feat: adding initial download sources

This commit is contained in:
Chubby Granny Chaser
2025-04-01 21:39:54 +01:00
parent 73f4b0e869
commit 0d75878b07
41 changed files with 306 additions and 520 deletions

38
src/main/services/7zip.ts Normal file
View File

@@ -0,0 +1,38 @@
import { app } from "electron";
import cp from "node:child_process";
import path from "node:path";
export const binaryName = {
linux: "7zzs",
darwin: "7zz",
win32: "7zr.exe",
};
export class _7Zip {
private static readonly binaryPath = app.isPackaged
? path.join(process.resourcesPath, binaryName[process.platform])
: path.join(
__dirname,
"..",
"..",
"binaries",
binaryName[process.platform]
);
public static extractFile(
filePath: string,
outputPath: string,
cb: () => void
) {
const child = cp.spawn(this.binaryPath, [
"x",
filePath,
"-o" + outputPath,
"-y",
]);
child.on("exit", () => {
cb();
});
}
}