Verify if a variable references a Buffer [Node.js]
The Buffer
class exposes a static method isBuffer(arg)
which returns true if the argument to this function is a Buffer instance.
const buf = Buffer.from([25, 45, 90]);
console.log( Buffer.isBuffer(buf) );
// true
Node.js
- Nkemtakeh C.
- 2022-03-08
Recent
- Unable to transpile a typescript file imported from a git submodule directory (that has a package.json)
- TS2307: Cannot find module '@app/express-base' or its corresponding type declarations when using paths
- Typescript paths not working with ts-node
- Cannot find name 'describe' Typescript error
- Typescript error: Return type of exported function has or is using private name 'X'