FileHelper
The FileHelper offers functionality to work with files.
import { FileHelper } from '@archibald/server';
setRoot
This method sets file root.
import { FileHelper } from '@archibald/server';
FileHelper.setRoot(PARAMETERS);
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| path | string | A file path. | .. |
getRoot
This method returns file root directory for a given type.
import { FileHelper } from '@archibald/server';
const root = FileHelper.getRoot(PARAMETERS);
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| type | DirectoryType | A directory type. | client |
loadFile
This method loads a file or the content of a file.
import { FileHelper } from '@archibald/server';
const file = FileHelper.loadFile(PARAMETERS);
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
| path | string | The path to a file. | |
| content | boolean | ✔️ | Defines if the content of a file should retrieved. |
getConfiguredPath
This method returns configuration path.
import { FileHelper } from '@archibald/server';
const configuredPath = await FileHelper.getConfiguredPath(PARAMETERS);
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
| source | string | The source of the configuration. | |
| platform | string | The name of the platform. | |
| tenant | string | ✔️ | The name of the tenant. |
| fallback | string | ✔️ | The name of the fallback platform. |