
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
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==";
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
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
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 stringhex - Encodes the data as a hex stringarray - Encodes the data as a numeric array of bytesFAQs
Tool to convert binary files to require-able JS files
We found that binquire demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.