---
title: "fs | Eidos Docs"
description: "SDK signatures, permissions and behavior for fs."
source: "https://docs.eidos.space/plugins/api/fs/"
lang: "en"
---

# 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](https://docs.eidos.space/plugins/files/). [API index](https://docs.eidos.space/plugins/api/).

Signatures, parameters and return types are generated from the SDK. Optional members are not available in every host and context.

## PluginFileSystem

[Source](https://github.com/mayneyao/eidos/blob/dev/packages/plugin-sdk/src/index.ts#L351)

### PluginFileSystem.readText

Supported hosts: Lite Mobile

Read file text, up to 2 MiB.

```ts
readText(path: string): Promise<string>;
```

| Parameter | Type   | Required |
| --------- | ------ | -------- |
| path      | string | Yes      |

Returns: `Promise<string>`.

### PluginFileSystem.writeText

Supported hosts: Lite Mobile

Write text, creating parent directories when needed.

```ts
writeText(path: string, content: string): Promise<void>;
```

| Parameter | Type   | Required |
| --------- | ------ | -------- |
| path      | string | Yes      |
| content   | string | Yes      |

Returns: `Promise<void>`.

### PluginFileSystem.readBinary

Supported hosts: Lite Mobile

Read file bytes, up to 16 MiB.

```ts
readBinary(path: string): Promise<Uint8Array>;
```

| Parameter | Type   | Required |
| --------- | ------ | -------- |
| path      | string | Yes      |

Returns: `Promise<Uint8Array>`.

### PluginFileSystem.writeBinary

Supported hosts: Lite

Write file bytes, up to 16 MiB.

```ts
writeBinary(path: string, content: Uint8Array): Promise<void>;
```

| Parameter | Type       | Required |
| --------- | ---------- | -------- |
| path      | string     | Yes      |
| content   | Uint8Array | Yes      |

Returns: `Promise<void>`.

### PluginFileSystem.delete

Supported hosts: Lite

Delete a permitted file. Open working copies are protected with BUSY.

```ts
delete(path: string): Promise<void>;
```

| Parameter | Type   | Required |
| --------- | ------ | -------- |
| path      | string | Yes      |

Returns: `Promise<void>`.

### PluginFileSystem.rename

Supported hosts: Lite

Move a regular file within the Space. Existing targets fail with ALREADY\_EXISTS.

```ts
rename(oldPath: string, newPath: string): Promise<void>;
```

| Parameter | Type   | Required |
| --------- | ------ | -------- |
| oldPath   | string | Yes      |
| newPath   | string | Yes      |

Returns: `Promise<void>`.

### PluginFileSystem.list

Supported hosts: Lite Mobile

List permitted files; defaults to recursive, file-only listing. Use includeDirectories for directory trees.

```ts
list(folder?: string, options?: FileListOptions): Promise<FileStat[]>;
```

| Parameter | Type            | Required |
| --------- | --------------- | -------- |
| folder    | string          | No       |
| options   | FileListOptions | No       |

Returns: `Promise<FileStat[]>`.

### PluginFileSystem.stat

Supported hosts: Lite Mobile

Read file metadata; return null if the file is absent.

```ts
stat(path: string): Promise<FileStat | null>;
```

| Parameter | Type   | Required |
| --------- | ------ | -------- |
| path      | string | Yes      |

Returns: `Promise<FileStat &#124; null>`.

### PluginFileSystem.getUrl

Supported hosts: Lite

Get a streaming media URL; omitting path uses the bound file where supported.

```ts
getUrl(path?: string): Promise<string>;
```

| Parameter | Type   | Required |
| --------- | ------ | -------- |
| path      | string | No       |

Returns: `Promise<string>`.

### PluginFileSystem.watch

Supported hosts: Lite Mobile

Subscribe to file or directory changes. Release the returned subscription when finished.

```ts
watch(pathOrFolder: string, listener: () => void): Promise<Disposable>;
```

| Parameter    | Type       | Required |
| ------------ | ---------- | -------- |
| pathOrFolder | string     | Yes      |
| listener     | () => void | Yes      |

Returns: `Promise<Disposable>`.

Related types: [FileListOptions](https://docs.eidos.space/plugins/api/types/#filelistoptions), [FileStat](https://docs.eidos.space/plugins/api/types/#filestat), [Disposable](https://docs.eidos.space/plugins/api/types/#disposable).
