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 <[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]>
  • 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.