回答編集履歴
1
コード
answer
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
[readline.moveCursor](http://nodejs.jp/nodejs.org_ja/api/readline.html#readline_readline_clearscreendown_stream)を利用すれば解決できそうです。
|
2
2
|
```js
|
3
|
-
const
|
3
|
+
const readline=require("readline");
|
4
4
|
|
5
5
|
function progress(par){
|
6
|
+
const LONG_MESSAGE = "LongCharacterLongCharacterLongCharacterLongCharacterLongCharacterLongCharacterLongCharacterLongCharacter";
|
7
|
+
|
6
|
-
|
8
|
+
const empty=" ".repeat(10);
|
7
9
|
var gauge=("=".repeat(par)+empty).slice(0,10);
|
8
10
|
process.stdout.write(`\r進捗:[${gauge}]:${LONG_MESSAGE}`);
|
9
11
|
}
|
10
12
|
|
11
|
-
const readline=require("readline");
|
12
13
|
const g=(function*(){
|
13
|
-
for(
|
14
|
+
for(let i=0;i<=10;i++){
|
14
15
|
yield setTimeout(()=>g.next(),200);
|
15
16
|
progress(i);
|
16
17
|
readline.moveCursor(process.stdout,0,-1);
|