Files
dashlibstorage/API.modelvfs.md
2026-10-03 23:13:40 +02:00

100 lines
2.4 KiB
Markdown

# modelvfs
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
## `modelvfs.delete`
*Source: `src/store/modelvfs/delete.js`*
Deletes a virtual file by name for the selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `name` | `string` | File name. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<{deleted: boolean}>`
## `modelvfs.list`
*Source: `src/store/modelvfs/list.js`*
Lists virtual files for the selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<Array<{id: number, company_id: number, name: string, mime: string, meta: any, created_at: string, updated_at: string}>>`
## `modelvfs.read`
*Source: `src/store/modelvfs/read.js`*
Reads a virtual file by name for the selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `name` | `string` | File name. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<{id: number, company_id: number, name: string, mime: string, content: Buffer, meta: any, created_at: string, updated_at: string}>`
**Throws**
`Error` — 'File not found'
## `modelvfs.reset`
*Source: `src/store/modelvfs/reset.js`*
Deletes all virtual files for the selected company (reset VFS).
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<{deletedCount: number}>`
## `modelvfs.write`
*Source: `src/store/modelvfs/write.js`*
Writes (inserts or overwrites) a virtual file for the selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `input` | `object` | |
| `input.name` | `string` | File path/name (e.g. 'candidate.avif', 'report.json'). |
| `[input.mime='application/octet-stream']` | `string` | Mime type. |
| `input.content` | `Buffer|string` | File content buffer or string. |
| `[input.meta]` | `object|string` | Optional metadata object or JSON string. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<object>` — The stored file record metadata.