Spaces:
Running
Running
Commit
·
8cc5a5a
1
Parent(s):
09e13bb
removed actual mirroring and added console.log to get to the bottom of this server crash
Browse files- hf_server.js +11 -4
hf_server.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* All rights reserved.
|
4 |
*/
|
5 |
//@ts-check
|
6 |
-
const VERSION = '0.6.0.hf.014.
|
7 |
|
8 |
const express = require('express');
|
9 |
const http = require('http');
|
@@ -464,24 +464,31 @@ function startMirrorToDataDir()
|
|
464 |
watcher
|
465 |
.on('add', function(path) {
|
466 |
const targetFile = path.replace(sourceDir, targetDir);
|
|
|
|
|
467 |
fs.copyFile(path, targetFile, (err) => {
|
468 |
if (err) throw err;
|
469 |
-
|
470 |
-
})
|
471 |
})
|
472 |
.on('change', function(path) {
|
473 |
const targetFile = path.replace(sourceDir, targetDir);
|
|
|
|
|
474 |
fs.copyFile(path, targetFile, (err) => {
|
475 |
if (err) throw err;
|
476 |
console.log('File', path, 'has been changed and copied to', targetFile);
|
477 |
});
|
|
|
478 |
})
|
479 |
.on('unlink', function(path) {
|
480 |
const targetFile = path.replace(sourceDir, targetDir);
|
|
|
|
|
481 |
fs.unlink(targetFile, (err) => {
|
482 |
if (err) throw err;
|
483 |
console.log('File', path, 'has been removed');
|
484 |
-
})
|
485 |
});
|
486 |
|
487 |
return watcher;
|
|
|
3 |
* All rights reserved.
|
4 |
*/
|
5 |
//@ts-check
|
6 |
+
const VERSION = '0.6.0.hf.014.f';
|
7 |
|
8 |
const express = require('express');
|
9 |
const http = require('http');
|
|
|
464 |
watcher
|
465 |
.on('add', function(path) {
|
466 |
const targetFile = path.replace(sourceDir, targetDir);
|
467 |
+
console.log(`TargetFile = ${targetFile}. File ${path} would have been added and copied from ${sourceDir} to ${targetDir}`);
|
468 |
+
/*
|
469 |
fs.copyFile(path, targetFile, (err) => {
|
470 |
if (err) throw err;
|
471 |
+
console.log('File', path, 'has been added and copied to', targetFile);
|
472 |
+
});*/
|
473 |
})
|
474 |
.on('change', function(path) {
|
475 |
const targetFile = path.replace(sourceDir, targetDir);
|
476 |
+
console.log(`TargetFile = ${targetFile}. File ${path} would have been changed and copied from ${sourceDir} to ${targetDir}`);
|
477 |
+
/*
|
478 |
fs.copyFile(path, targetFile, (err) => {
|
479 |
if (err) throw err;
|
480 |
console.log('File', path, 'has been changed and copied to', targetFile);
|
481 |
});
|
482 |
+
*/
|
483 |
})
|
484 |
.on('unlink', function(path) {
|
485 |
const targetFile = path.replace(sourceDir, targetDir);
|
486 |
+
console.log(`TargetFile = ${targetFile}. File ${path} would have been removed from ${targetDir}`);
|
487 |
+
/*
|
488 |
fs.unlink(targetFile, (err) => {
|
489 |
if (err) throw err;
|
490 |
console.log('File', path, 'has been removed');
|
491 |
+
});*/
|
492 |
});
|
493 |
|
494 |
return watcher;
|