/tmpdl

Download a remote file to a temporary location

Primary LanguageJavaScriptMIT LicenseMIT

⚠️ This project is no longer maintained

tmpdl

Version Build Status Coveralls npm License

Download a remote file to a temporary location.

Installation

npm install --save tmpdl

Usage

const tmpdl = require('tmpdl')

try {
  const filepath = await tmpdl('http://www.example.com/some-awesome-image.jpg')

  // remote file successfully downloaded and stored
} catch (err) {
  // something went wrong
}

tmpdl will return a promise which will resolve to the path of the saved file. Any errors that occur during the download of the file, or the creation of the temporary directory that the remote file will be stored in, will cause the promise to reject.