SaveData
Represents a "save data store".
Properties
Property | Modifier | Type | Description |
---|---|---|---|
applicationId | readonly | bigint | - |
id | readonly | bigint | - |
index | readonly | number | - |
rank | readonly | number | - |
size | readonly | bigint | - |
spaceId | readonly | number | - |
systemId | readonly | bigint | - |
type | readonly | number | - |
uid | readonly | ProfileUid | - |
url | public | null | URL | A URL instance that points to the root of the filesystem mount. You should use this to create file path references within the filesystem mount. Example const dataUrl = new URL('data.json', saveData.url); |
Methods
commit()
commit(): void
Commits to the disk any write operations that have occurred on this filesystem mount since the previous commit.
Failure to call this function after writes will cause the data to be lost after the application exits.
Returns
void
Example
delete()
delete(): void
Deletes the save data store.
This is a destructive operation! Use caution when using this function to avoid accidental data loss, such as prompting the user to confirm the deletion.
Returns
void
extend()
extend(dataSize
, journalSize
): void
Grows a save data store to the requested dataSize
and journalSize
.
Parameters
Parameter | Type | Description |
---|---|---|
dataSize | bigint | |
journalSize | bigint |
Returns
void
freeSpace()
freeSpace(): bigint
Returns
bigint
mount()
mount(name
): URL
Mounts the save data such that filesystem operations may be used.
Parameters
Parameter | Type | Description |
---|---|---|
name | string | The name of the mount for filesystem paths. By default, a random name is generated. Should not exceed 31 characters, and should not have a trailing colon. |
Returns
totalSpace()
totalSpace(): bigint
Returns
bigint
unmount()
unmount(): void
Unmounts the filesystem mount. Any filesytem operations attempting to use the mount path in the future will throw an error.
Returns
void
Example
[iterator]()
Returns
Generator
<SaveData
, void
, unknown
>
createSync()
createSync(init)
static
createSync(init
): SaveData
Parameters
Parameter | Type |
---|---|
init | SaveDataCreationInfoBase |
Returns
createSync(init, nacp)
static
createSync(init
, nacp
): SaveData
Parameters
Parameter | Type |
---|---|
init | SaveDataCreationInfoWithNacp |
nacp | ArrayBuffer |