|
|
|
@ -38,6 +38,10 @@ storage.ensureFileDoesntExist = function (file, callback) { |
|
|
|
|
* Flush data in OS buffer to storage if corresponding option is set |
|
|
|
|
*/ |
|
|
|
|
storage.flushToStorage = function (filename, callback) { |
|
|
|
|
// Hate having to do this but I can't seem to make fs.fsync work on Windows, and still don't even know whether fsync can be used on Windows.
|
|
|
|
|
// See this issue: https://github.com/nodejs/node/issues/3879
|
|
|
|
|
if (process.platform === 'win32' || process.platform === 'win64') { return callback(); } |
|
|
|
|
|
|
|
|
|
fs.open(filename, 'r', function (err, fd) { |
|
|
|
|
if (err) { return callback(err); } |
|
|
|
|
fs.fsync(fd, function (err) { return callback(err); }); |
|
|
|
|