An open API service indexing awesome lists of open source software.

https://github.com/kodedninja/datbot

Seed a DAT archive and trigger scripts on updates
https://github.com/kodedninja/datbot

Last synced: 9 months ago
JSON representation

Seed a DAT archive and trigger scripts on updates

Awesome Lists containing this project

README

          

# datbot

Stability

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.

```javascript
datbot('dat://dj837h....ew/', (path) => {
if (path.includes('content')) {
return [ 'npm run build' ]
}
}, {
output: '~/.tmp/'
})
```

## CLI
```
$ datbot [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`](https://npmjs.com/package/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`:

```javascript
{
rate: 2500, // miliseconds between update calls
output: // output directory for the Dat archive
}
```