cnys main feature allow developers to synchronize files between remote server on change !, what it does:
- ssh/sftp ! 🌐
- Server hoping (netcat) 🔒
- Copy/delete file/folder ! 👓
- Queue / concurrency 🚋
- Ready to use 🔥
If something doesn’t work, please file an issue 🐛.
$ npm install or yarn installThen use it like this :
const cnys = require('cnys');
const config = {
url: '192.168.30.2',
source: 'sync',
destination: '/home/user/sync',
username: 'your_username',
privateKey: true
};
cnys(config);Which is the same as :
$ cnys remote 'sync' '192.168.30.2' '/home/user/sync' --username 'your_username' --privateKey trueStart cnys on a local folder to a local destination :
$ cyns local [source=<sourcePath>] [destination=<destinationpath>]| Options | Description | aliases | type | default |
|---|---|---|---|---|
| verbose | Output action logs. | --v | boolean | false |
| debug | Output debug logs. | --d | boolean | false |
| remove | Enable delete file from destination. | --rm | boolean | true |
| ignored | A glob, regex, function, or array of any combination. | --i | filePattern | null |
| events | An array of event used as liteners. | --e | array | Events |
$ cyns remote [source=<sourcePath>] [url=<urlString>] [destination=<destinationpath>]| Options | Description | aliases | type | default |
|---|---|---|---|---|
| verbose | Output action logs. | --v | boolean | false |
| debug | Output debug logs. | --d | boolean | false |
| concurrency | Number of task that can be done in parallel. | --c | number | 5 |
| remove | Enable delete file from destination. | --rm | boolean | true |
| ignored | A glob, regex, function, or array of any combination. | --i | filePattern | null |
| ncUrl | A netcat url for ssh. (this is your destination). | --nc | string | null |
| username | A username to connect for ssh. | --u | string | null |
| password | A password to connect for ssh. | --pwd | string | null |
| privateKey | Will look for your pka file under ~/.ssh. | --ppk | boolean | false |
| events | An array of event used as liteners. | --e | array | Events |
You may want to look at chokidar, to see what kind of events you could start watching, by default cnys use all events.
$ cnys local 'sync' 'sync2' --v true --ignored '.git*' '*.yml'The example above will start watching file on a folder name sync and copying file into folder sync2
$ cnys remote 'sync' '192.168.30.2' '/home/user/sync' --ncUrl '192.168.30.3' --username 'your_username' --privateKey trueThe example above will start watching file on a folder name sync and copying file to '192.168.30.3' at '/home/user/test'
Use npm test to start testing your file. By default it read test file named *.test.js under /test.
You can easily add your own config by editing package.json
It also has a built-in coverage with npm run coverage
chokidar, a powerfull watcher
Jest, a testing framework
Thanks to Alexandre for the idea.
