Socket
Socket
Sign inDemoInstall

pkg-fetch

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pkg-fetch

Compiles and stores base binaries for pkg


Version published
Weekly downloads
172K
increased by5.04%
Maintainers
1
Weekly downloads
 
Created

What is pkg-fetch?

The pkg-fetch npm package is used to fetch and cache Node.js binaries for the pkg project. It is primarily used to download Node.js binaries that are compatible with the pkg tool, which allows you to package Node.js applications into standalone executables.

What are pkg-fetch's main functionalities?

Fetch Node.js binaries

This feature allows you to fetch a specific version of Node.js binaries for a given platform and architecture. The code sample demonstrates how to fetch Node.js version 14.15.1 for a Linux x64 system.

const fetch = require('pkg-fetch');

(async () => {
  const nodeVersion = 'node-v14.15.1';
  const platform = 'linux';
  const arch = 'x64';
  const binaryPath = await fetch.need({ nodeRange: nodeVersion, platform, arch });
  console.log(`Binary path: ${binaryPath}`);
})();

Cache management

This feature provides access to the cache path where the fetched binaries are stored. The code sample shows how to retrieve and print the cache path.

const fetch = require('pkg-fetch');

(async () => {
  const cachePath = fetch.system.cache;
  console.log(`Cache path: ${cachePath}`);
})();

Check for binary existence

This feature allows you to check if a specific Node.js binary already exists in the cache. The code sample demonstrates how to check for the existence of Node.js version 14.15.1 for a Linux x64 system.

const fetch = require('pkg-fetch');

(async () => {
  const nodeVersion = 'node-v14.15.1';
  const platform = 'linux';
  const arch = 'x64';
  const exists = await fetch.exists({ nodeRange: nodeVersion, platform, arch });
  console.log(`Binary exists: ${exists}`);
})();

Other packages similar to pkg-fetch

FAQs

Package last updated on 10 Apr 2023

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