Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
address @BridgeAR's comments
  • Loading branch information
thefourtheye committed Oct 19, 2018
commit e2bca192337a54a55ffadccf73e6d18d3ef15856
4 changes: 2 additions & 2 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ function writeFile(path, data, options, callback) {
function writeFd(fd, isUserFd) {
const buffer = isArrayBufferView(data) ?
data : Buffer.from('' + data, options.encoding || 'utf8');
const position = /a/.test(flag) || isUserFd ? null : 0;
const position = (/a/.test(flag) || isUserFd) ? null : 0;

writeAll(fd, isUserFd, buffer, 0, buffer.byteLength, position, callback);
}
Expand All @@ -1209,7 +1209,7 @@ function writeFileSync(path, data, options) {
}
let offset = 0;
let length = data.byteLength;
let position = /a/.test(flag) || isUserFd ? null : 0;
let position = (/a/.test(flag) || isUserFd) ? null : 0;
try {
while (length > 0) {
const written = fs.writeSync(fd, data, offset, length, position);
Expand Down