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 400,000 packages pre-installed, including save-to with all npm packages installed. Try it out:

var saveTo = require("save-to")

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

save-to v1.0.3

Save a stream to a file

Save to ______ Build Status

Save a stream to a file.

API

var saveTo = require('save-to')
var stream = fs.createReadStream('some file.txt')

saveTo(stream, 'destination.txt', function (err, destination) {
  if (err) throw err
})

saveTo(stream [, destination] [, options], callback)

  • stream is the source stream, for example a request.
  • destination is the path where the stream will be saved.
  • callback(err, destination)

The options are:

  • destination - if you don't specify destination as an argument.
  • length - expected byte length. Throws an error if it does not match the stream's length.
  • limit - maximum byte length. Throws an error if the stream is larger than this size.

Metadata

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