1.0.1 • Published 12 months ago
response-timer-package v1.0.1
You can use this package on any request / function / script that you want to see how much time it took to finish
Example usage :
const timer = require('response-timer-package');
async function main() { timer.start(); // here we are starting the timer
return new Promise((resolve) => { setTimeout(() => { const timeTaken = timer.stop(); // here we are stopping the timer and getting the time it took the script / function / request to run resolve(timeTaken); }, 5000); }); }
main().then((timeTaken) => {
console.log(Time taken: ${timeTaken} seconds
);
}).catch((error) => {
console.error(Error: ${error.message}
);
});