tar 2.1.0 → 2.2.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 (63) hide show
  1. package/.nyc_output/0471d9cf-687f-4ae8-84a5-ce7468becd03.json +1 -0
  2. package/.nyc_output/12bca2bc-6a2b-4f45-abc7-8483922a524d.json +1 -0
  3. package/.nyc_output/37d58de4-deea-4808-bb77-d27685bd1501.json +1 -0
  4. package/.nyc_output/5ad8066b-6b8c-4bc8-b807-c40bf80898b7.json +1 -0
  5. package/.nyc_output/5cbf674c-7089-4b7d-b9de-2119be4dbb0b.json +1 -0
  6. package/.nyc_output/7853e29b-78ef-4ab4-b8fb-e1e176c0787b.json +1 -0
  7. package/.nyc_output/9d414044-b18d-4f6d-b2e0-531a89bf6f4f.json +1 -0
  8. package/.nyc_output/c3ffeb8c-8e79-4a2c-b678-e5a917fe721e.json +1 -0
  9. package/.nyc_output/ea0194cb-f599-402f-8876-84fb8251e8db.json +1 -0
  10. package/.nyc_output/eda6b7a3-5e15-440f-8619-e11a15a07f77.json +1 -0
  11. package/.nyc_output/fb518800-240c-42ff-811f-79e92708d9db.json +1 -0
  12. package/.nyc_output/fdecfc06-a944-4897-9530-e08f62883fc1.json +1 -0
  13. package/.nyc_output/processinfo/0471d9cf-687f-4ae8-84a5-ce7468becd03.json +1 -0
  14. package/.nyc_output/processinfo/12bca2bc-6a2b-4f45-abc7-8483922a524d.json +1 -0
  15. package/.nyc_output/processinfo/37d58de4-deea-4808-bb77-d27685bd1501.json +1 -0
  16. package/.nyc_output/processinfo/5ad8066b-6b8c-4bc8-b807-c40bf80898b7.json +1 -0
  17. package/.nyc_output/processinfo/5cbf674c-7089-4b7d-b9de-2119be4dbb0b.json +1 -0
  18. package/.nyc_output/processinfo/7853e29b-78ef-4ab4-b8fb-e1e176c0787b.json +1 -0
  19. package/.nyc_output/processinfo/9d414044-b18d-4f6d-b2e0-531a89bf6f4f.json +1 -0
  20. package/.nyc_output/processinfo/c3ffeb8c-8e79-4a2c-b678-e5a917fe721e.json +1 -0
  21. package/.nyc_output/processinfo/ea0194cb-f599-402f-8876-84fb8251e8db.json +1 -0
  22. package/.nyc_output/processinfo/eda6b7a3-5e15-440f-8619-e11a15a07f77.json +1 -0
  23. package/.nyc_output/processinfo/fb518800-240c-42ff-811f-79e92708d9db.json +1 -0
  24. package/.nyc_output/processinfo/fdecfc06-a944-4897-9530-e08f62883fc1.json +1 -0
  25. package/.nyc_output/processinfo/index.json +1 -0
  26. package/LICENSE +12 -0
  27. package/coverage/lcov-report/base.css +212 -0
  28. package/coverage/lcov-report/index.html +106 -0
  29. package/coverage/lcov-report/prettify.css +1 -0
  30. package/coverage/lcov-report/prettify.js +1 -0
  31. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  32. package/coverage/lcov-report/sorter.js +158 -0
  33. package/coverage/lcov-report/tar/index.html +93 -0
  34. package/coverage/lcov-report/tar/index.js.html +119 -0
  35. package/coverage/lcov-report/tar/lib/create.js.html +380 -0
  36. package/coverage/lcov-report/tar/lib/extract.js.html +401 -0
  37. package/coverage/lcov-report/tar/lib/header.js.html +881 -0
  38. package/coverage/lcov-report/tar/lib/high-level-opt.js.html +152 -0
  39. package/coverage/lcov-report/tar/lib/index.html +314 -0
  40. package/coverage/lcov-report/tar/lib/large-numbers.js.html +341 -0
  41. package/coverage/lcov-report/tar/lib/list.js.html +449 -0
  42. package/coverage/lcov-report/tar/lib/mkdir.js.html +686 -0
  43. package/coverage/lcov-report/tar/lib/pack.js.html +1268 -0
  44. package/coverage/lcov-report/tar/lib/parse.js.html +1310 -0
  45. package/coverage/lcov-report/tar/lib/pax.js.html +500 -0
  46. package/coverage/lcov-report/tar/lib/read-entry.js.html +347 -0
  47. package/coverage/lcov-report/tar/lib/replace.js.html +722 -0
  48. package/coverage/lcov-report/tar/lib/types.js.html +197 -0
  49. package/coverage/lcov-report/tar/lib/unpack.js.html +1604 -0
  50. package/coverage/lcov-report/tar/lib/update.js.html +173 -0
  51. package/coverage/lcov-report/tar/lib/warn-mixin.js.html +107 -0
  52. package/coverage/lcov-report/tar/lib/winchars.js.html +134 -0
  53. package/coverage/lcov-report/tar/lib/write-entry.js.html +1268 -0
  54. package/coverage/lcov.info +3690 -0
  55. package/lib/entry.js +7 -0
  56. package/lib/parse.js +11 -1
  57. package/package.json +4 -4
  58. package/test/link-file-entry-collision/bad-link.hex +25 -0
  59. package/test/link-file-entry-collision/bad-link.tar +0 -0
  60. package/test/link-file-entry-collision.js +39 -0
  61. package/test/parse-discard.js +29 -0
  62. package/.npmignore +0 -5
  63. package/LICENCE +0 -25
