Skip to content

Invalid array length #166

@rawnly

Description

@rawnly
//...
https.get(url, response => {
			// if --progress run the progressbar
			if (flags.progress) {
				const len = parseInt(response.headers['content-length'], 10);
				const bar = new ProgressBar(chalk `{yellow ↓} {red :percent} [:bar] :elapsed s`, {
					complete: '=',
					incomplete: ' ',
					width: 20,
					total: len,
					clear: true
				});
			
				// on data received fill the progressbar
				response.on('data', chunk => {
					bar.tick(chunk.length, {
						passphrase: 'Making something awesome'
					});
				});
			}

                  //... rest of the function

causes:

/Users/rawnly/code/NODE/splash-cli-2018/node_modules/progress/lib/node-progress.js:155
  complete = Array(Math.max(0, completeLength + 1)).join(this.chars.complete);
             ^

RangeError: Invalid array length
    at ProgressBar.render (/Users/rawnly/code/NODE/splash-cli-2018/node_modules/progress/lib/node-progress.js:155:14)
    at ontimeout (timers.js:471:11)
    at tryOnTimeout (timers.js:306:5)
    at Timer.listOnTimeout (timers.js:266:5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions