Skip to content

Commit

Permalink
doc: adding example to Buffer.isBuffer method
Browse files Browse the repository at this point in the history
PR-URL: #36233
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
  • Loading branch information
ntedgi authored and targos committed May 1, 2021
1 parent 1d78d50 commit 6201f23
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/api/buffer.md
Expand Up @@ -730,6 +730,14 @@ added: v0.1.101

Returns `true` if `obj` is a `Buffer`, `false` otherwise.

```js
Buffer.isBuffer(Buffer.alloc(10)); // true
Buffer.isBuffer(Buffer.from('foo')); // true
Buffer.isBuffer('a string'); // false
Buffer.isBuffer([]); // false
Buffer.isBuffer(new Uint8Array(1024)); // false
```

### Static method: `Buffer.isEncoding(encoding)`
<!-- YAML
added: v0.9.1
Expand Down

0 comments on commit 6201f23

Please sign in to comment.