Socket
Socket
Sign inDemoInstall

libnpmpack

Package Overview
Dependencies
Maintainers
4
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libnpmpack

Programmatic API for the bits behind npm pack


Version published
Weekly downloads
607K
increased by3.59%
Maintainers
4
Weekly downloads
 
Created
Source

libnpmpack

npm version license CI - libnpmpack

libnpmpack is a Node.js library for programmatically packing tarballs from a local directory or from a registry or github spec. If packing from a local source, libnpmpack will also run the prepack and postpack lifecycles.

Table of Contents

Example

const pack = require('libnpmpack')

Install

$ npm install libnpmpack

API

> pack(spec, [opts]) -> Promise

Packs a tarball from a local directory or from a registry or github spec and returns a Promise that resolves to the tarball data Buffer, with from, resolved, and integrity fields attached.

If no options are passed, the tarball file will be saved on the same directory from which pack was called in.

libnpmpack uses pacote. Most options are passed through directly to that library, so please refer to its own opts documentation for options that can be passed in.

Examples
// packs from cwd
const tarball = await pack()

// packs from a local directory
const localTar = await pack('/Users/claudiahdz/projects/my-cool-pkg')

// packs from a registry spec
const registryTar = await pack('abbrev@1.0.3')

// packs from a github spec
const githubTar = await pack('isaacs/rimraf#PR-192')

FAQs

Package last updated on 29 May 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