Socket
Socket
Sign inDemoInstall

pacote

Package Overview
Dependencies
Maintainers
1
Versions
220
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pacote

JavaScript package downloader


Version published
Weekly downloads
6.9M
decreased by-5.35%
Maintainers
1
Weekly downloads
 
Created

What is pacote?

Pacote is a Node.js library that provides a set of utilities for fetching and extracting npm packages. It is designed to handle various types of package sources, including the npm registry, tarballs, git repositories, and local directories. Pacote is often used internally by npm and other tools to manage package dependencies.

What are pacote's main functionalities?

Fetch Package Metadata

This feature allows you to fetch the metadata of a package from the npm registry. The code sample demonstrates how to fetch and log the metadata for the 'lodash' package.

const pacote = require('pacote');

async function fetchMetadata(packageName) {
  const manifest = await pacote.manifest(packageName);
  console.log(manifest);
}

fetchMetadata('lodash');

Extract Package Tarball

This feature allows you to fetch and extract the tarball of a package. The code sample demonstrates how to fetch the tarball for the 'lodash' package and save it to a file named 'lodash.tgz'.

const pacote = require('pacote');
const fs = require('fs');

async function extractTarball(packageName, destination) {
  const tarballStream = await pacote.tarball.stream(packageName);
  tarballStream.pipe(fs.createWriteStream(destination));
}

extractTarball('lodash', './lodash.tgz');

Fetch Package from Git Repository

This feature allows you to fetch a package directly from a git repository. The code sample demonstrates how to fetch and log the metadata for the 'lodash' package from its GitHub repository.

const pacote = require('pacote');

async function fetchFromGit(repoUrl) {
  const manifest = await pacote.manifest(repoUrl);
  console.log(manifest);
}

fetchFromGit('https://github.com/lodash/lodash.git');

Other packages similar to pacote

Keywords

FAQs

Package last updated on 12 May 2017

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