Skip to content

Commit

Permalink
feat: add streamingTimeout for tar.gz download timeout
Browse files Browse the repository at this point in the history
streamingTimeout default is 120s
  • Loading branch information
fengmk2 committed Apr 14, 2018
1 parent b5e2251 commit ec0f76c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/format_install_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ module.exports = function formatInstallOptions(options) {
options.storeDir = path.join(options.targetDir, 'node_modules');
}
options.timeout = options.timeout || 60000;
options.streamingTimeout = options.streamingTimeout || 120000;
const customConsole = options.detail ? console : {
info: debug,
log: debug,
Expand Down
1 change: 1 addition & 0 deletions lib/local_install.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const bin = require('./bin');
* - {String} [targetDir] - node_modules target dir, default is ${root}.
* - {String} [storeDir] - npm modules store dir, default is `${targetDir}/node_modules`
* - {Number} [timeout] - npm registry request timeout, default is 60000 ms
* - {Number} [streamingTimeout] - download tar.gz stream timeout, default is 120000 ms
* - {Console} [console] - console logger instance, default is `console`
* - {Array<Object>} [pkgs] - optional packages to install, default is `[]`
* - {Boolean} [production] - production mode install, default is `false`
Expand Down
3 changes: 1 addition & 2 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,9 @@ exports.getPkgFromPaths = function* (name, paths) {
return null;
};


exports.getTarballStream = function* (url, options) {
const result = yield get(url, {
timeout: options.timeout,
timeout: options.streamingTimeout || options.timeout,
followRedirect: true,
streaming: true,
}, options);
Expand Down

0 comments on commit ec0f76c

Please sign in to comment.