muhammara 2.6.1 → 2.6.2

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 (32) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/node_modules/tar/README.md +37 -9
  3. package/node_modules/tar/lib/create.js +16 -9
  4. package/node_modules/tar/lib/extract.js +16 -10
  5. package/node_modules/tar/lib/header.js +50 -34
  6. package/node_modules/tar/lib/large-numbers.js +22 -17
  7. package/node_modules/tar/lib/list.js +20 -13
  8. package/node_modules/tar/lib/mkdir.js +40 -24
  9. package/node_modules/tar/lib/mode-fix.js +8 -4
  10. package/node_modules/tar/lib/normalize-unicode.js +3 -2
  11. package/node_modules/tar/lib/pack.js +54 -31
  12. package/node_modules/tar/lib/parse.js +74 -46
  13. package/node_modules/tar/lib/path-reservations.js +26 -18
  14. package/node_modules/tar/lib/pax.js +15 -8
  15. package/node_modules/tar/lib/read-entry.js +14 -7
  16. package/node_modules/tar/lib/replace.js +50 -27
  17. package/node_modules/tar/lib/strip-absolute-path.js +1 -1
  18. package/node_modules/tar/lib/unpack.js +73 -44
  19. package/node_modules/tar/lib/update.js +8 -4
  20. package/node_modules/tar/lib/warn-mixin.js +7 -4
  21. package/node_modules/tar/lib/write-entry.js +44 -23
  22. package/node_modules/tar/package.json +44 -30
  23. package/package.json +1 -1
  24. package/src/deps/PDFWriter/CFFFileInput.cpp +7 -1
  25. package/src/deps/PDFWriter/DecryptionHelper.cpp +1 -1
  26. package/src/deps/PDFWriter/DocumentContext.cpp +21 -8
  27. package/src/deps/PDFWriter/DocumentContext.h +1 -1
  28. package/src/deps/PDFWriter/PDFModifiedPage.cpp +2 -0
  29. package/src/deps/PDFWriter/PDFPageInput.cpp +7 -1
  30. package/src/deps/PDFWriter/PDFParser.cpp +6 -0
  31. package/src/deps/PDFWriter/PDFUsedFont.cpp +4 -2
  32. package/src/deps/PDFWriter/TrueTypeEmbeddedFontWriter.cpp +15 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.6.2] - 2022-11-23
11
+
12
+ ### Fixed
13
+
14
+ - Several cases of NPE under different circumstances
15
+
10
16
  ## [2.6.1] - 2022-10-23
11
17
 
12
18
  ### Fixed
@@ -247,7 +253,8 @@ with the following changes.
247
253
 
248
254
  * Initial release
249
255
 
250
- [Unreleased]: https://github.com/julianhille/MuhammaraJS/compare/2.6.1...HEAD
256
+ [Unreleased]: https://github.com/julianhille/MuhammaraJS/compare/2.6.2...HEAD
257
+ [2.6.2]: https://github.com/julianhille/MuhammaraJS/compare/2.6.1...2.6.2
251
258
  [2.6.1]: https://github.com/julianhille/MuhammaraJS/compare/2.6.0...2.6.1
252
259
  [2.6.0]: https://github.com/julianhille/MuhammaraJS/compare/2.5.0...2.6.0
253
260
  [2.5.0]: https://github.com/julianhille/MuhammaraJS/compare/2.4.0...2.5.0
@@ -1,6 +1,6 @@
1
1
  # node-tar
2
2
 
3
- [Fast](./benchmarks) and full-featured Tar for Node.js
3
+ Fast and full-featured Tar for Node.js
4
4
 
5
5
  The API is designed to mimic the behavior of `tar(1)` on unix systems.
6
6
  If you are familiar with how tar works, most of this will hopefully be
@@ -209,6 +209,19 @@ tar.t({
209
209
  })
210
210
  ```
211
211
 
212
+ For example, to just get the list of filenames from an archive:
213
+
214
+ ```js
215
+ const getEntryFilenames = async tarballFilename => {
216
+ const filenames = []
217
+ await tar.t({
218
+ file: tarballFilename,
219
+ onentry: entry => filenames.push(entry.path),
220
+ })
221
+ return filenames
222
+ }
223
+ ```
224
+
212
225
  To replicate `cat my-tarball.tgz | tar t` do:
213
226
 
214
227
  ```js
