diginext-utils 1.0.2 → 1.0.3

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,58 +1,58 @@
1
- import JSZip from "jszip";
2
- import ObjectExtra from "plugins/utils/ObjectExtra";
3
- import createDir from "../file/createDir";
4
- const fs = require("fs");
5
- const path = require("path");
1
+ // import JSZip from "jszip";
2
+ // import ObjectExtra from "plugins/utils/ObjectExtra";
3
+ // import createDir from "../file/createDir";
4
+ // const fs = require("fs");
5
+ // const path = require("path");
6
6
 
7
- /**
8
- *
9
- * @param {string} zipPath
10
- * @param {string} directory
11
- * @param {Function} forEach
12
- */
13
- const extractZip = async (zipPath, directory, forEach) => {
14
- // let id = -1;
15
- // let isCallcb = false;
16
- fs.readFile(zipPath, async function (err, data) {
17
- if (err) throw err;
18
- JSZip.loadAsync(data)
19
- .then(async function (zip) {
20
- const _length = ObjectExtra.toArray(zip).length;
21
- zip.forEach((filePath, fileObj) => {
22
- console.log(filePath);
23
- var fileName = path.resolve(directory, filePath);
24
- if (fileName.indexOf(".DS_Store") >= 0) {
25
- return;
26
- }
27
- if (fileName.indexOf("__MACOSX/") >= 0) {
28
- return;
29
- }
7
+ // /**
8
+ // *
9
+ // * @param {string} zipPath
10
+ // * @param {string} directory
11
+ // * @param {Function} forEach
12
+ // */
13
+ // const extractZip = async (zipPath, directory, forEach) => {
14
+ // // let id = -1;
15
+ // // let isCallcb = false;
16
+ // fs.readFile(zipPath, async function (err, data) {
17
+ // if (err) throw err;
18
+ // JSZip.loadAsync(data)
19
+ // .then(async function (zip) {
20
+ // const _length = ObjectExtra.toArray(zip).length;
21
+ // zip.forEach((filePath, fileObj) => {
22
+ // console.log(filePath);
23
+ // var fileName = path.resolve(directory, filePath);
24
+ // if (fileName.indexOf(".DS_Store") >= 0) {
25
+ // return;
26
+ // }
27
+ // if (fileName.indexOf("__MACOSX/") >= 0) {
28
+ // return;
29
+ // }
30
30
 
31
- // console.log(fileName)
32
- if (fileObj.dir) {
33
- createDir(fileName);
34
- if (forEach) forEach(fileName, false);
35
- } else {
36
- try {
37
- fileObj.async("nodebuffer").then((buff) => {
38
- fs.writeFileSync(fileName, buff);
39
- if (forEach) forEach(fileName, true);
31
+ // // console.log(fileName)
32
+ // if (fileObj.dir) {
33
+ // createDir(fileName);
34
+ // if (forEach) forEach(fileName, false);
35
+ // } else {
36
+ // try {
37
+ // fileObj.async("nodebuffer").then((buff) => {
38
+ // fs.writeFileSync(fileName, buff);
39
+ // if (forEach) forEach(fileName, true);
40
40
 
41
- // id++;
42
- // if (id >= _length) if (callback && !isCallcb) {
43
- // console.log("4")
44
- // isCallcb = true;
45
- // if (callback) callback();
46
- // }
47
- });
48
- } catch (error) {
49
- cosole.log("extractZip ERROR", error);
50
- }
51
- }
52
- });
53
- })
54
- .then(function () {});
55
- });
56
- };
41
+ // // id++;
42
+ // // if (id >= _length) if (callback && !isCallcb) {
43
+ // // console.log("4")
44
+ // // isCallcb = true;
45
+ // // if (callback) callback();
46
+ // // }
47
+ // });
48
+ // } catch (error) {
49
+ // cosole.log("extractZip ERROR", error);
50
+ // }
51
+ // }
52
+ // });
53
+ // })
54
+ // .then(function () {});
55
+ // });
56
+ // };
57
57
 
58
- export default extractZip;
58
+ // export default extractZip;