node-red-contrib-tak-registration 0.1.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.
Files changed (195) hide show
  1. package/LICENSE +14 -0
  2. package/README.md +35 -0
  3. package/node_modules/adm-zip/LICENSE +21 -0
  4. package/node_modules/adm-zip/README.md +65 -0
  5. package/node_modules/adm-zip/adm-zip.js +783 -0
  6. package/node_modules/adm-zip/headers/entryHeader.js +338 -0
  7. package/node_modules/adm-zip/headers/index.js +2 -0
  8. package/node_modules/adm-zip/headers/mainHeader.js +129 -0
  9. package/node_modules/adm-zip/methods/deflater.js +33 -0
  10. package/node_modules/adm-zip/methods/index.js +3 -0
  11. package/node_modules/adm-zip/methods/inflater.js +31 -0
  12. package/node_modules/adm-zip/methods/zipcrypto.js +170 -0
  13. package/node_modules/adm-zip/package.json +77 -0
  14. package/node_modules/adm-zip/util/constants.js +142 -0
  15. package/node_modules/adm-zip/util/errors.js +35 -0
  16. package/node_modules/adm-zip/util/fattr.js +79 -0
  17. package/node_modules/adm-zip/util/fileSystem.js +11 -0
  18. package/node_modules/adm-zip/util/index.js +4 -0
  19. package/node_modules/adm-zip/util/utils.js +246 -0
  20. package/node_modules/adm-zip/zipEntry.js +333 -0
  21. package/node_modules/adm-zip/zipFile.js +384 -0
  22. package/node_modules/asynckit/LICENSE +21 -0
  23. package/node_modules/asynckit/README.md +233 -0
  24. package/node_modules/asynckit/bench.js +76 -0
  25. package/node_modules/asynckit/index.js +6 -0
  26. package/node_modules/asynckit/lib/abort.js +29 -0
  27. package/node_modules/asynckit/lib/async.js +34 -0
  28. package/node_modules/asynckit/lib/defer.js +26 -0
  29. package/node_modules/asynckit/lib/iterate.js +75 -0
  30. package/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  31. package/node_modules/asynckit/lib/readable_parallel.js +25 -0
  32. package/node_modules/asynckit/lib/readable_serial.js +25 -0
  33. package/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  34. package/node_modules/asynckit/lib/state.js +37 -0
  35. package/node_modules/asynckit/lib/streamify.js +141 -0
  36. package/node_modules/asynckit/lib/terminator.js +29 -0
  37. package/node_modules/asynckit/package.json +91 -0
  38. package/node_modules/asynckit/parallel.js +43 -0
  39. package/node_modules/asynckit/serial.js +17 -0
  40. package/node_modules/asynckit/serialOrdered.js +75 -0
  41. package/node_modules/asynckit/stream.js +21 -0
  42. package/node_modules/axios/CHANGELOG.md +836 -0
  43. package/node_modules/axios/LICENSE +19 -0
  44. package/node_modules/axios/README.md +892 -0
  45. package/node_modules/axios/SECURITY.md +5 -0
  46. package/node_modules/axios/UPGRADE_GUIDE.md +162 -0
  47. package/node_modules/axios/dist/axios.js +2275 -0
  48. package/node_modules/axios/dist/axios.map +1 -0
  49. package/node_modules/axios/dist/axios.min.js +2 -0
  50. package/node_modules/axios/dist/axios.min.map +1 -0
  51. package/node_modules/axios/index.d.ts +206 -0
  52. package/node_modules/axios/index.js +1 -0
  53. package/node_modules/axios/lib/adapters/README.md +37 -0
  54. package/node_modules/axios/lib/adapters/http.js +363 -0
  55. package/node_modules/axios/lib/adapters/xhr.js +212 -0
  56. package/node_modules/axios/lib/axios.js +57 -0
  57. package/node_modules/axios/lib/cancel/Cancel.js +19 -0
  58. package/node_modules/axios/lib/cancel/CancelToken.js +119 -0
  59. package/node_modules/axios/lib/cancel/isCancel.js +5 -0
  60. package/node_modules/axios/lib/core/Axios.js +148 -0
  61. package/node_modules/axios/lib/core/InterceptorManager.js +54 -0
  62. package/node_modules/axios/lib/core/README.md +8 -0
  63. package/node_modules/axios/lib/core/buildFullPath.js +20 -0
  64. package/node_modules/axios/lib/core/createError.js +18 -0
  65. package/node_modules/axios/lib/core/dispatchRequest.js +87 -0
  66. package/node_modules/axios/lib/core/enhanceError.js +43 -0
  67. package/node_modules/axios/lib/core/mergeConfig.js +99 -0
  68. package/node_modules/axios/lib/core/settle.js +25 -0
  69. package/node_modules/axios/lib/core/transformData.js +22 -0
  70. package/node_modules/axios/lib/defaults.js +134 -0
  71. package/node_modules/axios/lib/env/README.md +3 -0
  72. package/node_modules/axios/lib/env/data.js +3 -0
  73. package/node_modules/axios/lib/helpers/README.md +7 -0
  74. package/node_modules/axios/lib/helpers/bind.js +11 -0
  75. package/node_modules/axios/lib/helpers/buildURL.js +70 -0
  76. package/node_modules/axios/lib/helpers/combineURLs.js +14 -0
  77. package/node_modules/axios/lib/helpers/cookies.js +53 -0
  78. package/node_modules/axios/lib/helpers/deprecatedMethod.js +24 -0
  79. package/node_modules/axios/lib/helpers/isAbsoluteURL.js +14 -0
  80. package/node_modules/axios/lib/helpers/isAxiosError.js +11 -0
  81. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +68 -0
  82. package/node_modules/axios/lib/helpers/normalizeHeaderName.js +12 -0
  83. package/node_modules/axios/lib/helpers/parseHeaders.js +53 -0
  84. package/node_modules/axios/lib/helpers/spread.js +27 -0
  85. package/node_modules/axios/lib/helpers/validator.js +82 -0
  86. package/node_modules/axios/lib/utils.js +349 -0
  87. package/node_modules/axios/package.json +113 -0
  88. package/node_modules/axios/tsconfig.json +14 -0
  89. package/node_modules/axios/tslint.json +6 -0
  90. package/node_modules/combined-stream/License +19 -0
  91. package/node_modules/combined-stream/Readme.md +138 -0
  92. package/node_modules/combined-stream/lib/combined_stream.js +208 -0
  93. package/node_modules/combined-stream/package.json +57 -0
  94. package/node_modules/combined-stream/yarn.lock +17 -0
  95. package/node_modules/delayed-stream/.npmignore +1 -0
  96. package/node_modules/delayed-stream/License +19 -0
  97. package/node_modules/delayed-stream/Makefile +7 -0
  98. package/node_modules/delayed-stream/Readme.md +141 -0
  99. package/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  100. package/node_modules/delayed-stream/package.json +62 -0
  101. package/node_modules/follow-redirects/LICENSE +18 -0
  102. package/node_modules/follow-redirects/README.md +148 -0
  103. package/node_modules/follow-redirects/debug.js +15 -0
  104. package/node_modules/follow-redirects/http.js +1 -0
  105. package/node_modules/follow-redirects/https.js +1 -0
  106. package/node_modules/follow-redirects/index.js +569 -0
  107. package/node_modules/follow-redirects/package.json +95 -0
  108. package/node_modules/form-data/License +19 -0
  109. package/node_modules/form-data/README.md.bak +358 -0
  110. package/node_modules/form-data/Readme.md +358 -0
  111. package/node_modules/form-data/index.d.ts +62 -0
  112. package/node_modules/form-data/lib/browser.js +2 -0
  113. package/node_modules/form-data/lib/form_data.js +501 -0
  114. package/node_modules/form-data/lib/populate.js +10 -0
  115. package/node_modules/form-data/package.json +101 -0
  116. package/node_modules/mime-db/HISTORY.md +499 -0
  117. package/node_modules/mime-db/LICENSE +22 -0
  118. package/node_modules/mime-db/README.md +100 -0
  119. package/node_modules/mime-db/db.json +8471 -0
  120. package/node_modules/mime-db/index.js +11 -0
  121. package/node_modules/mime-db/package.json +102 -0
  122. package/node_modules/mime-types/HISTORY.md +388 -0
  123. package/node_modules/mime-types/LICENSE +23 -0
  124. package/node_modules/mime-types/README.md +113 -0
  125. package/node_modules/mime-types/index.js +188 -0
  126. package/node_modules/mime-types/package.json +87 -0
  127. package/node_modules/uuid/CHANGELOG.md +229 -0
  128. package/node_modules/uuid/CONTRIBUTING.md +18 -0
  129. package/node_modules/uuid/LICENSE.md +9 -0
  130. package/node_modules/uuid/README.md +505 -0
  131. package/node_modules/uuid/dist/bin/uuid +2 -0
  132. package/node_modules/uuid/dist/esm-browser/index.js +9 -0
  133. package/node_modules/uuid/dist/esm-browser/md5.js +215 -0
  134. package/node_modules/uuid/dist/esm-browser/nil.js +1 -0
  135. package/node_modules/uuid/dist/esm-browser/parse.js +35 -0
  136. package/node_modules/uuid/dist/esm-browser/regex.js +1 -0
  137. package/node_modules/uuid/dist/esm-browser/rng.js +19 -0
  138. package/node_modules/uuid/dist/esm-browser/sha1.js +96 -0
  139. package/node_modules/uuid/dist/esm-browser/stringify.js +30 -0
  140. package/node_modules/uuid/dist/esm-browser/v1.js +95 -0
  141. package/node_modules/uuid/dist/esm-browser/v3.js +4 -0
  142. package/node_modules/uuid/dist/esm-browser/v35.js +64 -0
  143. package/node_modules/uuid/dist/esm-browser/v4.js +24 -0
  144. package/node_modules/uuid/dist/esm-browser/v5.js +4 -0
  145. package/node_modules/uuid/dist/esm-browser/validate.js +7 -0
  146. package/node_modules/uuid/dist/esm-browser/version.js +11 -0
  147. package/node_modules/uuid/dist/esm-node/index.js +9 -0
  148. package/node_modules/uuid/dist/esm-node/md5.js +13 -0
  149. package/node_modules/uuid/dist/esm-node/nil.js +1 -0
  150. package/node_modules/uuid/dist/esm-node/parse.js +35 -0
  151. package/node_modules/uuid/dist/esm-node/regex.js +1 -0
  152. package/node_modules/uuid/dist/esm-node/rng.js +12 -0
  153. package/node_modules/uuid/dist/esm-node/sha1.js +13 -0
  154. package/node_modules/uuid/dist/esm-node/stringify.js +29 -0
  155. package/node_modules/uuid/dist/esm-node/v1.js +95 -0
  156. package/node_modules/uuid/dist/esm-node/v3.js +4 -0
  157. package/node_modules/uuid/dist/esm-node/v35.js +64 -0
  158. package/node_modules/uuid/dist/esm-node/v4.js +24 -0
  159. package/node_modules/uuid/dist/esm-node/v5.js +4 -0
  160. package/node_modules/uuid/dist/esm-node/validate.js +7 -0
  161. package/node_modules/uuid/dist/esm-node/version.js +11 -0
  162. package/node_modules/uuid/dist/index.js +79 -0
  163. package/node_modules/uuid/dist/md5-browser.js +223 -0
  164. package/node_modules/uuid/dist/md5.js +23 -0
  165. package/node_modules/uuid/dist/nil.js +8 -0
  166. package/node_modules/uuid/dist/parse.js +45 -0
  167. package/node_modules/uuid/dist/regex.js +8 -0
  168. package/node_modules/uuid/dist/rng-browser.js +26 -0
  169. package/node_modules/uuid/dist/rng.js +24 -0
  170. package/node_modules/uuid/dist/sha1-browser.js +104 -0
  171. package/node_modules/uuid/dist/sha1.js +23 -0
  172. package/node_modules/uuid/dist/stringify.js +39 -0
  173. package/node_modules/uuid/dist/umd/uuid.min.js +1 -0
  174. package/node_modules/uuid/dist/umd/uuidNIL.min.js +1 -0
  175. package/node_modules/uuid/dist/umd/uuidParse.min.js +1 -0
  176. package/node_modules/uuid/dist/umd/uuidStringify.min.js +1 -0
  177. package/node_modules/uuid/dist/umd/uuidValidate.min.js +1 -0
  178. package/node_modules/uuid/dist/umd/uuidVersion.min.js +1 -0
  179. package/node_modules/uuid/dist/umd/uuidv1.min.js +1 -0
  180. package/node_modules/uuid/dist/umd/uuidv3.min.js +1 -0
  181. package/node_modules/uuid/dist/umd/uuidv4.min.js +1 -0
  182. package/node_modules/uuid/dist/umd/uuidv5.min.js +1 -0
  183. package/node_modules/uuid/dist/uuid-bin.js +85 -0
  184. package/node_modules/uuid/dist/v1.js +107 -0
  185. package/node_modules/uuid/dist/v3.js +16 -0
  186. package/node_modules/uuid/dist/v35.js +78 -0
  187. package/node_modules/uuid/dist/v4.js +37 -0
  188. package/node_modules/uuid/dist/v5.js +16 -0
  189. package/node_modules/uuid/dist/validate.js +17 -0
  190. package/node_modules/uuid/dist/version.js +21 -0
  191. package/node_modules/uuid/package.json +164 -0
  192. package/node_modules/uuid/wrapper.mjs +10 -0
  193. package/package.json +32 -0
  194. package/tak-registration.html +111 -0
  195. package/tak-registration.js +169 -0
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+
3
+ // node crypt, we use it for generate salt
4
+ // eslint-disable-next-line node/no-unsupported-features/node-builtins
5
+ const { randomFillSync } = require("crypto");
6
+
7
+ // generate CRC32 lookup table
8
+ const crctable = new Uint32Array(256).map((t, crc) => {
9
+ for (let j = 0; j < 8; j++) {
10
+ if (0 !== (crc & 1)) {
11
+ crc = (crc >>> 1) ^ 0xedb88320;
12
+ } else {
13
+ crc >>>= 1;
14
+ }
15
+ }
16
+ return crc >>> 0;
17
+ });
18
+
19
+ // C-style uInt32 Multiply (discards higher bits, when JS multiply discards lower bits)
20
+ const uMul = (a, b) => Math.imul(a, b) >>> 0;
21
+
22
+ // crc32 byte single update (actually same function is part of utils.crc32 function :) )
23
+ const crc32update = (pCrc32, bval) => {
24
+ return crctable[(pCrc32 ^ bval) & 0xff] ^ (pCrc32 >>> 8);
25
+ };
26
+
27
+ // function for generating salt for encrytion header
28
+ const genSalt = () => {
29
+ if ("function" === typeof randomFillSync) {
30
+ return randomFillSync(Buffer.alloc(12));
31
+ } else {
32
+ // fallback if function is not defined
33
+ return genSalt.node();
34
+ }
35
+ };
36
+
37
+ // salt generation with node random function (mainly as fallback)
38
+ genSalt.node = () => {
39
+ const salt = Buffer.alloc(12);
40
+ const len = salt.length;
41
+ for (let i = 0; i < len; i++) salt[i] = (Math.random() * 256) & 0xff;
42
+ return salt;
43
+ };
44
+
45
+ // general config
46
+ const config = {
47
+ genSalt
48
+ };
49
+
50
+ // Class Initkeys handles same basic ops with keys
51
+ function Initkeys(pw) {
52
+ const pass = Buffer.isBuffer(pw) ? pw : Buffer.from(pw);
53
+ this.keys = new Uint32Array([0x12345678, 0x23456789, 0x34567890]);
54
+ for (let i = 0; i < pass.length; i++) {
55
+ this.updateKeys(pass[i]);
56
+ }
57
+ }
58
+
59
+ Initkeys.prototype.updateKeys = function (byteValue) {
60
+ const keys = this.keys;
61
+ keys[0] = crc32update(keys[0], byteValue);
62
+ keys[1] += keys[0] & 0xff;
63
+ keys[1] = uMul(keys[1], 134775813) + 1;
64
+ keys[2] = crc32update(keys[2], keys[1] >>> 24);
65
+ return byteValue;
66
+ };
67
+
68
+ Initkeys.prototype.next = function () {
69
+ const k = (this.keys[2] | 2) >>> 0; // key
70
+ return (uMul(k, k ^ 1) >> 8) & 0xff; // decode
71
+ };
72
+
73
+ function make_decrypter(/*Buffer*/ pwd) {
74
+ // 1. Stage initialize key
75
+ const keys = new Initkeys(pwd);
76
+
77
+ // return decrypter function
78
+ return function (/*Buffer*/ data) {
79
+ // result - we create new Buffer for results
80
+ const result = Buffer.alloc(data.length);
81
+ let pos = 0;
82
+ // process input data
83
+ for (let c of data) {
84
+ //c ^= keys.next();
85
+ //result[pos++] = c; // decode & Save Value
86
+ result[pos++] = keys.updateKeys(c ^ keys.next()); // update keys with decoded byte
87
+ }
88
+ return result;
89
+ };
90
+ }
91
+
92
+ function make_encrypter(/*Buffer*/ pwd) {
93
+ // 1. Stage initialize key
94
+ const keys = new Initkeys(pwd);
95
+
96
+ // return encrypting function, result and pos is here so we dont have to merge buffers later
97
+ return function (/*Buffer*/ data, /*Buffer*/ result, /* Number */ pos = 0) {
98
+ // result - we create new Buffer for results
99
+ if (!result) result = Buffer.alloc(data.length);
100
+ // process input data
101
+ for (let c of data) {
102
+ const k = keys.next(); // save key byte
103
+ result[pos++] = c ^ k; // save val
104
+ keys.updateKeys(c); // update keys with decoded byte
105
+ }
106
+ return result;
107
+ };
108
+ }
109
+
110
+ function decrypt(/*Buffer*/ data, /*Object*/ header, /*String, Buffer*/ pwd) {
111
+ if (!data || !Buffer.isBuffer(data) || data.length < 12) {
112
+ return Buffer.alloc(0);
113
+ }
114
+
115
+ // 1. We Initialize and generate decrypting function
116
+ const decrypter = make_decrypter(pwd);
117
+
118
+ // 2. decrypt salt what is always 12 bytes and is a part of file content
119
+ const salt = decrypter(data.slice(0, 12));
120
+
121
+ // 3. does password meet expectations
122
+ if (salt[11] !== header.crc >>> 24) {
123
+ throw "ADM-ZIP: Wrong Password";
124
+ }
125
+
126
+ // 4. decode content
127
+ return decrypter(data.slice(12));
128
+ }
129
+
130
+ // lets add way to populate salt, NOT RECOMMENDED for production but maybe useful for testing general functionality
131
+ function _salter(data) {
132
+ if (Buffer.isBuffer(data) && data.length >= 12) {
133
+ // be aware - currently salting buffer data is modified
134
+ config.genSalt = function () {
135
+ return data.slice(0, 12);
136
+ };
137
+ } else if (data === "node") {
138
+ // test salt generation with node random function
139
+ config.genSalt = genSalt.node;
140
+ } else {
141
+ // if value is not acceptable config gets reset.
142
+ config.genSalt = genSalt;
143
+ }
144
+ }
145
+
146
+ function encrypt(/*Buffer*/ data, /*Object*/ header, /*String, Buffer*/ pwd, /*Boolean*/ oldlike = false) {
147
+ // 1. test data if data is not Buffer we make buffer from it
148
+ if (data == null) data = Buffer.alloc(0);
149
+ // if data is not buffer be make buffer from it
150
+ if (!Buffer.isBuffer(data)) data = Buffer.from(data.toString());
151
+
152
+ // 2. We Initialize and generate encrypting function
153
+ const encrypter = make_encrypter(pwd);
154
+
155
+ // 3. generate salt (12-bytes of random data)
156
+ const salt = config.genSalt();
157
+ salt[11] = (header.crc >>> 24) & 0xff;
158
+
159
+ // old implementations (before PKZip 2.04g) used two byte check
160
+ if (oldlike) salt[10] = (header.crc >>> 16) & 0xff;
161
+
162
+ // 4. create output
163
+ const result = Buffer.alloc(data.length + 12);
164
+ encrypter(salt, result);
165
+
166
+ // finally encode content
167
+ return encrypter(data, result, 12);
168
+ }
169
+
170
+ module.exports = { decrypt, encrypt, _salter };
@@ -0,0 +1,77 @@
1
+ {
2
+ "_from": "adm-zip@^0.5.9",
3
+ "_id": "adm-zip@0.5.9",
4
+ "_inBundle": false,
5
+ "_integrity": "sha512-s+3fXLkeeLjZ2kLjCBwQufpI5fuN+kIGBxu6530nVQZGVol0d7Y/M88/xw9HGGUcJjKf8LutN3VPRUBq6N7Ajg==",
6
+ "_location": "/node-red-contrib-takfiles/adm-zip",
7
+ "_phantomChildren": {},
8
+ "_requested": {
9
+ "type": "range",
10
+ "registry": true,
11
+ "raw": "adm-zip@^0.5.9",
12
+ "name": "adm-zip",
13
+ "escapedName": "adm-zip",
14
+ "rawSpec": "^0.5.9",
15
+ "saveSpec": null,
16
+ "fetchSpec": "^0.5.9"
17
+ },
18
+ "_requiredBy": [
19
+ "/node-red-contrib-takfiles"
20
+ ],
21
+ "_resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.9.tgz",
22
+ "_shasum": "b33691028333821c0cf95c31374c5462f2905a83",
23
+ "_spec": "adm-zip@^0.5.9",
24
+ "_where": "/Users/conway/Projects/DCJNodes/takfile/",
25
+ "author": {
26
+ "name": "Nasca Iacob",
27
+ "email": "sy@another-d-mention.ro",
28
+ "url": "https://github.com/cthackers"
29
+ },
30
+ "bugs": {
31
+ "url": "https://github.com/cthackers/adm-zip/issues",
32
+ "email": "sy@another-d-mention.ro"
33
+ },
34
+ "bundleDependencies": false,
35
+ "deprecated": false,
36
+ "description": "Javascript implementation of zip for nodejs with support for electron original-fs. Allows user to create or extract zip files both in memory or to/from disk",
37
+ "devDependencies": {
38
+ "chai": "^4.3.4",
39
+ "mocha": "^8.3.2",
40
+ "prettier": "^2.2.1",
41
+ "rimraf": "^3.0.2"
42
+ },
43
+ "engines": {
44
+ "node": ">=6.0"
45
+ },
46
+ "files": [
47
+ "adm-zip.js",
48
+ "headers",
49
+ "methods",
50
+ "util",
51
+ "zipEntry.js",
52
+ "zipFile.js",
53
+ "LICENSE"
54
+ ],
55
+ "homepage": "https://github.com/cthackers/adm-zip",
56
+ "keywords": [
57
+ "zip",
58
+ "methods",
59
+ "archive",
60
+ "unzip"
61
+ ],
62
+ "license": "MIT",
63
+ "main": "adm-zip.js",
64
+ "name": "adm-zip",
65
+ "repository": {
66
+ "type": "git",
67
+ "url": "git+https://github.com/cthackers/adm-zip.git"
68
+ },
69
+ "scripts": {
70
+ "format": "npm run format:prettier",
71
+ "format:prettier": "npm run format:prettier:raw -- --write",
72
+ "format:prettier:raw": "prettier \"**/*.{js,yml,json}\"",
73
+ "test": "mocha -R spec",
74
+ "test:format": "npm run format:prettier:raw -- --check"
75
+ },
76
+ "version": "0.5.9"
77
+ }
@@ -0,0 +1,142 @@
1
+ module.exports = {
2
+ /* The local file header */
3
+ LOCHDR : 30, // LOC header size
4
+ LOCSIG : 0x04034b50, // "PK\003\004"
5
+ LOCVER : 4, // version needed to extract
6
+ LOCFLG : 6, // general purpose bit flag
7
+ LOCHOW : 8, // compression method
8
+ LOCTIM : 10, // modification time (2 bytes time, 2 bytes date)
9
+ LOCCRC : 14, // uncompressed file crc-32 value
10
+ LOCSIZ : 18, // compressed size
11
+ LOCLEN : 22, // uncompressed size
12
+ LOCNAM : 26, // filename length
13
+ LOCEXT : 28, // extra field length
14
+
15
+ /* The Data descriptor */
16
+ EXTSIG : 0x08074b50, // "PK\007\008"
17
+ EXTHDR : 16, // EXT header size
18
+ EXTCRC : 4, // uncompressed file crc-32 value
19
+ EXTSIZ : 8, // compressed size
20
+ EXTLEN : 12, // uncompressed size
21
+
22
+ /* The central directory file header */
23
+ CENHDR : 46, // CEN header size
24
+ CENSIG : 0x02014b50, // "PK\001\002"
25
+ CENVEM : 4, // version made by
26
+ CENVER : 6, // version needed to extract
27
+ CENFLG : 8, // encrypt, decrypt flags
28
+ CENHOW : 10, // compression method
29
+ CENTIM : 12, // modification time (2 bytes time, 2 bytes date)
30
+ CENCRC : 16, // uncompressed file crc-32 value
31
+ CENSIZ : 20, // compressed size
32
+ CENLEN : 24, // uncompressed size
33
+ CENNAM : 28, // filename length
34
+ CENEXT : 30, // extra field length
35
+ CENCOM : 32, // file comment length
36
+ CENDSK : 34, // volume number start
37
+ CENATT : 36, // internal file attributes
38
+ CENATX : 38, // external file attributes (host system dependent)
39
+ CENOFF : 42, // LOC header offset
40
+
41
+ /* The entries in the end of central directory */
42
+ ENDHDR : 22, // END header size
43
+ ENDSIG : 0x06054b50, // "PK\005\006"
44
+ ENDSUB : 8, // number of entries on this disk
45
+ ENDTOT : 10, // total number of entries
46
+ ENDSIZ : 12, // central directory size in bytes
47
+ ENDOFF : 16, // offset of first CEN header
48
+ ENDCOM : 20, // zip file comment length
49
+
50
+ END64HDR : 20, // zip64 END header size
51
+ END64SIG : 0x07064b50, // zip64 Locator signature, "PK\006\007"
52
+ END64START : 4, // number of the disk with the start of the zip64
53
+ END64OFF : 8, // relative offset of the zip64 end of central directory
54
+ END64NUMDISKS : 16, // total number of disks
55
+
56
+ ZIP64SIG : 0x06064b50, // zip64 signature, "PK\006\006"
57
+ ZIP64HDR : 56, // zip64 record minimum size
58
+ ZIP64LEAD : 12, // leading bytes at the start of the record, not counted by the value stored in ZIP64SIZE
59
+ ZIP64SIZE : 4, // zip64 size of the central directory record
60
+ ZIP64VEM : 12, // zip64 version made by
61
+ ZIP64VER : 14, // zip64 version needed to extract
62
+ ZIP64DSK : 16, // zip64 number of this disk
63
+ ZIP64DSKDIR : 20, // number of the disk with the start of the record directory
64
+ ZIP64SUB : 24, // number of entries on this disk
65
+ ZIP64TOT : 32, // total number of entries
66
+ ZIP64SIZB : 40, // zip64 central directory size in bytes
67
+ ZIP64OFF : 48, // offset of start of central directory with respect to the starting disk number
68
+ ZIP64EXTRA : 56, // extensible data sector
69
+
70
+ /* Compression methods */
71
+ STORED : 0, // no compression
72
+ SHRUNK : 1, // shrunk
73
+ REDUCED1 : 2, // reduced with compression factor 1
74
+ REDUCED2 : 3, // reduced with compression factor 2
75
+ REDUCED3 : 4, // reduced with compression factor 3
76
+ REDUCED4 : 5, // reduced with compression factor 4
77
+ IMPLODED : 6, // imploded
78
+ // 7 reserved for Tokenizing compression algorithm
79
+ DEFLATED : 8, // deflated
80
+ ENHANCED_DEFLATED: 9, // enhanced deflated
81
+ PKWARE : 10,// PKWare DCL imploded
82
+ // 11 reserved by PKWARE
83
+ BZIP2 : 12, // compressed using BZIP2
84
+ // 13 reserved by PKWARE
85
+ LZMA : 14, // LZMA
86
+ // 15-17 reserved by PKWARE
87
+ IBM_TERSE : 18, // compressed using IBM TERSE
88
+ IBM_LZ77 : 19, // IBM LZ77 z
89
+ AES_ENCRYPT : 99, // WinZIP AES encryption method
90
+
91
+ /* General purpose bit flag */
92
+ // values can obtained with expression 2**bitnr
93
+ FLG_ENC : 1, // Bit 0: encrypted file
94
+ FLG_COMP1 : 2, // Bit 1, compression option
95
+ FLG_COMP2 : 4, // Bit 2, compression option
96
+ FLG_DESC : 8, // Bit 3, data descriptor
97
+ FLG_ENH : 16, // Bit 4, enhanced deflating
98
+ FLG_PATCH : 32, // Bit 5, indicates that the file is compressed patched data.
99
+ FLG_STR : 64, // Bit 6, strong encryption (patented)
100
+ // Bits 7-10: Currently unused.
101
+ FLG_EFS : 2048, // Bit 11: Language encoding flag (EFS)
102
+ // Bit 12: Reserved by PKWARE for enhanced compression.
103
+ // Bit 13: encrypted the Central Directory (patented).
104
+ // Bits 14-15: Reserved by PKWARE.
105
+ FLG_MSK : 4096, // mask header values
106
+
107
+ /* Load type */
108
+ FILE : 2,
109
+ BUFFER : 1,
110
+ NONE : 0,
111
+
112
+ /* 4.5 Extensible data fields */
113
+ EF_ID : 0,
114
+ EF_SIZE : 2,
115
+
116
+ /* Header IDs */
117
+ ID_ZIP64 : 0x0001,
118
+ ID_AVINFO : 0x0007,
119
+ ID_PFS : 0x0008,
120
+ ID_OS2 : 0x0009,
121
+ ID_NTFS : 0x000a,
122
+ ID_OPENVMS : 0x000c,
123
+ ID_UNIX : 0x000d,
124
+ ID_FORK : 0x000e,
125
+ ID_PATCH : 0x000f,
126
+ ID_X509_PKCS7 : 0x0014,
127
+ ID_X509_CERTID_F : 0x0015,
128
+ ID_X509_CERTID_C : 0x0016,
129
+ ID_STRONGENC : 0x0017,
130
+ ID_RECORD_MGT : 0x0018,
131
+ ID_X509_PKCS7_RL : 0x0019,
132
+ ID_IBM1 : 0x0065,
133
+ ID_IBM2 : 0x0066,
134
+ ID_POSZIP : 0x4690,
135
+
136
+ EF_ZIP64_OR_32 : 0xffffffff,
137
+ EF_ZIP64_OR_16 : 0xffff,
138
+ EF_ZIP64_SUNCOMP : 0,
139
+ EF_ZIP64_SCOMP : 8,
140
+ EF_ZIP64_RHO : 16,
141
+ EF_ZIP64_DSN : 24
142
+ };
@@ -0,0 +1,35 @@
1
+ module.exports = {
2
+ /* Header error messages */
3
+ INVALID_LOC: "Invalid LOC header (bad signature)",
4
+ INVALID_CEN: "Invalid CEN header (bad signature)",
5
+ INVALID_END: "Invalid END header (bad signature)",
6
+
7
+ /* ZipEntry error messages*/
8
+ NO_DATA: "Nothing to decompress",
9
+ BAD_CRC: "CRC32 checksum failed",
10
+ FILE_IN_THE_WAY: "There is a file in the way: %s",
11
+ UNKNOWN_METHOD: "Invalid/unsupported compression method",
12
+
13
+ /* Inflater error messages */
14
+ AVAIL_DATA: "inflate::Available inflate data did not terminate",
15
+ INVALID_DISTANCE: "inflate::Invalid literal/length or distance code in fixed or dynamic block",
16
+ TO_MANY_CODES: "inflate::Dynamic block code description: too many length or distance codes",
17
+ INVALID_REPEAT_LEN: "inflate::Dynamic block code description: repeat more than specified lengths",
18
+ INVALID_REPEAT_FIRST: "inflate::Dynamic block code description: repeat lengths with no first length",
19
+ INCOMPLETE_CODES: "inflate::Dynamic block code description: code lengths codes incomplete",
20
+ INVALID_DYN_DISTANCE: "inflate::Dynamic block code description: invalid distance code lengths",
21
+ INVALID_CODES_LEN: "inflate::Dynamic block code description: invalid literal/length code lengths",
22
+ INVALID_STORE_BLOCK: "inflate::Stored block length did not match one's complement",
23
+ INVALID_BLOCK_TYPE: "inflate::Invalid block type (type == 3)",
24
+
25
+ /* ADM-ZIP error messages */
26
+ CANT_EXTRACT_FILE: "Could not extract the file",
27
+ CANT_OVERRIDE: "Target file already exists",
28
+ NO_ZIP: "No zip file was loaded",
29
+ NO_ENTRY: "Entry doesn't exist",
30
+ DIRECTORY_CONTENT_ERROR: "A directory cannot have content",
31
+ FILE_NOT_FOUND: "File not found: %s",
32
+ NOT_IMPLEMENTED: "Not implemented",
33
+ INVALID_FILENAME: "Invalid filename",
34
+ INVALID_FORMAT: "Invalid or unsupported zip format. No END header found"
35
+ };
@@ -0,0 +1,79 @@
1
+ const fs = require("./fileSystem").require();
2
+ const pth = require("path");
3
+
4
+ fs.existsSync = fs.existsSync || pth.existsSync;
5
+
6
+ module.exports = function (/*String*/ path) {
7
+ var _path = path || "",
8
+ _obj = newAttr(),
9
+ _stat = null;
10
+
11
+ function newAttr() {
12
+ return {
13
+ directory: false,
14
+ readonly: false,
15
+ hidden: false,
16
+ executable: false,
17
+ mtime: 0,
18
+ atime: 0
19
+ };
20
+ }
21
+
22
+ if (_path && fs.existsSync(_path)) {
23
+ _stat = fs.statSync(_path);
24
+ _obj.directory = _stat.isDirectory();
25
+ _obj.mtime = _stat.mtime;
26
+ _obj.atime = _stat.atime;
27
+ _obj.executable = (0o111 & _stat.mode) !== 0; // file is executable who ever har right not just owner
28
+ _obj.readonly = (0o200 & _stat.mode) === 0; // readonly if owner has no write right
29
+ _obj.hidden = pth.basename(_path)[0] === ".";
30
+ } else {
31
+ console.warn("Invalid path: " + _path);
32
+ }
33
+
34
+ return {
35
+ get directory() {
36
+ return _obj.directory;
37
+ },
38
+
39
+ get readOnly() {
40
+ return _obj.readonly;
41
+ },
42
+
43
+ get hidden() {
44
+ return _obj.hidden;
45
+ },
46
+
47
+ get mtime() {
48
+ return _obj.mtime;
49
+ },
50
+
51
+ get atime() {
52
+ return _obj.atime;
53
+ },
54
+
55
+ get executable() {
56
+ return _obj.executable;
57
+ },
58
+
59
+ decodeAttributes: function () {},
60
+
61
+ encodeAttributes: function () {},
62
+
63
+ toJSON: function () {
64
+ return {
65
+ path: _path,
66
+ isDirectory: _obj.directory,
67
+ isReadOnly: _obj.readonly,
68
+ isHidden: _obj.hidden,
69
+ isExecutable: _obj.executable,
70
+ mTime: _obj.mtime,
71
+ aTime: _obj.atime
72
+ };
73
+ },
74
+
75
+ toString: function () {
76
+ return JSON.stringify(this.toJSON(), null, "\t");
77
+ }
78
+ };
79
+ };
@@ -0,0 +1,11 @@
1
+ exports.require = function () {
2
+ if (typeof process === "object" && process.versions && process.versions["electron"]) {
3
+ try {
4
+ const originalFs = require("original-fs");
5
+ if (Object.keys(originalFs).length > 0) {
6
+ return originalFs;
7
+ }
8
+ } catch (e) {}
9
+ }
10
+ return require("fs");
11
+ };
@@ -0,0 +1,4 @@
1
+ module.exports = require("./utils");
2
+ module.exports.Constants = require("./constants");
3
+ module.exports.Errors = require("./errors");
4
+ module.exports.FileAttr = require("./fattr");