Socket
Socket
Sign inDemoInstall

is-buffer

Package Overview
Dependencies
0
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-buffer

Determine if an object is a Buffer


Version published
Maintainers
1
Weekly downloads
32,929,392
decreased by-10.31%

Weekly downloads

Package description

What is is-buffer?

The is-buffer npm package is a simple utility module used to determine if an object is a Node.js Buffer. This package is particularly useful when working with modules that are designed to work both in the browser and Node.js, where the Buffer class is not available in the global scope in the browser.

What are is-buffer's main functionalities?

Buffer Detection

This feature allows you to check if a given object is an instance of a Buffer. The function returns true if the object is a Buffer, and false otherwise.

var isBuffer = require('is-buffer');
var buffer = new Buffer('This is a buffer');
var notBuffer = {};
console.log(isBuffer(buffer)); // true
console.log(isBuffer(notBuffer)); // false

Other packages similar to is-buffer

Readme

Source

is-buffer travis npm downloads javascript style guide

Determine if an object is a Buffer (including the browserify Buffer)

saucelabs

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)) // true
isBuffer(Buffer.alloc(4)) //true

isBuffer(undefined) // false
isBuffer(null) // false
isBuffer('') // false
isBuffer(true) // false
isBuffer(false) // false
isBuffer(0) // false
isBuffer(1) // false
isBuffer(1.0) // false
isBuffer('string') // false
isBuffer({}) // false
isBuffer(function foo () {}) // false

license

MIT. Copyright (C) Feross Aboukhadijeh.

Keywords

FAQs

Last updated on 03 Nov 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc