{
  "_from": "are-we-there-yet@~1.1.2",
  "_id": "are-we-there-yet@1.1.2",
  "_location": "/fsevents/are-we-there-yet",
  "_nodeVersion": "4.2.2",
  "_npmOperationalInternal": {
    "host": "packages-13-west.internal.npmjs.com",
    "tmp": "tmp/are-we-there-yet-1.1.2.tgz_1458084397358_0.15847722673788667"
  },
  "_npmUser": {
    "email": "me@re-becca.org",
    "name": "iarna"
  },
  "_npmVersion": "3.8.1",
  "_phantomChildren": {},
  "_requiredBy": [
    "/fsevents/npmlog"
  ],
  "_resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.2.tgz",
  "_shasum": "80e470e95a084794fe1899262c5667c6e88de1b3",
  "_shrinkwrap": null,
  "author": {
    "name": "Rebecca Turner",
    "url": "http://re-becca.org"
  },
  "bugs": {
    "url": "https://github.com/iarna/are-we-there-yet/issues"
  },
  "dependencies": {
    "delegates": "^1.0.0",
    "readable-stream": "^2.0.0 || ^1.1.13"
  },
  "description": "Keep track of the overall completion of many dispirate processes",
  "devDependencies": {
    "standard": "^6.0.8",
    "tap": "^5.7.0"
  },
  "directories": {},
  "dist": {
    "shasum": "80e470e95a084794fe1899262c5667c6e88de1b3",
    "tarball": "http://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.2.tgz"
  },
  "gitHead": "dd5706e2204cb681e78031d0ffe156ed4cc75823",
  "homepage": "https://github.com/iarna/are-we-there-yet",
  "license": "ISC",
  "main": "index.js",
  "maintainers": [
    {
      "email": "me@re-becca.org",
      "name": "iarna"
    }
  ],
  "name": "are-we-there-yet",
  "optionalDependencies": {},
  "readme": "are-we-there-yet\n----------------\n\nTrack complex hiearchies of asynchronous task completion statuses.  This is\nintended to give you a way of recording and reporting the progress of the big\nrecursive fan-out and gather type workflows that are so common in async.\n\nWhat you do with this completion data is up to you, but the most common use case is to\nfeed it to one of the many progress bar modules.\n\nMost progress bar modules include a rudamentary version of this, but my\nneeds were more complex.\n\nUsage\n=====\n\n```javascript\nvar TrackerGroup = require(\"are-we-there-yet\").TrackerGroup\n\nvar top = new TrackerGroup(\"program\")\n\nvar single = top.newItem(\"one thing\", 100)\nsingle.completeWork(20)\n\nconsole.log(top.completed()) // 0.2\n\nfs.stat(\"file\", function(er, stat) {\n  if (er) throw er  \n  var stream = top.newStream(\"file\", stat.size)\n  console.log(top.completed()) // now 0.1 as single is 50% of the job and is 20% complete\n                              // and 50% * 20% == 10%\n  fs.createReadStream(\"file\").pipe(stream).on(\"data\", function (chunk) {\n    // do stuff with chunk\n  })\n  top.on(\"change\", function (name) {\n    // called each time a chunk is read from \"file\"\n    // top.completed() will start at 0.1 and fill up to 0.6 as the file is read\n  })\n})\n```\n\nShared Methods\n==============\n\nAll tracker objects described below have the following methods, they, along\nwith the event comprise the interface for consumers of tracker objects.\n\n* var completed = tracker.completed()\n\nReturns the ratio of completed work to work to be done. Range of 0 to 1.\n\n* tracker.finish()\n\nMarks the tracker as completed. With a TrackerGroup this marks all of its\ncomponents as completed.\n\nMarks all of the components of this tracker as finished, which in turn means\nthat `tracker.completed()` for this will now be 1.\n\nThis will result in one or more `change` events being emitted.\n\nEvents\n======\n\nAll tracker objects emit `change` events with the following arguments:\n\n```\nfunction (name, completed, tracker)\n```\n\n`name` is the name of the tracker that originally emitted the event,\nor if it didn't have one, the first containing tracker group that had one.\n\n`completed` is the percent complete (as returned by `tracker.completed()` method).\n\n`tracker` is the tracker object that you are listening for events on.\n\nTrackerGroup\n============\n\n* var tracker = new TrackerGroup(**name**)\n\n  * **name** *(optional)* - The name of this tracker group, used in change\n    notifications if the component updating didn't have a name. Defaults to undefined.\n\nCreates a new empty tracker aggregation group. These are trackers whose\ncompletion status is determined by the completion status of other trackers.\n\n* tracker.addUnit(**otherTracker**, **weight**)\n\n  * **otherTracker** - Any of the other are-we-there-yet tracker objects\n  * **weight** *(optional)* - The weight to give the tracker, defaults to 1.\n\nAdds the **otherTracker** to this aggregation group. The weight determines\nhow long you expect this tracker to take to complete in proportion to other\nunits.  So for instance, if you add one tracker with a weight of 1 and\nanother with a weight of 2, you're saying the second will take twice as long\nto complete as the first.  As such, the first will account for 33% of the\ncompletion of this tracker and the second will account for the other 67%.\n\nReturns **otherTracker**.\n\n* var subGroup = tracker.newGroup(**name**, **weight**)\n\nThe above is exactly equivalent to:\n\n```javascript\n  var subGroup = tracker.addUnit(new TrackerGroup(name), weight)\n```\n\n* var subItem = tracker.newItem(**name**, **todo**, **weight**)\n\nThe above is exactly equivalent to:\n\n```javascript\n  var subItem = tracker.addUnit(new Tracker(name, todo), weight)\n```\n\n* var subStream = tracker.newStream(**name**, **todo**, **weight**)\n\nThe above is exactly equivalent to:\n\n```javascript\n  var subStream = tracker.addUnit(new TrackerStream(name, todo), weight)\n```\n\n* console.log( tracker.debug() )\n\nReturns a tree showing the completion of this tracker group and all of its\nchildren, including recursively entering all of the children.\n\nTracker\n=======\n\n* var tracker = new Tracker(**name**, **todo**)\n\n  * **name** *(optional)* The name of this counter to report in change\n    events.  Defaults to undefined.\n  * **todo** *(optional)* The amount of work todo (a number). Defaults to 0.\n\nOrdinarily these are constructed as a part of a tracker group (via\n`newItem`).\n\n* var completed = tracker.completed()\n\nReturns the ratio of completed work to work to be done. Range of 0 to 1. If\ntotal work to be done is 0 then it will return 0.\n\n* tracker.addWork(**todo**)\n\n  * **todo** A number to add to the amount of work to be done.\n\nIncreases the amount of work to be done, thus decreasing the completion\npercentage.  Triggers a `change` event.\n\n* tracker.completeWork(**completed**)\n\n  * **completed** A number to add to the work complete\n\nIncrease the amount of work complete, thus increasing the completion percentage.\nWill never increase the work completed past the amount of work todo. That is,\npercentages > 100% are not allowed. Triggers a `change` event.\n\n* tracker.finish()\n\nMarks this tracker as finished, tracker.completed() will now be 1. Triggers\na `change` event.\n\nTrackerStream\n=============\n\n* var tracker = new TrackerStream(**name**, **size**, **options**)\n\n  * **name** *(optional)* The name of this counter to report in change\n    events.  Defaults to undefined.\n  * **size** *(optional)* The number of bytes being sent through this stream.\n  * **options** *(optional)* A hash of stream options\n\nThe tracker stream object is a pass through stream that updates an internal\ntracker object each time a block passes through.  It's intended to track\ndownloads, file extraction and other related activities. You use it by piping\nyour data source into it and then using it as your data source.\n\nIf your data has a length attribute then that's used as the amount of work\ncompleted when the chunk is passed through.  If it does not (eg, object\nstreams) then each chunk counts as completing 1 unit of work, so your size\nshould be the total number of objects being streamed.\n\n* tracker.addWork(**todo**)\n\n  * **todo** Increase the expected overall size by **todo** bytes.\n\nIncreases the amount of work to be done, thus decreasing the completion\npercentage.  Triggers a `change` event.\n",
  "readmeFilename": "README.md",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/iarna/are-we-there-yet.git"
  },
  "scripts": {
    "test": "standard && tap test/*.js"
  },
  "version": "1.1.2"
}
