Compare commits
No commits in common. "b866ffdd49a5134fec2c55f867b22c966bb0c5c4" and "e5175568088cf24077837dcd88e7c7dcde3e0e85" have entirely different histories.
b866ffdd49
...
e517556808
|
@ -40,11 +40,3 @@ export function deleteTaskStudy(params) {
|
||||||
params
|
params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 获取iqc下载文件信息
|
|
||||||
export function getCRCUploadedStudyInfo(data) {
|
|
||||||
return request({
|
|
||||||
url: '/DownloadAndUpload/getCRCUploadedStudyInfo',
|
|
||||||
method: 'post',
|
|
||||||
data
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -13,8 +13,6 @@ let timer = null, // 网速定时器
|
||||||
export function AWSclose() {
|
export function AWSclose() {
|
||||||
if (timer) {
|
if (timer) {
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
timer = null;
|
|
||||||
store.state.trials.uploadTip = '0kb/s'
|
|
||||||
}
|
}
|
||||||
bytesReceivedPerSecond = {};
|
bytesReceivedPerSecond = {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,6 @@ let savaData = {},
|
||||||
export function OSSclose() {
|
export function OSSclose() {
|
||||||
if (timer) {
|
if (timer) {
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
timer = null;
|
|
||||||
store.state.trials.uploadTip = '0kb/s'
|
|
||||||
}
|
}
|
||||||
bytesReceivedPerSecond = {};
|
bytesReceivedPerSecond = {};
|
||||||
savaData = {};
|
savaData = {};
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
import streamSaver from "streamsaver";
|
|
||||||
import "streamsaver/examples/zip-stream.js";
|
|
||||||
|
|
||||||
// 下载文件并压缩
|
|
||||||
function zipFiles(zipName, files) {
|
|
||||||
console.log("同步下载打包开始时间:" + new Date());
|
|
||||||
// 创建压缩文件输出流
|
|
||||||
const zipFileOutputStream = streamSaver.createWriteStream(zipName);
|
|
||||||
// 创建下载文件流
|
|
||||||
const fileIterator = files.values();
|
|
||||||
const readableZipStream = new ZIP({
|
|
||||||
async pull(ctrl) {
|
|
||||||
const fileInfo = fileIterator.next();
|
|
||||||
if (fileInfo.done) {//迭代终止
|
|
||||||
ctrl.close();
|
|
||||||
} else {
|
|
||||||
const { name, url } = fileInfo.value;
|
|
||||||
return fetch(url).then(res => {
|
|
||||||
ctrl.enqueue({
|
|
||||||
name,
|
|
||||||
stream: () => res.body
|
|
||||||
});
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (window.WritableStream && readableZipStream.pipeTo) {
|
|
||||||
// 开始下载
|
|
||||||
readableZipStream
|
|
||||||
.pipeTo(zipFileOutputStream)
|
|
||||||
.then(() => console.log("同步下载打包结束时间:" + new Date()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 下载文件并修改名称
|
|
||||||
async function updateFile(file, name) {
|
|
||||||
try {
|
|
||||||
const fileOutputStream = streamSaver.createWriteStream(name);
|
|
||||||
let res = await fetch(file);
|
|
||||||
res.body.pipeTo(fileOutputStream);
|
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export function downLoadFile(file, name, type = 'file') {
|
|
||||||
if (type === 'zip') return zipFiles(name, file);
|
|
||||||
return updateFile(file, name)
|
|
||||||
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue