Socket
Socket
Sign inDemoInstall

isbinaryfile

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isbinaryfile

Detects if a file is binary in Node.js. Similar to Perl's -B.


Version published
Weekly downloads
4.6M
decreased by-19.72%
Maintainers
1
Weekly downloads
 
Created

What is isbinaryfile?

The isbinaryfile npm package is used to determine if a file is binary or text. This can be useful in various scenarios such as file processing, content analysis, and data validation.

What are isbinaryfile's main functionalities?

Check if a file is binary by file path

This feature allows you to check if a file is binary by providing the file path. The function returns a promise that resolves to a boolean indicating whether the file is binary.

const { isBinaryFile } = require('isbinaryfile');

(async () => {
  const result = await isBinaryFile('path/to/file');
  console.log(result); // true or false
})();

Check if a file is binary by buffer

This feature allows you to check if a file is binary by providing a buffer. The function returns a promise that resolves to a boolean indicating whether the file is binary.

const { isBinaryFile } = require('isbinaryfile');
const fs = require('fs');

(async () => {
  const buffer = fs.readFileSync('path/to/file');
  const result = await isBinaryFile(buffer);
  console.log(result); // true or false
})();

Other packages similar to isbinaryfile

FAQs

Package last updated on 19 Nov 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