function isBuffer
Usage in Deno
import { isBuffer } from "node:util";
isBuffer(object: unknown): object is Buffer
Deprecated
Since v4.0.0 - Use isBuffer
instead.
Returns true
if the given object
is a Buffer
. Otherwise, returns false
.
import util from 'node:util';
util.isBuffer({ length: 0 });
// Returns: false
util.isBuffer([]);
// Returns: false
util.isBuffer(Buffer.from('hello world'));
// Returns: true
object is Buffer