1.6.8 • Published 2 years ago

fs-rsync v1.6.8

Weekly downloads
2
License
WTFPL
Repository
github
Last release
2 years 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

2 years ago

1.6.7

9 years ago

1.6.6

9 years ago

1.6.5

9 years ago

1.6.4

9 years ago

1.6.3

9 years ago

1.6.2

9 years ago

1.6.1

9 years ago

1.6.0

9 years ago

1.5.6

9 years ago

1.5.4

9 years ago

1.5.3

9 years ago

1.5.2

9 years ago

1.5.1

9 years ago

1.5.0

9 years ago

1.4.31

9 years ago

1.4.30

9 years ago

1.4.29

9 years ago

1.4.28

9 years ago

1.4.27

9 years ago

1.4.26

9 years ago

1.4.25

9 years ago

1.4.24

9 years ago

1.4.22

9 years ago

1.4.21

10 years ago

1.4.20

10 years ago

1.4.19

10 years ago

1.4.18

10 years ago

1.4.17

10 years ago

1.4.16

10 years ago

1.4.15

10 years ago

1.4.14

10 years ago

1.4.12

10 years ago

1.4.11

10 years ago

1.4.10

10 years ago

1.4.7

10 years ago

1.4.5

10 years ago

1.4.4

10 years ago

1.4.1

10 years ago

1.3.1

10 years ago

1.2.0

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago