Skip to content

Commit 56dda6f

Browse files
benjamingrMyles Borins
authored andcommitted
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: #5289 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: thefourtheye <thechargingvolcano@gmail.com>
1 parent feedca7 commit 56dda6f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/fs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ function writeAll(fd, buffer, offset, length, position, callback_) {
10981098
fs.write(fd, buffer, offset, length, position, function(writeErr, written) {
10991099
if (writeErr) {
11001100
fs.close(fd, function() {
1101-
if (callback) callback(writeErr);
1101+
callback(writeErr);
11021102
});
11031103
} else {
11041104
if (written === length) {
@@ -1131,7 +1131,7 @@ fs.writeFile = function(path, data, options, callback_) {
11311131
var flag = options.flag || 'w';
11321132
fs.open(path, flag, options.mode, function(openErr, fd) {
11331133
if (openErr) {
1134-
if (callback) callback(openErr);
1134+
callback(openErr);
11351135
} else {
11361136
var buffer = (data instanceof Buffer) ? data : new Buffer('' + data,
11371137
options.encoding || 'utf8');

0 commit comments

Comments
 (0)