Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

[doc] include full options for createWriteStream? #4367

Closed
DTrejo opened this issue Dec 5, 2012 · 2 comments
Closed

[doc] include full options for createWriteStream? #4367

DTrejo opened this issue Dec 5, 2012 · 2 comments

Comments

@DTrejo
Copy link

DTrejo commented Dec 5, 2012

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?

  1. add the fd argument
  2. change to encoding: 'binary' for both read and write streams
  3. 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

@mscdex
Copy link

mscdex commented Dec 5, 2012

WriteStream's encoding is not actually used anywhere. It should be removed.

chrisdickinson pushed a commit that referenced this issue Dec 16, 2014
Clarify the fd option: it is preferred to the path parameter, omits
the "open" event if given, and is available on WriteStreams as well.

PR-URL: #7707
Fixes: #7707
Fixes: #7708
Fixes: #4367
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
@chrisdickinson
Copy link

The fd portion of this issue is addressed by #8001. Encoding is handled by the stream interface now -- closing this issue. Feel free to comment and I can reopen if I'm mistaken! Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants