Libnpmpack
Programmatic API for the bits behind npm pack
Install / Use
/learn @npm/LibnpmpackREADME
We've Moved! 🚚
The code for this repo is now a workspace in the npm CLI repo.
You can find the workspace in /workspaces/libnpmpack
Please file bugs and feature requests as issues on the CLI and tag the issue with "ws:libnpmpack".
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
<a name="pack"></a> > 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')
Related Skills
node-connect
354.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
112.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
354.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
354.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
