fs
Lite filesystem access is host-mediated. Space-wide reads require workspace.files; writes also require contribution write access. Text reads are limited to 2 MiB; binary I/O to 16 MiB. getUrl streams media. Direct mutation of an open working copy fails with BUSY; rename rejects existing targets with ALREADY_EXISTS.
Usage guide: files. API index.
Signatures, parameters and return types are generated from the SDK. Optional members are not available in every host and context.
PluginFileSystem
Section titled “PluginFileSystem”PluginFileSystem.readText
Section titled “PluginFileSystem.readText”Supported hosts: Lite Mobile
Read file text, up to 2 MiB.
readText(path: string): Promise<string>;| Parameter | Type | Required |
|---|---|---|
path |
string |
Yes |
Returns: Promise<string>.
PluginFileSystem.writeText
Section titled “PluginFileSystem.writeText”Supported hosts: Lite Mobile
Write text, creating parent directories when needed.
writeText(path: string, content: string): Promise<void>;| Parameter | Type | Required |
|---|---|---|
path |
string |
Yes |
content |
string |
Yes |
Returns: Promise<void>.
PluginFileSystem.readBinary
Section titled “PluginFileSystem.readBinary”Supported hosts: Lite Mobile
Read file bytes, up to 16 MiB.
readBinary(path: string): Promise<Uint8Array>;| Parameter | Type | Required |
|---|---|---|
path |
string |
Yes |
Returns: Promise<Uint8Array>.
PluginFileSystem.writeBinary
Section titled “PluginFileSystem.writeBinary”Supported hosts: Lite
Write file bytes, up to 16 MiB.
writeBinary(path: string, content: Uint8Array): Promise<void>;| Parameter | Type | Required |
|---|---|---|
path |
string |
Yes |
content |
Uint8Array |
Yes |
Returns: Promise<void>.
PluginFileSystem.delete
Section titled “PluginFileSystem.delete”Supported hosts: Lite
Delete a permitted file. Open working copies are protected with BUSY.
delete(path: string): Promise<void>;| Parameter | Type | Required |
|---|---|---|
path |
string |
Yes |
Returns: Promise<void>.
PluginFileSystem.rename
Section titled “PluginFileSystem.rename”Supported hosts: Lite
Move a regular file within the Space. Existing targets fail with ALREADY_EXISTS.
rename(oldPath: string, newPath: string): Promise<void>;| Parameter | Type | Required |
|---|---|---|
oldPath |
string |
Yes |
newPath |
string |
Yes |
Returns: Promise<void>.
PluginFileSystem.list
Section titled “PluginFileSystem.list”Supported hosts: Lite Mobile
List permitted files; defaults to recursive, file-only listing. Use includeDirectories for directory trees.
list(folder?: string, options?: FileListOptions): Promise<FileStat[]>;| Parameter | Type | Required |
|---|---|---|
folder |
string |
No |
options |
FileListOptions |
No |
Returns: Promise<FileStat[]>.
PluginFileSystem.stat
Section titled “PluginFileSystem.stat”Supported hosts: Lite Mobile
Read file metadata; return null if the file is absent.
stat(path: string): Promise<FileStat | null>;| Parameter | Type | Required |
|---|---|---|
path |
string |
Yes |
Returns: Promise<FileStat | null>.
PluginFileSystem.getUrl
Section titled “PluginFileSystem.getUrl”Supported hosts: Lite
Get a streaming media URL; omitting path uses the bound file where supported.
getUrl(path?: string): Promise<string>;| Parameter | Type | Required |
|---|---|---|
path |
string |
No |
Returns: Promise<string>.
PluginFileSystem.watch
Section titled “PluginFileSystem.watch”Supported hosts: Lite Mobile
Subscribe to file or directory changes. Release the returned subscription when finished.
watch(pathOrFolder: string, listener: () => void): Promise<Disposable>;| Parameter | Type | Required |
|---|---|---|
pathOrFolder |
string |
Yes |
listener |
() => void |
Yes |
Returns: Promise<Disposable>.
Related types: FileListOptions, FileStat, Disposable.