require-stream

A stream that requires modules

Require stream

This stream receives module paths and emits the imported modules

var requireStream = require("require-stream");
var JSONStream    = require("JSONStream");
var eventStream   = require("event-stream");
 
var lineStream = eventStream.map(function(linenext) {
  next(false, line + "\n")
});
 
stream = requireStream();
 
stream.pipe(JSONStream.stringify(false)).pipe(lineStream).pipe(process.stdout);
stream.write("test");
stream.write("export");
stream.end()

The stream requireStream() function takes no arguments to initialize it and it just returns an instance of a require stream that reveives module paths and emits the imported modules

  • @returns {stream} - The module importing stream