Skip to main content
The Deno 2 Release Candidate is here
Learn more
class SaveServer
import { SaveServer } from "https://deno.land/x/sptaki@1.2.0/servers/SaveServer.d.ts";

Constructors

new
SaveServer(
vfs: VFS,
saveLoadRouters: SaveLoadRouter[],
jsonUtil: JsonUtil,
hashUtil: HashUtil,
localisationService: LocalisationService,
logger: ILogger,
configServer: ConfigServer,
)

Properties

protected
configServer: ConfigServer
protected
hashUtil: HashUtil
protected
jsonUtil: JsonUtil
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
onBeforeSaveCallbacks: { }
protected
profileFilepath: string
protected
profiles: { }
protected
saveLoadRouters: SaveLoadRouter[]
protected
saveMd5: { }
protected
vfs: VFS

Methods

addBeforeSaveCallback(id: string, callback: (profile: Partial<IAkiProfile>) => Partial<IAkiProfile>): void

Add callback to occur prior to saving profile changes

addProfile(profileDetails: IAkiProfile): void

Add full profile in memory by key (info.id)

createProfile(profileInfo: Info): void

Create a new profile in memory with empty pmc/scav objects

deleteProfileById(sessionID: string): boolean

Delete a profile by id

getProfile(sessionId: string): IAkiProfile

Get a player profile from memory

getProfiles(): Record<string, IAkiProfile>

Get all profiles from memory

load(): void

Load all profiles in /user/profiles folder into memory (this.profiles)

loadProfile(sessionID: string): void

Look up profile json in user/profiles by id and store in memory Execute saveLoadRouters callbacks after being loaded into memory

removeBeforeSaveCallback(id: string): void

Remove a callback from being executed prior to saving profile in SaveServer.saveProfile()

removeProfile(sessionID: string): boolean

Remove a physical profile json from user/profiles

save(): void

Save changes for each profile from memory into user/profiles json

saveProfile(sessionID: string): number

Save changes from in-memory profile to user/profiles json Execute onBeforeSaveCallbacks callbacks prior to being saved to json