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.
@@ -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
- const pathWithSlash = path.endsWith('/') ? path : `${path}/`
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
- pack.entry({
49
- name: filepath.replace(pathWithSlash, ''),
50
- ...pipe([
51
- fs.promises.stat,
52
- pick(['size', 'mode', 'mtime', 'uid', 'gid']),
53
- ])(filepath),
54
- }, await fs.promises.readFile(filepath))
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "presidium",
3
- "version": "4.0.9",
3
+ "version": "4.0.10",
4
4
  "description": "The Presidium library.",
5
5
  "author": "Richard Tong",
6
6
  "license": "CFOSS",