@@ -5,9 +5,6 @@ import { ReadStream } from "tty";
5
5
import { Configurations } from "./constants" ;
6
6
import { EventEmitter } from "events" ;
7
7
import * as crypto from "crypto" ;
8
- import progress = require( "progress-stream" ) ;
9
- import filesize = require( "filesize" ) ;
10
- import * as util from "util" ;
11
8
12
9
const Table = require ( "cli-table" ) ;
13
10
@@ -36,46 +33,48 @@ export function regExpEscape(input: string): string {
36
33
return input . replace ( / [ | \\ { } ( ) [ \] ^ $ + * ? . ] / g, "\\$&" ) ;
37
34
}
38
35
39
- export function trackDownloadProgress ( destinationStream : NodeJS . WritableStream , url : string ) : NodeJS . ReadableStream {
40
- // \r for carriage return doesn't work on windows in node for some reason so we have to use it's hex representation \x1B[0G
41
- let lastMessageSize = 0 ;
42
- const carriageReturn = "\x1B[0G" ;
43
- let timeElapsed = 0 ;
44
-
45
- const isInteractiveTerminal = isInteractive ( ) ;
46
- const progressStream = progress ( { time : 1000 } , ( progress : any ) => {
47
- timeElapsed = progress . runtime ;
48
-
49
- if ( timeElapsed >= 1 ) {
50
- if ( isInteractiveTerminal ) {
51
- this . $logger . write ( "%s%s" , carriageReturn , Array ( lastMessageSize + 1 ) . join ( " " ) ) ;
52
-
53
- const message = util . format ( "%sDownload progress ... %s | %s | %s/s" ,
54
- carriageReturn ,
55
- Math . floor ( progress . percentage ) + "%" ,
56
- filesize ( progress . transferred ) ,
57
- filesize ( progress . speed ) ) ;
58
-
59
- this . $logger . write ( message ) ;
60
- lastMessageSize = message . length ;
61
- }
62
- }
63
- } ) ;
64
-
65
- progressStream . on ( "finish" , ( ) => {
66
- if ( timeElapsed >= 1 ) {
67
- const msg = `Download of ${ url } completed.` ;
68
- if ( isInteractiveTerminal ) {
69
- this . $logger . out ( "%s%s%s%s" , carriageReturn , Array ( lastMessageSize + 1 ) . join ( " " ) , carriageReturn , msg ) ;
70
- } else {
71
- this . $logger . out ( msg ) ;
72
- }
73
- }
74
- } ) ;
75
-
76
- progressStream . pipe ( destinationStream ) ;
77
- return progressStream ;
78
- }
36
+ // This function is a state of Art and that's why it has not been deleted.
37
+ // However, its code uses some dependencies that are not used anywhere else, so the code is commented, as we decided to remove those dependencies.
38
+ // export function trackDownloadProgress(destinationStream: NodeJS.WritableStream, url: string): NodeJS.ReadableStream {
39
+ // // \r for carriage return doesn't work on windows in node for some reason so we have to use it's hex representation \x1B[0G
40
+ // let lastMessageSize = 0;
41
+ // const carriageReturn = "\x1B[0G";
42
+ // let timeElapsed = 0;
43
+
44
+ // const isInteractiveTerminal = isInteractive();
45
+ // const progressStream = progress({ time: 1000 }, (progress: any) => {
46
+ // timeElapsed = progress.runtime;
47
+
48
+ // if (timeElapsed >= 1) {
49
+ // if (isInteractiveTerminal) {
50
+ // this.$logger.write("%s%s", carriageReturn, Array(lastMessageSize + 1).join(" "));
51
+
52
+ // const message = util.format("%sDownload progress ... %s | %s | %s/s",
53
+ // carriageReturn,
54
+ // Math.floor(progress.percentage) + "%",
55
+ // filesize(progress.transferred),
56
+ // filesize(progress.speed));
57
+
58
+ // this.$logger.write(message);
59
+ // lastMessageSize = message.length;
60
+ // }
61
+ // }
62
+ // });
63
+
64
+ // progressStream.on("finish", () => {
65
+ // if (timeElapsed >= 1) {
66
+ // const msg = `Download of ${url} completed.`;
67
+ // if (isInteractiveTerminal) {
68
+ // this.$logger.out("%s%s%s%s", carriageReturn, Array(lastMessageSize + 1).join(" "), carriageReturn, msg);
69
+ // } else {
70
+ // this.$logger.out(msg);
71
+ // }
72
+ // }
73
+ // });
74
+
75
+ // progressStream.pipe(destinationStream);
76
+ // return progressStream;
77
+ // }
79
78
80
79
export function isAllowedFinalFile ( item : string ) : RegExpMatchArray {
81
80
return item . match ( / .* \. a a r / ) ||
0 commit comments