Skip to content

Commit

Permalink
doc: add example for Buffer.isEncoding()
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
Meyito authored and targos committed Jul 2, 2019
1 parent 818f084 commit 4762399
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4762399

Please sign in to comment.