@@ -0,0 +1,401 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>Code coverage report for tar/lib/extract.js</title>
5
+ <meta charset="utf-8" />
6
+ <link rel="stylesheet" href="../../prettify.css" />
7
+ <link rel="stylesheet" href="../../base.css" />
8
+ <meta name="viewport" content="width=device-width, initial-scale=1">
9
+ <style type='text/css'>
10
+ .coverage-summary .sorter {
11
+ background-image: url(../../sort-arrow-sprite.png);
12
+ }
13
+ </style>
14
+ </head>
15
+ <body>
16
+ <div class='wrapper'>
17
+ <div class='pad1'>
18
+ <h1>
19
+ <a href="../../index.html">All files</a> / <a href="index.html">tar/lib</a> extract.js
20
+ </h1>
21
+ <div class='clearfix'>
22
+ <div class='fl pad1y space-right2'>
23
+ <span class="strong">100% </span>
24
+ <span class="quiet">Statements</span>
25
+ <span class='fraction'>61/61</span>
26
+ </div>
27
+ <div class='fl pad1y space-right2'>
28
+ <span class="strong">100% </span>
29
+ <span class="quiet">Branches</span>
30
+ <span class='fraction'>45/45</span>
31
+ </div>
32
+ <div class='fl pad1y space-right2'>
33
+ <span class="strong">100% </span>
34
+ <span class="quiet">Functions</span>
35
+ <span class='fraction'>12/12</span>
36
+ </div>
37
+ <div class='fl pad1y space-right2'>
38
+ <span class="strong">100% </span>
39
+ <span class="quiet">Lines</span>
40
+ <span class='fraction'>60/60</span>
41
+ </div>
42
+ </div>
43
+ </div>
44
+ <div class='status-line high'></div>
45
+ <pre><table class="coverage">
46
+ <tr><td class="line-count quiet">1
47
+ 2
48
+ 3
49
+ 4
50
+ 5
51
+ 6
52
+ 7
53
+ 8
54
+ 9
55
+ 10
56
+ 11
57
+ 12
58
+ 13
59
+ 14
60
+ 15
61
+ 16
62
+ 17
63
+ 18
64
+ 19
65
+ 20
66
+ 21
67
+ 22
68
+ 23
69
+ 24
70
+ 25
71
+ 26
72
+ 27
73
+ 28
74
+ 29
75
+ 30
76
+ 31
77
+ 32
78
+ 33
79
+ 34
80
+ 35
81
+ 36
82
+ 37
83
+ 38
84
+ 39
85
+ 40
86
+ 41
87
+ 42
88
+ 43
89
+ 44
90
+ 45
91
+ 46
92
+ 47
93
+ 48
94
+ 49
95
+ 50
96
+ 51
97
+ 52
98
+ 53
99
+ 54
100
+ 55
101
+ 56
102
+ 57
103
+ 58
104
+ 59
105
+ 60
106
+ 61
107
+ 62
108
+ 63
109
+ 64
110
+ 65
111
+ 66
112
+ 67
113
+ 68
114
+ 69
115
+ 70
116
+ 71
117
+ 72
118
+ 73
119
+ 74
120
+ 75
121
+ 76
122
+ 77
123
+ 78
124
+ 79
125
+ 80
126
+ 81
127
+ 82
128
+ 83
129
+ 84
130
+ 85
131
+ 86
132
+ 87
133
+ 88
134
+ 89
135
+ 90
136
+ 91
137
+ 92
138
+ 93
139
+ 94
140
+ 95
141
+ 96
142
+ 97
143
+ 98
144
+ 99
145
+ 100
146
+ 101
147
+ 102
148
+ 103
149
+ 104
150
+ 105
151
+ 106
152
+ 107
153
+ 108
154
+ 109
155
+ 110
156
+ 111
157
+ 112
158
+ 113</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
159
+ <span class="cline-any cline-neutral">&nbsp;</span>
160
+ <span class="cline-any cline-neutral">&nbsp;</span>
161
+ <span class="cline-any cline-yes">2x</span>
162
+ <span class="cline-any cline-yes">2x</span>
163
+ <span class="cline-any cline-yes">2x</span>
164
+ <span class="cline-any cline-yes">2x</span>
165
+ <span class="cline-any cline-yes">2x</span>
166
+ <span class="cline-any cline-neutral">&nbsp;</span>
167
+ <span class="cline-any cline-yes">2x</span>
168
+ <span class="cline-any cline-yes">21x</span>
169
+ <span class="cline-any cline-yes">1x</span>
170
+ <span class="cline-any cline-yes">20x</span>
171
+ <span class="cline-any cline-yes">1x</span>
172
+ <span class="cline-any cline-neutral">&nbsp;</span>
173
+ <span class="cline-any cline-yes">21x</span>
174
+ <span class="cline-any cline-yes">3x</span>
175
+ <span class="cline-any cline-neutral">&nbsp;</span>
176
+ <span class="cline-any cline-yes">21x</span>
177
+ <span class="cline-any cline-yes">13x</span>
178
+ <span class="cline-any cline-neutral">&nbsp;</span>
179
+ <span class="cline-any cline-yes">8x</span>
180
+ <span class="cline-any cline-neutral">&nbsp;</span>
181
+ <span class="cline-any cline-yes">21x</span>
182
+ <span class="cline-any cline-neutral">&nbsp;</span>
183
+ <span class="cline-any cline-yes">21x</span>
184
+ <span class="cline-any cline-yes">2x</span>
185
+ <span class="cline-any cline-neutral">&nbsp;</span>
186
+ <span class="cline-any cline-yes">19x</span>
187
+ <span class="cline-any cline-yes">1x</span>
188
+ <span class="cline-any cline-neutral">&nbsp;</span>
189
+ <span class="cline-any cline-yes">18x</span>
190
+ <span class="cline-any cline-yes">7x</span>
191
+ <span class="cline-any cline-neutral">&nbsp;</span>
192
+ <span class="cline-any cline-yes">18x</span>
193
+ <span class="cline-any cline-neutral">&nbsp;</span>
194
+ <span class="cline-any cline-neutral">&nbsp;</span>
195
+ <span class="cline-any cline-neutral">&nbsp;</span>
196
+ <span class="cline-any cline-neutral">&nbsp;</span>
197
+ <span class="cline-any cline-neutral">&nbsp;</span>
198
+ <span class="cline-any cline-neutral">&nbsp;</span>
199
+ <span class="cline-any cline-neutral">&nbsp;</span>
200
+ <span class="cline-any cline-yes">2x</span>
201
+ <span class="cline-any cline-yes">13x</span>
202
+ <span class="cline-any cline-yes">7x</span>
203
+ <span class="cline-any cline-neutral">&nbsp;</span>
204
+ <span class="cline-any cline-yes">7x</span>
205
+ <span class="cline-any cline-yes">87x</span>
206
+ <span class="cline-any cline-yes">87x</span>
207
+ <span class="cline-any cline-neutral">&nbsp;</span>
208
+ <span class="cline-any cline-neutral">&nbsp;</span>
209
+ <span class="cline-any cline-neutral">&nbsp;</span>
210
+ <span class="cline-any cline-yes">87x</span>
211
+ <span class="cline-any cline-yes">87x</span>
212
+ <span class="cline-any cline-neutral">&nbsp;</span>
213
+ <span class="cline-any cline-neutral">&nbsp;</span>
214
+ <span class="cline-any cline-yes">7x</span>
215
+ <span class="cline-any cline-yes">9x</span>
216
+ <span class="cline-any cline-yes">9x</span>
217
+ <span class="cline-any cline-neutral">&nbsp;</span>
218
+ <span class="cline-any cline-neutral">&nbsp;</span>
219
+ <span class="cline-any cline-yes">2x</span>
220
+ <span class="cline-any cline-yes">6x</span>
221
+ <span class="cline-any cline-neutral">&nbsp;</span>
222
+ <span class="cline-any cline-yes">6x</span>
223
+ <span class="cline-any cline-yes">6x</span>
224
+ <span class="cline-any cline-neutral">&nbsp;</span>
225
+ <span class="cline-any cline-yes">6x</span>
226
+ <span class="cline-any cline-neutral">&nbsp;</span>
227
+ <span class="cline-any cline-neutral">&nbsp;</span>
228
+ <span class="cline-any cline-yes">5x</span>
229
+ <span class="cline-any cline-yes">5x</span>
230
+ <span class="cline-any cline-neutral">&nbsp;</span>
231
+ <span class="cline-any cline-neutral">&nbsp;</span>
232
+ <span class="cline-any cline-neutral">&nbsp;</span>
233
+ <span class="cline-any cline-yes">4x</span>
234
+ <span class="cline-any cline-neutral">&nbsp;</span>
235
+ <span class="cline-any cline-neutral">&nbsp;</span>
236
+ <span class="cline-any cline-yes">2x</span>
237
+ <span class="cline-any cline-yes">9x</span>
238
+ <span class="cline-any cline-yes">9x</span>
239
+ <span class="cline-any cline-neutral">&nbsp;</span>
240
+ <span class="cline-any cline-yes">9x</span>
241
+ <span class="cline-any cline-yes">9x</span>
242
+ <span class="cline-any cline-yes">9x</span>
243
+ <span class="cline-any cline-yes">9x</span>
244
+ <span class="cline-any cline-neutral">&nbsp;</span>
245
+ <span class="cline-any cline-neutral">&nbsp;</span>
246
+ <span class="cline-any cline-neutral">&nbsp;</span>
247
+ <span class="cline-any cline-yes">9x</span>
248
+ <span class="cline-any cline-yes">9x</span>
249
+ <span class="cline-any cline-yes">1x</span>
250
+ <span class="cline-any cline-neutral">&nbsp;</span>
251
+ <span class="cline-any cline-yes">8x</span>
252
+ <span class="cline-any cline-neutral">&nbsp;</span>
253
+ <span class="cline-any cline-neutral">&nbsp;</span>
254
+ <span class="cline-any cline-neutral">&nbsp;</span>
255
+ <span class="cline-any cline-yes">8x</span>
256
+ <span class="cline-any cline-yes">8x</span>
257
+ <span class="cline-any cline-neutral">&nbsp;</span>
258
+ <span class="cline-any cline-neutral">&nbsp;</span>
259
+ <span class="cline-any cline-neutral">&nbsp;</span>
260
+ <span class="cline-any cline-yes">9x</span>
261
+ <span class="cline-any cline-neutral">&nbsp;</span>
262
+ <span class="cline-any cline-neutral">&nbsp;</span>
263
+ <span class="cline-any cline-yes">2x</span>
264
+ <span class="cline-any cline-yes">1x</span>
265
+ <span class="cline-any cline-neutral">&nbsp;</span>
266
+ <span class="cline-any cline-neutral">&nbsp;</span>
267
+ <span class="cline-any cline-yes">2x</span>
268
+ <span class="cline-any cline-yes">2x</span>
269
+ <span class="cline-any cline-neutral">&nbsp;</span>
270
+ <span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict'
271
+ &nbsp;
272
+ // tar -x
273
+ const hlo = require('./high-level-opt.js')
274
+ const Unpack = require('./unpack.js')
275
+ const fs = require('fs')
276
+ const fsm = require('fs-minipass')
277
+ const path = require('path')
278
+ &nbsp;
279
+ const x = module.exports = (opt_, files, cb) =&gt; {
280
+ if (typeof opt_ === 'function')
281
+ cb = opt_, files = null, opt_ = {}
282
+ else if (Array.isArray(opt_))
283
+ files = opt_, opt_ = {}
284
+ &nbsp;
285
+ if (typeof files === 'function')
286
+ cb = files, files = null
287
+ &nbsp;
288
+ if (!files)
289
+ files = []
290
+ else
291
+ files = Array.from(files)
292
+ &nbsp;
293
+ const opt = hlo(opt_)
294
+ &nbsp;
295
+ if (opt.sync &amp;&amp; typeof cb === 'function')
296
+ throw new TypeError('callback not supported for sync tar functions')
297
+ &nbsp;
298
+ if (!opt.file &amp;&amp; typeof cb === 'function')
299
+ throw new TypeError('callback only supported with file option')
300
+ &nbsp;
301
+ if (files.length)
302
+ filesFilter(opt, files)
303
+ &nbsp;
304
+ return opt.file &amp;&amp; opt.sync ? extractFileSync(opt)
305
+ : opt.file ? extractFile(opt, cb)
306
+ : opt.sync ? extractSync(opt)
307
+ : extract(opt)
308
+ }
309
+ &nbsp;
310
+ // construct a filter that limits the file entries listed
311
+ // include child entries if a dir is included
312
+ const filesFilter = (opt, files) =&gt; {
313
+ const map = new Map(files.map(f =&gt; [f.replace(/\/+$/, ''), true]))
314
+ const filter = opt.filter
315
+ &nbsp;
316
+ const mapHas = (file, r) =&gt; {
317
+ const root = r || path.parse(file).root || '.'
318
+ const ret = file === root ? false
319
+ : map.has(file) ? map.get(file)
320
+ : mapHas(path.dirname(file), root)
321
+ &nbsp;
322
+ map.set(file, ret)
323
+ return ret
324
+ }
325
+ &nbsp;
326
+ opt.filter = filter
327
+ ? (file, entry) =&gt; filter(file, entry) &amp;&amp; mapHas(file.replace(/\/+$/, ''))
328
+ : file =&gt; mapHas(file.replace(/\/+$/, ''))
329
+ }
330
+ &nbsp;
331
+ const extractFileSync = opt =&gt; {
332
+ const u = new Unpack.Sync(opt)
333
+ &nbsp;
334
+ const file = opt.file
335
+ let threw = true
336
+ let fd
337
+ const stat = fs.statSync(file)
338
+ // This trades a zero-byte read() syscall for a stat
339
+ // However, it will usually result in less memory allocation
340
+ const readSize = opt.maxReadSize || 16*1024*1024
341
+ const stream = new fsm.ReadStreamSync(file, {
342
+ readSize: readSize,
343
+ size: stat.size
344
+ })
345
+ stream.pipe(u)
346
+ }
347
+ &nbsp;
348
+ const extractFile = (opt, cb) =&gt; {
349
+ const u = new Unpack(opt)
350
+ const readSize = opt.maxReadSize || 16*1024*1024
351
+ &nbsp;
352
+ const file = opt.file
353
+ const p = new Promise((resolve, reject) =&gt; {
354
+ u.on('error', reject)
355
+ u.on('close', resolve)
356
+ &nbsp;
357
+ // This trades a zero-byte read() syscall for a stat
358
+ // However, it will usually result in less memory allocation
359
+ fs.stat(file, (er, stat) =&gt; {
360
+ if (er)
361
+ reject(er)
362
+ else {
363
+ const stream = new fsm.ReadStream(file, {
364
+ readSize: readSize,
365
+ size: stat.size
366
+ })
367
+ stream.on('error', reject)
368
+ stream.pipe(u)
369
+ }
370
+ })
371
+ })
372
+ return cb ? p.then(cb, cb) : p
373
+ }
374
+ &nbsp;
375
+ const extractSync = opt =&gt; {
376
+ return new Unpack.Sync(opt)
377
+ }
378
+ &nbsp;
379
+ const extract = opt =&gt; {
380
+ return new Unpack(opt)
381
+ }
382
+ &nbsp;</pre></td></tr>
383
+ </table></pre>
384
+ <div class='push'></div><!-- for sticky footer -->
385
+ </div><!-- /wrapper -->
386
+ <div class='footer quiet pad2 space-top1 center small'>
387
+ Code coverage
388
+ generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
389
+ </div>
390
+ </div>
391
+ <script src="../../prettify.js"></script>
392
+ <script>
393
+ window.onload = function () {
394
+ if (typeof prettyPrint === 'function') {
395
+ prettyPrint();
396
+ }
397
+ };
398
+ </script>
399
+ <script src="../../sorter.js"></script>
400
+ </body>
401
+ </html>