doc: add example for Buffer.isEncoding()
PR-URL: https://github.com/nodejs/node/pull/28360 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
d4549e75d4
commit
c81062a908
@ -951,6 +951,20 @@ added: v0.9.1
|
|||||||
Returns `true` if `encoding` contains a supported character encoding, or `false`
|
Returns `true` if `encoding` contains a supported character encoding, or `false`
|
||||||
otherwise.
|
otherwise.
|
||||||
|
|
||||||
|
```js
|
||||||
|
console.log(Buffer.isEncoding('utf-8'));
|
||||||
|
// Prints: true
|
||||||
|
|
||||||
|
console.log(Buffer.isEncoding('hex'));
|
||||||
|
// Prints: true
|
||||||
|
|
||||||
|
console.log(Buffer.isEncoding('utf/8'));
|
||||||
|
// Prints: false
|
||||||
|
|
||||||
|
console.log(Buffer.isEncoding(''));
|
||||||
|
// Prints: false
|
||||||
|
```
|
||||||
|
|
||||||
### Class Property: Buffer.poolSize
|
### Class Property: Buffer.poolSize
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v0.11.3
|
added: v0.11.3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user