Latest Threat Research:Malicious dYdX Packages Published to npm and PyPI After Maintainer Compromise.Details
Socket
Book a DemoInstallSign in
Socket

npm-tarball-globber

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-tarball-globber

Download files within npm packages and load them into memory

latest
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

npm-tarball-globber

Download files within npm packages and load them into memory

Here's what it does:

  • Fetches npm registry meadata for the given package;
  • Downloads the most recent tarball to /tmp;
  • Extracts the tarball to a directory in /tmp;
  • Synchronously loads all files that match the given glob pattern;
  • Executes given callback, passing an object with keys as filenames and values as stringified file contents.

Installation

Download node at nodejs.org and install it, if you haven't already.

npm install npm-tarball-globber --save

Usage

var getFiles = require("npm-tarball-globber")

// Get all the files in the `minimist` package
getFiles("minimist", function(err, files){
  console.log(err, Object.keys(files))
})

// Use globs to load only the files you need.
// See https://github.com/isaacs/minimatch#usage
getFiles("npm", "package/html/**/*.html", function(err, files){
  console.log(err, Object.keys(files))
})

Tests

npm install
npm test

Dependencies

  • glob: a little globber
  • superagent: elegant & feature rich browser / node HTTP with a fluent API
  • tarball-extract: A simple tarball download and extraction lib for node.

Dev Dependencies

  • mocha: simple, flexible, fun test framework

License

MIT

Generated by package-json-to-readme

FAQs

Package last updated on 30 Sep 2014

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