js-save-file
v1.0.3
Published
download files to save locally by JavaScript.
Downloads
5
Readme
js-save-file
download files to save locally by JavaScript.
Installing
Using npm:
npm install js-save-file
Using script:
<script src="./dist/download.js"></script>
Example
import JSSaveFile from 'js-save-file'
const save = new JSSaveFile(url, '自定义下载图片名称')
save.init()
save.on('progress', ({ loaded, total }) => {
console.log(`总字节数:${total} 已加载字节数:${loaded}`)
})
save.on('error', () => {
console.log('下载失败')
})
save.on('complete', () => {
this.$message('下载完成')
})
License
MIT