@zjlab-fe/util 0.6.2 → 0.8.0

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/README.md CHANGED
@@ -1,5 +1,28 @@
1
1
  ## API
2
2
 
3
+ ### 获取远端jsonl,解析后返回数组
4
+
5
+
6
+ ```javascript
7
+ /**
8
+ * 从 URL 获取 JSONL 文件并解析为数组
9
+ * @param url - 要获取的 URL
10
+ * @returns 解析后的数组
11
+ */
12
+ export declare function fetchJsonlAsArray<T = any>(url: string): Promise<T[]>;
13
+ ```
14
+
15
+ ### 根据文件名(包含扩展名)获取对应的 Content-Type
16
+
17
+ ```javascript
18
+ /**
19
+ * 根据文件名(包含扩展名)获取对应的 Content-Type
20
+ * @param fileName {string} 文件名或文件路径
21
+ * @returns {string} 对应的 MIME 类型
22
+ */
23
+ export declare function getContentTypeByFileName(fileName: string): string;
24
+ ```
25
+
3
26
  ### 上传内容到OSS
4
27
 
5
28
  ```javascript
@@ -7,9 +30,10 @@
7
30
  * 上传内容到OSS
8
31
  * @param ossUrl {string} 上传地址
9
32
  * @param content {string | Record<string, any>} 上传内容,类型可以是string,或者json对象
33
+ * @param contentType {string} 可选的 Content-Type,如果不传入,则会根据文件名自动判断,如果传入,则以传入的为准
10
34
  * @returns {Promise<boolean>}
11
35
  */
12
- export declare function uploadToOSS(ossUrl: string, content: string | Record<string, any>): Promise<boolean>;
36
+ export declare function uploadToOSS(ossUrl: string, content: string | Record<string, any>, contentType?: string): Promise<boolean>;
13
37
  ```
14
38
 
15
39
  ### 检查当前域名是否是线上环境