mirror of
https://github.com/KazooTTT/kazoottt-blog-v2.git
synced 2025-06-22 18:21:31 +08:00
1.6 KiB
1.6 KiB
toAstro, astroType, published, toWexin, toJuejin, toZhihu, title, date, author, tags, finished, slug, description, category, date_created, date_modified
toAstro | astroType | published | toWexin | toJuejin | toZhihu | title | date | author | tags | finished | slug | description | category | date_created | date_modified | |||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
true | null | true | null | null | null | file-downloader | 2024-02-18T00:00:00.000Z | KazooTTT |
|
true | file-downloader | 本文介绍了两个用于文件下载的函数:`downloadFileFromURL` 和 `downloadFileFromBlob`。`downloadFileFromURL` 函数用于从指定的URL下载文件,可以自定义文件名;`downloadFileFromBlob` 函数则用于从Blob对象下载文件,同样支持自定义文件名。这两个函数均来自 `@kzttools/file-downloader` 包,该包的NPM地址和GitHub地址均已提供。项目遵循MIT许可证,作者为kazoottt。 | 项目 | 20241217 | 20250304 |
File Download
封装了对于 url 和 blob 类型文件的下载方法。
downloadFileFromURL
function downloadFileFromURL(url: string, filename?: string)
url 是网络请求的链接,filename 不是必填,如果填了那么下载文件名称=filename
downloadFileFromBlob
function downloadFileFromBlob(blob: Blob | MediaSource, filename: string)
blob 是一个 blob 对象,一般从后端获取,filename 不是必填,如果填了那么下载文件名称=filename
地址
npm 地址:
@kzttools/file-downloader - npm
github 地址:
GitHub - kzttools/file-downloader