bare-string-decoder
`string_decoder` shim for Bare
stable
Source
Source
Source
bare-string-decoder — string_decoder shim for Bare.
npm i bare-string-decoderAPI
StringDecoder
new StringDecoder(encoding: BufferEncoding)
Source
Create a StringDecoder for the given encoding.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
encoding | BufferEncoding | — | The character encoding the bytes are decoded from (a BufferEncoding such as 'utf8' or 'utf16le'). |
end(buffer: string | Buffer): string
Source
Decode any remaining buffered bytes together with buffer and return the resulting string, flushing incomplete sequences.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
buffer | string | Buffer | — | A final chunk of bytes to decode together with any bytes buffered from previous calls. |
Returns string — The decoded string, including any bytes buffered from previous calls.
write(buffer: string | Buffer): string
Source
Decode buffer and return the resulting string, retaining any trailing incomplete multi-byte sequence to be completed by a subsequent call.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
buffer | string | Buffer | — | The bytes to decode. |
Returns string — The decoded string, excluding any trailing incomplete multi-byte sequence, which is buffered for the next call.
See also
- Bare modules — the full
bare-*catalog. - Bare runtime API — the runtime these modules extend.