presidium 4.0.9 → 4.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/internal/Archive.js +16 -8
- package/package.json +1 -1
package/internal/Archive.js
CHANGED
|
@@ -29,7 +29,7 @@ const Archive = {}
|
|
|
29
29
|
* * `ignore` - filepaths, filenames, or patterns to ignore.
|
|
30
30
|
*/
|
|
31
31
|
Archive.tar = function tar(path, options) {
|
|
32
|
-
|
|
32
|
+
path = path.endsWith('/') ? path : `${path}/`
|
|
33
33
|
const ignore = get(options, 'ignore')
|
|
34
34
|
const pack = tarStream.pack()
|
|
35
35
|
|
|
@@ -45,13 +45,21 @@ Archive.tar = function tar(path, options) {
|
|
|
45
45
|
}),
|
|
46
46
|
|
|
47
47
|
reduce(async (pack, filepath) => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
const stats = await pipe(filepath, [
|
|
49
|
+
fs.promises.stat,
|
|
50
|
+
pick(['size', 'mode', 'mtime', 'uid', 'gid']),
|
|
51
|
+
])
|
|
52
|
+
|
|
53
|
+
const entry = pack.entry({ ...stats, name: filepath.replace(path, '') })
|
|
54
|
+
|
|
55
|
+
const fileStream = fs.createReadStream(filepath)
|
|
56
|
+
|
|
57
|
+
fileStream.pipe(entry)
|
|
58
|
+
|
|
59
|
+
await new Promise(resolve => {
|
|
60
|
+
fileStream.on('end', resolve)
|
|
61
|
+
})
|
|
62
|
+
|
|
55
63
|
return pack
|
|
56
64
|
}, pack),
|
|
57
65
|
|