Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4762399

Browse filesBrowse files
Meyitotargos
authored andcommitted
doc: add example for Buffer.isEncoding()
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>
1 parent 818f084 commit 4762399
Copy full SHA for 4762399

File tree

Expand file treeCollapse file tree

1 file changed

+14
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-0
lines changed
Open diff view settings
Collapse file

‎doc/api/buffer.md‎

Copy file name to clipboardExpand all lines: doc/api/buffer.md
+14Lines changed: 14 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.