rsync-parser
Parses the output of rsync when called with the --itemize-changes
option. This
allows you to programmatically identify files that got created, updated and
deleted. Output can be in the form of strings and streams.
Example
const RsyncItemizeChangesParser = ; let parser = `>f..tp..... LICENSE>f.st...... package.json*deleting package-lock.jsoncd+++++++++ src/>f+++++++++ src/index.js`; // Reads a single token.let token = await parser;if token console; // Iterates over every token.for { }
More examples can be found in the examples
directory.
Install
npm install rsync-parser
Usage
Require the rsync-parser
module to get access to the
RsyncItemizeChangesParser
class.
const RsyncItemizeChangesParser = ;
You can instantiate RsyncItemizeChangesParser
either with a string:
;
Or with a stream:
let rsync = ; let parser = rsyncstdout;
You can then call read
to get tokens. It will return null when no more tokens
are available.
let token; while token = await parser console;
Contributing
The easiest way to contribute is by starring this project on GitHub!
https://github.com/daniel-araujo/node-rsync-parser
If you've found a bug, would like to suggest a feature or need help, feel free to create an issue on GitHub:
https://github.com/daniel-araujo/node-rsync-parser/issues
See also
Deno version of this library: https://deno.land/x/rsync_parser