tar 6.0.4 → 6.1.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.
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # node-tar
2
2
 
3
- [![Build Status](https://travis-ci.org/npm/node-tar.svg?branch=master)](https://travis-ci.org/npm/node-tar)
4
-
5
3
  [Fast](./benchmarks) and full-featured Tar for Node.js
6
4
 
7
5
  The API is designed to mimic the behavior of `tar(1)` on unix systems.
@@ -304,7 +302,6 @@ The following options are supported:
304
302
  - `mtime` Set to a `Date` object to force a specific `mtime` for
305
303
  everything added to the archive. Overridden by `noMtime`.
306
304
 
307
-
308
305
  The following options are mostly internal, but can be modified in some
309
306
  advanced use cases, such as re-using caches between runs.
310
307
 
@@ -398,6 +395,13 @@ The following options are supported:
398
395
  the `filter` option described above.)
399
396
  - `onentry` A function that gets called with `(entry)` for each entry
400
397
  that passes the filter.
398
+ - `onwarn` A function that will get called with `(code, message, data)` for
399
+ any warnings encountered. (See "Warnings and Errors")
400
+ - `noChmod` Set to true to omit calling `fs.chmod()` to ensure that the
401
+ extracted file matches the entry mode. This also suppresses the call to
402
+ `process.umask()` to determine the default umask value, since tar will
403
+ extract with whatever mode is provided, and let the process `umask` apply
404
+ normally.
401
405
 
402
406
  The following options are mostly internal, but can be modified in some
403
407
  advanced use cases, such as re-using caches between runs.
@@ -453,6 +457,8 @@ The following options are supported:
453
457
  the call to `onentry`. Set `noResume: true` to suppress this
454
458
  behavior. Note that by opting into this, the stream will never
455
459
  complete until the entry data is consumed.
460
+ - `onwarn` A function that will get called with `(code, message, data)` for
461
+ any warnings encountered. (See "Warnings and Errors")
456
462
 
457
463
  ### tar.u(options, fileList, callback) [alias: tar.update]
458
464
 
@@ -710,6 +716,11 @@ Most unpack errors will cause a `warn` event to be emitted. If the
710
716
  that passes the filter.
711
717
  - `onwarn` A function that will get called with `(code, message, data)` for
712
718
  any warnings encountered. (See "Warnings and Errors")
719
+ - `noChmod` Set to true to omit calling `fs.chmod()` to ensure that the
720
+ extracted file matches the entry mode. This also suppresses the call to
721
+ `process.umask()` to determine the default umask value, since tar will
722
+ extract with whatever mode is provided, and let the process `umask` apply
723
+ normally.
713
724
 
714
725
  ### class tar.Unpack.Sync
715
726
 
package/lib/create.js CHANGED
@@ -4,12 +4,11 @@
4
4
  const hlo = require('./high-level-opt.js')
5
5
 
6
6
  const Pack = require('./pack.js')
7
- const fs = require('fs')
8
7
  const fsm = require('fs-minipass')
9
8
  const t = require('./list.js')
10
9
  const path = require('path')
11
10
 
12
- const c = module.exports = (opt_, files, cb) => {
11
+ module.exports = (opt_, files, cb) => {
13
12
  if (typeof files === 'function')
14
13
  cb = files
15
14
 
@@ -38,7 +37,7 @@ const c = module.exports = (opt_, files, cb) => {
38
37
  const createFileSync = (opt, files) => {
39
38
  const p = new Pack.Sync(opt)
40
39
  const stream = new fsm.WriteStreamSync(opt.file, {
41
- mode: opt.mode || 0o666
40
+ mode: opt.mode || 0o666,
42
41
  })
43
42
  p.pipe(stream)
44
43
  addFilesSync(p, files)
@@ -47,7 +46,7 @@ const createFileSync = (opt, files) => {
47
46
  const createFile = (opt, files, cb) => {
48
47
  const p = new Pack(opt)
49
48
  const stream = new fsm.WriteStream(opt.file, {
50
- mode: opt.mode || 0o666
49
+ mode: opt.mode || 0o666,
51
50
  })
52
51
  p.pipe(stream)
53
52
 
@@ -64,14 +63,14 @@ const createFile = (opt, files, cb) => {
64
63
 
65
64
  const addFilesSync = (p, files) => {
66
65
  files.forEach(file => {
67
- if (file.charAt(0) === '@')
66
+ if (file.charAt(0) === '@') {
68
67
  t({
69
68
  file: path.resolve(p.cwd, file.substr(1)),
70
69
  sync: true,
71
70
  noResume: true,
72
- onentry: entry => p.add(entry)
71
+ onentry: entry => p.add(entry),
73
72
  })
74
- else
73
+ } else
75
74
  p.add(file)
76
75
  })
77
76
  p.end()
@@ -80,13 +79,13 @@ const addFilesSync = (p, files) => {
80
79
  const addFilesAsync = (p, files) => {
81
80
  while (files.length) {
82
81
  const file = files.shift()
83
- if (file.charAt(0) === '@')
82
+ if (file.charAt(0) === '@') {
84
83
  return t({
85
84
  file: path.resolve(p.cwd, file.substr(1)),
86
85
  noResume: true,
87
- onentry: entry => p.add(entry)
86
+ onentry: entry => p.add(entry),
88
87
  }).then(_ => addFilesAsync(p, files))
89
- else
88
+ } else
90
89
  p.add(file)
91
90
  }
92
91
  p.end()
package/lib/extract.js CHANGED
@@ -7,7 +7,7 @@ const fs = require('fs')
7
7
  const fsm = require('fs-minipass')
8
8
  const path = require('path')
9
9
 
10
- const x = module.exports = (opt_, files, cb) => {
10
+ module.exports = (opt_, files, cb) => {
11
11
  if (typeof opt_ === 'function')
12
12
  cb = opt_, files = null, opt_ = {}
13
13
  else if (Array.isArray(opt_))
@@ -63,22 +63,20 @@ const extractFileSync = opt => {
63
63
  const u = new Unpack.Sync(opt)
64
64
 
65
65
  const file = opt.file
66
- let threw = true
67
- let fd
68
66
  const stat = fs.statSync(file)
69
67
  // This trades a zero-byte read() syscall for a stat
70
68
  // However, it will usually result in less memory allocation
71
- const readSize = opt.maxReadSize || 16*1024*1024
69
+ const readSize = opt.maxReadSize || 16 * 1024 * 1024
72
70
  const stream = new fsm.ReadStreamSync(file, {
73
71
  readSize: readSize,
74
- size: stat.size
72
+ size: stat.size,
75
73
  })
76
74
  stream.pipe(u)
77
75
  }
78
76
 
79
77
  const extractFile = (opt, cb) => {
80
78
  const u = new Unpack(opt)
81
- const readSize = opt.maxReadSize || 16*1024*1024
79
+ const readSize = opt.maxReadSize || 16 * 1024 * 1024
82
80
 
83
81
  const file = opt.file
84
82
  const p = new Promise((resolve, reject) => {
@@ -93,7 +91,7 @@ const extractFile = (opt, cb) => {
93
91
  else {
94
92
  const stream = new fsm.ReadStream(file, {
95
93
  readSize: readSize,
96
- size: stat.size
94
+ size: stat.size,
97
95
  })
98
96
  stream.on('error', reject)
99
97
  stream.pipe(u)
@@ -103,10 +101,6 @@ const extractFile = (opt, cb) => {
103
101
  return cb ? p.then(cb, cb) : p
104
102
  }
105
103
 
106
- const extractSync = opt => {
107
- return new Unpack.Sync(opt)
108
- }
104
+ const extractSync = opt => new Unpack.Sync(opt)
109
105
 
110
- const extract = opt => {
111
- return new Unpack(opt)
112
- }
106
+ const extract = opt => new Unpack(opt)
package/lib/header.js CHANGED
@@ -95,19 +95,19 @@ class Header {
95
95
  }
96
96
 
97
97
  let sum = 8 * 0x20
98
- for (let i = off; i < off + 148; i++) {
98
+ for (let i = off; i < off + 148; i++)
99
99
  sum += buf[i]
100
- }
101
- for (let i = off + 156; i < off + 512; i++) {
100
+
101
+ for (let i = off + 156; i < off + 512; i++)
102
102
  sum += buf[i]
103
- }
103
+
104
104
  this.cksumValid = sum === this.cksum
105
105
  if (this.cksum === null && sum === 8 * 0x20)
106
106
  this.nullBlock = true
107
107
  }
108
108
 
109
109
  [SLURP] (ex, global) {
110
- for (let k in ex) {
110
+ for (const k in ex) {
111
111
  // we slurp in everything except for the path attribute in
112
112
  // a global extended header, because that's weird.
113
113
  if (ex[k] !== null && ex[k] !== undefined &&
@@ -157,12 +157,12 @@ class Header {
157
157
  }
158
158
 
159
159
  let sum = 8 * 0x20
160
- for (let i = off; i < off + 148; i++) {
160
+ for (let i = off; i < off + 148; i++)
161
161
  sum += buf[i]
162
- }
163
- for (let i = off + 156; i < off + 512; i++) {
162
+
163
+ for (let i = off + 156; i < off + 512; i++)
164
164
  sum += buf[i]
165
- }
165
+
166
166
  this.cksum = sum
167
167
  encNumber(buf, off + 148, 8, this.cksum)
168
168
  this.cksumValid = true
@@ -171,7 +171,7 @@ class Header {
171
171
  }
172
172
 
173
173
  set (data) {
174
- for (let i in data) {
174
+ for (const i in data) {
175
175
  if (data[i] !== null && data[i] !== undefined)
176
176
  this[i] = data[i]
177
177
  }
@@ -242,7 +242,7 @@ const numToDate = num => num === null ? null : new Date(num * 1000)
242
242
 
243
243
  const decNumber = (buf, off, size) =>
244
244
  buf[off] & 0x80 ? large.parse(buf.slice(off, off + size))
245
- : decSmallNumber(buf, off, size)
245
+ : decSmallNumber(buf, off, size)
246
246
 
247
247
  const nanNull = value => isNaN(value) ? null : value
248
248
 
@@ -254,7 +254,7 @@ const decSmallNumber = (buf, off, size) =>
254
254
  // the maximum encodable as a null-terminated octal, by field size
255
255
  const MAXNUM = {
256
256
  12: 0o77777777777,
257
- 8 : 0o7777777
257
+ 8: 0o7777777,
258
258
  }
259
259
 
260
260
  const encNumber = (buf, off, size, number) =>
@@ -283,6 +283,6 @@ const NULLS = new Array(156).join('\0')
283
283
  const encString = (buf, off, size, string) =>
284
284
  string === null ? false :
285
285
  (buf.write(string + NULLS, off, size, 'utf8'),
286
- string.length !== Buffer.byteLength(string) || string.length > size)
286
+ string.length !== Buffer.byteLength(string) || string.length > size)
287
287
 
288
288
  module.exports = Header
@@ -21,9 +21,9 @@ const argmap = new Map([
21
21
  ['no-mtime', 'noMtime'],
22
22
  ['p', 'preserveOwner'],
23
23
  ['L', 'follow'],
24
- ['h', 'follow']
24
+ ['h', 'follow'],
25
25
  ])
26
26
 
27
- const parse = module.exports = opt => opt ? Object.keys(opt).map(k => [
28
- argmap.has(k) ? argmap.get(k) : k, opt[k]
27
+ module.exports = opt => opt ? Object.keys(opt).map(k => [
28
+ argmap.has(k) ? argmap.get(k) : k, opt[k],
29
29
  ]).reduce((set, kv) => (set[kv[0]] = kv[1], set), Object.create(null)) : {}
@@ -2,7 +2,7 @@
2
2
  // Tar can encode large and negative numbers using a leading byte of
3
3
  // 0xff for negative, and 0x80 for positive.
4
4
 
5
- const encode = exports.encode = (num, buf) => {
5
+ const encode = (num, buf) => {
6
6
  if (!Number.isSafeInteger(num))
7
7
  // The number is so large that javascript cannot represent it with integer
8
8
  // precision.
@@ -18,7 +18,7 @@ const encodePositive = (num, buf) => {
18
18
  buf[0] = 0x80
19
19
 
20
20
  for (var i = buf.length; i > 1; i--) {
21
- buf[i-1] = num & 0xff
21
+ buf[i - 1] = num & 0xff
22
22
  num = Math.floor(num / 0x100)
23
23
  }
24
24
  }
@@ -31,25 +31,22 @@ const encodeNegative = (num, buf) => {
31
31
  var byte = num & 0xff
32
32
  num = Math.floor(num / 0x100)
33
33
  if (flipped)
34
- buf[i-1] = onesComp(byte)
34
+ buf[i - 1] = onesComp(byte)
35
35
  else if (byte === 0)
36
- buf[i-1] = 0
36
+ buf[i - 1] = 0
37
37
  else {
38
38
  flipped = true
39
- buf[i-1] = twosComp(byte)
39
+ buf[i - 1] = twosComp(byte)
40
40
  }
41
41
  }
42
42
  }
43
43
 
44
- const parse = exports.parse = (buf) => {
45
- var post = buf[buf.length - 1]
46
- var pre = buf[0]
47
- var value;
48
- if (pre === 0x80)
49
- value = pos(buf.slice(1, buf.length))
50
- else if (pre === 0xff)
51
- value = twos(buf)
52
- else
44
+ const parse = (buf) => {
45
+ const pre = buf[0]
46
+ const value = pre === 0x80 ? pos(buf.slice(1, buf.length))
47
+ : pre === 0xff ? twos(buf)
48
+ : null
49
+ if (value === null)
53
50
  throw Error('invalid base256 encoding')
54
51
 
55
52
  if (!Number.isSafeInteger(value))
@@ -95,3 +92,8 @@ const pos = (buf) => {
95
92
  const onesComp = byte => (0xff ^ byte) & 0xff
96
93
 
97
94
  const twosComp = byte => ((0xff ^ byte) + 1) & 0xff
95
+
96
+ module.exports = {
97
+ encode,
98
+ parse,
99
+ }
package/lib/list.js CHANGED
@@ -10,7 +10,7 @@ const fs = require('fs')
10
10
  const fsm = require('fs-minipass')
11
11
  const path = require('path')
12
12
 
13
- const t = module.exports = (opt_, files, cb) => {
13
+ module.exports = (opt_, files, cb) => {
14
14
  if (typeof opt_ === 'function')
15
15
  cb = opt_, files = null, opt_ = {}
16
16
  else if (Array.isArray(opt_))
@@ -79,15 +79,15 @@ const listFileSync = opt => {
79
79
  let fd
80
80
  try {
81
81
  const stat = fs.statSync(file)
82
- const readSize = opt.maxReadSize || 16*1024*1024
83
- if (stat.size < readSize) {
82
+ const readSize = opt.maxReadSize || 16 * 1024 * 1024
83
+ if (stat.size < readSize)
84
84
  p.end(fs.readFileSync(file))
85
- } else {
85
+ else {
86
86
  let pos = 0
87
87
  const buf = Buffer.allocUnsafe(readSize)
88
88
  fd = fs.openSync(file, 'r')
89
89
  while (pos < stat.size) {
90
- let bytesRead = fs.readSync(fd, buf, 0, readSize, pos)
90
+ const bytesRead = fs.readSync(fd, buf, 0, readSize, pos)
91
91
  pos += bytesRead
92
92
  p.write(buf.slice(0, bytesRead))
93
93
  }
@@ -95,14 +95,17 @@ const listFileSync = opt => {
95
95
  }
96
96
  threw = false
97
97
  } finally {
98
- if (threw && fd)
99
- try { fs.closeSync(fd) } catch (er) {}
98
+ if (threw && fd) {
99
+ try {
100
+ fs.closeSync(fd)
101
+ } catch (er) {}
102
+ }
100
103
  }
101
104
  }
102
105
 
103
106
  const listFile = (opt, cb) => {
104
107
  const parse = new Parser(opt)
105
- const readSize = opt.maxReadSize || 16*1024*1024
108
+ const readSize = opt.maxReadSize || 16 * 1024 * 1024
106
109
 
107
110
  const file = opt.file
108
111
  const p = new Promise((resolve, reject) => {
@@ -115,7 +118,7 @@ const listFile = (opt, cb) => {
115
118
  else {
116
119
  const stream = new fsm.ReadStream(file, {
117
120
  readSize: readSize,
118
- size: stat.size
121
+ size: stat.size,
119
122
  })
120
123
  stream.on('error', reject)
121
124
  stream.pipe(parse)
package/lib/mkdir.js CHANGED
@@ -33,7 +33,7 @@ class CwdError extends Error {
33
33
  }
34
34
  }
35
35
 
36
- const mkdir = module.exports = (dir, opt, cb) => {
36
+ module.exports = (dir, opt, cb) => {
37
37
  // if there's any overlap between mask and mode,
38
38
  // then we'll need an explicit chmod
39
39
  const umask = opt.umask
@@ -44,7 +44,7 @@ const mkdir = module.exports = (dir, opt, cb) => {
44
44
  const gid = opt.gid
45
45
  const doChown = typeof uid === 'number' &&
46
46
  typeof gid === 'number' &&
47
- ( uid !== opt.processUid || gid !== opt.processGid )
47
+ (uid !== opt.processUid || gid !== opt.processGid)
48
48
 
49
49
  const preserve = opt.preserve
50
50
  const unlink = opt.unlink
@@ -68,12 +68,13 @@ const mkdir = module.exports = (dir, opt, cb) => {
68
68
  if (cache && cache.get(dir) === true)
69
69
  return done()
70
70
 
71
- if (dir === cwd)
71
+ if (dir === cwd) {
72
72
  return fs.stat(dir, (er, st) => {
73
73
  if (er || !st.isDirectory())
74
74
  er = new CwdError(dir, er && er.code || 'ENOTDIR')
75
75
  done(er)
76
76
  })
77
+ }
77
78
 
78
79
  if (preserve)
79
80
  return mkdirp(dir, {mode}).then(made => done(null, made), done)
@@ -104,13 +105,13 @@ const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => er => {
104
105
  cb(statEr)
105
106
  else if (st.isDirectory())
106
107
  mkdir_(part, parts, mode, cache, unlink, cwd, created, cb)
107
- else if (unlink)
108
+ else if (unlink) {
108
109
  fs.unlink(part, er => {
109
110
  if (er)
110
111
  return cb(er)
111
112
  fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb))
112
113
  })
113
- else if (st.isSymbolicLink())
114
+ } else if (st.isSymbolicLink())
114
115
  return cb(new SymlinkError(part, part + '/' + parts.join('/')))
115
116
  else
116
117
  cb(er)
@@ -121,7 +122,7 @@ const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => er => {
121
122
  }
122
123
  }
123
124
 
124
- const mkdirSync = module.exports.sync = (dir, opt) => {
125
+ module.exports.sync = (dir, opt) => {
125
126
  // if there's any overlap between mask and mode,
126
127
  // then we'll need an explicit chmod
127
128
  const umask = opt.umask
@@ -132,7 +133,7 @@ const mkdirSync = module.exports.sync = (dir, opt) => {
132
133
  const gid = opt.gid
133
134
  const doChown = typeof uid === 'number' &&
134
135
  typeof gid === 'number' &&
135
- ( uid !== opt.processUid || gid !== opt.processGid )
136
+ (uid !== opt.processUid || gid !== opt.processGid)
136
137
 
137
138
  const preserve = opt.preserve
138
139
  const unlink = opt.unlink
@@ -172,9 +173,8 @@ const mkdirSync = module.exports.sync = (dir, opt) => {
172
173
  const parts = sub.split(/\/|\\/)
173
174
  let created = null
174
175
  for (let p = parts.shift(), part = cwd;
175
- p && (part += '/' + p);
176
- p = parts.shift()) {
177
-
176
+ p && (part += '/' + p);
177
+ p = parts.shift()) {
178
178
  if (cache.get(part))
179
179
  continue
180
180
 
package/lib/mode-fix.js CHANGED
@@ -7,9 +7,8 @@ module.exports = (mode, isDir, portable) => {
7
7
  // (as some linux distros do), then we'll write the
8
8
  // archive with 0o644 instead. Also, don't ever create
9
9
  // a file that is not readable/writable by the owner.
10
- if (portable) {
11
- mode = (mode | 0o600) &~0o22
12
- }
10
+ if (portable)
11
+ mode = (mode | 0o600) & ~0o22
13
12
 
14
13
  // if dirs are readable, then they should be listable
15
14
  if (isDir) {
package/lib/pack.js CHANGED
@@ -97,7 +97,7 @@ const Pack = warner(class Pack extends MiniPass {
97
97
 
98
98
  this.filter = typeof opt.filter === 'function' ? opt.filter : _ => true
99
99
 
100
- this[QUEUE] = new Yallist
100
+ this[QUEUE] = new Yallist()
101
101
  this[JOBS] = 0
102
102
  this.jobs = +opt.jobs || 4
103
103
  this[PROCESSING] = false
@@ -209,8 +209,8 @@ const Pack = warner(class Pack extends MiniPass {
209
209
 
210
210
  this[PROCESSING] = true
211
211
  for (let w = this[QUEUE].head;
212
- w !== null && this[JOBS] < this.jobs;
213
- w = w.next) {
212
+ w !== null && this[JOBS] < this.jobs;
213
+ w = w.next) {
214
214
  this[PROCESSJOB](w.value)
215
215
  if (w.value.ignore) {
216
216
  const p = w.next
@@ -297,7 +297,7 @@ const Pack = warner(class Pack extends MiniPass {
297
297
  linkCache: this.linkCache,
298
298
  statCache: this.statCache,
299
299
  noMtime: this.noMtime,
300
- mtime: this.mtime
300
+ mtime: this.mtime,
301
301
  }
302
302
  }
303
303
 
@@ -321,7 +321,7 @@ const Pack = warner(class Pack extends MiniPass {
321
321
  [PIPE] (job) {
322
322
  job.piped = true
323
323
 
324
- if (job.readdir)
324
+ if (job.readdir) {
325
325
  job.readdir.forEach(entry => {
326
326
  const p = this.prefix ?
327
327
  job.path.slice(this.prefix.length + 1) || './'
@@ -330,20 +330,22 @@ const Pack = warner(class Pack extends MiniPass {
330
330
  const base = p === './' ? '' : p.replace(/\/*$/, '/')
331
331
  this[ADDFSENTRY](base + entry)
332
332
  })
333
+ }
333
334
 
334
335
  const source = job.entry
335
336
  const zip = this.zip
336
337
 
337
- if (zip)
338
+ if (zip) {
338
339
  source.on('data', chunk => {
339
340
  if (!zip.write(chunk))
340
341
  source.pause()
341
342
  })
342
- else
343
+ } else {
343
344
  source.on('data', chunk => {
344
345
  if (!super.write(chunk))
345
346
  source.pause()
346
347
  })
348
+ }
347
349
  }
348
350
 
349
351
  pause () {
@@ -377,7 +379,7 @@ class PackSync extends Pack {
377
379
  const source = job.entry
378
380
  const zip = this.zip
379
381
 
380
- if (job.readdir)
382
+ if (job.readdir) {
381
383
  job.readdir.forEach(entry => {
382
384
  const p = this.prefix ?
383
385
  job.path.slice(this.prefix.length + 1) || './'
@@ -386,15 +388,17 @@ class PackSync extends Pack {
386
388
  const base = p === './' ? '' : p.replace(/\/*$/, '/')
387
389
  this[ADDFSENTRY](base + entry)
388
390
  })
391
+ }
389
392
 
390
- if (zip)
393
+ if (zip) {
391
394
  source.on('data', chunk => {
392
395
  zip.write(chunk)
393
396
  })
394
- else
397
+ } else {
395
398
  source.on('data', chunk => {
396
399
  super[WRITE](chunk)
397
400
  })
401
+ }
398
402
  }
399
403
  }
400
404
 
package/lib/parse.js CHANGED
@@ -21,7 +21,6 @@
21
21
  // ignored entries get .resume() called on them straight away
22
22
 
23
23
  const warner = require('./warn-mixin.js')
24
- const path = require('path')
25
24
  const Header = require('./header.js')
26
25
  const EE = require('events')
27
26
  const Yallist = require('yallist')
@@ -85,13 +84,14 @@ module.exports = warner(class Parser extends EE {
85
84
 
86
85
  if (opt.ondone)
87
86
  this.on(DONE, opt.ondone)
88
- else
87
+ else {
89
88
  this.on(DONE, _ => {
90
89
  this.emit('prefinish')
91
90
  this.emit('finish')
92
91
  this.emit('end')
93
92
  this.emit('close')
94
93
  })
94
+ }
95
95
 
96
96
  this.strict = !!opt.strict
97
97
  this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize
@@ -166,9 +166,8 @@ module.exports = warner(class Parser extends EE {
166
166
  this[SAW_VALID_ENTRY] = true
167
167
  }
168
168
  entry.on('end', onend)
169
- } else {
169
+ } else
170
170
  this[SAW_VALID_ENTRY] = true
171
- }
172
171
  }
173
172
 
174
173
  if (entry.meta) {
@@ -249,7 +248,7 @@ module.exports = warner(class Parser extends EE {
249
248
  this.emit('drain')
250
249
  } else
251
250
  re.once('drain', _ => this.emit('drain'))
252
- }
251
+ }
253
252
  }
254
253
 
255
254
  [CONSUMEBODY] (chunk, position) {
@@ -352,7 +351,7 @@ module.exports = warner(class Parser extends EE {
352
351
  this[CONSUMECHUNK]()
353
352
  })
354
353
  this[WRITING] = true
355
- const ret = this[UNZIP][ended ? 'end' : 'write' ](chunk)
354
+ const ret = this[UNZIP][ended ? 'end' : 'write'](chunk)
356
355
  this[WRITING] = false
357
356
  return ret
358
357
  }
@@ -415,9 +414,8 @@ module.exports = warner(class Parser extends EE {
415
414
  const c = this[BUFFER]
416
415
  this[BUFFER] = null
417
416
  this[CONSUMECHUNKSUB](c)
418
- } else {
417
+ } else
419
418
  this[CONSUMECHUNKSUB](chunk)
420
- }
421
419
 
422
420
  while (this[BUFFER] &&
423
421
  this[BUFFER].length >= 512 &&
@@ -438,7 +436,7 @@ module.exports = warner(class Parser extends EE {
438
436
  // we know that we are in CONSUMING mode, so anything written goes into
439
437
  // the buffer. Advance the position and put any remainder in the buffer.
440
438
  let position = 0
441
- let length = chunk.length
439
+ const length = chunk.length
442
440
  while (position + 512 <= length && !this[ABORTED] && !this[SAW_EOF]) {
443
441
  switch (this[STATE]) {
444
442
  case 'begin':
@@ -20,8 +20,8 @@ module.exports = () => {
20
20
  // return a set of parent dirs for a given path
21
21
  const { join } = require('path')
22
22
  const getDirs = path =>
23
- join(path).split(/[\\\/]/).slice(0, -1).reduce((set, path) =>
24
- set.length ? set.concat(join(set[set.length-1], path)) : [path], [])
23
+ join(path).split(/[\\/]/).slice(0, -1).reduce((set, path) =>
24
+ set.length ? set.concat(join(set[set.length - 1], path)) : [path], [])
25
25
 
26
26
  // functions currently running
27
27
  const running = new Set()
@@ -80,9 +80,9 @@ module.exports = () => {
80
80
  dirs.forEach(dir => {
81
81
  const q = queues.get(dir)
82
82
  assert(q[0] instanceof Set)
83
- if (q[0].size === 1 && q.length === 1) {
83
+ if (q[0].size === 1 && q.length === 1)
84
84
  queues.delete(dir)
85
- } else if (q[0].size === 1) {
85
+ else if (q[0].size === 1) {
86
86
  q.shift()
87
87
 
88
88
  // must be a function or else the Set would've been reused
@@ -112,8 +112,8 @@ module.exports = () => {
112
112
  const q = queues.get(dir)
113
113
  if (!q)
114
114
  queues.set(dir, [new Set([fn])])
115
- else if (q[q.length-1] instanceof Set)
116
- q[q.length-1].add(fn)
115
+ else if (q[q.length - 1] instanceof Set)
116
+ q[q.length - 1].add(fn)
117
117
  else
118
118
  q.push(new Set([fn]))
119
119
  })