Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
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.
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');
}
});
}
});
node-gyp is a cross-platform command-line tool written in Node.js for compiling native addon modules for Node.js. It is similar to bin-build in that it helps automate the build process, but it is specifically designed for compiling Node.js native addons.
prebuild is a tool for building and publishing prebuilt binaries for Node.js native addons. It is similar to bin-build in that it helps with the build process, but it focuses on creating and distributing prebuilt binaries to avoid the need for users to compile the code themselves.
node-pre-gyp is a Node.js tool that allows you to publish and install Node.js C++ addons from binaries. It is similar to bin-build in that it helps with the build and installation process, but it also includes features for packaging and distributing prebuilt binaries.
Easily build binaries
$ npm install --save bin-build
var BinBuild = require('bin-build');
var build = new BinBuild()
.src('http://www.lcdf.org/gifsicle/gifsicle-1.80.tar.gz')
.cmd('./configure --disable-gifview --disable-gifdiff')
.cmd('make install');
build.run(function (err) {
console.log('gifsicle built successfully');
});
Creates a new BinBuild
instance.
Type: number
Strip a number of leading paths from file names on extraction.
Type: string
Accepts a URL to a archive containing the source code, a path to an archive or a path to a directory containing the source code.
Type: string
Add a command to run when building.
Type: function
Runs the build and returns an error if something has gone wrong
MIT © Kevin Mårtensson
FAQs
Easily build binaries
The npm package bin-build receives a total of 0 weekly downloads. As such, bin-build popularity was classified as not popular.
We found that bin-build demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.