New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

npm-file

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-file

Specify a path within an npm package: download and extract it, returning a local path for reading

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

npm-file experimental

Specify a path within an npm package: download and extract it, returning a local path for reading.

Usage

NPM

get = npmfile(cache, resolve)

Returns a function you can use to get files from packages on npm. Takes the following arguments, both of which are optional:

  • cache: the directory to store modules on the filesystem. Defaults to .npm-files.
  • resolve: a custom module resolution function. Defaults to resolve, and expects the same function signature.
var resolve  = require('glsl-resolve')
var cachedir = __dirname + '/.cache'
var getnpm   = require('npm-file')(cachedir, resolve)

get(package, version, filename, got)

Retrieves a file from npm. Takes the following arguments:

  • package: the name of the package on npm.
  • version: a semver version range. May also be a fixed version, or * or latest.
  • filename: the module in the package to retrieve. Uses the previously defined resolve function, so you can omit file extensions if you so please.
  • got(err, path): is called when complete, returning the file path of the target module.

License

MIT. See LICENSE.md for details.

Keywords

npm

FAQs

Package last updated on 27 Jul 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