This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
Closed
Description
Currently the docs say that these are the defaults for createWriteStream
:
{ flags: 'w',
encoding: null,
mode: 0666 }
The true defaults are the following:
{ flags: 'w',
// see https://github.com/joyent/node/blob/master/lib/fs.js#L1537
+ encoding: 'binary',
// mixed in by https://github.com/joyent/node/blob/master/lib/fs.js#L1547
+ fd: null, // when passed in leads to same behavior as createReadStream's `fd` arg
mode: 0666
}
Shall I send in a pull request for the following?
- add the fd argument
- change to encoding: 'binary' for both read and write streams
- Give an updated list of allowed encodings, along with explanations if needed:
via https://github.com/joyent/node/blob/master/lib/buffer.js#L278
case 'hex':
case 'utf8':
case 'utf-8':
case 'ascii':
case 'binary':
case 'base64':
case 'ucs2':
case 'ucs-2':
case 'utf16le':
case 'utf-16le':
case 'raw':
Thanks for the feedback — don't want to write things and have them be wrong or never merged!
David Trejo