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:
Angie M. Delgado authored and Michaël Zasso committed 2019-07-02 09:07:54 +02:00
1 parent 818f08416c
commit 4762399aca
1 file changed
+14
+14
View File
@@ -951,6 +951,20 @@ added: v0.9.1
Returns `true` if `encoding` contains a supported character encoding, or `false`
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
<!-- YAML
added: v0.11.3