brctl-monitor

1.0.1 • Public • Published

brctl-monitor

Monitor the CloudDocs deamon. brctl-monitor spawns brctl in monitor mode. Which in turn uses NSMetadataQuery to monitor the chosen container

usage

const Brctl = require(`brctl-monitor`)
 
Brctl()
  .then(brctl => {
    brctl.state.on(`data`, state => {
      console.log(JSON.stringify(state, null, 2))
      // {
      //   "timestamp": "2016-10-07 12:11:27 +0000",
      //   "stats": {
      //     "total": 1,
      //     "updated": 1
      //   },
      //   "files": [
      //     {
      //       "filename": "/test",
      //       "status": {
      //         "availability": {
      //           "local": true,
      //           "remote": true
      //         },
      //         "transfers": {
      //           "up": null,
      //           "down": null
      //         },
      //         "waiting": false,
      //         "error": false,
      //         "raw": " ☁"
      //       }
      //     }
      //   ]
      // }
    })
  })
  .catch(e => console.error(e))

brctl-monitor takes an optional options-object:

to restrict the NSMetadataQuery scope:

Brctl({ scope: `both` || `docs` || `data` })

monitoring a specific container:

Brctl({ container: Brctl.ICLOUD_DRIVE })

Package Sidebar

Install

npm i brctl-monitor

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • rogerbf