emacroh5lib 1.0.73 → 1.0.74
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/emacroh5lib.min.js +1 -1
- package/package.json +1 -1
- package/src/utilities/EMacro.ts +12 -12
package/package.json
CHANGED
package/src/utilities/EMacro.ts
CHANGED
@@ -64,23 +64,23 @@ export namespace EMacro {
|
|
64
64
|
if (files[0].fileName == "" || files[0].fileSize == "" || files[0].fileSize == 0) {
|
65
65
|
throw new Error("文件异常")
|
66
66
|
}
|
67
|
-
|
68
|
-
if (files[0].webkitRelativePath != null && files[0].webkitRelativePath.trim() != "" ) {
|
69
|
-
let n = files[0].webkitRelativePath.indexOf("\\")
|
70
|
-
if (n == -1 ) {
|
71
|
-
n = files[0].webkitRelativePath.indexOf("/")
|
72
|
-
}
|
73
|
-
if (n != -1) {
|
74
|
-
directoryName = files[0].webkitRelativePath.substring(0, n)
|
75
|
-
}
|
76
|
-
}
|
67
|
+
|
77
68
|
|
78
69
|
for (let i = 0; i < files.length; i++) {
|
79
70
|
const file = files[i];
|
80
71
|
const md5 = await File.getFileMD5(file)
|
81
|
-
|
72
|
+
|
82
73
|
let { fileChunks, sliceSize, chunksLength } = File.getFileChunks(file, chunkSize)
|
83
74
|
|
75
|
+
let directoryName = "";
|
76
|
+
if (files[i].webkitRelativePath != null && files[i].webkitRelativePath.trim() != "") {
|
77
|
+
let n = files[i].webkitRelativePath.lastIndexOf("\\")
|
78
|
+
if (n == -1)
|
79
|
+
n = files[i].webkitRelativePath.lastIndexOf("/")
|
80
|
+
if (n != -1)
|
81
|
+
directoryName = files[i].webkitRelativePath.substring(0, n)
|
82
|
+
}
|
83
|
+
|
84
84
|
for (let index in fileChunks) {
|
85
85
|
let chunk = fileChunks[Number(index)]
|
86
86
|
const base64 = await File.getBase64(chunk) as string
|
@@ -105,7 +105,7 @@ export namespace EMacro {
|
|
105
105
|
completeHandle(files)
|
106
106
|
}
|
107
107
|
|
108
|
-
public static selectFile(options: any = { multiple: true, accept: "*/*" }, isDirectory =
|
108
|
+
public static selectFile(options: any = { multiple: true, accept: "*/*" }, isDirectory = true): Promise<FileList | null> {
|
109
109
|
return new Promise((res: (value: FileList) => void, rej) => {
|
110
110
|
const el = document.createElement("input");
|
111
111
|
el.type = "file";
|