Fix for windows

pull/2/head
Louis Chatriot 9 years ago
parent fea5c25807
commit 94cac41acb
  1. 4
      lib/storage.js

@ -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) {

Loading…
Cancel
Save