Skip to content

Commit dfa2d2d

Browse files
committed
squash: add docs
1 parent c78d989 commit dfa2d2d

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

doc/api/buffer.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,39 @@ appropriate for `Buffer.from()` variants.
14191419
[`Buffer.from(string)`][] may also use the internal `Buffer` pool like
14201420
[`Buffer.allocUnsafe()`][] does.
14211421

1422+
### Static method: `Buffer.fromBase64(base64string[, options])`
1423+
1424+
<!-- YAML
1425+
added: REPLACEME
1426+
-->
1427+
1428+
* `base64string` {string} A base64 string to decode.
1429+
* `options` {Object}
1430+
* `alphabet` {string} One of `'base64'` (default) or `'base64url'`.
1431+
* `lastChunkHandling` {string} One of `'loose'` (default), `'strict'`, or `'stop-before-partial'`.
1432+
* Returns: {Buffer}
1433+
1434+
This static method is same as [`Uint8Array.fromBase64()`][], except it
1435+
returns `Buffer` rather than `Uint8Array`.
1436+
1437+
This is not exactly the same as `Buffer.from(base64string, 'base64')`,
1438+
and this function will throw `SyntaxError` if input contains non-base64 symbols.
1439+
1440+
### Static method: `Buffer.fromHex(string)`
1441+
1442+
<!-- YAML
1443+
added: REPLACEME
1444+
-->
1445+
1446+
* `string` {string} A hexadecimal string to decode.
1447+
* Returns: {Buffer}
1448+
1449+
This static method is same as [`Uint8Array.fromHex()`][], except it
1450+
returns `Buffer` rather than `Uint8Array`.
1451+
1452+
This is not exactly the same as `Buffer.from(hexstring, 'hex')`,
1453+
and this function will throw `SyntaxError` if input contains non-hex symbols.
1454+
14221455
### Static method: `Buffer.isBuffer(obj)`
14231456

14241457
<!-- YAML
@@ -5540,6 +5573,8 @@ introducing security vulnerabilities into an application.
55405573
[`TypedArray.prototype.set()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set
55415574
[`TypedArray.prototype.slice()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice
55425575
[`TypedArray.prototype.subarray()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray
5576+
[`Uint8Array.fromBase64()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/fromBase64
5577+
[`Uint8Array.fromHex()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/fromBase64
55435578
[`buf.buffer`]: #bufbuffer
55445579
[`buf.compare()`]: #bufcomparetarget-targetstart-targetend-sourcestart-sourceend
55455580
[`buf.entries()`]: #bufentries

0 commit comments

Comments
 (0)