hubtag
v1.0.0
Published
Emit events on Docker Hub image tag changes (currently limited to handle push events).
Readme
hubtag
Emit events on Docker Hub image tag changes (currently limited to handle push events).
Example Usage
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
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
interface ITagWatcher {
isWatching: boolean;
on<T extends keyof TagWatcherEvents>(evt: T, cb: TagWatcherEvents[T]): TagWatcher;
off<T extends keyof TagWatcherEvents>(evt: T, cb: TagWatcherEvents[T]): TagWatcher;
offAll<T extends keyof TagWatcherEvents>(evt?: T): TagWatcher;
start(): TagWatcher;
stop(): TagWatcher;
}