are-we-there-yet
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
delegates | 1.0.0 | 2.78 kB | MIT | prod | |
readable-stream | 2.3.8 | 25.14 kB | MIT | prod |
"are-we-there-yet" is a handy npm package primarily used to keep track of the completion status of complex hierarchies of asynchronous tasks. This package helps to record and report the progress of different workflows, which are typical in asynchronous programming. Its primary usage is to feed the completion data into one of the progress bar modules. However, the package is versatile and can be utilized as per individual requirements.
To use "are-we-there-yet", firstly, you need to install the package via npm using the following command:
npm install --save are-we-there-yet
Here's an example of how to use "are-we-there-yet" in your JavaScript code:
var TrackerGroup = require("are-we-there-yet").TrackerGroup;
var top = new TrackerGroup("program");
var single = top.newItem("one thing", 100);
single.completeWork(20);
console.log(top.completed()) // It will log 0.2 to the console
fs.stat("file", function(er, stat) {
if (er) throw er;
var stream = top.newStream("file", stat.size);
fs.createReadStream("file").pipe(stream)
.on("data", function (chunk) {
// You can perform actions with each chunk here
})
top.on("change", function(name){
// This callback will get triggered every time a chunk is read from the file
// top.completed() will start at 0.1 and increase up to 0.6 as the file is read
})
})
In this code, "are-we-there-yet" is used to track the progress of reading a file. The script creates a TrackerGroup and starts a new item on it. The completed()
function helps determine the progress of the task.
The documentation for "are-we-there-yet" is available in the README file of its main repository on GitHub where it's maintained. To access the comprehensive documentation, you can visit https://github.com/npm/are-we-there-yet. It provides a complete guide and thorough explanation on how to use "are-we-there-yet", complete with usage instructions, function explanations, and real-world examples.