1.0.3 • Published 7 years ago
file-downloadr v1.0.3
file-downloadr :small_red_triangle_down:
A file downloader package top of request :zap:
Features
- Support Promise and async/ await :fire:
- Capture timeout errors :zap:
Installation
npm install file-downloadrOr
yarn add file-downloadrUsage
const fdownload = require("file-downloadr");
try {
fdownload(
"http://example/big-file.zip",
"/home/dummy/downloads/big-file.zip",
options
);
} catch (e) {
console.log("!! :( ", e);
}Or Promise API
const fdownload = require("file-downloadr");
fdownload(
"http://example/big-file.zip",
"/home/dummy/downloads/big-file.zip",
options
)
.then(res => console.log("File downloaded"))
.catch(error => console.log("Error downloading file"));Options
- method :string - http method (GET, POST..etc)
- timeout: number - time out in milli-seconds