status.js 754 B

1234567891011121314151617181920212223242526272829
  1. const fs = require('fs')
  2. const path = require('path')
  3. const log = require('../../util/log')
  4. const plist = require('../../util/plist')
  5. module.exports = {
  6. version: 4,
  7. name: 'backup.status',
  8. description: `Gets a backup's status`,
  9. requiresBackup: true,
  10. // Run on a v3 lib / backup object.
  11. async run (lib, { backup }) {
  12. // Load and parse status for the backup.
  13. log.verbose('parsing status', backup.path)
  14. return plist.parseFile(path.join(backup.path, 'Status.plist'))
  15. },
  16. // Status fields.
  17. output: {
  18. uuid: el => el.UUID,
  19. isFullBackup: el => el.IsFullBackup,
  20. version: el => el.Version, // backup version
  21. backupState: el => el.BackupState,
  22. date: el => el.Date,
  23. snapshotState: el => el.SnapshotState
  24. }
  25. }