is-buffer
Why not use Buffer.isBuffer
?
This module lets you check if an object is a Buffer
without using Buffer.isBuffer
(which includes the whole buffer module in browserify).
It's future-proof and works in node too!
install
npm install is-buffer
usage
var isBuffer = require('is-buffer')
isBuffer(new Buffer(4))
isBuffer(Buffer.alloc(4))
isBuffer(undefined)
isBuffer(null)
isBuffer('')
isBuffer(true)
isBuffer(false)
isBuffer(0)
isBuffer(1)
isBuffer(1.0)
isBuffer('string')
isBuffer({})
isBuffer(function foo () {})
license
MIT. Copyright (C) Feross Aboukhadijeh.