🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

bin-wrapper

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bin-wrapper

Binary wrapper that makes your programs seamlessly available as local dependencies

4.1.0
latest
Version published
Weekly downloads
765K
1.62%
Maintainers
3
Weekly downloads
 
Created

What is bin-wrapper?

The bin-wrapper npm package is a utility that helps you download and manage binaries for your Node.js projects. It allows you to specify a binary, download it if necessary, and make it available for use in your project. This is particularly useful for ensuring that the correct version of a binary is used, regardless of the environment in which your code is running.

What are bin-wrapper's main functionalities?

Download and manage binaries

This feature allows you to specify different sources for binaries based on the operating system and architecture. The code sample demonstrates how to set up a BinWrapper instance to download the gifsicle binary for different platforms and run it to check its version.

const BinWrapper = require('bin-wrapper');
const path = require('path');

const base = 'https://raw.githubusercontent.com/imagemin/gifsicle-bin/main/vendor';
const bin = new BinWrapper()
  .src(`${base}/macos/gifsicle`, 'darwin')
  .src(`${base}/linux/x64/gifsicle`, 'linux', 'x64')
  .src(`${base}/win/x64/gifsicle.exe`, 'win32', 'x64')
  .dest(path.join(__dirname, 'vendor'))
  .use(process.platform === 'win32' ? 'gifsicle.exe' : 'gifsicle');

bin.run(['--version']).then(() => {
  console.log('Binary is working');
}).catch(err => {
  console.error('Binary failed to run', err);
});

Other packages similar to bin-wrapper

FAQs

Package last updated on 07 Nov 2018

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