downloadts
v1.0.0
Published
A tiny library for downloading files from the browser programatically.
Downloads
2
Readme
download-ts
A tiny NPM package that allows you to download files to the user's computer.
Installation
npm install download-ts
Usage
import { downlaod } from "download-ts";
// can be used to download using a URL
download("/images/banana.jpg");
// by default, this example will download a file and name it "banana.jpg",
// but you can change the name by passing a second parameter:
download("/images/banana.jpg", "not-a-banana.jpg");
// and for a third argument, you can pass an AxiosRequestConfig
download("http://www.my-proxy-server.com", "banana.jpg", {
headers: {
"Target-URL": "https://www.some-other-server.com/images/banana.jpg",
},
});
// or a blob
download(blob, "my-filename.txt"); // where `blob` is a Blob