@rainte/js 0.0.56 → 0.0.59
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/dist/types/http/index.d.ts +2 -2
- package/dist/types/url/index.d.ts +1 -1
- package/package.json +2 -6
- package/index.d.ts +0 -3
|
@@ -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
|
*
|
|
@@ -10,7 +10,7 @@ export * from './axios';
|
|
|
10
10
|
* @example
|
|
11
11
|
* get('/api/user', { id: 1 })
|
|
12
12
|
*/
|
|
13
|
-
export declare const get: <T = unknown>(url: string, params?:
|
|
13
|
+
export declare const get: <T = unknown>(url: string, params?: Record<string, any>) => Promise<AxiosResponse<T>>;
|
|
14
14
|
/**
|
|
15
15
|
* POST 请求,默认 `Content-Type: application/json`。
|
|
16
16
|
*
|
|
@@ -21,7 +21,7 @@ export declare const get: <T = unknown>(url: string, params?: ObjectProps) => Pr
|
|
|
21
21
|
* @example
|
|
22
22
|
* post('/api/user', { name: 'foo' })
|
|
23
23
|
*/
|
|
24
|
-
export declare const post: <T = unknown>(url: string, data?:
|
|
24
|
+
export declare const post: <T = unknown>(url: string, data?: Record<string, any>) => Promise<AxiosResponse<T>>;
|
|
25
25
|
/**
|
|
26
26
|
* 下载请求,强制 `responseType = 'blob'`(除非调用方显式指定了其他值)。
|
|
27
27
|
*
|
|
@@ -20,7 +20,7 @@ export declare const search: (query?: string) => URLSearchParams;
|
|
|
20
20
|
* params('?a=1&b=2&b=3') // { a: '1', b: ['2', '3'] }
|
|
21
21
|
* params() // 当前页面的 query 对象
|
|
22
22
|
*/
|
|
23
|
-
export declare const params: (query?: string) =>
|
|
23
|
+
export declare const params: (query?: string) => Record<string, any>;
|
|
24
24
|
/**
|
|
25
25
|
* 打开新窗口/标签页。
|
|
26
26
|
*
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rainte/js",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.59",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
|
-
"dist"
|
|
10
|
-
"index.d.ts"
|
|
9
|
+
"dist"
|
|
11
10
|
],
|
|
12
11
|
"main": "./dist/index.umd.cjs",
|
|
13
12
|
"module": "./dist/index.js",
|
|
@@ -17,9 +16,6 @@
|
|
|
17
16
|
"types": "./dist/types/lib.d.ts",
|
|
18
17
|
"import": "./dist/index.js",
|
|
19
18
|
"require": "./dist/index.umd.cjs"
|
|
20
|
-
},
|
|
21
|
-
"./global": {
|
|
22
|
-
"types": "./index.d.ts"
|
|
23
19
|
}
|
|
24
20
|
},
|
|
25
21
|
"scripts": {
|
package/index.d.ts
DELETED