From f70864a0db9ca79a527dbd12b99d82ebd4884e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Wed, 26 Nov 2025 12:46:03 -0600 Subject: [PATCH] feat: vfs file --- packages/core/src/steam/vfs.ts | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/packages/core/src/steam/vfs.ts b/packages/core/src/steam/vfs.ts index b6ef72cc9..01516af6c 100644 --- a/packages/core/src/steam/vfs.ts +++ b/packages/core/src/steam/vfs.ts @@ -1,4 +1,3 @@ -import { writeFile } from "fs/promises"; import SteamUser, { EConnectionProtocol } from "steam-user"; interface SteamManifestFile { @@ -52,12 +51,14 @@ export class SteamVFS { const productInfo = await this.steam.getProductInfo([this.app], []); const manifest: SteamManifest = await new Promise((resolve) => { + // @ts-expect-error this.steam.getManifest( this.app, this.depot, productInfo.apps[this.app].appinfo.depots[this.depot].manifests.public .gid, "public", + // @ts-expect-error (_, response) => { resolve(response); } @@ -71,8 +72,28 @@ export class SteamVFS { this.manifest.set(path, file); } - writeFile("test.txt", paths.sort().join("\n")); + return this; + } - console.log(JSON.stringify(manifest.files[0], null, 2)); + async file(path: string) { + if (!this.manifest.has(path)) { + throw new Error(`File not found: ${path}`); + } + + const fileManifest = this.manifest.get(path)!; + + const downloaded: { type: "complete"; file: Buffer } = + // @ts-expect-error + await this.steam.downloadFile(this.app, this.depot, fileManifest); + + return new Uint8Array(downloaded.file); + } + + dispose() { + this.steam.logOff(); + } + + [Symbol.dispose]() { + this.dispose(); } }