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

binquire

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

binquire

Tool to convert binary files to require-able JS files

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

binquire - convert binary files to require-able JS files

binquire is a command-line utility (and underlying library) that takes binary files and encodes them as CommonJS modules. It can encode binary data as base64 strings (the most compact option), hex strings, or an array of numeric bytes. It produces a file with the format:

module.exports=BINARY;

where BINARY is the selected binary representation of your data.

For example, exporting a file in base64 format might result in the following output:

module.exports="aGVsbG8sIHdvcmxkCg==";

Installation

To use binquire as a command line tool, install it via npm install -g binquire

To use binquire locally as part of your project, install it as a dependency via npm install --save binquire

Command-line Usage

After installing binquire, you will have a binary of the same name available on your machine. The binquire binary is used in the following way:

binquire infile [outfile] [options]

where infile is the name of the binary file you wish to convert, outfile is the optional name of the output JavaScript file, and options are any of the available configuration options. If no outfile is specified, it will be sent to stdout. The default output format is a base64 string.

Supported options are:

  • --hex - Output as a hex string.
  • --array - Output as an array of numeric bytes.

So to output image.png to image-hex.js, in hex-string format, you would use the following command:

binquire image.png image-hex.js --hex

API Usage

require('binquire') also exports the core functionality as a programmable API. It exports a single function:

binquire(data, options)

data is a Node.js Buffer object containing the binary data you want to export.

options is an optional configuration object supporting the following keys:

  • type - The type of export format, supporting the following values:
    • base64 (default) - Encodes the data as a base64 string
    • hex - Encodes the data as a hex string
    • array - Encodes the data as a numeric array of bytes

FAQs

Package last updated on 25 Oct 2016

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