Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.
/ tmpdl Public archive

Download a remote file to a temporary location

License

Notifications You must be signed in to change notification settings

mike182uk/tmpdl

Repository files navigation

⚠️ 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.