Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

download-to-file

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

download-to-file

Download a file to disk programmatically

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12K
decreased by-4.21%
Maintainers
1
Weekly downloads
 
Created
Source

download-to-file

Download a file to disk programmatically.

Build status js-standard-style

Installation

npm install download-to-file --save

Usage

var download = require('download-to-file')

console.log('Downloading to /tmp/example.html')
download('http://example.com/', '/tmp/example.html', function (err, filepath) {
  if (err) throw err
  console.log('Download finished:', filepath)
})

API

download(url, filepath, callback)

Will download the content of the given url and store it in a file specified by filepath. When done, the callback will be called with an optional error object as the first argument and the filepath as the second argument.

If the server does not return a 200 HTTP status code, the callback will be called with an error and the file will not be stored on disk.

License

MIT

Keywords

FAQs

Package last updated on 03 Dec 2017

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