How to use the clearLine function from readline
Find comprehensive JavaScript readline.clearLine code examples handpicked from public code repositorys.
GitHub: JiPaix/xdccJS
210 211 212 213 214 215 216 217 218 219 220
* @param {string} message The message to write. * @api public */ ProgressBar.prototype.interrupt = function (message, draw) { readline.clearLine(this.stream, 0) readline.cursorTo(this.stream, 0) // // write the message text this.stream.write(message) // // re-display the progress bar with its lastDraw
6
20
0
+ 5 other calls in file
GitHub: BuilderIO/qwik-build
1462 1463 1464 1465 1466 1467 1468 1469 1470 1471
const C2 = (D2, { name: i }) => { if (String(D2) === "" && process.exit(0), !F2) return; let E2 = i === "return" ? 0 : -1, a2 = i === "return" ? -1 : 0; f.moveCursor(u2, E2, a2, () => { f.clearLine(u2, 1, () => { t.once("keypress", C2); }); }); };
1
6
4
+ 3 other calls in file
231 232 233 234 235 236 237 238 239 240
}, { onUploadProgress: (evt) => { if ((process.env.NODE_ENV || "").trim() !== "production") { const progress = (evt.bytesRead / fileSize) * 100; readline.clearLine(process.stdout, 0); readline.cursorTo(process.stdout, 0, null); process.stdout.write(`UPLOAD PROGRESS: ${Math.round(progress)}%`); } },
0
1
0
GitHub: gojecks/jeli-cli
322 323 324 325 326 327 328 329 330 331 332
setInitial: msg => initialMsg.push(msg), clear: exports.clearConsole }; exports.writeline = text => { readline.clearLine(process.stdout); readline.cursorTo(process.stdout, 0); process.stdout.write(text); };
0
0
2
60 61 62 63 64 65 66 67 68 69 70 71
assert.strictEqual(readline.clearLine(writable, -1, common.mustCall()), true); assert.deepStrictEqual(writable.data, CSI.kClearToLineBeginning); // Verify that clearLine() throws on invalid callback. assert.throws(() => { readline.clearLine(writable, 0, null); }, /ERR_INVALID_CALLBACK/); // Verify that clearLine() does not throw on null or undefined stream. assert.strictEqual(readline.clearLine(null, 0), true);
0
0
0
+ 5 other calls in file
107 108 109 110 111 112 113 114 115 116 117
updateProgress() { if (!process.stderr.isTTY || process.stdout.isTTY) { return; } readline.clearLine(process.stderr); readline.cursorTo(process.stderr, 0); process.stderr.write(this.getProgress()); } }
0
0
0
readline.createInterface is the most popular function in readline (187 examples)