js-file-download

WebJar for js-file-download

License

License

MIT
Categories

Categories

JavaScript Languages
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

js-file-download
Last Version

Last Version

0.4.12
Release Date

Release Date

Type

Type

jar
Description

Description

js-file-download
WebJar for js-file-download
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/kennethjiang/js-file-download

Download js-file-download

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/js-file-download/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>js-file-download</artifactId>
    <version>0.4.12</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/js-file-download/
implementation 'org.webjars.npm:js-file-download:0.4.12'
// https://jarcasting.com/artifacts/org.webjars.npm/js-file-download/
implementation ("org.webjars.npm:js-file-download:0.4.12")
'org.webjars.npm:js-file-download:jar:0.4.12'
<dependency org="org.webjars.npm" name="js-file-download" rev="0.4.12">
  <artifact name="js-file-download" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='js-file-download', version='0.4.12')
)
libraryDependencies += "org.webjars.npm" % "js-file-download" % "0.4.12"
[org.webjars.npm/js-file-download "0.4.12"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Javascript File Download

Javascript function to trigger browser to save data to file as if it was downloaded.

Installation

npm install js-file-download --save

Usage

var fileDownload = require('js-file-download');
fileDownload(data, 'filename.csv');

Binary downloads

When downloading binary data, the data must be a Blob, otherwise the downloaded file will be corrupted. For example, using Axios:

import Axios from axios;
import fileDownload from 'js-file-download';

function download(url: string, filename: string) {
  Axios.get(url, {
    responseType: 'blob',
  }).then(res => {
    fileDownload(res.data, filename);
  });
}

Versions

Version
0.4.12
0.4.11
0.4.9
0.4.8
0.4.7
0.4.5
0.4.4
0.4.1