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

bin-build

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bin-build

Easily build binaries

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
733K
decreased by-0.34%
Maintainers
2
Weekly downloads
 
Created

What is bin-build?

The bin-build npm package is a tool for building binaries using Node.js. It allows you to compile and install binaries from source, making it useful for developers who need to automate the process of building and installing command-line tools or other binary dependencies.

What are bin-build's main functionalities?

Building a binary from source

This feature allows you to build a binary from a source URL. The code sample demonstrates how to download a source tarball, configure the build, and run the build commands.

const BinBuild = require('bin-build');

const sourceUrl = 'https://example.com/source.tar.gz';
const buildCommands = [
  './configure --disable-shared',
  'make',
  'make install'
];

const builder = new BinBuild();
builder.src(sourceUrl)
  .cmd(buildCommands.join(' && '))
  .run((err) => {
    if (err) {
      console.error('Build failed:', err);
    } else {
      console.log('Build succeeded');
    }
  });

Customizing build environment

This feature allows you to customize the build environment by setting environment variables. The code sample shows how to set CFLAGS and LDFLAGS before running the build commands.

const BinBuild = require('bin-build');

const sourceUrl = 'https://example.com/source.tar.gz';
const buildCommands = [
  './configure --disable-shared',
  'make',
  'make install'
];

const builder = new BinBuild();
builder.src(sourceUrl)
  .cmd(buildCommands.join(' && '))
  .env({
    'CFLAGS': '-O2',
    'LDFLAGS': '-L/usr/local/lib'
  })
  .run((err) => {
    if (err) {
      console.error('Build failed:', err);
    } else {
      console.log('Build succeeded');
    }
  });

Checking for binary existence

This feature allows you to check if a binary exists after the build process. The code sample demonstrates how to run the build commands and then check for the existence of the binary.

const BinBuild = require('bin-build');

const builder = new BinBuild();
builder.src('https://example.com/source.tar.gz')
  .cmd('./configure && make && make install')
  .run((err) => {
    if (err) {
      console.error('Build failed:', err);
    } else {
      console.log('Build succeeded');
      builder.exists('path/to/binary', (exists) => {
        if (exists) {
          console.log('Binary exists');
        } else {
          console.log('Binary does not exist');
        }
      });
    }
  });

Other packages similar to bin-build

Keywords

FAQs

Package last updated on 17 Jun 2017

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