Browse Source

fixes lib/file.js write, it doesnt allways emit errors or success

v0.7.4-release
Onne 15 years ago
committed by Ryan Dahl
parent
commit
9d39e18c6d
  1. 2
      lib/file.js

2
lib/file.js

@ -29,10 +29,12 @@ exports.write = function (filename, data, encoding) {
posix.write(fd, _data, 0, encoding)
.addErrback(function () {
posix.close(fd);
promise.emitError();
})
.addCallback(function (written) {
if (written === _data.length) {
posix.close(fd);
promise.emitSuccess();
} else {
doWrite(_data.slice(written));
}

Loading…
Cancel
Save