Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
DemonMartin committed Jan 25, 2025
1 parent a6bdeb6 commit 787b81d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 61 deletions.
20 changes: 18 additions & 2 deletions src/utils/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import fetch from 'node-fetch';
import { fileURLToPath } from 'node:url';
import os from 'node:os';
import { isMainThread } from 'worker_threads';
import DownloadManager from './downloadManager.js';

let __filename, __dirname;

Expand Down Expand Up @@ -74,8 +73,25 @@ class ModuleClient {
if (this.customPath) {
throw new Error('Custom path provided but library does not exist: ' + this.TLS_LIB_PATH);
}
console.log('[tlsClient] Detected missing TLS library');
console.log('[tlsClient] DownloadPath: ' + this.tlsDependencyPath.DOWNLOAD_PATH);
console.log('[tlsClient] DestinationPath: ' + this.TLS_LIB_PATH);
console.log('[tlsClient] Downloading TLS library... This may take a while');

await DownloadManager.download(this.tlsDependencyPath.DOWNLOAD_PATH, this.TLS_LIB_PATH);
const response = await fetch(this.tlsDependencyPath.DOWNLOAD_PATH);
if (!response.ok) {
throw new Error(`Unexpected response ${response.statusText}`);
}
const fileStream = fs.createWriteStream(this.TLS_LIB_PATH);
response.body.pipe(fileStream);

return new Promise((resolve, reject) => {
fileStream.on('finish', () => {
console.log('[tlsClient] Successfully downloaded TLS library');
resolve();
});
fileStream.on('error', reject);
});
}

/**
Expand Down
59 changes: 0 additions & 59 deletions src/utils/downloadManager.js

This file was deleted.

0 comments on commit 787b81d

Please sign in to comment.