downloadts
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i downloadts

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

2.56 kB

Total Files

4

Last publish

Collaborators

  • ej-shafran