Updated specs

2025-08-28 00:25:06 +02:00
parent ad12eb30c5
commit cc02426b60

@@ -395,11 +395,11 @@ Read a file as JSON.
api.readJSON(scope, filename, callback); api.readJSON(scope, filename, callback);
``` ```
| Argument | Type | Description | | Argument | Type | Description |
| -------- | --------------------------------- | ------------------------------------------------------------------------ | | -------- | --------------------------------------------- | ------------------------------------------------------- |
| scope | 'static' \| 'module' \| 'channel' | The scope of the file, see [file scopes](./ModuleServerAPI#file-scopes). | | scope | 'static' \| 'module' \| 'channel' \| 'static' | The scope of the file. |
| filename | string | The name of the file. | | filename | string | The name of the file. |
| callback | ( json:any ):void | Function will be called with the JSON once it's loaded. | | callback | ( json:any ):void | Function will be called with the JSON once it's loaded. |
### writeJSON ### writeJSON
@@ -409,12 +409,12 @@ Write a file as JSON.
api.writeJSON(scope, filename, json, callback?); api.writeJSON(scope, filename, json, callback?);
``` ```
| Argument | Type | Description | | Argument | Type | Description |
| ------------------- | --------------------- | ------------------------------------------------------------------------ | | ------------------- | --------------------------------- | ------------------------------------------------ |
| scope | 'module' \| 'channel' | The scope of the file, see [file scopes](./ModuleServerAPI#file-scopes). | | scope | 'module' \| 'channel' \| 'static' | The scope of the file. |
| filename | string | The name of the file. | | filename | string | The name of the file. |
| json | object | The JSON data to write. | | json | object | The JSON data to write. |
| (Optional) callback | function | Function will be called with the JSON was saved. | | (Optional) callback | function | Function will be called with the JSON was saved. |
### writeFile ### writeFile
@@ -426,7 +426,7 @@ api.writeFile(scope, filename, data, options, callback?);
| Argument | Type | Description | | Argument | Type | Description |
| ------------------- | ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | | ------------------- | ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| scope | 'module' \| 'channel' | The scope of the file, see [file scopes](./ModuleServerAPI#file-scopes). | | scope | 'module' \| 'channel' \| 'static' | The scope of the file. |
| filename | string | The name of the file. | | filename | string | The name of the file. |
| data | string \| Buffer \| TypedArray \| DataView \| Object | The data to write. See [fs.writeFile](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback). | | data | string \| Buffer \| TypedArray \| DataView \| Object | The data to write. See [fs.writeFile](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback). |
| options | Object \| string | Writing options/mode to use. See [fs.writeFile](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback). | | options | Object \| string | Writing options/mode to use. See [fs.writeFile](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback). |
@@ -440,11 +440,11 @@ Check if a file exists.
api.fileExists(scope, filename, callback); api.fileExists(scope, filename, callback);
``` ```
| Argument | Type | Description | | Argument | Type | Description |
| -------- | --------------------------------- | ------------------------------------------------------------------------ | | -------- | --------------------------------------------- | ---------------------------------------------------------------- |
| scope | 'static' \| 'module' \| 'channel' | The scope of the file, see [file scopes](./ModuleServerAPI#file-scopes). | | scope | 'static' \| 'module' \| 'channel' \| 'static' | The scope of the file. |
| filename | string | The name of the file. | | filename | string | The name of the file. |
| callback | ( exists:boolean ):void | Function will be called when the file exists check has finished. | | callback | ( exists:boolean ):void | Function will be called when the file exists check has finished. |
### addHost ### addHost
@@ -454,10 +454,10 @@ Make a file accessable through the webserver.
api.addHost(scope, filename); api.addHost(scope, filename);
``` ```
| Argument | Type | Description | | Argument | Type | Description |
| -------- | --------------------- | ------------------------------------------------------------------------ | | -------- | --------------------------------- | ---------------------- |
| scope | 'module' \| 'channel' | The scope of the file, see [file scopes](./ModuleServerAPI#file-scopes). | | scope | 'module' \| 'channel' \| 'static' | The scope of the file. |
| filename | string | The name of the file. | | filename | string | The name of the file. |
\*_Returns_ { hostID:string, relativeUrl:string, downloadUrl:string } _The data of the hosted file._ \*_Returns_ { hostID:string, relativeUrl:string, downloadUrl:string } _The data of the hosted file._