xframelib 0.8.9 → 0.9.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.
@@ -1,4 +1,4 @@
1
- import { Unzipped, FlateCallback } from "fflate";
1
+ import { Unzipped } from "fflate";
2
2
  export interface IZipFile {
3
3
  filename: string;
4
4
  content: Uint8Array | string | ArrayBuffer;
@@ -8,12 +8,30 @@ export interface IZipFile {
8
8
  */
9
9
  export default class ZipTool {
10
10
  static runningInBrowser(): boolean;
11
+ /**
12
+ * 解决文件名乱码问题
13
+ * @param str 乱码字符串
14
+ * @returns
15
+ */
16
+ static encodeGBK(str: string): string;
17
+ /**
18
+ * 直接从文件列表数组,进行压缩文件
19
+ * @param zipfileName
20
+ * @param files
21
+ */
22
+ static saveZipFromFiles(zipfileName: string, files: Array<File>): Promise<void>;
11
23
  /**
12
24
  * 保存文件到本地
13
25
  * @param zipfileName zip文件名
14
26
  * @param files 压缩文件数组
15
27
  */
16
28
  static saveZipFile(zipfileName: string, files: Array<IZipFile>): void;
29
+ /**
30
+ * 同步方式压缩文件
31
+ * @param zipfileName
32
+ * @param files
33
+ */
34
+ static saveZipFileSync(zipfileName: string, files: Array<IZipFile>): boolean;
17
35
  /**
18
36
  * 同步解压压缩包
19
37
  * @param input
@@ -46,13 +64,13 @@ export default class ZipTool {
46
64
  * @param files
47
65
  * @returns
48
66
  */
49
- static zipSync(files: Array<IZipFile>): Uint8Array;
67
+ private static zipSync;
50
68
  /**
51
- * 异步压缩
69
+ * 异步压缩,回调返回:Uint8Array
52
70
  * @param files
53
- * @param cb
71
+ * @param cb 回调返回:Uint8Array
54
72
  */
55
- static zipAsync(files: Array<IZipFile>, cb: FlateCallback): void;
73
+ private static zipAsync;
56
74
  private static fflateFilter;
57
75
  private static fflatePostprocess;
58
76
  private static isImportableZipPath;
@@ -20,5 +20,6 @@ export * from './ValidateTool';
20
20
  import XXTEA from './XXTEA';
21
21
  import WaterMark from './WaterMark';
22
22
  import { GetSignalRClient } from './SignalrClient';
23
+ import iconv from 'iconv-lite';
23
24
  export * from './FilenameUtils';
24
- export { GetSignalRClient, WaterMark, XXTEA, H5Tool, StringUtils, StorageHelper as Storage, storage, uuid, newGuid, ZipTool, GzipTool };
25
+ export { iconv, GetSignalRClient, WaterMark, XXTEA, H5Tool, StringUtils, StorageHelper as Storage, storage, uuid, newGuid, ZipTool, GzipTool };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xframelib",
3
- "version": "0.8.9",
3
+ "version": "0.9.0",
4
4
  "description": "积累的前端开发基础库",
5
5
  "main": "dist/index.js",
6
6
  "common": "dist/index.cjs",
@@ -35,6 +35,7 @@
35
35
  "@microsoft/signalr": "^8.0.7",
36
36
  "axios": "^1.7.9",
37
37
  "fflate": "^0.8.2",
38
+ "iconv-lite": "^0.6.3",
38
39
  "localforage": "^1.10.0",
39
40
  "loglevel": "^1.9.2",
40
41
  "qs": "^6.13.1",