Skip to content
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.

[doc] include full options for createWriteStream? #4367

Closed
@DTrejo

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?

  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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions