Skip to content

API Reference

deepEqual

Deep equality comparison for objects that is order-independent.

### Parameters
| Name | Type | Description |
|------|------|-------------|
| `obj1` | `object` | First object to compare. |
| `obj2` | `object` | Second object to compare. |

### Returns
**Type:** `boolean`

- True if objects are deeply equal.

readRestorationState

Reads the restoration state from a JSON file.

### Parameters
| Name | Type | Description |
|------|------|-------------|
| `restorationFile` | `string` | The path to the awaiting-restoration JSON file. |
| `logger` | `object` | The logger instance. |

### Returns
**Type:** `Array`

- Array of restoration entries, or null if file doesn't exist or is empty.

writeRestorationState

Writes the restoration state to a JSON file.

### Parameters
| Name | Type | Description |
|------|------|-------------|
| `data` | `Array` | Array of restoration entries to write. |
| `restorationFile` | `string` | The path to the awaiting-restoration JSON file. |
| `logger` | `object` | The logger instance. |

appendToAwaitingRestoration

Appends or updates restoration information in an awaiting-restoration JSON file.

The entry is identified by matching analysisId, fileName, and options.

### Parameters
| Name | Type | Description |
|------|------|-------------|
| `restorationInfo` | `object` | An object containing restoration details (analysisId, fileName, restoreEstimation, options). |
| `logger` | `object` | The logger instance. |
| `restorationFile` | `string` | Optional path/name for the awaiting restoration JSON file. |

### Returns
**Type:** `Promise.<void>`

removeRestorationEntry

Removes an entry from the restoration state.

### Parameters
| Name | Type | Description |
|------|------|-------------|
| `analysisId` | `string` | The analysis ID to remove. |
| `fileName` | `string` | The file name to remove. |
| `restorationFile` | `string` | The path to the awaiting-restoration JSON file. |
| `logger` | `object` | The logger instance. |

### Returns
**Type:** `boolean`

- True if entry was removed, false if not found.

getReadyEntries

Gets entries that are ready for download (restoration time has passed).

### Parameters
| Name | Type | Description |
|------|------|-------------|
| `restorationFile` | `string` | The path to the awaiting-restoration JSON file. |
| `logger` | `object` | The logger instance. |

### Returns
**Type:** `object`

- Object with ready and pending arrays.

Released under the GPL-3.0 License.