-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
36 lines (31 loc) · 994 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use strict';
const Client = require('./lib/client');
const Server = require('./lib/server');
const Watcher = require('./lib/watcher');
// Connect to server which is sharing its file system
// url - <string>, server url address
// cb - <Function>, callback
// Returns: <Client>
const connect = (url, cb) => {
const client = new Client();
client.connect(url);
if (cb) client.on('connect', cb);
return client;
};
// Create server to share local file system
// options - <Object>, server options
// port - <number>, listening port,
// optional, default: 8080
// host - <string>, listening host,
// optional, default: 'localhost'
// dir - <string>, path to directory to be synced,
// optional, default: current working directory
// ignore - <RegExp>, regexp for file names,
// which should be ignored, optional
// Returns: <Server>
const share = options => new Server(options);
module.exports = {
connect,
share,
Watcher,
};