Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 609 Bytes

README.md

File metadata and controls

27 lines (20 loc) · 609 Bytes

url-tail

This package allows you to monitor changes to a remote file using polling of an external URL.

This polling uses HTTP range, so only new data is transferred.

Usage

npm install @imdt-os/url-tail

Sample code

const urlTail = require('@imdt-os/url-tail');
const destroy = urlTail("http://127.0.0.1/log.txt", ()=>{
    console.error("Error");
}, (newData, reset)=>{
    if(reset){
        console.log("Discard old data - file was truncated");
    }
    console.log("New data available", newData);
}, {debug: false});

setTimeout( destroy, 60000 ); // Destroy it after 60s