@@ -223,6 +236,18 @@ When the function returns, it's already done. Sync methods without a
223
236
  file argument return a sync stream, which flushes immediately. But,
224
237
  of course, it still won't be done until you `.end()` it.
225
238
 
239
+ ```js
240
+ const getEntryFilenamesSync = tarballFilename => {
241
+ const filenames = []
242
+ tar.t({
243
+ file: tarballFilename,
244
+ onentry: entry => filenames.push(entry.path),
245
+ sync: true,
246
+ })
247
+ return filenames
248
+ }
249
+ ```
250
+
226
251
  To filter entries, add `filter: <function>` to the options.
227
252
  Tar-creating methods call the filter with `filter(path, stat)`.
228
253
  Tar-reading methods (including extraction) call the filter with
@@ -429,15 +454,18 @@ no paths are provided, then all the entries are listed.
429
454
 
430
455
  If the archive is gzipped, then tar will detect this and unzip it.
431
456
 
432
- Returns an event emitter that emits `entry` events with
433
- `tar.ReadEntry` objects. However, they don't emit `'data'` or `'end'`
434
- events. (If you want to get actual readable entries, use the
435
- `tar.Parse` class instead.)
457
+ If the `file` option is _not_ provided, then returns an event emitter that
458
+ emits `entry` events with `tar.ReadEntry` objects. However, they don't
459
+ emit `'data'` or `'end'` events. (If you want to get actual readable
460
+ entries, use the `tar.Parse` class instead.)
461
+
462
+ If a `file` option _is_ provided, then the return value will be a promise
463
+ that resolves when the file has been fully traversed in async mode, or
464
+ `undefined` if `sync: true` is set. Thus, you _must_ specify an `onentry`
465
+ method in order to do anything useful with the data it parses.
436
466
 
437
467
  The following options are supported:
438
468
 
439
- - `cwd` Extract files relative to the specified directory. Defaults
440
- to `process.cwd()`. [Alias: `C`]
441
469
  - `file` The archive file to list. If not specified, then a
442
470
  Writable stream is returned where the archive data should be
443
471
  written. [Alias: `f`]
@@ -449,8 +477,8 @@ The following options are supported:
449
477
  entry being listed. Return `true` to emit the entry from the
450
478
  archive, or `false` to skip it.
451
479
  - `onentry` A function that gets called with `(entry)` for each entry
452
- that passes the filter. This is important for when both `file` and
453
- `sync` are set, because it will be called synchronously.
480
+ that passes the filter. This is important for when `file` is set,
481
+ because there is no other way to do anything useful with this method.
454
482
  - `maxReadSize` The maximum buffer size for `fs.read()` operations.
455
483
  Defaults to 16 MB.
456
484
  - `noResume` By default, `entry` streams are resumed immediately after
@@ -9,24 +9,29 @@ const t = require('./list.js')
9
9
  const path = require('path')
10
10
 
11
11
  module.exports = (opt_, files, cb) => {
12
- if (typeof files === 'function')
12
+ if (typeof files === 'function') {
13
13
  cb = files
14
+ }
14
15
 
15
- if (Array.isArray(opt_))
16
+ if (Array.isArray(opt_)) {
16
17
  files = opt_, opt_ = {}
18
+ }
17
19
 
18
- if (!files || !Array.isArray(files) || !files.length)
20
+ if (!files || !Array.isArray(files) || !files.length) {
19
21
  throw new TypeError('no files or directories specified')
22
+ }
20
23
 
21
24
  files = Array.from(files)
22
25
 
23
26
  const opt = hlo(opt_)
24
27
 
25
- if (opt.sync && typeof cb === 'function')
28
+ if (opt.sync && typeof cb === 'function') {
26
29
  throw new TypeError('callback not supported for sync tar functions')
30
+ }
27
31
 
28
- if (!opt.file && typeof cb === 'function')
32
+ if (!opt.file && typeof cb === 'function') {
29
33
  throw new TypeError('callback only supported with file option')
34
+ }
30
35
 
31
36
  return opt.file && opt.sync ? createFileSync(opt, files)
32
37
  : opt.file ? createFile(opt, files, cb)
@@ -65,13 +70,14 @@ const addFilesSync = (p, files) => {
65
70
  files.forEach(file => {
66
71
  if (file.charAt(0) === '@') {
67
72
  t({
68
- file: path.resolve(p.cwd, file.substr(1)),
73
+ file: path.resolve(p.cwd, file.slice(1)),
69
74
  sync: true,
70
75
  noResume: true,
71
76
  onentry: entry => p.add(entry),
72
77
  })
73
- } else
78
+ } else {
74
79
  p.add(file)
80
+ }
75
81
  })
76
82
  p.end()
77
83
  }
