datbot
v0.1.0
Published
Seed a DAT archive and trigger scripts on updates
Downloads
2
Readme
datbot
Seed a DAT archive and trigger scripts on updates
Work In Progress
Installation
npm i datbot
Usage
Use it as a CLI tool or from a Node program using the API.
datbot('dat://dj837h....ew/', (path) => {
if (path.includes('content')) {
return [ 'npm run build' ]
}
}, {
output: '~/.tmp/'
})
CLI
$ datbot <key> [opts] [commands]
options
--help, -h show this help text
--output, -o tell datbot where to download the files
--verbose print to the console
--version, -v print version
example
$ datbot dat://dj837h....ew/ "git add . && git commit -m automatic"
API
datbot(key, reducer(path), ?options, ?callback(exitCodes))
Takes a Dat key
that's forwarded to dat-node
and a reducer
function, that gets a string
containing the path of the currently changed file and returns an Array
of commands (string
). The path here isn't reliable, when many files are changed at the same time.
Optionally you can pass a callback
function, that gets called after each update containing an Array
of exit codes.
Defaults of options
:
{
rate: 2500, // miliseconds between update calls
output: <key> // output directory for the Dat archive
}