UNPKG

als-store

Version:

Library for streamlined file management and advanced data caching, featuring intelligent file searching, dynamic cache control, and flexible file operations

36 lines (25 loc) 1.98 kB
### Getters and Setters in the `File` Class #### `schema` (Getter and Setter) - **Getter**: Returns the current schema of the file, which is used for data validation and management. - **Setter**: Sets a new schema for the file. If provided, the schema is used to transform the file name into parameters and vice versa, allowing the organization and validation of file data according to a specified format. #### `name` (Getter and Setter) - **Getter**: Returns the current name of the file. - **Setter**: Sets a new name for the file. Validates whether the new file name meets the standards. On successful name change, updates the cache size and removes the old name from the cache. #### `params` (Getter) - **Getter**: Returns the file's parameters extracted from its name using the current schema. #### `$name` (Getter) - **Getter**: Returns the file name, which can be constructed from the file's parameters if a schema is provided. #### `fullPath` and `$fullPath` (Getters) - **`fullPath` Getter**: Returns the full path to the file, combining the specified path and the current file name. Validates the generated path. - **`$fullPath` Getter**: Similar to `fullPath`, but uses `$name` (potentially modified name) to form the path. #### `buffer` (Getter) - **Getter**: Returns the file's content buffer, if it has been loaded. #### `value` (Getter and Setter) - **Getter**: Returns the file's content as a `utf-8` string, if available. - **Setter**: Sets a new string value for the file, converting it to a buffer and marking the file as modified. - Can get value as buffer #### `json` (Getter and Setter) - **Getter**: Returns the file's content converted to JSON, if available. - **Setter**: Sets new file content in JSON format, converting it to a string before saving. #### `stats` (Getter) - **Getter**: Provides file statistics, such as size, access time, modification time, and creation time, if they have been loaded.