diff options
author | James M Snell <jasnell@gmail.com> | 2021-08-08 21:24:11 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2021-08-14 17:23:54 +0300 |
commit | fcf8ba4269eb4b9984f9f0d926e0d8e0bd6d4382 (patch) | |
tree | f69d1efbd69fe5c2f5f7ff8f9aedde13587af4a4 /doc/api/buffer.md | |
parent | ca19775d0ee0ce0863b46e3c76f00f3018b1e19f (diff) |
buffer: add endings option, remove Node.js specific encoding option
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/39708
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'doc/api/buffer.md')
-rw-r--r-- | doc/api/buffer.md | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/doc/api/buffer.md b/doc/api/buffer.md index f419be1181a..0e4fefdf8ed 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -459,14 +459,20 @@ multiple worker threads. ### `new buffer.Blob([sources[, options]])` <!-- YAML added: v15.7.0 +changes: + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/39708 + description: Added the standard `endings` option to replace line-endings, + and removed the non-standard `encoding` option. --> * `sources` {string[]|ArrayBuffer[]|TypedArray[]|DataView[]|Blob[]} An array of string, {ArrayBuffer}, {TypedArray}, {DataView}, or {Blob} objects, or any mix of such objects, that will be stored within the `Blob`. * `options` {Object} - * `encoding` {string} The character encoding to use for string sources. - **Default:** `'utf8'`. + * `endings` {string} One of either `'transparent'` or `'native'`. When set + to `'native'`, line endings in string source parts will be converted to + the platform native line-ending as specified by `require('os').EOL`. * `type` {string} The Blob content-type. The intent is for `type` to convey the MIME media type of the data, however no validation of the type format is performed. @@ -476,7 +482,9 @@ Creates a new `Blob` object containing a concatenation of the given sources. {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into the 'Blob' and can therefore be safely modified after the 'Blob' is created. -String sources are also copied into the `Blob`. +String sources are encoded as UTF-8 byte sequences and copied into the Blob. +Unmatched surrogate pairs within each string part will be replaced by Unicode +U+FFFD replacement characters. ### `blob.arrayBuffer()` <!-- YAML |