-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.docIssues and PRs related to the documentations.Issues and PRs related to the documentations.stalledIssues and PRs that are stalled.Issues and PRs that are stalled.
Description
- Version: Node v6.5.0
- Platform: OS X 10.11
- Subsystem: Buffer
Buffer.from
silently ignores decoding errors.
Buffer.from('aGVsbG8=', 'base64') // valid base64 string
// => hello
Buffer.from('aGV sbG8=', 'base64') // invalid base64 string
// => hello
I know this is now the expected behavior but it would be useful, e.g. when writing parsers for strict protocols, to have a Buffer.safeFrom
which throws on decoding errors. It could also be passed as a parameter, e.g.: Buffer.from(str, [encoding, throwOnError])
.
Ginden, FINDarkside, higleyc, visortelle, leandro-manifesto and 2 more
Metadata
Metadata
Assignees
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.docIssues and PRs related to the documentations.Issues and PRs related to the documentations.stalledIssues and PRs that are stalled.Issues and PRs that are stalled.