1. libnpmpack
Programmatic API for the bits behind npm pack
libnpmpack
Package: libnpmpack
Created by: npm
Last modified: Tue, 30 Apr 2024 21:57:51 GMT
Version: 7.0.1
License: ISC
Downloads: 2,283,771
Repository: https://github.com/npm/cli

Install

npm install libnpmpack
yarn add libnpmpack

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('[email protected]')

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

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code