Browse Source

fs: Remove unused branches

a few places the code was refactored to use `maybeCallback` which
always returns a function. Checking for `if (callback)` always
returns true anyway.

PR-URL: https://github.com/nodejs/node/pull/5289
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: thefourtheye <thechargingvolcano@gmail.com>
v4.x
Benjamin Gruenbaum 9 years ago
committed by Myles Borins
parent
commit
56dda6f336
  1. 4
      lib/fs.js

4
lib/fs.js

@ -1098,7 +1098,7 @@ function writeAll(fd, buffer, offset, length, position, callback_) {
fs.write(fd, buffer, offset, length, position, function(writeErr, written) {
if (writeErr) {
fs.close(fd, function() {
if (callback) callback(writeErr);
callback(writeErr);
});
} else {
if (written === length) {
@ -1131,7 +1131,7 @@ fs.writeFile = function(path, data, options, callback_) {
var flag = options.flag || 'w';
fs.open(path, flag, options.mode, function(openErr, fd) {
if (openErr) {
if (callback) callback(openErr);
callback(openErr);
} else {
var buffer = (data instanceof Buffer) ? data : new Buffer('' + data,
options.encoding || 'utf8');

Loading…
Cancel
Save