structure, layout and automation

This commit is contained in:
Tancre
2020-09-16 14:23:28 +02:00
commit 0efda7fffe
15549 changed files with 1280031 additions and 0 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{"uuid":"0471d9cf-687f-4ae8-84a5-ce7468becd03","parent":"37d58de4-deea-4808-bb77-d27685bd1501","pid":93247,"argv":["/usr/local/bin/node","/Users/isaacs/dev/js/tar/test/parse-discard.js"],"execArgv":["-r","/usr/local/lib/node_modules/tap/node_modules/esm/esm.js"],"cwd":"/Users/isaacs/dev/js/tar","time":1557878802822,"ppid":93238,"root":"e52f8603-1293-44df-8bfa-ed740bdd2b77","coverageFilename":"/Users/isaacs/dev/js/tar/.nyc_output/0471d9cf-687f-4ae8-84a5-ce7468becd03.json","externalId":"test/parse-discard.js","files":["/Users/isaacs/dev/js/tar/lib/pack.js","/Users/isaacs/dev/js/tar/lib/entry-writer.js","/Users/isaacs/dev/js/tar/lib/entry.js","/Users/isaacs/dev/js/tar/lib/global-header-writer.js","/Users/isaacs/dev/js/tar/lib/parse.js","/Users/isaacs/dev/js/tar/lib/buffer-entry.js","/Users/isaacs/dev/js/tar/lib/extended-header.js","/Users/isaacs/dev/js/tar/lib/extract.js"]}

View File

@ -0,0 +1 @@
{"uuid":"12bca2bc-6a2b-4f45-abc7-8483922a524d","parent":"37d58de4-deea-4808-bb77-d27685bd1501","pid":93240,"argv":["/usr/local/bin/node","/Users/isaacs/dev/js/tar/test/dir-normalization.js"],"execArgv":["-r","/usr/local/lib/node_modules/tap/node_modules/esm/esm.js"],"cwd":"/Users/isaacs/dev/js/tar","time":1557878801286,"ppid":93238,"root":"e52f8603-1293-44df-8bfa-ed740bdd2b77","coverageFilename":"/Users/isaacs/dev/js/tar/.nyc_output/12bca2bc-6a2b-4f45-abc7-8483922a524d.json","externalId":"test/dir-normalization.js","files":["/Users/isaacs/dev/js/tar/lib/pack.js","/Users/isaacs/dev/js/tar/lib/entry-writer.js","/Users/isaacs/dev/js/tar/lib/entry.js","/Users/isaacs/dev/js/tar/lib/global-header-writer.js","/Users/isaacs/dev/js/tar/lib/parse.js","/Users/isaacs/dev/js/tar/lib/buffer-entry.js","/Users/isaacs/dev/js/tar/lib/extended-header.js","/Users/isaacs/dev/js/tar/lib/extract.js"]}

View File

@ -0,0 +1 @@
{"uuid":"37d58de4-deea-4808-bb77-d27685bd1501","parent":null,"pid":93238,"argv":["/usr/local/bin/node","/usr/local/bin/tap","test/00-setup-fixtures.js","test/dir-normalization.js","test/error-on-broken.js","test/extract-move.js","test/extract.js","test/header.js","test/pack-no-proprietary.js","test/pack.js","test/parse-discard.js","test/parse.js","test/zz-cleanup.js"],"execArgv":[],"cwd":"/Users/isaacs/dev/js/tar","time":1557878798122,"ppid":93237,"root":"e52f8603-1293-44df-8bfa-ed740bdd2b77","coverageFilename":"/Users/isaacs/dev/js/tar/.nyc_output/37d58de4-deea-4808-bb77-d27685bd1501.json","files":[]}

View File

@ -0,0 +1 @@
{"uuid":"5ad8066b-6b8c-4bc8-b807-c40bf80898b7","parent":"37d58de4-deea-4808-bb77-d27685bd1501","pid":93246,"argv":["/usr/local/bin/node","/Users/isaacs/dev/js/tar/test/pack.js"],"execArgv":["-r","/usr/local/lib/node_modules/tap/node_modules/esm/esm.js"],"cwd":"/Users/isaacs/dev/js/tar","time":1557878801645,"ppid":93238,"root":"e52f8603-1293-44df-8bfa-ed740bdd2b77","coverageFilename":"/Users/isaacs/dev/js/tar/.nyc_output/5ad8066b-6b8c-4bc8-b807-c40bf80898b7.json","externalId":"test/pack.js","files":[]}

View File

@ -0,0 +1 @@
{"uuid":"5cbf674c-7089-4b7d-b9de-2119be4dbb0b","parent":"37d58de4-deea-4808-bb77-d27685bd1501","pid":93241,"argv":["/usr/local/bin/node","/Users/isaacs/dev/js/tar/test/error-on-broken.js"],"execArgv":["-r","/usr/local/lib/node_modules/tap/node_modules/esm/esm.js"],"cwd":"/Users/isaacs/dev/js/tar","time":1557878801335,"ppid":93238,"root":"e52f8603-1293-44df-8bfa-ed740bdd2b77","coverageFilename":"/Users/isaacs/dev/js/tar/.nyc_output/5cbf674c-7089-4b7d-b9de-2119be4dbb0b.json","externalId":"test/error-on-broken.js","files":["/Users/isaacs/dev/js/tar/lib/pack.js","/Users/isaacs/dev/js/tar/lib/entry-writer.js","/Users/isaacs/dev/js/tar/lib/entry.js","/Users/isaacs/dev/js/tar/lib/global-header-writer.js","/Users/isaacs/dev/js/tar/lib/parse.js","/Users/isaacs/dev/js/tar/lib/buffer-entry.js","/Users/isaacs/dev/js/tar/lib/extended-header.js","/Users/isaacs/dev/js/tar/lib/extract.js"]}

View File

@ -0,0 +1 @@
{"uuid":"7853e29b-78ef-4ab4-b8fb-e1e176c0787b","parent":"37d58de4-deea-4808-bb77-d27685bd1501","pid":93245,"argv":["/usr/local/bin/node","/Users/isaacs/dev/js/tar/test/pack-no-proprietary.js"],"execArgv":["-r","/usr/local/lib/node_modules/tap/node_modules/esm/esm.js"],"cwd":"/Users/isaacs/dev/js/tar","time":1557878801610,"ppid":93238,"root":"e52f8603-1293-44df-8bfa-ed740bdd2b77","coverageFilename":"/Users/isaacs/dev/js/tar/.nyc_output/7853e29b-78ef-4ab4-b8fb-e1e176c0787b.json","externalId":"test/pack-no-proprietary.js","files":[]}

View File

@ -0,0 +1 @@
{"uuid":"9d414044-b18d-4f6d-b2e0-531a89bf6f4f","parent":"37d58de4-deea-4808-bb77-d27685bd1501","pid":93250,"argv":["/usr/local/bin/node","/Users/isaacs/dev/js/tar/test/zz-cleanup.js"],"execArgv":["-r","/usr/local/lib/node_modules/tap/node_modules/esm/esm.js"],"cwd":"/Users/isaacs/dev/js/tar","time":1557878803490,"ppid":93238,"root":"e52f8603-1293-44df-8bfa-ed740bdd2b77","coverageFilename":"/Users/isaacs/dev/js/tar/.nyc_output/9d414044-b18d-4f6d-b2e0-531a89bf6f4f.json","externalId":"test/zz-cleanup.js","files":[]}

View File

@ -0,0 +1 @@
{"uuid":"c3ffeb8c-8e79-4a2c-b678-e5a917fe721e","parent":"37d58de4-deea-4808-bb77-d27685bd1501","pid":93243,"argv":["/usr/local/bin/node","/Users/isaacs/dev/js/tar/test/extract.js"],"execArgv":["-r","/usr/local/lib/node_modules/tap/node_modules/esm/esm.js"],"cwd":"/Users/isaacs/dev/js/tar","time":1557878801464,"ppid":93238,"root":"e52f8603-1293-44df-8bfa-ed740bdd2b77","coverageFilename":"/Users/isaacs/dev/js/tar/.nyc_output/c3ffeb8c-8e79-4a2c-b678-e5a917fe721e.json","externalId":"test/extract.js","files":["/Users/isaacs/dev/js/tar/lib/pack.js","/Users/isaacs/dev/js/tar/lib/entry-writer.js","/Users/isaacs/dev/js/tar/lib/entry.js","/Users/isaacs/dev/js/tar/lib/global-header-writer.js","/Users/isaacs/dev/js/tar/lib/parse.js","/Users/isaacs/dev/js/tar/lib/buffer-entry.js","/Users/isaacs/dev/js/tar/lib/extended-header.js","/Users/isaacs/dev/js/tar/lib/extract.js"]}

View File

@ -0,0 +1 @@
{"uuid":"ea0194cb-f599-402f-8876-84fb8251e8db","parent":"37d58de4-deea-4808-bb77-d27685bd1501","pid":93239,"argv":["/usr/local/bin/node","/Users/isaacs/dev/js/tar/test/00-setup-fixtures.js"],"execArgv":["-r","/usr/local/lib/node_modules/tap/node_modules/esm/esm.js"],"cwd":"/Users/isaacs/dev/js/tar","time":1557878801284,"ppid":93238,"root":"e52f8603-1293-44df-8bfa-ed740bdd2b77","coverageFilename":"/Users/isaacs/dev/js/tar/.nyc_output/ea0194cb-f599-402f-8876-84fb8251e8db.json","externalId":"test/00-setup-fixtures.js","files":[]}

View File

@ -0,0 +1 @@
{"uuid":"eda6b7a3-5e15-440f-8619-e11a15a07f77","parent":"37d58de4-deea-4808-bb77-d27685bd1501","pid":93242,"argv":["/usr/local/bin/node","/Users/isaacs/dev/js/tar/test/extract-move.js"],"execArgv":["-r","/usr/local/lib/node_modules/tap/node_modules/esm/esm.js"],"cwd":"/Users/isaacs/dev/js/tar","time":1557878801409,"ppid":93238,"root":"e52f8603-1293-44df-8bfa-ed740bdd2b77","coverageFilename":"/Users/isaacs/dev/js/tar/.nyc_output/eda6b7a3-5e15-440f-8619-e11a15a07f77.json","externalId":"test/extract-move.js","files":["/Users/isaacs/dev/js/tar/lib/pack.js","/Users/isaacs/dev/js/tar/lib/entry-writer.js","/Users/isaacs/dev/js/tar/lib/entry.js","/Users/isaacs/dev/js/tar/lib/global-header-writer.js","/Users/isaacs/dev/js/tar/lib/parse.js","/Users/isaacs/dev/js/tar/lib/buffer-entry.js","/Users/isaacs/dev/js/tar/lib/extended-header.js","/Users/isaacs/dev/js/tar/lib/extract.js"]}

View File

@ -0,0 +1 @@
{"uuid":"fb518800-240c-42ff-811f-79e92708d9db","parent":"37d58de4-deea-4808-bb77-d27685bd1501","pid":93244,"argv":["/usr/local/bin/node","/Users/isaacs/dev/js/tar/test/header.js"],"execArgv":["-r","/usr/local/lib/node_modules/tap/node_modules/esm/esm.js"],"cwd":"/Users/isaacs/dev/js/tar","time":1557878801608,"ppid":93238,"root":"e52f8603-1293-44df-8bfa-ed740bdd2b77","coverageFilename":"/Users/isaacs/dev/js/tar/.nyc_output/fb518800-240c-42ff-811f-79e92708d9db.json","externalId":"test/header.js","files":["/Users/isaacs/dev/js/tar/lib/pack.js","/Users/isaacs/dev/js/tar/lib/entry-writer.js","/Users/isaacs/dev/js/tar/lib/entry.js","/Users/isaacs/dev/js/tar/lib/global-header-writer.js","/Users/isaacs/dev/js/tar/lib/parse.js","/Users/isaacs/dev/js/tar/lib/buffer-entry.js","/Users/isaacs/dev/js/tar/lib/extended-header.js","/Users/isaacs/dev/js/tar/lib/extract.js"]}

View File

@ -0,0 +1 @@
{"uuid":"fdecfc06-a944-4897-9530-e08f62883fc1","parent":"37d58de4-deea-4808-bb77-d27685bd1501","pid":93248,"argv":["/usr/local/bin/node","/Users/isaacs/dev/js/tar/test/parse.js"],"execArgv":["-r","/usr/local/lib/node_modules/tap/node_modules/esm/esm.js"],"cwd":"/Users/isaacs/dev/js/tar","time":1557878802931,"ppid":93238,"root":"e52f8603-1293-44df-8bfa-ed740bdd2b77","coverageFilename":"/Users/isaacs/dev/js/tar/.nyc_output/fdecfc06-a944-4897-9530-e08f62883fc1.json","externalId":"test/parse.js","files":["/Users/isaacs/dev/js/tar/lib/pack.js","/Users/isaacs/dev/js/tar/lib/entry-writer.js","/Users/isaacs/dev/js/tar/lib/entry.js","/Users/isaacs/dev/js/tar/lib/global-header-writer.js","/Users/isaacs/dev/js/tar/lib/parse.js","/Users/isaacs/dev/js/tar/lib/buffer-entry.js","/Users/isaacs/dev/js/tar/lib/extended-header.js","/Users/isaacs/dev/js/tar/lib/extract.js"]}

1
node_modules/tar/.nyc_output/processinfo/index.json generated vendored Normal file

File diff suppressed because one or more lines are too long

4
node_modules/tar/.travis.yml generated vendored Normal file
View File

@ -0,0 +1,4 @@
language: node_js
node_js:
- 0.10
- 0.11

12
node_modules/tar/LICENSE generated vendored Normal file
View File

@ -0,0 +1,12 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

50
node_modules/tar/README.md generated vendored Normal file
View File

