open-index/open-npm huggingface dataset:
npm package: @octopod-service/notifier
Description: [![npm Version](https://img.shields.io/npm/v/@octopod-service/notifier.svg)](https://www.npmjs.com/package/@octopod-service/notifier)
Author: Adrien Castex
Latest version: 1.0.5

# Notifier for octopod

[![npm Version](https://img.shields.io/npm/v/@octopod-service/notifier.svg)](https://www.npmjs.com/package/@octopod-service/notifier)

## Install

```bash
npm install @octopod-service/notifier
```

## Usage

```javascript
// TypeScript
import * as notifier from '@octopod-service/notifier'
// JavaScript
const notifier = require('@octopod-service/notifier');

const notifierService = new notifier.NotifierService('http://...');

// Set option
notifierService.operations.push({
    type: 'write-file',
    settings: {
        path: '...'
    }
});

notifierService.types['write-file'] = function(type /* : DestinationType*/, data /* : Notification*/, callback /* : () => void*/)
{
    if(!type.settings.path)
    {
        this.error('Error in "write-file"', 'type.settings.path is not defined');
        return callback();
    }

    const retry = () => {
        require('fs').writeFile(type.settings.path, JSON.stringify(data), (e) => {
            if(!e)
                return callback(); // Success!

            this.error('Error in "write-file"', e);
            return setTimetout(() => retry(), type.retryTimeout ? type.retryTimeout : 10000); // If failed, retry later
        })
    }

    retry();
}

notifierService.start();
```

## Call

```javascript
this.writeToService<Notification>('notifier', 'notify', {
    title: 'title',
    body: 'body\r\nbody.',
    notify: {
        node: this.uid,
        type: this.options.username
    }
}, () => { });
```
npm package: @octopod-service/web-getter
Description: [![npm Version](https://img.shields.io/npm/v/@octopod-service/web-getter.svg)](https://www.npmjs.com/package/@octopod-service/web-getter)
Author: Adrien Castex
Latest version: 1.0.5

# web-getter for octopod

[![npm Version](https://img.shields.io/npm/v/@octopod-service/web-getter.svg)](https://www.npmjs.com/package/@octopod-service/web-getter)

Allow to download with a limited frequency a web page. It will queue a request to the service (one queue per hostname) and execute it when the timeout has been reached.

## Install

```bash
npm install @octopod-service/web-getter
```

## Usage

```javascript
// TypeScript
import * as getter from '@octopod-service/web-getter'
// JavaScript
const getter = require('@octopod-service/web-getter');

const service = new getter.GetterService('http://...');
service.start();
```

## Call

```javascript
this.call<GetterServiceResult, GetterServiceRequest>('getter', 'request', {
    url: 'http://...'
}, (response, paths, cleanup) => {
    console.log(response.filePath);

    cleanup();
});
```

```javascript
this.call<GetterServiceDirectResult, GetterServiceRequest>('getter', 'direct', {
    url: 'http://...'
}, (response, paths, cleanup) => {
    console.log(response.body);

    cleanup();
});
```