archive.*, crypto.*, net.* & log.*
archive.* — Zero-Dependency Multi-Format Packaging & Extraction (23 Methods)
Every archive.* function in both raggiescript.exe (static /MT Win32 C++20) and RaggieScript.Core (.NET v1.2) runs against 100% EULA-clean, zero-dependency engines built straight into Windows 11 (x64 & ARM64):
System32\cabinet.dll(COMPRESS_ALGORITHM_LZMS) +bcrypt.dll(SHA-256): Powers RaggieSoft's solid.rswpak(RSWPAK1) container in-process with 100% binary wire compatibility between C++20 and.NET.System32\tar.exe(bsdtar 3.8.9/ BSDlibarchive+zlib+ Public-Domainliblzma 5.8.3+bz2lib+libzstd 1.5.7): Powers.zip(plus.nupkg,.vsix,.epub,.msix),.7z(LZMA/LZMA2solid),.tar(.tar.gz,.tar.bz2,.tar.xz,.tar.lzma,.tar.zst),.zst(Zstandard bundles),.iso(ISO 9660Collector's Edition optical disc images for Showcase Studio),.cpio, and.xar.System32\makecab.exe(LZX:21multi-folder.ddf): Builds genuine Windows.cabcabinets for.msimedia and driver packages.System32\wimgapi.dll(WIMCreateFile/WIMCaptureImage/WIMApplyImage): Captures and applies Windows.wimimages when elevated (Uac.Deferred/Uac.RequireAdministrator), automatically enablingSeBackupPrivilegeandSeRestorePrivilege.
1. Read-Only & Wizard-Safe Inspection (2 Methods — Allowed Inside wizard { ... })
| Method | Signature | Return | Mutating? | Description |
|---|---|---|---|---|
archive.list | archive.list(archiveFile: path) | array | Wizard-Safe | Inspects any supported archive and returns { path: string, size: int, isDir: bool }[] (rejecting Zip-Slip paths & .rar). |
archive.verify | archive.verify(archiveFile: path, expectedSha256?: string) | bool | Wizard-Safe | Verifies optional 64-char hex SHA-256, container structure (including RSWPAK1 inner SHA-256), and Zip-Slip path safety. |
2. Auto-Detecting & Format-Specific Packaging (21 Mutating Methods — RSW701 Gated)
Every archive.create* call accepts a source folder (or single file), writes outArchive, and returns its 64-character lowercase SHA-256 hex digest. Every archive.extract* call verifies optional expectedSha256 before unpacking and returns the int count of extracted files.
| Method | Signature | Return | Underlying Windows 11 Engine & Container |
|---|---|---|---|
archive.create | archive.create(sourcePath: path, outArchive: path, options?: map) | string (SHA-256) | Infers container format automatically from outArchive extension (.zip, .7z, .rswpak, .cab, .tar.*, .zst, .iso, .wim, .cpio, .xar). |
archive.extract | archive.extract(archiveFile: path, destDir: path, expectedSha256?: string) | int (files) | Sniffs magic header bytes (PK\x03\x04 .zip/.nupkg/.vsix/.epub, 7z\xBC\xAF .7z, RSWPAK1 .rswpak, MSCF .cab, CD001 .iso, MSWIM .wim, \x28\xB5\x2F\xFD .zst, 070701 .cpio, xar!) and extracts with rollback tracking. |
archive.createZip | archive.createZip(sourcePath: path, outZip: path, options?: map) | string (SHA-256) | Packs folder/file into standard DEFLATE .zip. |
archive.extractZip | archive.extractZip(zipFile: path, destDir: path, expectedSha256?: string) | int (files) | Extracts .zip (or .nupkg / .vsix / .epub) into destDir. |
archive.create7z | archive.create7z(sourcePath: path, out7z: path, options?: map) | string (SHA-256) | Packs folder/file into solid Public-Domain LZMA2 .7z (System32\tar.exe --format=7zip). |
archive.extract7z | archive.extract7z(sevenZipFile: path, destDir: path, expectedSha256?: string) | int (files) | Extracts .7z (LZMA / LZMA2) archive into destDir. |
archive.createLzma | archive.createLzma(sourcePath: path, out7z: path, options?: map) | string (SHA-256) | Algorithm-named alias for archive.create7z. |
archive.extractLzma | archive.extractLzma(sevenZipFile: path, destDir: path, expectedSha256?: string) | int (files) | Algorithm-named alias for archive.extract7z. |
archive.createPak | archive.createPak(sourcePath: path, outPakFile: path, options?: map) | string (SHA-256) | Compresses folder/file into RaggieSoft's solid LZMS .rswpak (RSWPAK1 + inner SHA-256). |
archive.extractPak | archive.extractPak(pakFile: path, destDir: path, expectedSha256?: string) | int (files) | Verifies both outer and inner RSWPAK1 SHA-256 digests and extracts into destDir. |
archive.downloadPak | archive.downloadPak(httpsUrl: string, destDir: path, expectedSha256?: string, verifyAuthenticode?: bool) | int (files) | Streams remote pack over TLS 1.2/1.3 WinHTTP, verifies SHA-256 before unpacking, and extracts. |
archive.createCab | archive.createCab(sourcePath: path, outCab: path, options?: map) | string (SHA-256) | Compresses folder hierarchy into a multi-folder LZX:21 Windows .cab (System32\makecab.exe). |
archive.extractCab | archive.extractCab(cabFile: path, destDir: path, expectedSha256?: string) | int (files) | Extracts a Windows .cab cabinet preserving subdirectory structure. |
archive.createTar | archive.createTar(sourcePath: path, outTar: path, options?: map) | string (SHA-256) | Creates .tar, .tar.gz/.tgz, .tar.bz2, .tar.xz, .tar.lzma, or .tar.zst based on extension. |
archive.extractTar | archive.extractTar(tarFile: path, destDir: path, expectedSha256?: string) | int (files) | Extracts any uncompressed or compressed POSIX tarball into destDir. |
archive.createZst | archive.createZst(sourcePath: path, outZst: path, options?: map) | string (SHA-256) | Packs folder/file into a fast Zstandard .tar.zst bundle (libzstd 1.5.7). |
archive.extractZst | archive.extractZst(zstFile: path, destDir: path, expectedSha256?: string) | int (files) | Extracts a Zstandard .tar.zst / .tzst bundle into destDir. |
archive.createIso | archive.createIso(sourcePath: path, outIso: path, options?: map) | string (SHA-256) | Builds an ISO 9660 (.iso) Collector's Edition optical disc image (--format=iso9660). |
archive.extractIso | archive.extractIso(isoFile: path, destDir: path, expectedSha256?: string) | int (files) | Extracts an ISO 9660 (.iso) optical image into destDir (normalizing writable file attributes). |
archive.createWim | archive.createWim(sourceDir: path, outWim: path, options?: map) | string (SHA-256) | Captures sourceDir into a Windows .wim image via System32\wimgapi.dll (requires elevation). |
archive.extractWim | archive.extractWim(wimFile: path, destDir: path, expectedSha256?: string) | int (files) | Applies image #1 of a Windows .wim file via System32\wimgapi.dll (requires elevation). |
use installer;
param payload7z: path = sys.supportDir / "StarlightAssets.7z";
param installDir: path = sys.programFiles / "Starlight";
wizard {
step VerifyMedia {
// archive.verify() and archive.list() are 100% read-only & allowed inside wizard {}!
if (!archive.verify(payload7z)) {
ui.notice("Collector media archive is missing or corrupted.");
}
}
}
install {
// Automatically journaled in .rsw-rollback.jnl — rolled back cleanly if a later step fails!
const extracted = archive.extract7z(payload7z, installDir / "Assets");
const backupSha = archive.createZst(installDir / "Config", sys.localAppData / "Starlight" / "config-backup.tar.zst");
log.info("Unpacked ${extracted} files; config snapshot SHA-256 = ${backupSha}");
}
crypto.* — CNG bcrypt.dll Hashing, UUIDv5 & Authenticode (7 Methods)
All crypto.* methods are 100% Read-Only & Wizard-Safe, implemented directly against Windows bcrypt.dll and wintrust.dll with zero OpenSSL DLL dependencies:
| Method | Signature | Return | Description |
|---|---|---|---|
crypto.sha256 | crypto.sha256(text: string) | string | Computes lowercase 64-char hex SHA-256 of UTF-8 text. |
crypto.sha256Text | crypto.sha256Text(text: string) | string | Explicit alias for crypto.sha256(text). |
crypto.sha256File | crypto.sha256File(file: path) | string | Streams file in 64 KB chunks through BCRYPT_SHA256_ALGORITHM and returns 64-char hex SHA-256. |
crypto.crc32Text | crypto.crc32Text(text: string) | int | Computes unsigned IEEE 802.3 CRC-32 checksum of text. |
crypto.newGuid | crypto.newGuid() | string | Generates a random uppercase {GUID} via BCryptGenRandom. |
crypto.uuid5 | crypto.uuid5(name: string, namespaceGuid?: string) | string | Generates deterministic RFC 4122 SHA-1 UUIDv5 {GUID} for reproducible MSI Component GUIDs. |
crypto.verifyAuthenticode | crypto.verifyAuthenticode(peFile: path) | bool | Verifies Microsoft Authenticode / Azure Artifact Signing chain via WinVerifyTrust. |
net.* — Native TLS 1.2 / 1.3 WinHTTP Client & Winsock2 TCP Port Probes (6 Methods)
net.* pairs the OS-integrated winhttp.dll HTTPS stack with sub-millisecond Winsock2 local TCP port availability probes (isPortFree and findFreePort, both Wizard-Safe for ui.textBox port validators!) under use installer;:
| Method | Signature | Return | Description |
|---|---|---|---|
net.download | net.download(httpsUrl: string, destFile: path, expectedSha256?: string) | bool | Downloads httpsUrl to destFile with live UI progress; deletes destFile and returns false if expectedSha256 mismatches! |
net.getText | net.getText(httpsUrl: string) | string | Performs an HTTPS GET and returns the UTF-8 response body. |
net.getJson | net.getJson(httpsUrl: string) | any | Fetches and parses a remote HTTPS JSON manifest (catalog.json, release channels, etc.). |
net.probe | net.probe(httpsUrl: string) | bool | Performs a fast 4-second HEAD/GET reachability probe (true on HTTP 200..299). |
net.isPortFree | net.isPortFree(port: int, loopbackOnly?: bool) | bool | Wizard-Safe: Probes via Winsock2 (ws2_32.lib) whether local TCP port (1..65535) is free to bind. |
net.findFreePort | net.findFreePort(startPort?: int, endPort?: int) | int | Wizard-Safe: Returns the first available local TCP port in [startPort, endPort] (defaults 8000..9000, or -1). |
log.* — Structured Setup & Audit Logging (4 Methods)
| Method | Signature | Return | Description |
|---|---|---|---|
log.info | log.info(message: string) | null | Appends timestamped [INFO] entry to the setup log. |
log.warn | log.warn(message: string) | null | Appends timestamped [WARN] entry to the setup log. |
log.warning | log.warning(message: string) | null | Alias for log.warn(message). |
log.error | log.error(message: string) | null | Appends timestamped [ERROR] entry to the setup log. |
archive.list(archiveFile)Wizard-Safe
archive.verify(archiveFile, expectedSha256?)Wizard-Safe
archive.create(sourcePath, outArchive, options?)Mutating
archive.extract(archiveFile, destDir, expectedSha256?)Mutating
archive.createZip(sourcePath, outZip, options?)Mutating
archive.extractZip(zipFile, destDir, expectedSha256?)Mutating
archive.create7z(sourcePath, out7z, options?)Mutating
archive.extract7z(sevenZipFile, destDir, expectedSha256?)Mutating
archive.createLzma(sourcePath, out7z, options?)Mutating
archive.extractLzma(sevenZipFile, destDir, expectedSha256?)Mutating
archive.createPak(sourceDir, outPakFile, options?)Mutating
archive.extractPak(pakFile, destDir, expectedSha256?)Mutating
archive.downloadPak(url, destDir, expectedSha256?, verifySig?)Mutating
archive.createCab(sourcePath, outCab, options?)Mutating
archive.extractCab(cabFile, destDir, expectedSha256?)Mutating
archive.createTar(sourcePath, outTar, options?)Mutating
archive.extractTar(tarFile, destDir, expectedSha256?)Mutating
archive.createZst(sourcePath, outZst, options?)Mutating
archive.extractZst(zstFile, destDir, expectedSha256?)Mutating
archive.createIso(sourcePath, outIso, options?)Mutating
archive.extractIso(isoFile, destDir, expectedSha256?)Mutating
archive.createWim(sourceDir, outWim, options?)Mutating
archive.extractWim(wimFile, destDir, expectedSha256?)Mutating
crypto.sha256File(file)Read-Only
crypto.uuid5(name, nsGuid?)Read-Only
crypto.verifyAuthenticode(peFile)Read-Only
net.download(httpsUrl, destFile, expectedSha256?)Network
net.getJson(httpsUrl)Network
net.probe(httpsUrl)Network
net.isPortFree / net.findFreePortWizard-Safe