remove download progress clip model logs

This commit is contained in:
Abhinav 2024-01-12 10:11:10 +05:30
parent 52a35f2d62
commit d3588198e8
2 changed files with 2 additions and 13 deletions

View file

@ -86,7 +86,7 @@ async function downloadModel(saveLocation: string, url: string) {
}
log.info('downloading clip model');
const resp = await fetch(url);
await writeNodeStream(saveLocation, resp.body, true);
await writeNodeStream(saveLocation, resp.body);
log.info('clip model downloaded');
}

View file

@ -6,8 +6,6 @@ import StreamZip from 'node-stream-zip';
import { Readable } from 'stream';
import { logError } from './logging';
import { existsSync } from 'fs';
import { log } from 'electron-log';
import { convertBytesToHumanReadable } from '../utils/logging';
// https://stackoverflow.com/a/63111390
export const getDirFilePaths = async (dirPath: string) => {
@ -230,8 +228,7 @@ export const convertBrowserStreamToNode = (
export async function writeNodeStream(
filePath: string,
fileStream: NodeJS.ReadableStream,
enableLogging = false
fileStream: NodeJS.ReadableStream
) {
const writeable = fs.createWriteStream(filePath);
@ -241,14 +238,6 @@ export async function writeNodeStream(
fileStream.pipe(writeable);
let downloaded = 0;
if (enableLogging) {
fileStream.on('data', (chunk) => {
downloaded += chunk.length;
log(`Received ${convertBytesToHumanReadable(downloaded)} of data.`);
});
}
await new Promise((resolve, reject) => {
writeable.on('finish', resolve);
writeable.on('error', async (e) => {