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 <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
  • Loading branch information
ntedgi authored and danielleadams committed Dec 7, 2020
1 parent 66bc206 commit 65d89fd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,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 65d89fd

Please sign in to comment.