Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

has-binary

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

has-binary

A function that takes anything in javascript and returns true if its argument contains binary data.

  • 0.1.5
  • npm
  • Socket score

Version published
Weekly downloads
216K
decreased by-47.94%
Maintainers
1
Weekly downloads
 
Created

What is has-binary?

The has-binary npm package is a utility that checks if a given JavaScript object or array contains any binary data. This can be useful in various scenarios, such as when you need to determine if an object contains binary data before performing certain operations like serialization or transmission over a network.

What are has-binary's main functionalities?

Check if an object contains binary data

This feature allows you to check if a given object contains any binary data. In this example, the object contains a Buffer, which is binary data, so the function returns true.

const hasBinary = require('has-binary');
const obj = { key: 'value', buffer: Buffer.from('binary data') };
console.log(hasBinary(obj)); // true

Check if an array contains binary data

This feature allows you to check if a given array contains any binary data. In this example, the array contains a Uint8Array, which is binary data, so the function returns true.

const hasBinary = require('has-binary');
const arr = ['string', new Uint8Array([1, 2, 3])];
console.log(hasBinary(arr)); // true

Other packages similar to has-binary

FAQs

Package last updated on 04 Sep 2014

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc