Lightweight asynchronous Syncthing integration for nodejs.
npm install node-syncthing --save
var syncthing = require('node-syncthing');
syncthing.init(options, callback);
Options: object
- hostname: domain or ip address (defaults to 'localhost')
- port: port number (defaults to '8384')
- apikey: full API key
Callback: function
- Function containing a single argument which returns true or false depending on the success of the initiation.
syncthing.endpoint.action(options, callback);
example: syncthing.db.status( folder, callback );
Information about options: Syncthing API
Endpoints: endpoint/actions (options)
- System (system)
- ping
- shutdown
- restart
- version
- status
- connections
- getConfig
- setConfig (config)
- debug
- getDiscovery
- setDiscovery (device, address)
- errors
- clearErrors
- logs
- getUpgrade
- setUpgrade
- Database (db)
- scan (folder)
- status (folder)
- browse (folder, levels, subdir) subdir comes behind callback!
- completion (device, folder)
- file (folder, file)
- getIgnores
- setIgnores (folder, ignores)
- need (folder)
- prio (folder, file)
- Statistics (stats)
- devices
- folders
- Misc (misc)
- folders (device)
- lang
- report
The actions return a callback containing:
- Data argument:
- status: http status code
- id: syncthing id
- version: syncthing version
- date: ex. (Thu, 01 Jan 1970 00:00:00 GMT-0400)
- body: api response
- An argument for every option that has been given when calling the action containing the original send option.
- ex.
this would log:syncthing.db.browse("randomFolder", 0, function(data, folder, levels){ console.log(folder+", "+levels); });
randomFolder, 0