Socket
Socket
Sign inDemoInstall

snyk-resolve

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snyk-resolve

Resolves the location of a node package given a path


Version published
Weekly downloads
140K
decreased by-1.02%
Maintainers
2
Weekly downloads
 
Created
Source

snyk-resolve

Finds the filename for a given package name and starting directory. This is used to resolve packages in situations like npm@3 and deduped packages.

Supports both async (via promises) and sync methods of looking up.

Usage

var resolve = require('snyk-resolve');

// async (promise based)
resolve('foo', process.cwd()).then(function (dir) {
  // assuming that `foo` lived in the root of your drive
  console.assert(dir === '/node_modules/foo');
});

// sync
var dir = resolve.sync('bar', process.cwd());
// throws Error('package not found bar')

See tests for more examples.

Supports

  • npm@2 directory structure
  • npm@3 directory structure
  • deduped modules
  • scoped modules

Keywords

FAQs

Package last updated on 21 Jul 2020

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