1.0.1 • Published 7 years ago
generate-download-link v1.0.1
Download Link Generator
With this package, you can easily generate links for downloading content as files. generate-download-link returns a DOM element like the following:
<a href="data:application/octet-stream,DATA" download="FILENAME">TITLE</a>
Specify the
- Content of the file as a string,
- The filename to be used
- The title of the anchor element.
When the element is clicked, a file is downloaded and saved as FILENAME.
Usage
var generateDownloadLink = require('generate-download-link');
var opt = {
data: 'Here is the content of the file',
title: 'Click to download your file',
filename: 'example.txt'
};
var anchor = generateDownloadLink(opt);
1.0.1
7 years ago