Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including create-dependency-stream with all npm packages installed. Try it out:

var createDependencyStream = require("create-dependency-stream")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

create-dependency-stream v0.1.1

Create a stream of fully resolved dependencies from a package (and it's dependencies)



var createDependencyStream = require('create-dependency-stream')
var pkgJSON = require('./package.json'); 
var stream = createDependencyStream(pkgJSON, {
  registry: '' // optional

stream.on('data', console.log);
/* emits dependency objects like: */
{ name: 'request',
  versionRange: '2.x',
  version: '2.21.0',
  package: { /* .. parsed package.json contents .. */ },
  parent: { /* .. dependency object that included this dependency .. */ }
  dependencies: { /* .. mapping from dependency names to dependency object .. */ }


Given a parsed package.json with dependencies, this will create a stream of "dependency objects" containing the fully resolved versions and corresponding package.json contents for every dependency and every child dependency, in a way that (should be) completely compatible with npm.



RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free