Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/kldzj/hubtag

Watch Docker Hub image tag changes
https://github.com/kldzj/hubtag

docker docker-hub docker-image docker-tag node nodejs typescript watcher

Last synced: 22 days ago
JSON representation

Watch Docker Hub image tag changes

Awesome Lists containing this project

README

        

# hubtag

Emit events on Docker Hub image tag changes (currently limited to handle push events).

## Example Usage

```ts
import { TagWatcher } from 'hubtag';

new TagWatcher({ image: 'debian', tag: '10' })
.on('push', (date) => console.log('image tag was updated', date))
.on('error', (e) => console.error(e))
.start();
```

## Configuration

```ts
interface TagWatcherOptions {
/**
* Image name (e.g. `debian` or `containrrr/watchtower`)
*/
image: string;
/**
* Tag name (e.g. `10` or `c0mm17h45h`)
*/
tag: string;
/**
* Interval in ms, defaults to 60 seconds
*/
interval?: number;
}
```

## Events

### `error` -> `(e: Error) => void`

Emits fetcher errors.

### `push` -> `(date: Date) => void`

Emits push events, the `date` parameter is the last pushed timestamp.

### `fetch` -> `(result: any) => void`

Emits successful fetches, the `result` parameter contains the parsed JSON response.

## TagWatcher interface

```ts
interface ITagWatcher {
isWatching: boolean;
on(evt: T, cb: TagWatcherEvents[T]): TagWatcher;
off(evt: T, cb: TagWatcherEvents[T]): TagWatcher;
offAll(evt?: T): TagWatcher;
start(): TagWatcher;
stop(): TagWatcher;
}
```