|
|
|
@ -4,6 +4,7 @@ import {
|
|
|
|
} from './cliParsers';
|
|
|
|
} from './cliParsers';
|
|
|
|
import { Ilog, IupdateWorker } from './interfaces/interfaces';
|
|
|
|
import { Ilog, IupdateWorker } from './interfaces/interfaces';
|
|
|
|
import { IFileObject, Istreams } from './interfaces/synced/IFileObject';
|
|
|
|
import { IFileObject, Istreams } from './interfaces/synced/IFileObject';
|
|
|
|
|
|
|
|
import { fileExists } from './fileUtils';
|
|
|
|
|
|
|
|
|
|
|
|
const fancyTimeFormat = (time: number) => {
|
|
|
|
const fancyTimeFormat = (time: number) => {
|
|
|
|
// Hours, minutes and seconds
|
|
|
|
// Hours, minutes and seconds
|
|
|
|
@ -92,7 +93,7 @@ class CLI {
|
|
|
|
this.config = config;
|
|
|
|
this.config = config;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
updateETA = (perc: number): void => {
|
|
|
|
updateETA = async (perc: number): Promise<void> => {
|
|
|
|
if (perc > 0) {
|
|
|
|
if (perc > 0) {
|
|
|
|
if (this.lastProgCheck === 0) {
|
|
|
|
if (this.lastProgCheck === 0) {
|
|
|
|
this.lastProgCheck = new Date().getTime();
|
|
|
|
this.lastProgCheck = new Date().getTime();
|
|
|
|
@ -124,7 +125,7 @@ class CLI {
|
|
|
|
let outputFileSizeInGbytes;
|
|
|
|
let outputFileSizeInGbytes;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (fs.existsSync(this.config.outputFilePath)) {
|
|
|
|
if (await fileExists(this.config.outputFilePath)) {
|
|
|
|
let singleFileSize = fs.statSync(this.config.outputFilePath);
|
|
|
|
let singleFileSize = fs.statSync(this.config.outputFilePath);
|
|
|
|
// @ts-expect-error type
|
|
|
|
// @ts-expect-error type
|
|
|
|
singleFileSize = singleFileSize.size;
|
|
|
|
singleFileSize = singleFileSize.size;
|
|
|
|
@ -180,7 +181,7 @@ class CLI {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (percentage > 0) {
|
|
|
|
if (percentage > 0) {
|
|
|
|
this.updateETA(percentage);
|
|
|
|
void this.updateETA(percentage);
|
|
|
|
this.config.updateWorker({
|
|
|
|
this.config.updateWorker({
|
|
|
|
percentage,
|
|
|
|
percentage,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -236,7 +237,7 @@ class CLI {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (percentage > 0) {
|
|
|
|
if (percentage > 0) {
|
|
|
|
this.updateETA(percentage);
|
|
|
|
void this.updateETA(percentage);
|
|
|
|
this.config.updateWorker({
|
|
|
|
this.config.updateWorker({
|
|
|
|
percentage,
|
|
|
|
percentage,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
@ -246,7 +247,7 @@ class CLI {
|
|
|
|
str,
|
|
|
|
str,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (percentage > 0) {
|
|
|
|
if (percentage > 0) {
|
|
|
|
this.updateETA(percentage);
|
|
|
|
void this.updateETA(percentage);
|
|
|
|
this.config.updateWorker({
|
|
|
|
this.config.updateWorker({
|
|
|
|
percentage,
|
|
|
|
percentage,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|