(
/** @type {IFs} */ fs,
/** @type {SnapshotOptions} */ options,
/** @type {(err?: Error | null, snapshot?: Snapshot | null, snapshot2?: Snapshot | null) => void} */ callback
)
| 177 | }; |
| 178 | |
| 179 | const createSnapshot = ( |
| 180 | /** @type {IFs} */ fs, |
| 181 | /** @type {SnapshotOptions} */ options, |
| 182 | /** @type {(err?: Error | null, snapshot?: Snapshot | null, snapshot2?: Snapshot | null) => void} */ callback |
| 183 | ) => { |
| 184 | const fsInfo = createFsInfo(fs); |
| 185 | fsInfo.createSnapshot( |
| 186 | Date.now() + 10000, |
| 187 | files, |
| 188 | directories, |
| 189 | missing, |
| 190 | options, |
| 191 | (err, snapshot) => { |
| 192 | if (err) return callback(err); |
| 193 | /** @type {Snapshot & Record<string, unknown>} */ (snapshot).name = |
| 194 | "initial snapshot"; |
| 195 | // create another one to test the caching |
| 196 | fsInfo.createSnapshot( |
| 197 | Date.now() + 10000, |
| 198 | files, |
| 199 | directories, |
| 200 | missing, |
| 201 | options, |
| 202 | (err, snapshot2) => { |
| 203 | if (err) return callback(err); |
| 204 | /** @type {Snapshot & Record<string, unknown>} */ (snapshot2).name = |
| 205 | "cached snapshot"; |
| 206 | callback(null, snapshot, snapshot2); |
| 207 | } |
| 208 | ); |
| 209 | } |
| 210 | ); |
| 211 | }; |
| 212 | |
| 213 | const clone = (/** @type {Record<string, unknown>} */ object) => { |
| 214 | const serialized = buffersSerializer.serialize(object, {}); |
no test coverage detected