Socket
Socket
Sign inDemoInstall

node-gyp-build

Package Overview
Dependencies
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-gyp-build

Build tool and bindings loader for node-gyp that supports prebuilds


Version published
Weekly downloads
14M
increased by5.05%
Maintainers
2
Weekly downloads
 
Created

What is node-gyp-build?

The node-gyp-build package is designed to simplify the process of compiling and distributing native Node.js addons. It automatically detects the platform and architecture of the user's system and chooses the correct pre-compiled binary to use, if available. If a pre-compiled binary is not available, it falls back to building from source using node-gyp.

What are node-gyp-build's main functionalities?

Loading pre-compiled binaries

This code attempts to load a pre-compiled binary for the native addon located in the same directory as the script. If a pre-compiled binary is not available for the current platform, it will attempt to compile the addon from source.

const nativeAddon = require('node-gyp-build')(__dirname)

Building from source

This code snippet demonstrates how to explicitly get the path to the correct binary and then require it. If the binary does not exist, node-gyp-build will attempt to compile the addon from source using the binding.gyp file located in the __dirname directory.

const path = require('path');
const nodeGypBuild = require('node-gyp-build');

const bindingPath = nodeGypBuild.path(__dirname);
const binding = require(bindingPath);

Other packages similar to node-gyp-build

FAQs

Package last updated on 28 Aug 2024

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