25 lines
684 B
TypeScript
25 lines
684 B
TypeScript
import { Request } from "request";
|
|
|
|
/**
|
|
* Manages file downloads and network requests.
|
|
*/
|
|
export class DownloadManager {
|
|
public networkRequests: Record<string, any> = {};
|
|
|
|
public static instance: DownloadManager = new DownloadManager();
|
|
|
|
constructor() {
|
|
if (DownloadManager.instance) {
|
|
return DownloadManager.instance;
|
|
}
|
|
}
|
|
/**
|
|
* Sets a network request for a specific file.
|
|
* @param {string} fileName - The name of the file.
|
|
* @param {Request | undefined} request - The network request to set, or undefined to clear the request.
|
|
*/
|
|
setRequest(fileName: string, request: Request | undefined) {
|
|
this.networkRequests[fileName] = request;
|
|
}
|
|
}
|