presidium 4.0.8 → 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.
@@ -23,12 +23,6 @@ const getChromeUrl = require('./internal/getChromeUrl')
23
23
  const getAbsoluteFilePath = require('./internal/getAbsoluteFilePath')
24
24
  const getChromeBinaryOrExecutableFilePath = require('./internal/getChromeBinaryOrExecutableFilePath')
25
25
 
26
- function updateConsoleLog(message, platform) {
27
- readline.cursorTo(process.stdout, 0, undefined);
28
- readline.clearLine(process.stdout, 0);
29
- process.stdout.write(message);
30
- }
31
-
32
26
  async function installChrome() {
33
27
  const platform = getPlatform()
34
28
  const url = await getChromeUrl.call(this, platform)
@@ -53,9 +47,9 @@ async function installChrome() {
53
47
  response.on('data', chunk => {
54
48
  downloadedLength += chunk.length
55
49
  if (downloadedLength == contentLength) {
56
- updateConsoleLog(`Downloading ${url} (${downloadedLength} / ${contentLength} bytes)\n`, platform)
50
+ console.log(`Downloading ${url} (${downloadedLength} / ${contentLength} bytes)\n`, platform)
57
51
  } else {
58
- updateConsoleLog(`Downloading ${url} (${downloadedLength} / ${contentLength} bytes)`, platform)
52
+ console.log(`Downloading ${url} (${downloadedLength} / ${contentLength} bytes)`, platform)
59
53
  }
60
54
 
61
55
  fileStream.write(chunk)
@@ -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.8",
3
+ "version": "4.0.10",
4
4
  "description": "The Presidium library.",
5
5
  "author": "Richard Tong",
6
6
  "license": "CFOSS",