0.1.0 • Published 5 years ago

dxlibs-waitfs v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

dxlibs-waitfs v0.1.0

Espera por la existencia o eliminación de un archivo

Scripts

npm run eslint
npm test
npm run test-watch
npm run sonar

Instalación

Como libreria

npm install --save dxlibs-waitfs

Modo de uso

const wait = require("dxlibs-waitfs");
const filename = './archivo.txt';
const timeout = 10000;

wait
    .forCreate(filename, timeout)
    .then(ok => {
        if(!ok) throw new Error('Timeout!');

        console.log(`${filename} existe!`);
        return ok;
    })
    .catch(ex => {
        console.log(`ERROR: ${err}`);
    });

wait
    .forRemove(filename, timeout)
    .then(ok => {
        if(!ok) throw new Error('Timeout!');

        console.log(`${filename} fue eliminado!`);
        return ok;
    })
    .catch(ex => {
        console.log(`ERROR: ${err}`);
    });

0.1.0

5 years ago