androidjs-builder icon indicating copy to clipboard operation
androidjs-builder copied to clipboard

NodeJS Error/Fix process.stdout.clearLine not found

Open Cupidazul opened this issue 2 years ago • 1 comments

Error occurs in node 14.x. process.stdout.clearLine and cursorTo not found ...

Fix: ProgressBar.js

class LoadingBar {
    constructor() {
        this.interval = 100;
        this.currentIndex = 0;
        this.fill = '█';
        this.empty = '⣿';
        this.bar_length = 50;
        this.loop = null;
        this.flip = 1;
        this.chunksDownloaded = "0";
        this.isRunning = false;
        this.success = ' √';
        this.failed = ' X';
        this.message = '';
        this.messageSize = 0;
    }
    reset() {
        this.constructor();
    }
    next() {
        this.clear();
        this.currentIndex += this.flip;
        if (this.currentIndex === this.bar_length || this.currentIndex === 0) {
            this.flip *= -1;
        }
        let _left = this.currentIndex - 1;
        _left = _left 0) process.stdout.write('\b'.repeat(this.messageSize));
        }
    }

.
.
.
.

Cupidazul avatar Aug 03 '22 09:08 Cupidazul