diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 981c053ac40f0c..5f57bc10374d86 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -1419,6 +1419,39 @@ appropriate for `Buffer.from()` variants. [`Buffer.from(string)`][] may also use the internal `Buffer` pool like [`Buffer.allocUnsafe()`][] does. +### Static method: `Buffer.fromBase64(base64string[, options])` + + + +* `base64string` {string} A base64 string to decode. +* `options` {Object} + * `alphabet` {string} One of `'base64'` (default) or `'base64url'`. + * `lastChunkHandling` {string} One of `'loose'` (default), `'strict'`, or `'stop-before-partial'`. +* Returns: {Buffer} + +This static method is same as [`Uint8Array.fromBase64()`][], except it +returns `Buffer` rather than `Uint8Array`. + +This is not exactly the same as `Buffer.from(base64string, 'base64')`, +and this function will throw `SyntaxError` if input contains non-base64 symbols. + +### Static method: `Buffer.fromHex(string)` + + + +* `string` {string} A hexadecimal string to decode. +* Returns: {Buffer} + +This static method is same as [`Uint8Array.fromHex()`][], except it +returns `Buffer` rather than `Uint8Array`. + +This is not exactly the same as `Buffer.from(hexstring, 'hex')`, +and this function will throw `SyntaxError` if input contains non-hex symbols. + ### Static method: `Buffer.isBuffer(obj)`