-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: integrated archive to create an archive needed during build
- Loading branch information
1 parent
a8d9596
commit 173d698
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import fsp from "node:fs/promises"; | ||
import path from "node:path"; | ||
import { fileURLToPath } from "node:url"; | ||
|
||
import Seven from "node-7z"; | ||
|
||
const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
const my7z = path.join(__dirname, "..", "resources", "7zip", "win", "7za.exe"); | ||
|
||
const sourceFolder = path.join(__dirname, "..", "resources", "python-embedded"); | ||
const outputArchive = path.join(__dirname, "..", "resources", "python-embedded.7z"); | ||
|
||
const files = await fsp.readdir(sourceFolder); | ||
|
||
const archive = Seven.add( | ||
outputArchive, | ||
files.map(file => path.join(sourceFolder, file)), | ||
{ | ||
$bin: my7z, | ||
recursive: true, | ||
} | ||
); | ||
|
||
archive.on("end", () => { | ||
console.log("Compression finished"); | ||
}); | ||
|
||
archive.on("error", error => { | ||
console.error("Compression error:", error); | ||
}); |