🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.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.7
latest
npm
Version published
Weekly downloads
310K
-0.02%
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 19 Nov 2015

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