@imdt-os/url-tail
v0.0.5
Published
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.
Downloads
23
Readme
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 10s