tar 6.0.5 → 6.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.
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
  })
package/lib/pax.js CHANGED
@@ -34,9 +34,8 @@ class Pax {
34
34
  const buf = Buffer.allocUnsafe(bufLen)
35
35
 
36
36
  // 0-fill the header section, it might not hit every field
37
- for (let i = 0; i < 512; i++) {
37
+ for (let i = 0; i < 512; i++)
38
38
  buf[i] = 0
39
- }
40
39
 
41
40
  new Header({
42
41
  // XXX split the path
@@ -55,15 +54,14 @@ class Pax {
55
54
  devmaj: 0,
56
55
  devmin: 0,
57
56
  atime: this.atime || null,
58
- ctime: this.ctime || null
57
+ ctime: this.ctime || null,
59
58
  }).encode(buf)
60
59
 
61
60
  buf.write(body, 512, bodyLen, 'utf8')
62
61
 
63
62
  // null pad after the body
64
- for (let i = bodyLen + 512; i < buf.length; i++) {
63
+ for (let i = bodyLen + 512; i < buf.length; i++)
65
64
  buf[i] = 0
66
- }
67
65
 
68
66
  return buf
69
67
  }
@@ -95,7 +93,7 @@ class Pax {
95
93
  : this[field]
96
94
  const s = ' ' +
97
95
  (field === 'dev' || field === 'ino' || field === 'nlink'
98
- ? 'SCHILY.' : '') +
96
+ ? 'SCHILY.' : '') +
99
97
  field + '=' + v + '\n'
100
98
  const byteLen = Buffer.byteLength(s)
101
99
  // the digits includes the length of the digits in ascii base-10
@@ -136,7 +134,7 @@ const parseKVLine = (set, line) => {
136
134
 
137
135
  const v = kv.join('=')
138
136
  set[k] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k)
139
- ? new Date(v * 1000)
137
+ ? new Date(v * 1000)
140
138
  : /^[0-9]+$/.test(v) ? +v
141
139
  : v
142
140
  return set
package/lib/read-entry.js CHANGED
@@ -1,5 +1,4 @@
1
1
  'use strict'
2
- const types = require('./types.js')
3
2
  const MiniPass = require('minipass')
4
3
 
5
4
  const SLURP = Symbol('slurp')
@@ -63,8 +62,10 @@ module.exports = class ReadEntry extends MiniPass {
63
62
  this.uname = header.uname
64
63
  this.gname = header.gname
65
64
 
66
- if (ex) this[SLURP](ex)
67
- if (gex) this[SLURP](gex, true)
65
+ if (ex)
66
+ this[SLURP](ex)
67
+ if (gex)
68
+ this[SLURP](gex, true)
68
69
  }
69
70
 
70
71
  write (data) {
@@ -87,7 +88,7 @@ module.exports = class ReadEntry extends MiniPass {
87
88
  }
88
89
 
89
90
  [SLURP] (ex, global) {
90
- for (let k in ex) {
91
+ for (const k in ex) {
91
92
  // we slurp in everything except for the path attribute in
92
93
  // a global extended header, because that's weird.
93
94
  if (ex[k] !== null && ex[k] !== undefined &&
package/lib/replace.js CHANGED
@@ -3,7 +3,6 @@
3
3
  // tar -r
4
4
  const hlo = require('./high-level-opt.js')
5
5
  const Pack = require('./pack.js')
6
- const Parse = require('./parse.js')
7
6
  const fs = require('fs')
8
7
  const fsm = require('fs-minipass')
9
8
  const t = require('./list.js')
@@ -17,7 +16,7 @@ const path = require('path')
17
16
 
18
17
  const Header = require('./header.js')
19
18
 
20
- const r = module.exports = (opt_, files, cb) => {
19
+ module.exports = (opt_, files, cb) => {
21
20
  const opt = hlo(opt_)
22
21
 
23
22
  if (!opt.file)
@@ -68,10 +67,10 @@ const replaceSync = (opt, files) => {
68
67
  break POSITION
69
68
  }
70
69
 
71
- let h = new Header(headBuf)
70
+ const h = new Header(headBuf)
72
71
  if (!h.cksumValid)
73
72
  break
74
- let entryBlockSize = 512 * Math.ceil(h.size / 512)
73
+ const entryBlockSize = 512 * Math.ceil(h.size / 512)
75
74
  if (position + entryBlockSize + 512 > st.size)
76
75
  break
77
76
  // the 512 for the header we just parsed will be added as well
@@ -84,15 +83,18 @@ const replaceSync = (opt, files) => {
84
83
 
85
84
  streamSync(opt, p, position, fd, files)
86
85
  } finally {
87
- if (threw)
88
- try { fs.closeSync(fd) } catch (er) {}
86
+ if (threw) {
87
+ try {
88
+ fs.closeSync(fd)
89
+ } catch (er) {}
90
+ }
89
91
  }
90
92
  }
91
93
 
92
94
  const streamSync = (opt, p, position, fd, files) => {
93
95
  const stream = new fsm.WriteStreamSync(opt.file, {
94
96
  fd: fd,
95
- start: position
97
+ start: position,
96
98
  })
97
99
  p.pipe(stream)
98
100
  addFilesSync(p, files)
@@ -120,11 +122,12 @@ const replace = (opt, files, cb) => {
120
122
  if (er)
121
123
  return cb(er)
122
124
  bufPos += bytes
123
- if (bufPos < 512 && bytes)
125
+ if (bufPos < 512 && bytes) {
124
126
  return fs.read(
125
127
  fd, headBuf, bufPos, headBuf.length - bufPos,
126
128
  position + bufPos, onread
127
129
  )
130
+ }
128
131
 
129
132
  if (position === 0 && headBuf[0] === 0x1f && headBuf[1] === 0x8b)
130
133
  return cb(new Error('cannot append to compressed archives'))
@@ -173,7 +176,7 @@ const replace = (opt, files, cb) => {
173
176
  return reject(er)
174
177
  const stream = new fsm.WriteStream(opt.file, {
175
178
  fd: fd,
176
- start: position
179
+ start: position,
177
180
  })
178
181
  p.pipe(stream)
179
182
  stream.on('error', reject)
@@ -190,14 +193,14 @@ const replace = (opt, files, cb) => {
190
193
 
191
194
  const addFilesSync = (p, files) => {
192
195
  files.forEach(file => {
193
- if (file.charAt(0) === '@')
196
+ if (file.charAt(0) === '@') {
194
197
  t({
195
198
  file: path.resolve(p.cwd, file.substr(1)),
196
199
  sync: true,
197
200
  noResume: true,
198
- onentry: entry => p.add(entry)
201
+ onentry: entry => p.add(entry),
199
202
  })
200
- else
203
+ } else
201
204
  p.add(file)
202
205
  })
203
206
  p.end()
@@ -206,13 +209,13 @@ const addFilesSync = (p, files) => {
206
209
  const addFilesAsync = (p, files) => {
207
210
  while (files.length) {
208
211
  const file = files.shift()
209
- if (file.charAt(0) === '@')
212
+ if (file.charAt(0) === '@') {
210
213
  return t({
211
214
  file: path.resolve(p.cwd, file.substr(1)),
212
215
  noResume: true,
213
- onentry: entry => p.add(entry)
216
+ onentry: entry => p.add(entry),
214
217
  }).then(_ => addFilesAsync(p, files))
215
- else
218
+ } else
216
219
  p.add(file)
217
220
  }
218
221
  p.end()
package/lib/types.js CHANGED
@@ -37,7 +37,7 @@ exports.name = new Map([
37
37
  // skip
38
38
  ['V', 'TapeVolumeHeader'],
39
39
  // like x
40
- ['X', 'OldExtendedHeader']
40
+ ['X', 'OldExtendedHeader'],
41
41
  ])
42
42
 
43
43
  // map the other direction
package/lib/unpack.js CHANGED
@@ -7,13 +7,11 @@
7
7
  // clobbering an fs object to create one of a different type.)
8
8
 
9
9
  const assert = require('assert')
10
- const EE = require('events').EventEmitter
11
10
  const Parser = require('./parse.js')
12
11
  const fs = require('fs')
13
12
  const fsm = require('fs-minipass')
14
13
  const path = require('path')
15
14
  const mkdir = require('./mkdir.js')
16
- const mkdirSync = mkdir.sync
17
15
  const wc = require('./winchars.js')
18
16
  const pathReservations = require('./path-reservations.js')
19
17
 
@@ -28,7 +26,6 @@ const LINK = Symbol('link')
28
26
  const SYMLINK = Symbol('symlink')
29
27
  const HARDLINK = Symbol('hardlink')
30
28
  const UNSUPPORTED = Symbol('unsupported')
31
- const UNKNOWN = Symbol('unknown')
32
29
  const CHECKPATH = Symbol('checkPath')
33
30
  const MKDIR = Symbol('mkdir')
34
31
  const ONERROR = Symbol('onError')
@@ -121,9 +118,10 @@ class Unpack extends Parser {
121
118
  // need both or neither
122
119
  if (typeof opt.uid !== 'number' || typeof opt.gid !== 'number')
123
120
  throw new TypeError('cannot set owner without number uid and gid')
124
- if (opt.preserveOwner)
121
+ if (opt.preserveOwner) {
125
122
  throw new TypeError(
126
123
  'cannot preserve owner in archive and also set owner explicitly')
124
+ }
127
125
  this.uid = opt.uid
128
126
  this.gid = opt.gid
129
127
  this.setOwner = true
@@ -171,11 +169,14 @@ class Unpack extends Parser {
171
169
 
172
170
  this.cwd = path.resolve(opt.cwd || process.cwd())
173
171
  this.strip = +opt.strip || 0
174
- this.processUmask = process.umask()
172
+ // if we're not chmodding, then we don't need the process umask
173
+ this.processUmask = opt.noChmod ? 0 : process.umask()
175
174
  this.umask = typeof opt.umask === 'number' ? opt.umask : this.processUmask
175
+
176
176
  // default mode for dirs created as parents
177
177
  this.dmode = opt.dmode || (0o0777 & (~this.umask))
178
178
  this.fmode = opt.fmode || (0o0666 & (~this.umask))
179
+
179
180
  this.on('entry', entry => this[ONENTRY](entry))
180
181
  }
181
182
 
@@ -271,6 +272,7 @@ class Unpack extends Parser {
271
272
  case 'CharacterDevice':
272
273
  case 'BlockDevice':
273
274
  case 'FIFO':
275
+ default:
274
276
  return this[UNSUPPORTED](entry)
275
277
  }
276
278
  }
@@ -299,7 +301,8 @@ class Unpack extends Parser {
299
301
  unlink: this.unlink,
300
302
  cache: this.dirCache,
301
303
  cwd: this.cwd,
302
- mode: mode
304
+ mode: mode,
305
+ noChmod: this.noChmod,
303
306
  }, cb)
304
307
  }
305
308
 
@@ -308,11 +311,11 @@ class Unpack extends Parser {
308
311
  // in set owner mode, chown if setting doesn't match process
309
312
  return this.forceChown ||
310
313
  this.preserveOwner &&
311
- ( typeof entry.uid === 'number' && entry.uid !== this.processUid ||
312
- typeof entry.gid === 'number' && entry.gid !== this.processGid )
314
+ (typeof entry.uid === 'number' && entry.uid !== this.processUid ||
315
+ typeof entry.gid === 'number' && entry.gid !== this.processGid)
313
316
  ||
314
- ( typeof this.uid === 'number' && this.uid !== this.processUid ||
315
- typeof this.gid === 'number' && this.gid !== this.processGid )
317
+ (typeof this.uid === 'number' && this.uid !== this.processUid ||
318
+ typeof this.gid === 'number' && this.gid !== this.processGid)
316
319
  }
317
320
 
318
321
  [UID] (entry) {
@@ -328,7 +331,7 @@ class Unpack extends Parser {
328
331
  const stream = new fsm.WriteStream(entry.absolute, {
329
332
  flags: getFlag(entry.size),
330
333
  mode: mode,
331
- autoClose: false
334
+ autoClose: false,
332
335
  })
333
336
  stream.on('error', er => this[ONERROR](er, entry))
334
337
 
@@ -460,6 +463,7 @@ class Unpack extends Parser {
460
463
  paths.push(entry.linkpath)
461
464
  this.reservations.reserve(paths, done => this[CHECKFS2](entry, done))
462
465
  }
466
+
463
467
  [CHECKFS2] (entry, done) {
464
468
  this[MKDIR](path.dirname(entry.absolute), this.dmode, er => {
465
469
  if (er) {
@@ -470,16 +474,17 @@ class Unpack extends Parser {
470
474
  if (st && (this.keep || this.newer && st.mtime > entry.mtime)) {
471
475
  this[SKIP](entry)
472
476
  done()
473
- } else if (er || this[ISREUSABLE](entry, st)) {
477
+ } else if (er || this[ISREUSABLE](entry, st))
474
478
  this[MAKEFS](null, entry, done)
475
- }
479
+
476
480
  else if (st.isDirectory()) {
477
481
  if (entry.type === 'Directory') {
478
- if (!entry.mode || (st.mode & 0o7777) === entry.mode)
482
+ if (!this.noChmod && (!entry.mode || (st.mode & 0o7777) === entry.mode))
479
483
  this[MAKEFS](null, entry, done)
480
- else
484
+ else {
481
485
  fs.chmod(entry.absolute, entry.mode,
482
486
  er => this[MAKEFS](er, entry, done))
487
+ }
483
488
  } else
484
489
  fs.rmdir(entry.absolute, er => this[MAKEFS](er, entry, done))
485
490
  } else
@@ -523,10 +528,6 @@ class Unpack extends Parser {
523
528
  }
524
529
 
525
530
  class UnpackSync extends Unpack {
526
- constructor (opt) {
527
- super(opt)
528
- }
529
-
530
531
  [CHECKFS] (entry) {
531
532
  const er = this[MKDIR](path.dirname(entry.absolute), this.dmode, neverCalled)
532
533
  if (er)
@@ -541,7 +542,7 @@ class UnpackSync extends Unpack {
541
542
  try {
542
543
  if (st.isDirectory()) {
543
544
  if (entry.type === 'Directory') {
544
- if (entry.mode && (st.mode & 0o7777) !== entry.mode)
545
+ if (!this.noChmod && entry.mode && (st.mode & 0o7777) !== entry.mode)
545
546
  fs.chmodSync(entry.absolute, entry.mode)
546
547
  } else
547
548
  fs.rmdirSync(entry.absolute)
@@ -571,7 +572,6 @@ class UnpackSync extends Unpack {
571
572
  this[ONERROR](er || closeError, entry)
572
573
  }
573
574
 
574
- let stream
575
575
  let fd
576
576
  try {
577
577
  fd = fs.openSync(entry.absolute, getFlag(entry.size), mode)
@@ -659,7 +659,7 @@ class UnpackSync extends Unpack {
659
659
  unlink: this.unlink,
660
660
  cache: this.dirCache,
661
661
  cwd: this.cwd,
662
- mode: mode
662
+ mode: mode,
663
663
  })
664
664
  } catch (er) {
665
665
  return er
package/lib/update.js CHANGED
@@ -6,7 +6,7 @@ const hlo = require('./high-level-opt.js')
6
6
  const r = require('./replace.js')
7
7
  // just call tar.r with the filter and mtimeCache
8
8
 
9
- const u = module.exports = (opt_, files, cb) => {
9
+ module.exports = (opt_, files, cb) => {
10
10
  const opt = hlo(opt_)
11
11
 
12
12
  if (!opt.file)
package/lib/warn-mixin.js CHANGED
@@ -13,9 +13,9 @@ module.exports = Base => class extends Base {
13
13
  message = message.message
14
14
  }
15
15
  this.emit('warn', data.tarCode, message, data)
16
- } else if (message instanceof Error) {
16
+ } else if (message instanceof Error)
17
17
  this.emit('error', Object.assign(message, data))
18
- } else
18
+ else
19
19
  this.emit('error', Object.assign(new Error(`${code}: ${message}`), data))
20
20
  }
21
21
  }
package/lib/winchars.js CHANGED
@@ -8,7 +8,7 @@ const raw = [
8
8
  '<',
9
9
  '>',
10
10
  '?',
11
- ':'
11
+ ':',
12
12
  ]
13
13
 
14
14
  const win = raw.map(char =>
@@ -19,5 +19,5 @@ const toRaw = new Map(win.map((char, i) => [char, raw[i]]))
19
19
 
20
20
  module.exports = {
21
21
  encode: s => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s),
22
- decode: s => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s)
22
+ decode: s => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s),
23
23
  }
@@ -2,11 +2,9 @@
2
2
  const MiniPass = require('minipass')
3
3
  const Pax = require('./pax.js')
4
4
  const Header = require('./header.js')
5
- const ReadEntry = require('./read-entry.js')
6
5
  const fs = require('fs')
7
6
  const path = require('path')
8
7
 
9
- const types = require('./types.js')
10
8
  const maxReadSize = 16 * 1024 * 1024
11
9
  const PROCESS = Symbol('process')
12
10
  const FILE = Symbol('file')
@@ -134,12 +132,12 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
134
132
  mtime: this.noMtime ? null : this.mtime || this.stat.mtime,
135
133
  type: this.type,
136
134
  uname: this.portable ? null :
137
- this.stat.uid === this.myuid ? this.myuser : '',
135
+ this.stat.uid === this.myuid ? this.myuser : '',
138
136
  atime: this.portable ? null : this.stat.atime,
139
- ctime: this.portable ? null : this.stat.ctime
137
+ ctime: this.portable ? null : this.stat.ctime,
140
138
  })
141
139
 
142
- if (this.header.encode() && !this.noPax)
140
+ if (this.header.encode() && !this.noPax) {
143
141
  this.write(new Pax({
144
142
  atime: this.portable ? null : this.header.atime,
145
143
  ctime: this.portable ? null : this.header.ctime,
@@ -152,8 +150,9 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
152
150
  uname: this.portable ? null : this.header.uname,
153
151
  dev: this.portable ? null : this.stat.dev,
154
152
  ino: this.portable ? null : this.stat.ino,
155
- nlink: this.portable ? null : this.stat.nlink
153
+ nlink: this.portable ? null : this.stat.nlink,
156
154
  }).encode())
155
+ }
157
156
  this.write(this.header.block)
158
157
  }
159
158
 
@@ -256,8 +255,8 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
256
255
  if (bytesRead === remain) {
257
256
  for (let i = bytesRead; i < length && bytesRead < blockRemain; i++) {
258
257
  buf[i + offset] = 0
259
- bytesRead ++
260
- remain ++
258
+ bytesRead++
259
+ remain++
261
260
  }
262
261
  }
263
262
 
@@ -286,10 +285,6 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
286
285
  })
287
286
 
288
287
  class WriteEntrySync extends WriteEntry {
289
- constructor (path, opt) {
290
- super(path, opt)
291
- }
292
-
293
288
  [LSTAT] () {
294
289
  this[ONLSTAT](fs.lstatSync(this.absolute))
295
290
  }
@@ -311,8 +306,11 @@ class WriteEntrySync extends WriteEntry {
311
306
  } finally {
312
307
  // ignoring the error from close(2) is a bad practice, but at
313
308
  // this point we already have an error, don't need another one
314
- if (threw)
315
- try { this[CLOSE](fd, () => {}) } catch (er) {}
309
+ if (threw) {
310
+ try {
311
+ this[CLOSE](fd, () => {})
312
+ } catch (er) {}
313
+ }
316
314
  }
317
315
  }
318
316
 
@@ -375,7 +373,7 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass {
375
373
  type: this.type,
376
374
  uname: this.portable ? null : this.uname,
377
375
  atime: this.portable ? null : this.atime,
378
- ctime: this.portable ? null : this.ctime
376
+ ctime: this.portable ? null : this.ctime,
379
377
  })
380
378
 
381
379
  if (pathWarn) {
@@ -385,7 +383,7 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass {
385
383
  })
386
384
  }
387
385
 
388
- if (this.header.encode() && !this.noPax)
386
+ if (this.header.encode() && !this.noPax) {
389
387
  super.write(new Pax({
390
388
  atime: this.portable ? null : this.atime,
391
389
  ctime: this.portable ? null : this.ctime,
@@ -398,8 +396,9 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass {
398
396
  uname: this.portable ? null : this.uname,
399
397
  dev: this.portable ? null : this.readEntry.dev,
400
398
  ino: this.portable ? null : this.readEntry.ino,
401
- nlink: this.portable ? null : this.readEntry.nlink
399
+ nlink: this.portable ? null : this.readEntry.nlink,
402
400
  }).encode())
401
+ }
403
402
 
404
403
  super.write(this.header.block)
405
404
  readEntry.pipe(this)
package/package.json CHANGED
@@ -2,13 +2,17 @@
2
2
  "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
3
3
  "name": "tar",
4
4
  "description": "tar for node",
5
- "version": "6.0.5",
5
+ "version": "6.1.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/npm/node-tar.git"
9
9
  },
10
10
  "scripts": {
11
11
  "test": "tap",
12
+ "posttest": "npm run lint",
13
+ "eslint": "eslint",
14
+ "lint": "npm run eslint -- test lib",
15
+ "lintfix": "npm run lint -- --fix",
12
16
  "preversion": "npm test",
13
17
  "postversion": "npm publish",
14
18
  "prepublishOnly": "git push origin --follow-tags",
@@ -26,6 +30,11 @@
26
30
  "devDependencies": {
27
31
  "chmodr": "^1.2.0",
28
32
  "end-of-stream": "^1.4.3",
33
+ "eslint": "^7.17.0",
34
+ "eslint-plugin-import": "^2.22.1",
35
+ "eslint-plugin-node": "^11.1.0",
36
+ "eslint-plugin-promise": "^4.2.1",
37
+ "eslint-plugin-standard": "^5.0.0",
29
38
  "events-to-array": "^1.1.2",
30
39
  "mutate-fs": "^2.1.1",
31
40
  "rimraf": "^2.7.1",