Skip to content

Commit 4762399

Browse files
Meyitotargos
authored andcommitted
doc: add example for Buffer.isEncoding()
PR-URL: #28360 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 818f084 commit 4762399

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

doc/api/buffer.md

+14
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,20 @@ added: v0.9.1
951951
Returns `true` if `encoding` contains a supported character encoding, or `false`
952952
otherwise.
953953

954+
```js
955+
console.log(Buffer.isEncoding('utf-8'));
956+
// Prints: true
957+
958+
console.log(Buffer.isEncoding('hex'));
959+
// Prints: true
960+
961+
console.log(Buffer.isEncoding('utf/8'));
962+
// Prints: false
963+
964+
console.log(Buffer.isEncoding(''));
965+
// Prints: false
966+
```
967+
954968
### Class Property: Buffer.poolSize
955969
<!-- YAML
956970
added: v0.11.3

0 commit comments

Comments
 (0)