Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/kldzj/hubtag
- Owner: kldzj
- Created: 2021-03-24T11:44:37.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-24T11:54:26.000Z (almost 4 years ago)
- Last Synced: 2024-12-20T00:13:04.255Z (22 days ago)
- Topics: docker, docker-hub, docker-image, docker-tag, node, nodejs, typescript, watcher
- Language: TypeScript
- Homepage: https://npmjs.com/package/hubtag
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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;
}
```