@@ -81,12 +87,13 @@ const addFilesAsync = (p, files) => {
81
87
  const file = files.shift()
82
88
  if (file.charAt(0) === '@') {
83
89
  return t({
84
- file: path.resolve(p.cwd, file.substr(1)),
90
+ file: path.resolve(p.cwd, file.slice(1)),
85
91
  noResume: true,
86
92
  onentry: entry => p.add(entry),
87
93
  }).then(_ => addFilesAsync(p, files))
88
- } else
94
+ } else {
89
95
  p.add(file)
96
+ }
90
97
  }
91
98
  p.end()
92
99
  }
@@ -9,29 +9,35 @@ const path = require('path')
9
9
  const stripSlash = require('./strip-trailing-slashes.js')
10
10
 
11
11
  module.exports = (opt_, files, cb) => {
12
- if (typeof opt_ === 'function')
12
+ if (typeof opt_ === 'function') {
13
13
  cb = opt_, files = null, opt_ = {}
14
- else if (Array.isArray(opt_))
14
+ } else if (Array.isArray(opt_)) {
15
15
  files = opt_, opt_ = {}
16
+ }
16
17
 
17
- if (typeof files === 'function')
18
+ if (typeof files === 'function') {
18
19
  cb = files, files = null
20
+ }
19
21
 
20
- if (!files)
22
+ if (!files) {
21
23
  files = []
22
- else
24
+ } else {
23
25
  files = Array.from(files)
26
+ }
24
27
 
25
28
  const opt = hlo(opt_)
26
29
 
27
- if (opt.sync && typeof cb === 'function')
30
+ if (opt.sync && typeof cb === 'function') {
28
31
  throw new TypeError('callback not supported for sync tar functions')
32
+ }
29
33
 
30
- if (!opt.file && typeof cb === 'function')
34
+ if (!opt.file && typeof cb === 'function') {
31
35
  throw new TypeError('callback only supported with file option')
36
+ }
32
37
 
33
- if (files.length)
38
+ if (files.length) {
34
39
  filesFilter(opt, files)
40
+ }
35
41
 
36
42
  return opt.file && opt.sync ? extractFileSync(opt)
37
43
  : opt.file ? extractFile(opt, cb)
@@ -87,9 +93,9 @@ const extractFile = (opt, cb) => {
87
93
  // This trades a zero-byte read() syscall for a stat
88
94
  // However, it will usually result in less memory allocation
89
95
  fs.stat(file, (er, stat) => {
90
- if (er)
96
+ if (er) {
91
97
  reject(er)
92
- else {
98
+ } else {
93
99
  const stream = new fsm.ReadStream(file, {
94
100
  readSize: readSize,
95
101
  size: stat.size,
@@ -34,18 +34,21 @@ class Header {
34
34
  this.atime = null
35
35
  this.ctime = null
36
36
 
37
- if (Buffer.isBuffer(data))
37
+ if (Buffer.isBuffer(data)) {
38
38
  this.decode(data, off || 0, ex, gex)
39
- else if (data)
39
+ } else if (data) {
40
40
  this.set(data)
41
+ }
41
42
  }
42
43
 
43
44
  decode (buf, off, ex, gex) {
44
- if (!off)
45
+ if (!off) {
45
46
  off = 0
47
+ }
46
48
 
47
- if (!buf || !(buf.length >= off + 512))
49
+ if (!buf || !(buf.length >= off + 512)) {
48
50
  throw new Error('need 512 bytes for header')
51
+ }
49
52
 
50
53
  this.path = decString(buf, off, 100)
51
54
  this.mode = decNumber(buf, off + 100, 8)
@@ -62,18 +65,21 @@ class Header {
62
65
 
63
66
  // old tar versions marked dirs as a file with a trailing /
64
67
  this[TYPE] = decString(buf, off + 156, 1)
65
- if (this[TYPE] === '')
68
+ if (this[TYPE] === '') {
66
69
  this[TYPE] = '0'
67
- if (this[TYPE] === '0' && this.path.substr(-1) === '/')
70
+ }
71
+ if (this[TYPE] === '0' && this.path.slice(-1) === '/') {
68
72
  this[TYPE] = '5'
73
+ }
69
74
 
70
75
  // tar implementations sometimes incorrectly put the stat(dir).size
71
76
  // as the size in the tarball, even though Directory entries are
72
77
  // not able to have any body at all. In the very rare chance that
73
78
  // it actually DOES have a body, we weren't going to do anything with
74
79
  // it anyway, and it'll just be a warning about an invalid header.
75
- if (this[TYPE] === '5')
80
+ if (this[TYPE] === '5') {
76
81
  this.size = 0
82
+ }
77
83
 
78
84
  this.linkpath = decString(buf, off + 157, 100)
79
85
  if (buf.slice(off + 257, off + 265).toString() === 'ustar\u000000') {
@@ -87,23 +93,27 @@ class Header {
87
93
  this.path = prefix + '/' + this.path
88
94
  } else {
89
95
  const prefix = decString(buf, off + 345, 130)
90
- if (prefix)
96
+ if (prefix) {
91
97
  this.path = prefix + '/' + this.path
98
+ }
92
99
  this.atime = decDate(buf, off + 476, 12)
93
100
  this.ctime = decDate(buf, off + 488, 12)
94
101
  }
95
102
  }
96
103
 
97
104
  let sum = 8 * 0x20
98
- for (let i = off; i < off + 148; i++)
105
+ for (let i = off; i < off + 148; i++) {
99
106
  sum += buf[i]
107
+ }
100
108
 
101
- for (let i = off + 156; i < off + 512; i++)
109
+ for (let i = off + 156; i < off + 512; i++) {
102
110
  sum += buf[i]
111
+ }
103
112
 
104
113
  this.cksumValid = sum === this.cksum
105
- if (this.cksum === null && sum === 8 * 0x20)
114
+ if (this.cksum === null && sum === 8 * 0x20) {
106
115
  this.nullBlock = true
116
+ }
107
117
  }
108
118
 
109
119
  [SLURP] (ex, global) {
@@ -111,8 +121,9 @@ class Header {
111
121
  // we slurp in everything except for the path attribute in
112
122
  // a global extended header, because that's weird.
113
123
  if (ex[k] !== null && ex[k] !== undefined &&
114
- !(global && k === 'path'))
124
+ !(global && k === 'path')) {
115
125
  this[k] = ex[k]
126
+ }
116
127
  }
117
128
  }
118
129
 
@@ -122,11 +133,13 @@ class Header {
122
133
  off = 0
123
134
  }
124
135
 
125
- if (!off)
136
+ if (!off) {
126
137
  off = 0
138
+ }
127
139
 
128
- if (!(buf.length >= off + 512))
140
+ if (!(buf.length >= off + 512)) {
129
141
  throw new Error('need 512 bytes for header')
142
+ }
130
143
 
131
144
  const prefixSize = this.ctime || this.atime ? 130 : 155
132
145
  const split = splitPrefix(this.path || '', prefixSize)
@@ -148,20 +161,22 @@ class Header {
148
161
  this.needPax = encNumber(buf, off + 329, 8, this.devmaj) || this.needPax
149
162
  this.needPax = encNumber(buf, off + 337, 8, this.devmin) || this.needPax
150
163
  this.needPax = encString(buf, off + 345, prefixSize, prefix) || this.needPax
151
- if (buf[off + 475] !== 0)
164
+ if (buf[off + 475] !== 0) {
152
165
  this.needPax = encString(buf, off + 345, 155, prefix) || this.needPax
153
- else {
166
+ } else {
154
167
  this.needPax = encString(buf, off + 345, 130, prefix) || this.needPax
155
168
  this.needPax = encDate(buf, off + 476, 12, this.atime) || this.needPax
156
169
  this.needPax = encDate(buf, off + 488, 12, this.ctime) || this.needPax
157
170
  }
158
171
 
159
172
  let sum = 8 * 0x20
160
- for (let i = off; i < off + 148; i++)
173
+ for (let i = off; i < off + 148; i++) {
161
174
  sum += buf[i]
175
+ }
162
176
 
163
- for (let i = off + 156; i < off + 512; i++)
177
+ for (let i = off + 156; i < off + 512; i++) {
164
178
  sum += buf[i]
179
+ }
165
180
 
166
181
  this.cksum = sum
167
182
  encNumber(buf, off + 148, 8, this.cksum)
@@ -172,8 +187,9 @@ class Header {
172
187
 
173
188
  set (data) {
174
189
  for (const i in data) {
175
- if (data[i] !== null && data[i] !== undefined)
190
+ if (data[i] !== null && data[i] !== undefined) {
176
191
  this[i] = data[i]
192
+ }
177
193
  }
178
194
  }
179
195
 
@@ -186,10 +202,11 @@ class Header {
186
202
  }
187
203
 
188
204
  set type (type) {
189
- if (types.code.has(type))
205
+ if (types.code.has(type)) {
190
206
  this[TYPE] = types.code.get(type)
191
- else
207
+ } else {
192
208
  this[TYPE] = type
209
+ }
193
210
  }
194
211
  }
195
212
 
@@ -200,25 +217,23 @@ const splitPrefix = (p, prefixSize) => {
200
217
  let ret
201
218
  const root = pathModule.parse(p).root || '.'
202
219
 
203
- if (Buffer.byteLength(pp) < pathSize)
220
+ if (Buffer.byteLength(pp) < pathSize) {
204
221
  ret = [pp, prefix, false]
205
- else {
222
+ } else {
206
223
  // first set prefix to the dir, and path to the base
207
224
  prefix = pathModule.dirname(pp)
208
225
  pp = pathModule.basename(pp)
209
226
 
210
227
  do {
211
- // both fit!
212
228
  if (Buffer.byteLength(pp) <= pathSize &&
213
- Buffer.byteLength(prefix) <= prefixSize)
229
+ Buffer.byteLength(prefix) <= prefixSize) {
230
+ // both fit!
214
231
  ret = [pp, prefix, false]
215
-
216
- // prefix fits in prefix, but path doesn't fit in path
217
- else if (Buffer.byteLength(pp) > pathSize &&
218
- Buffer.byteLength(prefix) <= prefixSize)
219
- ret = [pp.substr(0, pathSize - 1), prefix, true]
220
-
221
- else {
232
+ } else if (Buffer.byteLength(pp) > pathSize &&
233
+ Buffer.byteLength(prefix) <= prefixSize) {
234
+ // prefix fits in prefix, but path doesn't fit in path
235
+ ret = [pp.slice(0, pathSize - 1), prefix, true]
236
+ } else {
222
237
  // make path take a bit from prefix
223
238
  pp = pathModule.join(pathModule.basename(prefix), pp)
224
239
  prefix = pathModule.dirname(prefix)
@@ -226,8 +241,9 @@ const splitPrefix = (p, prefixSize) => {
226
241
  } while (prefix !== root && !ret)
227
242
 
228
243
  // at this point, found no resolution, just truncate
229
- if (!ret)
230
- ret = [p.substr(0, pathSize - 1), '', true]
244
+ if (!ret) {
245
+ ret = [p.slice(0, pathSize - 1), '', true]
246
+ }
231
247
  }
232
248
  return ret
233
249
  }
@@ -3,14 +3,15 @@
3
3
  // 0xff for negative, and 0x80 for positive.
4
4
 
5
5
  const encode = (num, buf) => {
6
- if (!Number.isSafeInteger(num))
7
- // The number is so large that javascript cannot represent it with integer
8
- // precision.
6
+ if (!Number.isSafeInteger(num)) {
7
+ // The number is so large that javascript cannot represent it with integer
8
+ // precision.
9
9
  throw Error('cannot encode number outside of javascript safe integer range')
10
- else if (num < 0)
10
+ } else if (num < 0) {
11
11
  encodeNegative(num, buf)
12
- else
12
+ } else {
13
13
  encodePositive(num, buf)
14
+ }
14
15
  return buf
15
16
  }
16
17
 
@@ -30,11 +31,11 @@ const encodeNegative = (num, buf) => {
30
31
  for (var i = buf.length; i > 1; i--) {
31
32
  var byte = num & 0xff
32
33
  num = Math.floor(num / 0x100)
33
- if (flipped)
34
+ if (flipped) {
34
35
  buf[i - 1] = onesComp(byte)
35
- else if (byte === 0)
36
+ } else if (byte === 0) {
36
37
  buf[i - 1] = 0
37
- else {
38
+ } else {
38
39
  flipped = true
39
40
  buf[i - 1] = twosComp(byte)
40
41
  }
@@ -46,13 +47,15 @@ const parse = (buf) => {
46
47
  const value = pre === 0x80 ? pos(buf.slice(1, buf.length))
47
48
  : pre === 0xff ? twos(buf)
48
49
  : null
49
- if (value === null)
50
+ if (value === null) {
50
51
  throw Error('invalid base256 encoding')
52
+ }
51
53
 
52
- if (!Number.isSafeInteger(value))
53
- // The number is so large that javascript cannot represent it with integer
54
- // precision.
54
+ if (!Number.isSafeInteger(value)) {
55
+ // The number is so large that javascript cannot represent it with integer
56
+ // precision.
55
57
  throw Error('parsed number outside of javascript safe integer range')
58
+ }
56
59
 
57
60
  return value
58
61
  }
@@ -64,16 +67,17 @@ const twos = (buf) => {
64
67
  for (var i = len - 1; i > -1; i--) {
65
68
  var byte = buf[i]
66
69
  var f
67
- if (flipped)
70
+ if (flipped) {
68
71
  f = onesComp(byte)
69
- else if (byte === 0)
72
+ } else if (byte === 0) {
70
73
  f = byte
71
- else {
74
+ } else {
72
75
  flipped = true
73
76
  f = twosComp(byte)
74
77
  }
75
- if (f !== 0)
78
+ if (f !== 0) {
76
79
  sum -= f * Math.pow(256, len - i - 1)
80
+ }
77
81
  }
78
82
  return sum
79
83
  }
@@ -83,8 +87,9 @@ const pos = (buf) => {
83
87
  var sum = 0
84
88
  for (var i = len - 1; i > -1; i--) {
85
89
  var byte = buf[i]
86
- if (byte !== 0)
90
+ if (byte !== 0) {
87
91
  sum += byte * Math.pow(256, len - i - 1)
92
+ }
88
93
  }
89
94
  return sum
90
95
  }
@@ -12,32 +12,39 @@ const path = require('path')
12
12
  const stripSlash = require('./strip-trailing-slashes.js')
13
13
 
14
14
  module.exports = (opt_, files, cb) => {
15
- if (typeof opt_ === 'function')
15
+ if (typeof opt_ === 'function') {
16
16
  cb = opt_, files = null, opt_ = {}
17
- else if (Array.isArray(opt_))
17
+ } else if (Array.isArray(opt_)) {
18
18
  files = opt_, opt_ = {}
19
+ }
19
20
 
20
- if (typeof files === 'function')
21
+ if (typeof files === 'function') {
21
22
  cb = files, files = null
23
+ }
22
24
 
23
- if (!files)
25
+ if (!files) {
24
26
  files = []
25
- else
27
+ } else {
26
28
  files = Array.from(files)
29
+ }
27
30
 
28
31
  const opt = hlo(opt_)
29
32
 
30
- if (opt.sync && typeof cb === 'function')
33
+ if (opt.sync && typeof cb === 'function') {
31
34
  throw new TypeError('callback not supported for sync tar functions')
35
+ }
32
36
 
33
- if (!opt.file && typeof cb === 'function')
37
+ if (!opt.file && typeof cb === 'function') {
34
38
  throw new TypeError('callback only supported with file option')
39
+ }
35
40
 
36
- if (files.length)
41
+ if (files.length) {
37
42
  filesFilter(opt, files)
43
+ }
38
44
 
39
- if (!opt.noResume)
45
+ if (!opt.noResume) {
40
46
  onentryFunction(opt)
47
+ }
41
48
 
42
49
  return opt.file && opt.sync ? listFileSync(opt)
43
50
  : opt.file ? listFile(opt, cb)
@@ -81,9 +88,9 @@ const listFileSync = opt => {
81
88
  try {
82
89
  const stat = fs.statSync(file)
83
90
  const readSize = opt.maxReadSize || 16 * 1024 * 1024
84
- if (stat.size < readSize)
91
+ if (stat.size < readSize) {
85
92
  p.end(fs.readFileSync(file))
86
- else {
93
+ } else {
87
94
  let pos = 0
88
95
  const buf = Buffer.allocUnsafe(readSize)
89
96
  fd = fs.openSync(file, 'r')
@@ -114,9 +121,9 @@ const listFile = (opt, cb) => {
114
121
  parse.on('end', resolve)
115
122
 
116
123
  fs.stat(file, (er, stat) => {
117
- if (er)
124
+ if (er) {
118
125
  reject(er)
119
- else {
126
+ } else {
120
127
  const stream = new fsm.ReadStream(file, {
121
128
  readSize: readSize,
122
129
  size: stat.size,