You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
572 B
19 lines
572 B
import { request } from "@/components/service/index";
|
|
|
|
import { saveBlob, filenameFromContentDisposition } from "@/utils/download";
|
|
export const MinioService = {
|
|
async download(objectName: string) {
|
|
const res = await request.getFile("/api/minio/download", {
|
|
objectName,
|
|
type: "type2",
|
|
});
|
|
|
|
const blob: Blob = res.data;
|
|
const cd = res.headers?.["content-disposition"];
|
|
const fallback = objectName.split("/").pop() || "download.bin";
|
|
const filename = filenameFromContentDisposition(cd, fallback);
|
|
|
|
saveBlob(blob, filename);
|
|
},
|
|
};
|