You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* A backup will finish automatically when it succeeds or a fatal
205
+
* error occurs, meaning it is not necessary to call `db.finish()`.
206
+
* By default, SQLITE_LOCKED and SQLITE_BUSY errors are not
207
+
* treated as failures, and the backup will continue if they
208
+
* occur. The set of errors that are tolerated can be controlled
209
+
* by setting `backup.retryErrors`. To disable automatic
210
+
* finishing and stick strictly to sqlite's raw api, set
211
+
* `backup.retryErrors` to `[]`. In that case, it is necessary
212
+
* to call `backup.finish()`.
213
+
*
214
+
* In the same way as node-sqlite3 databases and statements,
215
+
* backup methods can be called safely without callbacks, due
216
+
* to an internal call queue. So for example this naive code
217
+
* will correctly back up a db, if there are no errors:
218
+
*
219
+
* var backup = db.backup('backup.db');
220
+
* backup.step(-1);
221
+
* backup.finish();
222
+
*
223
+
*/
224
+
exportclassBackupextendsevents.EventEmitter{
225
+
/**
226
+
* `true` when the backup is idle and ready for `step()` to be called, `false` when busy.
227
+
*/
228
+
idle: boolean
229
+
230
+
/**
231
+
* `true` when the backup has completed, `false` otherwise.
232
+
*/
233
+
completed: boolean
234
+
235
+
/**
236
+
* `true` when the backup has failed, `false` otherwise.
237
+
*/
238
+
failed: boolean
239
+
240
+
/**
241
+
* The number of remaining pages after the last call to `step()`, or `-1` if `step()` has never been called.
242
+
*/
243
+
remaining: number
244
+
245
+
/**
246
+
* The total number of pages measured during the last call to `step()`, or `-1` if `step()` has never been called.
247
+
*/
248
+
pageCount: number
249
+
250
+
251
+
/**
252
+
* An array of sqlite3 error codes that are treated as non-fatal - meaning, if they occur, `Backup.failed` is not set, and the backup may continue. By default, this is `[sqlite3.BUSY, sqlite3.LOCKED]`.
253
+
*/
254
+
retryErrors: number[]
255
+
256
+
/**
257
+
* Asynchronously finalize the backup (required).
258
+
*
259
+
* @param callback Called when the backup is finalized.
260
+
*/
261
+
finish(callback?: ()=>void): void
262
+
263
+
/**
264
+
* Asynchronously perform an incremental segment of the backup.
265
+
*
266
+
* Example:
267
+
*
268
+
* ```
269
+
* backup.step(5)
270
+
* ```
271
+
*
272
+
* @param nPages Number of pages to process (5 recommended).
273
+
* @param callback Called when the step is completed.
0 commit comments