1.6.8 • Published 1 year ago

fs-rsync v1.6.8

Weekly downloads
2
License
WTFPL
Repository
github
Last release
1 year ago

fs-rsync

node-browserfs extension for web clients to sync with remote files

constructor(fs, connection)

var fs = new browserfs(), 
  connection = FSRCON.Client();
..  
var rsync = new FSRSYNC(fs, connection);

syncDir(path, options, callback)

synchronizes a local fs with a remote fs directory

rsync.syncDir('/dirA', {recursive: true}, function (err) {
  if (err) {
    console.error(err);
  }
  ..
});

options.recursive: if truthy, synchronizes the directory recursively. default false.

syncFile(filename, callback)

synchronize a single file

rsync.syncFile('/file0', function (err) {
  ..
});

Example

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <script src="require.js"></script>
    <script>

    requirejs.config({
      'baseUrl': './',
      'paths': {
        'browserfs': '../node-browserfs/browserfs'
        'fs-rsync': '../fs-rsync',
        'fs-rpc': '../fs-rpc/fs-rpc',
        'fs-rcon': '../fs-rcon/fs-rcon'
      }
    });

    require([
        'browserfs'
        'fs-rsync',
        'fs-rcon'
      ], 
      function (
        browserfs, 
        FSRSYNC,
        FSRCON
      ) {

      var fs = new browserfs(), 
        connection = FSRCON.Client(),
        rsync = new FSRSYNC(fs, connection);

      connection.init('fsrcon/init')
        .then(
          function () {
            console.info('connected');

            rsync.syncDir('/', function (err) {
              if (err) {
                console.error(err);
              }
              fs.stat('/', function (err, files) {
                console.log(files);
              });
            });

          },
          function (err) {
            window.alert('failed to connect to server: ' + err.message);
            console.error(err);
          }
        );
      };
    
    });

    </script>
  </head>
  <body></body>
</html>        

test

start test server

$ npm test
->  test server listening at http://127.0.0.1:3000
    open specs at url file:///home/customer/projekte/fs-rsync/test/index.html in browser
    or example at file:///home/customer/projekte/fs-rsync/example/index.html in browser

License

WTFPL

1.6.8

1 year ago

1.6.7

8 years ago

1.6.6

8 years ago

1.6.5

8 years ago

1.6.4

8 years ago

1.6.3

8 years ago

1.6.2

8 years ago

1.6.1

8 years ago

1.6.0

8 years ago

1.5.6

8 years ago

1.5.4

8 years ago

1.5.3

8 years ago

1.5.2

8 years ago

1.5.1

8 years ago

1.5.0

8 years ago

1.4.31

8 years ago

1.4.30

8 years ago

1.4.29

8 years ago

1.4.28

8 years ago

1.4.27

8 years ago

1.4.26

8 years ago

1.4.25

8 years ago

1.4.24

8 years ago

1.4.22

8 years ago

1.4.21

8 years ago

1.4.20

8 years ago

1.4.19

8 years ago

1.4.18

8 years ago

1.4.17

8 years ago

1.4.16

8 years ago

1.4.15

8 years ago

1.4.14

8 years ago

1.4.12

8 years ago

1.4.11

8 years ago

1.4.10

8 years ago

1.4.7

8 years ago

1.4.5

8 years ago

1.4.4

8 years ago

1.4.1

8 years ago

1.3.1

8 years ago

1.2.0

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago