axios-downloader
v1.0.4
Published
- π³βπ **Downloading size**: Monitor download size - π¦ **Downloading downloadProgress**: Monitor downloadProgress downloadProgress - β‘ **Downloading cancel**: Cancel download
Downloads
8
Readme
π Features
- π³βπ Downloading size: Monitor download size
- π¦ Downloading downloadProgress: Monitor downloadProgress downloadProgress
- β‘ Downloading cancel: Cancel download
π¦ Install
npm i axios-downloader
π¦ Usage
import { ref } from 'vue'
import axios from 'axios'
import AxDownLoader from 'axios-downloader'
// Options
const AxDownLoaderOption = ref({
url: 'https://images.unsplash.com/photo-1663529628961-80aa6ebcd157?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=764&q=80',
fileName: 'test',
fileSize: 0,
downloadSize: 0,
downloadProgress: 0,
cancel: null,
})
// downLoad
const downLoad = function () {
AxDownLoader(AxDownLoaderOption.value)
.then((res) => {
console.log('downLoad success', res)
})
.catch((err) => {
console.log('downLoad faild', err)
})
}
// cancel
const cancel = function () {
AxDownLoaderOption.value.cancel()
}