|
|
|
@ -51,6 +51,10 @@ storage.flushToStorage = function (options, callback) { |
|
|
|
|
flags = options.isDir ? 'r' : 'r+'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Windows can't fsync (FlushFileBuffers) directories. We can live with this as it cannot cause 100% dataloss
|
|
|
|
|
// except in the very rare event of the first time database is loaded and a crash happens
|
|
|
|
|
if (flags === 'r' && (process.platform === 'win32' || process.platform === 'win64')) { return callback(null); } |
|
|
|
|
|
|
|
|
|
fs.open(filename, flags, function (err, fd) { |
|
|
|
|
if (err) { return callback(err); } |
|
|
|
|
fs.fsync(fd, function (errFS) { |
|
|
|
|