node-install-release 1.10.22 → 1.10.24

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.
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  var _crypto = /*#__PURE__*/ _interop_require_default(require("crypto"));
12
12
  var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
13
- var _endofstream = /*#__PURE__*/ _interop_require_default(require("end-of-stream"));
13
+ var _calloncefn = /*#__PURE__*/ _interop_require_default(require("call-once-fn"));
14
14
  var _getremote = /*#__PURE__*/ _interop_require_default(require("get-remote"));
15
15
  var _constants = require("../constants.cjs");
16
16
  function _interop_require_default(obj) {
@@ -27,14 +27,18 @@ function validateDownload(distPath, installPath, callback) {
27
27
  var filename = distPath.split('/').slice(1).join('/');
28
28
  var expected = text.split(filename)[0].split('\n').pop().trim();
29
29
  var hash = _crypto.default.createHash('sha256');
30
- var input = _fs.default.createReadStream(installPath);
31
- input.on('data', function(data) {
30
+ var stream = _fs.default.createReadStream(installPath);
31
+ stream.on('data', function(data) {
32
32
  return hash.update(data);
33
33
  });
34
- (0, _endofstream.default)(input, function(err) {
34
+ var end = (0, _calloncefn.default)(function(err) {
35
35
  if (err) return callback(err);
36
36
  hash.digest('hex') !== expected ? callback(new Error("".concat(filename, " checksum failed"))) : callback();
37
37
  });
38
+ stream.on('error', end);
39
+ stream.on('end', end);
40
+ stream.on('close', end);
41
+ stream.on('finish', end);
38
42
  });
39
43
  }
40
44
  /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/validateDownload.ts"],"sourcesContent":["import crypto from 'crypto';\nimport fs from 'fs';\nimport eos from 'end-of-stream';\nimport get from 'get-remote';\nimport { NODE_DIST_BASE_URL } from '../constants';\nexport default function validateDownload(distPath, installPath, callback) {\n const version = distPath.split('/')[0];\n const downloadPath = `${NODE_DIST_BASE_URL}/${version}/SHASUMS256.txt`;\n get(downloadPath).text((err, res) => {\n if (err) return callback(err);\n const text = res.body;\n const filename = distPath.split('/').slice(1).join('/');\n const expected = text.split(filename)[0].split('\\n').pop().trim();\n const hash = crypto.createHash('sha256');\n const input = fs.createReadStream(installPath);\n input.on('data', (data) => hash.update(data));\n eos(input, (err) => {\n if (err) return callback(err);\n hash.digest('hex') !== expected ? callback(new Error(`${filename} checksum failed`)) : callback();\n });\n });\n}\n"],"names":["validateDownload","distPath","installPath","callback","version","split","downloadPath","NODE_DIST_BASE_URL","get","text","err","res","body","filename","slice","join","expected","pop","trim","hash","crypto","createHash","input","fs","createReadStream","on","data","update","eos","digest","Error"],"mappings":";;;;+BAKA;;;eAAwBA;;;6DALL;yDACJ;kEACC;gEACA;yBACmB;;;;;;AACpB,SAASA,iBAAiBC,QAAQ,EAAEC,WAAW,EAAEC,QAAQ;IACtE,IAAMC,UAAUH,SAASI,KAAK,CAAC,IAAI,CAAC,EAAE;IACtC,IAAMC,eAAe,AAAC,GAAwBF,OAAtBG,6BAAkB,EAAC,KAAW,OAARH,SAAQ;IACtDI,IAAAA,kBAAG,EAACF,cAAcG,IAAI,CAAC,SAACC,KAAKC;QAC3B,IAAID,KAAK,OAAOP,SAASO;QACzB,IAAMD,OAAOE,IAAIC,IAAI;QACrB,IAAMC,WAAWZ,SAASI,KAAK,CAAC,KAAKS,KAAK,CAAC,GAAGC,IAAI,CAAC;QACnD,IAAMC,WAAWP,KAAKJ,KAAK,CAACQ,SAAS,CAAC,EAAE,CAACR,KAAK,CAAC,MAAMY,GAAG,GAAGC,IAAI;QAC/D,IAAMC,OAAOC,eAAM,CAACC,UAAU,CAAC;QAC/B,IAAMC,QAAQC,WAAE,CAACC,gBAAgB,CAACtB;QAClCoB,MAAMG,EAAE,CAAC,QAAQ,SAACC;mBAASP,KAAKQ,MAAM,CAACD;;QACvCE,IAAAA,oBAAG,EAACN,OAAO,SAACZ;YACV,IAAIA,KAAK,OAAOP,SAASO;YACzBS,KAAKU,MAAM,CAAC,WAAWb,WAAWb,SAAS,IAAI2B,MAAM,AAAC,GAAW,OAATjB,UAAS,wBAAsBV;QACzF;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/validateDownload.ts"],"sourcesContent":["import crypto from 'crypto';\nimport fs from 'fs';\nimport once from 'call-once-fn';\nimport get from 'get-remote';\nimport { NODE_DIST_BASE_URL } from '../constants';\nexport default function validateDownload(distPath, installPath, callback) {\n const version = distPath.split('/')[0];\n const downloadPath = `${NODE_DIST_BASE_URL}/${version}/SHASUMS256.txt`;\n get(downloadPath).text((err, res) => {\n if (err) return callback(err);\n const text = res.body;\n const filename = distPath.split('/').slice(1).join('/');\n const expected = text.split(filename)[0].split('\\n').pop().trim();\n const hash = crypto.createHash('sha256');\n const stream = fs.createReadStream(installPath);\n stream.on('data', (data) => hash.update(data));\n const end = once((err) => {\n if (err) return callback(err);\n hash.digest('hex') !== expected ? callback(new Error(`${filename} checksum failed`)) : callback();\n });\n stream.on('error', end);\n stream.on('end', end);\n stream.on('close', end);\n stream.on('finish', end);\n });\n}\n"],"names":["validateDownload","distPath","installPath","callback","version","split","downloadPath","NODE_DIST_BASE_URL","get","text","err","res","body","filename","slice","join","expected","pop","trim","hash","crypto","createHash","stream","fs","createReadStream","on","data","update","end","once","digest","Error"],"mappings":";;;;+BAKA;;;eAAwBA;;;6DALL;yDACJ;iEACE;gEACD;yBACmB;;;;;;AACpB,SAASA,iBAAiBC,QAAQ,EAAEC,WAAW,EAAEC,QAAQ;IACtE,IAAMC,UAAUH,SAASI,KAAK,CAAC,IAAI,CAAC,EAAE;IACtC,IAAMC,eAAe,AAAC,GAAwBF,OAAtBG,6BAAkB,EAAC,KAAW,OAARH,SAAQ;IACtDI,IAAAA,kBAAG,EAACF,cAAcG,IAAI,CAAC,SAACC,KAAKC;QAC3B,IAAID,KAAK,OAAOP,SAASO;QACzB,IAAMD,OAAOE,IAAIC,IAAI;QACrB,IAAMC,WAAWZ,SAASI,KAAK,CAAC,KAAKS,KAAK,CAAC,GAAGC,IAAI,CAAC;QACnD,IAAMC,WAAWP,KAAKJ,KAAK,CAACQ,SAAS,CAAC,EAAE,CAACR,KAAK,CAAC,MAAMY,GAAG,GAAGC,IAAI;QAC/D,IAAMC,OAAOC,eAAM,CAACC,UAAU,CAAC;QAC/B,IAAMC,SAASC,WAAE,CAACC,gBAAgB,CAACtB;QACnCoB,OAAOG,EAAE,CAAC,QAAQ,SAACC;mBAASP,KAAKQ,MAAM,CAACD;;QACxC,IAAME,MAAMC,IAAAA,mBAAI,EAAC,SAACnB;YAChB,IAAIA,KAAK,OAAOP,SAASO;YACzBS,KAAKW,MAAM,CAAC,WAAWd,WAAWb,SAAS,IAAI4B,MAAM,AAAC,GAAW,OAATlB,UAAS,wBAAsBV;QACzF;QACAmB,OAAOG,EAAE,CAAC,SAASG;QACnBN,OAAOG,EAAE,CAAC,OAAOG;QACjBN,OAAOG,EAAE,CAAC,SAASG;QACnBN,OAAOG,EAAE,CAAC,UAAUG;IACtB;AACF"}
@@ -1,6 +1,6 @@
1
1
  import crypto from 'crypto';
2
2
  import fs from 'fs';
3
- import eos from 'end-of-stream';
3
+ import once from 'call-once-fn';
4
4
  import get from 'get-remote';
5
5
  import { NODE_DIST_BASE_URL } from '../constants.mjs';
6
6
  export default function validateDownload(distPath, installPath, callback) {
@@ -12,11 +12,15 @@ export default function validateDownload(distPath, installPath, callback) {
12
12
  const filename = distPath.split('/').slice(1).join('/');
13
13
  const expected = text.split(filename)[0].split('\n').pop().trim();
14
14
  const hash = crypto.createHash('sha256');
15
- const input = fs.createReadStream(installPath);
16
- input.on('data', (data)=>hash.update(data));
17
- eos(input, (err)=>{
15
+ const stream = fs.createReadStream(installPath);
16
+ stream.on('data', (data)=>hash.update(data));
17
+ const end = once((err)=>{
18
18
  if (err) return callback(err);
19
19
  hash.digest('hex') !== expected ? callback(new Error(`${filename} checksum failed`)) : callback();
20
20
  });
21
+ stream.on('error', end);
22
+ stream.on('end', end);
23
+ stream.on('close', end);
24
+ stream.on('finish', end);
21
25
  });
22
26
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/validateDownload.ts"],"sourcesContent":["import crypto from 'crypto';\nimport fs from 'fs';\nimport eos from 'end-of-stream';\nimport get from 'get-remote';\nimport { NODE_DIST_BASE_URL } from '../constants';\nexport default function validateDownload(distPath, installPath, callback) {\n const version = distPath.split('/')[0];\n const downloadPath = `${NODE_DIST_BASE_URL}/${version}/SHASUMS256.txt`;\n get(downloadPath).text((err, res) => {\n if (err) return callback(err);\n const text = res.body;\n const filename = distPath.split('/').slice(1).join('/');\n const expected = text.split(filename)[0].split('\\n').pop().trim();\n const hash = crypto.createHash('sha256');\n const input = fs.createReadStream(installPath);\n input.on('data', (data) => hash.update(data));\n eos(input, (err) => {\n if (err) return callback(err);\n hash.digest('hex') !== expected ? callback(new Error(`${filename} checksum failed`)) : callback();\n });\n });\n}\n"],"names":["crypto","fs","eos","get","NODE_DIST_BASE_URL","validateDownload","distPath","installPath","callback","version","split","downloadPath","text","err","res","body","filename","slice","join","expected","pop","trim","hash","createHash","input","createReadStream","on","data","update","digest","Error"],"mappings":"AAAA,OAAOA,YAAY,SAAS;AAC5B,OAAOC,QAAQ,KAAK;AACpB,OAAOC,SAAS,gBAAgB;AAChC,OAAOC,SAAS,aAAa;AAC7B,SAASC,kBAAkB,QAAQ,eAAe;AAClD,eAAe,SAASC,iBAAiBC,QAAQ,EAAEC,WAAW,EAAEC,QAAQ;IACtE,MAAMC,UAAUH,SAASI,KAAK,CAAC,IAAI,CAAC,EAAE;IACtC,MAAMC,eAAe,GAAGP,mBAAmB,CAAC,EAAEK,QAAQ,eAAe,CAAC;IACtEN,IAAIQ,cAAcC,IAAI,CAAC,CAACC,KAAKC;QAC3B,IAAID,KAAK,OAAOL,SAASK;QACzB,MAAMD,OAAOE,IAAIC,IAAI;QACrB,MAAMC,WAAWV,SAASI,KAAK,CAAC,KAAKO,KAAK,CAAC,GAAGC,IAAI,CAAC;QACnD,MAAMC,WAAWP,KAAKF,KAAK,CAACM,SAAS,CAAC,EAAE,CAACN,KAAK,CAAC,MAAMU,GAAG,GAAGC,IAAI;QAC/D,MAAMC,OAAOtB,OAAOuB,UAAU,CAAC;QAC/B,MAAMC,QAAQvB,GAAGwB,gBAAgB,CAAClB;QAClCiB,MAAME,EAAE,CAAC,QAAQ,CAACC,OAASL,KAAKM,MAAM,CAACD;QACvCzB,IAAIsB,OAAO,CAACX;YACV,IAAIA,KAAK,OAAOL,SAASK;YACzBS,KAAKO,MAAM,CAAC,WAAWV,WAAWX,SAAS,IAAIsB,MAAM,GAAGd,SAAS,gBAAgB,CAAC,KAAKR;QACzF;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node-version/node-install-release/src/installNode/validateDownload.ts"],"sourcesContent":["import crypto from 'crypto';\nimport fs from 'fs';\nimport once from 'call-once-fn';\nimport get from 'get-remote';\nimport { NODE_DIST_BASE_URL } from '../constants';\nexport default function validateDownload(distPath, installPath, callback) {\n const version = distPath.split('/')[0];\n const downloadPath = `${NODE_DIST_BASE_URL}/${version}/SHASUMS256.txt`;\n get(downloadPath).text((err, res) => {\n if (err) return callback(err);\n const text = res.body;\n const filename = distPath.split('/').slice(1).join('/');\n const expected = text.split(filename)[0].split('\\n').pop().trim();\n const hash = crypto.createHash('sha256');\n const stream = fs.createReadStream(installPath);\n stream.on('data', (data) => hash.update(data));\n const end = once((err) => {\n if (err) return callback(err);\n hash.digest('hex') !== expected ? callback(new Error(`${filename} checksum failed`)) : callback();\n });\n stream.on('error', end);\n stream.on('end', end);\n stream.on('close', end);\n stream.on('finish', end);\n });\n}\n"],"names":["crypto","fs","once","get","NODE_DIST_BASE_URL","validateDownload","distPath","installPath","callback","version","split","downloadPath","text","err","res","body","filename","slice","join","expected","pop","trim","hash","createHash","stream","createReadStream","on","data","update","end","digest","Error"],"mappings":"AAAA,OAAOA,YAAY,SAAS;AAC5B,OAAOC,QAAQ,KAAK;AACpB,OAAOC,UAAU,eAAe;AAChC,OAAOC,SAAS,aAAa;AAC7B,SAASC,kBAAkB,QAAQ,eAAe;AAClD,eAAe,SAASC,iBAAiBC,QAAQ,EAAEC,WAAW,EAAEC,QAAQ;IACtE,MAAMC,UAAUH,SAASI,KAAK,CAAC,IAAI,CAAC,EAAE;IACtC,MAAMC,eAAe,GAAGP,mBAAmB,CAAC,EAAEK,QAAQ,eAAe,CAAC;IACtEN,IAAIQ,cAAcC,IAAI,CAAC,CAACC,KAAKC;QAC3B,IAAID,KAAK,OAAOL,SAASK;QACzB,MAAMD,OAAOE,IAAIC,IAAI;QACrB,MAAMC,WAAWV,SAASI,KAAK,CAAC,KAAKO,KAAK,CAAC,GAAGC,IAAI,CAAC;QACnD,MAAMC,WAAWP,KAAKF,KAAK,CAACM,SAAS,CAAC,EAAE,CAACN,KAAK,CAAC,MAAMU,GAAG,GAAGC,IAAI;QAC/D,MAAMC,OAAOtB,OAAOuB,UAAU,CAAC;QAC/B,MAAMC,SAASvB,GAAGwB,gBAAgB,CAAClB;QACnCiB,OAAOE,EAAE,CAAC,QAAQ,CAACC,OAASL,KAAKM,MAAM,CAACD;QACxC,MAAME,MAAM3B,KAAK,CAACW;YAChB,IAAIA,KAAK,OAAOL,SAASK;YACzBS,KAAKQ,MAAM,CAAC,WAAWX,WAAWX,SAAS,IAAIuB,MAAM,GAAGf,SAAS,gBAAgB,CAAC,KAAKR;QACzF;QACAgB,OAAOE,EAAE,CAAC,SAASG;QACnBL,OAAOE,EAAE,CAAC,OAAOG;QACjBL,OAAOE,EAAE,CAAC,SAASG;QACnBL,OAAOE,EAAE,CAAC,UAAUG;IACtB;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-install-release",
3
- "version": "1.10.22",
3
+ "version": "1.10.24",
4
4
  "description": "Cross-platform solution for installing releases of Node.js",
5
5
  "keywords": [
6
6
  "node",
@@ -40,12 +40,12 @@
40
40
  "version": "tsds version"
41
41
  },
42
42
  "dependencies": {
43
- "cross-spawn-cb": "^2.1.11",
44
- "end-of-stream": "^1.4.4",
43
+ "call-once-fn": "^1.0.10",
44
+ "cross-spawn-cb": "^2.1.13",
45
45
  "exit": "^0.1.2",
46
- "fast-extract": "^1.3.20",
46
+ "fast-extract": "^1.3.21",
47
47
  "function-exec-sync": "^1.2.12",
48
- "get-remote": "^1.3.18",
48
+ "get-remote": "^1.3.20",
49
49
  "getopts-compat": "^2.2.6",
50
50
  "homedir-polyfill": "^1.0.3",
51
51
  "is-version": "^0.2.9",