@rainte/js 0.0.56 → 0.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1474 -1467
- package/dist/index.umd.cjs +13 -13
- package/dist/types/blob/index.d.ts +15 -0
- package/package.json +1 -1
|
@@ -26,6 +26,21 @@ export declare const toBase64: (blob: Blob) => Promise<string>;
|
|
|
26
26
|
* toBlob('aGk=', { type: 'text/plain' }) // Blob { type: 'text/plain', ... }
|
|
27
27
|
*/
|
|
28
28
|
export declare const toBlob: (base64: string, options?: BlobPropertyBag) => Blob;
|
|
29
|
+
/**
|
|
30
|
+
* 将 base64 字符串(或 Data URL)转为 File。
|
|
31
|
+
* 复用 toBlob 的解析逻辑,支持与 toBlob 相同的三种输入。
|
|
32
|
+
*
|
|
33
|
+
* @param base64 base64 字符串或 Data URL
|
|
34
|
+
* @param filename 文件名(File.name)
|
|
35
|
+
* @param options 可选的 FilePropertyBag,其 type 优先级高于从字符串解析出的 mime
|
|
36
|
+
* @returns File
|
|
37
|
+
* @throws payload 非法 base64 时 atob 抛 DOMException
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* toFile('data:image/png;base64,iVBORw0KG...', 'a.png')
|
|
41
|
+
* toFile('aGk=', 'a.txt', { type: 'text/plain' })
|
|
42
|
+
*/
|
|
43
|
+
export declare const toFile: (base64: string, filename: string, options?: FilePropertyBag) => File;
|
|
29
44
|
/**
|
|
30
45
|
* 触发浏览器下载。
|
|
31
46
|
*
|