@ -0,0 +1,50 @@
# node-tar
Tar for Node.js.
[![NPM](https://nodei.co/npm/tar.png)](https://nodei.co/npm/tar/)
## API
See `examples/` for usage examples.
### var tar = require('tar')
Returns an object with `.Pack`, `.Extract` and `.Parse` methods.
### tar.Pack([properties])
Returns a through stream. Use
[fstream](https://npmjs.org/package/fstream) to write files into the
pack stream and you will receive tar archive data from the pack
stream.
This only works with directories, it does not work with individual files.
The optional `properties` object are used to set properties in the tar
'Global Extended Header'. If the `fromBase` property is set to true,
the tar will contain files relative to the path passed, and not with
the path included.
### tar.Extract([options])
Returns a through stream. Write tar data to the stream and the files
in the tarball will be extracted onto the filesystem.
`options` can be:
```js
{
path: '/path/to/extract/tar/into',
strip: 0, // how many path segments to strip from the root when extracting
}
```
`options` also get passed to the `fstream.Writer` instance that `tar`
uses internally.
### tar.Parse()
Returns a writable stream. Write tar data to it and it will emit
`entry` events for each entry parsed from the tarball. This is used by
`tar.Extract`.

212
node_modules/tar/coverage/lcov-report/base.css generated vendored Normal file
View File

@ -0,0 +1,212 @@
body, html {
margin:0; padding: 0;
height: 100%;
}
body {
font-family: Helvetica Neue, Helvetica, Arial;
font-size: 14px;
color:#333;
}
.small { font-size: 12px; }
*, *:after, *:before {
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
}
h1 { font-size: 20px; margin: 0;}
h2 { font-size: 14px; }
pre {
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
margin: 0;
padding: 0;
-moz-tab-size: 2;
-o-tab-size: 2;
tab-size: 2;
}
a { color:#0074D9; text-decoration:none; }
a:hover { text-decoration:underline; }
.strong { font-weight: bold; }
.space-top1 { padding: 10px 0 0 0; }
.pad2y { padding: 20px 0; }
.pad1y { padding: 10px 0; }
.pad2x { padding: 0 20px; }
.pad2 { padding: 20px; }
.pad1 { padding: 10px; }
.space-left2 { padding-left:55px; }
.space-right2 { padding-right:20px; }
.center { text-align:center; }
.clearfix { display:block; }
.clearfix:after {
content:'';
display:block;
height:0;
clear:both;
visibility:hidden;
}
.fl { float: left; }
@media only screen and (max-width:640px) {
.col3 { width:100%; max-width:100%; }
.hide-mobile { display:none!important; }
}
.quiet {
color: #7f7f7f;
color: rgba(0,0,0,0.5);
}
.quiet a { opacity: 0.7; }
.fraction {
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
font-size: 10px;
color: #555;
background: #E8E8E8;
padding: 4px 5px;
border-radius: 3px;
vertical-align: middle;
}
div.path a:link, div.path a:visited { color: #333; }
table.coverage {
border-collapse: collapse;
margin: 10px 0 0 0;
padding: 0;
}
table.coverage td {
margin: 0;
padding: 0;
vertical-align: top;
}
table.coverage td.line-count {
text-align: right;
padding: 0 5px 0 20px;
}
table.coverage td.line-coverage {
text-align: right;
padding-right: 10px;
min-width:20px;
}
table.coverage td span.cline-any {
display: inline-block;
padding: 0 5px;
width: 100%;
}
.missing-if-branch {
display: inline-block;
margin-right: 5px;
border-radius: 3px;
position: relative;
padding: 0 4px;
background: #333;
color: yellow;
}
.skip-if-branch {
display: none;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: #ccc;
color: white;
}
.missing-if-branch .typ, .skip-if-branch .typ {
color: inherit !important;
}
.coverage-summary {
border-collapse: collapse;
width: 100%;
}
.coverage-summary tr { border-bottom: 1px solid #bbb; }
.keyline-all { border: 1px solid #ddd; }
.coverage-summary td, .coverage-summary th { padding: 10px; }
.coverage-summary tbody { border: 1px solid #bbb; }
.coverage-summary td { border-right: 1px solid #bbb; }
.coverage-summary td:last-child { border-right: none; }
.coverage-summary th {
text-align: left;
font-weight: normal;
white-space: nowrap;
}
.coverage-summary th.file { border-right: none !important; }
.coverage-summary th.pct { }
.coverage-summary th.pic,
.coverage-summary th.abs,
.coverage-summary td.pct,
.coverage-summary td.abs { text-align: right; }
.coverage-summary td.file { white-space: nowrap; }
.coverage-summary td.pic { min-width: 120px !important; }
.coverage-summary tfoot td { }
.coverage-summary .sorter {
height: 10px;
width: 7px;
display: inline-block;
margin-left: 0.5em;
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
}
.coverage-summary .sorted .sorter {
background-position: 0 -20px;
}
.coverage-summary .sorted-desc .sorter {
background-position: 0 -10px;
}
.status-line { height: 10px; }
/* dark red */
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
.low .chart { border:1px solid #C21F39 }
/* medium red */
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
/* light red */
.low, .cline-no { background:#FCE1E5 }
/* light green */
.high, .cline-yes { background:rgb(230,245,208) }
/* medium green */
.cstat-yes { background:rgb(161,215,106) }
/* dark green */
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
.high .chart { border:1px solid rgb(77,146,33) }
.medium .chart { border:1px solid #666; }
.medium .cover-fill { background: #666; }
.cbranch-no { background: yellow !important; color: #111; }
.cstat-skip { background: #ddd; color: #111; }
.fstat-skip { background: #ddd; color: #111 !important; }
.cbranch-skip { background: #ddd !important; color: #111; }
span.cline-neutral { background: #eaeaea; }
.medium { background: #eaeaea; }
.cover-fill, .cover-empty {
display:inline-block;
height: 12px;
}
.chart {
line-height: 0;
}
.cover-empty {
background: white;
}
.cover-full {
border-right: none !important;
}
pre.prettyprint {
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
.com { color: #999 !important; }
.ignore-none { color: #999; font-weight: normal; }
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -48px;
}
.footer, .push {
height: 48px;
}

106
node_modules/tar/coverage/lcov-report/index.html generated vendored Normal file
View File

@ -0,0 +1,106 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for All files</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="prettify.css" />
<link rel="stylesheet" href="base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
All files
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">99.94% </span>
<span class="quiet">Statements</span>
<span class='fraction'>1795/1796</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">99.67% </span>
<span class="quiet">Branches</span>
<span class='fraction'>1224/1228</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>271/271</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">99.94% </span>
<span class="quiet">Lines</span>
<span class='fraction'>1748/1749</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file high" data-value="tar"><a href="tar/index.html">tar</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="13" class="abs high">13/13</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="13" class="abs high">13/13</td>
</tr>
<tr>
<td class="file high" data-value="tar/lib"><a href="tar/lib/index.html">tar/lib</a></td>
<td data-value="99.94" class="pic high"><div class="chart"><div class="cover-fill" style="width: 99%;"></div><div class="cover-empty" style="width:1%;"></div></div></td>
<td data-value="99.94" class="pct high">99.94%</td>
<td data-value="1783" class="abs high">1782/1783</td>
<td data-value="99.67" class="pct high">99.67%</td>
<td data-value="1228" class="abs high">1224/1228</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="271" class="abs high">271/271</td>
<td data-value="99.94" class="pct high">99.94%</td>
<td data-value="1736" class="abs high">1735/1736</td>
</tr>
</tbody>
</table>
</div><div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="sorter.js"></script>
</body>
</html>

1
node_modules/tar/coverage/lcov-report/prettify.css generated vendored Normal file
View File

@ -0,0 +1 @@
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}

1
node_modules/tar/coverage/lcov-report/prettify.js generated vendored Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

158
node_modules/tar/coverage/lcov-report/sorter.js generated vendored Normal file
View File

@ -0,0 +1,158 @@
var addSorting = (function () {
"use strict";
var cols,
currentSort = {
index: 0,
desc: false
};
// returns the summary table element
function getTable() { return document.querySelector('.coverage-summary'); }
// returns the thead element of the summary table
function getTableHeader() { return getTable().querySelector('thead tr'); }
// returns the tbody element of the summary table
function getTableBody() { return getTable().querySelector('tbody'); }
// returns the th element for nth column
function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; }
// loads all columns
function loadColumns() {
var colNodes = getTableHeader().querySelectorAll('th'),
colNode,
cols = [],
col,
i;
for (i = 0; i < colNodes.length; i += 1) {
colNode = colNodes[i];
col = {
key: colNode.getAttribute('data-col'),
sortable: !colNode.getAttribute('data-nosort'),
type: colNode.getAttribute('data-type') || 'string'
};
cols.push(col);
if (col.sortable) {
col.defaultDescSort = col.type === 'number';
colNode.innerHTML = colNode.innerHTML + '<span class="sorter"></span>';
}
}
return cols;
}
// attaches a data attribute to every tr element with an object
// of data values keyed by column name
function loadRowData(tableRow) {
var tableCols = tableRow.querySelectorAll('td'),
colNode,
col,
data = {},
i,
val;
for (i = 0; i < tableCols.length; i += 1) {
colNode = tableCols[i];
col = cols[i];
val = colNode.getAttribute('data-value');
if (col.type === 'number') {
val = Number(val);
}
data[col.key] = val;
}
return data;
}
// loads all row data
function loadData() {
var rows = getTableBody().querySelectorAll('tr'),
i;
for (i = 0; i < rows.length; i += 1) {
rows[i].data = loadRowData(rows[i]);
}
}
// sorts the table using the data for the ith column
function sortByIndex(index, desc) {
var key = cols[index].key,
sorter = function (a, b) {
a = a.data[key];
b = b.data[key];
return a < b ? -1 : a > b ? 1 : 0;
},
finalSorter = sorter,
tableBody = document.querySelector('.coverage-summary tbody'),
rowNodes = tableBody.querySelectorAll('tr'),
rows = [],
i;
if (desc) {
finalSorter = function (a, b) {
return -1 * sorter(a, b);
};
}
for (i = 0; i < rowNodes.length; i += 1) {
rows.push(rowNodes[i]);
tableBody.removeChild(rowNodes[i]);
}
rows.sort(finalSorter);
for (i = 0; i < rows.length; i += 1) {
tableBody.appendChild(rows[i]);
}
}
// removes sort indicators for current column being sorted
function removeSortIndicators() {
var col = getNthColumn(currentSort.index),
cls = col.className;
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
col.className = cls;
}
// adds sort indicators for current column being sorted
function addSortIndicators() {
getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted';
}
// adds event listeners for all sorter widgets
function enableUI() {
var i,
el,
ithSorter = function ithSorter(i) {
var col = cols[i];
return function () {
var desc = col.defaultDescSort;
if (currentSort.index === i) {
desc = !currentSort.desc;
}
sortByIndex(i, desc);
removeSortIndicators();
currentSort.index = i;
currentSort.desc = desc;
addSortIndicators();
};
};
for (i =0 ; i < cols.length; i += 1) {
if (cols[i].sortable) {
// add the click event handler on the th so users
// dont have to click on those tiny arrows
el = getNthColumn(i).querySelector('.sorter').parentElement;
if (el.addEventListener) {
el.addEventListener('click', ithSorter(i));
} else {
el.attachEvent('onclick', ithSorter(i));
}
}
}
}
// adds sorting functionality to the UI
return function () {
if (!getTable()) {
return;
}
cols = loadColumns();
loadData(cols);
addSortIndicators();
enableUI();
};
})();
window.addEventListener('load', addSorting);

93
node_modules/tar/coverage/lcov-report/tar/index.html generated vendored Normal file
View File

@ -0,0 +1,93 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for tar</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../index.html">All files</a> tar
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>13/13</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>13/13</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file high" data-value="index.js"><a href="index.js.html">index.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="13" class="abs high">13/13</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="13" class="abs high">13/13</td>
</tr>
</tbody>
</table>
</div><div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

119
node_modules/tar/coverage/lcov-report/tar/index.js.html generated vendored Normal file
View File

@ -0,0 +1,119 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for tar/index.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../index.html">All files</a> / <a href="index.html">tar</a> index.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>13/13</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>13/13</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict'
&nbsp;
// high-level commands
exports.c = exports.create = require('./lib/create.js')
exports.r = exports.replace = require('./lib/replace.js')
exports.t = exports.list = require('./lib/list.js')
exports.u = exports.update = require('./lib/update.js')
exports.x = exports.extract = require('./lib/extract.js')
&nbsp;
// classes
exports.Pack = require('./lib/pack.js')
exports.Unpack = require('./lib/unpack.js')
exports.Parse = require('./lib/parse.js')
exports.ReadEntry = require('./lib/read-entry.js')
exports.WriteEntry = require('./lib/write-entry.js')
exports.Header = require('./lib/header.js')
exports.Pax = require('./lib/pax.js')
exports.types = require('./lib/types.js')
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>

View File

@ -0,0 +1,380 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for tar/lib/create.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">tar/lib</a> create.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>59/59</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>35/35</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>12/12</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>59/59</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">15x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">15x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">15x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict'
&nbsp;
// tar -c
const hlo = require('./high-level-opt.js')
&nbsp;
const Pack = require('./pack.js')
const fs = require('fs')
const fsm = require('fs-minipass')
const t = require('./list.js')
const path = require('path')
&nbsp;
const c = module.exports = (opt_, files, cb) =&gt; {
if (typeof files === 'function')
cb = files
&nbsp;
if (Array.isArray(opt_))
files = opt_, opt_ = {}
&nbsp;
if (!files || !Array.isArray(files) || !files.length)
throw new TypeError('no files or directories specified')
&nbsp;
files = Array.from(files)
&nbsp;
const opt = hlo(opt_)
&nbsp;
if (opt.sync &amp;&amp; typeof cb === 'function')
throw new TypeError('callback not supported for sync tar functions')
&nbsp;
if (!opt.file &amp;&amp; typeof cb === 'function')
throw new TypeError('callback only supported with file option')
&nbsp;
return opt.file &amp;&amp; opt.sync ? createFileSync(opt, files)
: opt.file ? createFile(opt, files, cb)
: opt.sync ? createSync(opt, files)
: create(opt, files)
}
&nbsp;
const createFileSync = (opt, files) =&gt; {
const p = new Pack.Sync(opt)
const stream = new fsm.WriteStreamSync(opt.file, {
mode: opt.mode || 0o666
})
p.pipe(stream)
addFilesSync(p, files)
}
&nbsp;
const createFile = (opt, files, cb) =&gt; {
const p = new Pack(opt)
const stream = new fsm.WriteStream(opt.file, {
mode: opt.mode || 0o666
})
p.pipe(stream)
&nbsp;
const promise = new Promise((res, rej) =&gt; {
stream.on('error', rej)
stream.on('close', res)
p.on('error', rej)
})
&nbsp;
addFilesAsync(p, files)
&nbsp;
return cb ? promise.then(cb, cb) : promise
}
&nbsp;
const addFilesSync = (p, files) =&gt; {
files.forEach(file =&gt; {
if (file.charAt(0) === '@')
t({
file: path.resolve(p.cwd, file.substr(1)),
sync: true,
noResume: true,
onentry: entry =&gt; p.add(entry)
})
else
p.add(file)
})
p.end()
}
&nbsp;
const addFilesAsync = (p, files) =&gt; {
while (files.length) {
const file = files.shift()
if (file.charAt(0) === '@')
return t({
file: path.resolve(p.cwd, file.substr(1)),
noResume: true,
onentry: entry =&gt; p.add(entry)
}).then(_ =&gt; addFilesAsync(p, files))
else
p.add(file)
}
p.end()
}
&nbsp;
const createSync = (opt, files) =&gt; {
const p = new Pack.Sync(opt)
addFilesSync(p, files)
return p
}
&nbsp;
const create = (opt, files) =&gt; {
const p = new Pack(opt)
addFilesAsync(p, files)
return p
}
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

View File

@ -0,0 +1,401 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for tar/lib/extract.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">tar/lib</a> extract.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>61/61</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>45/45</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>12/12</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>60/60</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">21x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">20x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">21x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">21x</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">21x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">21x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">19x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">18x</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">18x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-yes">87x</span>
<span class="cline-any cline-yes">87x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">87x</span>
<span class="cline-any cline-yes">87x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict'
&nbsp;
// tar -x
const hlo = require('./high-level-opt.js')
const Unpack = require('./unpack.js')
const fs = require('fs')
const fsm = require('fs-minipass')
const path = require('path')
&nbsp;
const x = module.exports = (opt_, files, cb) =&gt; {
if (typeof opt_ === 'function')
cb = opt_, files = null, opt_ = {}
else if (Array.isArray(opt_))
files = opt_, opt_ = {}
&nbsp;
if (typeof files === 'function')
cb = files, files = null
&nbsp;
if (!files)
files = []
else
files = Array.from(files)
&nbsp;
const opt = hlo(opt_)
&nbsp;
if (opt.sync &amp;&amp; typeof cb === 'function')
throw new TypeError('callback not supported for sync tar functions')
&nbsp;
if (!opt.file &amp;&amp; typeof cb === 'function')
throw new TypeError('callback only supported with file option')
&nbsp;
if (files.length)
filesFilter(opt, files)
&nbsp;
return opt.file &amp;&amp; opt.sync ? extractFileSync(opt)
: opt.file ? extractFile(opt, cb)
: opt.sync ? extractSync(opt)
: extract(opt)
}
&nbsp;
// construct a filter that limits the file entries listed
// include child entries if a dir is included
const filesFilter = (opt, files) =&gt; {
const map = new Map(files.map(f =&gt; [f.replace(/\/+$/, ''), true]))
const filter = opt.filter
&nbsp;
const mapHas = (file, r) =&gt; {
const root = r || path.parse(file).root || '.'
const ret = file === root ? false
: map.has(file) ? map.get(file)
: mapHas(path.dirname(file), root)
&nbsp;
map.set(file, ret)
return ret
}
&nbsp;
opt.filter = filter
? (file, entry) =&gt; filter(file, entry) &amp;&amp; mapHas(file.replace(/\/+$/, ''))
: file =&gt; mapHas(file.replace(/\/+$/, ''))
}
&nbsp;
const extractFileSync = opt =&gt; {
const u = new Unpack.Sync(opt)
&nbsp;
const file = opt.file
let threw = true
let fd
const stat = fs.statSync(file)
// This trades a zero-byte read() syscall for a stat
// However, it will usually result in less memory allocation
const readSize = opt.maxReadSize || 16*1024*1024
const stream = new fsm.ReadStreamSync(file, {
readSize: readSize,
size: stat.size
})
stream.pipe(u)
}
&nbsp;
const extractFile = (opt, cb) =&gt; {
const u = new Unpack(opt)
const readSize = opt.maxReadSize || 16*1024*1024
&nbsp;
const file = opt.file
const p = new Promise((resolve, reject) =&gt; {
u.on('error', reject)
u.on('close', resolve)
&nbsp;
// This trades a zero-byte read() syscall for a stat
// However, it will usually result in less memory allocation
fs.stat(file, (er, stat) =&gt; {
if (er)
reject(er)
else {
const stream = new fsm.ReadStream(file, {
readSize: readSize,
size: stat.size
})
stream.on('error', reject)
stream.pipe(u)
}
})
})
return cb ? p.then(cb, cb) : p
}
&nbsp;
const extractSync = opt =&gt; {
return new Unpack.Sync(opt)
}
&nbsp;
const extract = opt =&gt; {
return new Unpack(opt)
}
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

View File

@ -0,0 +1,881 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for tar/lib/header.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">tar/lib</a> header.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>161/161</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>120/120</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>20/20</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>159/159</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13121x</span>
<span class="cline-any cline-yes">6393x</span>
<span class="cline-any cline-yes">6728x</span>
<span class="cline-any cline-yes">6726x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6393x</span>
<span class="cline-any cline-yes">2795x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6393x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-yes">1990x</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-yes">1594x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-yes">4275x</span>
<span class="cline-any cline-yes">4275x</span>
<span class="cline-any cline-yes">4275x</span>
<span class="cline-any cline-yes">4275x</span>
<span class="cline-any cline-yes">4275x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4273x</span>
<span class="cline-any cline-yes">4273x</span>
<span class="cline-any cline-yes">295x</span>
<span class="cline-any cline-yes">4273x</span>
<span class="cline-any cline-yes">4273x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-yes">946016x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-yes">2275552x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-yes">6392x</span>
<span class="cline-any cline-yes">1860x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6719x</span>
<span class="cline-any cline-yes">6600x</span>
<span class="cline-any cline-yes">6600x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6719x</span>
<span class="cline-any cline-yes">6717x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6719x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6716x</span>
<span class="cline-any cline-yes">6716x</span>
<span class="cline-any cline-yes">6716x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">994264x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">2391608x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6728x</span>
<span class="cline-any cline-yes">73451x</span>
<span class="cline-any cline-yes">66740x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">8178x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6723x</span>
<span class="cline-any cline-yes">6719x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-yes">6683x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">35x</span>
<span class="cline-any cline-yes">35x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">35x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">49x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">21x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">28x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">15x</span>
<span class="cline-any cline-yes">15x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">35x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6718x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">32001x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">14938x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">14938x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">55448x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">55411x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">55411x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">66910x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">66615x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">66615x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">66615x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">20150x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">40308x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict'
// parse a 512-byte header block to a data object, or vice-versa
// encode returns `true` if a pax extended header is needed, because
// the data could not be faithfully encoded in a simple header.
// (Also, check header.needPax to see if it needs a pax header.)
&nbsp;
const types = require('./types.js')
const pathModule = require('path')
const large = require('./large-numbers.js')
&nbsp;
const TYPE = Symbol('type')
&nbsp;
class Header {
constructor (data, off) {
this.cksumValid = false
this.needPax = false
this.nullBlock = false
&nbsp;
this.block = null
this.path = null
this.mode = null
this.uid = null
this.gid = null
this.size = null
this.mtime = null
this.cksum = null
this[TYPE] = '0'
this.linkpath = null
this.uname = null
this.gname = null
this.devmaj = 0
this.devmin = 0
this.atime = null
this.ctime = null
&nbsp;
if (Buffer.isBuffer(data)) {
this.decode(data, off || 0)
} else if (data)
this.set(data)
}
&nbsp;
decode (buf, off) {
if (!off)
off = 0
&nbsp;
if (!buf || !(buf.length &gt;= off + 512))
throw new Error('need 512 bytes for header')
&nbsp;
this.path = decString(buf, off, 100)
this.mode = decNumber(buf, off + 100, 8)
this.uid = decNumber(buf, off + 108, 8)
this.gid = decNumber(buf, off + 116, 8)
this.size = decNumber(buf, off + 124, 12)
this.mtime = decDate(buf, off + 136, 12)
this.cksum = decNumber(buf, off + 148, 12)
&nbsp;
// old tar versions marked dirs as a file with a trailing /
this[TYPE] = decString(buf, off + 156, 1)
if (this[TYPE] === '')
this[TYPE] = '0'
if (this[TYPE] === '0' &amp;&amp; this.path.substr(-1) === '/')
this[TYPE] = '5'
&nbsp;
// tar implementations sometimes incorrectly put the stat(dir).size
// as the size in the tarball, even though Directory entries are
// not able to have any body at all. In the very rare chance that
// it actually DOES have a body, we weren't going to do anything with
// it anyway, and it'll just be a warning about an invalid header.
if (this[TYPE] === '5')
this.size = 0
&nbsp;
this.linkpath = decString(buf, off + 157, 100)
if (buf.slice(off + 257, off + 265).toString() === 'ustar\u000000') {
this.uname = decString(buf, off + 265, 32)
this.gname = decString(buf, off + 297, 32)
this.devmaj = decNumber(buf, off + 329, 8)
this.devmin = decNumber(buf, off + 337, 8)
if (buf[off + 475] !== 0) {
// definitely a prefix, definitely &gt;130 chars.
const prefix = decString(buf, off + 345, 155)
this.path = prefix + '/' + this.path
} else {
const prefix = decString(buf, off + 345, 130)
if (prefix)
this.path = prefix + '/' + this.path
this.atime = decDate(buf, off + 476, 12)
this.ctime = decDate(buf, off + 488, 12)
}
}
&nbsp;
let sum = 8 * 0x20
for (let i = off; i &lt; off + 148; i++) {
sum += buf[i]
}
for (let i = off + 156; i &lt; off + 512; i++) {
sum += buf[i]
}
this.cksumValid = sum === this.cksum
if (this.cksum === null &amp;&amp; sum === 8 * 0x20)
this.nullBlock = true
}
&nbsp;
encode (buf, off) {
if (!buf) {
buf = this.block = Buffer.alloc(512)
off = 0
}
&nbsp;
if (!off)
off = 0
&nbsp;
if (!(buf.length &gt;= off + 512))
throw new Error('need 512 bytes for header')
&nbsp;
const prefixSize = this.ctime || this.atime ? 130 : 155
const split = splitPrefix(this.path || '', prefixSize)
const path = split[0]
const prefix = split[1]
this.needPax = split[2]
&nbsp;
this.needPax = encString(buf, off, 100, path) || this.needPax
this.needPax = encNumber(buf, off + 100, 8, this.mode) || this.needPax
this.needPax = encNumber(buf, off + 108, 8, this.uid) || this.needPax
this.needPax = encNumber(buf, off + 116, 8, this.gid) || this.needPax
this.needPax = encNumber(buf, off + 124, 12, this.size) || this.needPax
this.needPax = encDate(buf, off + 136, 12, this.mtime) || this.needPax
buf[off + 156] = this[TYPE].charCodeAt(0)
this.needPax = encString(buf, off + 157, 100, this.linkpath) || this.needPax
buf.write('ustar\u000000', off + 257, 8)
this.needPax = encString(buf, off + 265, 32, this.uname) || this.needPax
this.needPax = encString(buf, off + 297, 32, this.gname) || this.needPax
this.needPax = encNumber(buf, off + 329, 8, this.devmaj) || this.needPax
this.needPax = encNumber(buf, off + 337, 8, this.devmin) || this.needPax
this.needPax = encString(buf, off + 345, prefixSize, prefix) || this.needPax
if (buf[off + 475] !== 0)
this.needPax = encString(buf, off + 345, 155, prefix) || this.needPax
else {
this.needPax = encString(buf, off + 345, 130, prefix) || this.needPax
this.needPax = encDate(buf, off + 476, 12, this.atime) || this.needPax
this.needPax = encDate(buf, off + 488, 12, this.ctime) || this.needPax
}
&nbsp;
let sum = 8 * 0x20
for (let i = off; i &lt; off + 148; i++) {
sum += buf[i]
}
for (let i = off + 156; i &lt; off + 512; i++) {
sum += buf[i]
}
this.cksum = sum
encNumber(buf, off + 148, 8, this.cksum)
this.cksumValid = true
&nbsp;
return this.needPax
}
&nbsp;
set (data) {
for (let i in data) {
if (data[i] !== null &amp;&amp; data[i] !== undefined)
this[i] = data[i]
}
}
&nbsp;
get type () {
return types.name.get(this[TYPE]) || this[TYPE]
}
&nbsp;
get typeKey () {
return this[TYPE]
}
&nbsp;
set type (type) {
if (types.code.has(type))
this[TYPE] = types.code.get(type)
else
this[TYPE] = type
}
}
&nbsp;
const splitPrefix = (p, prefixSize) =&gt; {
const pathSize = 100
let pp = p
let prefix = ''
let ret
const root = pathModule.parse(p).root || '.'
&nbsp;
if (Buffer.byteLength(pp) &lt; pathSize)
ret = [pp, prefix, false]
else {
// first set prefix to the dir, and path to the base
prefix = pathModule.dirname(pp)
pp = pathModule.basename(pp)
&nbsp;
do {
// both fit!
if (Buffer.byteLength(pp) &lt;= pathSize &amp;&amp;
Buffer.byteLength(prefix) &lt;= prefixSize)
ret = [pp, prefix, false]
&nbsp;
// prefix fits in prefix, but path doesn't fit in path
else if (Buffer.byteLength(pp) &gt; pathSize &amp;&amp;
Buffer.byteLength(prefix) &lt;= prefixSize)
ret = [pp.substr(0, pathSize - 1), prefix, true]
&nbsp;
else {
// make path take a bit from prefix
pp = pathModule.join(pathModule.basename(prefix), pp)
prefix = pathModule.dirname(prefix)
}
} while (prefix !== root &amp;&amp; !ret)
&nbsp;
// at this point, found no resolution, just truncate
if (!ret)
ret = [p.substr(0, pathSize - 1), '', true]
}
return ret
}
&nbsp;
const decString = (buf, off, size) =&gt;
buf.slice(off, off + size).toString('utf8').replace(/\0.*/, '')
&nbsp;
const decDate = (buf, off, size) =&gt;
numToDate(decNumber(buf, off, size))
&nbsp;
const numToDate = num =&gt; num === null ? null : new Date(num * 1000)
&nbsp;
const decNumber = (buf, off, size) =&gt;
buf[off] &amp; 0x80 ? large.parse(buf.slice(off, off + size))
: decSmallNumber(buf, off, size)
&nbsp;
const nanNull = value =&gt; isNaN(value) ? null : value
&nbsp;
const decSmallNumber = (buf, off, size) =&gt;
nanNull(parseInt(
buf.slice(off, off + size)
.toString('utf8').replace(/\0.*$/, '').trim(), 8))
&nbsp;
// the maximum encodable as a null-terminated octal, by field size
const MAXNUM = {
12: 0o77777777777,
8 : 0o7777777
}
&nbsp;
const encNumber = (buf, off, size, number) =&gt;
number === null ? false :
number &gt; MAXNUM[size] || number &lt; 0
? (large.encode(number, buf.slice(off, off + size)), true)
: (encSmallNumber(buf, off, size, number), false)
&nbsp;
const encSmallNumber = (buf, off, size, number) =&gt;
buf.write(octalString(number, size), off, size, 'ascii')
&nbsp;
const octalString = (number, size) =&gt;
padOctal(Math.floor(number).toString(8), size)
&nbsp;
const padOctal = (string, size) =&gt;
(string.length === size - 1 ? string
: new Array(size - string.length - 1).join('0') + string + ' ') + '\0'
&nbsp;
const encDate = (buf, off, size, date) =&gt;
date === null ? false :
encNumber(buf, off, size, date.getTime() / 1000)
&nbsp;
// enough to fill the longest string we've got
const NULLS = new Array(156).join('\0')
// pad with nulls, return true if it's longer or non-ascii
const encString = (buf, off, size, string) =&gt;
string === null ? false :
(buf.write(string + NULLS, off, size, 'utf8'),
string.length !== Buffer.byteLength(string) || string.length &gt; size)
&nbsp;
module.exports = Header
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

View File

@ -0,0 +1,152 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for tar/lib/high-level-opt.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">tar/lib</a> high-level-opt.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>5/5</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>4/4</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>3/3</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>3/3</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">469x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">469x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict'
&nbsp;
// turn tar(1) style args like `C` into the more verbose things like `cwd`
&nbsp;
const argmap = new Map([
['C', 'cwd'],
['f', 'file'],
['z', 'gzip'],
['P', 'preservePaths'],
['U', 'unlink'],
['strip-components', 'strip'],
['stripComponents', 'strip'],
['keep-newer', 'newer'],
['keepNewer', 'newer'],
['keep-newer-files', 'newer'],
['keepNewerFiles', 'newer'],
['k', 'keep'],
['keep-existing', 'keep'],
['keepExisting', 'keep'],
['m', 'noMtime'],
['no-mtime', 'noMtime'],
['p', 'preserveOwner'],
['L', 'follow'],
['h', 'follow']
])
&nbsp;
const parse = module.exports = opt =&gt; opt ? Object.keys(opt).map(k =&gt; [
argmap.has(k) ? argmap.get(k) : k, opt[k]
]).reduce((set, kv) =&gt; (set[kv[0]] = kv[1], set), Object.create(null)) : {}
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

View File

@ -0,0 +1,314 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for tar/lib</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> tar/lib
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">99.94% </span>
<span class="quiet">Statements</span>
<span class='fraction'>1782/1783</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">99.67% </span>
<span class="quiet">Branches</span>
<span class='fraction'>1224/1228</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>271/271</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">99.94% </span>
<span class="quiet">Lines</span>
<span class='fraction'>1735/1736</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file high" data-value="create.js"><a href="create.js.html">create.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="59" class="abs high">59/59</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="35" class="abs high">35/35</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="12" class="abs high">12/12</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="59" class="abs high">59/59</td>
</tr>
<tr>
<td class="file high" data-value="extract.js"><a href="extract.js.html">extract.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="61" class="abs high">61/61</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="45" class="abs high">45/45</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="12" class="abs high">12/12</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="60" class="abs high">60/60</td>
</tr>
<tr>
<td class="file high" data-value="header.js"><a href="header.js.html">header.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="161" class="abs high">161/161</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="120" class="abs high">120/120</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="20" class="abs high">20/20</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="159" class="abs high">159/159</td>
</tr>
<tr>
<td class="file high" data-value="high-level-opt.js"><a href="high-level-opt.js.html">high-level-opt.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="5" class="abs high">5/5</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="4" class="abs high">4/4</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="3" class="abs high">3/3</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="3" class="abs high">3/3</td>
</tr>
<tr>
<td class="file high" data-value="large-numbers.js"><a href="large-numbers.js.html">large-numbers.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="59" class="abs high">59/59</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="20" class="abs high">20/20</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="8" class="abs high">8/8</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="57" class="abs high">57/57</td>
</tr>
<tr>
<td class="file high" data-value="list.js"><a href="list.js.html">list.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="80" class="abs high">80/80</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="53" class="abs high">53/53</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="14" class="abs high">14/14</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="77" class="abs high">77/77</td>
</tr>
<tr>
<td class="file high" data-value="mkdir.js"><a href="mkdir.js.html">mkdir.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="130" class="abs high">130/130</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="91" class="abs high">91/91</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="15" class="abs high">15/15</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="128" class="abs high">128/128</td>
</tr>
<tr>
<td class="file high" data-value="pack.js"><a href="pack.js.html">pack.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="228" class="abs high">228/228</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="123" class="abs high">123/123</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="44" class="abs high">44/44</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="222" class="abs high">222/222</td>
</tr>
<tr>
<td class="file high" data-value="parse.js"><a href="parse.js.html">parse.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="242" class="abs high">242/242</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="155" class="abs high">155/155</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="24" class="abs high">24/24</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="236" class="abs high">236/236</td>
</tr>
<tr>
<td class="file high" data-value="pax.js"><a href="pax.js.html">pax.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="62" class="abs high">62/62</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="75" class="abs high">75/75</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="9" class="abs high">9/9</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="60" class="abs high">60/60</td>
</tr>
<tr>
<td class="file high" data-value="read-entry.js"><a href="read-entry.js.html">read-entry.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="53" class="abs high">53/53</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="36" class="abs high">36/36</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="3" class="abs high">3/3</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="51" class="abs high">51/51</td>
</tr>
<tr>
<td class="file high" data-value="replace.js"><a href="replace.js.html">replace.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="131" class="abs high">131/131</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="70" class="abs high">70/70</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="18" class="abs high">18/18</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="128" class="abs high">128/128</td>
</tr>
<tr>
<td class="file high" data-value="types.js"><a href="types.js.html">types.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="3" class="abs high">3/3</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">1/1</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="2" class="abs high">2/2</td>
</tr>
<tr>
<td class="file high" data-value="unpack.js"><a href="unpack.js.html">unpack.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="254" class="abs high">254/254</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="194" class="abs high">194/194</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="44" class="abs high">44/44</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="247" class="abs high">247/247</td>
</tr>
<tr>
<td class="file high" data-value="update.js"><a href="update.js.html">update.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="20" class="abs high">20/20</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="15" class="abs high">15/15</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="4" class="abs high">4/4</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="20" class="abs high">20/20</td>
</tr>
<tr>
<td class="file high" data-value="warn-mixin.js"><a href="warn-mixin.js.html">warn-mixin.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="9" class="abs high">9/9</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="4" class="abs high">4/4</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="2" class="abs high">2/2</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="8" class="abs high">8/8</td>
</tr>
<tr>
<td class="file high" data-value="winchars.js"><a href="winchars.js.html">winchars.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="12" class="abs high">12/12</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="7" class="abs high">7/7</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="8" class="abs high">8/8</td>
</tr>
<tr>
<td class="file high" data-value="write-entry.js"><a href="write-entry.js.html">write-entry.js</a></td>
<td data-value="99.53" class="pic high"><div class="chart"><div class="cover-fill" style="width: 99%;"></div><div class="cover-empty" style="width:1%;"></div></div></td>
<td data-value="99.53" class="pct high">99.53%</td>
<td data-value="214" class="abs high">213/214</td>
<td data-value="97.87" class="pct high">97.87%</td>
<td data-value="188" class="abs high">184/188</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="31" class="abs high">31/31</td>
<td data-value="99.53" class="pct high">99.53%</td>
<td data-value="211" class="abs high">210/211</td>
</tr>
</tbody>
</table>
</div><div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

View File

@ -0,0 +1,341 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for tar/lib/large-numbers.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">tar/lib</a> large-numbers.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>59/59</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>20/20</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>8/8</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>57/57</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">14x</span>
<span class="cline-any cline-yes">17x</span>
<span class="cline-any cline-yes">17x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">17x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">14x</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">86x</span>
<span class="cline-any cline-yes">31x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">55x</span>
<span class="cline-any cline-yes">55x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">14x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60x</span>
<span class="cline-any cline-yes">42x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">18x</span>
<span class="cline-any cline-yes">18x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60x</span>
<span class="cline-any cline-yes">48x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">14x</span>
<span class="cline-any cline-yes">47x</span>
<span class="cline-any cline-yes">47x</span>
<span class="cline-any cline-yes">47x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">14x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">60x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60x</span>
<span class="cline-any cline-yes">48x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">60x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">14x</span>
<span class="cline-any cline-yes">41x</span>
<span class="cline-any cline-yes">41x</span>
<span class="cline-any cline-yes">41x</span>
<span class="cline-any cline-yes">266x</span>
<span class="cline-any cline-yes">266x</span>
<span class="cline-any cline-yes">161x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">41x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">96x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">14x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict'
// Tar can encode large and negative numbers using a leading byte of
// 0xff for negative, and 0x80 for positive. The trailing byte in the
// section will always be 0x20, or in some implementations 0x00.
// this module encodes and decodes these things.
&nbsp;
const encode = exports.encode = (num, buf) =&gt; {
buf[buf.length - 1] = 0x20
if (num &lt; 0)
encodeNegative(num, buf)
else
encodePositive(num, buf)
return buf
}
&nbsp;
const encodePositive = (num, buf) =&gt; {
buf[0] = 0x80
for (var i = buf.length - 2; i &gt; 0; i--) {
if (num === 0)
buf[i] = 0
else {
buf[i] = num % 0x100
num = Math.floor(num / 0x100)
}
}
}
&nbsp;
const encodeNegative = (num, buf) =&gt; {
buf[0] = 0xff
var flipped = false
num = num * -1
for (var i = buf.length - 2; i &gt; 0; i--) {
var byte
if (num === 0)
byte = 0
else {
byte = num % 0x100
num = Math.floor(num / 0x100)
}
if (flipped)
buf[i] = onesComp(byte)
else if (byte === 0)
buf[i] = 0
else {
flipped = true
buf[i] = twosComp(byte)
}
}
}
&nbsp;
const parse = exports.parse = (buf) =&gt; {
var post = buf[buf.length - 1]
var pre = buf[0]
return pre === 0x80 ? pos(buf.slice(1, buf.length - 1))
: twos(buf.slice(1, buf.length - 1))
}
&nbsp;
const twos = (buf) =&gt; {
var len = buf.length
var sum = 0
var flipped = false
for (var i = len - 1; i &gt; -1; i--) {
var byte = buf[i]
var f
if (flipped)
f = onesComp(byte)
else if (byte === 0)
f = byte
else {
flipped = true
f = twosComp(byte)
}
if (f !== 0)
sum += f * Math.pow(256, len - i - 1)
}
return sum * -1
}
&nbsp;
const pos = (buf) =&gt; {
var len = buf.length
var sum = 0
for (var i = len - 1; i &gt; -1; i--) {
var byte = buf[i]
if (byte !== 0)
sum += byte * Math.pow(256, len - i - 1)
}
return sum
}
&nbsp;
const onesComp = byte =&gt; (0xff ^ byte) &amp; 0xff
&nbsp;
const twosComp = byte =&gt; ((0xff ^ byte) + 1) &amp; 0xff
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

View File

@ -0,0 +1,449 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for tar/lib/list.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">tar/lib</a> list.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>80/80</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>53/53</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>14/14</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>77/77</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-yes">34x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">34x</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">34x</span>
<span class="cline-any cline-yes">31x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">34x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">34x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">32x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">32x</span>
<span class="cline-any cline-yes">22x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">32x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-yes">22x</span>
<span class="cline-any cline-yes">22x</span>
<span class="cline-any cline-yes">255x</span>
<span class="cline-any cline-yes">255x</span>
<span class="cline-any cline-yes">72x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">125x</span>
<span class="cline-any cline-yes">125x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">125x</span>
<span class="cline-any cline-yes">125x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">32x</span>
<span class="cline-any cline-yes">64x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-yes">10x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">28x</span>
<span class="cline-any cline-yes">27x</span>
<span class="cline-any cline-yes">27x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">14x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">14x</span>
<span class="cline-any cline-yes">14x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">16x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict'
&nbsp;
// XXX: This shares a lot in common with extract.js
// maybe some DRY opportunity here?
&nbsp;
// tar -t
const hlo = require('./high-level-opt.js')
const Parser = require('./parse.js')
const fs = require('fs')
const fsm = require('fs-minipass')
const path = require('path')
&nbsp;
const t = module.exports = (opt_, files, cb) =&gt; {
if (typeof opt_ === 'function')
cb = opt_, files = null, opt_ = {}
else if (Array.isArray(opt_))
files = opt_, opt_ = {}
&nbsp;
if (typeof files === 'function')
cb = files, files = null
&nbsp;
if (!files)
files = []
else
files = Array.from(files)
&nbsp;
const opt = hlo(opt_)
&nbsp;
if (opt.sync &amp;&amp; typeof cb === 'function')
throw new TypeError('callback not supported for sync tar functions')
&nbsp;
if (!opt.file &amp;&amp; typeof cb === 'function')
throw new TypeError('callback only supported with file option')
&nbsp;
if (files.length)
filesFilter(opt, files)
&nbsp;
if (!opt.noResume)
onentryFunction(opt)
&nbsp;
return opt.file &amp;&amp; opt.sync ? listFileSync(opt)
: opt.file ? listFile(opt, cb)
: list(opt)
}
&nbsp;
const onentryFunction = opt =&gt; {
const onentry = opt.onentry
opt.onentry = onentry ? e =&gt; {
onentry(e)
e.resume()
} : e =&gt; e.resume()
}
&nbsp;
// construct a filter that limits the file entries listed
// include child entries if a dir is included
const filesFilter = (opt, files) =&gt; {
const map = new Map(files.map(f =&gt; [f.replace(/\/+$/, ''), true]))
const filter = opt.filter
&nbsp;
const mapHas = (file, r) =&gt; {
const root = r || path.parse(file).root || '.'
const ret = file === root ? false
: map.has(file) ? map.get(file)
: mapHas(path.dirname(file), root)
&nbsp;
map.set(file, ret)
return ret
}
&nbsp;
opt.filter = filter
? (file, entry) =&gt; filter(file, entry) &amp;&amp; mapHas(file.replace(/\/+$/, ''))
: file =&gt; mapHas(file.replace(/\/+$/, ''))
}
&nbsp;
const listFileSync = opt =&gt; {
const p = list(opt)
const file = opt.file
let threw = true
let fd
try {
const stat = fs.statSync(file)
const readSize = opt.maxReadSize || 16*1024*1024
if (stat.size &lt; readSize) {
p.end(fs.readFileSync(file))
} else {
let pos = 0
const buf = Buffer.allocUnsafe(readSize)
fd = fs.openSync(file, 'r')
while (pos &lt; stat.size) {
let bytesRead = fs.readSync(fd, buf, 0, readSize, pos)
pos += bytesRead
p.write(buf.slice(0, bytesRead))
}
p.end()
}
threw = false
} finally {
if (threw &amp;&amp; fd)
try { fs.closeSync(fd) } catch (er) {}
}
}
&nbsp;
const listFile = (opt, cb) =&gt; {
const parse = new Parser(opt)
const readSize = opt.maxReadSize || 16*1024*1024
&nbsp;
const file = opt.file
const p = new Promise((resolve, reject) =&gt; {
parse.on('error', reject)
parse.on('end', resolve)
&nbsp;
fs.stat(file, (er, stat) =&gt; {
if (er)
reject(er)
else {
const stream = new fsm.ReadStream(file, {
readSize: readSize,
size: stat.size
})
stream.on('error', reject)
stream.pipe(parse)
}
})
})
return cb ? p.then(cb, cb) : p
}
&nbsp;
const list = opt =&gt; new Parser(opt)
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

View File

@ -0,0 +1,686 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for tar/lib/mkdir.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">tar/lib</a> mkdir.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>130/130</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>91/91</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>15/15</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>128/128</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">36x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">451x</span>
<span class="cline-any cline-yes">451x</span>
<span class="cline-any cline-yes">451x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">451x</span>
<span class="cline-any cline-yes">451x</span>
<span class="cline-any cline-yes">451x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">451x</span>
<span class="cline-any cline-yes">451x</span>
<span class="cline-any cline-yes">451x</span>
<span class="cline-any cline-yes">451x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">451x</span>
<span class="cline-any cline-yes">457x</span>
<span class="cline-any cline-yes">15x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">442x</span>
<span class="cline-any cline-yes">442x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">436x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">435x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">451x</span>
<span class="cline-any cline-yes">272x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">179x</span>
<span class="cline-any cline-yes">40x</span>
<span class="cline-any cline-yes">40x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">40x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">139x</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">131x</span>
<span class="cline-any cline-yes">131x</span>
<span class="cline-any cline-yes">131x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">1062x</span>
<span class="cline-any cline-yes">119x</span>
<span class="cline-any cline-yes">943x</span>
<span class="cline-any cline-yes">943x</span>
<span class="cline-any cline-yes">943x</span>
<span class="cline-any cline-yes">723x</span>
<span class="cline-any cline-yes">220x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">222x</span>
<span class="cline-any cline-yes">222x</span>
<span class="cline-any cline-yes">36x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">32x</span>
<span class="cline-any cline-yes">32x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">28x</span>
<span class="cline-any cline-yes">22x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">186x</span>
<span class="cline-any cline-yes">186x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">276x</span>
<span class="cline-any cline-yes">276x</span>
<span class="cline-any cline-yes">276x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">276x</span>
<span class="cline-any cline-yes">276x</span>
<span class="cline-any cline-yes">276x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">276x</span>
<span class="cline-any cline-yes">276x</span>
<span class="cline-any cline-yes">276x</span>
<span class="cline-any cline-yes">276x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">276x</span>
<span class="cline-any cline-yes">266x</span>
<span class="cline-any cline-yes">266x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">266x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">266x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">276x</span>
<span class="cline-any cline-yes">128x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">148x</span>
<span class="cline-any cline-yes">34x</span>
<span class="cline-any cline-yes">34x</span>
<span class="cline-any cline-yes">34x</span>
<span class="cline-any cline-yes">34x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">34x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">32x</span>
<span class="cline-any cline-yes">32x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">114x</span>
<span class="cline-any cline-yes">7x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">107x</span>
<span class="cline-any cline-yes">107x</span>
<span class="cline-any cline-yes">107x</span>
<span class="cline-any cline-yes">107x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">792x</span>
<span class="cline-any cline-yes">608x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">184x</span>
<span class="cline-any cline-yes">184x</span>
<span class="cline-any cline-yes">169x</span>
<span class="cline-any cline-yes">169x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">15x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">99x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict'
// wrapper around mkdirp for tar's needs.
&nbsp;
// TODO: This should probably be a class, not functionally
// passing around state in a gazillion args.
&nbsp;
const mkdirp = require('mkdirp')
const fs = require('fs')
const path = require('path')
const chownr = require('chownr')
&nbsp;
class SymlinkError extends Error {
constructor (symlink, path) {
super('Cannot extract through symbolic link')
this.path = path
this.symlink = symlink
}
&nbsp;
get name () {
return 'SylinkError'
}
}
&nbsp;
class CwdError extends Error {
constructor (path, code) {
super(code + ': Cannot cd into \'' + path + '\'')
this.path = path
this.code = code
}
&nbsp;
get name () {
return 'CwdError'
}
}
&nbsp;
const mkdir = module.exports = (dir, opt, cb) =&gt; {
// if there's any overlap between mask and mode,
// then we'll need an explicit chmod
const umask = opt.umask
const mode = opt.mode | 0o0700
const needChmod = (mode &amp; umask) !== 0
&nbsp;
const uid = opt.uid
const gid = opt.gid
const doChown = typeof uid === 'number' &amp;&amp;
typeof gid === 'number' &amp;&amp;
( uid !== opt.processUid || gid !== opt.processGid )
&nbsp;
const preserve = opt.preserve
const unlink = opt.unlink
const cache = opt.cache
const cwd = opt.cwd
&nbsp;
const done = (er, created) =&gt; {
if (er)
cb(er)
else {
cache.set(dir, true)
if (created &amp;&amp; doChown)
chownr(created, uid, gid, er =&gt; done(er))
else if (needChmod)
fs.chmod(dir, mode, cb)
else
cb()
}
}
&nbsp;
if (cache &amp;&amp; cache.get(dir) === true)
return done()
&nbsp;
if (dir === cwd)
return fs.lstat(dir, (er, st) =&gt; {
if (er || !st.isDirectory())
er = new CwdError(dir, er &amp;&amp; er.code || 'ENOTDIR')
done(er)
})
&nbsp;
if (preserve)
return mkdirp(dir, mode, done)
&nbsp;
const sub = path.relative(cwd, dir)
const parts = sub.split(/\/|\\/)
mkdir_(cwd, parts, mode, cache, unlink, cwd, null, done)
}
&nbsp;
const mkdir_ = (base, parts, mode, cache, unlink, cwd, created, cb) =&gt; {
if (!parts.length)
return cb(null, created)
const p = parts.shift()
const part = base + '/' + p
if (cache.get(part))
return mkdir_(part, parts, mode, cache, unlink, cwd, created, cb)
fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb))
}
&nbsp;
const onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) =&gt; er =&gt; {
if (er) {
if (er.path &amp;&amp; path.dirname(er.path) === cwd &amp;&amp;
(er.code === 'ENOTDIR' || er.code === 'ENOENT'))
return cb(new CwdError(cwd, er.code))
&nbsp;
fs.lstat(part, (statEr, st) =&gt; {
if (statEr)
cb(statEr)
else if (st.isDirectory())
mkdir_(part, parts, mode, cache, unlink, cwd, created, cb)
else if (unlink)
fs.unlink(part, er =&gt; {
if (er)
return cb(er)
fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb))
})
else if (st.isSymbolicLink())
return cb(new SymlinkError(part, part + '/' + parts.join('/')))
else
cb(er)
})
} else {
created = created || part
mkdir_(part, parts, mode, cache, unlink, cwd, created, cb)
}
}
&nbsp;
const mkdirSync = module.exports.sync = (dir, opt) =&gt; {
// if there's any overlap between mask and mode,
// then we'll need an explicit chmod
const umask = opt.umask
const mode = opt.mode | 0o0700
const needChmod = (mode &amp; umask) !== 0
&nbsp;
const uid = opt.uid
const gid = opt.gid
const doChown = typeof uid === 'number' &amp;&amp;
typeof gid === 'number' &amp;&amp;
( uid !== opt.processUid || gid !== opt.processGid )
&nbsp;
const preserve = opt.preserve
const unlink = opt.unlink
const cache = opt.cache
const cwd = opt.cwd
&nbsp;
const done = (created) =&gt; {
cache.set(dir, true)
if (created &amp;&amp; doChown)
chownr.sync(created, uid, gid)
if (needChmod)
fs.chmodSync(dir, mode)
cache.set(dir, true)
}
&nbsp;
if (cache &amp;&amp; cache.get(dir) === true)
return done()
&nbsp;
if (dir === cwd) {
let ok = false
let code = 'ENOTDIR'
try {
ok = fs.lstatSync(dir).isDirectory()
} catch (er) {
code = er.code
} finally {
if (!ok)
throw new CwdError(dir, code)
}
done()
return
}
&nbsp;
if (preserve)
return done(mkdirp.sync(dir, mode))
&nbsp;
const sub = path.relative(cwd, dir)
const parts = sub.split(/\/|\\/)
let created = null
for (let p = parts.shift(), part = cwd;
p &amp;&amp; (part += '/' + p);
p = parts.shift()) {
&nbsp;
if (cache.get(part))
continue
&nbsp;
try {
fs.mkdirSync(part, mode)
created = created || part
cache.set(part, true)
} catch (er) {
if (er.path &amp;&amp; path.dirname(er.path) === cwd &amp;&amp;
(er.code === 'ENOTDIR' || er.code === 'ENOENT'))
return new CwdError(cwd, er.code)
&nbsp;
const st = fs.lstatSync(part)
if (st.isDirectory()) {
cache.set(part, true)
continue
} else if (unlink) {
fs.unlinkSync(part)
fs.mkdirSync(part, mode)
created = created || part
cache.set(part, true)
continue
} else if (st.isSymbolicLink())
return new SymlinkError(part, part + '/' + parts.join('/'))
}
}
&nbsp;
return done(created)
}
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,500 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for tar/lib/pax.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">tar/lib</a> pax.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>62/62</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>75/75</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>9/9</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>60/60</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">435x</span>
<span class="cline-any cline-yes">435x</span>
<span class="cline-any cline-yes">435x</span>
<span class="cline-any cline-yes">435x</span>
<span class="cline-any cline-yes">435x</span>
<span class="cline-any cline-yes">435x</span>
<span class="cline-any cline-yes">435x</span>
<span class="cline-any cline-yes">435x</span>
<span class="cline-any cline-yes">435x</span>
<span class="cline-any cline-yes">435x</span>
<span class="cline-any cline-yes">435x</span>
<span class="cline-any cline-yes">435x</span>
<span class="cline-any cline-yes">435x</span>
<span class="cline-any cline-yes">435x</span>
<span class="cline-any cline-yes">435x</span>
<span class="cline-any cline-yes">435x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">34x</span>
<span class="cline-any cline-yes">34x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-yes">16896x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-yes">8949x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">34x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">510x</span>
<span class="cline-any cline-yes">204x</span>
<span class="cline-any cline-yes">306x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">306x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">306x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">306x</span>
<span class="cline-any cline-yes">306x</span>
<span class="cline-any cline-yes">30x</span>
<span class="cline-any cline-yes">306x</span>
<span class="cline-any cline-yes">306x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">401x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">401x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">401x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">2259x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2259x</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2254x</span>
<span class="cline-any cline-yes">2254x</span>
<span class="cline-any cline-yes">2254x</span>
<span class="cline-any cline-yes">2254x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2253x</span>
<span class="cline-any cline-yes">2253x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2253x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict'
const Header = require('./header.js')
const path = require('path')
&nbsp;
class Pax {
constructor (obj, global) {
this.atime = obj.atime || null
this.charset = obj.charset || null
this.comment = obj.comment || null
this.ctime = obj.ctime || null
this.gid = obj.gid || null
this.gname = obj.gname || null
this.linkpath = obj.linkpath || null
this.mtime = obj.mtime || null
this.path = obj.path || null
this.size = obj.size || null
this.uid = obj.uid || null
this.uname = obj.uname || null
this.dev = obj.dev || null
this.ino = obj.ino || null
this.nlink = obj.nlink || null
this.global = global || false
}
&nbsp;
encode () {
const body = this.encodeBody()
if (body === '')
return null
&nbsp;
const bodyLen = Buffer.byteLength(body)
// round up to 512 bytes
// add 512 for header
const bufLen = 512 * Math.ceil(1 + bodyLen / 512)
const buf = Buffer.allocUnsafe(bufLen)
&nbsp;
// 0-fill the header section, it might not hit every field
for (let i = 0; i &lt; 512; i++) {
buf[i] = 0
}
&nbsp;
new Header({
// XXX split the path
// then the path should be PaxHeader + basename, but less than 99,
// prepend with the dirname
path: ('PaxHeader/' + path.basename(this.path)).slice(0, 99),
mode: this.mode || 0o644,
uid: this.uid || null,
gid: this.gid || null,
size: bodyLen,
mtime: this.mtime || null,
type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader',
linkpath: '',
uname: this.uname || '',
gname: this.gname || '',
devmaj: 0,
devmin: 0,
atime: this.atime || null,
ctime: this.ctime || null
}).encode(buf)
&nbsp;
buf.write(body, 512, bodyLen, 'utf8')
&nbsp;
// null pad after the body
for (let i = bodyLen + 512; i &lt; buf.length; i++) {
buf[i] = 0
}
&nbsp;
return buf
}
&nbsp;
encodeBody () {
return (
this.encodeField('path') +
this.encodeField('ctime') +
this.encodeField('atime') +
this.encodeField('dev') +
this.encodeField('ino') +
this.encodeField('nlink') +
this.encodeField('charset') +
this.encodeField('comment') +
this.encodeField('gid') +
this.encodeField('gname') +
this.encodeField('linkpath') +
this.encodeField('mtime') +
this.encodeField('size') +
this.encodeField('uid') +
this.encodeField('uname')
)
}
&nbsp;
encodeField (field) {
if (this[field] === null || this[field] === undefined)
return ''
const v = this[field] instanceof Date ? this[field].getTime() / 1000
: this[field]
const s = ' ' +
(field === 'dev' || field === 'ino' || field === 'nlink'
? 'SCHILY.' : '') +
field + '=' + v + '\n'
const byteLen = Buffer.byteLength(s)
// the digits includes the length of the digits in ascii base-10
// so if it's 9 characters, then adding 1 for the 9 makes it 10
// which makes it 11 chars.
let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1
if (byteLen + digits &gt;= Math.pow(10, digits))
digits += 1
const len = digits + byteLen
return len + s
}
}
&nbsp;
Pax.parse = (string, ex, g) =&gt; new Pax(merge(parseKV(string), ex), g)
&nbsp;
const merge = (a, b) =&gt;
b ? Object.keys(a).reduce((s, k) =&gt; (s[k] = a[k], s), b) : a
&nbsp;
const parseKV = string =&gt;
string
.replace(/\n$/, '')
.split('\n')
.reduce(parseKVLine, Object.create(null))
&nbsp;
const parseKVLine = (set, line) =&gt; {
const n = parseInt(line, 10)
&nbsp;
// XXX Values with \n in them will fail this.
// Refactor to not be a naive line-by-line parse.
if (n !== Buffer.byteLength(line) + 1)
return set
&nbsp;
line = line.substr((n + ' ').length)
const kv = line.split('=')
const k = kv.shift().replace(/^SCHILY\.(dev|ino|nlink)/, '$1')
if (!k)
return set
&nbsp;
const v = kv.join('=')
set[k] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(k)
? new Date(v * 1000)
: /^[0-9]+$/.test(v) ? +v
: v
return set
}
&nbsp;
module.exports = Pax
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

View File

@ -0,0 +1,347 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for tar/lib/read-entry.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">tar/lib</a> read-entry.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>53/53</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>36/36</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>3/3</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>51/51</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3241x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">760x</span>
<span class="cline-any cline-yes">760x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">3720x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-yes">4004x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2222x</span>
<span class="cline-any cline-yes">2222x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2220x</span>
<span class="cline-any cline-yes">2220x</span>
<span class="cline-any cline-yes">2220x</span>
<span class="cline-any cline-yes">2220x</span>
<span class="cline-any cline-yes">2220x</span>
<span class="cline-any cline-yes">673x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1547x</span>
<span class="cline-any cline-yes">132x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1415x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">457x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6384x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2657x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict'
const types = require('./types.js')
const MiniPass = require('minipass')
&nbsp;
const SLURP = Symbol('slurp')
module.exports = class ReadEntry extends MiniPass {
constructor (header, ex, gex) {
super()
this.extended = ex
this.globalExtended = gex
this.header = header
this.startBlockSize = 512 * Math.ceil(header.size / 512)
this.blockRemain = this.startBlockSize
this.remain = header.size
this.type = header.type
this.meta = false
this.ignore = false
switch (this.type) {
case 'File':
case 'OldFile':
case 'Link':
case 'SymbolicLink':
case 'CharacterDevice':
case 'BlockDevice':
case 'Directory':
case 'FIFO':
case 'ContiguousFile':
case 'GNUDumpDir':
break
&nbsp;
case 'NextFileHasLongLinkpath':
case 'NextFileHasLongPath':
case 'OldGnuLongPath':
case 'GlobalExtendedHeader':
case 'ExtendedHeader':
case 'OldExtendedHeader':
this.meta = true
break
&nbsp;
// NOTE: gnutar and bsdtar treat unrecognized types as 'File'
// it may be worth doing the same, but with a warning.
default:
this.ignore = true
}
&nbsp;
this.path = header.path
this.mode = header.mode
if (this.mode)
this.mode = this.mode &amp; 0o7777
this.uid = header.uid
this.gid = header.gid
this.uname = header.uname
this.gname = header.gname
this.size = header.size
this.mtime = header.mtime
this.atime = header.atime
this.ctime = header.ctime
this.linkpath = header.linkpath
this.uname = header.uname
this.gname = header.gname
&nbsp;
if (ex) this[SLURP](ex)
if (gex) this[SLURP](gex, true)
}
&nbsp;
write (data) {
const writeLen = data.length
if (writeLen &gt; this.blockRemain)
throw new Error('writing more to entry than is appropriate')
&nbsp;
const r = this.remain
const br = this.blockRemain
this.remain = Math.max(0, r - writeLen)
this.blockRemain = Math.max(0, br - writeLen)
if (this.ignore)
return true
&nbsp;
if (r &gt;= writeLen)
return super.write(data)
&nbsp;
// r &lt; writeLen
return super.write(data.slice(0, r))
}
&nbsp;
[SLURP] (ex, global) {
for (let k in ex) {
// we slurp in everything except for the path attribute in
// a global extended header, because that's weird.
if (ex[k] !== null &amp;&amp; ex[k] !== undefined &amp;&amp;
!(global &amp;&amp; k === 'path'))
this[k] = ex[k]
}
}
}
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

View File

@ -0,0 +1,722 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for tar/lib/replace.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">tar/lib</a> replace.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>131/131</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>70/70</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>18/18</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>128/128</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">70x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">70x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">69x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">68x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">67x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">67x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">26x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">26x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">26x</span>
<span class="cline-any cline-yes">26x</span>
<span class="cline-any cline-yes">26x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">24x</span>
<span class="cline-any cline-yes">22x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">22x</span>
<span class="cline-any cline-yes">61x</span>
<span class="cline-any cline-yes">63x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">61x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">59x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">55x</span>
<span class="cline-any cline-yes">55x</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-yes">47x</span>
<span class="cline-any cline-yes">47x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">45x</span>
<span class="cline-any cline-yes">45x</span>
<span class="cline-any cline-yes">28x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">18x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">18x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">26x</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">18x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">18x</span>
<span class="cline-any cline-yes">18x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">41x</span>
<span class="cline-any cline-yes">41x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">41x</span>
<span class="cline-any cline-yes">37x</span>
<span class="cline-any cline-yes">37x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">37x</span>
<span class="cline-any cline-yes">37x</span>
<span class="cline-any cline-yes">8x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">29x</span>
<span class="cline-any cline-yes">29x</span>
<span class="cline-any cline-yes">29x</span>
<span class="cline-any cline-yes">112x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">110x</span>
<span class="cline-any cline-yes">110x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">104x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">102x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">98x</span>
<span class="cline-any cline-yes">98x</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">85x</span>
<span class="cline-any cline-yes">85x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">81x</span>
<span class="cline-any cline-yes">81x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">77x</span>
<span class="cline-any cline-yes">46x</span>
<span class="cline-any cline-yes">77x</span>
<span class="cline-any cline-yes">77x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">29x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">41x</span>
<span class="cline-any cline-yes">41x</span>
<span class="cline-any cline-yes">41x</span>
<span class="cline-any cline-yes">41x</span>
<span class="cline-any cline-yes">45x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">41x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">39x</span>
<span class="cline-any cline-yes">39x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">37x</span>
<span class="cline-any cline-yes">37x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">41x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">41x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">18x</span>
<span class="cline-any cline-yes">19x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">18x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">18x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">34x</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">32x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict'
&nbsp;
// tar -r
const hlo = require('./high-level-opt.js')
const Pack = require('./pack.js')
const Parse = require('./parse.js')
const fs = require('fs')
const fsm = require('fs-minipass')
const t = require('./list.js')
const path = require('path')
&nbsp;
// starting at the head of the file, read a Header
// If the checksum is invalid, that's our position to start writing
// If it is, jump forward by the specified size (round up to 512)
// and try again.
// Write the new Pack stream starting there.
&nbsp;
const Header = require('./header.js')
&nbsp;
const r = module.exports = (opt_, files, cb) =&gt; {
const opt = hlo(opt_)
&nbsp;
if (!opt.file)
throw new TypeError('file is required')
&nbsp;
if (opt.gzip)
throw new TypeError('cannot append to compressed archives')
&nbsp;
if (!files || !Array.isArray(files) || !files.length)
throw new TypeError('no files or directories specified')
&nbsp;
files = Array.from(files)
&nbsp;
return opt.sync ? replaceSync(opt, files)
: replace(opt, files, cb)
}
&nbsp;
const replaceSync = (opt, files) =&gt; {
const p = new Pack.Sync(opt)
&nbsp;
let threw = true
let fd
let position
&nbsp;
try {
try {
fd = fs.openSync(opt.file, 'r+')
} catch (er) {
if (er.code === 'ENOENT')
fd = fs.openSync(opt.file, 'w+')
else
throw er
}
&nbsp;
const st = fs.fstatSync(fd)
const headBuf = Buffer.alloc(512)
&nbsp;
POSITION: for (position = 0; position &lt; st.size; position += 512) {
for (let bufPos = 0, bytes = 0; bufPos &lt; 512; bufPos += bytes) {
bytes = fs.readSync(
fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos
)
&nbsp;
if (position === 0 &amp;&amp; headBuf[0] === 0x1f &amp;&amp; headBuf[1] === 0x8b)
throw new Error('cannot append to compressed archives')
&nbsp;
if (!bytes)
break POSITION
}
&nbsp;
let h = new Header(headBuf)
if (!h.cksumValid)
break
let entryBlockSize = 512 * Math.ceil(h.size / 512)
if (position + entryBlockSize + 512 &gt; st.size)
break
// the 512 for the header we just parsed will be added as well
// also jump ahead all the blocks for the body
position += entryBlockSize
if (opt.mtimeCache)
opt.mtimeCache.set(h.path, h.mtime)
}
threw = false
&nbsp;
streamSync(opt, p, position, fd, files)
} finally {
if (threw)
try { fs.closeSync(fd) } catch (er) {}
}
}
&nbsp;
const streamSync = (opt, p, position, fd, files) =&gt; {
const stream = new fsm.WriteStreamSync(opt.file, {
fd: fd,
start: position
})
p.pipe(stream)
addFilesSync(p, files)
}
&nbsp;
const replace = (opt, files, cb) =&gt; {
files = Array.from(files)
const p = new Pack(opt)
&nbsp;
const getPos = (fd, size, cb_) =&gt; {
const cb = (er, pos) =&gt; {
if (er)
fs.close(fd, _ =&gt; cb_(er))
else
cb_(null, pos)
}
&nbsp;
let position = 0
if (size === 0)
return cb(null, 0)
&nbsp;
let bufPos = 0
const headBuf = Buffer.alloc(512)
const onread = (er, bytes) =&gt; {
if (er)
return cb(er)
bufPos += bytes
if (bufPos &lt; 512 &amp;&amp; bytes)
return fs.read(
fd, headBuf, bufPos, headBuf.length - bufPos,
position + bufPos, onread
)
&nbsp;
if (position === 0 &amp;&amp; headBuf[0] === 0x1f &amp;&amp; headBuf[1] === 0x8b)
return cb(new Error('cannot append to compressed archives'))
&nbsp;
// truncated header
if (bufPos &lt; 512)
return cb(null, position)
&nbsp;
const h = new Header(headBuf)
if (!h.cksumValid)
return cb(null, position)
&nbsp;
const entryBlockSize = 512 * Math.ceil(h.size / 512)
if (position + entryBlockSize + 512 &gt; size)
return cb(null, position)
&nbsp;
position += entryBlockSize + 512
if (position &gt;= size)
return cb(null, position)
&nbsp;
if (opt.mtimeCache)
opt.mtimeCache.set(h.path, h.mtime)
bufPos = 0
fs.read(fd, headBuf, 0, 512, position, onread)
}
fs.read(fd, headBuf, 0, 512, position, onread)
}
&nbsp;
const promise = new Promise((resolve, reject) =&gt; {
p.on('error', reject)
let flag = 'r+'
const onopen = (er, fd) =&gt; {
if (er &amp;&amp; er.code === 'ENOENT' &amp;&amp; flag === 'r+') {
flag = 'w+'
return fs.open(opt.file, flag, onopen)
}
&nbsp;
if (er)
return reject(er)
&nbsp;
fs.fstat(fd, (er, st) =&gt; {
if (er)
return reject(er)
getPos(fd, st.size, (er, position) =&gt; {
if (er)
return reject(er)
const stream = new fsm.WriteStream(opt.file, {
fd: fd,
start: position
})
p.pipe(stream)
stream.on('error', reject)
stream.on('close', resolve)
addFilesAsync(p, files)
})
})
}
fs.open(opt.file, flag, onopen)
})
&nbsp;
return cb ? promise.then(cb, cb) : promise
}
&nbsp;
const addFilesSync = (p, files) =&gt; {
files.forEach(file =&gt; {
if (file.charAt(0) === '@')
t({
file: path.resolve(p.cwd, file.substr(1)),
sync: true,
noResume: true,
onentry: entry =&gt; p.add(entry)
})
else
p.add(file)
})
p.end()
}
&nbsp;
const addFilesAsync = (p, files) =&gt; {
while (files.length) {
const file = files.shift()
if (file.charAt(0) === '@')
return t({
file: path.resolve(p.cwd, file.substr(1)),
noResume: true,
onentry: entry =&gt; p.add(entry)
}).then(_ =&gt; addFilesAsync(p, files))
else
p.add(file)
}
p.end()
}
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

View File

@ -0,0 +1,197 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for tar/lib/types.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">tar/lib</a> types.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>3/3</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>1/1</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>2/2</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">14x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">294x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict'
// map types from key to human-friendly name
exports.name = new Map([
['0', 'File'],
// same as File
['', 'OldFile'],
['1', 'Link'],
['2', 'SymbolicLink'],
// Devices and FIFOs aren't fully supported
// they are parsed, but skipped when unpacking
['3', 'CharacterDevice'],
['4', 'BlockDevice'],
['5', 'Directory'],
['6', 'FIFO'],
// same as File
['7', 'ContiguousFile'],
// pax headers
['g', 'GlobalExtendedHeader'],
['x', 'ExtendedHeader'],
// vendor-specific stuff
// skip
['A', 'SolarisACL'],
// like 5, but with data, which should be skipped
['D', 'GNUDumpDir'],
// metadata only, skip
['I', 'Inode'],
// data = link path of next file
['K', 'NextFileHasLongLinkpath'],
// data = path of next file
['L', 'NextFileHasLongPath'],
// skip
['M', 'ContinuationFile'],
// like L
['N', 'OldGnuLongPath'],
// skip
['S', 'SparseFile'],
// skip
['V', 'TapeVolumeHeader'],
// like x
['X', 'OldExtendedHeader']
])
&nbsp;
// map the other direction
exports.code = new Map(Array.from(exports.name).map(kv =&gt; [kv[1], kv[0]]))
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,173 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for tar/lib/update.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">tar/lib</a> update.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>20/20</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>15/15</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>4/4</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>20/20</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">36x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">36x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">35x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">34x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-yes">32x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">33x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">24x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict'
&nbsp;
// tar -u
&nbsp;
const hlo = require('./high-level-opt.js')
const r = require('./replace.js')
// just call tar.r with the filter and mtimeCache
&nbsp;
const u = module.exports = (opt_, files, cb) =&gt; {
const opt = hlo(opt_)
&nbsp;
if (!opt.file)
throw new TypeError('file is required')
&nbsp;
if (opt.gzip)
throw new TypeError('cannot append to compressed archives')
&nbsp;
if (!files || !Array.isArray(files) || !files.length)
throw new TypeError('no files or directories specified')
&nbsp;
files = Array.from(files)
&nbsp;
mtimeFilter(opt)
return r(opt, files, cb)
}
&nbsp;
const mtimeFilter = opt =&gt; {
const filter = opt.filter
&nbsp;
if (!opt.mtimeCache)
opt.mtimeCache = new Map()
&nbsp;
opt.filter = filter ? (path, stat) =&gt;
filter(path, stat) &amp;&amp; !(opt.mtimeCache.get(path) &gt; stat.mtime)
: (path, stat) =&gt; !(opt.mtimeCache.get(path) &gt; stat.mtime)
}
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

View File

@ -0,0 +1,107 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for tar/lib/warn-mixin.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">tar/lib</a> warn-mixin.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>9/9</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>4/4</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>2/2</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>8/8</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">27x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">333x</span>
<span class="cline-any cline-yes">184x</span>
<span class="cline-any cline-yes">149x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">147x</span>
<span class="cline-any cline-yes">147x</span>
<span class="cline-any cline-yes">147x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict'
module.exports = Base =&gt; class extends Base {
warn (msg, data) {
if (!this.strict)
this.emit('warn', msg, data)
else if (data instanceof Error)
this.emit('error', data)
else {
const er = new Error(msg)
er.data = data
this.emit('error', er)
}
}
}
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

View File

@ -0,0 +1,134 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for tar/lib/winchars.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../prettify.css" />
<link rel="stylesheet" href="../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../index.html">All files</a> / <a href="index.html">tar/lib</a> winchars.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>12/12</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>7/7</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>8/8</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">45x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">45x</span>
<span class="cline-any cline-yes">45x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">30x</span>
<span class="cline-any cline-yes">20x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">'use strict'
&nbsp;
// When writing files on Windows, translate the characters to their
// 0xf000 higher-encoded versions.
&nbsp;
const raw = [
'|',
'&lt;',
'&gt;',
'?',
':'
]
&nbsp;
const win = raw.map(char =&gt;
String.fromCharCode(0xf000 + char.charCodeAt(0)))
&nbsp;
const toWin = new Map(raw.map((char, i) =&gt; [char, win[i]]))
const toRaw = new Map(win.map((char, i) =&gt; [char, raw[i]]))
&nbsp;
module.exports = {
encode: s =&gt; raw.reduce((s, c) =&gt; s.split(c).join(toWin.get(c)), s),
decode: s =&gt; win.reduce((s, c) =&gt; s.split(c).join(toRaw.get(c)), s)
}
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Nov 20 2017 16:00:38 GMT-0800 (PST)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

3690
node_modules/tar/coverage/lcov.info generated vendored Normal file

File diff suppressed because it is too large Load Diff

19
node_modules/tar/examples/extracter.js generated vendored Normal file
View File

@ -0,0 +1,19 @@
var tar = require("../tar.js")
, fs = require("fs")
function onError(err) {
console.error('An error occurred:', err)
}
function onEnd() {
console.log('Extracted!')
}
var extractor = tar.Extract({path: __dirname + "/extract"})
.on('error', onError)
.on('end', onEnd);
fs.createReadStream(__dirname + "/../test/fixtures/c.tar")
.on('error', onError)
.pipe(extractor);

24
node_modules/tar/examples/packer.js generated vendored Normal file
View File

@ -0,0 +1,24 @@
var tar = require("../tar.js")
, fstream = require("fstream")
, fs = require("fs")
var dirDest = fs.createWriteStream('dir.tar')
function onError(err) {
console.error('An error occurred:', err)
}
function onEnd() {
console.log('Packed!')
}
var packer = tar.Pack({ noProprietary: true })
.on('error', onError)
.on('end', onEnd);
// This must be a "directory"
fstream.Reader({ path: __dirname, type: "Directory" })
.on('error', onError)
.pipe(packer)
.pipe(dirDest)

36
node_modules/tar/examples/reader.js generated vendored Normal file
View File

@ -0,0 +1,36 @@
var tar = require("../tar.js")
, fs = require("fs")
fs.createReadStream(__dirname + "/../test/fixtures/c.tar")
.pipe(tar.Parse())
.on("extendedHeader", function (e) {
console.error("extended pax header", e.props)
e.on("end", function () {
console.error("extended pax fields:", e.fields)
})
})
.on("ignoredEntry", function (e) {
console.error("ignoredEntry?!?", e.props)
})
.on("longLinkpath", function (e) {
console.error("longLinkpath entry", e.props)
e.on("end", function () {
console.error("value=%j", e.body.toString())
})
})
.on("longPath", function (e) {
console.error("longPath entry", e.props)
e.on("end", function () {
console.error("value=%j", e.body.toString())
})
})
.on("entry", function (e) {
console.error("entry", e.props)
e.on("data", function (c) {
console.error(" >>>" + c.toString().replace(/\n/g, "\\n"))
})
e.on("end", function () {
console.error(" <<<EOF")
})
})

30
node_modules/tar/lib/buffer-entry.js generated vendored Normal file
View File

@ -0,0 +1,30 @@
// just like the Entry class, but it buffers the contents
//
// XXX It would be good to set a maximum BufferEntry filesize,
// since it eats up memory. In normal operation,
// these are only for long filenames or link names, which are
// rarely very big.
module.exports = BufferEntry
var inherits = require("inherits")
, Entry = require("./entry.js")
function BufferEntry () {
Entry.apply(this, arguments)
this._buffer = new Buffer(this.props.size)
this._offset = 0
this.body = ""
this.on("end", function () {
this.body = this._buffer.toString().slice(0, -1)
})
}
inherits(BufferEntry, Entry)
// collect the bytes as they come in.
BufferEntry.prototype.write = function (c) {
c.copy(this._buffer, this._offset)
this._offset += c.length
Entry.prototype.write.call(this, c)
}

169
node_modules/tar/lib/entry-writer.js generated vendored Normal file
View File

@ -0,0 +1,169 @@
module.exports = EntryWriter
var tar = require("../tar.js")
, TarHeader = require("./header.js")
, Entry = require("./entry.js")
, inherits = require("inherits")
, BlockStream = require("block-stream")
, ExtendedHeaderWriter
, Stream = require("stream").Stream
, EOF = {}
inherits(EntryWriter, Stream)
function EntryWriter (props) {
var me = this
if (!(me instanceof EntryWriter)) {
return new EntryWriter(props)
}
Stream.apply(this)
me.writable = true
me.readable = true
me._stream = new BlockStream(512)
me._stream.on("data", function (c) {
me.emit("data", c)
})
me._stream.on("drain", function () {
me.emit("drain")
})
me._stream.on("end", function () {
me.emit("end")
me.emit("close")
})
me.props = props
if (props.type === "Directory") {
props.size = 0
}
props.ustar = "ustar\0"
props.ustarver = "00"
me.path = props.path
me._buffer = []
me._didHeader = false
me._meta = false
me.on("pipe", function () {
me._process()
})
}
EntryWriter.prototype.write = function (c) {
// console.error(".. ew write")
if (this._ended) return this.emit("error", new Error("write after end"))
this._buffer.push(c)
this._process()
this._needDrain = this._buffer.length > 0
return !this._needDrain
}
EntryWriter.prototype.end = function (c) {
// console.error(".. ew end")
if (c) this._buffer.push(c)
this._buffer.push(EOF)
this._ended = true
this._process()
this._needDrain = this._buffer.length > 0
}
EntryWriter.prototype.pause = function () {
// console.error(".. ew pause")
this._paused = true
this.emit("pause")
}
EntryWriter.prototype.resume = function () {
// console.error(".. ew resume")
this._paused = false
this.emit("resume")
this._process()
}
EntryWriter.prototype.add = function (entry) {
// console.error(".. ew add")
if (!this.parent) return this.emit("error", new Error("no parent"))
// make sure that the _header and such is emitted, and clear out
// the _currentEntry link on the parent.
if (!this._ended) this.end()
return this.parent.add(entry)
}
EntryWriter.prototype._header = function () {
// console.error(".. ew header")
if (this._didHeader) return
this._didHeader = true
var headerBlock = TarHeader.encode(this.props)
if (this.props.needExtended && !this._meta) {
var me = this
ExtendedHeaderWriter = ExtendedHeaderWriter ||
require("./extended-header-writer.js")
ExtendedHeaderWriter(this.props)
.on("data", function (c) {
me.emit("data", c)
})
.on("error", function (er) {
me.emit("error", er)
})
.end()
}
// console.error(".. .. ew headerBlock emitting")
this.emit("data", headerBlock)
this.emit("header")
}
EntryWriter.prototype._process = function () {
// console.error(".. .. ew process")
if (!this._didHeader && !this._meta) {
this._header()
}
if (this._paused || this._processing) {
// console.error(".. .. .. paused=%j, processing=%j", this._paused, this._processing)
return
}
this._processing = true
var buf = this._buffer
for (var i = 0; i < buf.length; i ++) {
// console.error(".. .. .. i=%d", i)
var c = buf[i]
if (c === EOF) this._stream.end()
else this._stream.write(c)
if (this._paused) {
// console.error(".. .. .. paused mid-emission")
this._processing = false
if (i < buf.length) {
this._needDrain = true
this._buffer = buf.slice(i + 1)
}
return
}
}
// console.error(".. .. .. emitted")
this._buffer.length = 0
this._processing = false
// console.error(".. .. .. emitting drain")
this.emit("drain")
}
EntryWriter.prototype.destroy = function () {}

220
node_modules/tar/lib/entry.js generated vendored Normal file
View File

@ -0,0 +1,220 @@
// A passthrough read/write stream that sets its properties
// based on a header, extendedHeader, and globalHeader
//
// Can be either a file system object of some sort, or
// a pax/ustar metadata entry.
module.exports = Entry
var TarHeader = require("./header.js")
, tar = require("../tar")
, assert = require("assert").ok
, Stream = require("stream").Stream
, inherits = require("inherits")
, fstream = require("fstream").Abstract
function Entry (header, extended, global) {
Stream.call(this)
this.readable = true
this.writable = true
this._needDrain = false
this._paused = false
this._reading = false
this._ending = false
this._ended = false
this._remaining = 0
this._abort = false
this._queue = []
this._index = 0
this._queueLen = 0
this._read = this._read.bind(this)
this.props = {}
this._header = header
this._extended = extended || {}
// globals can change throughout the course of
// a file parse operation. Freeze it at its current state.
this._global = {}
var me = this
Object.keys(global || {}).forEach(function (g) {
me._global[g] = global[g]
})
this._setProps()
}
inherits(Entry, Stream)
Entry.prototype.write = function (c) {
if (this._ending) this.error("write() after end()", null, true)
if (this._remaining === 0) {
this.error("invalid bytes past eof")
}
// often we'll get a bunch of \0 at the end of the last write,
// since chunks will always be 512 bytes when reading a tarball.
if (c.length > this._remaining) {
c = c.slice(0, this._remaining)
}
this._remaining -= c.length
// put it on the stack.
var ql = this._queueLen
this._queue.push(c)
this._queueLen ++
this._read()
// either paused, or buffered
if (this._paused || ql > 0) {
this._needDrain = true
return false
}
return true
}
Entry.prototype.end = function (c) {
if (c) this.write(c)
this._ending = true
this._read()
}
Entry.prototype.pause = function () {
this._paused = true
this.emit("pause")
}
Entry.prototype.resume = function () {
// console.error(" Tar Entry resume", this.path)
this.emit("resume")
this._paused = false
this._read()
return this._queueLen - this._index > 1
}
// This is bound to the instance
Entry.prototype._read = function () {
// console.error(" Tar Entry _read", this.path)
if (this._paused || this._reading || this._ended) return
// set this flag so that event handlers don't inadvertently
// get multiple _read() calls running.
this._reading = true
// have any data to emit?
while (this._index < this._queueLen && !this._paused) {
var chunk = this._queue[this._index ++]
this.emit("data", chunk)
}
// check if we're drained
if (this._index >= this._queueLen) {
this._queue.length = this._queueLen = this._index = 0
if (this._needDrain) {
this._needDrain = false
this.emit("drain")
}
if (this._ending) {
this._ended = true
this.emit("end")
}
}
// if the queue gets too big, then pluck off whatever we can.
// this should be fairly rare.
var mql = this._maxQueueLen
if (this._queueLen > mql && this._index > 0) {
mql = Math.min(this._index, mql)
this._index -= mql
this._queueLen -= mql
this._queue = this._queue.slice(mql)
}
this._reading = false
}
Entry.prototype._setProps = function () {
// props = extended->global->header->{}
var header = this._header
, extended = this._extended
, global = this._global
, props = this.props
// first get the values from the normal header.
var fields = tar.fields
for (var f = 0; fields[f] !== null; f ++) {
var field = fields[f]
, val = header[field]
if (typeof val !== "undefined") props[field] = val
}
// next, the global header for this file.
// numeric values, etc, will have already been parsed.
;[global, extended].forEach(function (p) {
Object.keys(p).forEach(function (f) {
if (typeof p[f] !== "undefined") props[f] = p[f]
})
})
// no nulls allowed in path or linkpath
;["path", "linkpath"].forEach(function (p) {
if (props.hasOwnProperty(p)) {
props[p] = props[p].split("\0")[0]
}
})
// set date fields to be a proper date
;["mtime", "ctime", "atime"].forEach(function (p) {
if (props.hasOwnProperty(p)) {
props[p] = new Date(props[p] * 1000)
}
})
// set the type so that we know what kind of file to create
var type
switch (tar.types[props.type]) {
case "OldFile":
case "ContiguousFile":
type = "File"
break
case "GNUDumpDir":
type = "Directory"
break
case undefined:
type = "Unknown"
break
case "Link":
case "SymbolicLink":
case "CharacterDevice":
case "BlockDevice":
case "Directory":
case "FIFO":
default:
type = tar.types[props.type]
}
this.type = type
this.path = props.path
this.size = props.size
// size is special, since it signals when the file needs to end.
this._remaining = props.size
}
// the parser may not call write if _abort is true.
// useful for skipping data from some files quickly.
Entry.prototype.abort = function(){
this._abort = true
}
Entry.prototype.warn = fstream.warn
Entry.prototype.error = fstream.error

191
node_modules/tar/lib/extended-header-writer.js generated vendored Normal file
View File

@ -0,0 +1,191 @@
module.exports = ExtendedHeaderWriter
var inherits = require("inherits")
, EntryWriter = require("./entry-writer.js")
inherits(ExtendedHeaderWriter, EntryWriter)
var tar = require("../tar.js")
, path = require("path")
, TarHeader = require("./header.js")
// props is the props of the thing we need to write an
// extended header for.
// Don't be shy with it. Just encode everything.
function ExtendedHeaderWriter (props) {
// console.error(">> ehw ctor")
var me = this
if (!(me instanceof ExtendedHeaderWriter)) {
return new ExtendedHeaderWriter(props)
}
me.fields = props
var p =
{ path : ("PaxHeader" + path.join("/", props.path || ""))
.replace(/\\/g, "/").substr(0, 100)
, mode : props.mode || 0666
, uid : props.uid || 0
, gid : props.gid || 0
, size : 0 // will be set later
, mtime : props.mtime || Date.now() / 1000
, type : "x"
, linkpath : ""
, ustar : "ustar\0"
, ustarver : "00"
, uname : props.uname || ""
, gname : props.gname || ""
, devmaj : props.devmaj || 0
, devmin : props.devmin || 0
}
EntryWriter.call(me, p)
// console.error(">> ehw props", me.props)
me.props = p
me._meta = true
}
ExtendedHeaderWriter.prototype.end = function () {
// console.error(">> ehw end")
var me = this
if (me._ended) return
me._ended = true
me._encodeFields()
if (me.props.size === 0) {
// nothing to write!
me._ready = true
me._stream.end()
return
}
me._stream.write(TarHeader.encode(me.props))
me.body.forEach(function (l) {
me._stream.write(l)
})
me._ready = true
// console.error(">> ehw _process calling end()", me.props)
this._stream.end()
}
ExtendedHeaderWriter.prototype._encodeFields = function () {
// console.error(">> ehw _encodeFields")
this.body = []
if (this.fields.prefix) {
this.fields.path = this.fields.prefix + "/" + this.fields.path
this.fields.prefix = ""
}
encodeFields(this.fields, "", this.body, this.fields.noProprietary)
var me = this
this.body.forEach(function (l) {
me.props.size += l.length
})
}
function encodeFields (fields, prefix, body, nop) {
// console.error(">> >> ehw encodeFields")
// "%d %s=%s\n", <length>, <keyword>, <value>
// The length is a decimal number, and includes itself and the \n
// Numeric values are decimal strings.
Object.keys(fields).forEach(function (k) {
var val = fields[k]
, numeric = tar.numeric[k]
if (prefix) k = prefix + "." + k
// already including NODETAR.type, don't need File=true also
if (k === fields.type && val === true) return
switch (k) {
// don't include anything that's always handled just fine
// in the normal header, or only meaningful in the context
// of nodetar
case "mode":
case "cksum":
case "ustar":
case "ustarver":
case "prefix":
case "basename":
case "dirname":
case "needExtended":
case "block":
case "filter":
return
case "rdev":
if (val === 0) return
break
case "nlink":
case "dev": // Truly a hero among men, Creator of Star!
case "ino": // Speak his name with reverent awe! It is:
k = "SCHILY." + k
break
default: break
}
if (val && typeof val === "object" &&
!Buffer.isBuffer(val)) encodeFields(val, k, body, nop)
else if (val === null || val === undefined) return
else body.push.apply(body, encodeField(k, val, nop))
})
return body
}
function encodeField (k, v, nop) {
// lowercase keys must be valid, otherwise prefix with
// "NODETAR."
if (k.charAt(0) === k.charAt(0).toLowerCase()) {
var m = k.split(".")[0]
if (!tar.knownExtended[m]) k = "NODETAR." + k
}
// no proprietary
if (nop && k.charAt(0) !== k.charAt(0).toLowerCase()) {
return []
}
if (typeof val === "number") val = val.toString(10)
var s = new Buffer(" " + k + "=" + v + "\n")
, digits = Math.floor(Math.log(s.length) / Math.log(10)) + 1
// console.error("1 s=%j digits=%j s.length=%d", s.toString(), digits, s.length)
// if adding that many digits will make it go over that length,
// then add one to it. For example, if the string is:
// " foo=bar\n"
// then that's 9 characters. With the "9", that bumps the length
// up to 10. However, this is invalid:
// "10 foo=bar\n"
// but, since that's actually 11 characters, since 10 adds another
// character to the length, and the length includes the number
// itself. In that case, just bump it up again.
if (s.length + digits >= Math.pow(10, digits)) digits += 1
// console.error("2 s=%j digits=%j s.length=%d", s.toString(), digits, s.length)
var len = digits + s.length
// console.error("3 s=%j digits=%j s.length=%d len=%d", s.toString(), digits, s.length, len)
var lenBuf = new Buffer("" + len)
if (lenBuf.length + s.length !== len) {
throw new Error("Bad length calculation\n"+
"len="+len+"\n"+
"lenBuf="+JSON.stringify(lenBuf.toString())+"\n"+
"lenBuf.length="+lenBuf.length+"\n"+
"digits="+digits+"\n"+
"s="+JSON.stringify(s.toString())+"\n"+
"s.length="+s.length)
}
return [lenBuf, s]
}

140
node_modules/tar/lib/extended-header.js generated vendored Normal file
View File

@ -0,0 +1,140 @@
// An Entry consisting of:
//
// "%d %s=%s\n", <length>, <keyword>, <value>
//
// The length is a decimal number, and includes itself and the \n
// \0 does not terminate anything. Only the length terminates the string.
// Numeric values are decimal strings.
module.exports = ExtendedHeader
var Entry = require("./entry.js")
, inherits = require("inherits")
, tar = require("../tar.js")
, numeric = tar.numeric
, keyTrans = { "SCHILY.dev": "dev"
, "SCHILY.ino": "ino"
, "SCHILY.nlink": "nlink" }
function ExtendedHeader () {
Entry.apply(this, arguments)
this.on("data", this._parse)
this.fields = {}
this._position = 0
this._fieldPos = 0
this._state = SIZE
this._sizeBuf = []
this._keyBuf = []
this._valBuf = []
this._size = -1
this._key = ""
}
inherits(ExtendedHeader, Entry)
ExtendedHeader.prototype._parse = parse
var s = 0
, states = ExtendedHeader.states = {}
, SIZE = states.SIZE = s++
, KEY = states.KEY = s++
, VAL = states.VAL = s++
, ERR = states.ERR = s++
Object.keys(states).forEach(function (s) {
states[states[s]] = states[s]
})
states[s] = null
// char code values for comparison
var _0 = "0".charCodeAt(0)
, _9 = "9".charCodeAt(0)
, point = ".".charCodeAt(0)
, a = "a".charCodeAt(0)
, Z = "Z".charCodeAt(0)
, a = "a".charCodeAt(0)
, z = "z".charCodeAt(0)
, space = " ".charCodeAt(0)
, eq = "=".charCodeAt(0)
, cr = "\n".charCodeAt(0)
function parse (c) {
if (this._state === ERR) return
for ( var i = 0, l = c.length
; i < l
; this._position++, this._fieldPos++, i++) {
// console.error("top of loop, size="+this._size)
var b = c[i]
if (this._size >= 0 && this._fieldPos > this._size) {
error(this, "field exceeds length="+this._size)
return
}
switch (this._state) {
case ERR: return
case SIZE:
// console.error("parsing size, b=%d, rest=%j", b, c.slice(i).toString())
if (b === space) {
this._state = KEY
// this._fieldPos = this._sizeBuf.length
this._size = parseInt(new Buffer(this._sizeBuf).toString(), 10)
this._sizeBuf.length = 0
continue
}
if (b < _0 || b > _9) {
error(this, "expected [" + _0 + ".." + _9 + "], got " + b)
return
}
this._sizeBuf.push(b)
continue
case KEY:
// can be any char except =, not > size.
if (b === eq) {
this._state = VAL
this._key = new Buffer(this._keyBuf).toString()
if (keyTrans[this._key]) this._key = keyTrans[this._key]
this._keyBuf.length = 0
continue
}
this._keyBuf.push(b)
continue
case VAL:
// field must end with cr
if (this._fieldPos === this._size - 1) {
// console.error("finished with "+this._key)
if (b !== cr) {
error(this, "expected \\n at end of field")
return
}
var val = new Buffer(this._valBuf).toString()
if (numeric[this._key]) {
val = parseFloat(val)
}
this.fields[this._key] = val
this._valBuf.length = 0
this._state = SIZE
this._size = -1
this._fieldPos = -1
continue
}
this._valBuf.push(b)
continue
}
}
}
function error (me, msg) {
msg = "invalid header: " + msg
+ "\nposition=" + me._position
+ "\nfield position=" + me._fieldPos
me.error(msg)
me.state = ERR
}

94
node_modules/tar/lib/extract.js generated vendored Normal file
View File

@ -0,0 +1,94 @@
// give it a tarball and a path, and it'll dump the contents
module.exports = Extract
var tar = require("../tar.js")
, fstream = require("fstream")
, inherits = require("inherits")
, path = require("path")
function Extract (opts) {
if (!(this instanceof Extract)) return new Extract(opts)
tar.Parse.apply(this)
if (typeof opts !== "object") {
opts = { path: opts }
}
// better to drop in cwd? seems more standard.
opts.path = opts.path || path.resolve("node-tar-extract")
opts.type = "Directory"
opts.Directory = true
// similar to --strip or --strip-components
opts.strip = +opts.strip
if (!opts.strip || opts.strip <= 0) opts.strip = 0
this._fst = fstream.Writer(opts)
this.pause()
var me = this
// Hardlinks in tarballs are relative to the root
// of the tarball. So, they need to be resolved against
// the target directory in order to be created properly.
me.on("entry", function (entry) {
// if there's a "strip" argument, then strip off that many
// path components.
if (opts.strip) {
var p = entry.path.split("/").slice(opts.strip).join("/")
entry.path = entry.props.path = p
if (entry.linkpath) {
var lp = entry.linkpath.split("/").slice(opts.strip).join("/")
entry.linkpath = entry.props.linkpath = lp
}
}
if (entry.type === "Link") {
entry.linkpath = entry.props.linkpath =
path.join(opts.path, path.join("/", entry.props.linkpath))
}
if (entry.type === "SymbolicLink") {
var dn = path.dirname(entry.path) || ""
var linkpath = entry.props.linkpath
var target = path.resolve(opts.path, dn, linkpath)
if (target.indexOf(opts.path) !== 0) {
linkpath = path.join(opts.path, path.join("/", linkpath))
}
entry.linkpath = entry.props.linkpath = linkpath
}
})
this._fst.on("ready", function () {
me.pipe(me._fst, { end: false })
me.resume()
})
this._fst.on('error', function(err) {
me.emit('error', err)
})
this._fst.on('drain', function() {
me.emit('drain')
})
// this._fst.on("end", function () {
// console.error("\nEEEE Extract End", me._fst.path)
// })
this._fst.on("close", function () {
// console.error("\nEEEE Extract End", me._fst.path)
me.emit("finish")
me.emit("end")
me.emit("close")
})
}
inherits(Extract, tar.Parse)
Extract.prototype._streamEnd = function () {
var me = this
if (!me._ended || me._entry) me.error("unexpected eof")
me._fst.end()
// my .end() is coming later.
}

14
node_modules/tar/lib/global-header-writer.js generated vendored Normal file
View File

@ -0,0 +1,14 @@
module.exports = GlobalHeaderWriter
var ExtendedHeaderWriter = require("./extended-header-writer.js")
, inherits = require("inherits")
inherits(GlobalHeaderWriter, ExtendedHeaderWriter)
function GlobalHeaderWriter (props) {
if (!(this instanceof GlobalHeaderWriter)) {
return new GlobalHeaderWriter(props)
}
ExtendedHeaderWriter.call(this, props)
this.props.type = "g"
}

385
node_modules/tar/lib/header.js generated vendored Normal file
View File

@ -0,0 +1,385 @@
// parse a 512-byte header block to a data object, or vice-versa
// If the data won't fit nicely in a simple header, then generate
// the appropriate extended header file, and return that.
module.exports = TarHeader
var tar = require("../tar.js")
, fields = tar.fields
, fieldOffs = tar.fieldOffs
, fieldEnds = tar.fieldEnds
, fieldSize = tar.fieldSize
, numeric = tar.numeric
, assert = require("assert").ok
, space = " ".charCodeAt(0)
, slash = "/".charCodeAt(0)
, bslash = process.platform === "win32" ? "\\".charCodeAt(0) : null
function TarHeader (block) {
if (!(this instanceof TarHeader)) return new TarHeader(block)
if (block) this.decode(block)
}
TarHeader.prototype =
{ decode : decode
, encode: encode
, calcSum: calcSum
, checkSum: checkSum
}
TarHeader.parseNumeric = parseNumeric
TarHeader.encode = encode
TarHeader.decode = decode
// note that this will only do the normal ustar header, not any kind
// of extended posix header file. If something doesn't fit comfortably,
// then it will set obj.needExtended = true, and set the block to
// the closest approximation.
function encode (obj) {
if (!obj && !(this instanceof TarHeader)) throw new Error(
"encode must be called on a TarHeader, or supplied an object")
obj = obj || this
var block = obj.block = new Buffer(512)
// if the object has a "prefix", then that's actually an extension of
// the path field.
if (obj.prefix) {
// console.error("%% header encoding, got a prefix", obj.prefix)
obj.path = obj.prefix + "/" + obj.path
// console.error("%% header encoding, prefixed path", obj.path)
obj.prefix = ""
}
obj.needExtended = false
if (obj.mode) {
if (typeof obj.mode === "string") obj.mode = parseInt(obj.mode, 8)
obj.mode = obj.mode & 0777
}
for (var f = 0; fields[f] !== null; f ++) {
var field = fields[f]
, off = fieldOffs[f]
, end = fieldEnds[f]
, ret
switch (field) {
case "cksum":
// special, done below, after all the others
break
case "prefix":
// special, this is an extension of the "path" field.
// console.error("%% header encoding, skip prefix later")
break
case "type":
// convert from long name to a single char.
var type = obj.type || "0"
if (type.length > 1) {
type = tar.types[obj.type]
if (!type) type = "0"
}
writeText(block, off, end, type)
break
case "path":
// uses the "prefix" field if > 100 bytes, but <= 255
var pathLen = Buffer.byteLength(obj.path)
, pathFSize = fieldSize[fields.path]
, prefFSize = fieldSize[fields.prefix]
// paths between 100 and 255 should use the prefix field.
// longer than 255
if (pathLen > pathFSize &&
pathLen <= pathFSize + prefFSize) {
// need to find a slash somewhere in the middle so that
// path and prefix both fit in their respective fields
var searchStart = pathLen - 1 - pathFSize
, searchEnd = prefFSize
, found = false
, pathBuf = new Buffer(obj.path)
for ( var s = searchStart
; (s <= searchEnd)
; s ++ ) {
if (pathBuf[s] === slash || pathBuf[s] === bslash) {
found = s
break
}
}
if (found !== false) {
prefix = pathBuf.slice(0, found).toString("utf8")
path = pathBuf.slice(found + 1).toString("utf8")
ret = writeText(block, off, end, path)
off = fieldOffs[fields.prefix]
end = fieldEnds[fields.prefix]
// console.error("%% header writing prefix", off, end, prefix)
ret = writeText(block, off, end, prefix) || ret
break
}
}
// paths less than 100 chars don't need a prefix
// and paths longer than 255 need an extended header and will fail
// on old implementations no matter what we do here.
// Null out the prefix, and fallthrough to default.
// console.error("%% header writing no prefix")
var poff = fieldOffs[fields.prefix]
, pend = fieldEnds[fields.prefix]
writeText(block, poff, pend, "")
// fallthrough
// all other fields are numeric or text
default:
ret = numeric[field]
? writeNumeric(block, off, end, obj[field])
: writeText(block, off, end, obj[field] || "")
break
}
obj.needExtended = obj.needExtended || ret
}
var off = fieldOffs[fields.cksum]
, end = fieldEnds[fields.cksum]
writeNumeric(block, off, end, calcSum.call(this, block))
return block
}
// if it's a negative number, or greater than will fit,
// then use write256.
var MAXNUM = { 12: 077777777777
, 11: 07777777777
, 8 : 07777777
, 7 : 0777777 }
function writeNumeric (block, off, end, num) {
var writeLen = end - off
, maxNum = MAXNUM[writeLen] || 0
num = num || 0
// console.error(" numeric", num)
if (num instanceof Date ||
Object.prototype.toString.call(num) === "[object Date]") {
num = num.getTime() / 1000
}
if (num > maxNum || num < 0) {
write256(block, off, end, num)
// need an extended header if negative or too big.
return true
}
// god, tar is so annoying
// if the string is small enough, you should put a space
// between the octal string and the \0, but if it doesn't
// fit, then don't.
var numStr = Math.floor(num).toString(8)
if (num < MAXNUM[writeLen - 1]) numStr += " "
// pad with "0" chars
if (numStr.length < writeLen) {
numStr = (new Array(writeLen - numStr.length).join("0")) + numStr
}
if (numStr.length !== writeLen - 1) {
throw new Error("invalid length: " + JSON.stringify(numStr) + "\n" +
"expected: "+writeLen)
}
block.write(numStr, off, writeLen, "utf8")
block[end - 1] = 0
}
function write256 (block, off, end, num) {
var buf = block.slice(off, end)
var positive = num >= 0
buf[0] = positive ? 0x80 : 0xFF
// get the number as a base-256 tuple
if (!positive) num *= -1
var tuple = []
do {
var n = num % 256
tuple.push(n)
num = (num - n) / 256
} while (num)
var bytes = tuple.length
var fill = buf.length - bytes
for (var i = 1; i < fill; i ++) {
buf[i] = positive ? 0 : 0xFF
}
// tuple is a base256 number, with [0] as the *least* significant byte
// if it's negative, then we need to flip all the bits once we hit the
// first non-zero bit. The 2's-complement is (0x100 - n), and the 1's-
// complement is (0xFF - n).
var zero = true
for (i = bytes; i > 0; i --) {
var byte = tuple[bytes - i]
if (positive) buf[fill + i] = byte
else if (zero && byte === 0) buf[fill + i] = 0
else if (zero) {
zero = false
buf[fill + i] = 0x100 - byte
} else buf[fill + i] = 0xFF - byte
}
}
function writeText (block, off, end, str) {
// strings are written as utf8, then padded with \0
var strLen = Buffer.byteLength(str)
, writeLen = Math.min(strLen, end - off)
// non-ascii fields need extended headers
// long fields get truncated
, needExtended = strLen !== str.length || strLen > writeLen
// write the string, and null-pad
if (writeLen > 0) block.write(str, off, writeLen, "utf8")
for (var i = off + writeLen; i < end; i ++) block[i] = 0
return needExtended
}
function calcSum (block) {
block = block || this.block
assert(Buffer.isBuffer(block) && block.length === 512)
if (!block) throw new Error("Need block to checksum")
// now figure out what it would be if the cksum was " "
var sum = 0
, start = fieldOffs[fields.cksum]
, end = fieldEnds[fields.cksum]
for (var i = 0; i < fieldOffs[fields.cksum]; i ++) {
sum += block[i]
}
for (var i = start; i < end; i ++) {
sum += space
}
for (var i = end; i < 512; i ++) {
sum += block[i]
}
return sum
}
function checkSum (block) {
var sum = calcSum.call(this, block)
block = block || this.block
var cksum = block.slice(fieldOffs[fields.cksum], fieldEnds[fields.cksum])
cksum = parseNumeric(cksum)
return cksum === sum
}
function decode (block) {
block = block || this.block
assert(Buffer.isBuffer(block) && block.length === 512)
this.block = block
this.cksumValid = this.checkSum()
var prefix = null
// slice off each field.
for (var f = 0; fields[f] !== null; f ++) {
var field = fields[f]
, val = block.slice(fieldOffs[f], fieldEnds[f])
switch (field) {
case "ustar":
// if not ustar, then everything after that is just padding.
if (val.toString() !== "ustar\0") {
this.ustar = false
return
} else {
// console.error("ustar:", val, val.toString())
this.ustar = val.toString()
}
break
// prefix is special, since it might signal the xstar header
case "prefix":
var atime = parseNumeric(val.slice(131, 131 + 12))
, ctime = parseNumeric(val.slice(131 + 12, 131 + 12 + 12))
if ((val[130] === 0 || val[130] === space) &&
typeof atime === "number" &&
typeof ctime === "number" &&
val[131 + 12] === space &&
val[131 + 12 + 12] === space) {
this.atime = atime
this.ctime = ctime
val = val.slice(0, 130)
}
prefix = val.toString("utf8").replace(/\0+$/, "")
// console.error("%% header reading prefix", prefix)
break
// all other fields are null-padding text
// or a number.
default:
if (numeric[field]) {
this[field] = parseNumeric(val)
} else {
this[field] = val.toString("utf8").replace(/\0+$/, "")
}
break
}
}
// if we got a prefix, then prepend it to the path.
if (prefix) {
this.path = prefix + "/" + this.path
// console.error("%% header got a prefix", this.path)
}
}
function parse256 (buf) {
// first byte MUST be either 80 or FF
// 80 for positive, FF for 2's comp
var positive
if (buf[0] === 0x80) positive = true
else if (buf[0] === 0xFF) positive = false
else return null
// build up a base-256 tuple from the least sig to the highest
var zero = false
, tuple = []
for (var i = buf.length - 1; i > 0; i --) {
var byte = buf[i]
if (positive) tuple.push(byte)
else if (zero && byte === 0) tuple.push(0)
else if (zero) {
zero = false
tuple.push(0x100 - byte)
} else tuple.push(0xFF - byte)
}
for (var sum = 0, i = 0, l = tuple.length; i < l; i ++) {
sum += tuple[i] * Math.pow(256, i)
}
return positive ? sum : -1 * sum
}
function parseNumeric (f) {
if (f[0] & 0x80) return parse256(f)
var str = f.toString("utf8").split("\0")[0].trim()
, res = parseInt(str, 8)
return isNaN(res) ? null : res
}

236
node_modules/tar/lib/pack.js generated vendored Normal file
View File

@ -0,0 +1,236 @@
// pipe in an fstream, and it'll make a tarball.
// key-value pair argument is global extended header props.
module.exports = Pack
var EntryWriter = require("./entry-writer.js")
, Stream = require("stream").Stream
, path = require("path")
, inherits = require("inherits")
, GlobalHeaderWriter = require("./global-header-writer.js")
, collect = require("fstream").collect
, eof = new Buffer(512)
for (var i = 0; i < 512; i ++) eof[i] = 0
inherits(Pack, Stream)
function Pack (props) {
// console.error("-- p ctor")
var me = this
if (!(me instanceof Pack)) return new Pack(props)
if (props) me._noProprietary = props.noProprietary
else me._noProprietary = false
me._global = props
me.readable = true
me.writable = true
me._buffer = []
// console.error("-- -- set current to null in ctor")
me._currentEntry = null
me._processing = false
me._pipeRoot = null
me.on("pipe", function (src) {
if (src.root === me._pipeRoot) return
me._pipeRoot = src
src.on("end", function () {
me._pipeRoot = null
})
me.add(src)
})
}
Pack.prototype.addGlobal = function (props) {
// console.error("-- p addGlobal")
if (this._didGlobal) return
this._didGlobal = true
var me = this
GlobalHeaderWriter(props)
.on("data", function (c) {
me.emit("data", c)
})
.end()
}
Pack.prototype.add = function (stream) {
if (this._global && !this._didGlobal) this.addGlobal(this._global)
if (this._ended) return this.emit("error", new Error("add after end"))
collect(stream)
this._buffer.push(stream)
this._process()
this._needDrain = this._buffer.length > 0
return !this._needDrain
}
Pack.prototype.pause = function () {
this._paused = true
if (this._currentEntry) this._currentEntry.pause()
this.emit("pause")
}
Pack.prototype.resume = function () {
this._paused = false
if (this._currentEntry) this._currentEntry.resume()
this.emit("resume")
this._process()
}
Pack.prototype.end = function () {
this._ended = true
this._buffer.push(eof)
this._process()
}
Pack.prototype._process = function () {
var me = this
if (me._paused || me._processing) {
return
}
var entry = me._buffer.shift()
if (!entry) {
if (me._needDrain) {
me.emit("drain")
}
return
}
if (entry.ready === false) {
// console.error("-- entry is not ready", entry)
me._buffer.unshift(entry)
entry.on("ready", function () {
// console.error("-- -- ready!", entry)
me._process()
})
return
}
me._processing = true
if (entry === eof) {
// need 2 ending null blocks.
me.emit("data", eof)
me.emit("data", eof)
me.emit("end")
me.emit("close")
return
}
// Change the path to be relative to the root dir that was
// added to the tarball.
//
// XXX This should be more like how -C works, so you can
// explicitly set a root dir, and also explicitly set a pathname
// in the tarball to use. That way we can skip a lot of extra
// work when resolving symlinks for bundled dependencies in npm.
var root = path.dirname((entry.root || entry).path);
if (me._global && me._global.fromBase && entry.root && entry.root.path) {
// user set 'fromBase: true' indicating tar root should be directory itself
root = entry.root.path;
}
var wprops = {}
Object.keys(entry.props || {}).forEach(function (k) {
wprops[k] = entry.props[k]
})
if (me._noProprietary) wprops.noProprietary = true
wprops.path = path.relative(root, entry.path || '')
// actually not a matter of opinion or taste.
if (process.platform === "win32") {
wprops.path = wprops.path.replace(/\\/g, "/")
}
if (!wprops.type)
wprops.type = 'Directory'
switch (wprops.type) {
// sockets not supported
case "Socket":
return
case "Directory":
wprops.path += "/"
wprops.size = 0
break
case "Link":
var lp = path.resolve(path.dirname(entry.path), entry.linkpath)
wprops.linkpath = path.relative(root, lp) || "."
wprops.size = 0
break
case "SymbolicLink":
var lp = path.resolve(path.dirname(entry.path), entry.linkpath)
wprops.linkpath = path.relative(path.dirname(entry.path), lp) || "."
wprops.size = 0
break
}
// console.error("-- new writer", wprops)
// if (!wprops.type) {
// // console.error("-- no type?", entry.constructor.name, entry)
// }
// console.error("-- -- set current to new writer", wprops.path)
var writer = me._currentEntry = EntryWriter(wprops)
writer.parent = me
// writer.on("end", function () {
// // console.error("-- -- writer end", writer.path)
// })
writer.on("data", function (c) {
me.emit("data", c)
})
writer.on("header", function () {
Buffer.prototype.toJSON = function () {
return this.toString().split(/\0/).join(".")
}
// console.error("-- -- writer header %j", writer.props)
if (writer.props.size === 0) nextEntry()
})
writer.on("close", nextEntry)
var ended = false
function nextEntry () {
if (ended) return
ended = true
// console.error("-- -- writer close", writer.path)
// console.error("-- -- set current to null", wprops.path)
me._currentEntry = null
me._processing = false
me._process()
}
writer.on("error", function (er) {
// console.error("-- -- writer error", writer.path)
me.emit("error", er)
})
// if it's the root, then there's no need to add its entries,
// or data, since they'll be added directly.
if (entry === me._pipeRoot) {
// console.error("-- is the root, don't auto-add")
writer.add = null
}
entry.pipe(writer)
}
Pack.prototype.destroy = function () {}
Pack.prototype.write = function () {}

281
node_modules/tar/lib/parse.js generated vendored Normal file
View File

@ -0,0 +1,281 @@
// A writable stream.
// It emits "entry" events, which provide a readable stream that has
// header info attached.
module.exports = Parse.create = Parse
var stream = require("stream")
, Stream = stream.Stream
, BlockStream = require("block-stream")
, tar = require("../tar.js")
, TarHeader = require("./header.js")
, Entry = require("./entry.js")
, BufferEntry = require("./buffer-entry.js")
, ExtendedHeader = require("./extended-header.js")
, assert = require("assert").ok
, inherits = require("inherits")
, fstream = require("fstream")
// reading a tar is a lot like reading a directory
// However, we're actually not going to run the ctor,
// since it does a stat and various other stuff.
// This inheritance gives us the pause/resume/pipe
// behavior that is desired.
inherits(Parse, fstream.Reader)
function Parse () {
var me = this
if (!(me instanceof Parse)) return new Parse()
// doesn't apply fstream.Reader ctor?
// no, becasue we don't want to stat/etc, we just
// want to get the entry/add logic from .pipe()
Stream.apply(me)
me.writable = true
me.readable = true
me._stream = new BlockStream(512)
me.position = 0
me._ended = false
me._hardLinks = {}
me._stream.on("error", function (e) {
me.emit("error", e)
})
me._stream.on("data", function (c) {
me._process(c)
})
me._stream.on("end", function () {
me._streamEnd()
})
me._stream.on("drain", function () {
me.emit("drain")
})
}
// overridden in Extract class, since it needs to
// wait for its DirWriter part to finish before
// emitting "end"
Parse.prototype._streamEnd = function () {
var me = this
if (!me._ended || me._entry) me.error("unexpected eof")
me.emit("end")
}
// a tar reader is actually a filter, not just a readable stream.
// So, you should pipe a tarball stream into it, and it needs these
// write/end methods to do that.
Parse.prototype.write = function (c) {
if (this._ended) {
// gnutar puts a LOT of nulls at the end.
// you can keep writing these things forever.
// Just ignore them.
for (var i = 0, l = c.length; i > l; i ++) {
if (c[i] !== 0) return this.error("write() after end()")
}
return
}
return this._stream.write(c)
}
Parse.prototype.end = function (c) {
this._ended = true
return this._stream.end(c)
}
// don't need to do anything, since we're just
// proxying the data up from the _stream.
// Just need to override the parent's "Not Implemented"
// error-thrower.
Parse.prototype._read = function () {}
Parse.prototype._process = function (c) {
assert(c && c.length === 512, "block size should be 512")
// one of three cases.
// 1. A new header
// 2. A part of a file/extended header
// 3. One of two or more EOF null blocks
if (this._entry) {
var entry = this._entry
if(!entry._abort) entry.write(c)
else {
entry._remaining -= c.length
if(entry._remaining < 0) entry._remaining = 0
}
if (entry._remaining === 0) {
entry.end()
this._entry = null
}
} else {
// either zeroes or a header
var zero = true
for (var i = 0; i < 512 && zero; i ++) {
zero = c[i] === 0
}
// eof is *at least* 2 blocks of nulls, and then the end of the
// file. you can put blocks of nulls between entries anywhere,
// so appending one tarball to another is technically valid.
// ending without the eof null blocks is not allowed, however.
if (zero) {
if (this._eofStarted)
this._ended = true
this._eofStarted = true
} else {
this._eofStarted = false
this._startEntry(c)
}
}
this.position += 512
}
// take a header chunk, start the right kind of entry.
Parse.prototype._startEntry = function (c) {
var header = new TarHeader(c)
, self = this
, entry
, ev
, EntryType
, onend
, meta = false
if (null === header.size || !header.cksumValid) {
var e = new Error("invalid tar file")
e.header = header
e.tar_file_offset = this.position
e.tar_block = this.position / 512
return this.emit("error", e)
}
switch (tar.types[header.type]) {
case "File":
case "OldFile":
case "Link":
case "SymbolicLink":
case "CharacterDevice":
case "BlockDevice":
case "Directory":
case "FIFO":
case "ContiguousFile":
case "GNUDumpDir":
// start a file.
// pass in any extended headers
// These ones consumers are typically most interested in.
EntryType = Entry
ev = "entry"
break
case "GlobalExtendedHeader":
// extended headers that apply to the rest of the tarball
EntryType = ExtendedHeader
onend = function () {
self._global = self._global || {}
Object.keys(entry.fields).forEach(function (k) {
self._global[k] = entry.fields[k]
})
}
ev = "globalExtendedHeader"
meta = true
break
case "ExtendedHeader":
case "OldExtendedHeader":
// extended headers that apply to the next entry
EntryType = ExtendedHeader
onend = function () {
self._extended = entry.fields
}
ev = "extendedHeader"
meta = true
break
case "NextFileHasLongLinkpath":
// set linkpath=<contents> in extended header
EntryType = BufferEntry
onend = function () {
self._extended = self._extended || {}
self._extended.linkpath = entry.body
}
ev = "longLinkpath"
meta = true
break
case "NextFileHasLongPath":
case "OldGnuLongPath":
// set path=<contents> in file-extended header
EntryType = BufferEntry
onend = function () {
self._extended = self._extended || {}
self._extended.path = entry.body
}
ev = "longPath"
meta = true
break
default:
// all the rest we skip, but still set the _entry
// member, so that we can skip over their data appropriately.
// emit an event to say that this is an ignored entry type?
EntryType = Entry
ev = "ignoredEntry"
break
}
var global, extended
if (meta) {
global = extended = null
} else {
var global = this._global
var extended = this._extended
// extendedHeader only applies to one entry, so once we start
// an entry, it's over.
this._extended = null
}
entry = new EntryType(header, extended, global)
entry.meta = meta
// only proxy data events of normal files.
if (!meta) {
entry.on("data", function (c) {
me.emit("data", c)
})
}
if (onend) entry.on("end", onend)
this._entry = entry
if (entry.type === "Link") {
this._hardLinks[entry.path] = entry
}
var me = this
entry.on("pause", function () {
me.pause()
})
entry.on("resume", function () {
me.resume()
})
if (this.listeners("*").length) {
this.emit("*", ev, entry)
}
this.emit(ev, entry)
// Zero-byte entry. End immediately.
if (entry.props.size === 0) {
entry.end()
this._entry = null
}
}

59
node_modules/tar/package.json generated vendored Normal file
View File

@ -0,0 +1,59 @@
{
"_from": "tar@^2.0.0",
"_id": "tar@2.2.2",
"_inBundle": false,
"_integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==",
"_location": "/tar",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "tar@^2.0.0",
"name": "tar",
"escapedName": "tar",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/node-gyp"
],
"_resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz",
"_shasum": "0ca8848562c7299b8b446ff6a4d60cdbb23edc40",
"_spec": "tar@^2.0.0",
"_where": "/home/outis/Documents/Sites/BBB/node_modules/node-gyp",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"bugs": {
"url": "https://github.com/isaacs/node-tar/issues"
},
"bundleDependencies": false,
"dependencies": {
"block-stream": "*",
"fstream": "^1.0.12",
"inherits": "2"
},
"deprecated": false,
"description": "tar for node",
"devDependencies": {
"graceful-fs": "^4.1.2",
"mkdirp": "^0.5.0",
"rimraf": "1.x",
"tap": "0.x"
},
"homepage": "https://github.com/isaacs/node-tar#readme",
"license": "ISC",
"main": "tar.js",
"name": "tar",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-tar.git"
},
"scripts": {
"test": "tap test/*.js"
},
"version": "2.2.2"
}

173
node_modules/tar/tar.js generated vendored Normal file
View File

@ -0,0 +1,173 @@
// field paths that every tar file must have.
// header is padded to 512 bytes.
var f = 0
, fields = {}
, path = fields.path = f++
, mode = fields.mode = f++
, uid = fields.uid = f++
, gid = fields.gid = f++
, size = fields.size = f++
, mtime = fields.mtime = f++
, cksum = fields.cksum = f++
, type = fields.type = f++
, linkpath = fields.linkpath = f++
, headerSize = 512
, blockSize = 512
, fieldSize = []
fieldSize[path] = 100
fieldSize[mode] = 8
fieldSize[uid] = 8
fieldSize[gid] = 8
fieldSize[size] = 12
fieldSize[mtime] = 12
fieldSize[cksum] = 8
fieldSize[type] = 1
fieldSize[linkpath] = 100
// "ustar\0" may introduce another bunch of headers.
// these are optional, and will be nulled out if not present.
var ustar = fields.ustar = f++
, ustarver = fields.ustarver = f++
, uname = fields.uname = f++
, gname = fields.gname = f++
, devmaj = fields.devmaj = f++
, devmin = fields.devmin = f++
, prefix = fields.prefix = f++
, fill = fields.fill = f++
// terminate fields.
fields[f] = null
fieldSize[ustar] = 6
fieldSize[ustarver] = 2
fieldSize[uname] = 32
fieldSize[gname] = 32
fieldSize[devmaj] = 8
fieldSize[devmin] = 8
fieldSize[prefix] = 155
fieldSize[fill] = 12
// nb: prefix field may in fact be 130 bytes of prefix,
// a null char, 12 bytes for atime, 12 bytes for ctime.
//
// To recognize this format:
// 1. prefix[130] === ' ' or '\0'
// 2. atime and ctime are octal numeric values
// 3. atime and ctime have ' ' in their last byte
var fieldEnds = {}
, fieldOffs = {}
, fe = 0
for (var i = 0; i < f; i ++) {
fieldOffs[i] = fe
fieldEnds[i] = (fe += fieldSize[i])
}
// build a translation table of field paths.
Object.keys(fields).forEach(function (f) {
if (fields[f] !== null) fields[fields[f]] = f
})
// different values of the 'type' field
// paths match the values of Stats.isX() functions, where appropriate
var types =
{ 0: "File"
, "\0": "OldFile" // like 0
, "": "OldFile"
, 1: "Link"
, 2: "SymbolicLink"
, 3: "CharacterDevice"
, 4: "BlockDevice"
, 5: "Directory"
, 6: "FIFO"
, 7: "ContiguousFile" // like 0
// posix headers
, g: "GlobalExtendedHeader" // k=v for the rest of the archive
, x: "ExtendedHeader" // k=v for the next file
// vendor-specific stuff
, A: "SolarisACL" // skip
, D: "GNUDumpDir" // like 5, but with data, which should be skipped
, I: "Inode" // metadata only, skip
, K: "NextFileHasLongLinkpath" // data = link path of next file
, L: "NextFileHasLongPath" // data = path of next file
, M: "ContinuationFile" // skip
, N: "OldGnuLongPath" // like L
, S: "SparseFile" // skip
, V: "TapeVolumeHeader" // skip
, X: "OldExtendedHeader" // like x
}
Object.keys(types).forEach(function (t) {
types[types[t]] = types[types[t]] || t
})
// values for the mode field
var modes =
{ suid: 04000 // set uid on extraction
, sgid: 02000 // set gid on extraction
, svtx: 01000 // set restricted deletion flag on dirs on extraction
, uread: 0400
, uwrite: 0200
, uexec: 0100
, gread: 040
, gwrite: 020
, gexec: 010
, oread: 4
, owrite: 2
, oexec: 1
, all: 07777
}
var numeric =
{ mode: true
, uid: true
, gid: true
, size: true
, mtime: true
, devmaj: true
, devmin: true
, cksum: true
, atime: true
, ctime: true
, dev: true
, ino: true
, nlink: true
}
Object.keys(modes).forEach(function (t) {
modes[modes[t]] = modes[modes[t]] || t
})
var knownExtended =
{ atime: true
, charset: true
, comment: true
, ctime: true
, gid: true
, gname: true
, linkpath: true
, mtime: true
, path: true
, realtime: true
, security: true
, size: true
, uid: true
, uname: true }
exports.fields = fields
exports.fieldSize = fieldSize
exports.fieldOffs = fieldOffs
exports.fieldEnds = fieldEnds
exports.types = types
exports.modes = modes
exports.numeric = numeric
exports.headerSize = headerSize
exports.blockSize = blockSize
exports.knownExtended = knownExtended
exports.Pack = require("./lib/pack.js")
exports.Parse = require("./lib/parse.js")
exports.Extract = require("./lib/extract.js")

53
node_modules/tar/test/00-setup-fixtures.js generated vendored Normal file
View File

@ -0,0 +1,53 @@
// the fixtures have some weird stuff that is painful
// to include directly in the repo for various reasons.
//
// So, unpack the fixtures with the system tar first.
//
// This means, of course, that it'll only work if you
// already have a tar implementation, and some of them
// will not properly unpack the fixtures anyway.
//
// But, since usually those tests will fail on Windows
// and other systems with less capable filesystems anyway,
// at least this way we don't cause inconveniences by
// merely cloning the repo or installing the package.
var tap = require("tap")
, child_process = require("child_process")
, rimraf = require("rimraf")
, test = tap.test
, path = require("path")
test("clean fixtures", function (t) {
rimraf(path.resolve(__dirname, "fixtures"), function (er) {
t.ifError(er, "rimraf ./fixtures/")
t.end()
})
})
test("clean tmp", function (t) {
rimraf(path.resolve(__dirname, "tmp"), function (er) {
t.ifError(er, "rimraf ./tmp/")
t.end()
})
})
test("extract fixtures", function (t) {
var c = child_process.spawn("tar"
,["xzvf", "fixtures.tgz"]
,{ cwd: __dirname })
c.stdout.on("data", errwrite)
c.stderr.on("data", errwrite)
function errwrite (chunk) {
process.stderr.write(chunk)
}
c.on("exit", function (code) {
t.equal(code, 0, "extract fixtures should exit with 0")
if (code) {
t.comment("Note, all tests from here on out will fail because of this.")
}
t.end()
})
})

BIN
node_modules/tar/test/cb-never-called-1.0.1.tgz generated vendored Normal file

Binary file not shown.

177
node_modules/tar/test/dir-normalization.js generated vendored Normal file
View File

@ -0,0 +1,177 @@
// Set the umask, so that it works the same everywhere.
process.umask(parseInt('22', 8))
var fs = require('fs')
var path = require('path')
var fstream = require('fstream')
var test = require('tap').test
var tar = require('../tar.js')
var file = path.resolve(__dirname, 'dir-normalization.tar')
var target = path.resolve(__dirname, 'tmp/dir-normalization-test')
var ee = 0
var expectEntries = [
{ path: 'fixtures/',
mode: '755',
type: '5',
linkpath: ''
},
{ path: 'fixtures/a/',
mode: '755',
type: '5',
linkpath: ''
},
{ path: 'fixtures/the-chumbler',
mode: '755',
type: '2',
linkpath: path.resolve(target, 'a/b/c/d/the-chumbler'),
},
{ path: 'fixtures/a/b/',
mode: '755',
type: '5',
linkpath: ''
},
{ path: 'fixtures/a/x',
mode: '644',
type: '0',
linkpath: ''
},
{ path: 'fixtures/a/b/c/',
mode: '755',
type: '5',
linkpath: ''
},
{ path: 'fixtures/a/b/c/y',
mode: '755',
type: '2',
linkpath: '../../x',
}
]
var ef = 0
var expectFiles = [
{ path: '',
mode: '40755',
type: 'Directory',
depth: 0,
linkpath: undefined
},
{ path: '/fixtures',
mode: '40755',
type: 'Directory',
depth: 1,
linkpath: undefined
},
{ path: '/fixtures/a',
mode: '40755',
type: 'Directory',
depth: 2,
linkpath: undefined
},
{ path: '/fixtures/a/b',
mode: '40755',
type: 'Directory',
depth: 3,
linkpath: undefined
},
{ path: '/fixtures/a/b/c',
mode: '40755',
type: 'Directory',
depth: 4,
linkpath: undefined
},
{ path: '/fixtures/a/b/c/y',
mode: '120755',
type: 'SymbolicLink',
depth: 5,
linkpath: '../../x'
},
{ path: '/fixtures/a/x',
mode: '100644',
type: 'File',
depth: 3,
linkpath: undefined
},
{ path: '/fixtures/the-chumbler',
mode: '120755',
type: 'SymbolicLink',
depth: 2,
linkpath: path.resolve(target, 'a/b/c/d/the-chumbler')
}
]
test('preclean', function (t) {
require('rimraf').sync(path.join(__dirname, '/tmp/dir-normalization-test'))
t.pass('cleaned!')
t.end()
})
test('extract test', function (t) {
var extract = tar.Extract(target)
var inp = fs.createReadStream(file)
inp.pipe(extract)
extract.on('end', function () {
t.equal(ee, expectEntries.length, 'should see ' + expectEntries.length + ' entries')
// should get no more entries after end
extract.removeAllListeners('entry')
extract.on('entry', function (e) {
t.fail('Should not get entries after end!')
})
next()
})
extract.on('entry', function (entry) {
var mode = entry.props.mode & (~parseInt('22', 8))
var found = {
path: entry.path,
mode: mode.toString(8),
type: entry.props.type,
linkpath: entry.props.linkpath,
}
var wanted = expectEntries[ee++]
t.equivalent(found, wanted, 'tar entry ' + ee + ' ' + (wanted && wanted.path))
})
function next () {
var r = fstream.Reader({
path: target,
type: 'Directory',
sort: 'alpha'
})
r.on('ready', function () {
foundEntry(r)
})
r.on('end', finish)
function foundEntry (entry) {
var p = entry.path.substr(target.length)
var mode = entry.props.mode & (~parseInt('22', 8))
var found = {
path: p,
mode: mode.toString(8),
type: entry.props.type,
depth: entry.props.depth,
linkpath: entry.props.linkpath
}
var wanted = expectFiles[ef++]
t.equivalent(found, wanted, 'unpacked file ' + ef + ' ' + (wanted && wanted.path))
entry.on('entry', foundEntry)
}
function finish () {
t.equal(ef, expectFiles.length, 'should have ' + ef + ' items')
t.end()
}
}
})

BIN
node_modules/tar/test/dir-normalization.tar generated vendored Normal file

Binary file not shown.

33
node_modules/tar/test/error-on-broken.js generated vendored Normal file
View File

@ -0,0 +1,33 @@
var fs = require('fs')
var path = require('path')
var zlib = require('zlib')
var tap = require('tap')
var tar = require('../tar.js')
var file = path.join(__dirname, 'cb-never-called-1.0.1.tgz')
var target = path.join(__dirname, 'tmp/extract-test')
tap.test('preclean', function (t) {
require('rimraf').sync(__dirname + '/tmp/extract-test')
t.pass('cleaned!')
t.end()
})
tap.test('extract test', function (t) {
var extract = tar.Extract(target)
var inp = fs.createReadStream(file)
inp.pipe(zlib.createGunzip()).pipe(extract)
extract.on('error', function (er) {
t.equal(er.message, 'unexpected eof', 'error noticed')
t.end()
})
extract.on('end', function () {
t.fail('shouldn\'t reach this point due to errors')
t.end()
})
})

132
node_modules/tar/test/extract-move.js generated vendored Normal file
View File

@ -0,0 +1,132 @@
// Set the umask, so that it works the same everywhere.
process.umask(parseInt('22', 8))
var tap = require("tap")
, tar = require("../tar.js")
, fs = require("fs")
, gfs = require("graceful-fs")
, path = require("path")
, file = path.resolve(__dirname, "fixtures/dir.tar")
, target = path.resolve(__dirname, "tmp/extract-test")
, index = 0
, fstream = require("fstream")
, rimraf = require("rimraf")
, mkdirp = require("mkdirp")
, ee = 0
, expectEntries = [
{
"path" : "dir/",
"mode" : "750",
"type" : "5",
"depth" : undefined,
"size" : 0,
"linkpath" : "",
"nlink" : undefined,
"dev" : undefined,
"ino" : undefined
},
{
"path" : "dir/sub/",
"mode" : "750",
"type" : "5",
"depth" : undefined,
"size" : 0,
"linkpath" : "",
"nlink" : undefined,
"dev" : undefined,
"ino" : undefined
} ]
function slow (fs, method, t1, t2) {
var orig = fs[method]
if (!orig) return null
fs[method] = function () {
var args = [].slice.call(arguments)
console.error("slow", method, args[0])
var cb = args.pop()
setTimeout(function () {
orig.apply(fs, args.concat(function(er, data) {
setTimeout(function() {
cb(er, data)
}, t2)
}))
}, t1)
}
}
// Make sure we get the graceful-fs that fstream is using.
var gfs2
try {
gfs2 = require("fstream/node_modules/graceful-fs")
} catch (er) {}
var slowMethods = ["chown", "chmod", "utimes", "lutimes"]
slowMethods.forEach(function (method) {
var t1 = 500
var t2 = 0
slow(fs, method, t1, t2)
slow(gfs, method, t1, t2)
if (gfs2) {
slow(gfs2, method, t1, t2)
}
})
// The extract class basically just pipes the input
// to a Reader, and then to a fstream.DirWriter
// So, this is as much a test of fstream.Reader and fstream.Writer
// as it is of tar.Extract, but it sort of makes sense.
tap.test("preclean", function (t) {
rimraf.sync(target)
/mkdirp.sync(target)
t.pass("cleaned!")
t.end()
})
tap.test("extract test", function (t) {
var extract = tar.Extract(target)
var inp = fs.createReadStream(file)
// give it a weird buffer size to try to break in odd places
inp.bufferSize = 1234
inp.pipe(extract)
extract.on("end", function () {
rimraf.sync(target)
t.equal(ee, expectEntries.length, "should see "+ee+" entries")
// should get no more entries after end
extract.removeAllListeners("entry")
extract.on("entry", function (e) {
t.fail("Should not get entries after end!")
})
t.end()
})
extract.on("entry", function (entry) {
var found =
{ path: entry.path
, mode: entry.props.mode.toString(8)
, type: entry.props.type
, depth: entry.props.depth
, size: entry.props.size
, linkpath: entry.props.linkpath
, nlink: entry.props.nlink
, dev: entry.props.dev
, ino: entry.props.ino
}
var wanted = expectEntries[ee ++]
t.equivalent(found, wanted, "tar entry " + ee + " " + wanted.path)
})
})

367
node_modules/tar/test/extract.js generated vendored Normal file
View File

@ -0,0 +1,367 @@
// Set the umask, so that it works the same everywhere.
process.umask(parseInt('22', 8))
var tap = require("tap")
, tar = require("../tar.js")
, fs = require("fs")
, path = require("path")
, file = path.resolve(__dirname, "fixtures/c.tar")
, target = path.resolve(__dirname, "tmp/extract-test")
, index = 0
, fstream = require("fstream")
, ee = 0
, expectEntries =
[ { path: 'c.txt',
mode: '644',
type: '0',
depth: undefined,
size: 513,
linkpath: '',
nlink: undefined,
dev: undefined,
ino: undefined },
{ path: 'cc.txt',
mode: '644',
type: '0',
depth: undefined,
size: 513,
linkpath: '',
nlink: undefined,
dev: undefined,
ino: undefined },
{ path: 'r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: '644',
type: '0',
depth: undefined,
size: 100,
linkpath: '',
nlink: undefined,
dev: undefined,
ino: undefined },
{ path: 'Ω.txt',
mode: '644',
type: '0',
depth: undefined,
size: 2,
linkpath: '',
nlink: undefined,
dev: undefined,
ino: undefined },
{ path: 'Ω.txt',
mode: '644',
type: '0',
depth: undefined,
size: 2,
linkpath: '',
nlink: 1,
dev: 234881026,
ino: 51693379 },
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: '644',
type: '0',
depth: undefined,
size: 200,
linkpath: '',
nlink: 1,
dev: 234881026,
ino: 51681874 },
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: '644',
type: '0',
depth: undefined,
size: 201,
linkpath: '',
nlink: undefined,
dev: undefined,
ino: undefined },
{ path: '200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL',
mode: '777',
type: '2',
depth: undefined,
size: 0,
linkpath: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
nlink: undefined,
dev: undefined,
ino: undefined },
{ path: '200-hard',
mode: '644',
type: '0',
depth: undefined,
size: 200,
linkpath: '',
nlink: 2,
dev: 234881026,
ino: 51681874 },
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: '644',
type: '1',
depth: undefined,
size: 0,
linkpath: path.resolve(target, '200-hard'),
nlink: 2,
dev: 234881026,
ino: 51681874 } ]
, ef = 0
, expectFiles =
[ { path: '',
mode: '40755',
type: 'Directory',
depth: 0,
linkpath: undefined },
{ path: '/200-hard',
mode: '100644',
type: 'File',
depth: 1,
size: 200,
linkpath: undefined,
nlink: 2 },
{ path: '/200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL',
mode: '120777',
type: 'SymbolicLink',
depth: 1,
size: 200,
linkpath: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
nlink: 1 },
{ path: '/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: '100644',
type: 'Link',
depth: 1,
size: 200,
linkpath: path.join(target, '200-hard'),
nlink: 2 },
{ path: '/c.txt',
mode: '100644',
type: 'File',
depth: 1,
size: 513,
linkpath: undefined,
nlink: 1 },
{ path: '/cc.txt',
mode: '100644',
type: 'File',
depth: 1,
size: 513,
linkpath: undefined,
nlink: 1 },
{ path: '/r',
mode: '40755',
type: 'Directory',
depth: 1,
linkpath: undefined },
{ path: '/r/e',
mode: '40755',
type: 'Directory',
depth: 2,
linkpath: undefined },
{ path: '/r/e/a',
mode: '40755',
type: 'Directory',
depth: 3,
linkpath: undefined },
{ path: '/r/e/a/l',
mode: '40755',
type: 'Directory',
depth: 4,
linkpath: undefined },
{ path: '/r/e/a/l/l',
mode: '40755',
type: 'Directory',
depth: 5,
linkpath: undefined },
{ path: '/r/e/a/l/l/y',
mode: '40755',
type: 'Directory',
depth: 6,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-',
mode: '40755',
type: 'Directory',
depth: 7,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-/d',
mode: '40755',
type: 'Directory',
depth: 8,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-/d/e',
mode: '40755',
type: 'Directory',
depth: 9,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-/d/e/e',
mode: '40755',
type: 'Directory',
depth: 10,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-/d/e/e/p',
mode: '40755',
type: 'Directory',
depth: 11,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-',
mode: '40755',
type: 'Directory',
depth: 12,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f',
mode: '40755',
type: 'Directory',
depth: 13,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o',
mode: '40755',
type: 'Directory',
depth: 14,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l',
mode: '40755',
type: 'Directory',
depth: 15,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d',
mode: '40755',
type: 'Directory',
depth: 16,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e',
mode: '40755',
type: 'Directory',
depth: 17,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r',
mode: '40755',
type: 'Directory',
depth: 18,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-',
mode: '40755',
type: 'Directory',
depth: 19,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p',
mode: '40755',
type: 'Directory',
depth: 20,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a',
mode: '40755',
type: 'Directory',
depth: 21,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t',
mode: '40755',
type: 'Directory',
depth: 22,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h',
mode: '40755',
type: 'Directory',
depth: 23,
linkpath: undefined },
{ path: '/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: '100644',
type: 'File',
depth: 24,
size: 100,
linkpath: undefined,
nlink: 1 },
{ path: '/Ω.txt',
mode: '100644',
type: 'File',
depth: 1,
size: 2,
linkpath: undefined,
nlink: 1 } ]
// The extract class basically just pipes the input
// to a Reader, and then to a fstream.DirWriter
// So, this is as much a test of fstream.Reader and fstream.Writer
// as it is of tar.Extract, but it sort of makes sense.
tap.test("preclean", function (t) {
require("rimraf").sync(__dirname + "/tmp/extract-test")
t.pass("cleaned!")
t.end()
})
tap.test("extract test", function (t) {
var extract = tar.Extract(target)
var inp = fs.createReadStream(file)
// give it a weird buffer size to try to break in odd places
inp.bufferSize = 1234
inp.pipe(extract)
extract.on("end", function () {
t.equal(ee, expectEntries.length, "should see "+ee+" entries")
// should get no more entries after end
extract.removeAllListeners("entry")
extract.on("entry", function (e) {
t.fail("Should not get entries after end!")
})
next()
})
extract.on("entry", function (entry) {
var found =
{ path: entry.path
, mode: entry.props.mode.toString(8)
, type: entry.props.type
, depth: entry.props.depth
, size: entry.props.size
, linkpath: entry.props.linkpath
, nlink: entry.props.nlink
, dev: entry.props.dev
, ino: entry.props.ino
}
var wanted = expectEntries[ee ++]
t.equivalent(found, wanted, "tar entry " + ee + " " + wanted.path)
})
function next () {
var r = fstream.Reader({ path: target
, type: "Directory"
// this is just to encourage consistency
, sort: "alpha" })
r.on("ready", function () {
foundEntry(r)
})
r.on("end", finish)
function foundEntry (entry) {
var p = entry.path.substr(target.length)
var found =
{ path: p
, mode: entry.props.mode.toString(8)
, type: entry.props.type
, depth: entry.props.depth
, size: entry.props.size
, linkpath: entry.props.linkpath
, nlink: entry.props.nlink
}
var wanted = expectFiles[ef ++]
t.has(found, wanted, "unpacked file " + ef + " " + wanted.path)
entry.on("entry", foundEntry)
}
function finish () {
t.equal(ef, expectFiles.length, "should have "+ef+" items")
t.end()
}
}
})

BIN
node_modules/tar/test/fixtures.tgz generated vendored Normal file

Binary file not shown.

183
node_modules/tar/test/header.js generated vendored Normal file
View File

@ -0,0 +1,183 @@
var tap = require("tap")
var TarHeader = require("../lib/header.js")
var tar = require("../tar.js")
var fs = require("fs")
var headers =
{ "a.txt file header":
[ "612e747874000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030303430312031313635313336303333332030313234353100203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
, { cksumValid: true
, path: 'a.txt'
, mode: 420
, uid: 24561
, gid: 20
, size: 257
, mtime: 1319493851
, cksum: 5417
, type: '0'
, linkpath: ''
, ustar: 'ustar\0'
, ustarver: '00'
, uname: 'isaacs'
, gname: 'staff'
, devmaj: 0
, devmin: 0
, fill: '' }
]
, "omega pax": // the extended header from omega tar.
[ "5061784865616465722fcea92e74787400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030303137302031313534333731303631312030313530353100207800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
, { cksumValid: true
, path: 'PaxHeader/Ω.txt'
, mode: 420
, uid: 24561
, gid: 20
, size: 120
, mtime: 1301254537
, cksum: 6697
, type: 'x'
, linkpath: ''
, ustar: 'ustar\0'
, ustarver: '00'
, uname: 'isaacs'
, gname: 'staff'
, devmaj: 0
, devmin: 0
, fill: '' } ]
, "omega file header":
[ "cea92e7478740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030303030322031313534333731303631312030313330373200203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
, { cksumValid: true
, path: 'Ω.txt'
, mode: 420
, uid: 24561
, gid: 20
, size: 2
, mtime: 1301254537
, cksum: 5690
, type: '0'
, linkpath: ''
, ustar: 'ustar\0'
, ustarver: '00'
, uname: 'isaacs'
, gname: 'staff'
, devmaj: 0
, devmin: 0
, fill: '' } ]
, "foo.js file header":
[ "666f6f2e6a730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030303030342031313534333637303734312030313236313700203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
, { cksumValid: true
, path: 'foo.js'
, mode: 420
, uid: 24561
, gid: 20
, size: 4
, mtime: 1301246433
, cksum: 5519
, type: '0'
, linkpath: ''
, ustar: 'ustar\0'
, ustarver: '00'
, uname: 'isaacs'
, gname: 'staff'
, devmaj: 0
, devmin: 0
, fill: '' }
]
, "b.txt file header":
[ "622e747874000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030303036343420003035373736312000303030303234200030303030303030313030302031313635313336303637372030313234363100203000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
, { cksumValid: true
, path: 'b.txt'
, mode: 420
, uid: 24561
, gid: 20
, size: 512
, mtime: 1319494079
, cksum: 5425
, type: '0'
, linkpath: ''
, ustar: 'ustar\0'
, ustarver: '00'
, uname: 'isaacs'
, gname: 'staff'
, devmaj: 0
, devmin: 0
, fill: '' }
]
, "deep nested file":
[ "636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363633030303634342000303537373631200030303030323420003030303030303030313434203131363532313531353333203034333331340020300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000075737461720030306973616163730000000000000000000000000000000000000000000000000000737461666600000000000000000000000000000000000000000000000000000030303030303020003030303030302000722f652f612f6c2f6c2f792f2d2f642f652f652f702f2d2f662f6f2f6c2f642f652f722f2d2f702f612f742f680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
, { cksumValid: true,
path: 'r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'
, mode: 420
, uid: 24561
, gid: 20
, size: 100
, mtime: 1319687003
, cksum: 18124
, type: '0'
, linkpath: ''
, ustar: 'ustar\0'
, ustarver: '00'
, uname: 'isaacs'
, gname: 'staff'
, devmaj: 0
, devmin: 0
, fill: '' }
]
}
tap.test("parsing", function (t) {
Object.keys(headers).forEach(function (name) {
var h = headers[name]
, header = new Buffer(h[0], "hex")
, expect = h[1]
, parsed = new TarHeader(header)
// console.error(parsed)
t.has(parsed, expect, "parse " + name)
})
t.end()
})
tap.test("encoding", function (t) {
Object.keys(headers).forEach(function (name) {
var h = headers[name]
, expect = new Buffer(h[0], "hex")
, encoded = TarHeader.encode(h[1])
// might have slightly different bytes, since the standard
// isn't very strict, but should have the same semantics
// checkSum will be different, but cksumValid will be true
var th = new TarHeader(encoded)
delete h[1].block
delete h[1].needExtended
delete h[1].cksum
t.has(th, h[1], "fields "+name)
})
t.end()
})
// test these manually. they're a bit rare to find in the wild
tap.test("parseNumeric tests", function (t) {
var parseNumeric = TarHeader.parseNumeric
, numbers =
{ "303737373737373700": 2097151
, "30373737373737373737373700": 8589934591
, "303030303036343400": 420
, "800000ffffffffffff": 281474976710655
, "ffffff000000000001": -281474976710654
, "ffffff000000000000": -281474976710655
, "800000000000200000": 2097152
, "8000000000001544c5": 1393861
, "ffffffffffff1544c5": -15383354 }
Object.keys(numbers).forEach(function (n) {
var b = new Buffer(n, "hex")
t.equal(parseNumeric(b), numbers[n], n + " === " + numbers[n])
})
t.end()
})

39
node_modules/tar/test/link-file-entry-collision.js generated vendored Normal file
View File

@ -0,0 +1,39 @@
// Set the umask, so that it works the same everywhere.
process.umask(parseInt('22', 8))
var tap = require("tap")
, tar = require("../tar.js")
, fs = require("fs")
, path = require("path")
, file = path.resolve(__dirname, "link-file-entry-collision/bad-link.tar")
, target = path.resolve(__dirname, "tmp/link-file-entry-collision")
, index = 0
, fstream = require("fstream")
, mkdirp = require("mkdirp")
, rimraf = require("rimraf")
tap.test("preclean", function (t) {
rimraf.sync(target)
t.pass("cleaned!")
t.end()
})
tap.test("extract test", function (t) {
var extract = tar.Extract(target)
var inp = fs.createReadStream(file)
inp.pipe(extract)
extract.on("end", function () {
t.equal(fs.readFileSync(target + "/bad-link-target", "utf8"),
"this should remain the same\n")
t.equal(fs.readFileSync(target + "/a.txt", "utf8"),
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
t.end()
})
})
tap.test("cleanup", function (t) {
rimraf.sync(target)
t.pass("cleaned!")
t.end()
})

View File

@ -0,0 +1,25 @@
-- header for the link target --
6261642d6c696e6b2d74617267657400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000303030363434200030303037363520003030303032342000303030303030303030333420313334363636353530353620303134333731002030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # bad-link-target.....................................................................................000644..000765..000024..00000000034.13466655056.014371..0...................................................................................................
00757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # .ustar.00isaacs..........................staff...........................000000..000000.........................................................................................................................................................................
-- link target file contents (should not be overwritten) --
746869732073686f756c642072656d61696e207468652073616d650a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # this.should.remain.the.same.....................................................................................................................................................................................................................................
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # ................................................................................................................................................................................................................................................................
-- header for the link named a.txt --
612e74787400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003030303634342000303030373635200030303030323420003030303030303030303030203133343636363535303536203031353334320020316261642d6c696e6b2d746172676574000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # a.txt...............................................................................................000644..000765..000024..00000000000.13466655056.015342..1bad-link-target....................................................................................
00757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # .ustar.00isaacs..........................staff...........................000000..000000.........................................................................................................................................................................
-- header for file entry which attempts to overwrite the link --
612e7478740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000303030363434200030353737363120003030303032342000303030303030303034303120313136353133363033333320303132343531002030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # a.txt...............................................................................................000644..057761..000024..00000000401.11651360333.012451..0...................................................................................................
00757374617200303069736161637300000000000000000000000000000000000000000000000000007374616666000000000000000000000000000000000000000000000000000000303030303030200030303030303020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # .ustar.00isaacs..........................staff...........................000000..000000.........................................................................................................................................................................
-- contents that threaten to overwrite the link target --
61616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161 # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
61000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # a...............................................................................................................................................................................................................................................................
-- tar eof --
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # ................................................................................................................................................................................................................................................................
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # ................................................................................................................................................................................................................................................................
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # ................................................................................................................................................................................................................................................................
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # ................................................................................................................................................................................................................................................................

Binary file not shown.

886
node_modules/tar/test/pack-no-proprietary.js generated vendored Normal file
View File

@ -0,0 +1,886 @@
// This is exactly like test/pack.js, except that it's excluding
// any proprietary headers.
//
// This loses some information about the filesystem, but creates
// tarballs that are supported by more versions of tar, especially
// old non-spec-compliant copies of gnutar.
// the symlink file is excluded from git, because it makes
// windows freak the hell out.
var fs = require("fs")
, path = require("path")
, symlink = path.resolve(__dirname, "fixtures/symlink")
try { fs.unlinkSync(symlink) } catch (e) {}
fs.symlinkSync("./hardlink-1", symlink)
process.on("exit", function () {
fs.unlinkSync(symlink)
})
var tap = require("tap")
, tar = require("../tar.js")
, pkg = require("../package.json")
, Pack = tar.Pack
, fstream = require("fstream")
, Reader = fstream.Reader
, Writer = fstream.Writer
, input = path.resolve(__dirname, "fixtures/")
, target = path.resolve(__dirname, "tmp/pack.tar")
, uid = process.getuid ? process.getuid() : 0
, gid = process.getgid ? process.getgid() : 0
, entries =
// the global header and root fixtures/ dir are going to get
// a different date each time, so omit that bit.
// Also, dev/ino values differ across machines, so that's not
// included.
[ [ 'entry',
{ path: 'fixtures/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'extendedHeader',
{ path: 'PaxHeader/fixtures/200cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: 420,
uid: uid,
gid: gid,
type: 'x',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' },
{ path: 'fixtures/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
uid: uid,
gid: gid,
size: 200 } ]
, [ 'entry',
{ path: 'fixtures/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: 420,
uid: uid,
gid: gid,
size: 200,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/a.txt',
mode: 420,
uid: uid,
gid: gid,
size: 257,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/b.txt',
mode: 420,
uid: uid,
gid: gid,
size: 512,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/c.txt',
mode: 420,
uid: uid,
gid: gid,
size: 513,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/cc.txt',
mode: 420,
uid: uid,
gid: gid,
size: 513,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/dir/',
mode: 488,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/dir/sub/',
mode: 488,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/foo.js',
mode: 420,
uid: uid,
gid: gid,
size: 4,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/hardlink-1',
mode: 420,
uid: uid,
gid: gid,
size: 200,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/hardlink-2',
mode: 420,
uid: uid,
gid: gid,
size: 0,
type: '1',
linkpath: 'fixtures/hardlink-1',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/omega.txt',
mode: 420,
uid: uid,
gid: gid,
size: 2,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/packtest/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/packtest/omega.txt',
mode: 420,
uid: uid,
gid: gid,
size: 2,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/packtest/star.4.html',
mode: 420,
uid: uid,
gid: gid,
size: 54081,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'extendedHeader',
{ path: 'PaxHeader/fixtures/packtest/Ω.txt',
mode: 420,
uid: uid,
gid: gid,
type: 'x',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' },
{ path: 'fixtures/packtest/Ω.txt',
uid: uid,
gid: gid,
size: 2 } ]
, [ 'entry',
{ path: 'fixtures/packtest/Ω.txt',
mode: 420,
uid: uid,
gid: gid,
size: 2,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: 420,
uid: uid,
gid: gid,
size: 100,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/symlink',
uid: uid,
gid: gid,
size: 0,
type: '2',
linkpath: 'hardlink-1',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'extendedHeader',
{ path: 'PaxHeader/fixtures/Ω.txt',
mode: 420,
uid: uid,
gid: gid,
type: 'x',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' },
{ path: "fixtures/Ω.txt"
, uid: uid
, gid: gid
, size: 2 } ]
, [ 'entry',
{ path: 'fixtures/Ω.txt',
mode: 420,
uid: uid,
gid: gid,
size: 2,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
]
// first, make sure that the hardlinks are actually hardlinks, or this
// won't work. Git has a way of replacing them with a copy.
var hard1 = path.resolve(__dirname, "fixtures/hardlink-1")
, hard2 = path.resolve(__dirname, "fixtures/hardlink-2")
, fs = require("fs")
try { fs.unlinkSync(hard2) } catch (e) {}
fs.linkSync(hard1, hard2)
tap.test("with global header", { timeout: 10000 }, function (t) {
runTest(t, true)
})
tap.test("without global header", { timeout: 10000 }, function (t) {
runTest(t, false)
})
function alphasort (a, b) {
return a === b ? 0
: a.toLowerCase() > b.toLowerCase() ? 1
: a.toLowerCase() < b.toLowerCase() ? -1
: a > b ? 1
: -1
}
function runTest (t, doGH) {
var reader = Reader({ path: input
, filter: function () {
return !this.path.match(/\.(tar|hex)$/)
}
, sort: alphasort
})
var props = doGH ? pkg : {}
props.noProprietary = true
var pack = Pack(props)
var writer = Writer(target)
// global header should be skipped regardless, since it has no content.
var entry = 0
t.ok(reader, "reader ok")
t.ok(pack, "pack ok")
t.ok(writer, "writer ok")
pack.pipe(writer)
var parse = tar.Parse()
t.ok(parse, "parser should be ok")
pack.on("data", function (c) {
// console.error("PACK DATA")
if (c.length !== 512) {
// this one is too noisy, only assert if it'll be relevant
t.equal(c.length, 512, "parser should emit data in 512byte blocks")
}
parse.write(c)
})
pack.on("end", function () {
// console.error("PACK END")
t.pass("parser ends")
parse.end()
})
pack.on("error", function (er) {
t.fail("pack error", er)
})
parse.on("error", function (er) {
t.fail("parse error", er)
})
writer.on("error", function (er) {
t.fail("writer error", er)
})
reader.on("error", function (er) {
t.fail("reader error", er)
})
parse.on("*", function (ev, e) {
var wanted = entries[entry++]
if (!wanted) {
t.fail("unexpected event: "+ev)
return
}
t.equal(ev, wanted[0], "event type should be "+wanted[0])
if (ev !== wanted[0] || e.path !== wanted[1].path) {
console.error("wanted", wanted)
console.error([ev, e.props])
e.on("end", function () {
console.error(e.fields)
throw "break"
})
}
t.has(e.props, wanted[1], "properties "+wanted[1].path)
if (wanted[2]) {
e.on("end", function () {
if (!e.fields) {
t.ok(e.fields, "should get fields")
} else {
t.has(e.fields, wanted[2], "should get expected fields")
}
})
}
})
reader.pipe(pack)
writer.on("close", function () {
t.equal(entry, entries.length, "should get all expected entries")
t.pass("it finished")
t.end()
})
}

952
node_modules/tar/test/pack.js generated vendored Normal file
View File

@ -0,0 +1,952 @@
// the symlink file is excluded from git, because it makes
// windows freak the hell out.
var fs = require("fs")
, path = require("path")
, symlink = path.resolve(__dirname, "fixtures/symlink")
try { fs.unlinkSync(symlink) } catch (e) {}
fs.symlinkSync("./hardlink-1", symlink)
process.on("exit", function () {
fs.unlinkSync(symlink)
})
var tap = require("tap")
, tar = require("../tar.js")
, pkg = require("../package.json")
, Pack = tar.Pack
, fstream = require("fstream")
, Reader = fstream.Reader
, Writer = fstream.Writer
, input = path.resolve(__dirname, "fixtures/")
, target = path.resolve(__dirname, "tmp/pack.tar")
, uid = process.getuid ? process.getuid() : 0
, gid = process.getgid ? process.getgid() : 0
, entries =
// the global header and root fixtures/ dir are going to get
// a different date each time, so omit that bit.
// Also, dev/ino values differ across machines, so that's not
// included.
[ [ 'globalExtendedHeader',
{ path: 'PaxHeader/',
mode: 438,
uid: 0,
gid: 0,
type: 'g',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' },
{ "NODETAR.author": pkg.author,
"NODETAR.name": pkg.name,
"NODETAR.description": pkg.description,
"NODETAR.version": pkg.version,
"NODETAR.repository.type": pkg.repository.type,
"NODETAR.repository.url": pkg.repository.url,
"NODETAR.main": pkg.main,
"NODETAR.scripts.test": pkg.scripts.test } ]
, [ 'entry',
{ path: 'fixtures/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'extendedHeader',
{ path: 'PaxHeader/fixtures/200cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: 420,
uid: uid,
gid: gid,
type: 'x',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' },
{ path: 'fixtures/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
'NODETAR.depth': '1',
'NODETAR.type': 'File',
nlink: 1,
uid: uid,
gid: gid,
size: 200,
'NODETAR.blksize': '4096',
'NODETAR.blocks': '8' } ]
, [ 'entry',
{ path: 'fixtures/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: 420,
uid: uid,
gid: gid,
size: 200,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '',
'NODETAR.depth': '1',
'NODETAR.type': 'File',
nlink: 1,
'NODETAR.blksize': '4096',
'NODETAR.blocks': '8' } ]
, [ 'entry',
{ path: 'fixtures/a.txt',
mode: 420,
uid: uid,
gid: gid,
size: 257,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/b.txt',
mode: 420,
uid: uid,
gid: gid,
size: 512,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/c.txt',
mode: 420,
uid: uid,
gid: gid,
size: 513,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/cc.txt',
mode: 420,
uid: uid,
gid: gid,
size: 513,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/dir/',
mode: 488,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/dir/sub/',
mode: 488,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/foo.js',
mode: 420,
uid: uid,
gid: gid,
size: 4,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/hardlink-1',
mode: 420,
uid: uid,
gid: gid,
size: 200,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/hardlink-2',
mode: 420,
uid: uid,
gid: gid,
size: 0,
type: '1',
linkpath: 'fixtures/hardlink-1',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/omega.txt',
mode: 420,
uid: uid,
gid: gid,
size: 2,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/packtest/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/packtest/omega.txt',
mode: 420,
uid: uid,
gid: gid,
size: 2,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/packtest/star.4.html',
mode: 420,
uid: uid,
gid: gid,
size: 54081,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'extendedHeader',
{ path: 'PaxHeader/fixtures/packtest/Ω.txt',
mode: 420,
uid: uid,
gid: gid,
type: 'x',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' },
{ path: 'fixtures/packtest/Ω.txt',
'NODETAR.depth': '2',
'NODETAR.type': 'File',
nlink: 1,
uid: uid,
gid: gid,
size: 2,
'NODETAR.blksize': '4096',
'NODETAR.blocks': '8' } ]
, [ 'entry',
{ path: 'fixtures/packtest/Ω.txt',
mode: 420,
uid: uid,
gid: gid,
size: 2,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '',
'NODETAR.depth': '2',
'NODETAR.type': 'File',
nlink: 1,
'NODETAR.blksize': '4096',
'NODETAR.blocks': '8' } ]
, [ 'entry',
{ path: 'fixtures/r/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/',
mode: 493,
uid: uid,
gid: gid,
size: 0,
type: '5',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: 420,
uid: uid,
gid: gid,
size: 100,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'entry',
{ path: 'fixtures/symlink',
uid: uid,
gid: gid,
size: 0,
type: '2',
linkpath: 'hardlink-1',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' } ]
, [ 'extendedHeader',
{ path: 'PaxHeader/fixtures/Ω.txt',
mode: 420,
uid: uid,
gid: gid,
type: 'x',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '' },
{ path: "fixtures/Ω.txt"
, "NODETAR.depth": "1"
, "NODETAR.type": "File"
, nlink: 1
, uid: uid
, gid: gid
, size: 2
, "NODETAR.blksize": "4096"
, "NODETAR.blocks": "8" } ]
, [ 'entry',
{ path: 'fixtures/Ω.txt',
mode: 420,
uid: uid,
gid: gid,
size: 2,
type: '0',
linkpath: '',
ustar: 'ustar\u0000',
ustarver: '00',
uname: '',
gname: '',
devmaj: 0,
devmin: 0,
fill: '',
'NODETAR.depth': '1',
'NODETAR.type': 'File',
nlink: 1,
'NODETAR.blksize': '4096',
'NODETAR.blocks': '8' } ]
]
// first, make sure that the hardlinks are actually hardlinks, or this
// won't work. Git has a way of replacing them with a copy.
var hard1 = path.resolve(__dirname, "fixtures/hardlink-1")
, hard2 = path.resolve(__dirname, "fixtures/hardlink-2")
, fs = require("fs")
try { fs.unlinkSync(hard2) } catch (e) {}
fs.linkSync(hard1, hard2)
tap.test("with global header", { timeout: 10000 }, function (t) {
runTest(t, true)
})
tap.test("without global header", { timeout: 10000 }, function (t) {
runTest(t, false)
})
tap.test("with from base", { timeout: 10000 }, function (t) {
runTest(t, true, true)
})
function alphasort (a, b) {
return a === b ? 0
: a.toLowerCase() > b.toLowerCase() ? 1
: a.toLowerCase() < b.toLowerCase() ? -1
: a > b ? 1
: -1
}
function runTest (t, doGH, doFromBase) {
var reader = Reader({ path: input
, filter: function () {
return !this.path.match(/\.(tar|hex)$/)
}
, sort: alphasort
})
var props = doGH ? pkg : {}
if(doFromBase) props.fromBase = true;
var pack = Pack(props)
var writer = Writer(target)
// skip the global header if we're not doing that.
var entry = doGH ? 0 : 1
t.ok(reader, "reader ok")
t.ok(pack, "pack ok")
t.ok(writer, "writer ok")
pack.pipe(writer)
var parse = tar.Parse()
t.ok(parse, "parser should be ok")
pack.on("data", function (c) {
// console.error("PACK DATA")
if (c.length !== 512) {
// this one is too noisy, only assert if it'll be relevant
t.equal(c.length, 512, "parser should emit data in 512byte blocks")
}
parse.write(c)
})
pack.on("end", function () {
// console.error("PACK END")
t.pass("parser ends")
parse.end()
})
pack.on("error", function (er) {
t.fail("pack error", er)
})
parse.on("error", function (er) {
t.fail("parse error", er)
})
writer.on("error", function (er) {
t.fail("writer error", er)
})
reader.on("error", function (er) {
t.fail("reader error", er)
})
parse.on("*", function (ev, e) {
var wanted = entries[entry++]
if (!wanted) {
t.fail("unexpected event: "+ev)
return
}
t.equal(ev, wanted[0], "event type should be "+wanted[0])
if(doFromBase) {
if(wanted[1].path.indexOf('fixtures/') && wanted[1].path.length == 100)
wanted[1].path = wanted[1].path.replace('fixtures/', '') + 'ccccccccc'
if(wanted[1]) wanted[1].path = wanted[1].path.replace('fixtures/', '').replace('//', '/')
if(wanted[1].path == '') wanted[1].path = '/'
if(wanted[2] && wanted[2].path) wanted[2].path = wanted[2].path.replace('fixtures', '').replace(/^\//, '')
wanted[1].linkpath = wanted[1].linkpath.replace('fixtures/', '')
}
if (ev !== wanted[0] || e.path !== wanted[1].path) {
console.error("wanted", wanted)
console.error([ev, e.props])
e.on("end", function () {
console.error(e.fields)
throw "break"
})
}
t.has(e.props, wanted[1], "properties "+wanted[1].path)
if (wanted[2]) {
e.on("end", function () {
if (!e.fields) {
t.ok(e.fields, "should get fields")
} else {
t.has(e.fields, wanted[2], "should get expected fields")
}
})
}
})
reader.pipe(pack)
writer.on("close", function () {
t.equal(entry, entries.length, "should get all expected entries")
t.pass("it finished")
t.end()
})
}

29
node_modules/tar/test/parse-discard.js generated vendored Normal file
View File

@ -0,0 +1,29 @@
var tap = require("tap")
, tar = require("../tar.js")
, fs = require("fs")
, path = require("path")
, file = path.resolve(__dirname, "fixtures/c.tar")
tap.test("parser test", function (t) {
var parser = tar.Parse()
var total = 0
var dataTotal = 0
parser.on("end", function () {
t.equals(total-513,dataTotal,'should have discarded only c.txt')
t.end()
})
fs.createReadStream(file)
.pipe(parser)
.on('entry',function(entry){
if(entry.path === 'c.txt') entry.abort()
total += entry.size;
entry.on('data',function(data){
dataTotal += data.length
})
})
})

359
node_modules/tar/test/parse.js generated vendored Normal file
View File

@ -0,0 +1,359 @@
var tap = require("tap")
, tar = require("../tar.js")
, fs = require("fs")
, path = require("path")
, file = path.resolve(__dirname, "fixtures/c.tar")
, index = 0
, expect =
[ [ 'entry',
{ path: 'c.txt',
mode: 420,
uid: 24561,
gid: 20,
size: 513,
mtime: new Date('Wed, 26 Oct 2011 01:10:58 GMT'),
cksum: 5422,
type: '0',
linkpath: '',
ustar: 'ustar\0',
ustarver: '00',
uname: 'isaacs',
gname: 'staff',
devmaj: 0,
devmin: 0,
fill: '' },
undefined ],
[ 'entry',
{ path: 'cc.txt',
mode: 420,
uid: 24561,
gid: 20,
size: 513,
mtime: new Date('Wed, 26 Oct 2011 01:11:02 GMT'),
cksum: 5525,
type: '0',
linkpath: '',
ustar: 'ustar\0',
ustarver: '00',
uname: 'isaacs',
gname: 'staff',
devmaj: 0,
devmin: 0,
fill: '' },
undefined ],
[ 'entry',
{ path: 'r/e/a/l/l/y/-/d/e/e/p/-/f/o/l/d/e/r/-/p/a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: 420,
uid: 24561,
gid: 20,
size: 100,
mtime: new Date('Thu, 27 Oct 2011 03:43:23 GMT'),
cksum: 18124,
type: '0',
linkpath: '',
ustar: 'ustar\0',
ustarver: '00',
uname: 'isaacs',
gname: 'staff',
devmaj: 0,
devmin: 0,
fill: '' },
undefined ],
[ 'entry',
{ path: 'Ω.txt',
mode: 420,
uid: 24561,
gid: 20,
size: 2,
mtime: new Date('Thu, 27 Oct 2011 17:51:49 GMT'),
cksum: 5695,
type: '0',
linkpath: '',
ustar: 'ustar\0',
ustarver: '00',
uname: 'isaacs',
gname: 'staff',
devmaj: 0,
devmin: 0,
fill: '' },
undefined ],
[ 'extendedHeader',
{ path: 'PaxHeader/Ω.txt',
mode: 420,
uid: 24561,
gid: 20,
size: 120,
mtime: new Date('Thu, 27 Oct 2011 17:51:49 GMT'),
cksum: 6702,
type: 'x',
linkpath: '',
ustar: 'ustar\0',
ustarver: '00',
uname: 'isaacs',
gname: 'staff',
devmaj: 0,
devmin: 0,
fill: '' },
{ path: 'Ω.txt',
ctime: 1319737909,
atime: 1319739061,
dev: 234881026,
ino: 51693379,
nlink: 1 } ],
[ 'entry',
{ path: 'Ω.txt',
mode: 420,
uid: 24561,
gid: 20,
size: 2,
mtime: new Date('Thu, 27 Oct 2011 17:51:49 GMT'),
cksum: 5695,
type: '0',
linkpath: '',
ustar: 'ustar\0',
ustarver: '00',
uname: 'isaacs',
gname: 'staff',
devmaj: 0,
devmin: 0,
fill: '',
ctime: new Date('Thu, 27 Oct 2011 17:51:49 GMT'),
atime: new Date('Thu, 27 Oct 2011 18:11:01 GMT'),
dev: 234881026,
ino: 51693379,
nlink: 1 },
undefined ],
[ 'extendedHeader',
{ path: 'PaxHeader/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: 420,
uid: 24561,
gid: 20,
size: 353,
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
cksum: 14488,
type: 'x',
linkpath: '',
ustar: 'ustar\0',
ustarver: '00',
uname: 'isaacs',
gname: 'staff',
devmaj: 0,
devmin: 0,
fill: '' },
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
ctime: 1319686868,
atime: 1319741254,
'LIBARCHIVE.creationtime': '1319686852',
dev: 234881026,
ino: 51681874,
nlink: 1 } ],
[ 'entry',
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: 420,
uid: 24561,
gid: 20,
size: 200,
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
cksum: 14570,
type: '0',
linkpath: '',
ustar: 'ustar\0',
ustarver: '00',
uname: 'isaacs',
gname: 'staff',
devmaj: 0,
devmin: 0,
fill: '',
ctime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
atime: new Date('Thu, 27 Oct 2011 18:47:34 GMT'),
'LIBARCHIVE.creationtime': '1319686852',
dev: 234881026,
ino: 51681874,
nlink: 1 },
undefined ],
[ 'longPath',
{ path: '././@LongLink',
mode: 0,
uid: 0,
gid: 0,
size: 201,
mtime: new Date('Thu, 01 Jan 1970 00:00:00 GMT'),
cksum: 4976,
type: 'L',
linkpath: '',
ustar: false },
'200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' ],
[ 'entry',
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: 420,
uid: 1000,
gid: 1000,
size: 201,
mtime: new Date('Thu, 27 Oct 2011 22:21:50 GMT'),
cksum: 14086,
type: '0',
linkpath: '',
ustar: false },
undefined ],
[ 'longLinkpath',
{ path: '././@LongLink',
mode: 0,
uid: 0,
gid: 0,
size: 201,
mtime: new Date('Thu, 01 Jan 1970 00:00:00 GMT'),
cksum: 4975,
type: 'K',
linkpath: '',
ustar: false },
'200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' ],
[ 'longPath',
{ path: '././@LongLink',
mode: 0,
uid: 0,
gid: 0,
size: 201,
mtime: new Date('Thu, 01 Jan 1970 00:00:00 GMT'),
cksum: 4976,
type: 'L',
linkpath: '',
ustar: false },
'200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL' ],
[ 'entry',
{ path: '200LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL',
mode: 511,
uid: 1000,
gid: 1000,
size: 0,
mtime: new Date('Fri, 28 Oct 2011 23:05:17 GMT'),
cksum: 21603,
type: '2',
linkpath: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
ustar: false },
undefined ],
[ 'extendedHeader',
{ path: 'PaxHeader/200-hard',
mode: 420,
uid: 24561,
gid: 20,
size: 143,
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
cksum: 6533,
type: 'x',
linkpath: '',
ustar: 'ustar\0',
ustarver: '00',
uname: 'isaacs',
gname: 'staff',
devmaj: 0,
devmin: 0,
fill: '' },
{ ctime: 1320617144,
atime: 1320617232,
'LIBARCHIVE.creationtime': '1319686852',
dev: 234881026,
ino: 51681874,
nlink: 2 } ],
[ 'entry',
{ path: '200-hard',
mode: 420,
uid: 24561,
gid: 20,
size: 200,
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
cksum: 5526,
type: '0',
linkpath: '',
ustar: 'ustar\0',
ustarver: '00',
uname: 'isaacs',
gname: 'staff',
devmaj: 0,
devmin: 0,
fill: '',
ctime: new Date('Sun, 06 Nov 2011 22:05:44 GMT'),
atime: new Date('Sun, 06 Nov 2011 22:07:12 GMT'),
'LIBARCHIVE.creationtime': '1319686852',
dev: 234881026,
ino: 51681874,
nlink: 2 },
undefined ],
[ 'extendedHeader',
{ path: 'PaxHeader/200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: 420,
uid: 24561,
gid: 20,
size: 353,
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
cksum: 14488,
type: 'x',
linkpath: '',
ustar: 'ustar\0',
ustarver: '00',
uname: 'isaacs',
gname: 'staff',
devmaj: 0,
devmin: 0,
fill: '' },
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
ctime: 1320617144,
atime: 1320617406,
'LIBARCHIVE.creationtime': '1319686852',
dev: 234881026,
ino: 51681874,
nlink: 2 } ],
[ 'entry',
{ path: '200ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc',
mode: 420,
uid: 24561,
gid: 20,
size: 0,
mtime: new Date('Thu, 27 Oct 2011 03:41:08 GMT'),
cksum: 15173,
type: '1',
linkpath: '200-hard',
ustar: 'ustar\0',
ustarver: '00',
uname: 'isaacs',
gname: 'staff',
devmaj: 0,
devmin: 0,
fill: '',
ctime: new Date('Sun, 06 Nov 2011 22:05:44 GMT'),
atime: new Date('Sun, 06 Nov 2011 22:10:06 GMT'),
'LIBARCHIVE.creationtime': '1319686852',
dev: 234881026,
ino: 51681874,
nlink: 2 },
undefined ] ]
tap.test("parser test", function (t) {
var parser = tar.Parse()
parser.on("end", function () {
t.equal(index, expect.length, "saw all expected events")
t.end()
})
fs.createReadStream(file)
.pipe(parser)
.on("*", function (ev, entry) {
var wanted = expect[index]
if (!wanted) {
return t.fail("Unexpected event: " + ev)
}
var result = [ev, entry.props]
entry.on("end", function () {
result.push(entry.fields || entry.body)
t.equal(ev, wanted[0], index + " event type")
t.equivalent(entry.props, wanted[1], wanted[1].path + " entry properties")
if (wanted[2]) {
t.equivalent(result[2], wanted[2], "metadata values")
}
index ++
})
})
})

20
node_modules/tar/test/zz-cleanup.js generated vendored Normal file
View File

@ -0,0 +1,20 @@
// clean up the fixtures
var tap = require("tap")
, rimraf = require("rimraf")
, test = tap.test
, path = require("path")
test("clean fixtures", function (t) {
rimraf(path.resolve(__dirname, "fixtures"), function (er) {
t.ifError(er, "rimraf ./fixtures/")
t.end()
})
})
test("clean tmp", function (t) {
rimraf(path.resolve(__dirname, "tmp"), function (er) {
t.ifError(er, "rimraf ./tmp/")
t.end()
})
})