node package manager
Love JavaScript? Your insights can make it even better. Take the 2017 JavaScript Ecosystem Survey ยป


tubule - copy files from URI stream

The tubule Node.js module is a Transform stream that uses http or https to get files from URIs written to it. As the files are copied to a local directory, tubule emits the paths of the completed downloads.

Build Status


To download all images from

var http = require('http')
  , tubule = require('tubule')
  , cop = require('cop')
  , scrim = require('scrim')
  , dir = '/tmp/tubule-' + Math.floor(Math.random() * (1<<24))

http.get('', function (res) {
    .on('error', console.error)
    .on('error', console.error)
    .pipe(cop(function (uri) { return uri + '\n' }))

function abs (uri) {
  return uri.toString().substr(0,4) === 'http' ? uri : null


The tubule module exports a single function that returns a Transform stream.

  • dir The target directory to write the files


Install with npm:

npm install tubule


MIT License