+++ /dev/null
-{
- "libs": [
- ],
- "plugins": {
- "node": {}
- }
-}
\ No newline at end of file
--- /dev/null
+### v1.4.28 (2014-09-12):
+
+* [`f4540b6`](https://github.com/npm/npm/commit/f4540b6537a87e653d7495a9ddcf72949fdd4d14)
+ [#6043](https://github.com/npm/npm/issues/6043) defer rollbacks until just
+ before the CLI exits ([@isaacs](https://github.com/isaacs))
+* [`1eabfd5`](https://github.com/npm/npm/commit/1eabfd5c03f33c2bd28823714ff02059eeee3899)
+ [#6043](https://github.com/npm/npm/issues/6043) `slide@1.1.6`: wait until all
+ callbacks have finished before proceeding
+ ([@othiym23](https://github.com/othiym23))
+
+### v1.4.27 (2014-09-04):
+
+* [`4cf3c8f`](https://github.com/npm/npm/commit/4cf3c8fd78c9e2693a5f899f50c28f4823c88e2e)
+ [#6007](https://github.com/npm/npm/issues/6007) `request@2.42.0`: properly set
+ headers on proxy requests ([@isaacs](https://github.com/isaacs))
+* [`403cb52`](https://github.com/npm/npm/commit/403cb526be1472bb7545fa8e62d4976382cdbbe5)
+ [#6055](https://github.com/npm/npm/issues/6055) `npmconf@1.1.8`: restore
+ case-insensitivity of environmental config
+ ([@iarna](https://github.com/iarna))
+
+### v1.4.26 (2014-08-28):
+
+* [`eceea95`](https://github.com/npm/npm/commit/eceea95c804fa15b18e91c52c0beb08d42a3e77d)
+ `github-url-from-git@1.4.0`: add support for git+https and git+ssh
+ ([@stefanbuck](https://github.com/stefanbuck))
+* [`e561758`](https://github.com/npm/npm/commit/e5617587e7d7ab686192391ce55357dbc7fed0a3)
+ `columnify@1.2.1` ([@othiym23](https://github.com/othiym23))
+* [`0c4fab3`](https://github.com/npm/npm/commit/0c4fab372ee76eab01dda83b6749429a8564902e)
+ `cmd-shim@2.0.0`: upgrade to graceful-fs 3
+ ([@ForbesLindesay](https://github.com/ForbesLindesay))
+* [`2d69e4d`](https://github.com/npm/npm/commit/2d69e4d95777671958b5e08d3b2f5844109d73e4)
+ `github-url-from-username-repo@1.0.0`: accept slashes in branch names
+ ([@robertkowalski](https://github.com/robertkowalski))
+* [`81f9b2b`](https://github.com/npm/npm/commit/81f9b2bac9d34c223ea093281ba3c495f23f10d1)
+ ensure lifecycle spawn errors caught properly
+ ([@isaacs](https://github.com/isaacs))
+* [`bfaab8c`](https://github.com/npm/npm/commit/bfaab8c6e0942382a96b250634ded22454c36b5a)
+ `npm-registry-client@2.0.7`: properly encode % in passwords
+ ([@isaacs](https://github.com/isaacs))
+* [`91cfb58`](https://github.com/npm/npm/commit/91cfb58dda851377ec604782263519f01fd96ad8)
+ doc: Fix 'npm help index' ([@isaacs](https://github.com/isaacs))
+
+### v1.4.25 (2014-08-21):
+
+* [`64c0ec2`](https://github.com/npm/npm/commit/64c0ec241ef5d83761ca8de54acb3c41b079956e)
+ `npm-registry-client@2.0.6`: Print the notification header returned by the
+ registry, and make sure status codes are printed without gratuitous quotes
+ around them.
+ ([@othiym23](https://github.com/othiym23))
+* [`a8ed12b`](https://github.com/npm/npm/commit/a8ed12b) `tar@1.0.1`:
+ Add test for removing an extract target immediately after unpacking.
+ ([@isaacs](https://github.com/isaacs))
+* [`70fd11d`](https://github.com/npm/npm/commit/70fd11d)
+ `lockfile@1.0.0`: Fix incorrect interaction between `wait`, `stale`,
+ and `retries` options. Part 2 of race condition leading to `ENOENT`
+ errors.
+ ([@isaacs](https://github.com/isaacs))
+* [`0072c4d`](https://github.com/npm/npm/commit/0072c4d)
+ `fstream@1.0.2`: Fix a double-finish call which can result in excess
+ FS operations after the `close` event. Part 2 of race condition
+ leading to `ENOENT` errors.
+ ([@isaacs](https://github.com/isaacs))
+
+### v1.4.24 (2014-08-14):
+
+* [`9344bd9`](https://github.com/npm/npm/commit/9344bd9b2929b5c399a0e0e0b34d45bce7bc24bb)
+ doc: add new changelog ([@othiym23](https://github.com/othiym23))
+* [`4be76fd`](https://github.com/npm/npm/commit/4be76fd65e895883c337a99f275ccc8c801adda3)
+ doc: update version doc to include `pre-*` increment args
+ ([@isaacs](https://github.com/isaacs))
+* [`e4f2620`](https://github.com/npm/npm/commit/e4f262036080a282ad60e236a9aeebd39fde9fe4)
+ build: add `make tag` to tag current release as `latest`
+ ([@isaacs](https://github.com/isaacs))
+* [`ec2596a`](https://github.com/npm/npm/commit/ec2596a7cb626772780b25b0a94a7e547a812bd5)
+ build: publish with `--tag=v1.4-next` ([@isaacs](https://github.com/isaacs))
+* [`9ee55f8`](https://github.com/npm/npm/commit/9ee55f892b8b473032a43c59912c5684fd1b39e6)
+ build: add script to output `v1.4-next` publish tag
+ ([@isaacs](https://github.com/isaacs))
+* [`aecb56f`](https://github.com/npm/npm/commit/aecb56f95a84687ea46920a0b98aaa587fee1568)
+ build: remove outdated `docpublish` make target
+ ([@isaacs](https://github.com/isaacs))
+* [`b57a9b7`](https://github.com/npm/npm/commit/b57a9b7ccd13e6b38831ed63595c8ea5763da247)
+ build: remove unpublish step from `make publish`
+ ([@isaacs](https://github.com/isaacs))
+* [`2c6acb9`](https://github.com/npm/npm/commit/2c6acb96c71c16106965d5cd829b67195dd673c7)
+ install: rename `.gitignore` when unpacking foreign tarballs
+ ([@isaacs](https://github.com/isaacs))
+* [`22f3681`](https://github.com/npm/npm/commit/22f3681923e993a47fc1769ba735bfa3dd138082)
+ cache: detect non-gzipped tar files more reliably
+ ([@isaacs](https://github.com/isaacs))
+
+### v2.0.0-alpha-6 (2014-07-31):
+
+* [`d987707`](https://github.com/npm/npm/commit/d987707) move fetch into
+ npm-registry-client ([@othiym23](https://github.com/othiym23))
+* [`9b318e2`](https://github.com/npm/npm/commit/9b318e2) `read-installed@3.0.0`
+ ([@isaacs](https://github.com/isaacs))
+* [`9d73de7`](https://github.com/npm/npm/commit/9d73de7) remove unnecessary
+ mkdirps ([@isaacs](https://github.com/isaacs))
+* [`ea547e2`](https://github.com/npm/npm/commit/ea547e2) Bump semver to version 3
+ ([@isaacs](https://github.com/isaacs))
+* [`33ccd13`](https://github.com/npm/npm/commit/33ccd13) Don't squash execute
+ perms in `_git-remotes/` dir ([@adammeadows](https://github.com/adammeadows))
+* [`48fd233`](https://github.com/npm/npm/commit/48fd233) `npm-package-arg@2.0.1`
+ ([@isaacs](https://github.com/isaacs))
+
+### v1.4.23 (2014-07-31):
+
+* [`8dd11d1`](https://github.com/npm/npm/commit/8dd11d1) update several
+ dependencies to avoid using `semver`s starting with 0.
+
+### v1.4.22 (2014-07-31):
+
+* [`d9a9e84`](https://github.com/npm/npm/commit/d9a9e84) `read-package-json@1.2.4`
+ ([@isaacs](https://github.com/isaacs))
+* [`86f0340`](https://github.com/npm/npm/commit/86f0340)
+ `github-url-from-git@1.2.0` ([@isaacs](https://github.com/isaacs))
+* [`a94136a`](https://github.com/npm/npm/commit/a94136a) `fstream@0.1.29`
+ ([@isaacs](https://github.com/isaacs))
+* [`bb82d18`](https://github.com/npm/npm/commit/bb82d18) `glob@4.0.5`
+ ([@isaacs](https://github.com/isaacs))
+* [`5b6bcf4`](https://github.com/npm/npm/commit/5b6bcf4) `cmd-shim@1.1.2`
+ ([@isaacs](https://github.com/isaacs))
+* [`c2aa8b3`](https://github.com/npm/npm/commit/c2aa8b3) license: Cleaned up
+ legalese with actual lawyer ([@isaacs](https://github.com/isaacs))
+* [`63fe0ee`](https://github.com/npm/npm/commit/63fe0ee) `init-package-json@1.0.0`
+ ([@isaacs](https://github.com/isaacs))
+
+### v2.0.0-alpha-5 (2014-07-22):
+
+This release bumps up to 2.0 because of this breaking change, which could
+potentially affect how your package's scripts are run:
+
+* [`df4b0e7`](https://github.com/npm/npm/commit/df4b0e7fc1abd9a54f98db75ec9e4d03d37d125b)
+ [#5518](https://github.com/npm/npm/issues/5518) BREAKING CHANGE: support
+ passing arguments to `run` scripts ([@bcoe](https://github.com/bcoe))
+
+Other changes:
+
+* [`cd422c9`](https://github.com/npm/npm/commit/cd422c9de510766797c65720d70f085000f50543)
+ [#5748](https://github.com/npm/npm/issues/5748) link binaries for scoped
+ packages ([@othiym23](https://github.com/othiym23))
+* [`4c3c778`](https://github.com/npm/npm/commit/4c3c77839920e830991e0c229c3c6a855c914d67)
+ [#5758](https://github.com/npm/npm/issues/5758) `npm link` includes scope
+ when linking scoped package ([@fengmk2](https://github.com/fengmk2))
+* [`f9f58dd`](https://github.com/npm/npm/commit/f9f58dd0f5b715d4efa6619f13901916d8f99c47)
+ [#5707](https://github.com/npm/npm/issues/5707) document generic pre- /
+ post-commands ([@sudodoki](https://github.com/sudodoki))
+* [`ac7a480`](https://github.com/npm/npm/commit/ac7a4801d80361b41dce4a18f22bcdf75e396000)
+ [#5406](https://github.com/npm/npm/issues/5406) `npm cache` displays usage
+ when called without arguments
+ ([@michaelnisi](https://github.com/michaelnisi))
+* [`f4554e9`](https://github.com/npm/npm/commit/f4554e99d34f77a8a02884493748f7d49a9a9d8b)
+ Test fixes for Windows ([@isaacs](https://github.com/isaacs))
+* update dependencies ([@othiym23](https://github.com/othiym23))
+
+
+### v1.5.0-alpha-4 (2014-07-18):
+
+* fall back to `_auth` config as default auth when using default registry
+ ([@isaacs](https://github.com/isaacs))
+* support for 'init.version' for those who don't want to deal with semver 0.0.x
+ oddities ([@rvagg](https://github.com/rvagg))
+* [`be06213`](https://github.com/npm/npm/commit/be06213415f2d51a50d2c792b4cd0d3412a9a7b1)
+ remove residual support for `win` log level
+ ([@aterris](https://github.com/aterris))
+
+### v1.5.0-alpha-3 (2014-07-17):
+
+* [`a3a85dd`](https://github.com/npm/npm/commit/a3a85dd004c9245a71ad2f0213bd1a9a90d64cd6)
+ `--save` scoped packages correctly ([@othiym23](https://github.com/othiym23))
+* [`18a3385`](https://github.com/npm/npm/commit/18a3385bcf8bfb8312239216afbffb7eec759150)
+ `npm-registry-client@3.0.2` ([@othiym23](https://github.com/othiym23))
+* [`375988b`](https://github.com/npm/npm/commit/375988b9bf5aa5170f06a790d624d31b1eb32c6d)
+ invalid package names are an early error for optional deps
+ ([@othiym23](https://github.com/othiym23))
+* consistently use `node-package-arg` instead of arbitrary package spec
+ splitting ([@othiym23](https://github.com/othiym23))
+
+### v1.4.21 (2014-07-14):
+
+* [`88f51aa`](https://github.com/npm/npm/commit/88f51aa27eb9a958d1fa7ec50fee5cfdedd05110)
+ fix handling for 301s in `npm-registry-client@2.0.3`
+ ([@Raynos](https://github.com/Raynos))
+
+### v1.5.0-alpha-2 (2014-07-01):
+
+* [`54cf625`](https://github.com/npm/npm/commit/54cf62534e3331e3f454e609e44f0b944e819283)
+ fix handling for 301s in `npm-registry-client@3.0.1`
+ ([@Raynos](https://github.com/Raynos))
+* [`e410861`](https://github.com/npm/npm/commit/e410861c69a3799c1874614cb5b87af8124ff98d)
+ don't crash if no username set on `whoami`
+ ([@isaacs](https://github.com/isaacs))
+* [`0353dde`](https://github.com/npm/npm/commit/0353ddeaca8171aa7dbdd8102b7e2eb581a86406)
+ respect `--json` for output ([@isaacs](https://github.com/isaacs))
+* [`b3d112a`](https://github.com/npm/npm/commit/b3d112ae190b984cc1779b9e6de92218f22380c6)
+ outdated: Don't show headings if there's nothing to output
+ ([@isaacs](https://github.com/isaacs))
+* [`bb4b90c`](https://github.com/npm/npm/commit/bb4b90c80dbf906a1cb26d85bc0625dc2758acc3)
+ outdated: Default to `latest` rather than `*` for unspecified deps
+ ([@isaacs](https://github.com/isaacs))
+
+### v1.4.20 (2014-07-02):
+
+* [`0353dde`](https://github.com/npm/npm/commit/0353ddeaca8171aa7dbdd8102b7e2eb581a86406)
+ respect `--json` for output ([@isaacs](https://github.com/isaacs))
+* [`b3d112a`](https://github.com/npm/npm/commit/b3d112ae190b984cc1779b9e6de92218f22380c6)
+ outdated: Don't show headings if there's nothing to output
+ ([@isaacs](https://github.com/isaacs))
+* [`bb4b90c`](https://github.com/npm/npm/commit/bb4b90c80dbf906a1cb26d85bc0625dc2758acc3)
+ outdated: Default to `latest` rather than `*` for unspecified deps
+ ([@isaacs](https://github.com/isaacs))
+
+### v1.5.0-alpha-1 (2014-07-01):
+
+* [`eef4884`](https://github.com/npm/npm/commit/eef4884d6487ee029813e60a5f9c54e67925d9fa)
+ use the correct piece of the spec for GitHub shortcuts
+ ([@othiym23](https://github.com/othiym23))
+
+### v1.5.0-alpha-0 (2014-07-01):
+
+* [`7f55057`](https://github.com/npm/npm/commit/7f55057807cfdd9ceaf6331968e666424f48116c)
+ install scoped packages ([#5239](https://github.com/npm/npm/issues/5239))
+ ([@othiym23](https://github.com/othiym23))
+* [`0df7e16`](https://github.com/npm/npm/commit/0df7e16c0232d8f4d036ebf4ec3563215517caac)
+ publish scoped packages ([#5239](https://github.com/npm/npm/issues/5239))
+ ([@othiym23](https://github.com/othiym23))
+* [`0689ba2`](https://github.com/npm/npm/commit/0689ba249b92b4c6279a26804c96af6f92b3a501)
+ support (and save) --scope=@s config
+ ([@othiym23](https://github.com/othiym23))
+* [`f34878f`](https://github.com/npm/npm/commit/f34878fc4cee29901e4daf7bace94be01e25cad7)
+ scope credentials to registry ([@othiym23](https://github.com/othiym23))
+* [`0ac7ca2`](https://github.com/npm/npm/commit/0ac7ca233f7a69751fe4386af6c4daa3ee9fc0da)
+ capture and store bearer tokens when sent by registry
+ ([@othiym23](https://github.com/othiym23))
+* [`63c3277`](https://github.com/npm/npm/commit/63c3277f089b2c4417e922826bdc313ac854cad6)
+ only delete files that are created by npm
+ ([@othiym23](https://github.com/othiym23))
+* [`4f54043`](https://github.com/npm/npm/commit/4f540437091d1cbca3915cd20c2da83c2a88bb8e)
+ `npm-package-arg@2.0.0` ([@othiym23](https://github.com/othiym23))
+* [`9e1460e`](https://github.com/npm/npm/commit/9e1460e6ac9433019758481ec031358f4af4cd44)
+ `read-package-json@1.2.3` ([@othiym23](https://github.com/othiym23))
+* [`719d8ad`](https://github.com/npm/npm/commit/719d8adb9082401f905ff4207ede494661f8a554)
+ `fs-vacuum@1.2.1` ([@othiym23](https://github.com/othiym23))
+* [`9ef8fe4`](https://github.com/npm/npm/commit/9ef8fe4d6ead3acb3e88c712000e2d3a9480ebec)
+ `async-some@1.0.0` ([@othiym23](https://github.com/othiym23))
+* [`a964f65`](https://github.com/npm/npm/commit/a964f65ab662107b62a4ca58535ce817e8cca331)
+ `npmconf@2.0.1` ([@othiym23](https://github.com/othiym23))
+* [`113765b`](https://github.com/npm/npm/commit/113765bfb7d3801917c1d9f124b8b3d942bec89a)
+ `npm-registry-client@3.0.0` ([@othiym23](https://github.com/othiym23))
+
+### v1.4.19 (2014-07-01):
+
+* [`f687433`](https://github.com/npm/npm/commit/f687433) relative URLS for
+ working non-root registry URLS ([@othiym23](https://github.com/othiym23))
+* [`bea190c`](https://github.com/npm/npm/commit/bea190c)
+ [#5591](https://github.com/npm/npm/issues/5591) bump nopt and npmconf
+ ([@isaacs](https://github.com/isaacs))
+
+### v1.4.18 (2014-06-29):
+
+* Bump glob dependency from 4.0.2 to 4.0.3. It now uses graceful-fs when
+ available, increasing resilience to [various filesystem
+ errors](https://github.com/isaacs/node-graceful-fs#improvements-over-fs-module).
+ ([@isaacs](https://github.com/isaacs))
+
+### v1.4.17 (2014-06-27):
+
+* replace escape codes with ansicolors
+ ([@othiym23](https://github.com/othiym23))
+* Allow to build all the docs OOTB. ([@GeJ](https://github.com/GeJ))
+* Use core.longpaths on win32 git - fixes
+ [#5525](https://github.com/npm/npm/issues/5525) (Bradley Meck)
+* `npmconf@1.1.2` ([@isaacs](https://github.com/isaacs))
+* Consolidate color sniffing in config/log loading process
+ ([@isaacs](https://github.com/isaacs))
+* add verbose log when project config file is ignored
+ ([@isaacs](https://github.com/isaacs))
+* npmconf: Float patch to remove 'scope' from config defs
+ ([@isaacs](https://github.com/isaacs))
+* doc: npm-explore can't handle a version
+ ([@robertkowalski](https://github.com/robertkowalski))
+* Add user-friendly errors for ENOSPC and EROFS.
+ ([@voodootikigod](https://github.com/voodootikigod))
+* bump tar and fstream deps ([@isaacs](https://github.com/isaacs))
+* Run the npm-registry-couchapp tests along with npm tests
+ ([@isaacs](https://github.com/isaacs))
+
+### v1.2.8000 (2014-06-17):
+
+* Same as v1.4.16, but with the spinner disabled, and a version number that
+ starts with v1.2.
+
+### v1.4.16 (2014-06-17):
+
+* `npm-registry-client@2.0.2` ([@isaacs](https://github.com/isaacs))
+* `fstream@0.1.27` ([@isaacs](https://github.com/isaacs))
+* `sha@1.2.4` ([@isaacs](https://github.com/isaacs))
+* `rimraf@2.2.8` ([@isaacs](https://github.com/isaacs))
+* `npmlog@1.0.1` ([@isaacs](https://github.com/isaacs))
+* `npm-registry-client@2.0.1` ([@isaacs](https://github.com/isaacs))
+* removed redundant dependency ([@othiym23](https://github.com/othiym23))
+* `npmconf@1.0.5` ([@isaacs](https://github.com/isaacs))
+* Properly handle errors that can occur in the config-loading process
+ ([@isaacs](https://github.com/isaacs))
+
+### v1.4.15 (2014-06-10):
+
+* cache: atomic de-race-ified package.json writing
+ ([@isaacs](https://github.com/isaacs))
+* `fstream@0.1.26` ([@isaacs](https://github.com/isaacs))
+* `graceful-fs@3.0.2` ([@isaacs](https://github.com/isaacs))
+* `osenv@0.1.0` ([@isaacs](https://github.com/isaacs))
+* Only spin the spinner when we're fetching stuff
+ ([@isaacs](https://github.com/isaacs))
+* Update `osenv@0.1.0` which removes ~/tmp as possible tmp-folder
+ ([@robertkowalski](https://github.com/robertkowalski))
+* `ini@1.2.1` ([@isaacs](https://github.com/isaacs))
+* `graceful-fs@3` ([@isaacs](https://github.com/isaacs))
+* Update glob and things depending on glob
+ ([@isaacs](https://github.com/isaacs))
+* github-url-from-username-repo and read-package-json updates
+ ([@isaacs](https://github.com/isaacs))
+* `editor@0.1.0` ([@isaacs](https://github.com/isaacs))
+* `columnify@1.1.0` ([@isaacs](https://github.com/isaacs))
+* bump ansi and associated deps ([@isaacs](https://github.com/isaacs))
+
+### v1.4.14 (2014-06-05):
+
+* char-spinner: update to not bork windows
+ ([@isaacs](https://github.com/isaacs))
+
+### v1.4.13 (2014-05-23):
+
+* Fix `npm install` on a tarball.
+ ([`ed3abf1`](https://github.com/npm/npm/commit/ed3abf1aa10000f0f687330e976d78d1955557f6),
+ [#5330](https://github.com/npm/npm/issues/5330),
+ [@othiym23](https://github.com/othiym23))
+* Fix an issue with the spinner on Node 0.8.
+ ([`9f00306`](https://github.com/npm/npm/commit/9f003067909440390198c0b8f92560d84da37762),
+ [@isaacs](https://github.com/isaacs))
+* Re-add `npm.commands.cache.clean` and `npm.commands.cache.read` APIs, and
+ document `npm.commands.cache.*` as npm-cache(3).
+ ([`e06799e`](https://github.com/npm/npm/commit/e06799e77e60c1fc51869619083a25e074d368b3),
+ [@isaacs](https://github.com/isaacs))
+
+### v1.4.12 (2014-05-23):
+
+* remove normalize-package-data from top level, de-^-ify inflight dep
+ ([@isaacs](https://github.com/isaacs))
+* Always sort saved bundleDependencies ([@isaacs](https://github.com/isaacs))
+* add inflight to bundledDependencies
+ ([@othiym23](https://github.com/othiym23))
+
+### v1.4.11 (2014-05-22):
+
+* fix `npm ls` labeling issue
+* `node-gyp@0.13.1`
+* default repository to https:// instead of git://
+* addLocalTarball: Remove extraneous unpack
+ ([@isaacs](https://github.com/isaacs))
+* Massive cache folder refactor ([@othiym23](https://github.com/othiym23) and
+ [@isaacs](https://github.com/isaacs))
+* Busy Spinner, no http noise ([@isaacs](https://github.com/isaacs))
+* Per-project .npmrc file support ([@isaacs](https://github.com/isaacs))
+* `npmconf@1.0.0`, Refactor config/uid/prefix loading process
+ ([@isaacs](https://github.com/isaacs))
+* Allow once-disallowed characters in passwords
+ ([@isaacs](https://github.com/isaacs))
+* Send npm version as 'version' header ([@isaacs](https://github.com/isaacs))
+* fix cygwin encoding issue (Karsten Tinnefeld)
+* Allow non-github repositories with `npm repo`
+ ([@evanlucas](https://github.com/evanlucas))
+* Allow peer deps to be satisfied by grandparent
+* Stop optional deps moving into deps on `update --save`
+ ([@timoxley](https://github.com/timoxley))
+* Ensure only matching deps update with `update --save*`
+ ([@timoxley](https://github.com/timoxley))
+* Add support for `prerelease`, `preminor`, `prepatch` to `npm version`
+
+### v1.4.10 (2014-05-05):
+
+* Don't set referer if already set
+* fetch: Send referer and npm-session headers
+* `run-script`: Support `--parseable` and `--json`
+* list runnable scripts ([@evanlucas](https://github.com/evanlucas))
+* Use marked instead of ronn for html docs
+
+### v1.4.9 (2014-05-01):
+
+* Send referer header (with any potentially private stuff redacted)
+* Fix critical typo bug in previous npm release
+
+### v1.4.8 (2014-05-01):
+
+* Check SHA before using files from cache
+* adduser: allow change of the saved password
+* Make `npm install` respect `config.unicode`
+* Fix lifecycle to pass `Infinity` for config env value
+* Don't return 0 exit code on invalid command
+* cache: Handle 404s and other HTTP errors as errors
+* Resolve ~ in path configs to env.HOME
+* Include npm version in default user-agent conf
+* npm init: Use ISC as default license, use save-prefix for deps
+* Many test and doc fixes
+
+### v1.4.7 (2014-04-15):
+
+* Add `--save-prefix` option that can be used to override the default of `^`
+ when using `npm install --save` and its counterparts.
+ ([`64eefdf`](https://github.com/npm/npm/commit/64eefdfe26bb27db8dc90e3ab5d27a5ef18a4470),
+ [@thlorenz](https://github.com/thlorenz))
+* Allow `--silent` to silence the echoing of commands that occurs with `npm
+ run`.
+ ([`c95cf08`](https://github.com/npm/npm/commit/c95cf086e5b97dbb48ff95a72517b203a8f29eab),
+ [@Raynos](https://github.com/Raynos))
+* Some speed improvements to the cache, which should improve install times.
+ ([`cb94310`](https://github.com/npm/npm/commit/cb94310a6adb18cb7b881eacb8d67171eda8b744),
+ [`3b0870f`](https://github.com/npm/npm/commit/3b0870fb2f40358b3051abdab6be4319d196b99d),
+ [`120f5a9`](https://github.com/npm/npm/commit/120f5a93437bbbea9249801574a2f33e44e81c33),
+ [@isaacs](https://github.com/isaacs))
+* Improve ability to retry registry requests when a subset of the registry
+ servers are down.
+ ([`4a5257d`](https://github.com/npm/npm/commit/4a5257de3870ac3dafa39667379f19f6dcd6093e),
+ https://github.com/npm/npm-registry-client/commit/7686d02cb0b844626d6a401e58c0755ef3bc8432,
+ [@isaacs](https://github.com/isaacs))
+* Fix marking of peer dependencies as extraneous.
+ ([`779b164`](https://github.com/npm/npm/commit/779b1649764607b062c031c7e5c972151b4a1754),
+ https://github.com/npm/read-installed/commit/6680ba6ef235b1ca3273a00b70869798ad662ddc,
+ [@isaacs](https://github.com/isaacs))
+* Fix npm crashing when doing `npm shrinkwrap` in the presence of a
+ `package.json` with no dependencies.
+ ([`a9d9fa5`](https://github.com/npm/npm/commit/a9d9fa5ad3b8c925a589422b7be28d2735f320b0),
+ [@kislyuk](https://github.com/kislyuk))
+* Fix error when using `npm view` on packages that have no versions or have
+ been unpublished.
+ ([`94df2f5`](https://github.com/npm/npm/commit/94df2f56d684b35d1df043660180fc321b743dc8),
+ [@juliangruber](https://github.com/juliangruber);
+ [`2241a09`](https://github.com/npm/npm/commit/2241a09c843669c70633c399ce698cec3add40b3),
+ [@isaacs](https://github.com/isaacs))
+
+### v1.4.6 (2014-03-19):
+
+* Fix extraneous package detection to work in more cases.
+ ([`f671286`](https://github.com/npm/npm/commit/f671286), npm/read-installed#20,
+ [@LaurentVB](https://github.com/LaurentVB))
+
+### v1.4.5 (2014-03-18):
+
+* Sort dependencies in `package.json` when doing `npm install --save` and all
+ its variants.
+ ([`6fd6ff7`](https://github.com/npm/npm/commit/6fd6ff7e536ea6acd33037b1878d4eca1f931985),
+ [@domenic](https://github.com/domenic))
+* Add `--save-exact` option, usable alongside `--save` and its variants, which
+ will write the exact version number into `package.json` instead of the
+ appropriate semver-compatibility range.
+ ([`17f07df`](https://github.com/npm/npm/commit/17f07df8ad8e594304c2445bf7489cb53346f2c5),
+ [@timoxley](https://github.com/timoxley))
+* Accept gzipped content from the registry to speed up downloads and save
+ bandwidth.
+ ([`a3762de`](https://github.com/npm/npm/commit/a3762de843b842be8fa0ab57cdcd6b164f145942),
+ npm/npm-registry-client#40, [@fengmk2](https://github.com/fengmk2))
+* Fix `npm ls`'s `--depth` and `--log` options.
+ ([`1d29b17`](https://github.com/npm/npm/commit/1d29b17f5193d52a5c4faa412a95313dcf41ed91),
+ npm/read-installed#13, [@zertosh](https://github.com/zertosh))
+* Fix "Adding a cache directory to the cache will make the world implode" in
+ certain cases.
+ ([`9a4b2c4`](https://github.com/npm/npm/commit/9a4b2c4667c2b1e0054e3d5611ab86acb1760834),
+ domenic/path-is-inside#1, [@pmarques](https://github.com/pmarques))
+* Fix readmes not being uploaded in certain rare cases.
+ ([`527b72c`](https://github.com/npm/npm/commit/527b72cca6c55762b51e592c48a9f28cc7e2ff8b),
+ [@isaacs](https://github.com/isaacs))
+
+### v1.4.4 (2014-02-20):
+
+* Add `npm t` as an alias for `npm test` (which is itself an alias for `npm run
+ test`, or even `npm run-script test`). We like making running your tests
+ easy. ([`14e650b`](https://github.com/npm/npm/commit/14e650bce0bfebba10094c961ac104a61417a5de), [@isaacs](https://github.com/isaacs))
+
+### v1.4.3 (2014-02-16):
+
+* Add back `npm prune --production`, which was removed in 1.3.24.
+ ([`acc4d02`](https://github.com/npm/npm/commit/acc4d023c57d07704b20a0955e4bf10ee91bdc83),
+ [@davglass](https://github.com/davglass))
+* Default `npm install --save` and its counterparts to use the `^` version
+ specifier, instead of `~`.
+ ([`0a3151c`](https://github.com/npm/npm/commit/0a3151c9cbeb50c1c65895685c2eabdc7e2608dc),
+ [@mikolalysenko](https://github.com/mikolalysenko))
+* Make `npm shrinkwrap` output dependencies in a sorted order, so that diffs
+ between shrinkwrap files should be saner now.
+ ([`059b2bf`](https://github.com/npm/npm/commit/059b2bfd06ae775205a37257dca80142596a0113),
+ [@Raynos](https://github.com/Raynos))
+* Fix `npm dedupe` not correctly respecting dependency constraints.
+ ([`86028e9`](https://github.com/npm/npm/commit/86028e9fd8524d5e520ce01ba2ebab5a030103fc),
+ [@rafeca](https://github.com/rafeca))
+* Fix `npm ls` giving spurious warnings when you used `"latest"` as a version
+ specifier.
+ (https://github.com/npm/read-installed/commit/d2956400e0386931c926e0f30c334840e0938f14,
+ [@bajtos](https://github.com/bajtos))
+* Fixed a bug where using `npm link` on packages without a `name` value could
+ cause npm to delete itself.
+ ([`401a642`](https://github.com/npm/npm/commit/401a64286aa6665a94d1d2f13604f7014c5fce87),
+ [@isaacs](https://github.com/isaacs))
+* Fixed `npm install ./pkg@1.2.3` to actually install the directory at
+ `pkg@1.2.3`; before it would try to find version `1.2.3` of the package
+ `./pkg` in the npm registry.
+ ([`46d8768`](https://github.com/npm/npm/commit/46d876821d1dd94c050d5ebc86444bed12c56739),
+ [@rlidwka](https://github.com/rlidwka); see also
+ [`f851b79`](https://github.com/npm/npm/commit/f851b79a71d9a5f5125aa85877c94faaf91bea5f))
+* Fix `npm outdated` to respect the `color` configuration option.
+ ([`d4f6f3f`](https://github.com/npm/npm/commit/d4f6f3ff83bd14fb60d3ac6392cb8eb6b1c55ce1),
+ [@timoxley](https://github.com/timoxley))
+* Fix `npm outdated --parseable`.
+ ([`9575a23`](https://github.com/npm/npm/commit/9575a23f955ce3e75b509c89504ef0bd707c8cf6),
+ [@yhpark](https://github.com/yhpark))
+* Fix a lockfile-related errors when using certain Git URLs.
+ ([`164b97e`](https://github.com/npm/npm/commit/164b97e6089f64e686db7a9a24016f245effc37f),
+ [@nigelzor](https://github.com/nigelzor))
+
+### v1.4.2 (2014-02-13):
+
+* Fixed an issue related to mid-publish GET requests made against the registry.
+ (https://github.com/npm/npm-registry-client/commit/acbec48372bc1816c67c9e7cbf814cf50437ff93,
+ [@isaacs](https://github.com/isaacs))
+
+### v1.4.1 (2014-02-13):
+
+* Fix `npm shrinkwrap` forgetting to shrinkwrap dependencies that were also
+ development dependencies.
+ ([`9c575c5`](https://github.com/npm/npm/commit/9c575c56efa9b0c8b0d4a17cb9c1de3833004bcd),
+ [@diwu1989](https://github.com/diwu1989))
+* Fixed publishing of pre-existing packages with uppercase characters in their
+ name.
+ (https://github.com/npm/npm-registry-client/commit/9345d3b6c3d8510dd5c4418f27ee1fce59acebad,
+ [@isaacs](https://github.com/isaacs))
+
+### v1.4.0 (2014-02-12):
+
+* Remove `npm publish --force`. See
+ https://github.com/npm/npmjs.org/issues/148.
+ ([@isaacs](https://github.com/isaacs),
+ npm/npm-registry-client@2c8dba990de6a59af6545b75cc00a6dc12777c2a)
+* Other changes to the registry client related to saved configs and couch
+ logins. ([@isaacs](https://github.com/isaacs);
+ npm/npm-registry-client@25e2b019a1588155e5f87d035c27e79963b75951,
+ npm/npm-registry-client@9e41e9101b68036e0f078398785f618575f3cdde,
+ npm/npm-registry-client@2c8dba990de6a59af6545b75cc00a6dc12777c2a)
+* Show an error to the user when doing `npm update` and the `package.json`
+ specifies a version that does not exist.
+ ([@evanlucas](https://github.com/evanlucas),
+ [`027a33a`](https://github.com/npm/npm/commit/027a33a5c594124cc1d82ddec5aee2c18bc8dc32))
+* Fix some issues with cache ownership in certain installation configurations.
+ ([@outcoldman](https://github.com/outcoldman),
+ [`a132690`](https://github.com/npm/npm/commit/a132690a2876cda5dcd1e4ca751f21dfcb11cb9e))
+* Fix issues where GitHub shorthand dependencies `user/repo` were not always
+ treated the same as full Git URLs.
+ ([@robertkowalski](https://github.com/robertkowalski),
+ https://github.com/meryn/normalize-package-data/commit/005d0b637aec1895117fcb4e3b49185eebf9e240)
+
+### v1.3.26 (2014-02-02):
+
+* Fixes and updates to publishing code
+ ([`735427a`](https://github.com/npm/npm/commit/735427a69ba4fe92aafa2d88f202aaa42920a9e2)
+ and
+ [`c0ac832`](https://github.com/npm/npm/commit/c0ac83224d49aa62e55577f8f27d53bbfd640dc5),
+ [@isaacs](https://github.com/isaacs))
+* Fix `npm bugs` with no arguments.
+ ([`b99d465`](https://github.com/npm/npm/commit/b99d465221ac03bca30976cbf4d62ca80ab34091),
+ [@Hoops](https://github.com/Hoops))
+
+### v1.3.25 (2014-01-25):
+
+* Remove gubblebum blocky font from documentation headers.
+ ([`6940c9a`](https://github.com/npm/npm/commit/6940c9a100160056dc6be8f54a7ad7fa8ceda7e2),
+ [@isaacs](https://github.com/isaacs))
+
+### v1.3.24 (2014-01-19):
+
+* Make the search output prettier, with nice truncated columns, and a `--long`
+ option to create wrapping columns.
+ ([`20439b2`](https://github.com/npm/npm/commit/20439b2) and
+ [`3a6942d`](https://github.com/npm/npm/commit/3a6942d),
+ [@timoxley](https://github.com/timoxley))
+* Support multiple packagenames in `npm docs`.
+ ([`823010b`](https://github.com/npm/npm/commit/823010b),
+ [@timoxley](https://github.com/timoxley))
+* Fix the `npm adduser` bug regarding "Error: default value must be string or
+ number" again. ([`b9b4248`](https://github.com/npm/npm/commit/b9b4248),
+ [@isaacs](https://github.com/isaacs))
+* Fix `scripts` entries containing whitespaces on Windows.
+ ([`80282ed`](https://github.com/npm/npm/commit/80282ed),
+ [@robertkowalski](https://github.com/robertkowalski))
+* Fix `npm update` for Git URLs that have credentials in them
+ ([`93fc364`](https://github.com/npm/npm/commit/93fc364),
+ [@danielsantiago](https://github.com/danielsantiago))
+* Fix `npm install` overwriting `npm link`-ed dependencies when they are tagged
+ Git dependencies. ([`af9bbd9`](https://github.com/npm/npm/commit/af9bbd9),
+ [@evanlucas](https://github.com/evanlucas))
+* Remove `npm prune --production` since it buggily removed some dependencies
+ that were necessary for production; see
+ [#4509](https://github.com/npm/npm/issues/4509). Hopefully it can make its
+ triumphant return, one day.
+ ([`1101b6a`](https://github.com/npm/npm/commit/1101b6a),
+ [@isaacs](https://github.com/isaacs))
+
+Dependency updates:
+* [`909cccf`](https://github.com/npm/npm/commit/909cccf) `read-package-json@1.1.6`
+* [`a3891b6`](https://github.com/npm/npm/commit/a3891b6) `rimraf@2.2.6`
+* [`ac6efbc`](https://github.com/npm/npm/commit/ac6efbc) `sha@1.2.3`
+* [`dd30038`](https://github.com/npm/npm/commit/dd30038) `node-gyp@0.12.2`
+* [`c8c3ebe`](https://github.com/npm/npm/commit/c8c3ebe) `npm-registry-client@0.3.3`
+* [`4315286`](https://github.com/npm/npm/commit/4315286) `npmconf@0.1.12`
+
+### v1.3.23 (2014-01-03):
+
+* Properly handle installations that contained a certain class of circular
+ dependencies.
+ ([`5dc93e8`](https://github.com/npm/npm/commit/5dc93e8c82604c45b6067b1acf1c768e0bfce754),
+ [@substack](https://github.com/substack))
+
+### v1.3.22 (2013-12-25):
+
+* Fix a critical bug in `npm adduser` that would manifest in the error message
+ "Error: default value must be string or number."
+ ([`fba4bd2`](https://github.com/npm/npm/commit/fba4bd24bc2ab00ccfeda2043aa53af7d75ef7ce),
+ [@isaacs](https://github.com/isaacs))
+* Allow `npm bugs` in the current directory to open the current package's bugs
+ URL.
+ ([`d04cf64`](https://github.com/npm/npm/commit/d04cf6483932c693452f3f778c2fa90f6153a4af),
+ [@evanlucas](https://github.com/evanlucas))
+* Several fixes to various error messages to include more useful or updated
+ information.
+ ([`1e6f2a7`](https://github.com/npm/npm/commit/1e6f2a72ca058335f9f5e7ca22d01e1a8bb0f9f7),
+ [`ff46366`](https://github.com/npm/npm/commit/ff46366bd40ff0ef33c7bac8400bc912c56201d1),
+ [`8b4bb48`](https://github.com/npm/npm/commit/8b4bb4815d80a3612186dc5549d698e7b988eb03);
+ [@rlidwka](https://github.com/rlidwka),
+ [@evanlucas](https://github.com/evanlucas))
+
+### v1.3.21 (2013-12-17):
+
+* Fix a critical bug that prevented publishing due to incorrect hash
+ calculation.
+ ([`4ca4a2c`](https://github.com/npm/npm-registry-client/commit/4ca4a2c6333144299428be6b572e2691aa59852e),
+ [@dominictarr](https://github.com/dominictarr))
+
+### v1.3.20 (2013-12-17):
+
+* Fixes a critical bug in v1.3.19. Thankfully, due to that bug, no one could
+ install npm v1.3.19 :)
+
+### v1.3.19 (2013-12-16):
+
+* Adds atomic PUTs for publishing packages, which should result in far fewer
+ requests and less room for replication errors on the server-side.
+
+### v1.3.18 (2013-12-16):
+
+* Added an `--ignore-scripts` option, which will prevent `package.json` scripts
+ from being run. Most notably, this will work on `npm install`, so e.g. `npm
+ install --ignore-scripts` will not run preinstall and prepublish scripts.
+ ([`d7e67bf`](https://github.com/npm/npm/commit/d7e67bf0d94b085652ec1c87d595afa6f650a8f6),
+ [@sqs](https://github.com/sqs))
+* Fixed a bug introduced in 1.3.16 that would manifest with certain cache
+ configurations, by causing spurious errors saying "Adding a cache directory
+ to the cache will make the world implode."
+ ([`966373f`](https://github.com/npm/npm/commit/966373fad8d741637f9744882bde9f6e94000865),
+ [@domenic](https://github.com/domenic))
+* Re-fixed the multiple download of URL dependencies, whose fix was reverted in
+ 1.3.17.
+ ([`a362c3f`](https://github.com/npm/npm/commit/a362c3f1919987419ed8a37c8defa19d2e6697b0),
+ [@spmason](https://github.com/spmason))
+
+### v1.3.17 (2013-12-11):
+
+* This release reverts
+ [`644c2ff`](https://github.com/npm/npm/commit/644c2ff3e3d9c93764f7045762477f48864d64a7),
+ which avoided re-downloading URL and shinkwrap dependencies when doing `npm
+ install`. You can see the in-depth reasoning in
+ [`d8c907e`](https://github.com/npm/npm/commit/d8c907edc2019b75cff0f53467e34e0ffd7e5fba);
+ the problem was, that the patch changed the behavior of `npm install -f` to
+ reinstall all dependencies.
+* A new version of the no-re-downloading fix has been submitted as
+ [#4303](https://github.com/npm/npm/issues/4303) and will hopefully be
+ included in the next release.
+
+### v1.3.16 (2013-12-11):
+
+* Git URL dependencies are now updated on `npm install`, fixing a two-year old
+ bug
+ ([`5829ecf`](https://github.com/npm/npm/commit/5829ecf032b392d2133bd351f53d3c644961396b),
+ [@robertkowalski](https://github.com/robertkowalski)). Additional progress on
+ reducing the resulting Git-related I/O is tracked as
+ [#4191](https://github.com/npm/npm/issues/4191), but for now, this will be a
+ big improvement.
+* Added a `--json` mode to `npm outdated` to give a parseable output.
+ ([`0b6c9b7`](https://github.com/npm/npm/commit/0b6c9b7c8c5579f4d7d37a0c24d9b7a12ccbe5fe),
+ [@yyx990803](https://github.com/yyx990803))
+* Made `npm outdated` much prettier and more useful. It now outputs a
+ color-coded and easy-to-read table.
+ ([`fd3017f`](https://github.com/npm/npm/commit/fd3017fc3e9d42acf6394a5285122edb4dc16106),
+ [@quimcalpe](https://github.com/quimcalpe))
+* Added the `--depth` option to `npm outdated`, so that e.g. you can do `npm
+ outdated --depth=0` to show only top-level outdated dependencies.
+ ([`1d184ef`](https://github.com/npm/npm/commit/1d184ef3f4b4bc309d38e9128732e3e6fb46d49c),
+ [@yyx990803](https://github.com/yyx990803))
+* Added a `--no-git-tag-version` option to `npm version`, for doing the usual
+ job of `npm version` minus the Git tagging. This could be useful if you need
+ to increase the version in other related files before actually adding the
+ tag.
+ ([`59ca984`](https://github.com/npm/npm/commit/59ca9841ba4f4b2f11b8e72533f385c77ae9f8bd),
+ [@evanlucas](https://github.com/evanlucas))
+* Made `npm repo` and `npm docs` work without any arguments, adding them to the
+ list of npm commands that work on the package in the current directory when
+ invoked without arguments.
+ ([`bf9048e`](https://github.com/npm/npm/commit/bf9048e2fa16d43fbc4b328d162b0a194ca484e8),
+ [@robertkowalski](https://github.com/robertkowalski);
+ [`07600d0`](https://github.com/npm/npm/commit/07600d006c652507cb04ac0dae9780e35073dd67),
+ [@wilmoore](https://github.com/wilmoore)). There are a few other commands we
+ still want to implement this for; see
+ [#4204](https://github.com/npm/npm/issues/4204).
+* Pass through the `GIT_SSL_NO_VERIFY` environment variable to Git, if it is
+ set; we currently do this with a few other environment variables, but we
+ missed that one.
+ ([`c625de9`](https://github.com/npm/npm/commit/c625de91770df24c189c77d2e4bc821f2265efa8),
+ [@arikon](https://github.com/arikon))
+* Fixed `npm dedupe` on Windows due to incorrect path separators being used
+ ([`7677de4`](https://github.com/npm/npm/commit/7677de4583100bc39407093ecc6bc13715bf8161),
+ [@mcolyer](https://github.com/mcolyer)).
+* Fixed the `npm help` command when multiple words were searched for; it
+ previously gave a `ReferenceError`.
+ ([`6a28dd1`](https://github.com/npm/npm/commit/6a28dd147c6957a93db12b1081c6e0da44fe5e3c),
+ [@dereckson](https://github.com/dereckson))
+* Stopped re-downloading URL and shrinkwrap dependencies, as demonstrated in
+ [#3463](https://github.com/npm/npm/issues/3463)
+ ([`644c2ff`](https://github.com/isaacs/npm/commit/644c2ff3e3d9c93764f7045762477f48864d64a7),
+ [@spmason](https://github.com/spmason)). You can use the `--force` option to
+ force re-download and installation of all dependencies.
# vim: set softtabstop=2 shiftwidth=2:
SHELL = bash
+PUBLISHTAG = $(shell node scripts/publish-tag.js)
+BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
+
markdowns = $(shell find doc -name '*.md' | grep -v 'index') README.md
html_docdeps = html/dochead.html \
test: doc
node cli.js test
+tag:
+ npm tag npm@$(PUBLISHTAG) latest
+
publish: link doc
@git push origin :v$(shell npm -v) 2>&1 || true
- @npm unpublish npm@$(shell npm -v) 2>&1 || true
git clean -fd &&\
- git push origin &&\
+ git push origin $(BRANCH) &&\
git push origin --tags &&\
- npm publish &&\
- make doc-publish
-
-docpublish: doc-publish
-doc-publish: doc
- # legacy urls
- for f in $$(find html/doc/{cli,files,misc}/ -name '*.html'); do \
- j=$$(basename $$f | sed 's|^npm-||g'); \
- if ! [ -f html/doc/$$j ] && [ $$j != README.html ] && [ $$j != index.html ]; then \
- perl -pi -e 's/ href="\.\.\// href="/g' <$$f >html/doc/$$j; \
- fi; \
- done
- mkdir -p html/api
- for f in $$(find html/doc/api/ -name '*.html'); do \
- j=$$(basename $$f | sed 's|^npm-||g'); \
- perl -pi -e 's/ href="\.\.\// href="/g' <$$f >html/api/$$j; \
- done
- rsync -vazu --stats --no-implied-dirs --delete \
- html/doc/* \
- ../npm-www/doc
- rsync -vazu --stats --no-implied-dirs --delete \
- html/static/style.css \
- ../npm-www/static/
- #cleanup
- rm -rf html/api
- for f in html/doc/*.html; do \
- case $$f in \
- html/doc/README.html) continue ;; \
- html/doc/index.html) continue ;; \
- *) rm $$f ;; \
- esac; \
- done
+ npm publish --tag=$(PUBLISHTAG)
release:
@bash scripts/release.sh
sandwich:
@[ $$(whoami) = "root" ] && (echo "ok"; echo "ham" > sandwich) || (echo "make it yourself" && exit 13)
-.PHONY: all latest install dev link doc clean uninstall test man doc-publish doc-clean docclean docpublish release
+.PHONY: all latest install dev link doc clean uninstall test man doc-clean docclean release
## SYNOPSIS
- npm version [<newversion> | major | minor | patch]
+ npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease]
## DESCRIPTION
Run this in a package directory to bump the version and write the new
data back to the package.json file.
-The `newversion` argument should be a valid semver string, *or* a valid
-second argument to semver.inc (one of "patch", "minor", or
-"major"). In the second case, the existing version will be incremented
-by 1 in the specified field.
+The `newversion` argument should be a valid semver string, *or* a
+valid second argument to semver.inc (one of "patch", "minor", "major",
+"prepatch", "preminor", "premajor", "prerelease"). In the second case,
+the existing version will be incremented by 1 in the specified field.
If run in a git repo, it will also create a version commit and tag, and
fail if the repo is not clean.
npm-index(7) -- Index of all npm documentation
==============================================
-## README(1)
+### README(1)
node package manager
-# Command Line Documentation
+## Command Line Documentation
-## npm(1)
+Using npm on the command line
+
+### npm(1)
node package manager
-## npm-adduser(1)
+### npm-adduser(1)
Add a registry user account
-## npm-bin(1)
+### npm-bin(1)
Display npm bin folder
-## npm-bugs(1)
+### npm-bugs(1)
Bugs for a package in a web browser maybe
-## npm-build(1)
+### npm-build(1)
Build a package
-## npm-bundle(1)
+### npm-bundle(1)
REMOVED
-## npm-cache(1)
+### npm-cache(1)
Manipulates packages cache
-## npm-completion(1)
+### npm-completion(1)
Tab Completion for npm
-## npm-config(1)
+### npm-config(1)
Manage the npm configuration files
-## npm-dedupe(1)
+### npm-dedupe(1)
Reduce duplication
-## npm-deprecate(1)
+### npm-deprecate(1)
Deprecate a version of a package
-## npm-docs(1)
+### npm-docs(1)
Docs for a package in a web browser maybe
-## npm-edit(1)
+### npm-edit(1)
Edit an installed package
-## npm-explore(1)
+### npm-explore(1)
Browse an installed package
-## npm-help-search(1)
+### npm-help-search(1)
Search npm help documentation
-## npm-help(1)
+### npm-help(1)
Get help on npm
-## npm-init(1)
+### npm-init(1)
Interactively create a package.json file
-## npm-install(1)
+### npm-install(1)
Install a package
-## npm-link(1)
+### npm-link(1)
Symlink a package folder
-## npm-ls(1)
+### npm-ls(1)
List installed packages
-## npm-outdated(1)
+### npm-outdated(1)
Check for outdated packages
-## npm-owner(1)
+### npm-owner(1)
Manage package owners
-## npm-pack(1)
+### npm-pack(1)
Create a tarball from a package
-## npm-prefix(1)
+### npm-prefix(1)
Display prefix
-## npm-prune(1)
+### npm-prune(1)
Remove extraneous packages
-## npm-publish(1)
+### npm-publish(1)
Publish a package
-## npm-rebuild(1)
+### npm-rebuild(1)
Rebuild a package
-## npm-repo(1)
+### npm-repo(1)
Open package repository page in the browser
-## npm-restart(1)
+### npm-restart(1)
Start a package
-## npm-rm(1)
+### npm-rm(1)
Remove a package
-## npm-root(1)
+### npm-root(1)
Display npm root
-## npm-run-script(1)
+### npm-run-script(1)
Run arbitrary package scripts
-## npm-search(1)
+### npm-search(1)
Search for packages
-## npm-shrinkwrap(1)
+### npm-shrinkwrap(1)
Lock down dependency versions
-## npm-star(1)
+### npm-star(1)
Mark your favorite packages
-## npm-stars(1)
+### npm-stars(1)
View packages marked as favorites
-## npm-start(1)
+### npm-start(1)
Start a package
-## npm-stop(1)
+### npm-stop(1)
Stop a package
-## npm-submodule(1)
+### npm-submodule(1)
Add a package as a git submodule
-## npm-tag(1)
+### npm-tag(1)
Tag a published version
-## npm-test(1)
+### npm-test(1)
Test a package
-## npm-uninstall(1)
+### npm-uninstall(1)
Remove a package
-## npm-unpublish(1)
+### npm-unpublish(1)
Remove a package from the registry
-## npm-update(1)
+### npm-update(1)
Update a package
-## npm-version(1)
+### npm-version(1)
Bump a package version
-## npm-view(1)
+### npm-view(1)
View registry info
-## npm-whoami(1)
+### npm-whoami(1)
Display npm username
-# API Documentation
+## API Documentation
+
+Using npm in your Node programs
-## npm(3)
+### npm(3)
node package manager
-## npm-bin(3)
+### npm-bin(3)
Display npm bin folder
-## npm-bugs(3)
+### npm-bugs(3)
Bugs for a package in a web browser maybe
-## npm-cache(3)
+### npm-cache(3)
manage the npm cache programmatically
-## npm-commands(3)
+### npm-commands(3)
npm commands
-## npm-config(3)
+### npm-config(3)
Manage the npm configuration files
-## npm-deprecate(3)
+### npm-deprecate(3)
Deprecate a version of a package
-## npm-docs(3)
+### npm-docs(3)
Docs for a package in a web browser maybe
-## npm-edit(3)
+### npm-edit(3)
Edit an installed package
-## npm-explore(3)
+### npm-explore(3)
Browse an installed package
-## npm-help-search(3)
+### npm-help-search(3)
Search the help pages
-## npm-init(3)
+### npm-init(3)
Interactively create a package.json file
-## npm-install(3)
+### npm-install(3)
install a package programmatically
-## npm-link(3)
+### npm-link(3)
Symlink a package folder
-## npm-load(3)
+### npm-load(3)
Load config settings
-## npm-ls(3)
+### npm-ls(3)
List installed packages
-## npm-outdated(3)
+### npm-outdated(3)
Check for outdated packages
-## npm-owner(3)
+### npm-owner(3)
Manage package owners
-## npm-pack(3)
+### npm-pack(3)
Create a tarball from a package
-## npm-prefix(3)
+### npm-prefix(3)
Display prefix
-## npm-prune(3)
+### npm-prune(3)
Remove extraneous packages
-## npm-publish(3)
+### npm-publish(3)
Publish a package
-## npm-rebuild(3)
+### npm-rebuild(3)
Rebuild a package
-## npm-repo(3)
+### npm-repo(3)
Open package repository page in the browser
-## npm-restart(3)
+### npm-restart(3)
Start a package
-## npm-root(3)
+### npm-root(3)
Display npm root
-## npm-run-script(3)
+### npm-run-script(3)
Run arbitrary package scripts
-## npm-search(3)
+### npm-search(3)
Search for packages
-## npm-shrinkwrap(3)
+### npm-shrinkwrap(3)
programmatically generate package shrinkwrap file
-## npm-start(3)
+### npm-start(3)
Start a package
-## npm-stop(3)
+### npm-stop(3)
Stop a package
-## npm-submodule(3)
+### npm-submodule(3)
Add a package as a git submodule
-## npm-tag(3)
+### npm-tag(3)
Tag a published version
-## npm-test(3)
+### npm-test(3)
Test a package
-## npm-uninstall(3)
+### npm-uninstall(3)
uninstall a package programmatically
-## npm-unpublish(3)
+### npm-unpublish(3)
Remove a package from the registry
-## npm-update(3)
+### npm-update(3)
Update a package
-## npm-version(3)
+### npm-version(3)
Bump a package version
-## npm-view(3)
+### npm-view(3)
View registry info
-## npm-whoami(3)
+### npm-whoami(3)
Display npm username
-# Files
+## Files
-## npm-folders(5)
+File system structures npm uses
+
+### npm-folders(5)
Folder Structures Used by npm
-## npmrc(5)
+### npmrc(5)
The npm config files
-## package.json(5)
+### package.json(5)
Specifics of npm's package.json handling
-# Misc
+## Misc
+
+Various other bits and bobs
-## npm-coding-style(7)
+### npm-coding-style(7)
npm's "funny" coding style
-## npm-config(7)
+### npm-config(7)
More than you probably want to know about npm configuration
-## npm-developers(7)
+### npm-developers(7)
Developer Guide
-## npm-disputes(7)
+### npm-disputes(7)
Handling Module Name Disputes
-## npm-faq(7)
+### npm-faq(7)
Frequently Asked Questions
-## npm-index(7)
+### npm-index(7)
Index of all npm documentation
-## npm-registry(7)
+### npm-registry(7)
The JavaScript Package Registry
-## npm-scripts(7)
+### npm-scripts(7)
How npm handles the "scripts" field
-## removing-npm(7)
+### removing-npm(7)
Cleaning the Slate
-## semver(7)
+### semver(7)
The semantic versioner for npm
<p>If you have a complaint about a package in the public npm registry,
and cannot <a href="https://www.npmjs.org/doc/misc/npm-disputes.html">resolve it with the package
owner</a>, please email
-<a href="mailto:support@npmjs.com">support@npmjs.com</a> and explain the situation.</p>
+<a href="mailto:support@npmjs.com">support@npmjs.com</a> and explain the situation.</p>
<p>Any data published to The npm Registry (including user account
information) may be removed or modified at the sole discretion of the
npm server administrators.</p>
<li>web:
<a href="https://github.com/npm/npm/issues">https://github.com/npm/npm/issues</a></li>
<li>email:
-<a href="mailto:npm-@googlegroups.com">npm-@googlegroups.com</a></li>
+<a href="mailto:npm-@googlegroups.com">npm-@googlegroups.com</a></li>
</ul>
<p>Be sure to include <em>all</em> of the output from the npm command that didn't work
as expected. The <code>npm-debug.log</code> file is also helpful to provide.</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer"><a href="../doc/README.html">README</a> — npm@1.4.23</p>
+<p id="footer"><a href="../doc/README.html">README</a> — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-bin — npm@1.4.23</p>
+<p id="footer">npm-bin — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-bugs — npm@1.4.23</p>
+<p id="footer">npm-bugs — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-cache — npm@1.4.23</p>
+<p id="footer">npm-cache — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-commands — npm@1.4.23</p>
+<p id="footer">npm-commands — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-config — npm@1.4.23</p>
+<p id="footer">npm-config — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-deprecate — npm@1.4.23</p>
+<p id="footer">npm-deprecate — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-docs — npm@1.4.23</p>
+<p id="footer">npm-docs — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-edit — npm@1.4.23</p>
+<p id="footer">npm-edit — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-explore — npm@1.4.23</p>
+<p id="footer">npm-explore — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-help-search — npm@1.4.23</p>
+<p id="footer">npm-help-search — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-init — npm@1.4.23</p>
+<p id="footer">npm-init — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-install — npm@1.4.23</p>
+<p id="footer">npm-install — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-link — npm@1.4.23</p>
+<p id="footer">npm-link — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-load — npm@1.4.23</p>
+<p id="footer">npm-load — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-ls — npm@1.4.23</p>
+<p id="footer">npm-ls — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-outdated — npm@1.4.23</p>
+<p id="footer">npm-outdated — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-owner — npm@1.4.23</p>
+<p id="footer">npm-owner — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-pack — npm@1.4.23</p>
+<p id="footer">npm-pack — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-prefix — npm@1.4.23</p>
+<p id="footer">npm-prefix — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-prune — npm@1.4.23</p>
+<p id="footer">npm-prune — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-publish — npm@1.4.23</p>
+<p id="footer">npm-publish — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-rebuild — npm@1.4.23</p>
+<p id="footer">npm-rebuild — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-repo — npm@1.4.23</p>
+<p id="footer">npm-repo — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-restart — npm@1.4.23</p>
+<p id="footer">npm-restart — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-root — npm@1.4.23</p>
+<p id="footer">npm-root — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-run-script — npm@1.4.23</p>
+<p id="footer">npm-run-script — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-search — npm@1.4.23</p>
+<p id="footer">npm-search — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-shrinkwrap — npm@1.4.23</p>
+<p id="footer">npm-shrinkwrap — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-start — npm@1.4.23</p>
+<p id="footer">npm-start — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-stop — npm@1.4.23</p>
+<p id="footer">npm-stop — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-submodule — npm@1.4.23</p>
+<p id="footer">npm-submodule — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-tag — npm@1.4.23</p>
+<p id="footer">npm-tag — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-test — npm@1.4.23</p>
+<p id="footer">npm-test — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-uninstall — npm@1.4.23</p>
+<p id="footer">npm-uninstall — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-unpublish — npm@1.4.23</p>
+<p id="footer">npm-unpublish — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-update — npm@1.4.23</p>
+<p id="footer">npm-update — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-version — npm@1.4.23</p>
+<p id="footer">npm-version — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-view — npm@1.4.23</p>
+<p id="footer">npm-view — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-whoami — npm@1.4.23</p>
+<p id="footer">npm-whoami — npm@1.4.28</p>
npm.commands.install(["package"], cb)
})
</code></pre><h2 id="version">VERSION</h2>
-<p>1.4.23</p>
+<p>1.4.28</p>
<h2 id="description">DESCRIPTION</h2>
<p>This is the API documentation for npm.
To find documentation of the command line
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm — npm@1.4.23</p>
+<p id="footer">npm — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-adduser — npm@1.4.23</p>
+<p id="footer">npm-adduser — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-bin — npm@1.4.23</p>
+<p id="footer">npm-bin — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-bugs — npm@1.4.23</p>
+<p id="footer">npm-bugs — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-build — npm@1.4.23</p>
+<p id="footer">npm-build — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-bundle — npm@1.4.23</p>
+<p id="footer">npm-bundle — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-cache — npm@1.4.23</p>
+<p id="footer">npm-cache — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-completion — npm@1.4.23</p>
+<p id="footer">npm-completion — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-config — npm@1.4.23</p>
+<p id="footer">npm-config — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-dedupe — npm@1.4.23</p>
+<p id="footer">npm-dedupe — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-deprecate — npm@1.4.23</p>
+<p id="footer">npm-deprecate — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-docs — npm@1.4.23</p>
+<p id="footer">npm-docs — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-edit — npm@1.4.23</p>
+<p id="footer">npm-edit — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-explore — npm@1.4.23</p>
+<p id="footer">npm-explore — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-help-search — npm@1.4.23</p>
+<p id="footer">npm-help-search — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-help — npm@1.4.23</p>
+<p id="footer">npm-help — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-init — npm@1.4.23</p>
+<p id="footer">npm-init — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-install — npm@1.4.23</p>
+<p id="footer">npm-install — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-link — npm@1.4.23</p>
+<p id="footer">npm-link — npm@1.4.28</p>
limit the results to only the paths to the packages named. Note that
nested packages will <em>also</em> show the paths to the specified packages.
For example, running <code>npm ls promzard</code> in npm's source tree will show:</p>
-<pre><code>npm@1.4.23 /path/to/npm
+<pre><code>npm@1.4.28 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre><p>It will print out extraneous, missing, and invalid packages.</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-ls — npm@1.4.23</p>
+<p id="footer">npm-ls — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-outdated — npm@1.4.23</p>
+<p id="footer">npm-outdated — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-owner — npm@1.4.23</p>
+<p id="footer">npm-owner — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-pack — npm@1.4.23</p>
+<p id="footer">npm-pack — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-prefix — npm@1.4.23</p>
+<p id="footer">npm-prefix — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-prune — npm@1.4.23</p>
+<p id="footer">npm-prune — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-publish — npm@1.4.23</p>
+<p id="footer">npm-publish — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-rebuild — npm@1.4.23</p>
+<p id="footer">npm-rebuild — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-repo — npm@1.4.23</p>
+<p id="footer">npm-repo — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-restart — npm@1.4.23</p>
+<p id="footer">npm-restart — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-rm — npm@1.4.23</p>
+<p id="footer">npm-rm — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-root — npm@1.4.23</p>
+<p id="footer">npm-root — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-run-script — npm@1.4.23</p>
+<p id="footer">npm-run-script — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-search — npm@1.4.23</p>
+<p id="footer">npm-search — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-shrinkwrap — npm@1.4.23</p>
+<p id="footer">npm-shrinkwrap — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-star — npm@1.4.23</p>
+<p id="footer">npm-star — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-stars — npm@1.4.23</p>
+<p id="footer">npm-stars — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-start — npm@1.4.23</p>
+<p id="footer">npm-start — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-stop — npm@1.4.23</p>
+<p id="footer">npm-stop — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-submodule — npm@1.4.23</p>
+<p id="footer">npm-submodule — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-tag — npm@1.4.23</p>
+<p id="footer">npm-tag — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-test — npm@1.4.23</p>
+<p id="footer">npm-test — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-uninstall — npm@1.4.23</p>
+<p id="footer">npm-uninstall — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-unpublish — npm@1.4.23</p>
+<p id="footer">npm-unpublish — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-update — npm@1.4.23</p>
+<p id="footer">npm-update — npm@1.4.28</p>
<h1><a href="../cli/npm-version.html">npm-version</a></h1> <p>Bump a package version</p>
<h2 id="synopsis">SYNOPSIS</h2>
-<pre><code>npm version [<newversion> | major | minor | patch]
+<pre><code>npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease]
</code></pre><h2 id="description">DESCRIPTION</h2>
<p>Run this in a package directory to bump the version and write the new
data back to the package.json file.</p>
-<p>The <code>newversion</code> argument should be a valid semver string, <em>or</em> a valid
-second argument to semver.inc (one of "patch", "minor", or
-"major"). In the second case, the existing version will be incremented
-by 1 in the specified field.</p>
+<p>The <code>newversion</code> argument should be a valid semver string, <em>or</em> a
+valid second argument to semver.inc (one of "patch", "minor", "major",
+"prepatch", "preminor", "premajor", "prerelease"). In the second case,
+the existing version will be incremented by 1 in the specified field.</p>
<p>If run in a git repo, it will also create a version commit and tag, and
fail if the repo is not clean.</p>
<p>If supplied with <code>--message</code> (shorthand: <code>-m</code>) config option, npm will
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-version — npm@1.4.23</p>
+<p id="footer">npm-version — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-view — npm@1.4.23</p>
+<p id="footer">npm-view — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-whoami — npm@1.4.23</p>
+<p id="footer">npm-whoami — npm@1.4.28</p>
<h2 id="synopsis">SYNOPSIS</h2>
<pre><code>npm <command> [args]
</code></pre><h2 id="version">VERSION</h2>
-<p>1.4.23</p>
+<p>1.4.28</p>
<h2 id="description">DESCRIPTION</h2>
<p>npm is the package manager for the Node JavaScript platform. It puts
modules in place so that node can find them, and manages dependency
the issues list or ask on the mailing list.</p>
<ul>
<li><a href="http://github.com/npm/npm/issues">http://github.com/npm/npm/issues</a></li>
-<li><a href="mailto:npm-@googlegroups.com">npm-@googlegroups.com</a></li>
+<li><a href="mailto:npm-@googlegroups.com">npm-@googlegroups.com</a></li>
</ul>
<h2 id="bugs">BUGS</h2>
<p>When you find issues, please report them:</p>
<li>web:
<a href="http://github.com/npm/npm/issues">http://github.com/npm/npm/issues</a></li>
<li>email:
-<a href="mailto:npm-@googlegroups.com">npm-@googlegroups.com</a></li>
+<a href="mailto:npm-@googlegroups.com">npm-@googlegroups.com</a></li>
</ul>
<p>Be sure to include <em>all</em> of the output from the npm command that didn't work
as expected. The <code>npm-debug.log</code> file is also helpful to provide.</p>
<p><a href="http://blog.izs.me/">Isaac Z. Schlueter</a> ::
<a href="https://github.com/isaacs/">isaacs</a> ::
<a href="http://twitter.com/izs">@izs</a> ::
-<a href="mailto:i@izs.me">i@izs.me</a></p>
+<a href="mailto:i@izs.me">i@izs.me</a></p>
<h2 id="see-also">SEE ALSO</h2>
<ul>
<li><a href="../cli/npm-help.html">npm-help(1)</a></li>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm — npm@1.4.23</p>
+<p id="footer">npm — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-folders — npm@1.4.23</p>
+<p id="footer">npm-folders — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-folders — npm@1.4.23</p>
+<p id="footer">npm-folders — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">package.json — npm@1.4.23</p>
+<p id="footer">package.json — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npmrc — npm@1.4.23</p>
+<p id="footer">npmrc — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">package.json — npm@1.4.23</p>
+<p id="footer">package.json — npm@1.4.28</p>
<div id="wrapper">
<h1><a href="misc/npm-index.html">npm-index</a></h1> <p>Index of all npm documentation</p>
-<h2 id="readme-1-"><a href="../doc/README.html">README</a></h2>
+<h3 id="readme-1-"><a href="../doc/README.html">README</a></h3>
<p>node package manager</p>
-<h1 id="command-line-documentation">Command Line Documentation</h1>
-<h2 id="npm-1-"><a href="cli/npm.html">npm(1)</a></h2>
+<h2 id="command-line-documentation">Command Line Documentation</h2>
+<p>Using npm on the command line</p>
+<h3 id="npm-1-"><a href="cli/npm.html">npm(1)</a></h3>
<p>node package manager</p>
-<h2 id="npm-adduser-1-"><a href="cli/npm-adduser.html">npm-adduser(1)</a></h2>
+<h3 id="npm-adduser-1-"><a href="cli/npm-adduser.html">npm-adduser(1)</a></h3>
<p>Add a registry user account</p>
-<h2 id="npm-bin-1-"><a href="cli/npm-bin.html">npm-bin(1)</a></h2>
+<h3 id="npm-bin-1-"><a href="cli/npm-bin.html">npm-bin(1)</a></h3>
<p>Display npm bin folder</p>
-<h2 id="npm-bugs-1-"><a href="cli/npm-bugs.html">npm-bugs(1)</a></h2>
+<h3 id="npm-bugs-1-"><a href="cli/npm-bugs.html">npm-bugs(1)</a></h3>
<p>Bugs for a package in a web browser maybe</p>
-<h2 id="npm-build-1-"><a href="cli/npm-build.html">npm-build(1)</a></h2>
+<h3 id="npm-build-1-"><a href="cli/npm-build.html">npm-build(1)</a></h3>
<p>Build a package</p>
-<h2 id="npm-bundle-1-"><a href="cli/npm-bundle.html">npm-bundle(1)</a></h2>
+<h3 id="npm-bundle-1-"><a href="cli/npm-bundle.html">npm-bundle(1)</a></h3>
<p>REMOVED</p>
-<h2 id="npm-cache-1-"><a href="cli/npm-cache.html">npm-cache(1)</a></h2>
+<h3 id="npm-cache-1-"><a href="cli/npm-cache.html">npm-cache(1)</a></h3>
<p>Manipulates packages cache</p>
-<h2 id="npm-completion-1-"><a href="cli/npm-completion.html">npm-completion(1)</a></h2>
+<h3 id="npm-completion-1-"><a href="cli/npm-completion.html">npm-completion(1)</a></h3>
<p>Tab Completion for npm</p>
-<h2 id="npm-config-1-"><a href="cli/npm-config.html">npm-config(1)</a></h2>
+<h3 id="npm-config-1-"><a href="cli/npm-config.html">npm-config(1)</a></h3>
<p>Manage the npm configuration files</p>
-<h2 id="npm-dedupe-1-"><a href="cli/npm-dedupe.html">npm-dedupe(1)</a></h2>
+<h3 id="npm-dedupe-1-"><a href="cli/npm-dedupe.html">npm-dedupe(1)</a></h3>
<p>Reduce duplication</p>
-<h2 id="npm-deprecate-1-"><a href="cli/npm-deprecate.html">npm-deprecate(1)</a></h2>
+<h3 id="npm-deprecate-1-"><a href="cli/npm-deprecate.html">npm-deprecate(1)</a></h3>
<p>Deprecate a version of a package</p>
-<h2 id="npm-docs-1-"><a href="cli/npm-docs.html">npm-docs(1)</a></h2>
+<h3 id="npm-docs-1-"><a href="cli/npm-docs.html">npm-docs(1)</a></h3>
<p>Docs for a package in a web browser maybe</p>
-<h2 id="npm-edit-1-"><a href="cli/npm-edit.html">npm-edit(1)</a></h2>
+<h3 id="npm-edit-1-"><a href="cli/npm-edit.html">npm-edit(1)</a></h3>
<p>Edit an installed package</p>
-<h2 id="npm-explore-1-"><a href="cli/npm-explore.html">npm-explore(1)</a></h2>
+<h3 id="npm-explore-1-"><a href="cli/npm-explore.html">npm-explore(1)</a></h3>
<p>Browse an installed package</p>
-<h2 id="npm-help-search-1-"><a href="cli/npm-help-search.html">npm-help-search(1)</a></h2>
+<h3 id="npm-help-search-1-"><a href="cli/npm-help-search.html">npm-help-search(1)</a></h3>
<p>Search npm help documentation</p>
-<h2 id="npm-help-1-"><a href="cli/npm-help.html">npm-help(1)</a></h2>
+<h3 id="npm-help-1-"><a href="cli/npm-help.html">npm-help(1)</a></h3>
<p>Get help on npm</p>
-<h2 id="npm-init-1-"><a href="cli/npm-init.html">npm-init(1)</a></h2>
+<h3 id="npm-init-1-"><a href="cli/npm-init.html">npm-init(1)</a></h3>
<p>Interactively create a package.json file</p>
-<h2 id="npm-install-1-"><a href="cli/npm-install.html">npm-install(1)</a></h2>
+<h3 id="npm-install-1-"><a href="cli/npm-install.html">npm-install(1)</a></h3>
<p>Install a package</p>
-<h2 id="npm-link-1-"><a href="cli/npm-link.html">npm-link(1)</a></h2>
+<h3 id="npm-link-1-"><a href="cli/npm-link.html">npm-link(1)</a></h3>
<p>Symlink a package folder</p>
-<h2 id="npm-ls-1-"><a href="cli/npm-ls.html">npm-ls(1)</a></h2>
+<h3 id="npm-ls-1-"><a href="cli/npm-ls.html">npm-ls(1)</a></h3>
<p>List installed packages</p>
-<h2 id="npm-outdated-1-"><a href="cli/npm-outdated.html">npm-outdated(1)</a></h2>
+<h3 id="npm-outdated-1-"><a href="cli/npm-outdated.html">npm-outdated(1)</a></h3>
<p>Check for outdated packages</p>
-<h2 id="npm-owner-1-"><a href="cli/npm-owner.html">npm-owner(1)</a></h2>
+<h3 id="npm-owner-1-"><a href="cli/npm-owner.html">npm-owner(1)</a></h3>
<p>Manage package owners</p>
-<h2 id="npm-pack-1-"><a href="cli/npm-pack.html">npm-pack(1)</a></h2>
+<h3 id="npm-pack-1-"><a href="cli/npm-pack.html">npm-pack(1)</a></h3>
<p>Create a tarball from a package</p>
-<h2 id="npm-prefix-1-"><a href="cli/npm-prefix.html">npm-prefix(1)</a></h2>
+<h3 id="npm-prefix-1-"><a href="cli/npm-prefix.html">npm-prefix(1)</a></h3>
<p>Display prefix</p>
-<h2 id="npm-prune-1-"><a href="cli/npm-prune.html">npm-prune(1)</a></h2>
+<h3 id="npm-prune-1-"><a href="cli/npm-prune.html">npm-prune(1)</a></h3>
<p>Remove extraneous packages</p>
-<h2 id="npm-publish-1-"><a href="cli/npm-publish.html">npm-publish(1)</a></h2>
+<h3 id="npm-publish-1-"><a href="cli/npm-publish.html">npm-publish(1)</a></h3>
<p>Publish a package</p>
-<h2 id="npm-rebuild-1-"><a href="cli/npm-rebuild.html">npm-rebuild(1)</a></h2>
+<h3 id="npm-rebuild-1-"><a href="cli/npm-rebuild.html">npm-rebuild(1)</a></h3>
<p>Rebuild a package</p>
-<h2 id="npm-repo-1-"><a href="cli/npm-repo.html">npm-repo(1)</a></h2>
+<h3 id="npm-repo-1-"><a href="cli/npm-repo.html">npm-repo(1)</a></h3>
<p>Open package repository page in the browser</p>
-<h2 id="npm-restart-1-"><a href="cli/npm-restart.html">npm-restart(1)</a></h2>
+<h3 id="npm-restart-1-"><a href="cli/npm-restart.html">npm-restart(1)</a></h3>
<p>Start a package</p>
-<h2 id="npm-rm-1-"><a href="cli/npm-rm.html">npm-rm(1)</a></h2>
+<h3 id="npm-rm-1-"><a href="cli/npm-rm.html">npm-rm(1)</a></h3>
<p>Remove a package</p>
-<h2 id="npm-root-1-"><a href="cli/npm-root.html">npm-root(1)</a></h2>
+<h3 id="npm-root-1-"><a href="cli/npm-root.html">npm-root(1)</a></h3>
<p>Display npm root</p>
-<h2 id="npm-run-script-1-"><a href="cli/npm-run-script.html">npm-run-script(1)</a></h2>
+<h3 id="npm-run-script-1-"><a href="cli/npm-run-script.html">npm-run-script(1)</a></h3>
<p>Run arbitrary package scripts</p>
-<h2 id="npm-search-1-"><a href="cli/npm-search.html">npm-search(1)</a></h2>
+<h3 id="npm-search-1-"><a href="cli/npm-search.html">npm-search(1)</a></h3>
<p>Search for packages</p>
-<h2 id="npm-shrinkwrap-1-"><a href="cli/npm-shrinkwrap.html">npm-shrinkwrap(1)</a></h2>
+<h3 id="npm-shrinkwrap-1-"><a href="cli/npm-shrinkwrap.html">npm-shrinkwrap(1)</a></h3>
<p>Lock down dependency versions</p>
-<h2 id="npm-star-1-"><a href="cli/npm-star.html">npm-star(1)</a></h2>
+<h3 id="npm-star-1-"><a href="cli/npm-star.html">npm-star(1)</a></h3>
<p>Mark your favorite packages</p>
-<h2 id="npm-stars-1-"><a href="cli/npm-stars.html">npm-stars(1)</a></h2>
+<h3 id="npm-stars-1-"><a href="cli/npm-stars.html">npm-stars(1)</a></h3>
<p>View packages marked as favorites</p>
-<h2 id="npm-start-1-"><a href="cli/npm-start.html">npm-start(1)</a></h2>
+<h3 id="npm-start-1-"><a href="cli/npm-start.html">npm-start(1)</a></h3>
<p>Start a package</p>
-<h2 id="npm-stop-1-"><a href="cli/npm-stop.html">npm-stop(1)</a></h2>
+<h3 id="npm-stop-1-"><a href="cli/npm-stop.html">npm-stop(1)</a></h3>
<p>Stop a package</p>
-<h2 id="npm-submodule-1-"><a href="cli/npm-submodule.html">npm-submodule(1)</a></h2>
+<h3 id="npm-submodule-1-"><a href="cli/npm-submodule.html">npm-submodule(1)</a></h3>
<p>Add a package as a git submodule</p>
-<h2 id="npm-tag-1-"><a href="cli/npm-tag.html">npm-tag(1)</a></h2>
+<h3 id="npm-tag-1-"><a href="cli/npm-tag.html">npm-tag(1)</a></h3>
<p>Tag a published version</p>
-<h2 id="npm-test-1-"><a href="cli/npm-test.html">npm-test(1)</a></h2>
+<h3 id="npm-test-1-"><a href="cli/npm-test.html">npm-test(1)</a></h3>
<p>Test a package</p>
-<h2 id="npm-uninstall-1-"><a href="cli/npm-uninstall.html">npm-uninstall(1)</a></h2>
+<h3 id="npm-uninstall-1-"><a href="cli/npm-uninstall.html">npm-uninstall(1)</a></h3>
<p>Remove a package</p>
-<h2 id="npm-unpublish-1-"><a href="cli/npm-unpublish.html">npm-unpublish(1)</a></h2>
+<h3 id="npm-unpublish-1-"><a href="cli/npm-unpublish.html">npm-unpublish(1)</a></h3>
<p>Remove a package from the registry</p>
-<h2 id="npm-update-1-"><a href="cli/npm-update.html">npm-update(1)</a></h2>
+<h3 id="npm-update-1-"><a href="cli/npm-update.html">npm-update(1)</a></h3>
<p>Update a package</p>
-<h2 id="npm-version-1-"><a href="cli/npm-version.html">npm-version(1)</a></h2>
+<h3 id="npm-version-1-"><a href="cli/npm-version.html">npm-version(1)</a></h3>
<p>Bump a package version</p>
-<h2 id="npm-view-1-"><a href="cli/npm-view.html">npm-view(1)</a></h2>
+<h3 id="npm-view-1-"><a href="cli/npm-view.html">npm-view(1)</a></h3>
<p>View registry info</p>
-<h2 id="npm-whoami-1-"><a href="cli/npm-whoami.html">npm-whoami(1)</a></h2>
+<h3 id="npm-whoami-1-"><a href="cli/npm-whoami.html">npm-whoami(1)</a></h3>
<p>Display npm username</p>
-<h1 id="api-documentation">API Documentation</h1>
-<h2 id="npm-3-"><a href="api/npm.html">npm(3)</a></h2>
+<h2 id="api-documentation">API Documentation</h2>
+<p>Using npm in your Node programs</p>
+<h3 id="npm-3-"><a href="api/npm.html">npm(3)</a></h3>
<p>node package manager</p>
-<h2 id="npm-bin-3-"><a href="api/npm-bin.html">npm-bin(3)</a></h2>
+<h3 id="npm-bin-3-"><a href="api/npm-bin.html">npm-bin(3)</a></h3>
<p>Display npm bin folder</p>
-<h2 id="npm-bugs-3-"><a href="api/npm-bugs.html">npm-bugs(3)</a></h2>
+<h3 id="npm-bugs-3-"><a href="api/npm-bugs.html">npm-bugs(3)</a></h3>
<p>Bugs for a package in a web browser maybe</p>
-<h2 id="npm-cache-3-"><a href="api/npm-cache.html">npm-cache(3)</a></h2>
+<h3 id="npm-cache-3-"><a href="api/npm-cache.html">npm-cache(3)</a></h3>
<p>manage the npm cache programmatically</p>
-<h2 id="npm-commands-3-"><a href="api/npm-commands.html">npm-commands(3)</a></h2>
+<h3 id="npm-commands-3-"><a href="api/npm-commands.html">npm-commands(3)</a></h3>
<p>npm commands</p>
-<h2 id="npm-config-3-"><a href="api/npm-config.html">npm-config(3)</a></h2>
+<h3 id="npm-config-3-"><a href="api/npm-config.html">npm-config(3)</a></h3>
<p>Manage the npm configuration files</p>
-<h2 id="npm-deprecate-3-"><a href="api/npm-deprecate.html">npm-deprecate(3)</a></h2>
+<h3 id="npm-deprecate-3-"><a href="api/npm-deprecate.html">npm-deprecate(3)</a></h3>
<p>Deprecate a version of a package</p>
-<h2 id="npm-docs-3-"><a href="api/npm-docs.html">npm-docs(3)</a></h2>
+<h3 id="npm-docs-3-"><a href="api/npm-docs.html">npm-docs(3)</a></h3>
<p>Docs for a package in a web browser maybe</p>
-<h2 id="npm-edit-3-"><a href="api/npm-edit.html">npm-edit(3)</a></h2>
+<h3 id="npm-edit-3-"><a href="api/npm-edit.html">npm-edit(3)</a></h3>
<p>Edit an installed package</p>
-<h2 id="npm-explore-3-"><a href="api/npm-explore.html">npm-explore(3)</a></h2>
+<h3 id="npm-explore-3-"><a href="api/npm-explore.html">npm-explore(3)</a></h3>
<p>Browse an installed package</p>
-<h2 id="npm-help-search-3-"><a href="api/npm-help-search.html">npm-help-search(3)</a></h2>
+<h3 id="npm-help-search-3-"><a href="api/npm-help-search.html">npm-help-search(3)</a></h3>
<p>Search the help pages</p>
-<h2 id="npm-init-3-"><a href="api/npm-init.html">npm-init(3)</a></h2>
+<h3 id="npm-init-3-"><a href="api/npm-init.html">npm-init(3)</a></h3>
<p>Interactively create a package.json file</p>
-<h2 id="npm-install-3-"><a href="api/npm-install.html">npm-install(3)</a></h2>
+<h3 id="npm-install-3-"><a href="api/npm-install.html">npm-install(3)</a></h3>
<p>install a package programmatically</p>
-<h2 id="npm-link-3-"><a href="api/npm-link.html">npm-link(3)</a></h2>
+<h3 id="npm-link-3-"><a href="api/npm-link.html">npm-link(3)</a></h3>
<p>Symlink a package folder</p>
-<h2 id="npm-load-3-"><a href="api/npm-load.html">npm-load(3)</a></h2>
+<h3 id="npm-load-3-"><a href="api/npm-load.html">npm-load(3)</a></h3>
<p>Load config settings</p>
-<h2 id="npm-ls-3-"><a href="api/npm-ls.html">npm-ls(3)</a></h2>
+<h3 id="npm-ls-3-"><a href="api/npm-ls.html">npm-ls(3)</a></h3>
<p>List installed packages</p>
-<h2 id="npm-outdated-3-"><a href="api/npm-outdated.html">npm-outdated(3)</a></h2>
+<h3 id="npm-outdated-3-"><a href="api/npm-outdated.html">npm-outdated(3)</a></h3>
<p>Check for outdated packages</p>
-<h2 id="npm-owner-3-"><a href="api/npm-owner.html">npm-owner(3)</a></h2>
+<h3 id="npm-owner-3-"><a href="api/npm-owner.html">npm-owner(3)</a></h3>
<p>Manage package owners</p>
-<h2 id="npm-pack-3-"><a href="api/npm-pack.html">npm-pack(3)</a></h2>
+<h3 id="npm-pack-3-"><a href="api/npm-pack.html">npm-pack(3)</a></h3>
<p>Create a tarball from a package</p>
-<h2 id="npm-prefix-3-"><a href="api/npm-prefix.html">npm-prefix(3)</a></h2>
+<h3 id="npm-prefix-3-"><a href="api/npm-prefix.html">npm-prefix(3)</a></h3>
<p>Display prefix</p>
-<h2 id="npm-prune-3-"><a href="api/npm-prune.html">npm-prune(3)</a></h2>
+<h3 id="npm-prune-3-"><a href="api/npm-prune.html">npm-prune(3)</a></h3>
<p>Remove extraneous packages</p>
-<h2 id="npm-publish-3-"><a href="api/npm-publish.html">npm-publish(3)</a></h2>
+<h3 id="npm-publish-3-"><a href="api/npm-publish.html">npm-publish(3)</a></h3>
<p>Publish a package</p>
-<h2 id="npm-rebuild-3-"><a href="api/npm-rebuild.html">npm-rebuild(3)</a></h2>
+<h3 id="npm-rebuild-3-"><a href="api/npm-rebuild.html">npm-rebuild(3)</a></h3>
<p>Rebuild a package</p>
-<h2 id="npm-repo-3-"><a href="api/npm-repo.html">npm-repo(3)</a></h2>
+<h3 id="npm-repo-3-"><a href="api/npm-repo.html">npm-repo(3)</a></h3>
<p>Open package repository page in the browser</p>
-<h2 id="npm-restart-3-"><a href="api/npm-restart.html">npm-restart(3)</a></h2>
+<h3 id="npm-restart-3-"><a href="api/npm-restart.html">npm-restart(3)</a></h3>
<p>Start a package</p>
-<h2 id="npm-root-3-"><a href="api/npm-root.html">npm-root(3)</a></h2>
+<h3 id="npm-root-3-"><a href="api/npm-root.html">npm-root(3)</a></h3>
<p>Display npm root</p>
-<h2 id="npm-run-script-3-"><a href="api/npm-run-script.html">npm-run-script(3)</a></h2>
+<h3 id="npm-run-script-3-"><a href="api/npm-run-script.html">npm-run-script(3)</a></h3>
<p>Run arbitrary package scripts</p>
-<h2 id="npm-search-3-"><a href="api/npm-search.html">npm-search(3)</a></h2>
+<h3 id="npm-search-3-"><a href="api/npm-search.html">npm-search(3)</a></h3>
<p>Search for packages</p>
-<h2 id="npm-shrinkwrap-3-"><a href="api/npm-shrinkwrap.html">npm-shrinkwrap(3)</a></h2>
+<h3 id="npm-shrinkwrap-3-"><a href="api/npm-shrinkwrap.html">npm-shrinkwrap(3)</a></h3>
<p>programmatically generate package shrinkwrap file</p>
-<h2 id="npm-start-3-"><a href="api/npm-start.html">npm-start(3)</a></h2>
+<h3 id="npm-start-3-"><a href="api/npm-start.html">npm-start(3)</a></h3>
<p>Start a package</p>
-<h2 id="npm-stop-3-"><a href="api/npm-stop.html">npm-stop(3)</a></h2>
+<h3 id="npm-stop-3-"><a href="api/npm-stop.html">npm-stop(3)</a></h3>
<p>Stop a package</p>
-<h2 id="npm-submodule-3-"><a href="api/npm-submodule.html">npm-submodule(3)</a></h2>
+<h3 id="npm-submodule-3-"><a href="api/npm-submodule.html">npm-submodule(3)</a></h3>
<p>Add a package as a git submodule</p>
-<h2 id="npm-tag-3-"><a href="api/npm-tag.html">npm-tag(3)</a></h2>
+<h3 id="npm-tag-3-"><a href="api/npm-tag.html">npm-tag(3)</a></h3>
<p>Tag a published version</p>
-<h2 id="npm-test-3-"><a href="api/npm-test.html">npm-test(3)</a></h2>
+<h3 id="npm-test-3-"><a href="api/npm-test.html">npm-test(3)</a></h3>
<p>Test a package</p>
-<h2 id="npm-uninstall-3-"><a href="api/npm-uninstall.html">npm-uninstall(3)</a></h2>
+<h3 id="npm-uninstall-3-"><a href="api/npm-uninstall.html">npm-uninstall(3)</a></h3>
<p>uninstall a package programmatically</p>
-<h2 id="npm-unpublish-3-"><a href="api/npm-unpublish.html">npm-unpublish(3)</a></h2>
+<h3 id="npm-unpublish-3-"><a href="api/npm-unpublish.html">npm-unpublish(3)</a></h3>
<p>Remove a package from the registry</p>
-<h2 id="npm-update-3-"><a href="api/npm-update.html">npm-update(3)</a></h2>
+<h3 id="npm-update-3-"><a href="api/npm-update.html">npm-update(3)</a></h3>
<p>Update a package</p>
-<h2 id="npm-version-3-"><a href="api/npm-version.html">npm-version(3)</a></h2>
+<h3 id="npm-version-3-"><a href="api/npm-version.html">npm-version(3)</a></h3>
<p>Bump a package version</p>
-<h2 id="npm-view-3-"><a href="api/npm-view.html">npm-view(3)</a></h2>
+<h3 id="npm-view-3-"><a href="api/npm-view.html">npm-view(3)</a></h3>
<p>View registry info</p>
-<h2 id="npm-whoami-3-"><a href="api/npm-whoami.html">npm-whoami(3)</a></h2>
+<h3 id="npm-whoami-3-"><a href="api/npm-whoami.html">npm-whoami(3)</a></h3>
<p>Display npm username</p>
-<h1 id="files">Files</h1>
-<h2 id="npm-folders-5-"><a href="files/npm-folders.html">npm-folders(5)</a></h2>
+<h2 id="files">Files</h2>
+<p>File system structures npm uses</p>
+<h3 id="npm-folders-5-"><a href="files/npm-folders.html">npm-folders(5)</a></h3>
<p>Folder Structures Used by npm</p>
-<h2 id="npmrc-5-"><a href="files/npmrc.html">npmrc(5)</a></h2>
+<h3 id="npmrc-5-"><a href="files/npmrc.html">npmrc(5)</a></h3>
<p>The npm config files</p>
-<h2 id="package-json-5-"><a href="files/package.json.html">package.json(5)</a></h2>
+<h3 id="package-json-5-"><a href="files/package.json.html">package.json(5)</a></h3>
<p>Specifics of npm's package.json handling</p>
-<h1 id="misc">Misc</h1>
-<h2 id="npm-coding-style-7-"><a href="misc/npm-coding-style.html">npm-coding-style(7)</a></h2>
+<h2 id="misc">Misc</h2>
+<p>Various other bits and bobs</p>
+<h3 id="npm-coding-style-7-"><a href="misc/npm-coding-style.html">npm-coding-style(7)</a></h3>
<p>npm's "funny" coding style</p>
-<h2 id="npm-config-7-"><a href="misc/npm-config.html">npm-config(7)</a></h2>
+<h3 id="npm-config-7-"><a href="misc/npm-config.html">npm-config(7)</a></h3>
<p>More than you probably want to know about npm configuration</p>
-<h2 id="npm-developers-7-"><a href="misc/npm-developers.html">npm-developers(7)</a></h2>
+<h3 id="npm-developers-7-"><a href="misc/npm-developers.html">npm-developers(7)</a></h3>
<p>Developer Guide</p>
-<h2 id="npm-disputes-7-"><a href="misc/npm-disputes.html">npm-disputes(7)</a></h2>
+<h3 id="npm-disputes-7-"><a href="misc/npm-disputes.html">npm-disputes(7)</a></h3>
<p>Handling Module Name Disputes</p>
-<h2 id="npm-faq-7-"><a href="misc/npm-faq.html">npm-faq(7)</a></h2>
+<h3 id="npm-faq-7-"><a href="misc/npm-faq.html">npm-faq(7)</a></h3>
<p>Frequently Asked Questions</p>
-<h2 id="npm-index-7-"><a href="misc/npm-index.html">npm-index(7)</a></h2>
+<h3 id="npm-index-7-"><a href="misc/npm-index.html">npm-index(7)</a></h3>
<p>Index of all npm documentation</p>
-<h2 id="npm-registry-7-"><a href="misc/npm-registry.html">npm-registry(7)</a></h2>
+<h3 id="npm-registry-7-"><a href="misc/npm-registry.html">npm-registry(7)</a></h3>
<p>The JavaScript Package Registry</p>
-<h2 id="npm-scripts-7-"><a href="misc/npm-scripts.html">npm-scripts(7)</a></h2>
+<h3 id="npm-scripts-7-"><a href="misc/npm-scripts.html">npm-scripts(7)</a></h3>
<p>How npm handles the "scripts" field</p>
-<h2 id="removing-npm-7-"><a href="misc/removing-npm.html">removing-npm(7)</a></h2>
+<h3 id="removing-npm-7-"><a href="misc/removing-npm.html">removing-npm(7)</a></h3>
<p>Cleaning the Slate</p>
-<h2 id="semver-7-"><a href="misc/semver.html">semver(7)</a></h2>
+<h3 id="semver-7-"><a href="misc/semver.html">semver(7)</a></h3>
<p>The semantic versioner for npm</p>
</div>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-index — npm@1.4.23</p>
+<p id="footer">npm-index — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-coding-style — npm@1.4.23</p>
+<p id="footer">npm-coding-style — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-config — npm@1.4.23</p>
+<p id="footer">npm-config — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-developers — npm@1.4.23</p>
+<p id="footer">npm-developers — npm@1.4.28</p>
<h2 id="synopsis">SYNOPSIS</h2>
<ol>
<li>Get the author email with <code>npm owner ls <pkgname></code></li>
-<li>Email the author, CC <a href="mailto:support@npmjs.com">support@npmjs.com</a></li>
+<li>Email the author, CC <a href="mailto:support@npmjs.com">support@npmjs.com</a></li>
<li>After a few weeks, if there's no resolution, we'll sort it out.</li>
</ol>
<p>Don't squat on package names. Publish code or move out of the way.</p>
owner (Bob).</li>
<li>Joe emails Bob, explaining the situation <strong>as respectfully as
possible</strong>, and what he would like to do with the module name. He
-adds the npm support staff <a href="mailto:support@npmjs.com">support@npmjs.com</a> to the CC list of
+adds the npm support staff <a href="mailto:support@npmjs.com">support@npmjs.com</a> to the CC list of
the email. Mention in the email that Bob can run <code>npm owner add
joe foo</code> to add Joe as an owner of the <code>foo</code> package.</li>
<li>After a reasonable amount of time, if Bob has not responded, or if
Bob and Joe can't come to any sort of resolution, email support
-<a href="mailto:support@npmjs.com">support@npmjs.com</a> and we'll sort it out. ("Reasonable" is
+<a href="mailto:support@npmjs.com">support@npmjs.com</a> and we'll sort it out. ("Reasonable" is
usually at least 4 weeks, but extra time is allowed around common
holidays.)</li>
</ol>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-disputes — npm@1.4.23</p>
+<p id="footer">npm-disputes — npm@1.4.28</p>
<p>To check if the registry is down, open up
<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a> in a web browser. This will also tell
you if you are just unable to access the internet for some reason.</p>
-<p>If the registry IS down, let us know by emailing <a href="mailto:support@npmjs.com">support@npmjs.com</a>
+<p>If the registry IS down, let us know by emailing <a href="mailto:support@npmjs.com">support@npmjs.com</a>
or posting an issue at <a href="https://github.com/npm/npm/issues">https://github.com/npm/npm/issues</a>. If it's
down for the world (and not just on your local network) then we're
probably already being pinged about it.</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-faq — npm@1.4.23</p>
+<p id="footer">npm-faq — npm@1.4.28</p>
<div id="wrapper">
<h1><a href="../misc/npm-index.html">npm-index</a></h1> <p>Index of all npm documentation</p>
-<h2 id="readme-1-"><a href="../../doc/README.html">README</a></h2>
+<h3 id="readme-1-"><a href="../../doc/README.html">README</a></h3>
<p>node package manager</p>
-<h1 id="command-line-documentation">Command Line Documentation</h1>
-<h2 id="npm-1-"><a href="../cli/npm.html">npm(1)</a></h2>
+<h2 id="command-line-documentation">Command Line Documentation</h2>
+<p>Using npm on the command line</p>
+<h3 id="npm-1-"><a href="../cli/npm.html">npm(1)</a></h3>
<p>node package manager</p>
-<h2 id="npm-adduser-1-"><a href="../cli/npm-adduser.html">npm-adduser(1)</a></h2>
+<h3 id="npm-adduser-1-"><a href="../cli/npm-adduser.html">npm-adduser(1)</a></h3>
<p>Add a registry user account</p>
-<h2 id="npm-bin-1-"><a href="../cli/npm-bin.html">npm-bin(1)</a></h2>
+<h3 id="npm-bin-1-"><a href="../cli/npm-bin.html">npm-bin(1)</a></h3>
<p>Display npm bin folder</p>
-<h2 id="npm-bugs-1-"><a href="../cli/npm-bugs.html">npm-bugs(1)</a></h2>
+<h3 id="npm-bugs-1-"><a href="../cli/npm-bugs.html">npm-bugs(1)</a></h3>
<p>Bugs for a package in a web browser maybe</p>
-<h2 id="npm-build-1-"><a href="../cli/npm-build.html">npm-build(1)</a></h2>
+<h3 id="npm-build-1-"><a href="../cli/npm-build.html">npm-build(1)</a></h3>
<p>Build a package</p>
-<h2 id="npm-bundle-1-"><a href="../cli/npm-bundle.html">npm-bundle(1)</a></h2>
+<h3 id="npm-bundle-1-"><a href="../cli/npm-bundle.html">npm-bundle(1)</a></h3>
<p>REMOVED</p>
-<h2 id="npm-cache-1-"><a href="../cli/npm-cache.html">npm-cache(1)</a></h2>
+<h3 id="npm-cache-1-"><a href="../cli/npm-cache.html">npm-cache(1)</a></h3>
<p>Manipulates packages cache</p>
-<h2 id="npm-completion-1-"><a href="../cli/npm-completion.html">npm-completion(1)</a></h2>
+<h3 id="npm-completion-1-"><a href="../cli/npm-completion.html">npm-completion(1)</a></h3>
<p>Tab Completion for npm</p>
-<h2 id="npm-config-1-"><a href="../cli/npm-config.html">npm-config(1)</a></h2>
+<h3 id="npm-config-1-"><a href="../cli/npm-config.html">npm-config(1)</a></h3>
<p>Manage the npm configuration files</p>
-<h2 id="npm-dedupe-1-"><a href="../cli/npm-dedupe.html">npm-dedupe(1)</a></h2>
+<h3 id="npm-dedupe-1-"><a href="../cli/npm-dedupe.html">npm-dedupe(1)</a></h3>
<p>Reduce duplication</p>
-<h2 id="npm-deprecate-1-"><a href="../cli/npm-deprecate.html">npm-deprecate(1)</a></h2>
+<h3 id="npm-deprecate-1-"><a href="../cli/npm-deprecate.html">npm-deprecate(1)</a></h3>
<p>Deprecate a version of a package</p>
-<h2 id="npm-docs-1-"><a href="../cli/npm-docs.html">npm-docs(1)</a></h2>
+<h3 id="npm-docs-1-"><a href="../cli/npm-docs.html">npm-docs(1)</a></h3>
<p>Docs for a package in a web browser maybe</p>
-<h2 id="npm-edit-1-"><a href="../cli/npm-edit.html">npm-edit(1)</a></h2>
+<h3 id="npm-edit-1-"><a href="../cli/npm-edit.html">npm-edit(1)</a></h3>
<p>Edit an installed package</p>
-<h2 id="npm-explore-1-"><a href="../cli/npm-explore.html">npm-explore(1)</a></h2>
+<h3 id="npm-explore-1-"><a href="../cli/npm-explore.html">npm-explore(1)</a></h3>
<p>Browse an installed package</p>
-<h2 id="npm-help-search-1-"><a href="../cli/npm-help-search.html">npm-help-search(1)</a></h2>
+<h3 id="npm-help-search-1-"><a href="../cli/npm-help-search.html">npm-help-search(1)</a></h3>
<p>Search npm help documentation</p>
-<h2 id="npm-help-1-"><a href="../cli/npm-help.html">npm-help(1)</a></h2>
+<h3 id="npm-help-1-"><a href="../cli/npm-help.html">npm-help(1)</a></h3>
<p>Get help on npm</p>
-<h2 id="npm-init-1-"><a href="../cli/npm-init.html">npm-init(1)</a></h2>
+<h3 id="npm-init-1-"><a href="../cli/npm-init.html">npm-init(1)</a></h3>
<p>Interactively create a package.json file</p>
-<h2 id="npm-install-1-"><a href="../cli/npm-install.html">npm-install(1)</a></h2>
+<h3 id="npm-install-1-"><a href="../cli/npm-install.html">npm-install(1)</a></h3>
<p>Install a package</p>
-<h2 id="npm-link-1-"><a href="../cli/npm-link.html">npm-link(1)</a></h2>
+<h3 id="npm-link-1-"><a href="../cli/npm-link.html">npm-link(1)</a></h3>
<p>Symlink a package folder</p>
-<h2 id="npm-ls-1-"><a href="../cli/npm-ls.html">npm-ls(1)</a></h2>
+<h3 id="npm-ls-1-"><a href="../cli/npm-ls.html">npm-ls(1)</a></h3>
<p>List installed packages</p>
-<h2 id="npm-outdated-1-"><a href="../cli/npm-outdated.html">npm-outdated(1)</a></h2>
+<h3 id="npm-outdated-1-"><a href="../cli/npm-outdated.html">npm-outdated(1)</a></h3>
<p>Check for outdated packages</p>
-<h2 id="npm-owner-1-"><a href="../cli/npm-owner.html">npm-owner(1)</a></h2>
+<h3 id="npm-owner-1-"><a href="../cli/npm-owner.html">npm-owner(1)</a></h3>
<p>Manage package owners</p>
-<h2 id="npm-pack-1-"><a href="../cli/npm-pack.html">npm-pack(1)</a></h2>
+<h3 id="npm-pack-1-"><a href="../cli/npm-pack.html">npm-pack(1)</a></h3>
<p>Create a tarball from a package</p>
-<h2 id="npm-prefix-1-"><a href="../cli/npm-prefix.html">npm-prefix(1)</a></h2>
+<h3 id="npm-prefix-1-"><a href="../cli/npm-prefix.html">npm-prefix(1)</a></h3>
<p>Display prefix</p>
-<h2 id="npm-prune-1-"><a href="../cli/npm-prune.html">npm-prune(1)</a></h2>
+<h3 id="npm-prune-1-"><a href="../cli/npm-prune.html">npm-prune(1)</a></h3>
<p>Remove extraneous packages</p>
-<h2 id="npm-publish-1-"><a href="../cli/npm-publish.html">npm-publish(1)</a></h2>
+<h3 id="npm-publish-1-"><a href="../cli/npm-publish.html">npm-publish(1)</a></h3>
<p>Publish a package</p>
-<h2 id="npm-rebuild-1-"><a href="../cli/npm-rebuild.html">npm-rebuild(1)</a></h2>
+<h3 id="npm-rebuild-1-"><a href="../cli/npm-rebuild.html">npm-rebuild(1)</a></h3>
<p>Rebuild a package</p>
-<h2 id="npm-repo-1-"><a href="../cli/npm-repo.html">npm-repo(1)</a></h2>
+<h3 id="npm-repo-1-"><a href="../cli/npm-repo.html">npm-repo(1)</a></h3>
<p>Open package repository page in the browser</p>
-<h2 id="npm-restart-1-"><a href="../cli/npm-restart.html">npm-restart(1)</a></h2>
+<h3 id="npm-restart-1-"><a href="../cli/npm-restart.html">npm-restart(1)</a></h3>
<p>Start a package</p>
-<h2 id="npm-rm-1-"><a href="../cli/npm-rm.html">npm-rm(1)</a></h2>
+<h3 id="npm-rm-1-"><a href="../cli/npm-rm.html">npm-rm(1)</a></h3>
<p>Remove a package</p>
-<h2 id="npm-root-1-"><a href="../cli/npm-root.html">npm-root(1)</a></h2>
+<h3 id="npm-root-1-"><a href="../cli/npm-root.html">npm-root(1)</a></h3>
<p>Display npm root</p>
-<h2 id="npm-run-script-1-"><a href="../cli/npm-run-script.html">npm-run-script(1)</a></h2>
+<h3 id="npm-run-script-1-"><a href="../cli/npm-run-script.html">npm-run-script(1)</a></h3>
<p>Run arbitrary package scripts</p>
-<h2 id="npm-search-1-"><a href="../cli/npm-search.html">npm-search(1)</a></h2>
+<h3 id="npm-search-1-"><a href="../cli/npm-search.html">npm-search(1)</a></h3>
<p>Search for packages</p>
-<h2 id="npm-shrinkwrap-1-"><a href="../cli/npm-shrinkwrap.html">npm-shrinkwrap(1)</a></h2>
+<h3 id="npm-shrinkwrap-1-"><a href="../cli/npm-shrinkwrap.html">npm-shrinkwrap(1)</a></h3>
<p>Lock down dependency versions</p>
-<h2 id="npm-star-1-"><a href="../cli/npm-star.html">npm-star(1)</a></h2>
+<h3 id="npm-star-1-"><a href="../cli/npm-star.html">npm-star(1)</a></h3>
<p>Mark your favorite packages</p>
-<h2 id="npm-stars-1-"><a href="../cli/npm-stars.html">npm-stars(1)</a></h2>
+<h3 id="npm-stars-1-"><a href="../cli/npm-stars.html">npm-stars(1)</a></h3>
<p>View packages marked as favorites</p>
-<h2 id="npm-start-1-"><a href="../cli/npm-start.html">npm-start(1)</a></h2>
+<h3 id="npm-start-1-"><a href="../cli/npm-start.html">npm-start(1)</a></h3>
<p>Start a package</p>
-<h2 id="npm-stop-1-"><a href="../cli/npm-stop.html">npm-stop(1)</a></h2>
+<h3 id="npm-stop-1-"><a href="../cli/npm-stop.html">npm-stop(1)</a></h3>
<p>Stop a package</p>
-<h2 id="npm-submodule-1-"><a href="../cli/npm-submodule.html">npm-submodule(1)</a></h2>
+<h3 id="npm-submodule-1-"><a href="../cli/npm-submodule.html">npm-submodule(1)</a></h3>
<p>Add a package as a git submodule</p>
-<h2 id="npm-tag-1-"><a href="../cli/npm-tag.html">npm-tag(1)</a></h2>
+<h3 id="npm-tag-1-"><a href="../cli/npm-tag.html">npm-tag(1)</a></h3>
<p>Tag a published version</p>
-<h2 id="npm-test-1-"><a href="../cli/npm-test.html">npm-test(1)</a></h2>
+<h3 id="npm-test-1-"><a href="../cli/npm-test.html">npm-test(1)</a></h3>
<p>Test a package</p>
-<h2 id="npm-uninstall-1-"><a href="../cli/npm-uninstall.html">npm-uninstall(1)</a></h2>
+<h3 id="npm-uninstall-1-"><a href="../cli/npm-uninstall.html">npm-uninstall(1)</a></h3>
<p>Remove a package</p>
-<h2 id="npm-unpublish-1-"><a href="../cli/npm-unpublish.html">npm-unpublish(1)</a></h2>
+<h3 id="npm-unpublish-1-"><a href="../cli/npm-unpublish.html">npm-unpublish(1)</a></h3>
<p>Remove a package from the registry</p>
-<h2 id="npm-update-1-"><a href="../cli/npm-update.html">npm-update(1)</a></h2>
+<h3 id="npm-update-1-"><a href="../cli/npm-update.html">npm-update(1)</a></h3>
<p>Update a package</p>
-<h2 id="npm-version-1-"><a href="../cli/npm-version.html">npm-version(1)</a></h2>
+<h3 id="npm-version-1-"><a href="../cli/npm-version.html">npm-version(1)</a></h3>
<p>Bump a package version</p>
-<h2 id="npm-view-1-"><a href="../cli/npm-view.html">npm-view(1)</a></h2>
+<h3 id="npm-view-1-"><a href="../cli/npm-view.html">npm-view(1)</a></h3>
<p>View registry info</p>
-<h2 id="npm-whoami-1-"><a href="../cli/npm-whoami.html">npm-whoami(1)</a></h2>
+<h3 id="npm-whoami-1-"><a href="../cli/npm-whoami.html">npm-whoami(1)</a></h3>
<p>Display npm username</p>
-<h1 id="api-documentation">API Documentation</h1>
-<h2 id="npm-3-"><a href="../api/npm.html">npm(3)</a></h2>
+<h2 id="api-documentation">API Documentation</h2>
+<p>Using npm in your Node programs</p>
+<h3 id="npm-3-"><a href="../api/npm.html">npm(3)</a></h3>
<p>node package manager</p>
-<h2 id="npm-bin-3-"><a href="../api/npm-bin.html">npm-bin(3)</a></h2>
+<h3 id="npm-bin-3-"><a href="../api/npm-bin.html">npm-bin(3)</a></h3>
<p>Display npm bin folder</p>
-<h2 id="npm-bugs-3-"><a href="../api/npm-bugs.html">npm-bugs(3)</a></h2>
+<h3 id="npm-bugs-3-"><a href="../api/npm-bugs.html">npm-bugs(3)</a></h3>
<p>Bugs for a package in a web browser maybe</p>
-<h2 id="npm-cache-3-"><a href="../api/npm-cache.html">npm-cache(3)</a></h2>
+<h3 id="npm-cache-3-"><a href="../api/npm-cache.html">npm-cache(3)</a></h3>
<p>manage the npm cache programmatically</p>
-<h2 id="npm-commands-3-"><a href="../api/npm-commands.html">npm-commands(3)</a></h2>
+<h3 id="npm-commands-3-"><a href="../api/npm-commands.html">npm-commands(3)</a></h3>
<p>npm commands</p>
-<h2 id="npm-config-3-"><a href="../api/npm-config.html">npm-config(3)</a></h2>
+<h3 id="npm-config-3-"><a href="../api/npm-config.html">npm-config(3)</a></h3>
<p>Manage the npm configuration files</p>
-<h2 id="npm-deprecate-3-"><a href="../api/npm-deprecate.html">npm-deprecate(3)</a></h2>
+<h3 id="npm-deprecate-3-"><a href="../api/npm-deprecate.html">npm-deprecate(3)</a></h3>
<p>Deprecate a version of a package</p>
-<h2 id="npm-docs-3-"><a href="../api/npm-docs.html">npm-docs(3)</a></h2>
+<h3 id="npm-docs-3-"><a href="../api/npm-docs.html">npm-docs(3)</a></h3>
<p>Docs for a package in a web browser maybe</p>
-<h2 id="npm-edit-3-"><a href="../api/npm-edit.html">npm-edit(3)</a></h2>
+<h3 id="npm-edit-3-"><a href="../api/npm-edit.html">npm-edit(3)</a></h3>
<p>Edit an installed package</p>
-<h2 id="npm-explore-3-"><a href="../api/npm-explore.html">npm-explore(3)</a></h2>
+<h3 id="npm-explore-3-"><a href="../api/npm-explore.html">npm-explore(3)</a></h3>
<p>Browse an installed package</p>
-<h2 id="npm-help-search-3-"><a href="../api/npm-help-search.html">npm-help-search(3)</a></h2>
+<h3 id="npm-help-search-3-"><a href="../api/npm-help-search.html">npm-help-search(3)</a></h3>
<p>Search the help pages</p>
-<h2 id="npm-init-3-"><a href="../api/npm-init.html">npm-init(3)</a></h2>
+<h3 id="npm-init-3-"><a href="../api/npm-init.html">npm-init(3)</a></h3>
<p>Interactively create a package.json file</p>
-<h2 id="npm-install-3-"><a href="../api/npm-install.html">npm-install(3)</a></h2>
+<h3 id="npm-install-3-"><a href="../api/npm-install.html">npm-install(3)</a></h3>
<p>install a package programmatically</p>
-<h2 id="npm-link-3-"><a href="../api/npm-link.html">npm-link(3)</a></h2>
+<h3 id="npm-link-3-"><a href="../api/npm-link.html">npm-link(3)</a></h3>
<p>Symlink a package folder</p>
-<h2 id="npm-load-3-"><a href="../api/npm-load.html">npm-load(3)</a></h2>
+<h3 id="npm-load-3-"><a href="../api/npm-load.html">npm-load(3)</a></h3>
<p>Load config settings</p>
-<h2 id="npm-ls-3-"><a href="../api/npm-ls.html">npm-ls(3)</a></h2>
+<h3 id="npm-ls-3-"><a href="../api/npm-ls.html">npm-ls(3)</a></h3>
<p>List installed packages</p>
-<h2 id="npm-outdated-3-"><a href="../api/npm-outdated.html">npm-outdated(3)</a></h2>
+<h3 id="npm-outdated-3-"><a href="../api/npm-outdated.html">npm-outdated(3)</a></h3>
<p>Check for outdated packages</p>
-<h2 id="npm-owner-3-"><a href="../api/npm-owner.html">npm-owner(3)</a></h2>
+<h3 id="npm-owner-3-"><a href="../api/npm-owner.html">npm-owner(3)</a></h3>
<p>Manage package owners</p>
-<h2 id="npm-pack-3-"><a href="../api/npm-pack.html">npm-pack(3)</a></h2>
+<h3 id="npm-pack-3-"><a href="../api/npm-pack.html">npm-pack(3)</a></h3>
<p>Create a tarball from a package</p>
-<h2 id="npm-prefix-3-"><a href="../api/npm-prefix.html">npm-prefix(3)</a></h2>
+<h3 id="npm-prefix-3-"><a href="../api/npm-prefix.html">npm-prefix(3)</a></h3>
<p>Display prefix</p>
-<h2 id="npm-prune-3-"><a href="../api/npm-prune.html">npm-prune(3)</a></h2>
+<h3 id="npm-prune-3-"><a href="../api/npm-prune.html">npm-prune(3)</a></h3>
<p>Remove extraneous packages</p>
-<h2 id="npm-publish-3-"><a href="../api/npm-publish.html">npm-publish(3)</a></h2>
+<h3 id="npm-publish-3-"><a href="../api/npm-publish.html">npm-publish(3)</a></h3>
<p>Publish a package</p>
-<h2 id="npm-rebuild-3-"><a href="../api/npm-rebuild.html">npm-rebuild(3)</a></h2>
+<h3 id="npm-rebuild-3-"><a href="../api/npm-rebuild.html">npm-rebuild(3)</a></h3>
<p>Rebuild a package</p>
-<h2 id="npm-repo-3-"><a href="../api/npm-repo.html">npm-repo(3)</a></h2>
+<h3 id="npm-repo-3-"><a href="../api/npm-repo.html">npm-repo(3)</a></h3>
<p>Open package repository page in the browser</p>
-<h2 id="npm-restart-3-"><a href="../api/npm-restart.html">npm-restart(3)</a></h2>
+<h3 id="npm-restart-3-"><a href="../api/npm-restart.html">npm-restart(3)</a></h3>
<p>Start a package</p>
-<h2 id="npm-root-3-"><a href="../api/npm-root.html">npm-root(3)</a></h2>
+<h3 id="npm-root-3-"><a href="../api/npm-root.html">npm-root(3)</a></h3>
<p>Display npm root</p>
-<h2 id="npm-run-script-3-"><a href="../api/npm-run-script.html">npm-run-script(3)</a></h2>
+<h3 id="npm-run-script-3-"><a href="../api/npm-run-script.html">npm-run-script(3)</a></h3>
<p>Run arbitrary package scripts</p>
-<h2 id="npm-search-3-"><a href="../api/npm-search.html">npm-search(3)</a></h2>
+<h3 id="npm-search-3-"><a href="../api/npm-search.html">npm-search(3)</a></h3>
<p>Search for packages</p>
-<h2 id="npm-shrinkwrap-3-"><a href="../api/npm-shrinkwrap.html">npm-shrinkwrap(3)</a></h2>
+<h3 id="npm-shrinkwrap-3-"><a href="../api/npm-shrinkwrap.html">npm-shrinkwrap(3)</a></h3>
<p>programmatically generate package shrinkwrap file</p>
-<h2 id="npm-start-3-"><a href="../api/npm-start.html">npm-start(3)</a></h2>
+<h3 id="npm-start-3-"><a href="../api/npm-start.html">npm-start(3)</a></h3>
<p>Start a package</p>
-<h2 id="npm-stop-3-"><a href="../api/npm-stop.html">npm-stop(3)</a></h2>
+<h3 id="npm-stop-3-"><a href="../api/npm-stop.html">npm-stop(3)</a></h3>
<p>Stop a package</p>
-<h2 id="npm-submodule-3-"><a href="../api/npm-submodule.html">npm-submodule(3)</a></h2>
+<h3 id="npm-submodule-3-"><a href="../api/npm-submodule.html">npm-submodule(3)</a></h3>
<p>Add a package as a git submodule</p>
-<h2 id="npm-tag-3-"><a href="../api/npm-tag.html">npm-tag(3)</a></h2>
+<h3 id="npm-tag-3-"><a href="../api/npm-tag.html">npm-tag(3)</a></h3>
<p>Tag a published version</p>
-<h2 id="npm-test-3-"><a href="../api/npm-test.html">npm-test(3)</a></h2>
+<h3 id="npm-test-3-"><a href="../api/npm-test.html">npm-test(3)</a></h3>
<p>Test a package</p>
-<h2 id="npm-uninstall-3-"><a href="../api/npm-uninstall.html">npm-uninstall(3)</a></h2>
+<h3 id="npm-uninstall-3-"><a href="../api/npm-uninstall.html">npm-uninstall(3)</a></h3>
<p>uninstall a package programmatically</p>
-<h2 id="npm-unpublish-3-"><a href="../api/npm-unpublish.html">npm-unpublish(3)</a></h2>
+<h3 id="npm-unpublish-3-"><a href="../api/npm-unpublish.html">npm-unpublish(3)</a></h3>
<p>Remove a package from the registry</p>
-<h2 id="npm-update-3-"><a href="../api/npm-update.html">npm-update(3)</a></h2>
+<h3 id="npm-update-3-"><a href="../api/npm-update.html">npm-update(3)</a></h3>
<p>Update a package</p>
-<h2 id="npm-version-3-"><a href="../api/npm-version.html">npm-version(3)</a></h2>
+<h3 id="npm-version-3-"><a href="../api/npm-version.html">npm-version(3)</a></h3>
<p>Bump a package version</p>
-<h2 id="npm-view-3-"><a href="../api/npm-view.html">npm-view(3)</a></h2>
+<h3 id="npm-view-3-"><a href="../api/npm-view.html">npm-view(3)</a></h3>
<p>View registry info</p>
-<h2 id="npm-whoami-3-"><a href="../api/npm-whoami.html">npm-whoami(3)</a></h2>
+<h3 id="npm-whoami-3-"><a href="../api/npm-whoami.html">npm-whoami(3)</a></h3>
<p>Display npm username</p>
-<h1 id="files">Files</h1>
-<h2 id="npm-folders-5-"><a href="../files/npm-folders.html">npm-folders(5)</a></h2>
+<h2 id="files">Files</h2>
+<p>File system structures npm uses</p>
+<h3 id="npm-folders-5-"><a href="../files/npm-folders.html">npm-folders(5)</a></h3>
<p>Folder Structures Used by npm</p>
-<h2 id="npmrc-5-"><a href="../files/npmrc.html">npmrc(5)</a></h2>
+<h3 id="npmrc-5-"><a href="../files/npmrc.html">npmrc(5)</a></h3>
<p>The npm config files</p>
-<h2 id="package-json-5-"><a href="../files/package.json.html">package.json(5)</a></h2>
+<h3 id="package-json-5-"><a href="../files/package.json.html">package.json(5)</a></h3>
<p>Specifics of npm's package.json handling</p>
-<h1 id="misc">Misc</h1>
-<h2 id="npm-coding-style-7-"><a href="../misc/npm-coding-style.html">npm-coding-style(7)</a></h2>
+<h2 id="misc">Misc</h2>
+<p>Various other bits and bobs</p>
+<h3 id="npm-coding-style-7-"><a href="../misc/npm-coding-style.html">npm-coding-style(7)</a></h3>
<p>npm's "funny" coding style</p>
-<h2 id="npm-config-7-"><a href="../misc/npm-config.html">npm-config(7)</a></h2>
+<h3 id="npm-config-7-"><a href="../misc/npm-config.html">npm-config(7)</a></h3>
<p>More than you probably want to know about npm configuration</p>
-<h2 id="npm-developers-7-"><a href="../misc/npm-developers.html">npm-developers(7)</a></h2>
+<h3 id="npm-developers-7-"><a href="../misc/npm-developers.html">npm-developers(7)</a></h3>
<p>Developer Guide</p>
-<h2 id="npm-disputes-7-"><a href="../misc/npm-disputes.html">npm-disputes(7)</a></h2>
+<h3 id="npm-disputes-7-"><a href="../misc/npm-disputes.html">npm-disputes(7)</a></h3>
<p>Handling Module Name Disputes</p>
-<h2 id="npm-faq-7-"><a href="../misc/npm-faq.html">npm-faq(7)</a></h2>
+<h3 id="npm-faq-7-"><a href="../misc/npm-faq.html">npm-faq(7)</a></h3>
<p>Frequently Asked Questions</p>
-<h2 id="npm-index-7-"><a href="../misc/npm-index.html">npm-index(7)</a></h2>
+<h3 id="npm-index-7-"><a href="../misc/npm-index.html">npm-index(7)</a></h3>
<p>Index of all npm documentation</p>
-<h2 id="npm-registry-7-"><a href="../misc/npm-registry.html">npm-registry(7)</a></h2>
+<h3 id="npm-registry-7-"><a href="../misc/npm-registry.html">npm-registry(7)</a></h3>
<p>The JavaScript Package Registry</p>
-<h2 id="npm-scripts-7-"><a href="../misc/npm-scripts.html">npm-scripts(7)</a></h2>
+<h3 id="npm-scripts-7-"><a href="../misc/npm-scripts.html">npm-scripts(7)</a></h3>
<p>How npm handles the "scripts" field</p>
-<h2 id="removing-npm-7-"><a href="../misc/removing-npm.html">removing-npm(7)</a></h2>
+<h3 id="removing-npm-7-"><a href="../misc/removing-npm.html">removing-npm(7)</a></h3>
<p>Cleaning the Slate</p>
-<h2 id="semver-7-"><a href="../misc/semver.html">semver(7)</a></h2>
+<h3 id="semver-7-"><a href="../misc/semver.html">semver(7)</a></h3>
<p>The semantic versioner for npm</p>
</div>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-index — npm@1.4.23</p>
+<p id="footer">npm-index — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-registry — npm@1.4.23</p>
+<p id="footer">npm-registry — npm@1.4.28</p>
--- /dev/null
+<!doctype html>
+<html>
+ <title>npm-scope</title>
+ <meta http-equiv="content-type" value="text/html;utf-8">
+ <link rel="stylesheet" type="text/css" href="../../static/style.css">
+ <link rel="canonical" href="https://www.npmjs.org/doc/misc/npm-scope.html">
+ <script async=true src="../../static/toc.js"></script>
+
+ <body>
+ <div id="wrapper">
+
+<h1><a href="../misc/npm-scope.html">npm-scope</a></h1> <p>Scoped packages</p>
+<h2 id="description">DESCRIPTION</h2>
+<p>All npm packages have a name. Some package names also have a scope. A scope
+follows the usual rules for package names (url-safe characters, no leading dots
+or underscores). When used in package names, preceded by an @-symbol and
+followed by a slash, e.g.</p>
+<pre><code>@somescope/somepackagename
+</code></pre><p>Scopes are a way of grouping related packages together, and also affect a few
+things about the way npm treats the package.</p>
+<p><strong>As of 2014-09-03, scoped packages are not supported by the public npm registry</strong>.
+However, the npm client is backwards-compatible with un-scoped registries, so
+it can be used to work with scoped and un-scoped registries at the same time.</p>
+<h2 id="installing-scoped-packages">Installing scoped packages</h2>
+<p>Scoped packages are installed to a sub-folder of the regular installation
+folder, e.g. if your other packages are installed in <code>node_modules/packagename</code>,
+scoped modules will be in <code>node_modules/@myorg/packagename</code>. The scope folder
+(<code>@myorg</code>) is simply the name of the scope preceded by an @-symbol, and can
+contain any number of scoped packages.</p>
+<p>A scoped package is install by referencing it by name, preceded by an @-symbol,
+in <code>npm install</code>:</p>
+<pre><code>npm install @myorg/mypackage
+</code></pre><p>Or in <code>package.json</code>:</p>
+<pre><code>"dependencies": {
+ "@myorg/mypackage": "^1.3.0"
+}
+</code></pre><p>Note that if the @-symbol is omitted in either case npm will instead attempt to
+install from GitHub; see <code><a href="../cli/npm-install.html">npm-install(1)</a></code>.</p>
+<h2 id="requiring-scoped-packages">Requiring scoped packages</h2>
+<p>Because scoped packages are installed into a scope folder, you have to
+include the name of the scope when requiring them in your code, e.g.</p>
+<pre><code>require('@myorg/mypackage')
+</code></pre><p>There is nothing special about the way Node treats scope folders, this is
+just specifying to require the module <code>mypackage</code> in the folder called <code>@myorg</code>.</p>
+<h2 id="publishing-scoped-packages">Publishing scoped packages</h2>
+<p>Scoped packages can be published to any registry that supports them.
+<em>As of 2014-09-03, the public npm registry does not support scoped packages</em>,
+so attempting to publish a scoped package to the registry will fail unless
+you have associated that scope with a different registry, see below.</p>
+<h2 id="associating-a-scope-with-a-registry">Associating a scope with a registry</h2>
+<p>Scopes can be associated with a separate registry. This allows you to
+seamlessly use a mix of packages from the public npm registry and one or more
+private registries, such as npm Enterprise.</p>
+<p>You can associate a scope with a registry at login, e.g.</p>
+<pre><code>npm login --registry=http://reg.example.com --scope=@myco
+</code></pre><p>Scopes have a many-to-one relationship with registries: one registry can
+host multiple scopes, but a scope only ever points to one registry.</p>
+<p>You can also associate a scope with a registry using <code>npm config</code>:</p>
+<pre><code>npm config set @myco:registry http://reg.example.com
+</code></pre><p>Once a scope is associated with a registry, any <code>npm install</code> for a package
+with that scope will request packages from that registry instead. Any
+<code>npm publish</code> for a package name that contains the scope will be published to
+that registry instead.</p>
+<h2 id="see-also">SEE ALSO</h2>
+<ul>
+<li><a href="../cli/npm-install.html">npm-install(1)</a></li>
+<li><a href="../cli/npm-publish.html">npm-publish(1)</a></li>
+</ul>
+
+</div>
+
+<table border=0 cellspacing=0 cellpadding=0 id=npmlogo>
+<tr><td style="width:180px;height:10px;background:rgb(237,127,127)" colspan=18> </td></tr>
+<tr><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)"> </td><td style="width:40px;height:10px;background:#fff" colspan=4> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4> </td><td style="width:40px;height:10px;background:#fff" colspan=4> </td><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)"> </td><td colspan=6 style="width:60px;height:10px;background:#fff"> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4> </td></tr>
+<tr><td colspan=2 style="width:20px;height:30px;background:#fff" rowspan=3> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:20px;height:10px;background:#fff" rowspan=4 colspan=2> </td><td style="width:10px;height:20px;background:rgb(237,127,127)" rowspan=2> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:20px;height:10px;background:#fff" rowspan=3 colspan=2> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td></tr>
+<tr><td style="width:10px;height:10px;background:#fff" rowspan=2> </td></tr>
+<tr><td style="width:10px;height:10px;background:#fff"> </td></tr>
+<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
+<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
+</table>
+<p id="footer">npm-scope — npm@2.0.0-beta.3</p>
+
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">npm-scripts — npm@1.4.23</p>
+<p id="footer">npm-scripts — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">removing-npm — npm@1.4.23</p>
+<p id="footer">removing-npm — npm@1.4.28</p>
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
</table>
-<p id="footer">semver — npm@1.4.23</p>
+<p id="footer">semver — npm@1.4.28</p>
if (!er) return cb_(er, data)
if (false === npm.config.get("rollback")) return cb_(er)
- npm.commands.unbuild([targetFolder], true, function (er2) {
- if (er2) log.error("error rolling back", target._id, er2)
- return cb_(er, data)
- })
+ npm.rollbacks.push(targetFolder)
+ cb_(er, data)
}
var bundled = []
npm.commands = {}
+npm.rollbacks = []
+
try {
var pv = process.version.replace(/^v/, '')
// startup, ok to do this synchronously
, path = require("path")
, wroteLogFile = false
, exitCode = 0
+ , rollbacks = npm.rollbacks
+ , chain = require("slide").chain
process.on("exit", function (code) {
log.verbose("exit", [code, doExit])
if (log.level === "silent") noLog = true
- if (code && !noLog) writeLogFile(reallyExit)
- else rm("npm-debug.log", function () { rm(npm.tmp, reallyExit) })
+ if (rollbacks.length) {
+ chain(rollbacks.map(function (f) {
+ return function (cb) {
+ npm.commands.unbuild([f], true, cb)
+ }
+ }), function (er) {
+ if (er) {
+ log.error("error rolling back", er)
+ if (!code) errorHandler(er)
+ else reallyExit(er)
+ } else {
+ rm("npm-debug.log", reallyExit)
+ }
+ })
+ rollbacks.length = 0
+ }
+ else if (code && !noLog) writeLogFile(reallyExit)
+ else reallyExit()
function reallyExit() {
// truncate once it's been written.
env.npm_lifecycle_script = pkg.scripts[stage]
}
- if (failOk) {
- cb = (function (cb_) { return function (er) {
- if (er) log.warn("continuing anyway", er.message)
- cb_()
- }})(cb)
- }
-
- if (npm.config.get("force")) {
- cb = (function (cb_) { return function (er) {
- if (er) log.info("forced, continuing", er)
- cb_()
- }})(cb)
+ function done (er) {
+ if (er) {
+ if (npm.config.get("force")) {
+ log.info("forced, continuing", er)
+ er = null
+ } else if (failOk) {
+ log.warn("continuing anyway", er.message)
+ er = null
+ }
+ }
+ cb(er)
}
chain
( [ packageLifecycle && [runPackageLifecycle, pkg, env, wd, unsafe]
, [runHookLifecycle, pkg, env, wd, unsafe] ]
- , cb )
+ , done )
}
function validWd (d, cb) {
}
var proc = spawn(sh, [shFlag, cmd], conf)
+ proc.on("error", procError)
proc.on("close", function (code, signal) {
if (signal) {
process.kill(process.pid, signal);
} else if (code) {
var er = new Error("Exit status " + code)
}
+ procError(er)
+ })
+
+ function procError (er) {
if (er && !npm.ROLLBACK) {
log.info(pkg._id, "Failed to exec "+stage+" script")
er.message = pkg._id + " "
return cb()
}
cb(er)
- })
+ }
}
extractOpts.gid = gid
}
+ var sawIgnores = {}
extractOpts.filter = function () {
// symbolic links are not allowed in packages.
if (this.type.match(/^.*Link$/)) {
+ " -> " + this.linkpath )
return false
}
+
+ // Note: This mirrors logic in the fs read operations that are
+ // employed during tarball creation, in the fstream-npm module.
+ // It is duplicated here to handle tarballs that are created
+ // using other means, such as system tar or git archive.
+ if (this.type === "File") {
+ var base = path.basename(this.path)
+ if (base === ".npmignore") {
+ sawIgnores[ this.path ] = true
+ } else if (base === ".gitignore") {
+ var npmignore = this.path.replace(/\.gitignore$/, ".npmignore")
+ if (sawIgnores[npmignore]) {
+ // Skip this one, already seen.
+ return false
+ } else {
+ // Rename, may be clobbered later.
+ this.path = npmignore
+ this._path = npmignore
+ }
+ }
+ }
+
return true
}
cb(er)
})
.on("close", cb)
- } else if (c.toString().match(/^package\//)) {
+ } else if (c.toString().match(/^package\//) ||
+ c.toString().match(/^pax_global_header/)) {
// naked tar
fst
.pipe(tar.Extract(extractOpts))
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM" "1" "July 2014" "" ""
+.TH "NPM" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm\fR \-\- node package manager![Build Status \fIhttps://img\.shields\.io/travis/npm/npm/master\.svg)](https://travis\-ci\.org/npm/npm\fR
npm help npm
.
.IP "\(bu" 4
-npm help faq
+npm help 7 faq
.
.IP "\(bu" 4
npm help help
.
.IP "\(bu" 4
-npm help index
+npm help 7 index
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-ADDUSER" "1" "July 2014" "" ""
+.TH "NPM\-ADDUSER" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-adduser\fR \-\- Add a registry user account
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "\(bu" 4
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "\(bu" 4
npm help owner
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BIN" "1" "July 2014" "" ""
+.TH "NPM\-BIN" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-bin\fR \-\- Display npm bin folder
npm help root
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "\(bu" 4
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BUGS" "1" "July 2014" "" ""
+.TH "NPM\-BUGS" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-bugs\fR \-\- Bugs for a package in a web browser maybe
npm help publish
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "\(bu" 4
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "\(bu" 4
-npm help package\.json
+npm help 5 package\.json
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BUILD" "1" "July 2014" "" ""
+.TH "NPM\-BUILD" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-build\fR \-\- Build a package
npm help link
.
.IP "\(bu" 4
-npm help scripts
+npm help 7 scripts
.
.IP "\(bu" 4
-npm help package\.json
+npm help 5 package\.json
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BUNDLE" "1" "July 2014" "" ""
+.TH "NPM\-BUNDLE" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-bundle\fR \-\- REMOVED
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-CACHE" "1" "July 2014" "" ""
+.TH "NPM\-CACHE" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-cache\fR \-\- Manipulates packages cache
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "\(bu" 4
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "\(bu" 4
npm help install
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-COMPLETION" "1" "July 2014" "" ""
+.TH "NPM\-COMPLETION" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-completion\fR \-\- Tab Completion for npm
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help developers
+npm help 7 developers
.
.IP "\(bu" 4
-npm help faq
+npm help 7 faq
.
.IP "\(bu" 4
npm help npm
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-CONFIG" "1" "July 2014" "" ""
+.TH "NPM\-CONFIG" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-config\fR \-\- Manage the npm configuration files
variables, \fBnpmrc\fR files, and in some cases, the \fBpackage\.json\fR file\.
.
.P
-npm help See npmrc for more information about the npmrc files\.
+See npm help 5 npmrc for more information about the npmrc files\.
.
.P
-npm help See \fBnpm\-config\fR for a more thorough discussion of the mechanisms
+See npm help 7 \fBnpm\-config\fR for a more thorough discussion of the mechanisms
involved\.
.
.P
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help package\.json
+npm help 5 package\.json
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "\(bu" 4
npm help npm
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DEDUPE" "1" "July 2014" "" ""
+.TH "NPM\-DEDUPE" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-dedupe\fR \-\- Reduce duplication
.IP "" 0
.
.P
-npm help In this case, \fBnpm\-dedupe\fR will transform the tree to:
+In this case, npm help \fBnpm\-dedupe\fR will transform the tree to:
.
.IP "" 4
.
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DEPRECATE" "1" "July 2014" "" ""
+.TH "NPM\-DEPRECATE" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-deprecate\fR \-\- Deprecate a version of a package
npm help publish
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DOCS" "1" "July 2014" "" ""
+.TH "NPM\-DOCS" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-docs\fR \-\- Docs for a package in a web browser maybe
npm help publish
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "\(bu" 4
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "\(bu" 4
-npm help package\.json
+npm help 5 package\.json
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-EDIT" "1" "July 2014" "" ""
+.TH "NPM\-EDIT" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-edit\fR \-\- Edit an installed package
.
.SH "DESCRIPTION"
Opens the package folder in the default editor (or whatever you\'ve
-npm help configured as the npm \fBeditor\fR config \-\- see \fBnpm\-config\fR\|\.)
+configured as the npm \fBeditor\fR config \-\- see npm help 7 \fBnpm\-config\fR\|\.)
.
.P
After it has been edited, the package is rebuilt so as to pick up any
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "\(bu" 4
npm help explore
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-EXPLORE" "1" "July 2014" "" ""
+.TH "NPM\-EXPLORE" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-explore\fR \-\- Browse an installed package
npm help submodule
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "\(bu" 4
npm help edit
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-HELP\-SEARCH" "1" "July 2014" "" ""
+.TH "NPM\-HELP\-SEARCH" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-help-search\fR \-\- Search npm help documentation
npm help npm
.
.IP "\(bu" 4
-npm help faq
+npm help 7 faq
.
.IP "\(bu" 4
npm help help
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-HELP" "1" "July 2014" "" ""
+.TH "NPM\-HELP" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-help\fR \-\- Get help on npm
README
.
.IP "\(bu" 4
-npm help faq
+npm help 7 faq
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "\(bu" 4
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "\(bu" 4
-npm help package\.json
+npm help 5 package\.json
.
.IP "\(bu" 4
npm help help\-search
.
.IP "\(bu" 4
-npm help index
+npm help 7 index
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-INIT" "1" "July 2014" "" ""
+.TH "NPM\-INIT" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-init\fR \-\- Interactively create a package\.json file
\fIhttps://github\.com/isaacs/init\-package\-json\fR
.
.IP "\(bu" 4
-npm help package\.json
+npm help 5 package\.json
.
.IP "\(bu" 4
npm help version
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-INSTALL" "1" "July 2014" "" ""
+.TH "NPM\-INSTALL" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-install\fR \-\- Install a package
.SH "DESCRIPTION"
This command installs a package, and any packages that it depends on\. If the
package has a shrinkwrap file, the installation of dependencies will be driven
-npm help by that\. See npm\-shrinkwrap\.
+by that\. See npm help shrinkwrap\.
.
.P
A \fBpackage\fR is:
c) a url that resolves to (b)
.
.IP "\(bu" 4
-d) a \fB<name>@<version>\fR that is published on the registry (npm help see \fBnpm\-registry\fR) with (c)
+d) a \fB<name>@<version>\fR that is published on the registry (see npm help 7 \fBnpm\-registry\fR) with (c)
.
.IP "\(bu" 4
e) a \fB<name>@<tag>\fR that points to (d)
\fBnpm install <name> [\-\-save|\-\-save\-dev|\-\-save\-optional]\fR:
.
.IP
-Do a \fB<name>@<tag>\fR install, where \fB<tag>\fR is the "tag" config\. (npm help See \fBnpm\-config\fR\|\.)
+Do a \fB<name>@<tag>\fR install, where \fB<tag>\fR is the "tag" config\. (See npm help 7 \fBnpm\-config\fR\|\.)
.
.IP
In most cases, this will install the latest version
.
.IP
Install a version of the package matching the specified version range\. This
-npm help will follow the same rules for resolving dependencies described in \fBpackage\.json\fR\|\.
+will follow the same rules for resolving dependencies described in npm help 5 \fBpackage\.json\fR\|\.
.
.IP
Note that most version ranges must be put in quotes so that your shell will
.
.P
The \fB\-\-global\fR argument will cause npm to install the package globally
-npm help rather than locally\. See \fBnpm\-folders\fR\|\.
+rather than locally\. See npm help 5 \fBnpm\-folders\fR\|\.
.
.P
The \fB\-\-link\fR argument will cause npm to link global installs into the
node source code so that npm can compile native modules\.
.
.P
-npm help See \fBnpm\-config\fR\|\. Many of the configuration params have some
+See npm help 7 \fBnpm\-config\fR\|\. Many of the configuration params have some
effect on installation, since that\'s most of what npm does\.
.
.SH "ALGORITHM"
already caused C to be installed at a higher level\.
.
.P
-npm help See npm\-folders for a more detailed description of the specific
+See npm help 5 folders for a more detailed description of the specific
folder structures that npm creates\.
.
.SS "Limitations of npm's Install Algorithm"
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "\(bu" 4
npm help update
npm help rebuild
.
.IP "\(bu" 4
-npm help scripts
+npm help 7 scripts
.
.IP "\(bu" 4
npm help build
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "\(bu" 4
npm help tag
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-LINK" "1" "July 2014" "" ""
+.TH "NPM\-LINK" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-link\fR \-\- Symlink a package folder
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help developers
+npm help 7 developers
.
.IP "\(bu" 4
-npm help faq
+npm help 7 faq
.
.IP "\(bu" 4
-npm help package\.json
+npm help 5 package\.json
.
.IP "\(bu" 4
npm help install
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "\(bu" 4
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-LS" "1" "July 2014" "" ""
+.TH "NPM\-LS" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-ls\fR \-\- List installed packages
.IP "" 4
.
.nf
-npm@1.4.23 /path/to/npm
+npm@1.4.28 /path/to/npm
└─┬ init\-package\-json@0\.0\.4
└── promzard@0\.1\.5
.
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "\(bu" 4
npm help install
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-OUTDATED" "1" "July 2014" "" ""
+.TH "NPM\-OUTDATED" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-outdated\fR \-\- Check for outdated packages
npm help update
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-OWNER" "1" "July 2014" "" ""
+.TH "NPM\-OWNER" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-owner\fR \-\- Manage package owners
npm help publish
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "\(bu" 4
npm help adduser
.
.IP "\(bu" 4
-npm help disputes
+npm help 7 disputes
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PACK" "1" "July 2014" "" ""
+.TH "NPM\-PACK" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-pack\fR \-\- Create a tarball from a package
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PREFIX" "1" "July 2014" "" ""
+.TH "NPM\-PREFIX" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-prefix\fR \-\- Display prefix
npm help bin
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "\(bu" 4
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PRUNE" "1" "July 2014" "" ""
+.TH "NPM\-PRUNE" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-prune\fR \-\- Remove extraneous packages
npm help rm
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "\(bu" 4
npm help ls
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PUBLISH" "1" "July 2014" "" ""
+.TH "NPM\-PUBLISH" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-publish\fR \-\- Publish a package
.P
Once a package is published with a given name and version, that
specific name and version combination can never be used again, even if
-npm help it is removed with npm\-unpublish\.
+it is removed with npm help unpublish\.
.
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "\(bu" 4
npm help adduser
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-REBUILD" "1" "July 2014" "" ""
+.TH "NPM\-REBUILD" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-rebuild\fR \-\- Rebuild a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-REPO" "1" "July 2014" "" ""
+.TH "NPM\-REPO" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-repo\fR \-\- Open package repository page in the browser
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RESTART" "1" "July 2014" "" ""
+.TH "NPM\-RESTART" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-restart\fR \-\- Start a package
npm help run\-script
.
.IP "\(bu" 4
-npm help scripts
+npm help 7 scripts
.
.IP "\(bu" 4
npm help test
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RM" "1" "July 2014" "" ""
+.TH "NPM\-RM" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-rm\fR \-\- Remove a package
npm help install
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "\(bu" 4
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-ROOT" "1" "July 2014" "" ""
+.TH "NPM\-ROOT" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-root\fR \-\- Display npm root
npm help bin
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "\(bu" 4
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RUN\-SCRIPT" "1" "July 2014" "" ""
+.TH "NPM\-RUN\-SCRIPT" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-run-script\fR \-\- Run arbitrary package scripts
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help scripts
+npm help 7 scripts
.
.IP "\(bu" 4
npm help test
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SEARCH" "1" "July 2014" "" ""
+.TH "NPM\-SEARCH" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-search\fR \-\- Search for packages
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "\(bu" 4
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "\(bu" 4
npm help view
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SHRINKWRAP" "1" "July 2014" "" ""
+.TH "NPM\-SHRINKWRAP" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-shrinkwrap\fR \-\- Lock down dependency versions
.IP "" 0
.
.P
-npm help You can use npm\-outdated to view dependencies with newer versions
+You can use npm help outdated to view dependencies with newer versions
available\.
.
.SS "Other Notes"
npm help install
.
.IP "\(bu" 4
-npm help package\.json
+npm help 5 package\.json
.
.IP "\(bu" 4
npm help ls
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-STAR" "1" "July 2014" "" ""
+.TH "NPM\-STAR" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-star\fR \-\- Mark your favorite packages
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-STARS" "1" "July 2014" "" ""
+.TH "NPM\-STARS" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-stars\fR \-\- View packages marked as favorites
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-START" "1" "July 2014" "" ""
+.TH "NPM\-START" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-start\fR \-\- Start a package
npm help run\-script
.
.IP "\(bu" 4
-npm help scripts
+npm help 7 scripts
.
.IP "\(bu" 4
npm help test
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-STOP" "1" "July 2014" "" ""
+.TH "NPM\-STOP" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-stop\fR \-\- Stop a package
npm help run\-script
.
.IP "\(bu" 4
-npm help scripts
+npm help 7 scripts
.
.IP "\(bu" 4
npm help test
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SUBMODULE" "1" "July 2014" "" ""
+.TH "NPM\-SUBMODULE" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-submodule\fR \-\- Add a package as a git submodule
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help package\.json
+npm help 5 package\.json
.
.IP "\(bu" 4
git help submodule
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-TAG" "1" "July 2014" "" ""
+.TH "NPM\-TAG" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-tag\fR \-\- Tag a published version
npm help dedupe
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "\(bu" 4
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-TEST" "1" "July 2014" "" ""
+.TH "NPM\-TEST" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-test\fR \-\- Test a package
npm help run\-script
.
.IP "\(bu" 4
-npm help scripts
+npm help 7 scripts
.
.IP "\(bu" 4
npm help start
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RM" "1" "July 2014" "" ""
+.TH "NPM\-RM" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-rm\fR \-\- Remove a package
npm help install
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "\(bu" 4
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-UNPUBLISH" "1" "July 2014" "" ""
+.TH "NPM\-UNPUBLISH" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-unpublish\fR \-\- Remove a package from the registry
npm help publish
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "\(bu" 4
npm help adduser
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-UPDATE" "1" "July 2014" "" ""
+.TH "NPM\-UPDATE" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-update\fR \-\- Update a package
npm help outdated
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "\(bu" 4
npm help ls
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-VERSION" "1" "July 2014" "" ""
+.TH "NPM\-VERSION" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-version\fR \-\- Bump a package version
.SH "SYNOPSIS"
.
.nf
-npm version [<newversion> | major | minor | patch]
+npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease]
.
.fi
.
data back to the package\.json file\.
.
.P
-The \fBnewversion\fR argument should be a valid semver string, \fIor\fR a valid
-second argument to semver\.inc (one of "patch", "minor", or
-"major")\. In the second case, the existing version will be incremented
-by 1 in the specified field\.
+The \fBnewversion\fR argument should be a valid semver string, \fIor\fR a
+valid second argument to semver\.inc (one of "patch", "minor", "major",
+"prepatch", "preminor", "premajor", "prerelease")\. In the second case,
+the existing version will be incremented by 1 in the specified field\.
.
.P
If run in a git repo, it will also create a version commit and tag, and
npm help init
.
.IP "\(bu" 4
-npm help package\.json
+npm help 5 package\.json
.
.IP "\(bu" 4
-npm help semver
+npm help 7 semver
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-VIEW" "1" "July 2014" "" ""
+.TH "NPM\-VIEW" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-view\fR \-\- View registry info
.P
"Person" fields are shown as a string if they would be shown as an
object\. So, for example, this will show the list of npm contributors in
-the shortened string format\. (npm help See \fBpackage\.json\fR for more on this\.)
+the shortened string format\. (See npm help 5 \fBpackage\.json\fR for more on this\.)
.
.IP "" 4
.
npm help search
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "\(bu" 4
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "\(bu" 4
npm help docs
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-WHOAMI" "1" "July 2014" "" ""
+.TH "NPM\-WHOAMI" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-whoami\fR \-\- Display npm username
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "\(bu" 4
npm help adduser
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM" "1" "July 2014" "" ""
+.TH "NPM" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm\fR \-\- node package manager
.fi
.
.SH "VERSION"
-1.4.23
+1.4.28
.
.SH "DESCRIPTION"
npm is the package manager for the Node JavaScript platform\. It puts
You probably got npm because you want to install stuff\.
.
.P
-npm help Use \fBnpm install blerg\fR to install the latest version of "blerg"\. Check out \fBnpm\-install\fR for more info\. It can do a lot of stuff\.
+Use \fBnpm install blerg\fR to install the latest version of "blerg"\. Check out npm help \fBnpm\-install\fR for more info\. It can do a lot of stuff\.
.
.P
Use the \fBnpm search\fR command to show everything that\'s available\.
the node\-gyp Wiki \fIhttps://github\.com/TooTallNate/node\-gyp/wiki\fR\|\.
.
.SH "DIRECTORIES"
-npm help See \fBnpm\-folders\fR to learn about where npm puts stuff\.
+See npm help 5 \fBnpm\-folders\fR to learn about where npm puts stuff\.
.
.P
In particular, npm has two modes of operation:
.
.IP "\(bu" 4
json:
-npm help Make a package\.json file\. See \fBpackage\.json\fR\|\.
+Make a package\.json file\. See npm help 5 \fBpackage\.json\fR\|\.
.
.IP "\(bu" 4
link:
.IP "" 0
.
.P
-npm help See \fBnpm\-config\fR for much much more information\.
+See npm help 7 \fBnpm\-config\fR for much much more information\.
.
.SH "CONTRIBUTIONS"
Patches welcome!
.
.IP "\(bu" 4
code:
-npm help Read through \fBnpm\-coding\-style\fR if you plan to submit code\.
+Read through npm help 7 \fBnpm\-coding\-style\fR if you plan to submit code\.
You don\'t have to agree with it, but you do have to follow it\.
.
.IP "\(bu" 4
npm help help
.
.IP "\(bu" 4
-npm help faq
+npm help 7 faq
.
.IP "\(bu" 4
README
.
.IP "\(bu" 4
-npm help package\.json
+npm help 5 package\.json
.
.IP "\(bu" 4
npm help install
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "\(bu" 4
-npm help index
+npm help 7 index
.
.IP "\(bu" 4
npm apihelp npm
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BIN" "3" "July 2014" "" ""
+.TH "NPM\-BIN" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-bin\fR \-\- Display npm bin folder
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-BUGS" "3" "July 2014" "" ""
+.TH "NPM\-BUGS" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-bugs\fR \-\- Bugs for a package in a web browser maybe
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-CACHE" "3" "July 2014" "" ""
+.TH "NPM\-CACHE" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-cache\fR \-\- manage the npm cache programmatically
.fi
.
.SH "DESCRIPTION"
-npm help This acts much the same ways as the npm\-cache command line
+This acts much the same ways as the npm help cache command line
functionality\.
.
.P
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-COMMANDS" "3" "July 2014" "" ""
+.TH "NPM\-COMMANDS" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-commands\fR \-\- npm commands
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help index
+npm help 7 index
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-CONFIG" "3" "July 2014" "" ""
+.TH "NPM\-CONFIG" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-config\fR \-\- Manage the npm configuration files
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DEPRECATE" "3" "July 2014" "" ""
+.TH "NPM\-DEPRECATE" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-deprecate\fR \-\- Deprecate a version of a package
npm apihelp unpublish
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DOCS" "3" "July 2014" "" ""
+.TH "NPM\-DOCS" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-docs\fR \-\- Docs for a package in a web browser maybe
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-EDIT" "3" "July 2014" "" ""
+.TH "NPM\-EDIT" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-edit\fR \-\- Edit an installed package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-EXPLORE" "3" "July 2014" "" ""
+.TH "NPM\-EXPLORE" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-explore\fR \-\- Browse an installed package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-HELP\-SEARCH" "3" "July 2014" "" ""
+.TH "NPM\-HELP\-SEARCH" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-help-search\fR \-\- Search the help pages
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "INIT" "3" "July 2014" "" ""
+.TH "INIT" "3" "September 2014" "" ""
.
.SH "NAME"
\fBinit\fR \-\- Interactively create a package\.json file
then go ahead and use this programmatically\.
.
.SH "SEE ALSO"
-npm help package\.json
+npm help 5 package\.json
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-INSTALL" "3" "July 2014" "" ""
+.TH "NPM\-INSTALL" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-install\fR \-\- install a package programmatically
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-LINK" "3" "July 2014" "" ""
+.TH "NPM\-LINK" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-link\fR \-\- Symlink a package folder
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-LOAD" "3" "July 2014" "" ""
+.TH "NPM\-LOAD" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-load\fR \-\- Load config settings
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-LS" "3" "July 2014" "" ""
+.TH "NPM\-LS" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-ls\fR \-\- List installed packages
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-OUTDATED" "3" "July 2014" "" ""
+.TH "NPM\-OUTDATED" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-outdated\fR \-\- Check for outdated packages
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-OWNER" "3" "July 2014" "" ""
+.TH "NPM\-OWNER" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-owner\fR \-\- Manage package owners
npm apihelp publish
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PACK" "3" "July 2014" "" ""
+.TH "NPM\-PACK" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-pack\fR \-\- Create a tarball from a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PREFIX" "3" "July 2014" "" ""
+.TH "NPM\-PREFIX" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-prefix\fR \-\- Display prefix
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PRUNE" "3" "July 2014" "" ""
+.TH "NPM\-PRUNE" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-prune\fR \-\- Remove extraneous packages
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-PUBLISH" "3" "July 2014" "" ""
+.TH "NPM\-PUBLISH" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-publish\fR \-\- Publish a package
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "\(bu" 4
npm help adduser
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-REBUILD" "3" "July 2014" "" ""
+.TH "NPM\-REBUILD" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-rebuild\fR \-\- Rebuild a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-REPO" "3" "July 2014" "" ""
+.TH "NPM\-REPO" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-repo\fR \-\- Open package repository page in the browser
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RESTART" "3" "July 2014" "" ""
+.TH "NPM\-RESTART" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-restart\fR \-\- Start a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-ROOT" "3" "July 2014" "" ""
+.TH "NPM\-ROOT" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-root\fR \-\- Display npm root
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-RUN\-SCRIPT" "3" "July 2014" "" ""
+.TH "NPM\-RUN\-SCRIPT" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-run-script\fR \-\- Run arbitrary package scripts
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help scripts
+npm help 7 scripts
.
.IP "\(bu" 4
npm apihelp test
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SEARCH" "3" "July 2014" "" ""
+.TH "NPM\-SEARCH" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-search\fR \-\- Search for packages
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SHRINKWRAP" "3" "July 2014" "" ""
+.TH "NPM\-SHRINKWRAP" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-shrinkwrap\fR \-\- programmatically generate package shrinkwrap file
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-START" "3" "July 2014" "" ""
+.TH "NPM\-START" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-start\fR \-\- Start a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-STOP" "3" "July 2014" "" ""
+.TH "NPM\-STOP" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-stop\fR \-\- Stop a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SUBMODULE" "3" "July 2014" "" ""
+.TH "NPM\-SUBMODULE" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-submodule\fR \-\- Add a package as a git submodule
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-TAG" "3" "July 2014" "" ""
+.TH "NPM\-TAG" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-tag\fR \-\- Tag a published version
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-TEST" "3" "July 2014" "" ""
+.TH "NPM\-TEST" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-test\fR \-\- Test a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-UNINSTALL" "3" "July 2014" "" ""
+.TH "NPM\-UNINSTALL" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-uninstall\fR \-\- uninstall a package programmatically
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-UNPUBLISH" "3" "July 2014" "" ""
+.TH "NPM\-UNPUBLISH" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-unpublish\fR \-\- Remove a package from the registry
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-UPDATE" "3" "July 2014" "" ""
+.TH "NPM\-UPDATE" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-update\fR \-\- Update a package
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-VERSION" "3" "July 2014" "" ""
+.TH "NPM\-VERSION" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-version\fR \-\- Bump a package version
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-VIEW" "3" "July 2014" "" ""
+.TH "NPM\-VIEW" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-view\fR \-\- View registry info
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-WHOAMI" "3" "July 2014" "" ""
+.TH "NPM\-WHOAMI" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-whoami\fR \-\- Display npm username
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM" "3" "July 2014" "" ""
+.TH "NPM" "3" "September 2014" "" ""
.
.SH "NAME"
\fBnpm\fR \-\- node package manager
.fi
.
.SH "VERSION"
-1.4.23
+1.4.28
.
.SH "DESCRIPTION"
This is the API documentation for npm\.
To find documentation of the command line
-npm help client, see \fBnpm\fR\|\.
+client, see npm help \fBnpm\fR\|\.
.
.P
Prior to using npm\'s commands, \fBnpm\.load()\fR must be called\.
configs, they override the values stored in the various config
locations\. In the npm command line client, this set of configs
is parsed from the command line options\. Additional configuration
-npm help npm help params are loaded from two configuration files\. See \fBnpm\-config\fR, \fBnpm\-confignpm help \fR, and \fBnpmrc\fR for more information\.
+params are loaded from two configuration files\. See npm help \fBnpm\-config\fR, npm help 7 \fBnpm\-config\fR, and npm help 5 \fBnpmrc\fR for more information\.
.
.P
After that, each of the functions are accessible in the
-npm help commands object: \fBnpm\.commands\.<cmd>\fR\|\. See \fBnpm\-index\fR for a list of
+commands object: \fBnpm\.commands\.<cmd>\fR\|\. See npm help 7 \fBnpm\-index\fR for a list of
all possible commands\.
.
.P
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-FOLDERS" "5" "July 2014" "" ""
+.TH "NPM\-FOLDERS" "5" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-folders\fR \-\- Folder Structures Used by npm
Man pages are not installed on Windows systems\.
.
.SS "Cache"
-npm help See \fBnpm\-cache\fR\|\. Cache files are stored in \fB~/\.npm\fR on Posix, or \fB~/npm\-cache\fR on Windows\.
+See npm help \fBnpm\-cache\fR\|\. Cache files are stored in \fB~/\.npm\fR on Posix, or \fB~/npm\-cache\fR on Windows\.
.
.P
This is controlled by the \fBcache\fR configuration param\.
.P
This allows a package maintainer to install all of their dependencies
(and dev dependencies) locally, but only re\-publish those items that
-npm help cannot be found elsewhere\. See \fBpackage\.json\fR for more information\.
+cannot be found elsewhere\. See npm help 5 \fBpackage\.json\fR for more information\.
.
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help faq
+npm help 7 faq
.
.IP "\(bu" 4
-npm help package\.json
+npm help 5 package\.json
.
.IP "\(bu" 4
npm help install
npm help config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
npm help publish
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-FOLDERS" "5" "July 2014" "" ""
+.TH "NPM\-FOLDERS" "5" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-folders\fR \-\- Folder Structures Used by npm
Man pages are not installed on Windows systems\.
.
.SS "Cache"
-npm help See \fBnpm\-cache\fR\|\. Cache files are stored in \fB~/\.npm\fR on Posix, or \fB~/npm\-cache\fR on Windows\.
+See npm help \fBnpm\-cache\fR\|\. Cache files are stored in \fB~/\.npm\fR on Posix, or \fB~/npm\-cache\fR on Windows\.
.
.P
This is controlled by the \fBcache\fR configuration param\.
.P
This allows a package maintainer to install all of their dependencies
(and dev dependencies) locally, but only re\-publish those items that
-npm help cannot be found elsewhere\. See \fBpackage\.json\fR for more information\.
+cannot be found elsewhere\. See npm help 5 \fBpackage\.json\fR for more information\.
.
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help faq
+npm help 7 faq
.
.IP "\(bu" 4
-npm help package\.json
+npm help 5 package\.json
.
.IP "\(bu" 4
npm help install
npm help config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
npm help publish
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "PACKAGE\.JSON" "5" "July 2014" "" ""
+.TH "PACKAGE\.JSON" "5" "September 2014" "" ""
.
.SH "NAME"
\fBpackage.json\fR \-\- Specifics of npm\'s package\.json handling
.
.P
A lot of the behavior described in this document is affected by the config
-npm help settings described in \fBnpm\-config\fR\|\.
+settings described in npm help 7 \fBnpm\-config\fR\|\.
.
.SH "name"
The \fImost\fR important things in your package\.json are the name and version fields\.
with npm as a dependency\. (\fBnpm install semver\fR to use it yourself\.)
.
.P
-npm help More on version numbers and ranges at semver\.
+More on version numbers and ranges at npm help 7 semver\.
.
.SH "description"
Put a description in it\. It\'s a string\. This helps people discover your
event, and the value is the command to run at that point\.
.
.P
-npm help See \fBnpm\-scripts\fR to find out more about writing package scripts\.
+See npm help 7 \fBnpm\-scripts\fR to find out more about writing package scripts\.
.
.SH "config"
A "config" hash can be used to set configuration
override that by doing \fBnpm config set foo:port 8001\fR\|\.
.
.P
-npm help See \fBnpm\-confignpm help \fR and \fBnpm\-scripts\fR for more on package
+See npm help 7 \fBnpm\-config\fR and npm help 7 \fBnpm\-scripts\fR for more on package
configs\.
.
.SH "dependencies"
\fBPlease do not put test harnesses or transpilers in your \fBdependencies\fR hash\.\fR See \fBdevDependencies\fR, below\.
.
.P
-npm help See semver for more details about specifying version ranges\.
+See npm help 7 semver for more details about specifying version ranges\.
.
.IP "\(bu" 4
\fBversion\fR Must match \fBversion\fR exactly
\fB<=version\fR
.
.IP "\(bu" 4
-npm help \fB~version\fR "Approximately equivalent to version" See semver
+\fB~version\fR "Approximately equivalent to version" See npm help 7 semver
.
.IP "\(bu" 4
-npm help \fB^version\fR "Compatible with version" See semver
+\fB^version\fR "Compatible with version" See npm help 7 semver
.
.IP "\(bu" 4
\fB1\.2\.x\fR 1\.2\.0, 1\.2\.1, etc\., but not 1\.3\.0
.P
These things will be installed when doing \fBnpm link\fR or \fBnpm install\fR
from the root of a package, and can be managed like any other npm
-npm help configuration param\. See \fBnpm\-config\fR for more on the topic\.
+configuration param\. See npm help 7 \fBnpm\-config\fR for more on the topic\.
.
.P
For build steps that are not platform\-specific, such as compiling
"registry" probably matter for the purposes of publishing\.
.
.P
-npm help See \fBnpm\-config\fR to see the list of config options that can be
+See npm help 7 \fBnpm\-config\fR to see the list of config options that can be
overridden\.
.
.SH "DEFAULT VALUES"
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help semver
+npm help 7 semver
.
.IP "\(bu" 4
npm help init
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
npm help help
.
.IP "\(bu" 4
-npm help faq
+npm help 7 faq
.
.IP "\(bu" 4
npm help install
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPMRC" "5" "July 2014" "" ""
+.TH "NPMRC" "5" "September 2014" "" ""
.
.SH "NAME"
\fBnpmrc\fR \-\- The npm config files
of the user and global npmrc files\.
.
.P
-npm help For a list of available configuration options, see npm\-config\.
+For a list of available configuration options, see npm help 7 config\.
.
.SH "FILES"
The four relevant files are:
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "\(bu" 4
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help package\.json
+npm help 5 package\.json
.
.IP "\(bu" 4
npm help npm
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "PACKAGE\.JSON" "5" "July 2014" "" ""
+.TH "PACKAGE\.JSON" "5" "September 2014" "" ""
.
.SH "NAME"
\fBpackage.json\fR \-\- Specifics of npm\'s package\.json handling
.
.P
A lot of the behavior described in this document is affected by the config
-npm help settings described in \fBnpm\-config\fR\|\.
+settings described in npm help 7 \fBnpm\-config\fR\|\.
.
.SH "name"
The \fImost\fR important things in your package\.json are the name and version fields\.
with npm as a dependency\. (\fBnpm install semver\fR to use it yourself\.)
.
.P
-npm help More on version numbers and ranges at semver\.
+More on version numbers and ranges at npm help 7 semver\.
.
.SH "description"
Put a description in it\. It\'s a string\. This helps people discover your
event, and the value is the command to run at that point\.
.
.P
-npm help See \fBnpm\-scripts\fR to find out more about writing package scripts\.
+See npm help 7 \fBnpm\-scripts\fR to find out more about writing package scripts\.
.
.SH "config"
A "config" hash can be used to set configuration
override that by doing \fBnpm config set foo:port 8001\fR\|\.
.
.P
-npm help See \fBnpm\-confignpm help \fR and \fBnpm\-scripts\fR for more on package
+See npm help 7 \fBnpm\-config\fR and npm help 7 \fBnpm\-scripts\fR for more on package
configs\.
.
.SH "dependencies"
\fBPlease do not put test harnesses or transpilers in your \fBdependencies\fR hash\.\fR See \fBdevDependencies\fR, below\.
.
.P
-npm help See semver for more details about specifying version ranges\.
+See npm help 7 semver for more details about specifying version ranges\.
.
.IP "\(bu" 4
\fBversion\fR Must match \fBversion\fR exactly
\fB<=version\fR
.
.IP "\(bu" 4
-npm help \fB~version\fR "Approximately equivalent to version" See semver
+\fB~version\fR "Approximately equivalent to version" See npm help 7 semver
.
.IP "\(bu" 4
-npm help \fB^version\fR "Compatible with version" See semver
+\fB^version\fR "Compatible with version" See npm help 7 semver
.
.IP "\(bu" 4
\fB1\.2\.x\fR 1\.2\.0, 1\.2\.1, etc\., but not 1\.3\.0
.P
These things will be installed when doing \fBnpm link\fR or \fBnpm install\fR
from the root of a package, and can be managed like any other npm
-npm help configuration param\. See \fBnpm\-config\fR for more on the topic\.
+configuration param\. See npm help 7 \fBnpm\-config\fR for more on the topic\.
.
.P
For build steps that are not platform\-specific, such as compiling
"registry" probably matter for the purposes of publishing\.
.
.P
-npm help See \fBnpm\-config\fR to see the list of config options that can be
+See npm help 7 \fBnpm\-config\fR to see the list of config options that can be
overridden\.
.
.SH "DEFAULT VALUES"
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help semver
+npm help 7 semver
.
.IP "\(bu" 4
npm help init
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
npm help help
.
.IP "\(bu" 4
-npm help faq
+npm help 7 faq
.
.IP "\(bu" 4
npm help install
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-CODING\-STYLE" "7" "July 2014" "" ""
+.TH "NPM\-CODING\-STYLE" "7" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-coding-style\fR \-\- npm\'s "funny" coding style
occurs\.
.
.P
-npm help Use appropriate log levels\. See \fBnpm\-config\fR and search for
+Use appropriate log levels\. See npm help 7 \fBnpm\-config\fR and search for
"loglevel"\.
.
.SH "Case, naming, etc\."
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help developers
+npm help 7 developers
.
.IP "\(bu" 4
-npm help faq
+npm help 7 faq
.
.IP "\(bu" 4
npm help npm
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-CONFIG" "7" "July 2014" "" ""
+.TH "NPM\-CONFIG" "7" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-config\fR \-\- More than you probably want to know about npm configuration
.IP "" 0
.
.P
-npm help See npmrc for more details\.
+See npm help 5 npmrc for more details\.
.
.SS "Default Configs"
A set of configuration parameters that are internal to npm, and are
.IP "" 0
.
.SH "Per\-Package Config Settings"
-When running scripts (npm help see \fBnpm\-scripts\fR) the package\.json "config"
+When running scripts (see npm help 7 \fBnpm\-scripts\fR) the package\.json "config"
keys are overwritten in the environment if there is a config param of \fB<name>[@<version>]:<key>\fR\|\. For example, if the package\.json has
this:
.
.IP "" 0
.
.P
-npm help See package\.json for more information\.
+See npm help 5 package\.json for more information\.
.
.SH "Config Settings"
.
.IP "" 0
.
.P
-npm help The location of npm\'s cache directory\. See \fBnpm\-cache\fR
+The location of npm\'s cache directory\. See npm help \fBnpm\-cache\fR
.
.SS "cache\-lock\-stale"
.
.IP "" 0
.
.P
-npm help Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory\. See \fBnpm\-folders\fR for more on the differences in behavior\.
+Operates in "global" mode, so that packages are installed into the \fBprefix\fR folder instead of the current working directory\. See npm help 5 \fBnpm\-folders\fR for more on the differences in behavior\.
.
.IP "\(bu" 4
packages are installed into the \fB{prefix}/lib/node_modules\fR folder, instead of the
.P
A module that will be loaded by the \fBnpm init\fR command\. See the
documentation for the init\-package\-json \fIhttps://github\.com/isaacs/init\-package\-json\fR module
-npm help for more information, or npm\-init\.
+for more information, or npm help init\.
.
.SS "init\.author\.name"
.
.SS "prefix"
.
.IP "\(bu" 4
-npm help Default: see npm\-folders
+Default: see npm help 5 folders
.
.IP "\(bu" 4
Type: path
.
.P
Set to show short usage output (like the \-H output)
-npm help instead of complete help when doing \fBnpm\-help\fR\|\.
+instead of complete help when doing npm help \fBnpm\-help\fR\|\.
.
.SS "user"
.
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "\(bu" 4
-npm help scripts
+npm help 7 scripts
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "\(bu" 4
npm help npm
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DEVELOPERS" "7" "July 2014" "" ""
+.TH "NPM\-DEVELOPERS" "7" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-developers\fR \-\- Developer Guide
much of anything with npm\. That is basically the whole interface\.
.
.P
-npm help See \fBpackage\.json\fR for details about what goes in that file\. At the very
+See npm help 5 \fBpackage\.json\fR for details about what goes in that file\. At the very
least, you need:
.
.IP "\(bu" 4
If you have a special compilation or installation script, then you
should put it in the \fBscripts\fR hash\. You should definitely have at
least a basic smoke\-test command as the "scripts\.test" field\.
-npm help See npm\-scripts\.
+See npm help 7 scripts\.
.
.IP "\(bu" 4
main:
.
.P
You can use \fBnpm init\fR in the root of your package in order to get you
-npm help started with a pretty basic package\.json file\. See \fBnpm\-init\fR for
+started with a pretty basic package\.json file\. See npm help \fBnpm\-init\fR for
more info\.
.
.SH "Keeping files "
of course\.)
.
.P
-npm help More info at \fBnpm\-link\fR\|\.
+More info at npm help \fBnpm\-link\fR\|\.
.
.SH "Before Publishing: Make Sure Your Package Installs and Works"
\fBThis is important\.\fR
and then follow the prompts\.
.
.P
-npm help This is documented better in npm\-adduser\.
+This is documented better in npm help adduser\.
.
.SH "Publish your package"
This part\'s easy\. IN the root of your folder, do this:
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help faq
+npm help 7 faq
.
.IP "\(bu" 4
npm help npm
npm help init
.
.IP "\(bu" 4
-npm help package\.json
+npm help 5 package\.json
.
.IP "\(bu" 4
-npm help scripts
+npm help 7 scripts
.
.IP "\(bu" 4
npm help publish
npm help adduser
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-DISPUTES" "7" "July 2014" "" ""
+.TH "NPM\-DISPUTES" "7" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-disputes\fR \-\- Handling Module Name Disputes
.SH "SEE ALSO"
.
.IP "\(bu" 4
-npm help registry
+npm help 7 registry
.
.IP "\(bu" 4
npm help owner
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-FAQ" "7" "July 2014" "" ""
+.TH "NPM\-FAQ" "7" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-faq\fR \-\- Frequently Asked Questions
do what it says and post a bug with all the information it asks for\.
.
.SH "Where does npm put stuff?"
-npm help See \fBnpm\-folders\fR
+See npm help 5 \fBnpm\-folders\fR
.
.P
tl;dr:
.P
It is much harder to avoid dependency conflicts without nesting
dependencies\. This is fundamental to the way that npm works, and has
-npm help proven to be an extremely successful approach\. See \fBnpm\-folders\fR for
+proven to be an extremely successful approach\. See npm help 5 \fBnpm\-folders\fR for
more details\.
.
.P
.IP "" 0
.
.SH "How can I use npm for development?"
-npm help See \fBnpm\-developersnpm help \fR and \fBpackage\.json\fR\|\.
+See npm help 7 \fBnpm\-developers\fR and npm help 5 \fBpackage\.json\fR\|\.
.
.P
You\'ll most likely want to \fBnpm link\fR your development folder\. That\'s
awesomely handy\.
.
.P
-npm help To set up your own private registry, check out \fBnpm\-registry\fR\|\.
+To set up your own private registry, check out npm help 7 \fBnpm\-registry\fR\|\.
.
.SH "Can I list a url as a dependency?"
Yes\. It should be a url to a gzipped tarball containing a single folder
(See "what is a package?" above\.)
.
.SH "How do I symlink to a dev folder so I don't have to keep re\-installing?"
-npm help See \fBnpm\-link\fR
+See npm help \fBnpm\-link\fR
.
.SH "The package registry website\. What is that exactly?"
-npm help See \fBnpm\-registry\fR\|\.
+See npm help 7 \fBnpm\-registry\fR\|\.
.
.SH "I forgot my password, and can't publish\. How do I reset it?"
Go to \fIhttps://npmjs\.org/forgot\fR\|\.
npm help npm
.
.IP "\(bu" 4
-npm help developers
+npm help 7 developers
.
.IP "\(bu" 4
-npm help package\.json
+npm help 5 package\.json
.
.IP "\(bu" 4
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help folders
+npm help 5 folders
.
.IP "" 0
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-INDEX" "7" "July 2014" "" ""
+.TH "NPM\-INDEX" "7" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-index\fR \-\- Index of all npm documentation
.
-npm help .SH "README"
+.SS "npm help README"
node package manager
.
-npm help .SH "npm"
+.SH "Command Line Documentation"
+Using npm on the command line
+.
+.SS "npm help npm"
node package manager
.
-npm help .SH "npm\-adduser"
+.SS "npm help adduser"
Add a registry user account
.
-npm help .SH "npm\-bin"
+.SS "npm help bin"
Display npm bin folder
.
-npm help .SH "npm\-bugs"
+.SS "npm help bugs"
Bugs for a package in a web browser maybe
.
-npm help .SH "npm\-build"
+.SS "npm help build"
Build a package
.
-npm help .SH "npm\-bundle"
+.SS "npm help bundle"
REMOVED
.
-npm help .SH "npm\-cache"
+.SS "npm help cache"
Manipulates packages cache
.
-npm help .SH "npm\-completion"
+.SS "npm help completion"
Tab Completion for npm
.
-npm help .SH "npm\-config"
+.SS "npm help config"
Manage the npm configuration files
.
-npm help .SH "npm\-dedupe"
+.SS "npm help dedupe"
Reduce duplication
.
-npm help .SH "npm\-deprecate"
+.SS "npm help deprecate"
Deprecate a version of a package
.
-npm help .SH "npm\-docs"
+.SS "npm help docs"
Docs for a package in a web browser maybe
.
-npm help .SH "npm\-edit"
+.SS "npm help edit"
Edit an installed package
.
-npm help .SH "npm\-explore"
+.SS "npm help explore"
Browse an installed package
.
-npm help .SH "npm\-help\-search"
+.SS "npm help help\-search"
Search npm help documentation
.
-npm help .SH "npm\-help"
+.SS "npm help help"
Get help on npm
.
-npm help .SH "npm\-init"
+.SS "npm help init"
Interactively create a package\.json file
.
-npm help .SH "npm\-install"
+.SS "npm help install"
Install a package
.
-npm help .SH "npm\-link"
+.SS "npm help link"
Symlink a package folder
.
-npm help .SH "npm\-ls"
+.SS "npm help ls"
List installed packages
.
-npm help .SH "npm\-outdated"
+.SS "npm help outdated"
Check for outdated packages
.
-npm help .SH "npm\-owner"
+.SS "npm help owner"
Manage package owners
.
-npm help .SH "npm\-pack"
+.SS "npm help pack"
Create a tarball from a package
.
-npm help .SH "npm\-prefix"
+.SS "npm help prefix"
Display prefix
.
-npm help .SH "npm\-prune"
+.SS "npm help prune"
Remove extraneous packages
.
-npm help .SH "npm\-publish"
+.SS "npm help publish"
Publish a package
.
-npm help .SH "npm\-rebuild"
+.SS "npm help rebuild"
Rebuild a package
.
-npm help .SH "npm\-repo"
+.SS "npm help repo"
Open package repository page in the browser
.
-npm help .SH "npm\-restart"
+.SS "npm help restart"
Start a package
.
-npm help .SH "npm\-rm"
+.SS "npm help rm"
Remove a package
.
-npm help .SH "npm\-root"
+.SS "npm help root"
Display npm root
.
-npm help .SH "npm\-run\-script"
+.SS "npm help run\-script"
Run arbitrary package scripts
.
-npm help .SH "npm\-search"
+.SS "npm help search"
Search for packages
.
-npm help .SH "npm\-shrinkwrap"
+.SS "npm help shrinkwrap"
Lock down dependency versions
.
-npm help .SH "npm\-star"
+.SS "npm help star"
Mark your favorite packages
.
-npm help .SH "npm\-stars"
+.SS "npm help stars"
View packages marked as favorites
.
-npm help .SH "npm\-start"
+.SS "npm help start"
Start a package
.
-npm help .SH "npm\-stop"
+.SS "npm help stop"
Stop a package
.
-npm help .SH "npm\-submodule"
+.SS "npm help submodule"
Add a package as a git submodule
.
-npm help .SH "npm\-tag"
+.SS "npm help tag"
Tag a published version
.
-npm help .SH "npm\-test"
+.SS "npm help test"
Test a package
.
-npm help .SH "npm\-uninstall"
+.SS "npm help uninstall"
Remove a package
.
-npm help .SH "npm\-unpublish"
+.SS "npm help unpublish"
Remove a package from the registry
.
-npm help .SH "npm\-update"
+.SS "npm help update"
Update a package
.
-npm help .SH "npm\-version"
+.SS "npm help version"
Bump a package version
.
-npm help .SH "npm\-view"
+.SS "npm help view"
View registry info
.
-npm help .SH "npm\-whoami"
+.SS "npm help whoami"
Display npm username
.
-npm apihelp .SH "npm"
+.SH "API Documentation"
+Using npm in your Node programs
+.
+.SS "npm apihelp npm"
node package manager
.
-npm apihelp .SH "npm\-bin"
+.SS "npm apihelp bin"
Display npm bin folder
.
-npm apihelp .SH "npm\-bugs"
+.SS "npm apihelp bugs"
Bugs for a package in a web browser maybe
.
-npm apihelp .SH "npm\-cache"
+.SS "npm apihelp cache"
manage the npm cache programmatically
.
-npm apihelp .SH "npm\-commands"
+.SS "npm apihelp commands"
npm commands
.
-npm apihelp .SH "npm\-config"
+.SS "npm apihelp config"
Manage the npm configuration files
.
-npm apihelp .SH "npm\-deprecate"
+.SS "npm apihelp deprecate"
Deprecate a version of a package
.
-npm apihelp .SH "npm\-docs"
+.SS "npm apihelp docs"
Docs for a package in a web browser maybe
.
-npm apihelp .SH "npm\-edit"
+.SS "npm apihelp edit"
Edit an installed package
.
-npm apihelp .SH "npm\-explore"
+.SS "npm apihelp explore"
Browse an installed package
.
-npm apihelp .SH "npm\-help\-search"
+.SS "npm apihelp help\-search"
Search the help pages
.
-npm apihelp .SH "npm\-init"
+.SS "npm apihelp init"
Interactively create a package\.json file
.
-npm apihelp .SH "npm\-install"
+.SS "npm apihelp install"
install a package programmatically
.
-npm apihelp .SH "npm\-link"
+.SS "npm apihelp link"
Symlink a package folder
.
-npm apihelp .SH "npm\-load"
+.SS "npm apihelp load"
Load config settings
.
-npm apihelp .SH "npm\-ls"
+.SS "npm apihelp ls"
List installed packages
.
-npm apihelp .SH "npm\-outdated"
+.SS "npm apihelp outdated"
Check for outdated packages
.
-npm apihelp .SH "npm\-owner"
+.SS "npm apihelp owner"
Manage package owners
.
-npm apihelp .SH "npm\-pack"
+.SS "npm apihelp pack"
Create a tarball from a package
.
-npm apihelp .SH "npm\-prefix"
+.SS "npm apihelp prefix"
Display prefix
.
-npm apihelp .SH "npm\-prune"
+.SS "npm apihelp prune"
Remove extraneous packages
.
-npm apihelp .SH "npm\-publish"
+.SS "npm apihelp publish"
Publish a package
.
-npm apihelp .SH "npm\-rebuild"
+.SS "npm apihelp rebuild"
Rebuild a package
.
-npm apihelp .SH "npm\-repo"
+.SS "npm apihelp repo"
Open package repository page in the browser
.
-npm apihelp .SH "npm\-restart"
+.SS "npm apihelp restart"
Start a package
.
-npm apihelp .SH "npm\-root"
+.SS "npm apihelp root"
Display npm root
.
-npm apihelp .SH "npm\-run\-script"
+.SS "npm apihelp run\-script"
Run arbitrary package scripts
.
-npm apihelp .SH "npm\-search"
+.SS "npm apihelp search"
Search for packages
.
-npm apihelp .SH "npm\-shrinkwrap"
+.SS "npm apihelp shrinkwrap"
programmatically generate package shrinkwrap file
.
-npm apihelp .SH "npm\-start"
+.SS "npm apihelp start"
Start a package
.
-npm apihelp .SH "npm\-stop"
+.SS "npm apihelp stop"
Stop a package
.
-npm apihelp .SH "npm\-submodule"
+.SS "npm apihelp submodule"
Add a package as a git submodule
.
-npm apihelp .SH "npm\-tag"
+.SS "npm apihelp tag"
Tag a published version
.
-npm apihelp .SH "npm\-test"
+.SS "npm apihelp test"
Test a package
.
-npm apihelp .SH "npm\-uninstall"
+.SS "npm apihelp uninstall"
uninstall a package programmatically
.
-npm apihelp .SH "npm\-unpublish"
+.SS "npm apihelp unpublish"
Remove a package from the registry
.
-npm apihelp .SH "npm\-update"
+.SS "npm apihelp update"
Update a package
.
-npm apihelp .SH "npm\-version"
+.SS "npm apihelp version"
Bump a package version
.
-npm apihelp .SH "npm\-view"
+.SS "npm apihelp view"
View registry info
.
-npm apihelp .SH "npm\-whoami"
+.SS "npm apihelp whoami"
Display npm username
.
-npm help .SH "npm\-folders"
+.SH "Files"
+File system structures npm uses
+.
+.SS "npm help 5 folders"
Folder Structures Used by npm
.
-npm help .SH "npmrc"
+.SS "npm help 5 npmrc"
The npm config files
.
-npm help .SH "package\.json"
+.SS "npm help 5 package\.json"
Specifics of npm\'s package\.json handling
.
-npm help .SH "npm\-coding\-style"
+.SH "Misc"
+Various other bits and bobs
+.
+.SS "npm help 7 coding\-style"
npm\'s "funny" coding style
.
-npm help .SH "npm\-config"
+.SS "npm help 7 config"
More than you probably want to know about npm configuration
.
-npm help .SH "npm\-developers"
+.SS "npm help 7 developers"
Developer Guide
.
-npm help .SH "npm\-disputes"
+.SS "npm help 7 disputes"
Handling Module Name Disputes
.
-npm help .SH "npm\-faq"
+.SS "npm help 7 faq"
Frequently Asked Questions
.
-npm help .SH "npm\-index"
+.SS "npm help 7 index"
Index of all npm documentation
.
-npm help .SH "npm\-registry"
+.SS "npm help 7 registry"
The JavaScript Package Registry
.
-npm help .SH "npm\-scripts"
+.SS "npm help 7 scripts"
How npm handles the "scripts" field
.
-npm help .SH "removing\-npm"
+.SS "npm help 7 removing\-npm"
Cleaning the Slate
.
-npm help .SH "semver"
+.SS "npm help 7 semver"
The semantic versioner for npm
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-REGISTRY" "7" "July 2014" "" ""
+.TH "NPM\-REGISTRY" "7" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-registry\fR \-\- The JavaScript Package Registry
database\.
.
.P
-npm help npm help The registry URL is supplied by the \fBregistry\fR config parameter\. See \fBnpm\-config\fR, \fBnpmrcnpm help \fR, and \fBnpm\-config\fR for more on managing
+The registry URL is supplied by the \fBregistry\fR config parameter\. See npm help \fBnpm\-config\fR, npm help 5 \fBnpmrc\fR, and npm help 7 \fBnpm\-config\fR for more on managing
npm\'s configuration\.
.
.SH "Can I run my own private registry?"
to force it to be published only to your internal registry\.
.
.P
-npm help See \fBpackage\.json\fR for more info on what goes in the package\.json file\.
+See npm help 5 \fBpackage\.json\fR for more info on what goes in the package\.json file\.
.
.SH "Will you replicate from my registry into the public one?"
No\. If you want things to be public, then publish them into the public
npm help config
.
.IP "\(bu" 4
-npm help config
+npm help 7 config
.
.IP "\(bu" 4
-npm help npmrc
+npm help 5 npmrc
.
.IP "\(bu" 4
-npm help developers
+npm help 7 developers
.
.IP "\(bu" 4
-npm help disputes
+npm help 7 disputes
.
.IP "" 0
--- /dev/null
+.TH "NPM\-SCOPE" "7" "September 2014" "" ""
+.SH "NAME"
+\fBnpm-scope\fR \- Scoped packages
+.SH DESCRIPTION
+.P
+All npm packages have a name\. Some package names also have a scope\. A scope
+follows the usual rules for package names (url\-safe characters, no leading dots
+or underscores)\. When used in package names, preceded by an @\-symbol and
+followed by a slash, e\.g\.
+.P
+.RS 2
+.EX
+@somescope/somepackagename
+.EE
+.RE
+.P
+Scopes are a way of grouping related packages together, and also affect a few
+things about the way npm treats the package\.
+.P
+\fBAs of 2014\-09\-03, scoped packages are not supported by the public npm registry\fR\|\.
+However, the npm client is backwards\-compatible with un\-scoped registries, so
+it can be used to work with scoped and un\-scoped registries at the same time\.
+.SH Installing scoped packages
+.P
+Scoped packages are installed to a sub\-folder of the regular installation
+folder, e\.g\. if your other packages are installed in \fBnode_modules/packagename\fR,
+scoped modules will be in \fBnode_modules/@myorg/packagename\fR\|\. The scope folder
+(\fB@myorg\fR) is simply the name of the scope preceded by an @\-symbol, and can
+contain any number of scoped packages\.
+.P
+A scoped package is install by referencing it by name, preceded by an @\-symbol,
+in \fBnpm install\fR:
+.P
+.RS 2
+.EX
+npm install @myorg/mypackage
+.EE
+.RE
+.P
+Or in \fBpackage\.json\fR:
+.P
+.RS 2
+.EX
+"dependencies": {
+ "@myorg/mypackage": "^1\.3\.0"
+}
+.EE
+.RE
+.P
+Note that if the @\-symbol is omitted in either case npm will instead attempt to
+install from GitHub; see npm help \fBnpm\-install\fR\|\.
+.SH Requiring scoped packages
+.P
+Because scoped packages are installed into a scope folder, you have to
+include the name of the scope when requiring them in your code, e\.g\.
+.P
+.RS 2
+.EX
+require('@myorg/mypackage')
+.EE
+.RE
+.P
+There is nothing special about the way Node treats scope folders, this is
+just specifying to require the module \fBmypackage\fR in the folder called \fB@myorg\fR\|\.
+.SH Publishing scoped packages
+.P
+Scoped packages can be published to any registry that supports them\.
+\fIAs of 2014\-09\-03, the public npm registry does not support scoped packages\fR,
+so attempting to publish a scoped package to the registry will fail unless
+you have associated that scope with a different registry, see below\.
+.SH Associating a scope with a registry
+.P
+Scopes can be associated with a separate registry\. This allows you to
+seamlessly use a mix of packages from the public npm registry and one or more
+private registries, such as npm Enterprise\.
+.P
+You can associate a scope with a registry at login, e\.g\.
+.P
+.RS 2
+.EX
+npm login \-\-registry=http://reg\.example\.com \-\-scope=@myco
+.EE
+.RE
+.P
+Scopes have a many\-to\-one relationship with registries: one registry can
+host multiple scopes, but a scope only ever points to one registry\.
+.P
+You can also associate a scope with a registry using \fBnpm config\fR:
+.P
+.RS 2
+.EX
+npm config set @myco:registry http://reg\.example\.com
+.EE
+.RE
+.P
+Once a scope is associated with a registry, any \fBnpm install\fR for a package
+with that scope will request packages from that registry instead\. Any
+\fBnpm publish\fR for a package name that contains the scope will be published to
+that registry instead\.
+.SH SEE ALSO
+.RS 0
+.IP \(bu 2
+npm help install
+.IP \(bu 2
+npm help publish
+
+.RE
+
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-SCRIPTS" "7" "July 2014" "" ""
+.TH "NPM\-SCRIPTS" "7" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-scripts\fR \-\- How npm handles the "scripts" field
print a warning and exit successfully\.
.
.IP "\(bu" 4
-npm help Try not to use scripts to do what npm can do for you\. Read through \fBpackage\.json\fR to see all the things that you can specify and enable
+Try not to use scripts to do what npm can do for you\. Read through npm help 5 \fBpackage\.json\fR to see all the things that you can specify and enable
by simply describing your package appropriately\. In general, this
will lead to a more robust and consistent state\.
.
npm help run\-script
.
.IP "\(bu" 4
-npm help package\.json
+npm help 5 package\.json
.
.IP "\(bu" 4
-npm help developers
+npm help 7 developers
.
.IP "\(bu" 4
npm help install
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "NPM\-REMOVAL" "1" "July 2014" "" ""
+.TH "NPM\-REMOVAL" "1" "September 2014" "" ""
.
.SH "NAME"
\fBnpm-removal\fR \-\- Cleaning the Slate
.\" Generated with Ronnjs 0.3.8
.\" http://github.com/kapouer/ronnjs/
.
-.TH "SEMVER" "7" "July 2014" "" ""
+.TH "SEMVER" "7" "September 2014" "" ""
.
.SH "NAME"
\fBsemver\fR \-\- The semantic versioner for npm
-lib-cov\r
-*.seed\r
-*.log\r
-*.csv\r
-*.dat\r
-*.out\r
-*.pid\r
-*.gz\r
-\r
-pids\r
-logs\r
-results\r
-\r
-npm-debug.log\r
-\r
-node_modules\r
+lib-cov
+*.seed
+*.log
+*.csv
+*.dat
+*.out
+*.pid
+*.gz
+
+pids
+logs
+results
+
+npm-debug.log
+
+node_modules
-language: node_js\r
-node_js:\r
- - "0.10"\r
+language: node_js
+node_js:
+ - "0.10"
- "0.8"
\ No newline at end of file
-Copyright (c) Isaac Z. Schlueter ("Author")\r
-All rights reserved.\r
-\r
-The BSD License\r
-\r
-Redistribution and use in source and binary forms, with or without\r
-modification, are permitted provided that the following conditions\r
-are met:\r
-\r
-1. Redistributions of source code must retain the above copyright\r
- notice, this list of conditions and the following disclaimer.\r
-\r
-2. Redistributions in binary form must reproduce the above copyright\r
- notice, this list of conditions and the following disclaimer in the\r
- documentation and/or other materials provided with the distribution.\r
-\r
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\r
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
-PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS\r
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\r
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\r
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+Copyright (c) Isaac Z. Schlueter ("Author")
+All rights reserved.
+
+The BSD License
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# cmd-shim\r
-\r
-The cmd-shim used in npm to create executable scripts on Windows,\r
-since symlinks are not suitable for this purpose there.\r
-\r
-On Unix systems, you should use a symbolic link instead.\r
-\r
-[![Build Status](https://img.shields.io/travis/ForbesLindesay/cmd-shim/master.svg)](https://travis-ci.org/ForbesLindesay/cmd-shim)\r
-[![Dependency Status](https://img.shields.io/gemnasium/ForbesLindesay/cmd-shim.svg)](https://gemnasium.com/ForbesLindesay/cmd-shim)\r
-[![NPM version](https://img.shields.io/npm/v/cmd-shim.svg)](http://badge.fury.io/js/cmd-shim)\r
-\r
-## Installation\r
-\r
-```\r
-npm install cmd-shim\r
-```\r
-\r
-## API\r
-\r
-### cmdShim(from, to, cb)\r
-\r
-Create a cmd shim at `to` for the command line program at `from`.\r
-e.g.\r
-\r
-```javascript\r
-var cmdShim = require('cmd-shim');\r
-cmdShim(__dirname + '/cli.js', '/usr/bin/command-name', function (err) {\r
- if (err) throw err;\r
-});\r
-```\r
-\r
-### cmdShim.ifExists(from, to, cb)\r
-\r
-The same as above, but will just continue if the file does not exist.\r
-Source:\r
-\r
-```javascript\r
-function cmdShimIfExists (from, to, cb) {\r
- fs.stat(from, function (er) {\r
- if (er) return cb()\r
- cmdShim(from, to, cb)\r
- })\r
-}\r
-```\r
+# cmd-shim
+
+The cmd-shim used in npm to create executable scripts on Windows,
+since symlinks are not suitable for this purpose there.
+
+On Unix systems, you should use a symbolic link instead.
+
+[![Build Status](https://img.shields.io/travis/ForbesLindesay/cmd-shim/master.svg)](https://travis-ci.org/ForbesLindesay/cmd-shim)
+[![Dependency Status](https://img.shields.io/gemnasium/ForbesLindesay/cmd-shim.svg)](https://gemnasium.com/ForbesLindesay/cmd-shim)
+[![NPM version](https://img.shields.io/npm/v/cmd-shim.svg)](http://badge.fury.io/js/cmd-shim)
+
+## Installation
+
+```
+npm install cmd-shim
+```
+
+## API
+
+### cmdShim(from, to, cb)
+
+Create a cmd shim at `to` for the command line program at `from`.
+e.g.
+
+```javascript
+var cmdShim = require('cmd-shim');
+cmdShim(__dirname + '/cli.js', '/usr/bin/command-name', function (err) {
+ if (err) throw err;
+});
+```
+
+### cmdShim.ifExists(from, to, cb)
+
+The same as above, but will just continue if the file does not exist.
+Source:
+
+```javascript
+function cmdShimIfExists (from, to, cb) {
+ fs.stat(from, function (er) {
+ if (er) return cb()
+ cmdShim(from, to, cb)
+ })
+}
+```
-// On windows, create a .cmd file.\r
-// Read the #! in the file to see what it uses. The vast majority\r
-// of the time, this will be either:\r
-// "#!/usr/bin/env <prog> <args...>"\r
-// or:\r
-// "#!<prog> <args...>"\r
-//\r
-// Write a binroot/pkg.bin + ".cmd" file that has this line in it:\r
-// @<prog> <args...> %~dp0<target> %*\r
-\r
-module.exports = cmdShim\r
-cmdShim.ifExists = cmdShimIfExists\r
-\r
-try {\r
- var fs = require("graceful-fs")\r
-} catch (e) {\r
- var fs = require("fs")\r
-}\r
-\r
-var mkdir = require("mkdirp")\r
- , path = require("path")\r
- , shebangExpr = /^#\!\s*(?:\/usr\/bin\/env)?\s*([^ \t]+)(.*)$/\r
-\r
-function cmdShimIfExists (from, to, cb) {\r
- fs.stat(from, function (er) {\r
- if (er) return cb()\r
- cmdShim(from, to, cb)\r
- })\r
-}\r
-\r
-// Try to unlink, but ignore errors.\r
-// Any problems will surface later.\r
-function rm (path, cb) {\r
- fs.unlink(path, function(er) {\r
- cb()\r
- })\r
-}\r
-\r
-function cmdShim (from, to, cb) {\r
- fs.stat(from, function (er, stat) {\r
- if (er)\r
- return cb(er)\r
-\r
- cmdShim_(from, to, cb)\r
- })\r
-}\r
-\r
-function cmdShim_ (from, to, cb) {\r
- var then = times(2, next, cb)\r
- rm(to, then)\r
- rm(to + ".cmd", then)\r
-\r
- function next(er) {\r
- writeShim(from, to, cb)\r
- }\r
-}\r
-\r
-function writeShim (from, to, cb) {\r
- // make a cmd file and a sh script\r
- // First, check if the bin is a #! of some sort.\r
- // If not, then assume it's something that'll be compiled, or some other\r
- // sort of script, and just call it directly.\r
- mkdir(path.dirname(to), function (er) {\r
- if (er)\r
- return cb(er)\r
- fs.readFile(from, "utf8", function (er, data) {\r
- if (er) return writeShim_(from, to, null, null, cb)\r
- var firstLine = data.trim().split(/\r*\n/)[0]\r
- , shebang = firstLine.match(shebangExpr)\r
- if (!shebang) return writeShim_(from, to, null, null, cb)\r
- var prog = shebang[1]\r
- , args = shebang[2] || ""\r
- return writeShim_(from, to, prog, args, cb)\r
- })\r
- })\r
-}\r
-\r
-function writeShim_ (from, to, prog, args, cb) {\r
- var shTarget = path.relative(path.dirname(to), from)\r
- , target = shTarget.split("/").join("\\")\r
- , longProg\r
- , shProg = prog && prog.split("\\").join("/")\r
- , shLongProg\r
- shTarget = shTarget.split("\\").join("/")\r
- args = args || ""\r
- if (!prog) {\r
- prog = "\"%~dp0\\" + target + "\""\r
- shProg = "\"$basedir/" + shTarget + "\""\r
- args = ""\r
- target = ""\r
- shTarget = ""\r
- } else {\r
- longProg = "\"%~dp0\\" + prog + ".exe\""\r
- shLongProg = "\"$basedir/" + prog + "\""\r
- target = "\"%~dp0\\" + target + "\""\r
- shTarget = "\"$basedir/" + shTarget + "\""\r
- }\r
-\r
- // @IF EXIST "%~dp0\node.exe" (\r
- // "%~dp0\node.exe" "%~dp0\.\node_modules\npm\bin\npm-cli.js" %*\r
- // ) ELSE (\r
- // SETLOCAL\r
- // SET PATHEXT=%PATHEXT:;.JS;=;%\r
- // node "%~dp0\.\node_modules\npm\bin\npm-cli.js" %*\r
- // )\r
- var cmd\r
- if (longProg) {\r
- cmd = "@IF EXIST " + longProg + " (\r\n"\r
- + " " + longProg + " " + args + " " + target + " %*\r\n"\r
- + ") ELSE (\r\n"\r
- + " @SETLOCAL\r\n"\r
- + " @SET PATHEXT=%PATHEXT:;.JS;=;%\r\n"\r
- + " " + prog + " " + args + " " + target + " %*\r\n"\r
- + ")"\r
- } else {\r
- cmd = prog + " " + args + " " + target + " %*\r\n"\r
- }\r
-\r
- // #!/bin/sh\r
- // basedir=`dirname "$0"`\r
- //\r
- // case `uname` in\r
- // *CYGWIN*) basedir=`cygpath -w "$basedir"`;;\r
- // esac\r
- //\r
- // if [ -x "$basedir/node.exe" ]; then\r
- // "$basedir/node.exe" "$basedir/node_modules/npm/bin/npm-cli.js" "$@"\r
- // ret=$?\r
- // else\r
- // node "$basedir/node_modules/npm/bin/npm-cli.js" "$@"\r
- // ret=$?\r
- // fi\r
- // exit $ret\r
-\r
- var sh = "#!/bin/sh\n"\r
-\r
- if (shLongProg) {\r
- sh = sh\r
- + "basedir=`dirname \"$0\"`\n"\r
- + "\n"\r
- + "case `uname` in\n"\r
- + " *CYGWIN*) basedir=`cygpath -w \"$basedir\"`;;\n"\r
- + "esac\n"\r
- + "\n"\r
-\r
- sh = sh\r
- + "if [ -x "+shLongProg+" ]; then\n"\r
- + " " + shLongProg + " " + args + " " + shTarget + " \"$@\"\n"\r
- + " ret=$?\n"\r
- + "else \n"\r
- + " " + shProg + " " + args + " " + shTarget + " \"$@\"\n"\r
- + " ret=$?\n"\r
- + "fi\n"\r
- + "exit $ret\n"\r
- } else {\r
- sh = shProg + " " + args + " " + shTarget + " \"$@\"\n"\r
- + "exit $?\n"\r
- }\r
-\r
- var then = times(2, next, cb)\r
- fs.writeFile(to + ".cmd", cmd, "utf8", then)\r
- fs.writeFile(to, sh, "utf8", then)\r
- function next () {\r
- chmodShim(to, cb)\r
- }\r
-}\r
-\r
-function chmodShim (to, cb) {\r
- var then = times(2, cb, cb)\r
- fs.chmod(to, 0755, then)\r
- fs.chmod(to + ".cmd", 0755, then)\r
-}\r
-\r
-function times(n, ok, cb) {\r
- var errState = null\r
- return function(er) {\r
- if (!errState) {\r
- if (er)\r
- cb(errState = er)\r
- else if (--n === 0)\r
- ok()\r
- }\r
- }\r
-}\r
+// On windows, create a .cmd file.
+// Read the #! in the file to see what it uses. The vast majority
+// of the time, this will be either:
+// "#!/usr/bin/env <prog> <args...>"
+// or:
+// "#!<prog> <args...>"
+//
+// Write a binroot/pkg.bin + ".cmd" file that has this line in it:
+// @<prog> <args...> %~dp0<target> %*
+
+module.exports = cmdShim
+cmdShim.ifExists = cmdShimIfExists
+
+try {
+ var fs = require("graceful-fs")
+} catch (e) {
+ var fs = require("fs")
+}
+
+var mkdir = require("mkdirp")
+ , path = require("path")
+ , shebangExpr = /^#\!\s*(?:\/usr\/bin\/env)?\s*([^ \t]+)(.*)$/
+
+function cmdShimIfExists (from, to, cb) {
+ fs.stat(from, function (er) {
+ if (er) return cb()
+ cmdShim(from, to, cb)
+ })
+}
+
+// Try to unlink, but ignore errors.
+// Any problems will surface later.
+function rm (path, cb) {
+ fs.unlink(path, function(er) {
+ cb()
+ })
+}
+
+function cmdShim (from, to, cb) {
+ fs.stat(from, function (er, stat) {
+ if (er)
+ return cb(er)
+
+ cmdShim_(from, to, cb)
+ })
+}
+
+function cmdShim_ (from, to, cb) {
+ var then = times(2, next, cb)
+ rm(to, then)
+ rm(to + ".cmd", then)
+
+ function next(er) {
+ writeShim(from, to, cb)
+ }
+}
+
+function writeShim (from, to, cb) {
+ // make a cmd file and a sh script
+ // First, check if the bin is a #! of some sort.
+ // If not, then assume it's something that'll be compiled, or some other
+ // sort of script, and just call it directly.
+ mkdir(path.dirname(to), function (er) {
+ if (er)
+ return cb(er)
+ fs.readFile(from, "utf8", function (er, data) {
+ if (er) return writeShim_(from, to, null, null, cb)
+ var firstLine = data.trim().split(/\r*\n/)[0]
+ , shebang = firstLine.match(shebangExpr)
+ if (!shebang) return writeShim_(from, to, null, null, cb)
+ var prog = shebang[1]
+ , args = shebang[2] || ""
+ return writeShim_(from, to, prog, args, cb)
+ })
+ })
+}
+
+function writeShim_ (from, to, prog, args, cb) {
+ var shTarget = path.relative(path.dirname(to), from)
+ , target = shTarget.split("/").join("\\")
+ , longProg
+ , shProg = prog && prog.split("\\").join("/")
+ , shLongProg
+ shTarget = shTarget.split("\\").join("/")
+ args = args || ""
+ if (!prog) {
+ prog = "\"%~dp0\\" + target + "\""
+ shProg = "\"$basedir/" + shTarget + "\""
+ args = ""
+ target = ""
+ shTarget = ""
+ } else {
+ longProg = "\"%~dp0\\" + prog + ".exe\""
+ shLongProg = "\"$basedir/" + prog + "\""
+ target = "\"%~dp0\\" + target + "\""
+ shTarget = "\"$basedir/" + shTarget + "\""
+ }
+
+ // @IF EXIST "%~dp0\node.exe" (
+ // "%~dp0\node.exe" "%~dp0\.\node_modules\npm\bin\npm-cli.js" %*
+ // ) ELSE (
+ // SETLOCAL
+ // SET PATHEXT=%PATHEXT:;.JS;=;%
+ // node "%~dp0\.\node_modules\npm\bin\npm-cli.js" %*
+ // )
+ var cmd
+ if (longProg) {
+ cmd = "@IF EXIST " + longProg + " (\r\n"
+ + " " + longProg + " " + args + " " + target + " %*\r\n"
+ + ") ELSE (\r\n"
+ + " @SETLOCAL\r\n"
+ + " @SET PATHEXT=%PATHEXT:;.JS;=;%\r\n"
+ + " " + prog + " " + args + " " + target + " %*\r\n"
+ + ")"
+ } else {
+ cmd = prog + " " + args + " " + target + " %*\r\n"
+ }
+
+ // #!/bin/sh
+ // basedir=`dirname "$0"`
+ //
+ // case `uname` in
+ // *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
+ // esac
+ //
+ // if [ -x "$basedir/node.exe" ]; then
+ // "$basedir/node.exe" "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
+ // ret=$?
+ // else
+ // node "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
+ // ret=$?
+ // fi
+ // exit $ret
+
+ var sh = "#!/bin/sh\n"
+
+ if (shLongProg) {
+ sh = sh
+ + "basedir=`dirname \"$0\"`\n"
+ + "\n"
+ + "case `uname` in\n"
+ + " *CYGWIN*) basedir=`cygpath -w \"$basedir\"`;;\n"
+ + "esac\n"
+ + "\n"
+
+ sh = sh
+ + "if [ -x "+shLongProg+" ]; then\n"
+ + " " + shLongProg + " " + args + " " + shTarget + " \"$@\"\n"
+ + " ret=$?\n"
+ + "else \n"
+ + " " + shProg + " " + args + " " + shTarget + " \"$@\"\n"
+ + " ret=$?\n"
+ + "fi\n"
+ + "exit $ret\n"
+ } else {
+ sh = shProg + " " + args + " " + shTarget + " \"$@\"\n"
+ + "exit $?\n"
+ }
+
+ var then = times(2, next, cb)
+ fs.writeFile(to + ".cmd", cmd, "utf8", then)
+ fs.writeFile(to, sh, "utf8", then)
+ function next () {
+ chmodShim(to, cb)
+ }
+}
+
+function chmodShim (to, cb) {
+ var then = times(2, cb, cb)
+ fs.chmod(to, 0755, then)
+ fs.chmod(to + ".cmd", 0755, then)
+}
+
+function times(n, ok, cb) {
+ var errState = null
+ return function(er) {
+ if (!errState) {
+ if (er)
+ cb(errState = er)
+ else if (--n === 0)
+ ok()
+ }
+ }
+}
{
"name": "cmd-shim",
- "version": "1.1.2",
+ "version": "2.0.0",
"description": "Used in npm for command line application support",
"scripts": {
"test": "tap test/*.js"
},
"license": "BSD",
"optionalDependencies": {
- "graceful-fs": "2"
+ "graceful-fs": "^3.0.2"
},
"dependencies": {
"mkdirp": "~0.5.0",
- "graceful-fs": "2"
+ "graceful-fs": "^3.0.2"
},
"devDependencies": {
"tap": "~0.4.11",
"rimraf": "~2.2.8"
},
+ "readme": "# cmd-shim\n\nThe cmd-shim used in npm to create executable scripts on Windows,\nsince symlinks are not suitable for this purpose there.\n\nOn Unix systems, you should use a symbolic link instead.\n\n[![Build Status](https://img.shields.io/travis/ForbesLindesay/cmd-shim/master.svg)](https://travis-ci.org/ForbesLindesay/cmd-shim)\n[![Dependency Status](https://img.shields.io/gemnasium/ForbesLindesay/cmd-shim.svg)](https://gemnasium.com/ForbesLindesay/cmd-shim)\n[![NPM version](https://img.shields.io/npm/v/cmd-shim.svg)](http://badge.fury.io/js/cmd-shim)\n\n## Installation\n\n```\nnpm install cmd-shim\n```\n\n## API\n\n### cmdShim(from, to, cb)\n\nCreate a cmd shim at `to` for the command line program at `from`.\ne.g.\n\n```javascript\nvar cmdShim = require('cmd-shim');\ncmdShim(__dirname + '/cli.js', '/usr/bin/command-name', function (err) {\n if (err) throw err;\n});\n```\n\n### cmdShim.ifExists(from, to, cb)\n\nThe same as above, but will just continue if the file does not exist.\nSource:\n\n```javascript\nfunction cmdShimIfExists (from, to, cb) {\n fs.stat(from, function (er) {\n if (er) return cb()\n cmdShim(from, to, cb)\n })\n}\n```\n",
+ "readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/ForbesLindesay/cmd-shim/issues"
},
"homepage": "https://github.com/ForbesLindesay/cmd-shim",
- "_id": "cmd-shim@1.1.2",
- "dist": {
- "shasum": "e4f9198802e361e8eb43b591959ef4dc6cdb6754",
- "tarball": "http://registry.npmjs.org/cmd-shim/-/cmd-shim-1.1.2.tgz"
- },
- "_from": "cmd-shim@~1.1.1",
- "_npmVersion": "1.4.3",
- "_npmUser": {
- "name": "forbeslindesay",
- "email": "forbes@lindeay.co.uk"
- },
- "maintainers": [
- {
- "name": "forbeslindesay",
- "email": "forbes@lindesay.co.uk"
- }
- ],
- "directories": {},
- "_shasum": "e4f9198802e361e8eb43b591959ef4dc6cdb6754",
- "_resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-1.1.2.tgz",
- "readme": "ERROR: No README data found!"
+ "_id": "cmd-shim@2.0.0",
+ "_shasum": "64fd5859110051571406f61821bf37d366bc3cb3",
+ "_resolved": "git://github.com/othiym23/cmd-shim#12de64ca97f45ac600910092f19afacc3d5376dd",
+ "_from": "git://github.com/othiym23/cmd-shim",
+ "_fromGithub": true
}
-var test = require('tap').test\r
-var mkdirp = require('mkdirp')\r
-var fs = require('fs')\r
-var path = require('path')\r
-var fixtures = path.resolve(__dirname, 'fixtures')\r
-\r
-var froms = {\r
- 'from.exe': 'exe',\r
- 'from.env': '#!/usr/bin/env node\nconsole.log(/hi/)\n',\r
- 'from.env.args': '#!/usr/bin/env node --expose_gc\ngc()\n',\r
- 'from.sh': '#!/usr/bin/sh\necho hi\n',\r
- 'from.sh.args': '#!/usr/bin/sh -x\necho hi\n'\r
-}\r
-\r
-var cmdShim = require('../')\r
-\r
-test('create fixture', function (t) {\r
- mkdirp(fixtures, function (er) {\r
- if (er)\r
- throw er\r
- t.pass('made dir')\r
- Object.keys(froms).forEach(function (f) {\r
- t.test('write ' + f, function (t) {\r
- fs.writeFile(path.resolve(fixtures, f), froms[f], function (er) {\r
- if (er)\r
- throw er\r
- t.pass('wrote ' + f)\r
- t.end()\r
- })\r
- })\r
- })\r
- t.end()\r
- })\r
-})\r
+var test = require('tap').test
+var mkdirp = require('mkdirp')
+var fs = require('fs')
+var path = require('path')
+var fixtures = path.resolve(__dirname, 'fixtures')
+
+var froms = {
+ 'from.exe': 'exe',
+ 'from.env': '#!/usr/bin/env node\nconsole.log(/hi/)\n',
+ 'from.env.args': '#!/usr/bin/env node --expose_gc\ngc()\n',
+ 'from.sh': '#!/usr/bin/sh\necho hi\n',
+ 'from.sh.args': '#!/usr/bin/sh -x\necho hi\n'
+}
+
+var cmdShim = require('../')
+
+test('create fixture', function (t) {
+ mkdirp(fixtures, function (er) {
+ if (er)
+ throw er
+ t.pass('made dir')
+ Object.keys(froms).forEach(function (f) {
+ t.test('write ' + f, function (t) {
+ fs.writeFile(path.resolve(fixtures, f), froms[f], function (er) {
+ if (er)
+ throw er
+ t.pass('wrote ' + f)
+ t.end()
+ })
+ })
+ })
+ t.end()
+ })
+})
-var test = require('tap').test\r
-var mkdirp = require('mkdirp')\r
-var fs = require('fs')\r
-var path = require('path')\r
-var fixtures = path.resolve(__dirname, 'fixtures')\r
-\r
-var cmdShim = require('../')\r
-\r
-test('no shebang', function (t) {\r
- var from = path.resolve(fixtures, 'from.exe')\r
- var to = path.resolve(fixtures, 'exe.shim')\r
- cmdShim(from, to, function(er) {\r
- if (er)\r
- throw er\r
- t.equal(fs.readFileSync(to, 'utf8'),\r
- "\"$basedir/from.exe\" \"$@\"\nexit $?\n")\r
- t.equal(fs.readFileSync(to + '.cmd', 'utf8'),\r
- "\"%~dp0\\from.exe\" %*\r\n")\r
- t.end()\r
- })\r
-})\r
-\r
-test('env shebang', function (t) {\r
- var from = path.resolve(fixtures, 'from.env')\r
- var to = path.resolve(fixtures, 'env.shim')\r
- cmdShim(from, to, function(er) {\r
- if (er)\r
- throw er\r
- console.error('%j', fs.readFileSync(to, 'utf8'))\r
- console.error('%j', fs.readFileSync(to + '.cmd', 'utf8'))\r
-\r
- t.equal(fs.readFileSync(to, 'utf8'),\r
- "#!/bin/sh"+\r
- "\nbasedir=`dirname \"$0\"`"+\r
- "\n"+\r
- "\ncase `uname` in"+\r
- "\n *CYGWIN*) basedir=`cygpath -w \"$basedir\"`;;"+\r
- "\nesac"+\r
- "\n"+\r
- "\nif [ -x \"$basedir/node\" ]; then"+\r
- "\n \"$basedir/node\" \"$basedir/from.env\" \"$@\""+\r
- "\n ret=$?"+\r
- "\nelse "+\r
- "\n node \"$basedir/from.env\" \"$@\""+\r
- "\n ret=$?"+\r
- "\nfi"+\r
- "\nexit $ret"+\r
- "\n")\r
- t.equal(fs.readFileSync(to + '.cmd', 'utf8'),\r
- "@IF EXIST \"%~dp0\\node.exe\" (\r"+\r
- "\n \"%~dp0\\node.exe\" \"%~dp0\\from.env\" %*\r"+\r
- "\n) ELSE (\r"+\r
- "\n @SETLOCAL\r"+\r
- "\n @SET PATHEXT=%PATHEXT:;.JS;=;%\r"+\r
- "\n node \"%~dp0\\from.env\" %*\r"+\r
- "\n)")\r
- t.end()\r
- })\r
-})\r
-\r
-test('env shebang with args', function (t) {\r
- var from = path.resolve(fixtures, 'from.env.args')\r
- var to = path.resolve(fixtures, 'env.args.shim')\r
- cmdShim(from, to, function(er) {\r
- if (er)\r
- throw er\r
- console.error('%j', fs.readFileSync(to, 'utf8'))\r
- console.error('%j', fs.readFileSync(to + '.cmd', 'utf8'))\r
-\r
- t.equal(fs.readFileSync(to, 'utf8'),\r
- "#!/bin/sh"+\r
- "\nbasedir=`dirname \"$0\"`"+\r
- "\n"+\r
- "\ncase `uname` in"+\r
- "\n *CYGWIN*) basedir=`cygpath -w \"$basedir\"`;;"+\r
- "\nesac"+\r
- "\n"+\r
- "\nif [ -x \"$basedir/node\" ]; then"+\r
- "\n \"$basedir/node\" --expose_gc \"$basedir/from.env.args\" \"$@\""+\r
- "\n ret=$?"+\r
- "\nelse "+\r
- "\n node --expose_gc \"$basedir/from.env.args\" \"$@\""+\r
- "\n ret=$?"+\r
- "\nfi"+\r
- "\nexit $ret"+\r
- "\n")\r
- t.equal(fs.readFileSync(to + '.cmd', 'utf8'),\r
- "@IF EXIST \"%~dp0\\node.exe\" (\r"+\r
- "\n \"%~dp0\\node.exe\" --expose_gc \"%~dp0\\from.env.args\" %*\r"+\r
- "\n) ELSE (\r"+\r
- "\n @SETLOCAL\r"+\r
- "\n @SET PATHEXT=%PATHEXT:;.JS;=;%\r"+\r
- "\n node --expose_gc \"%~dp0\\from.env.args\" %*\r"+\r
- "\n)")\r
- t.end()\r
- })\r
-})\r
-\r
-test('explicit shebang', function (t) {\r
- var from = path.resolve(fixtures, 'from.sh')\r
- var to = path.resolve(fixtures, 'sh.shim')\r
- cmdShim(from, to, function(er) {\r
- if (er)\r
- throw er\r
- console.error('%j', fs.readFileSync(to, 'utf8'))\r
- console.error('%j', fs.readFileSync(to + '.cmd', 'utf8'))\r
-\r
- t.equal(fs.readFileSync(to, 'utf8'),\r
- "#!/bin/sh" +\r
- "\nbasedir=`dirname \"$0\"`" +\r
- "\n" +\r
- "\ncase `uname` in" +\r
- "\n *CYGWIN*) basedir=`cygpath -w \"$basedir\"`;;" +\r
- "\nesac" +\r
- "\n" +\r
- "\nif [ -x \"$basedir//usr/bin/sh\" ]; then" +\r
- "\n \"$basedir//usr/bin/sh\" \"$basedir/from.sh\" \"$@\"" +\r
- "\n ret=$?" +\r
- "\nelse " +\r
- "\n /usr/bin/sh \"$basedir/from.sh\" \"$@\"" +\r
- "\n ret=$?" +\r
- "\nfi" +\r
- "\nexit $ret" +\r
- "\n")\r
-\r
- t.equal(fs.readFileSync(to + '.cmd', 'utf8'),\r
- "@IF EXIST \"%~dp0\\/usr/bin/sh.exe\" (\r" +\r
- "\n \"%~dp0\\/usr/bin/sh.exe\" \"%~dp0\\from.sh\" %*\r" +\r
- "\n) ELSE (\r" +\r
- "\n @SETLOCAL\r"+\r
- "\n @SET PATHEXT=%PATHEXT:;.JS;=;%\r"+\r
- "\n /usr/bin/sh \"%~dp0\\from.sh\" %*\r" +\r
- "\n)")\r
- t.end()\r
- })\r
-})\r
-\r
-test('explicit shebang with args', function (t) {\r
- var from = path.resolve(fixtures, 'from.sh.args')\r
- var to = path.resolve(fixtures, 'sh.args.shim')\r
- cmdShim(from, to, function(er) {\r
- if (er)\r
- throw er\r
- console.error('%j', fs.readFileSync(to, 'utf8'))\r
- console.error('%j', fs.readFileSync(to + '.cmd', 'utf8'))\r
-\r
- t.equal(fs.readFileSync(to, 'utf8'),\r
- "#!/bin/sh" +\r
- "\nbasedir=`dirname \"$0\"`" +\r
- "\n" +\r
- "\ncase `uname` in" +\r
- "\n *CYGWIN*) basedir=`cygpath -w \"$basedir\"`;;" +\r
- "\nesac" +\r
- "\n" +\r
- "\nif [ -x \"$basedir//usr/bin/sh\" ]; then" +\r
- "\n \"$basedir//usr/bin/sh\" -x \"$basedir/from.sh.args\" \"$@\"" +\r
- "\n ret=$?" +\r
- "\nelse " +\r
- "\n /usr/bin/sh -x \"$basedir/from.sh.args\" \"$@\"" +\r
- "\n ret=$?" +\r
- "\nfi" +\r
- "\nexit $ret" +\r
- "\n")\r
-\r
- t.equal(fs.readFileSync(to + '.cmd', 'utf8'),\r
- "@IF EXIST \"%~dp0\\/usr/bin/sh.exe\" (\r" +\r
- "\n \"%~dp0\\/usr/bin/sh.exe\" -x \"%~dp0\\from.sh.args\" %*\r" +\r
- "\n) ELSE (\r" +\r
- "\n @SETLOCAL\r"+\r
- "\n @SET PATHEXT=%PATHEXT:;.JS;=;%\r"+\r
- "\n /usr/bin/sh -x \"%~dp0\\from.sh.args\" %*\r" +\r
- "\n)")\r
- t.end()\r
- })\r
-})\r
+var test = require('tap').test
+var mkdirp = require('mkdirp')
+var fs = require('fs')
+var path = require('path')
+var fixtures = path.resolve(__dirname, 'fixtures')
+
+var cmdShim = require('../')
+
+test('no shebang', function (t) {
+ var from = path.resolve(fixtures, 'from.exe')
+ var to = path.resolve(fixtures, 'exe.shim')
+ cmdShim(from, to, function(er) {
+ if (er)
+ throw er
+ t.equal(fs.readFileSync(to, 'utf8'),
+ "\"$basedir/from.exe\" \"$@\"\nexit $?\n")
+ t.equal(fs.readFileSync(to + '.cmd', 'utf8'),
+ "\"%~dp0\\from.exe\" %*\r\n")
+ t.end()
+ })
+})
+
+test('env shebang', function (t) {
+ var from = path.resolve(fixtures, 'from.env')
+ var to = path.resolve(fixtures, 'env.shim')
+ cmdShim(from, to, function(er) {
+ if (er)
+ throw er
+ console.error('%j', fs.readFileSync(to, 'utf8'))
+ console.error('%j', fs.readFileSync(to + '.cmd', 'utf8'))
+
+ t.equal(fs.readFileSync(to, 'utf8'),
+ "#!/bin/sh"+
+ "\nbasedir=`dirname \"$0\"`"+
+ "\n"+
+ "\ncase `uname` in"+
+ "\n *CYGWIN*) basedir=`cygpath -w \"$basedir\"`;;"+
+ "\nesac"+
+ "\n"+
+ "\nif [ -x \"$basedir/node\" ]; then"+
+ "\n \"$basedir/node\" \"$basedir/from.env\" \"$@\""+
+ "\n ret=$?"+
+ "\nelse "+
+ "\n node \"$basedir/from.env\" \"$@\""+
+ "\n ret=$?"+
+ "\nfi"+
+ "\nexit $ret"+
+ "\n")
+ t.equal(fs.readFileSync(to + '.cmd', 'utf8'),
+ "@IF EXIST \"%~dp0\\node.exe\" (\r"+
+ "\n \"%~dp0\\node.exe\" \"%~dp0\\from.env\" %*\r"+
+ "\n) ELSE (\r"+
+ "\n @SETLOCAL\r"+
+ "\n @SET PATHEXT=%PATHEXT:;.JS;=;%\r"+
+ "\n node \"%~dp0\\from.env\" %*\r"+
+ "\n)")
+ t.end()
+ })
+})
+
+test('env shebang with args', function (t) {
+ var from = path.resolve(fixtures, 'from.env.args')
+ var to = path.resolve(fixtures, 'env.args.shim')
+ cmdShim(from, to, function(er) {
+ if (er)
+ throw er
+ console.error('%j', fs.readFileSync(to, 'utf8'))
+ console.error('%j', fs.readFileSync(to + '.cmd', 'utf8'))
+
+ t.equal(fs.readFileSync(to, 'utf8'),
+ "#!/bin/sh"+
+ "\nbasedir=`dirname \"$0\"`"+
+ "\n"+
+ "\ncase `uname` in"+
+ "\n *CYGWIN*) basedir=`cygpath -w \"$basedir\"`;;"+
+ "\nesac"+
+ "\n"+
+ "\nif [ -x \"$basedir/node\" ]; then"+
+ "\n \"$basedir/node\" --expose_gc \"$basedir/from.env.args\" \"$@\""+
+ "\n ret=$?"+
+ "\nelse "+
+ "\n node --expose_gc \"$basedir/from.env.args\" \"$@\""+
+ "\n ret=$?"+
+ "\nfi"+
+ "\nexit $ret"+
+ "\n")
+ t.equal(fs.readFileSync(to + '.cmd', 'utf8'),
+ "@IF EXIST \"%~dp0\\node.exe\" (\r"+
+ "\n \"%~dp0\\node.exe\" --expose_gc \"%~dp0\\from.env.args\" %*\r"+
+ "\n) ELSE (\r"+
+ "\n @SETLOCAL\r"+
+ "\n @SET PATHEXT=%PATHEXT:;.JS;=;%\r"+
+ "\n node --expose_gc \"%~dp0\\from.env.args\" %*\r"+
+ "\n)")
+ t.end()
+ })
+})
+
+test('explicit shebang', function (t) {
+ var from = path.resolve(fixtures, 'from.sh')
+ var to = path.resolve(fixtures, 'sh.shim')
+ cmdShim(from, to, function(er) {
+ if (er)
+ throw er
+ console.error('%j', fs.readFileSync(to, 'utf8'))
+ console.error('%j', fs.readFileSync(to + '.cmd', 'utf8'))
+
+ t.equal(fs.readFileSync(to, 'utf8'),
+ "#!/bin/sh" +
+ "\nbasedir=`dirname \"$0\"`" +
+ "\n" +
+ "\ncase `uname` in" +
+ "\n *CYGWIN*) basedir=`cygpath -w \"$basedir\"`;;" +
+ "\nesac" +
+ "\n" +
+ "\nif [ -x \"$basedir//usr/bin/sh\" ]; then" +
+ "\n \"$basedir//usr/bin/sh\" \"$basedir/from.sh\" \"$@\"" +
+ "\n ret=$?" +
+ "\nelse " +
+ "\n /usr/bin/sh \"$basedir/from.sh\" \"$@\"" +
+ "\n ret=$?" +
+ "\nfi" +
+ "\nexit $ret" +
+ "\n")
+
+ t.equal(fs.readFileSync(to + '.cmd', 'utf8'),
+ "@IF EXIST \"%~dp0\\/usr/bin/sh.exe\" (\r" +
+ "\n \"%~dp0\\/usr/bin/sh.exe\" \"%~dp0\\from.sh\" %*\r" +
+ "\n) ELSE (\r" +
+ "\n @SETLOCAL\r"+
+ "\n @SET PATHEXT=%PATHEXT:;.JS;=;%\r"+
+ "\n /usr/bin/sh \"%~dp0\\from.sh\" %*\r" +
+ "\n)")
+ t.end()
+ })
+})
+
+test('explicit shebang with args', function (t) {
+ var from = path.resolve(fixtures, 'from.sh.args')
+ var to = path.resolve(fixtures, 'sh.args.shim')
+ cmdShim(from, to, function(er) {
+ if (er)
+ throw er
+ console.error('%j', fs.readFileSync(to, 'utf8'))
+ console.error('%j', fs.readFileSync(to + '.cmd', 'utf8'))
+
+ t.equal(fs.readFileSync(to, 'utf8'),
+ "#!/bin/sh" +
+ "\nbasedir=`dirname \"$0\"`" +
+ "\n" +
+ "\ncase `uname` in" +
+ "\n *CYGWIN*) basedir=`cygpath -w \"$basedir\"`;;" +
+ "\nesac" +
+ "\n" +
+ "\nif [ -x \"$basedir//usr/bin/sh\" ]; then" +
+ "\n \"$basedir//usr/bin/sh\" -x \"$basedir/from.sh.args\" \"$@\"" +
+ "\n ret=$?" +
+ "\nelse " +
+ "\n /usr/bin/sh -x \"$basedir/from.sh.args\" \"$@\"" +
+ "\n ret=$?" +
+ "\nfi" +
+ "\nexit $ret" +
+ "\n")
+
+ t.equal(fs.readFileSync(to + '.cmd', 'utf8'),
+ "@IF EXIST \"%~dp0\\/usr/bin/sh.exe\" (\r" +
+ "\n \"%~dp0\\/usr/bin/sh.exe\" -x \"%~dp0\\from.sh.args\" %*\r" +
+ "\n) ELSE (\r" +
+ "\n @SETLOCAL\r"+
+ "\n @SET PATHEXT=%PATHEXT:;.JS;=;%\r"+
+ "\n /usr/bin/sh -x \"%~dp0\\from.sh.args\" %*\r" +
+ "\n)")
+ t.end()
+ })
+})
-var test = require('tap').test\r
-var path = require('path')\r
-var fixtures = path.resolve(__dirname, 'fixtures')\r
-var rimraf = require('rimraf')\r
-\r
-test('cleanup', function(t) {\r
- rimraf(fixtures, function(er) {\r
- if (er)\r
- throw er\r
- t.pass('cleaned up')\r
- t.end()\r
- })\r
-})\r
+var test = require('tap').test
+var path = require('path')
+var fixtures = path.resolve(__dirname, 'fixtures')
+var rimraf = require('rimraf')
+
+test('cleanup', function(t) {
+ rimraf(fixtures, function(er) {
+ if (er)
+ throw er
+ t.pass('cleaned up')
+ t.end()
+ })
+})
## Other Configuration Options
-### Align Right
+### Align Right/Center
```js
var data = {
debug@0.8.1 1
```
+Align Center works in a similar way.
+
+
+### Padding
+
+```js
+var data = {
+ "shortKey": "veryVeryVeryVeryVeryLongVal",
+ "veryVeryVeryVeryVeryLongKey": "shortVal"
+}
+
+columnify(data, { paddingChr: '.'})
+```
+
+#### Output:
+```
+KEY........................ VALUE......................
+shortKey................... veryVeryVeryVeryVeryLongVal
+veryVeryVeryVeryVeryLongKey shortVal...................
+```
+
### Preserve existing newlines
By default, `columnify` sanitises text by replacing any occurance of 1 or more whitespace characters with a single space.
## License
MIT
-
-
var wcwidth = require('./width')
var utils = require('./utils')
var padRight = utils.padRight
+var padCenter = utils.padCenter
var padLeft = utils.padLeft
var splitIntoLines = utils.splitIntoLines
var splitLongWords = utils.splitLongWords
truncate: false,
truncateMarker: '…',
preserveNewLines: false,
+ paddingChr: ' ',
+ showHeaders: true,
headingTransform: function(key) {
return key.toUpperCase()
},
options.spacing = options.spacing || '\n' // probably useless
options.preserveNewLines = !!options.preserveNewLines
+ options.showHeaders = !!options.showHeaders;
options.columns = options.columns || options.include // alias include/columns, prefer columns if supplied
var columnNames = options.columns || [] // optional user-supplied columns to include
// add headers
var headers = {}
- columnNames.forEach(function(columnName) {
- var column = columns[columnName]
- headers[columnName] = column.headingTransform(columnName)
- })
- items.unshift(headers)
-
+ if(options.showHeaders) {
+ columnNames.forEach(function(columnName) {
+ var column = columns[columnName]
+ headers[columnName] = column.headingTransform(columnName)
+ })
+ items.unshift(headers)
+ }
// get actual max-width between min & max
// based on length of data in columns
columnNames.forEach(function(columnName) {
})
- var rows = createRows(items, columns, columnNames) // merge lines into rows
+ var rows = createRows(items, columns, columnNames, options.paddingChr) // merge lines into rows
// conceive output
return rows.reduce(function(output, row) {
return output.concat(row.reduce(function(rowOut, line) {
* @return Array items wrapped in arrays, corresponding to lines
*/
-function createRows(items, columns, columnNames) {
+function createRows(items, columns, columnNames, paddingChr) {
return items.map(function(item) {
var row = []
var numLines = 0
columnNames.forEach(function(columnName) {
var column = columns[columnName]
var val = item[columnName][i] || '' // || '' ensures empty columns get padded
- if (column.align == 'right') row[i].push(padLeft(val, column.width))
- else row[i].push(padRight(val, column.width))
+ if (column.align == 'right') row[i].push(padLeft(val, column.width, paddingChr))
+ else if (column.align == 'center') row[i].push(padCenter(val, column.width, paddingChr))
+ else row[i].push(padRight(val, column.width, paddingChr))
})
}
return row
'use strict';
-var ansiRegex = require('ansi-regex');
+var ansiRegex = require('ansi-regex')();
module.exports = function (str) {
return typeof str === 'string' ? str.replace(ansiRegex, '') : str;
'use strict';
-module.exports = /\x1B\[([0-9]{1,3}(;[0-9]{1,3})*)?[m|K]/g;
+module.exports = function () {
+ return /\u001b\[(?:[0-9]{1,3}(?:;[0-9]{1,3})*)?[m|K]/g;
+};
{
"name": "ansi-regex",
- "version": "0.1.0",
+ "version": "0.2.1",
"description": "Regular expression for matching ANSI escape codes",
"license": "MIT",
"repository": {
"text",
"regex",
"regexp",
- "re"
+ "re",
+ "match",
+ "test",
+ "find",
+ "pattern"
],
"devDependencies": {
"mocha": "*"
"url": "https://github.com/sindresorhus/ansi-regex/issues"
},
"homepage": "https://github.com/sindresorhus/ansi-regex",
- "_id": "ansi-regex@0.1.0",
- "_shasum": "55ca60db6900857c423ae9297980026f941ed903",
- "_from": "ansi-regex@^0.1.0",
+ "_id": "ansi-regex@0.2.1",
+ "_shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9",
+ "_from": "ansi-regex@^0.2.1",
"_npmVersion": "1.4.9",
"_npmUser": {
"name": "sindresorhus",
}
],
"dist": {
- "shasum": "55ca60db6900857c423ae9297980026f941ed903",
- "tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-0.1.0.tgz"
+ "shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9",
+ "tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz"
},
"directories": {},
- "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.1.0.tgz",
+ "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz",
"readme": "ERROR: No README data found!"
}
```js
var ansiRegex = require('ansi-regex');
-ansiRegex.test('\x1b[4mcake\x1b[0m');
+ansiRegex().test('\u001b[4mcake\u001b[0m');
//=> true
-ansiRegex.test('cake');
+ansiRegex().test('cake');
//=> false
+
+'\u001b[4mcake\u001b[0m'.match(ansiRegex());
+//=> ['\u001b[4m', '\u001b[0m']
```
+*It's a function so you can create multiple instances. Regexes with the global flag will have the `.lastIndex` property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for `.test()`.*
+
## License
{
"name": "strip-ansi",
- "version": "0.2.2",
+ "version": "1.0.0",
"description": "Strip ANSI escape codes",
"license": "MIT",
"bin": {
"text"
],
"dependencies": {
- "ansi-regex": "^0.1.0"
+ "ansi-regex": "^0.2.1"
},
"devDependencies": {
"mocha": "*"
},
+ "gitHead": "6fea2ef935f1ba10d43e4c4d9814af328803935c",
"bugs": {
"url": "https://github.com/sindresorhus/strip-ansi/issues"
},
"homepage": "https://github.com/sindresorhus/strip-ansi",
- "_id": "strip-ansi@0.2.2",
- "_shasum": "854d290c981525fc8c397a910b025ae2d54ffc08",
- "_from": "strip-ansi@^0.2.1",
- "_npmVersion": "1.4.9",
+ "_id": "strip-ansi@1.0.0",
+ "_shasum": "6c021321d6ece161a3c608fbab268c7328901c73",
+ "_from": "strip-ansi@^1.0.0",
+ "_npmVersion": "1.4.14",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
+ },
+ {
+ "name": "jbnicolai",
+ "email": "jappelman@xebia.com"
}
],
"dist": {
- "shasum": "854d290c981525fc8c397a910b025ae2d54ffc08",
- "tarball": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-0.2.2.tgz"
+ "shasum": "6c021321d6ece161a3c608fbab268c7328901c73",
+ "tarball": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-1.0.0.tgz"
},
"directories": {},
- "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.2.2.tgz",
+ "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-1.0.0.tgz",
"readme": "ERROR: No README data found!"
}
+++ /dev/null
-How To Build and Install wcwidth.js
-===================================
-
-This package does not provide an automated way to build or install the library
-except using [`npm`](http://npmjs.org/package/wcwidth.js) because wcwidth.js is
-intended to runs on top of [`node.js`](http://nodejs.org) that is a javascript
-interpreter. If you have `node.js` installed,
-
- npm install wcwidth.js
-
-brings the latest version of `wcwidth.js` and installs it with its all
-depending packages.
+++ /dev/null
-What's New in wcwidth.js?
-=========================
-
-2014-04-26 0.0.4 released.
-2012-12-13 0.0.3 released.
-2012-12-12 Moved the repository to git/github.
-2012-10-16 0.0.2 released.
-2012-10-16 Using `wcwidth' without invoking it checked.
-2012-10-12 First release.
+++ /dev/null
-wcwidth.js: A JavaScript Porting of Markus Kuhn's wcwidth() Implementation
-==========================================================================
-
-`wcwidth.js` is a simple JavaScript porting of `wcwidth()` implemented in C
-[by Markus Kuhn](http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c).
-
-`wcwidth()` and its string version, `wcswidth()` are defined by IEEE Std
-1002.1-2001, a.k.a. POSIX.1-2001, and return the number of columns used to
-represent the given wide character and string. Markus's implementation assumes
-the wide character given to those functions to be encoded in ISO 10646, which
-is almost true for JavaScript's characters.
-
-For convenience, `wcwidth.js` sets the getter of the property named `wcwidth`
-for the string type. You don't need to invoke a function to get the width of
-strings, but inspecting the `wcwidth` property is enough. The following code
-snippet shows how to use `wcwidth.js`:
-
- var wcwidth = require('wcwidth')({
- nul: 0,
- control: -1,
- monkeypatch: true
- }); // equivalent to var wcwidth = require('wcwidth')();
-
- console.log("한글".wcwidth); // prints 4
- console.log("\0".wcwidth); // prints 0
- console.log("\t".wcwidth); // prints -1
-
-The argument `{ nul: 0, control: -1, monkeypatch: true }` (which are the
-default values, in fact) tells `wcwidth.js` to return 0 for the NUL character
-and -1 for non-printable control characters. Setting a negative value to `nul`
-or `control` makes the `wcwidth` property set to -1 for any string that
-contains NUL or control characters respectively. If you plan to replace each
-control character with, say, `???` when printing, you can 'require'
-`wcwidth.js` as follows:
-
- var wcwidth = require('wcwidth')({
- control: 3
- }); // leaving nul as 0
-
- console.log("\t".wcwidth); // prints 3
- console.log("\0".wcwidth); // prints 0
-
-The last option `monkeypatch` allows `wcwidth.js` to monkey-patch
-`String.prototype` to provide the getter `wcwidth`. Even if it is convenient to
-have a getter that looks like the native one, it is sometimes unwanted as
-adding a getter into `String.prototype` may break node.js's module system; you
-are not guaranteed to have the version your code `require`s through the getter
-if other modules you're using also depend on other versions of `wcwidth.js`
-(thanks to [timoxley](https://github.com/timoxley) for the information). By
-setting `monkeypatch` to `false`, `wcwidth.js` touches no global object and
-provides no getter but a callable method explained below.
-
-`wcwidth.js` also provides a method. Since JavaScript has no character type,
-it is meaningless to have two versions while POSIX does for C. The method also
-accepts a code value that can be obtained by the `charCodeAt()` method.
-
- console.log(wcwidth('한')); // prints 2
- console.log(wcwidth('글'.charCodeAt(0)); // prints 2
- console.log(wcwidth('한글')); // prints 4
-
-`INSTALL.md` explains how to build and install the library. For the copyright
-issues, see the accompanying `LICENSE.md` file.
-
-If you have a question or suggestion, do not hesitate to contact me via email
-(woong.jun at gmail.com) or web (http://code.woong.org/).
+++ /dev/null
- __
- /\ \ __
- __ __ ___ \_\ \ __ _ __ ____ ___ ___ _ __ __ /\_\ ____
- /\ \/\ \ /' _ `\ /'_ \ /'__`\/\ __\/ ,__\ / ___\ / __`\/\ __\/'__`\ \/\ \ /',__\
- \ \ \_\ \/\ \/\ \/\ \ \ \/\ __/\ \ \//\__, `\/\ \__//\ \ \ \ \ \//\ __/ __ \ \ \/\__, `\
- \ \____/\ \_\ \_\ \___,_\ \____\\ \_\\/\____/\ \____\ \____/\ \_\\ \____\/\_\ _\ \ \/\____/
- \/___/ \/_/\/_/\/__,_ /\/____/ \/_/ \/___/ \/____/\/___/ \/_/ \/____/\/_//\ \_\ \/___/
- \ \____/
- \/___/
-
-Underscore.js is a utility-belt library for JavaScript that provides
-support for the usual functional suspects (each, map, reduce, filter...)
-without extending any core JavaScript objects.
-
-For Docs, License, Tests, and pre-packed downloads, see:
-http://underscorejs.org
-
-Underscore is an open-sourced component of DocumentCloud:
-https://github.com/documentcloud
-
-Many thanks to our contributors:
-https://github.com/jashkenas/underscore/contributors
+++ /dev/null
-{
- "name": "underscore",
- "description": "JavaScript's functional programming helper library.",
- "homepage": "http://underscorejs.org",
- "keywords": [
- "util",
- "functional",
- "server",
- "client",
- "browser"
- ],
- "author": {
- "name": "Jeremy Ashkenas",
- "email": "jeremy@documentcloud.org"
- },
- "repository": {
- "type": "git",
- "url": "git://github.com/jashkenas/underscore.git"
- },
- "main": "underscore.js",
- "version": "1.6.0",
- "devDependencies": {
- "docco": "0.6.x",
- "phantomjs": "1.9.0-1",
- "uglify-js": "2.4.x"
- },
- "scripts": {
- "test": "phantomjs test/vendor/runner.js test/index.html?noglobals=true",
- "build": "uglifyjs underscore.js -c \"evaluate=false\" --comments \"/ .*/\" -m --source-map underscore-min.map -o underscore-min.js",
- "doc": "docco underscore.js"
- },
- "licenses": [
- {
- "type": "MIT",
- "url": "https://raw.github.com/jashkenas/underscore/master/LICENSE"
- }
- ],
- "files": [
- "underscore.js",
- "underscore-min.js",
- "LICENSE"
- ],
- "bugs": {
- "url": "https://github.com/jashkenas/underscore/issues"
- },
- "_id": "underscore@1.6.0",
- "dist": {
- "shasum": "8b38b10cacdef63337b8b24e4ff86d45aea529a8",
- "tarball": "http://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz"
- },
- "_from": "underscore@>= 1.3.0",
- "_npmVersion": "1.3.21",
- "_npmUser": {
- "name": "jashkenas",
- "email": "jashkenas@gmail.com"
- },
- "maintainers": [
- {
- "name": "jashkenas",
- "email": "jashkenas@gmail.com"
- }
- ],
- "directories": {},
- "_shasum": "8b38b10cacdef63337b8b24e4ff86d45aea529a8",
- "_resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz",
- "readme": "ERROR: No README data found!"
-}
+++ /dev/null
-// Underscore.js 1.6.0
-// http://underscorejs.org
-// (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
-// Underscore may be freely distributed under the MIT license.
-(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,w=Object.keys,_=i.bind,j=function(n){return n instanceof j?n:this instanceof j?void(this._wrapped=n):new j(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.6.0";var A=j.each=j.forEach=function(n,t,e){if(null==n)return n;if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return;return n};j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var O="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(O);return r},j.reduceRight=j.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(O);return r},j.find=j.detect=function(n,t,r){var e;return k(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},j.filter=j.select=function(n,t,r){var e=[];return null==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){return j.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);var u=!0;return null==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var k=j.some=j.any=function(n,t,e){t||(t=j.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};j.contains=j.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:k(n,function(n){return n===t})},j.invoke=function(n,t){var r=o.call(arguments,2),e=j.isFunction(t);return j.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){return j.map(n,j.property(t))},j.where=function(n,t){return j.filter(n,j.matches(t))},j.findWhere=function(n,t){return j.find(n,j.matches(t))},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);var e=-1/0,u=-1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;o>u&&(e=n,u=o)}),e},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);var e=1/0,u=1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;u>o&&(e=n,u=o)}),e},j.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=j.random(r++),e[r-1]=e[t],e[t]=n}),e},j.sample=function(n,t,r){return null==t||r?(n.length!==+n.length&&(n=j.values(n)),n[j.random(n.length-1)]):j.shuffle(n).slice(0,Math.max(0,t))};var E=function(n){return null==n?j.identity:j.isFunction(n)?n:j.property(n)};j.sortBy=function(n,t,r){return t=E(t),j.pluck(j.map(n,function(n,e,u){return{value:n,index:e,criteria:t.call(r,n,e,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={};return r=E(r),A(t,function(i,a){var o=r.call(e,i,a,t);n(u,o,i)}),u}};j.groupBy=F(function(n,t,r){j.has(n,t)?n[t].push(r):n[t]=[r]}),j.indexBy=F(function(n,t,r){n[t]=r}),j.countBy=F(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,r,e){r=E(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;r.call(e,n[o])<u?i=o+1:a=o}return i},j.toArray=function(n){return n?j.isArray(n)?o.call(n):n.length===+n.length?j.map(n,j.identity):j.values(n):[]},j.size=function(n){return null==n?0:n.length===+n.length?n.length:j.keys(n).length},j.first=j.head=j.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:0>t?[]:o.call(n,0,t)},j.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},j.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},j.rest=j.tail=j.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},j.compact=function(n){return j.filter(n,j.identity)};var M=function(n,t,r){return t&&j.every(n,j.isArray)?c.apply(r,n):(A(n,function(n){j.isArray(n)||j.isArguments(n)?t?a.apply(r,n):M(n,t,r):r.push(n)}),r)};j.flatten=function(n,t){return M(n,t,[])},j.without=function(n){return j.difference(n,o.call(arguments,1))},j.partition=function(n,t){var r=[],e=[];return A(n,function(n){(t(n)?r:e).push(n)}),[r,e]},j.uniq=j.unique=function(n,t,r,e){j.isFunction(t)&&(e=r,r=t,t=!1);var u=r?j.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:j.contains(a,r))||(a.push(r),i.push(n[e]))}),i},j.union=function(){return j.uniq(j.flatten(arguments,!0))},j.intersection=function(n){var t=o.call(arguments,1);return j.filter(j.uniq(n),function(n){return j.every(t,function(t){return j.contains(t,n)})})},j.difference=function(n){var t=c.apply(e,o.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){for(var n=j.max(j.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;n>r;r++)t[r]=j.pluck(arguments,""+r);return t},j.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},j.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=j.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},j.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},j.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=new Array(e);e>u;)i[u++]=n,n+=r;return i};var R=function(){};j.bind=function(n,t){var r,e;if(_&&n.bind===_)return _.apply(n,o.call(arguments,1));if(!j.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));R.prototype=n.prototype;var u=new R;R.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},j.partial=function(n){var t=o.call(arguments,1);return function(){for(var r=0,e=t.slice(),u=0,i=e.length;i>u;u++)e[u]===j&&(e[u]=arguments[r++]);for(;r<arguments.length;)e.push(arguments[r++]);return n.apply(this,e)}},j.bindAll=function(n){var t=o.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return A(t,function(t){n[t]=j.bind(n[t],n)}),n},j.memoize=function(n,t){var r={};return t||(t=j.identity),function(){var e=t.apply(this,arguments);return j.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},j.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},j.defer=function(n){return j.delay.apply(j,[n,1].concat(o.call(arguments,1)))},j.throttle=function(n,t,r){var e,u,i,a=null,o=0;r||(r={});var c=function(){o=r.leading===!1?0:j.now(),a=null,i=n.apply(e,u),e=u=null};return function(){var l=j.now();o||r.leading!==!1||(o=l);var f=t-(l-o);return e=this,u=arguments,0>=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u),e=u=null):a||r.trailing===!1||(a=setTimeout(c,f)),i}},j.debounce=function(n,t,r){var e,u,i,a,o,c=function(){var l=j.now()-a;t>l?e=setTimeout(c,t-l):(e=null,r||(o=n.apply(i,u),i=u=null))};return function(){i=this,u=arguments,a=j.now();var l=r&&!e;return e||(e=setTimeout(c,t)),l&&(o=n.apply(i,u),i=u=null),o}},j.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){return j.partial(t,n)},j.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},j.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},j.keys=function(n){if(!j.isObject(n))return[];if(w)return w(n);var t=[];for(var r in n)j.has(n,r)&&t.push(r);return t},j.values=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},j.pairs=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},j.invert=function(n){for(var t={},r=j.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},j.functions=j.methods=function(n){var t=[];for(var r in n)j.isFunction(n[r])&&t.push(r);return t.sort()},j.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},j.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},j.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)j.contains(r,u)||(t[u]=n[u]);return t},j.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){return t(n),n};var S=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;var a=n.constructor,o=t.constructor;if(a!==o&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(o)&&o instanceof o)&&"constructor"in n&&"constructor"in t)return!1;r.push(n),e.push(t);var c=0,f=!0;if("[object Array]"==u){if(c=n.length,f=c==t.length)for(;c--&&(f=S(n[c],t[c],r,e)););}else{for(var s in n)if(j.has(n,s)&&(c++,!(f=j.has(t,s)&&S(n[s],t[s],r,e))))break;if(f){for(s in t)if(j.has(t,s)&&!c--)break;f=!c}}return r.pop(),e.pop(),f};j.isEqual=function(n,t){return S(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==l.call(n)},j.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){return j.isNumber(n)&&n!=+n},j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},j.isNull=function(n){return null===n},j.isUndefined=function(n){return n===void 0},j.has=function(n,t){return f.call(n,t)},j.noConflict=function(){return n._=t,this},j.identity=function(n){return n},j.constant=function(n){return function(){return n}},j.property=function(n){return function(t){return t[n]}},j.matches=function(n){return function(t){if(t===n)return!0;for(var r in n)if(n[r]!==t[r])return!1;return!0}},j.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},j.now=Date.now||function(){return(new Date).getTime()};var T={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};T.unescape=j.invert(T.escape);var I={escape:new RegExp("["+j.keys(T.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(T.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(I[n],function(t){return T[n][t]})}}),j.result=function(n,t){if(null==n)return void 0;var r=n[t];return j.isFunction(r)?r.call(n):r},j.mixin=function(n){A(j.functions(n),function(t){var r=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),z.call(this,r.apply(j,n))}})};var N=0;j.uniqueId=function(n){var t=++N+"";return n?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,r){var e;r=j.defaults({},r,j.templateSettings);var u=new RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(D,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,j);var c=function(n){return e.call(this,n,j)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){return j(n).chain()};var z=function(n){return this._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];j.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],z.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];j.prototype[n]=function(){return z.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return j})}).call(this);
-//# sourceMappingURL=underscore-min.map
\ No newline at end of file
+++ /dev/null
-// Underscore.js 1.6.0
-// http://underscorejs.org
-// (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
-// Underscore may be freely distributed under the MIT license.
-
-(function() {
-
- // Baseline setup
- // --------------
-
- // Establish the root object, `window` in the browser, or `exports` on the server.
- var root = this;
-
- // Save the previous value of the `_` variable.
- var previousUnderscore = root._;
-
- // Establish the object that gets returned to break out of a loop iteration.
- var breaker = {};
-
- // Save bytes in the minified (but not gzipped) version:
- var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
-
- // Create quick reference variables for speed access to core prototypes.
- var
- push = ArrayProto.push,
- slice = ArrayProto.slice,
- concat = ArrayProto.concat,
- toString = ObjProto.toString,
- hasOwnProperty = ObjProto.hasOwnProperty;
-
- // All **ECMAScript 5** native function implementations that we hope to use
- // are declared here.
- var
- nativeForEach = ArrayProto.forEach,
- nativeMap = ArrayProto.map,
- nativeReduce = ArrayProto.reduce,
- nativeReduceRight = ArrayProto.reduceRight,
- nativeFilter = ArrayProto.filter,
- nativeEvery = ArrayProto.every,
- nativeSome = ArrayProto.some,
- nativeIndexOf = ArrayProto.indexOf,
- nativeLastIndexOf = ArrayProto.lastIndexOf,
- nativeIsArray = Array.isArray,
- nativeKeys = Object.keys,
- nativeBind = FuncProto.bind;
-
- // Create a safe reference to the Underscore object for use below.
- var _ = function(obj) {
- if (obj instanceof _) return obj;
- if (!(this instanceof _)) return new _(obj);
- this._wrapped = obj;
- };
-
- // Export the Underscore object for **Node.js**, with
- // backwards-compatibility for the old `require()` API. If we're in
- // the browser, add `_` as a global object via a string identifier,
- // for Closure Compiler "advanced" mode.
- if (typeof exports !== 'undefined') {
- if (typeof module !== 'undefined' && module.exports) {
- exports = module.exports = _;
- }
- exports._ = _;
- } else {
- root._ = _;
- }
-
- // Current version.
- _.VERSION = '1.6.0';
-
- // Collection Functions
- // --------------------
-
- // The cornerstone, an `each` implementation, aka `forEach`.
- // Handles objects with the built-in `forEach`, arrays, and raw objects.
- // Delegates to **ECMAScript 5**'s native `forEach` if available.
- var each = _.each = _.forEach = function(obj, iterator, context) {
- if (obj == null) return obj;
- if (nativeForEach && obj.forEach === nativeForEach) {
- obj.forEach(iterator, context);
- } else if (obj.length === +obj.length) {
- for (var i = 0, length = obj.length; i < length; i++) {
- if (iterator.call(context, obj[i], i, obj) === breaker) return;
- }
- } else {
- var keys = _.keys(obj);
- for (var i = 0, length = keys.length; i < length; i++) {
- if (iterator.call(context, obj[keys[i]], keys[i], obj) === breaker) return;
- }
- }
- return obj;
- };
-
- // Return the results of applying the iterator to each element.
- // Delegates to **ECMAScript 5**'s native `map` if available.
- _.map = _.collect = function(obj, iterator, context) {
- var results = [];
- if (obj == null) return results;
- if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
- each(obj, function(value, index, list) {
- results.push(iterator.call(context, value, index, list));
- });
- return results;
- };
-
- var reduceError = 'Reduce of empty array with no initial value';
-
- // **Reduce** builds up a single result from a list of values, aka `inject`,
- // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
- _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
- var initial = arguments.length > 2;
- if (obj == null) obj = [];
- if (nativeReduce && obj.reduce === nativeReduce) {
- if (context) iterator = _.bind(iterator, context);
- return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
- }
- each(obj, function(value, index, list) {
- if (!initial) {
- memo = value;
- initial = true;
- } else {
- memo = iterator.call(context, memo, value, index, list);
- }
- });
- if (!initial) throw new TypeError(reduceError);
- return memo;
- };
-
- // The right-associative version of reduce, also known as `foldr`.
- // Delegates to **ECMAScript 5**'s native `reduceRight` if available.
- _.reduceRight = _.foldr = function(obj, iterator, memo, context) {
- var initial = arguments.length > 2;
- if (obj == null) obj = [];
- if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
- if (context) iterator = _.bind(iterator, context);
- return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
- }
- var length = obj.length;
- if (length !== +length) {
- var keys = _.keys(obj);
- length = keys.length;
- }
- each(obj, function(value, index, list) {
- index = keys ? keys[--length] : --length;
- if (!initial) {
- memo = obj[index];
- initial = true;
- } else {
- memo = iterator.call(context, memo, obj[index], index, list);
- }
- });
- if (!initial) throw new TypeError(reduceError);
- return memo;
- };
-
- // Return the first value which passes a truth test. Aliased as `detect`.
- _.find = _.detect = function(obj, predicate, context) {
- var result;
- any(obj, function(value, index, list) {
- if (predicate.call(context, value, index, list)) {
- result = value;
- return true;
- }
- });
- return result;
- };
-
- // Return all the elements that pass a truth test.
- // Delegates to **ECMAScript 5**'s native `filter` if available.
- // Aliased as `select`.
- _.filter = _.select = function(obj, predicate, context) {
- var results = [];
- if (obj == null) return results;
- if (nativeFilter && obj.filter === nativeFilter) return obj.filter(predicate, context);
- each(obj, function(value, index, list) {
- if (predicate.call(context, value, index, list)) results.push(value);
- });
- return results;
- };
-
- // Return all the elements for which a truth test fails.
- _.reject = function(obj, predicate, context) {
- return _.filter(obj, function(value, index, list) {
- return !predicate.call(context, value, index, list);
- }, context);
- };
-
- // Determine whether all of the elements match a truth test.
- // Delegates to **ECMAScript 5**'s native `every` if available.
- // Aliased as `all`.
- _.every = _.all = function(obj, predicate, context) {
- predicate || (predicate = _.identity);
- var result = true;
- if (obj == null) return result;
- if (nativeEvery && obj.every === nativeEvery) return obj.every(predicate, context);
- each(obj, function(value, index, list) {
- if (!(result = result && predicate.call(context, value, index, list))) return breaker;
- });
- return !!result;
- };
-
- // Determine if at least one element in the object matches a truth test.
- // Delegates to **ECMAScript 5**'s native `some` if available.
- // Aliased as `any`.
- var any = _.some = _.any = function(obj, predicate, context) {
- predicate || (predicate = _.identity);
- var result = false;
- if (obj == null) return result;
- if (nativeSome && obj.some === nativeSome) return obj.some(predicate, context);
- each(obj, function(value, index, list) {
- if (result || (result = predicate.call(context, value, index, list))) return breaker;
- });
- return !!result;
- };
-
- // Determine if the array or object contains a given value (using `===`).
- // Aliased as `include`.
- _.contains = _.include = function(obj, target) {
- if (obj == null) return false;
- if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
- return any(obj, function(value) {
- return value === target;
- });
- };
-
- // Invoke a method (with arguments) on every item in a collection.
- _.invoke = function(obj, method) {
- var args = slice.call(arguments, 2);
- var isFunc = _.isFunction(method);
- return _.map(obj, function(value) {
- return (isFunc ? method : value[method]).apply(value, args);
- });
- };
-
- // Convenience version of a common use case of `map`: fetching a property.
- _.pluck = function(obj, key) {
- return _.map(obj, _.property(key));
- };
-
- // Convenience version of a common use case of `filter`: selecting only objects
- // containing specific `key:value` pairs.
- _.where = function(obj, attrs) {
- return _.filter(obj, _.matches(attrs));
- };
-
- // Convenience version of a common use case of `find`: getting the first object
- // containing specific `key:value` pairs.
- _.findWhere = function(obj, attrs) {
- return _.find(obj, _.matches(attrs));
- };
-
- // Return the maximum element or (element-based computation).
- // Can't optimize arrays of integers longer than 65,535 elements.
- // See [WebKit Bug 80797](https://bugs.webkit.org/show_bug.cgi?id=80797)
- _.max = function(obj, iterator, context) {
- if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
- return Math.max.apply(Math, obj);
- }
- var result = -Infinity, lastComputed = -Infinity;
- each(obj, function(value, index, list) {
- var computed = iterator ? iterator.call(context, value, index, list) : value;
- if (computed > lastComputed) {
- result = value;
- lastComputed = computed;
- }
- });
- return result;
- };
-
- // Return the minimum element (or element-based computation).
- _.min = function(obj, iterator, context) {
- if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
- return Math.min.apply(Math, obj);
- }
- var result = Infinity, lastComputed = Infinity;
- each(obj, function(value, index, list) {
- var computed = iterator ? iterator.call(context, value, index, list) : value;
- if (computed < lastComputed) {
- result = value;
- lastComputed = computed;
- }
- });
- return result;
- };
-
- // Shuffle an array, using the modern version of the
- // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
- _.shuffle = function(obj) {
- var rand;
- var index = 0;
- var shuffled = [];
- each(obj, function(value) {
- rand = _.random(index++);
- shuffled[index - 1] = shuffled[rand];
- shuffled[rand] = value;
- });
- return shuffled;
- };
-
- // Sample **n** random values from a collection.
- // If **n** is not specified, returns a single random element.
- // The internal `guard` argument allows it to work with `map`.
- _.sample = function(obj, n, guard) {
- if (n == null || guard) {
- if (obj.length !== +obj.length) obj = _.values(obj);
- return obj[_.random(obj.length - 1)];
- }
- return _.shuffle(obj).slice(0, Math.max(0, n));
- };
-
- // An internal function to generate lookup iterators.
- var lookupIterator = function(value) {
- if (value == null) return _.identity;
- if (_.isFunction(value)) return value;
- return _.property(value);
- };
-
- // Sort the object's values by a criterion produced by an iterator.
- _.sortBy = function(obj, iterator, context) {
- iterator = lookupIterator(iterator);
- return _.pluck(_.map(obj, function(value, index, list) {
- return {
- value: value,
- index: index,
- criteria: iterator.call(context, value, index, list)
- };
- }).sort(function(left, right) {
- var a = left.criteria;
- var b = right.criteria;
- if (a !== b) {
- if (a > b || a === void 0) return 1;
- if (a < b || b === void 0) return -1;
- }
- return left.index - right.index;
- }), 'value');
- };
-
- // An internal function used for aggregate "group by" operations.
- var group = function(behavior) {
- return function(obj, iterator, context) {
- var result = {};
- iterator = lookupIterator(iterator);
- each(obj, function(value, index) {
- var key = iterator.call(context, value, index, obj);
- behavior(result, key, value);
- });
- return result;
- };
- };
-
- // Groups the object's values by a criterion. Pass either a string attribute
- // to group by, or a function that returns the criterion.
- _.groupBy = group(function(result, key, value) {
- _.has(result, key) ? result[key].push(value) : result[key] = [value];
- });
-
- // Indexes the object's values by a criterion, similar to `groupBy`, but for
- // when you know that your index values will be unique.
- _.indexBy = group(function(result, key, value) {
- result[key] = value;
- });
-
- // Counts instances of an object that group by a certain criterion. Pass
- // either a string attribute to count by, or a function that returns the
- // criterion.
- _.countBy = group(function(result, key) {
- _.has(result, key) ? result[key]++ : result[key] = 1;
- });
-
- // Use a comparator function to figure out the smallest index at which
- // an object should be inserted so as to maintain order. Uses binary search.
- _.sortedIndex = function(array, obj, iterator, context) {
- iterator = lookupIterator(iterator);
- var value = iterator.call(context, obj);
- var low = 0, high = array.length;
- while (low < high) {
- var mid = (low + high) >>> 1;
- iterator.call(context, array[mid]) < value ? low = mid + 1 : high = mid;
- }
- return low;
- };
-
- // Safely create a real, live array from anything iterable.
- _.toArray = function(obj) {
- if (!obj) return [];
- if (_.isArray(obj)) return slice.call(obj);
- if (obj.length === +obj.length) return _.map(obj, _.identity);
- return _.values(obj);
- };
-
- // Return the number of elements in an object.
- _.size = function(obj) {
- if (obj == null) return 0;
- return (obj.length === +obj.length) ? obj.length : _.keys(obj).length;
- };
-
- // Array Functions
- // ---------------
-
- // Get the first element of an array. Passing **n** will return the first N
- // values in the array. Aliased as `head` and `take`. The **guard** check
- // allows it to work with `_.map`.
- _.first = _.head = _.take = function(array, n, guard) {
- if (array == null) return void 0;
- if ((n == null) || guard) return array[0];
- if (n < 0) return [];
- return slice.call(array, 0, n);
- };
-
- // Returns everything but the last entry of the array. Especially useful on
- // the arguments object. Passing **n** will return all the values in
- // the array, excluding the last N. The **guard** check allows it to work with
- // `_.map`.
- _.initial = function(array, n, guard) {
- return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n));
- };
-
- // Get the last element of an array. Passing **n** will return the last N
- // values in the array. The **guard** check allows it to work with `_.map`.
- _.last = function(array, n, guard) {
- if (array == null) return void 0;
- if ((n == null) || guard) return array[array.length - 1];
- return slice.call(array, Math.max(array.length - n, 0));
- };
-
- // Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
- // Especially useful on the arguments object. Passing an **n** will return
- // the rest N values in the array. The **guard**
- // check allows it to work with `_.map`.
- _.rest = _.tail = _.drop = function(array, n, guard) {
- return slice.call(array, (n == null) || guard ? 1 : n);
- };
-
- // Trim out all falsy values from an array.
- _.compact = function(array) {
- return _.filter(array, _.identity);
- };
-
- // Internal implementation of a recursive `flatten` function.
- var flatten = function(input, shallow, output) {
- if (shallow && _.every(input, _.isArray)) {
- return concat.apply(output, input);
- }
- each(input, function(value) {
- if (_.isArray(value) || _.isArguments(value)) {
- shallow ? push.apply(output, value) : flatten(value, shallow, output);
- } else {
- output.push(value);
- }
- });
- return output;
- };
-
- // Flatten out an array, either recursively (by default), or just one level.
- _.flatten = function(array, shallow) {
- return flatten(array, shallow, []);
- };
-
- // Return a version of the array that does not contain the specified value(s).
- _.without = function(array) {
- return _.difference(array, slice.call(arguments, 1));
- };
-
- // Split an array into two arrays: one whose elements all satisfy the given
- // predicate, and one whose elements all do not satisfy the predicate.
- _.partition = function(array, predicate) {
- var pass = [], fail = [];
- each(array, function(elem) {
- (predicate(elem) ? pass : fail).push(elem);
- });
- return [pass, fail];
- };
-
- // Produce a duplicate-free version of the array. If the array has already
- // been sorted, you have the option of using a faster algorithm.
- // Aliased as `unique`.
- _.uniq = _.unique = function(array, isSorted, iterator, context) {
- if (_.isFunction(isSorted)) {
- context = iterator;
- iterator = isSorted;
- isSorted = false;
- }
- var initial = iterator ? _.map(array, iterator, context) : array;
- var results = [];
- var seen = [];
- each(initial, function(value, index) {
- if (isSorted ? (!index || seen[seen.length - 1] !== value) : !_.contains(seen, value)) {
- seen.push(value);
- results.push(array[index]);
- }
- });
- return results;
- };
-
- // Produce an array that contains the union: each distinct element from all of
- // the passed-in arrays.
- _.union = function() {
- return _.uniq(_.flatten(arguments, true));
- };
-
- // Produce an array that contains every item shared between all the
- // passed-in arrays.
- _.intersection = function(array) {
- var rest = slice.call(arguments, 1);
- return _.filter(_.uniq(array), function(item) {
- return _.every(rest, function(other) {
- return _.contains(other, item);
- });
- });
- };
-
- // Take the difference between one array and a number of other arrays.
- // Only the elements present in just the first array will remain.
- _.difference = function(array) {
- var rest = concat.apply(ArrayProto, slice.call(arguments, 1));
- return _.filter(array, function(value){ return !_.contains(rest, value); });
- };
-
- // Zip together multiple lists into a single array -- elements that share
- // an index go together.
- _.zip = function() {
- var length = _.max(_.pluck(arguments, 'length').concat(0));
- var results = new Array(length);
- for (var i = 0; i < length; i++) {
- results[i] = _.pluck(arguments, '' + i);
- }
- return results;
- };
-
- // Converts lists into objects. Pass either a single array of `[key, value]`
- // pairs, or two parallel arrays of the same length -- one of keys, and one of
- // the corresponding values.
- _.object = function(list, values) {
- if (list == null) return {};
- var result = {};
- for (var i = 0, length = list.length; i < length; i++) {
- if (values) {
- result[list[i]] = values[i];
- } else {
- result[list[i][0]] = list[i][1];
- }
- }
- return result;
- };
-
- // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
- // we need this function. Return the position of the first occurrence of an
- // item in an array, or -1 if the item is not included in the array.
- // Delegates to **ECMAScript 5**'s native `indexOf` if available.
- // If the array is large and already in sort order, pass `true`
- // for **isSorted** to use binary search.
- _.indexOf = function(array, item, isSorted) {
- if (array == null) return -1;
- var i = 0, length = array.length;
- if (isSorted) {
- if (typeof isSorted == 'number') {
- i = (isSorted < 0 ? Math.max(0, length + isSorted) : isSorted);
- } else {
- i = _.sortedIndex(array, item);
- return array[i] === item ? i : -1;
- }
- }
- if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted);
- for (; i < length; i++) if (array[i] === item) return i;
- return -1;
- };
-
- // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
- _.lastIndexOf = function(array, item, from) {
- if (array == null) return -1;
- var hasIndex = from != null;
- if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) {
- return hasIndex ? array.lastIndexOf(item, from) : array.lastIndexOf(item);
- }
- var i = (hasIndex ? from : array.length);
- while (i--) if (array[i] === item) return i;
- return -1;
- };
-
- // Generate an integer Array containing an arithmetic progression. A port of
- // the native Python `range()` function. See
- // [the Python documentation](http://docs.python.org/library/functions.html#range).
- _.range = function(start, stop, step) {
- if (arguments.length <= 1) {
- stop = start || 0;
- start = 0;
- }
- step = arguments[2] || 1;
-
- var length = Math.max(Math.ceil((stop - start) / step), 0);
- var idx = 0;
- var range = new Array(length);
-
- while(idx < length) {
- range[idx++] = start;
- start += step;
- }
-
- return range;
- };
-
- // Function (ahem) Functions
- // ------------------
-
- // Reusable constructor function for prototype setting.
- var ctor = function(){};
-
- // Create a function bound to a given object (assigning `this`, and arguments,
- // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
- // available.
- _.bind = function(func, context) {
- var args, bound;
- if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
- if (!_.isFunction(func)) throw new TypeError;
- args = slice.call(arguments, 2);
- return bound = function() {
- if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
- ctor.prototype = func.prototype;
- var self = new ctor;
- ctor.prototype = null;
- var result = func.apply(self, args.concat(slice.call(arguments)));
- if (Object(result) === result) return result;
- return self;
- };
- };
-
- // Partially apply a function by creating a version that has had some of its
- // arguments pre-filled, without changing its dynamic `this` context. _ acts
- // as a placeholder, allowing any combination of arguments to be pre-filled.
- _.partial = function(func) {
- var boundArgs = slice.call(arguments, 1);
- return function() {
- var position = 0;
- var args = boundArgs.slice();
- for (var i = 0, length = args.length; i < length; i++) {
- if (args[i] === _) args[i] = arguments[position++];
- }
- while (position < arguments.length) args.push(arguments[position++]);
- return func.apply(this, args);
- };
- };
-
- // Bind a number of an object's methods to that object. Remaining arguments
- // are the method names to be bound. Useful for ensuring that all callbacks
- // defined on an object belong to it.
- _.bindAll = function(obj) {
- var funcs = slice.call(arguments, 1);
- if (funcs.length === 0) throw new Error('bindAll must be passed function names');
- each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
- return obj;
- };
-
- // Memoize an expensive function by storing its results.
- _.memoize = function(func, hasher) {
- var memo = {};
- hasher || (hasher = _.identity);
- return function() {
- var key = hasher.apply(this, arguments);
- return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
- };
- };
-
- // Delays a function for the given number of milliseconds, and then calls
- // it with the arguments supplied.
- _.delay = function(func, wait) {
- var args = slice.call(arguments, 2);
- return setTimeout(function(){ return func.apply(null, args); }, wait);
- };
-
- // Defers a function, scheduling it to run after the current call stack has
- // cleared.
- _.defer = function(func) {
- return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
- };
-
- // Returns a function, that, when invoked, will only be triggered at most once
- // during a given window of time. Normally, the throttled function will run
- // as much as it can, without ever going more than once per `wait` duration;
- // but if you'd like to disable the execution on the leading edge, pass
- // `{leading: false}`. To disable execution on the trailing edge, ditto.
- _.throttle = function(func, wait, options) {
- var context, args, result;
- var timeout = null;
- var previous = 0;
- options || (options = {});
- var later = function() {
- previous = options.leading === false ? 0 : _.now();
- timeout = null;
- result = func.apply(context, args);
- context = args = null;
- };
- return function() {
- var now = _.now();
- if (!previous && options.leading === false) previous = now;
- var remaining = wait - (now - previous);
- context = this;
- args = arguments;
- if (remaining <= 0) {
- clearTimeout(timeout);
- timeout = null;
- previous = now;
- result = func.apply(context, args);
- context = args = null;
- } else if (!timeout && options.trailing !== false) {
- timeout = setTimeout(later, remaining);
- }
- return result;
- };
- };
-
- // Returns a function, that, as long as it continues to be invoked, will not
- // be triggered. The function will be called after it stops being called for
- // N milliseconds. If `immediate` is passed, trigger the function on the
- // leading edge, instead of the trailing.
- _.debounce = function(func, wait, immediate) {
- var timeout, args, context, timestamp, result;
-
- var later = function() {
- var last = _.now() - timestamp;
- if (last < wait) {
- timeout = setTimeout(later, wait - last);
- } else {
- timeout = null;
- if (!immediate) {
- result = func.apply(context, args);
- context = args = null;
- }
- }
- };
-
- return function() {
- context = this;
- args = arguments;
- timestamp = _.now();
- var callNow = immediate && !timeout;
- if (!timeout) {
- timeout = setTimeout(later, wait);
- }
- if (callNow) {
- result = func.apply(context, args);
- context = args = null;
- }
-
- return result;
- };
- };
-
- // Returns a function that will be executed at most one time, no matter how
- // often you call it. Useful for lazy initialization.
- _.once = function(func) {
- var ran = false, memo;
- return function() {
- if (ran) return memo;
- ran = true;
- memo = func.apply(this, arguments);
- func = null;
- return memo;
- };
- };
-
- // Returns the first function passed as an argument to the second,
- // allowing you to adjust arguments, run code before and after, and
- // conditionally execute the original function.
- _.wrap = function(func, wrapper) {
- return _.partial(wrapper, func);
- };
-
- // Returns a function that is the composition of a list of functions, each
- // consuming the return value of the function that follows.
- _.compose = function() {
- var funcs = arguments;
- return function() {
- var args = arguments;
- for (var i = funcs.length - 1; i >= 0; i--) {
- args = [funcs[i].apply(this, args)];
- }
- return args[0];
- };
- };
-
- // Returns a function that will only be executed after being called N times.
- _.after = function(times, func) {
- return function() {
- if (--times < 1) {
- return func.apply(this, arguments);
- }
- };
- };
-
- // Object Functions
- // ----------------
-
- // Retrieve the names of an object's properties.
- // Delegates to **ECMAScript 5**'s native `Object.keys`
- _.keys = function(obj) {
- if (!_.isObject(obj)) return [];
- if (nativeKeys) return nativeKeys(obj);
- var keys = [];
- for (var key in obj) if (_.has(obj, key)) keys.push(key);
- return keys;
- };
-
- // Retrieve the values of an object's properties.
- _.values = function(obj) {
- var keys = _.keys(obj);
- var length = keys.length;
- var values = new Array(length);
- for (var i = 0; i < length; i++) {
- values[i] = obj[keys[i]];
- }
- return values;
- };
-
- // Convert an object into a list of `[key, value]` pairs.
- _.pairs = function(obj) {
- var keys = _.keys(obj);
- var length = keys.length;
- var pairs = new Array(length);
- for (var i = 0; i < length; i++) {
- pairs[i] = [keys[i], obj[keys[i]]];
- }
- return pairs;
- };
-
- // Invert the keys and values of an object. The values must be serializable.
- _.invert = function(obj) {
- var result = {};
- var keys = _.keys(obj);
- for (var i = 0, length = keys.length; i < length; i++) {
- result[obj[keys[i]]] = keys[i];
- }
- return result;
- };
-
- // Return a sorted list of the function names available on the object.
- // Aliased as `methods`
- _.functions = _.methods = function(obj) {
- var names = [];
- for (var key in obj) {
- if (_.isFunction(obj[key])) names.push(key);
- }
- return names.sort();
- };
-
- // Extend a given object with all the properties in passed-in object(s).
- _.extend = function(obj) {
- each(slice.call(arguments, 1), function(source) {
- if (source) {
- for (var prop in source) {
- obj[prop] = source[prop];
- }
- }
- });
- return obj;
- };
-
- // Return a copy of the object only containing the whitelisted properties.
- _.pick = function(obj) {
- var copy = {};
- var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
- each(keys, function(key) {
- if (key in obj) copy[key] = obj[key];
- });
- return copy;
- };
-
- // Return a copy of the object without the blacklisted properties.
- _.omit = function(obj) {
- var copy = {};
- var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
- for (var key in obj) {
- if (!_.contains(keys, key)) copy[key] = obj[key];
- }
- return copy;
- };
-
- // Fill in a given object with default properties.
- _.defaults = function(obj) {
- each(slice.call(arguments, 1), function(source) {
- if (source) {
- for (var prop in source) {
- if (obj[prop] === void 0) obj[prop] = source[prop];
- }
- }
- });
- return obj;
- };
-
- // Create a (shallow-cloned) duplicate of an object.
- _.clone = function(obj) {
- if (!_.isObject(obj)) return obj;
- return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
- };
-
- // Invokes interceptor with the obj, and then returns obj.
- // The primary purpose of this method is to "tap into" a method chain, in
- // order to perform operations on intermediate results within the chain.
- _.tap = function(obj, interceptor) {
- interceptor(obj);
- return obj;
- };
-
- // Internal recursive comparison function for `isEqual`.
- var eq = function(a, b, aStack, bStack) {
- // Identical objects are equal. `0 === -0`, but they aren't identical.
- // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
- if (a === b) return a !== 0 || 1 / a == 1 / b;
- // A strict comparison is necessary because `null == undefined`.
- if (a == null || b == null) return a === b;
- // Unwrap any wrapped objects.
- if (a instanceof _) a = a._wrapped;
- if (b instanceof _) b = b._wrapped;
- // Compare `[[Class]]` names.
- var className = toString.call(a);
- if (className != toString.call(b)) return false;
- switch (className) {
- // Strings, numbers, dates, and booleans are compared by value.
- case '[object String]':
- // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
- // equivalent to `new String("5")`.
- return a == String(b);
- case '[object Number]':
- // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
- // other numeric values.
- return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
- case '[object Date]':
- case '[object Boolean]':
- // Coerce dates and booleans to numeric primitive values. Dates are compared by their
- // millisecond representations. Note that invalid dates with millisecond representations
- // of `NaN` are not equivalent.
- return +a == +b;
- // RegExps are compared by their source patterns and flags.
- case '[object RegExp]':
- return a.source == b.source &&
- a.global == b.global &&
- a.multiline == b.multiline &&
- a.ignoreCase == b.ignoreCase;
- }
- if (typeof a != 'object' || typeof b != 'object') return false;
- // Assume equality for cyclic structures. The algorithm for detecting cyclic
- // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
- var length = aStack.length;
- while (length--) {
- // Linear search. Performance is inversely proportional to the number of
- // unique nested structures.
- if (aStack[length] == a) return bStack[length] == b;
- }
- // Objects with different constructors are not equivalent, but `Object`s
- // from different frames are.
- var aCtor = a.constructor, bCtor = b.constructor;
- if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
- _.isFunction(bCtor) && (bCtor instanceof bCtor))
- && ('constructor' in a && 'constructor' in b)) {
- return false;
- }
- // Add the first object to the stack of traversed objects.
- aStack.push(a);
- bStack.push(b);
- var size = 0, result = true;
- // Recursively compare objects and arrays.
- if (className == '[object Array]') {
- // Compare array lengths to determine if a deep comparison is necessary.
- size = a.length;
- result = size == b.length;
- if (result) {
- // Deep compare the contents, ignoring non-numeric properties.
- while (size--) {
- if (!(result = eq(a[size], b[size], aStack, bStack))) break;
- }
- }
- } else {
- // Deep compare objects.
- for (var key in a) {
- if (_.has(a, key)) {
- // Count the expected number of properties.
- size++;
- // Deep compare each member.
- if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break;
- }
- }
- // Ensure that both objects contain the same number of properties.
- if (result) {
- for (key in b) {
- if (_.has(b, key) && !(size--)) break;
- }
- result = !size;
- }
- }
- // Remove the first object from the stack of traversed objects.
- aStack.pop();
- bStack.pop();
- return result;
- };
-
- // Perform a deep comparison to check if two objects are equal.
- _.isEqual = function(a, b) {
- return eq(a, b, [], []);
- };
-
- // Is a given array, string, or object empty?
- // An "empty" object has no enumerable own-properties.
- _.isEmpty = function(obj) {
- if (obj == null) return true;
- if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
- for (var key in obj) if (_.has(obj, key)) return false;
- return true;
- };
-
- // Is a given value a DOM element?
- _.isElement = function(obj) {
- return !!(obj && obj.nodeType === 1);
- };
-
- // Is a given value an array?
- // Delegates to ECMA5's native Array.isArray
- _.isArray = nativeIsArray || function(obj) {
- return toString.call(obj) == '[object Array]';
- };
-
- // Is a given variable an object?
- _.isObject = function(obj) {
- return obj === Object(obj);
- };
-
- // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp.
- each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) {
- _['is' + name] = function(obj) {
- return toString.call(obj) == '[object ' + name + ']';
- };
- });
-
- // Define a fallback version of the method in browsers (ahem, IE), where
- // there isn't any inspectable "Arguments" type.
- if (!_.isArguments(arguments)) {
- _.isArguments = function(obj) {
- return !!(obj && _.has(obj, 'callee'));
- };
- }
-
- // Optimize `isFunction` if appropriate.
- if (typeof (/./) !== 'function') {
- _.isFunction = function(obj) {
- return typeof obj === 'function';
- };
- }
-
- // Is a given object a finite number?
- _.isFinite = function(obj) {
- return isFinite(obj) && !isNaN(parseFloat(obj));
- };
-
- // Is the given value `NaN`? (NaN is the only number which does not equal itself).
- _.isNaN = function(obj) {
- return _.isNumber(obj) && obj != +obj;
- };
-
- // Is a given value a boolean?
- _.isBoolean = function(obj) {
- return obj === true || obj === false || toString.call(obj) == '[object Boolean]';
- };
-
- // Is a given value equal to null?
- _.isNull = function(obj) {
- return obj === null;
- };
-
- // Is a given variable undefined?
- _.isUndefined = function(obj) {
- return obj === void 0;
- };
-
- // Shortcut function for checking if an object has a given property directly
- // on itself (in other words, not on a prototype).
- _.has = function(obj, key) {
- return hasOwnProperty.call(obj, key);
- };
-
- // Utility Functions
- // -----------------
-
- // Run Underscore.js in *noConflict* mode, returning the `_` variable to its
- // previous owner. Returns a reference to the Underscore object.
- _.noConflict = function() {
- root._ = previousUnderscore;
- return this;
- };
-
- // Keep the identity function around for default iterators.
- _.identity = function(value) {
- return value;
- };
-
- _.constant = function(value) {
- return function () {
- return value;
- };
- };
-
- _.property = function(key) {
- return function(obj) {
- return obj[key];
- };
- };
-
- // Returns a predicate for checking whether an object has a given set of `key:value` pairs.
- _.matches = function(attrs) {
- return function(obj) {
- if (obj === attrs) return true; //avoid comparing an object to itself.
- for (var key in attrs) {
- if (attrs[key] !== obj[key])
- return false;
- }
- return true;
- }
- };
-
- // Run a function **n** times.
- _.times = function(n, iterator, context) {
- var accum = Array(Math.max(0, n));
- for (var i = 0; i < n; i++) accum[i] = iterator.call(context, i);
- return accum;
- };
-
- // Return a random integer between min and max (inclusive).
- _.random = function(min, max) {
- if (max == null) {
- max = min;
- min = 0;
- }
- return min + Math.floor(Math.random() * (max - min + 1));
- };
-
- // A (possibly faster) way to get the current timestamp as an integer.
- _.now = Date.now || function() { return new Date().getTime(); };
-
- // List of HTML entities for escaping.
- var entityMap = {
- escape: {
- '&': '&',
- '<': '<',
- '>': '>',
- '"': '"',
- "'": '''
- }
- };
- entityMap.unescape = _.invert(entityMap.escape);
-
- // Regexes containing the keys and values listed immediately above.
- var entityRegexes = {
- escape: new RegExp('[' + _.keys(entityMap.escape).join('') + ']', 'g'),
- unescape: new RegExp('(' + _.keys(entityMap.unescape).join('|') + ')', 'g')
- };
-
- // Functions for escaping and unescaping strings to/from HTML interpolation.
- _.each(['escape', 'unescape'], function(method) {
- _[method] = function(string) {
- if (string == null) return '';
- return ('' + string).replace(entityRegexes[method], function(match) {
- return entityMap[method][match];
- });
- };
- });
-
- // If the value of the named `property` is a function then invoke it with the
- // `object` as context; otherwise, return it.
- _.result = function(object, property) {
- if (object == null) return void 0;
- var value = object[property];
- return _.isFunction(value) ? value.call(object) : value;
- };
-
- // Add your own custom functions to the Underscore object.
- _.mixin = function(obj) {
- each(_.functions(obj), function(name) {
- var func = _[name] = obj[name];
- _.prototype[name] = function() {
- var args = [this._wrapped];
- push.apply(args, arguments);
- return result.call(this, func.apply(_, args));
- };
- });
- };
-
- // Generate a unique integer id (unique within the entire client session).
- // Useful for temporary DOM ids.
- var idCounter = 0;
- _.uniqueId = function(prefix) {
- var id = ++idCounter + '';
- return prefix ? prefix + id : id;
- };
-
- // By default, Underscore uses ERB-style template delimiters, change the
- // following template settings to use alternative delimiters.
- _.templateSettings = {
- evaluate : /<%([\s\S]+?)%>/g,
- interpolate : /<%=([\s\S]+?)%>/g,
- escape : /<%-([\s\S]+?)%>/g
- };
-
- // When customizing `templateSettings`, if you don't want to define an
- // interpolation, evaluation or escaping regex, we need one that is
- // guaranteed not to match.
- var noMatch = /(.)^/;
-
- // Certain characters need to be escaped so that they can be put into a
- // string literal.
- var escapes = {
- "'": "'",
- '\\': '\\',
- '\r': 'r',
- '\n': 'n',
- '\t': 't',
- '\u2028': 'u2028',
- '\u2029': 'u2029'
- };
-
- var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g;
-
- // JavaScript micro-templating, similar to John Resig's implementation.
- // Underscore templating handles arbitrary delimiters, preserves whitespace,
- // and correctly escapes quotes within interpolated code.
- _.template = function(text, data, settings) {
- var render;
- settings = _.defaults({}, settings, _.templateSettings);
-
- // Combine delimiters into one regular expression via alternation.
- var matcher = new RegExp([
- (settings.escape || noMatch).source,
- (settings.interpolate || noMatch).source,
- (settings.evaluate || noMatch).source
- ].join('|') + '|$', 'g');
-
- // Compile the template source, escaping string literals appropriately.
- var index = 0;
- var source = "__p+='";
- text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
- source += text.slice(index, offset)
- .replace(escaper, function(match) { return '\\' + escapes[match]; });
-
- if (escape) {
- source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
- }
- if (interpolate) {
- source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
- }
- if (evaluate) {
- source += "';\n" + evaluate + "\n__p+='";
- }
- index = offset + match.length;
- return match;
- });
- source += "';\n";
-
- // If a variable is not specified, place data values in local scope.
- if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
-
- source = "var __t,__p='',__j=Array.prototype.join," +
- "print=function(){__p+=__j.call(arguments,'');};\n" +
- source + "return __p;\n";
-
- try {
- render = new Function(settings.variable || 'obj', '_', source);
- } catch (e) {
- e.source = source;
- throw e;
- }
-
- if (data) return render(data, _);
- var template = function(data) {
- return render.call(this, data, _);
- };
-
- // Provide the compiled function source as a convenience for precompilation.
- template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}';
-
- return template;
- };
-
- // Add a "chain" function, which will delegate to the wrapper.
- _.chain = function(obj) {
- return _(obj).chain();
- };
-
- // OOP
- // ---------------
- // If Underscore is called as a function, it returns a wrapped object that
- // can be used OO-style. This wrapper holds altered versions of all the
- // underscore functions. Wrapped objects may be chained.
-
- // Helper function to continue chaining intermediate results.
- var result = function(obj) {
- return this._chain ? _(obj).chain() : obj;
- };
-
- // Add all of the Underscore functions to the wrapper object.
- _.mixin(_);
-
- // Add all mutator Array functions to the wrapper.
- each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
- var method = ArrayProto[name];
- _.prototype[name] = function() {
- var obj = this._wrapped;
- method.apply(obj, arguments);
- if ((name == 'shift' || name == 'splice') && obj.length === 0) delete obj[0];
- return result.call(this, obj);
- };
- });
-
- // Add all accessor Array functions to the wrapper.
- each(['concat', 'join', 'slice'], function(name) {
- var method = ArrayProto[name];
- _.prototype[name] = function() {
- return result.call(this, method.apply(this._wrapped, arguments));
- };
- });
-
- _.extend(_.prototype, {
-
- // Start chaining a wrapped Underscore object.
- chain: function() {
- this._chain = true;
- return this;
- },
-
- // Extracts the result from a wrapped and chained object.
- value: function() {
- return this._wrapped;
- }
-
- });
-
- // AMD registration happens at the end for compatibility with AMD loaders
- // that may not enforce next-turn semantics on modules. Even though general
- // practice for AMD registration is to be anonymous, underscore registers
- // as a named module because, like jQuery, it is a base library that is
- // popular enough to be bundled in a third party lib, but not be part of
- // an AMD load request. Those cases could generate an error when an
- // anonymous define() is called outside of a loader request.
- if (typeof define === 'function' && define.amd) {
- define('underscore', [], function() {
- return _;
- });
- }
-}).call(this);
+++ /dev/null
-{
- "name": "wcwidth.js",
- "version": "0.0.4",
- "description": "A JavaScript porting of C's wcwidth() and wcswidth()",
- "author": {
- "name": "Woong Jun",
- "email": "woong.jun@gmail.com",
- "url": "http://code.woong.org/"
- },
- "contributors": [],
- "homepage": "http://code.woong.org/wcwidth.js",
- "repository": {
- "type": "git",
- "url": "https://github.com/mycoboco/wcwidth.js.git"
- },
- "bugs": {
- "url": "https://github.com/mycoboco/wcwidth.js/issues",
- "email": "woong.jun@gmail.com"
- },
- "main": "wcwidth.js",
- "dependencies": {
- "underscore": ">= 1.3.0"
- },
- "devDependencies": {},
- "engines": {
- "node": ">= 0.8.0"
- },
- "licenses": "MIT",
- "keywords": [
- "wide character",
- "wc",
- "wide character string",
- "wcs",
- "terminal",
- "width",
- "wcwidth",
- "wcswidth"
- ],
- "_id": "wcwidth.js@0.0.4",
- "dist": {
- "shasum": "44298a7c899c17501990fdaddd76ef6bd081be75",
- "tarball": "http://registry.npmjs.org/wcwidth.js/-/wcwidth.js-0.0.4.tgz"
- },
- "_from": "wcwidth.js@~0.0.4",
- "_npmVersion": "1.3.11",
- "_npmUser": {
- "name": "mycoboco",
- "email": "woong.jun@gmail.com"
- },
- "maintainers": [
- {
- "name": "mycoboco",
- "email": "woong.jun@gmail.com"
- }
- ],
- "directories": {},
- "_shasum": "44298a7c899c17501990fdaddd76ef6bd081be75",
- "_resolved": "https://registry.npmjs.org/wcwidth.js/-/wcwidth.js-0.0.4.tgz",
- "readme": "ERROR: No README data found!"
-}
+++ /dev/null
-/*
- * Javascript porting of Markus Kuhn's wcwidth() implementation
- *
- * The following explanation comes from the original C implementation:
- *
- * This is an implementation of wcwidth() and wcswidth() (defined in
- * IEEE Std 1002.1-2001) for Unicode.
- *
- * http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html
- * http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html
- *
- * In fixed-width output devices, Latin characters all occupy a single
- * "cell" position of equal width, whereas ideographic CJK characters
- * occupy two such cells. Interoperability between terminal-line
- * applications and (teletype-style) character terminals using the
- * UTF-8 encoding requires agreement on which character should advance
- * the cursor by how many cell positions. No established formal
- * standards exist at present on which Unicode character shall occupy
- * how many cell positions on character terminals. These routines are
- * a first attempt of defining such behavior based on simple rules
- * applied to data provided by the Unicode Consortium.
- *
- * For some graphical characters, the Unicode standard explicitly
- * defines a character-cell width via the definition of the East Asian
- * FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes.
- * In all these cases, there is no ambiguity about which width a
- * terminal shall use. For characters in the East Asian Ambiguous (A)
- * class, the width choice depends purely on a preference of backward
- * compatibility with either historic CJK or Western practice.
- * Choosing single-width for these characters is easy to justify as
- * the appropriate long-term solution, as the CJK practice of
- * displaying these characters as double-width comes from historic
- * implementation simplicity (8-bit encoded characters were displayed
- * single-width and 16-bit ones double-width, even for Greek,
- * Cyrillic, etc.) and not any typographic considerations.
- *
- * Much less clear is the choice of width for the Not East Asian
- * (Neutral) class. Existing practice does not dictate a width for any
- * of these characters. It would nevertheless make sense
- * typographically to allocate two character cells to characters such
- * as for instance EM SPACE or VOLUME INTEGRAL, which cannot be
- * represented adequately with a single-width glyph. The following
- * routines at present merely assign a single-cell width to all
- * neutral characters, in the interest of simplicity. This is not
- * entirely satisfactory and should be reconsidered before
- * establishing a formal standard in this area. At the moment, the
- * decision which Not East Asian (Neutral) characters should be
- * represented by double-width glyphs cannot yet be answered by
- * applying a simple rule from the Unicode database content. Setting
- * up a proper standard for the behavior of UTF-8 character terminals
- * will require a careful analysis not only of each Unicode character,
- * but also of each presentation form, something the author of these
- * routines has avoided to do so far.
- *
- * http://www.unicode.org/unicode/reports/tr11/
- *
- * Markus Kuhn -- 2007-05-26 (Unicode 5.0)
- *
- * Permission to use, copy, modify, and distribute this software
- * for any purpose and without fee is hereby granted. The author
- * disclaims all warranties with regard to this software.
- *
- * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
- */
-
-var _ = require('underscore');
-
-
-// The following two functions define the column width of an ISO 10646 character as follows:
-//
-// - The null character (U+0000) has a column width of 0.
-// - Other C0/C1 control characters and DEL will lead to a return value of -1.
-// - Non-spacing and enclosing combining characters (general category code Mn or Me in the
-// Unicode database) have a column width of 0.
-// - SOFT HYPHEN (U+00AD) has a column width of 1.
-// - Other format characters (general category code Cf in the Unicode database) and ZERO WIDTH
-// SPACE (U+200B) have a column width of 0.
-// - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF) have a column width of 0.
-// - Spacing characters in the East Asian Wide (W) or East Asian Full-width (F) category as
-// defined in Unicode Technical Report #11 have a column width of 2.
-// - All remaining characters (including all printable ISO 8859-1 and WGL4 characters, Unicode
-// control characters, etc.) have a column width of 1.
-//
-// This implementation assumes that characters are encoded in ISO 10646.
-//
-// optional option = { null: width, control: width, monkeypatch: boolean }
-module.exports = wcwidth = function (option) {
- // sorted list of non-overlapping intervals of non-spacing characters
- // generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c"
- var combining = [
- [ 0x0300, 0x036F ], [ 0x0483, 0x0486 ], [ 0x0488, 0x0489 ],
- [ 0x0591, 0x05BD ], [ 0x05BF, 0x05BF ], [ 0x05C1, 0x05C2 ],
- [ 0x05C4, 0x05C5 ], [ 0x05C7, 0x05C7 ], [ 0x0600, 0x0603 ],
- [ 0x0610, 0x0615 ], [ 0x064B, 0x065E ], [ 0x0670, 0x0670 ],
- [ 0x06D6, 0x06E4 ], [ 0x06E7, 0x06E8 ], [ 0x06EA, 0x06ED ],
- [ 0x070F, 0x070F ], [ 0x0711, 0x0711 ], [ 0x0730, 0x074A ],
- [ 0x07A6, 0x07B0 ], [ 0x07EB, 0x07F3 ], [ 0x0901, 0x0902 ],
- [ 0x093C, 0x093C ], [ 0x0941, 0x0948 ], [ 0x094D, 0x094D ],
- [ 0x0951, 0x0954 ], [ 0x0962, 0x0963 ], [ 0x0981, 0x0981 ],
- [ 0x09BC, 0x09BC ], [ 0x09C1, 0x09C4 ], [ 0x09CD, 0x09CD ],
- [ 0x09E2, 0x09E3 ], [ 0x0A01, 0x0A02 ], [ 0x0A3C, 0x0A3C ],
- [ 0x0A41, 0x0A42 ], [ 0x0A47, 0x0A48 ], [ 0x0A4B, 0x0A4D ],
- [ 0x0A70, 0x0A71 ], [ 0x0A81, 0x0A82 ], [ 0x0ABC, 0x0ABC ],
- [ 0x0AC1, 0x0AC5 ], [ 0x0AC7, 0x0AC8 ], [ 0x0ACD, 0x0ACD ],
- [ 0x0AE2, 0x0AE3 ], [ 0x0B01, 0x0B01 ], [ 0x0B3C, 0x0B3C ],
- [ 0x0B3F, 0x0B3F ], [ 0x0B41, 0x0B43 ], [ 0x0B4D, 0x0B4D ],
- [ 0x0B56, 0x0B56 ], [ 0x0B82, 0x0B82 ], [ 0x0BC0, 0x0BC0 ],
- [ 0x0BCD, 0x0BCD ], [ 0x0C3E, 0x0C40 ], [ 0x0C46, 0x0C48 ],
- [ 0x0C4A, 0x0C4D ], [ 0x0C55, 0x0C56 ], [ 0x0CBC, 0x0CBC ],
- [ 0x0CBF, 0x0CBF ], [ 0x0CC6, 0x0CC6 ], [ 0x0CCC, 0x0CCD ],
- [ 0x0CE2, 0x0CE3 ], [ 0x0D41, 0x0D43 ], [ 0x0D4D, 0x0D4D ],
- [ 0x0DCA, 0x0DCA ], [ 0x0DD2, 0x0DD4 ], [ 0x0DD6, 0x0DD6 ],
- [ 0x0E31, 0x0E31 ], [ 0x0E34, 0x0E3A ], [ 0x0E47, 0x0E4E ],
- [ 0x0EB1, 0x0EB1 ], [ 0x0EB4, 0x0EB9 ], [ 0x0EBB, 0x0EBC ],
- [ 0x0EC8, 0x0ECD ], [ 0x0F18, 0x0F19 ], [ 0x0F35, 0x0F35 ],
- [ 0x0F37, 0x0F37 ], [ 0x0F39, 0x0F39 ], [ 0x0F71, 0x0F7E ],
- [ 0x0F80, 0x0F84 ], [ 0x0F86, 0x0F87 ], [ 0x0F90, 0x0F97 ],
- [ 0x0F99, 0x0FBC ], [ 0x0FC6, 0x0FC6 ], [ 0x102D, 0x1030 ],
- [ 0x1032, 0x1032 ], [ 0x1036, 0x1037 ], [ 0x1039, 0x1039 ],
- [ 0x1058, 0x1059 ], [ 0x1160, 0x11FF ], [ 0x135F, 0x135F ],
- [ 0x1712, 0x1714 ], [ 0x1732, 0x1734 ], [ 0x1752, 0x1753 ],
- [ 0x1772, 0x1773 ], [ 0x17B4, 0x17B5 ], [ 0x17B7, 0x17BD ],
- [ 0x17C6, 0x17C6 ], [ 0x17C9, 0x17D3 ], [ 0x17DD, 0x17DD ],
- [ 0x180B, 0x180D ], [ 0x18A9, 0x18A9 ], [ 0x1920, 0x1922 ],
- [ 0x1927, 0x1928 ], [ 0x1932, 0x1932 ], [ 0x1939, 0x193B ],
- [ 0x1A17, 0x1A18 ], [ 0x1B00, 0x1B03 ], [ 0x1B34, 0x1B34 ],
- [ 0x1B36, 0x1B3A ], [ 0x1B3C, 0x1B3C ], [ 0x1B42, 0x1B42 ],
- [ 0x1B6B, 0x1B73 ], [ 0x1DC0, 0x1DCA ], [ 0x1DFE, 0x1DFF ],
- [ 0x200B, 0x200F ], [ 0x202A, 0x202E ], [ 0x2060, 0x2063 ],
- [ 0x206A, 0x206F ], [ 0x20D0, 0x20EF ], [ 0x302A, 0x302F ],
- [ 0x3099, 0x309A ], [ 0xA806, 0xA806 ], [ 0xA80B, 0xA80B ],
- [ 0xA825, 0xA826 ], [ 0xFB1E, 0xFB1E ], [ 0xFE00, 0xFE0F ],
- [ 0xFE20, 0xFE23 ], [ 0xFEFF, 0xFEFF ], [ 0xFFF9, 0xFFFB ],
- [ 0x10A01, 0x10A03 ], [ 0x10A05, 0x10A06 ], [ 0x10A0C, 0x10A0F ],
- [ 0x10A38, 0x10A3A ], [ 0x10A3F, 0x10A3F ], [ 0x1D167, 0x1D169 ],
- [ 0x1D173, 0x1D182 ], [ 0x1D185, 0x1D18B ], [ 0x1D1AA, 0x1D1AD ],
- [ 0x1D242, 0x1D244 ], [ 0xE0001, 0xE0001 ], [ 0xE0020, 0xE007F ],
- [ 0xE0100, 0xE01EF ]
- ];
-
- // auxiliary function for binary search in interval table
- var bisearch = function(ucs) {
- var min = 0,
- max = combining.length-1;
- var mid;
-
- if (ucs < combining[0][0] || ucs > combining[max][1])
- return false;
- while (max >= min) {
- mid = Math.floor((min + max) / 2);
- if (ucs > combining[mid][1])
- min = mid + 1;
- else if (ucs < combining[mid][0])
- max = mid - 1;
- else
- return true;
- }
-
- return false;
- }
-
- // ucs = 'character' or charCode
- var wcwidth = function (ucs) {
- // test for 8-bit control characters
- if (ucs === 0)
- return option.nul;
- if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0))
- return option.control;
-
- // binary search in table of non-spacing characters
- if (bisearch(ucs))
- return 0;
-
- // if we arrive here, ucs is not a combining or C0/C1 control character
- return 1 +
- (ucs >= 0x1100 &&
- (ucs <= 0x115f || // Hangul Jamo init. consonants
- ucs == 0x2329 || ucs == 0x232a ||
- (ucs >= 0x2e80 && ucs <= 0xa4cf &&
- ucs != 0x303f) || // CJK ... Yi
- (ucs >= 0xac00 && ucs <= 0xd7a3) || // Hangul Syllables
- (ucs >= 0xf900 && ucs <= 0xfaff) || // CJK Compatibility Ideographs
- (ucs >= 0xfe10 && ucs <= 0xfe19) || // Vertical forms
- (ucs >= 0xfe30 && ucs <= 0xfe6f) || // CJK Compatibility Forms
- (ucs >= 0xff00 && ucs <= 0xff60) || // Fullwidth Forms
- (ucs >= 0xffe0 && ucs <= 0xffe6) ||
- (ucs >= 0x20000 && ucs <= 0x2fffd) ||
- (ucs >= 0x30000 && ucs <= 0x3fffd)));
- };
-
- var wcswidth = function (str) {
- var i, l, n, s = 0;
-
- if (_.isString(str))
- for (i=0, l=str.length; i < l; i++) {
- if ((n = wcwidth(str.charCodeAt(i))) < 0)
- return -1;
- s += n;
- }
- else
- s = wcwidth(str);
-
- return s;
- };
-
- option = _.extend({
- nul: 0,
- control: -1,
- monkeypatch: true
- }, option);
-
- if (option.monkeypatch)
- String.prototype.__defineGetter__('wcwidth', function () {
- return wcswidth(this);
- });
-
- return wcswidth;
-};
-
-
-/*
-(function () {
- var ww = wcwidth();
- var test = [
- '다섯글자임',
- 'four',
- 'ten chars',
- ' \n\t',
- '\0'
- ];
-
- for (var i = 0; i < test.length; i++)
- console.log(test[i], test[i].length, ww(test[i]), test[i].wcwidth);
- console.log(ww('한글'));
- console.log(ww('한'.charCodeAt(0)));
-}());
-*/
-
-
-/*
-(function () {
- var ww = wcwidth({
- nul: 1,
- control: 1,
- monkeypatch: false
- });
- var test = [
- '다섯글자임',
- 'four',
- 'ten chars',
- ' \n\t',
- '\0'
- ];
-
- for (var i = 0; i < test.length; i++)
- console.log(test[i], test[i].length, ww(test[i]), test[i].wcwidth);
- console.log(ww('한글'));
- console.log(ww('한'.charCodeAt(0)));
-}());
-*/
-
-// end of wcwidth.js
--- /dev/null
+node_modules
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
+
--- /dev/null
+# wcwidth
+
+Determine columns needed for a fixed-size wide-character string
+
+----
+
+wcwidth is a simple JavaScript port of [wcwidth](http://man7.org/linux/man-pages/man3/wcswidth.3.html) implemented in C by Markus Kuhn.
+
+JavaScript port [originally](https://github.com/mycoboco/wcwidth.js) written by Woong Jun <woong.jun@gmail.com> (http://code.woong.org/)
+
+## Example
+
+```js
+'한'.length // => 1
+wcwidth('한'); // => 2
+
+'한글'.length // => 2
+wcwidth('한글'); // => 4
+```
+
+`wcwidth()` and its string version, `wcswidth()` are defined by IEEE Std
+1002.1-2001, a.k.a. POSIX.1-2001, and return the number of columns used
+to represent the given wide character and string.
+
+Markus's implementation assumes the wide character given to those
+functions to be encoded in ISO 10646, which is almost true for
+JavaScript's characters.
+
+[Further explaination here](docs)
+
+## License
+
+MIT
--- /dev/null
+module.exports = [
+ [ 0x0300, 0x036F ], [ 0x0483, 0x0486 ], [ 0x0488, 0x0489 ],
+ [ 0x0591, 0x05BD ], [ 0x05BF, 0x05BF ], [ 0x05C1, 0x05C2 ],
+ [ 0x05C4, 0x05C5 ], [ 0x05C7, 0x05C7 ], [ 0x0600, 0x0603 ],
+ [ 0x0610, 0x0615 ], [ 0x064B, 0x065E ], [ 0x0670, 0x0670 ],
+ [ 0x06D6, 0x06E4 ], [ 0x06E7, 0x06E8 ], [ 0x06EA, 0x06ED ],
+ [ 0x070F, 0x070F ], [ 0x0711, 0x0711 ], [ 0x0730, 0x074A ],
+ [ 0x07A6, 0x07B0 ], [ 0x07EB, 0x07F3 ], [ 0x0901, 0x0902 ],
+ [ 0x093C, 0x093C ], [ 0x0941, 0x0948 ], [ 0x094D, 0x094D ],
+ [ 0x0951, 0x0954 ], [ 0x0962, 0x0963 ], [ 0x0981, 0x0981 ],
+ [ 0x09BC, 0x09BC ], [ 0x09C1, 0x09C4 ], [ 0x09CD, 0x09CD ],
+ [ 0x09E2, 0x09E3 ], [ 0x0A01, 0x0A02 ], [ 0x0A3C, 0x0A3C ],
+ [ 0x0A41, 0x0A42 ], [ 0x0A47, 0x0A48 ], [ 0x0A4B, 0x0A4D ],
+ [ 0x0A70, 0x0A71 ], [ 0x0A81, 0x0A82 ], [ 0x0ABC, 0x0ABC ],
+ [ 0x0AC1, 0x0AC5 ], [ 0x0AC7, 0x0AC8 ], [ 0x0ACD, 0x0ACD ],
+ [ 0x0AE2, 0x0AE3 ], [ 0x0B01, 0x0B01 ], [ 0x0B3C, 0x0B3C ],
+ [ 0x0B3F, 0x0B3F ], [ 0x0B41, 0x0B43 ], [ 0x0B4D, 0x0B4D ],
+ [ 0x0B56, 0x0B56 ], [ 0x0B82, 0x0B82 ], [ 0x0BC0, 0x0BC0 ],
+ [ 0x0BCD, 0x0BCD ], [ 0x0C3E, 0x0C40 ], [ 0x0C46, 0x0C48 ],
+ [ 0x0C4A, 0x0C4D ], [ 0x0C55, 0x0C56 ], [ 0x0CBC, 0x0CBC ],
+ [ 0x0CBF, 0x0CBF ], [ 0x0CC6, 0x0CC6 ], [ 0x0CCC, 0x0CCD ],
+ [ 0x0CE2, 0x0CE3 ], [ 0x0D41, 0x0D43 ], [ 0x0D4D, 0x0D4D ],
+ [ 0x0DCA, 0x0DCA ], [ 0x0DD2, 0x0DD4 ], [ 0x0DD6, 0x0DD6 ],
+ [ 0x0E31, 0x0E31 ], [ 0x0E34, 0x0E3A ], [ 0x0E47, 0x0E4E ],
+ [ 0x0EB1, 0x0EB1 ], [ 0x0EB4, 0x0EB9 ], [ 0x0EBB, 0x0EBC ],
+ [ 0x0EC8, 0x0ECD ], [ 0x0F18, 0x0F19 ], [ 0x0F35, 0x0F35 ],
+ [ 0x0F37, 0x0F37 ], [ 0x0F39, 0x0F39 ], [ 0x0F71, 0x0F7E ],
+ [ 0x0F80, 0x0F84 ], [ 0x0F86, 0x0F87 ], [ 0x0F90, 0x0F97 ],
+ [ 0x0F99, 0x0FBC ], [ 0x0FC6, 0x0FC6 ], [ 0x102D, 0x1030 ],
+ [ 0x1032, 0x1032 ], [ 0x1036, 0x1037 ], [ 0x1039, 0x1039 ],
+ [ 0x1058, 0x1059 ], [ 0x1160, 0x11FF ], [ 0x135F, 0x135F ],
+ [ 0x1712, 0x1714 ], [ 0x1732, 0x1734 ], [ 0x1752, 0x1753 ],
+ [ 0x1772, 0x1773 ], [ 0x17B4, 0x17B5 ], [ 0x17B7, 0x17BD ],
+ [ 0x17C6, 0x17C6 ], [ 0x17C9, 0x17D3 ], [ 0x17DD, 0x17DD ],
+ [ 0x180B, 0x180D ], [ 0x18A9, 0x18A9 ], [ 0x1920, 0x1922 ],
+ [ 0x1927, 0x1928 ], [ 0x1932, 0x1932 ], [ 0x1939, 0x193B ],
+ [ 0x1A17, 0x1A18 ], [ 0x1B00, 0x1B03 ], [ 0x1B34, 0x1B34 ],
+ [ 0x1B36, 0x1B3A ], [ 0x1B3C, 0x1B3C ], [ 0x1B42, 0x1B42 ],
+ [ 0x1B6B, 0x1B73 ], [ 0x1DC0, 0x1DCA ], [ 0x1DFE, 0x1DFF ],
+ [ 0x200B, 0x200F ], [ 0x202A, 0x202E ], [ 0x2060, 0x2063 ],
+ [ 0x206A, 0x206F ], [ 0x20D0, 0x20EF ], [ 0x302A, 0x302F ],
+ [ 0x3099, 0x309A ], [ 0xA806, 0xA806 ], [ 0xA80B, 0xA80B ],
+ [ 0xA825, 0xA826 ], [ 0xFB1E, 0xFB1E ], [ 0xFE00, 0xFE0F ],
+ [ 0xFE20, 0xFE23 ], [ 0xFEFF, 0xFEFF ], [ 0xFFF9, 0xFFFB ],
+ [ 0x10A01, 0x10A03 ], [ 0x10A05, 0x10A06 ], [ 0x10A0C, 0x10A0F ],
+ [ 0x10A38, 0x10A3A ], [ 0x10A3F, 0x10A3F ], [ 0x1D167, 0x1D169 ],
+ [ 0x1D173, 0x1D182 ], [ 0x1D185, 0x1D18B ], [ 0x1D1AA, 0x1D1AD ],
+ [ 0x1D242, 0x1D244 ], [ 0xE0001, 0xE0001 ], [ 0xE0020, 0xE007F ],
+ [ 0xE0100, 0xE01EF ]
+]
--- /dev/null
+### Javascript porting of Markus Kuhn's wcwidth() implementation
+
+The following explanation comes from the original C implementation:
+
+This is an implementation of wcwidth() and wcswidth() (defined in
+IEEE Std 1002.1-2001) for Unicode.
+
+http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html
+http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html
+
+In fixed-width output devices, Latin characters all occupy a single
+"cell" position of equal width, whereas ideographic CJK characters
+occupy two such cells. Interoperability between terminal-line
+applications and (teletype-style) character terminals using the
+UTF-8 encoding requires agreement on which character should advance
+the cursor by how many cell positions. No established formal
+standards exist at present on which Unicode character shall occupy
+how many cell positions on character terminals. These routines are
+a first attempt of defining such behavior based on simple rules
+applied to data provided by the Unicode Consortium.
+
+For some graphical characters, the Unicode standard explicitly
+defines a character-cell width via the definition of the East Asian
+FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes.
+In all these cases, there is no ambiguity about which width a
+terminal shall use. For characters in the East Asian Ambiguous (A)
+class, the width choice depends purely on a preference of backward
+compatibility with either historic CJK or Western practice.
+Choosing single-width for these characters is easy to justify as
+the appropriate long-term solution, as the CJK practice of
+displaying these characters as double-width comes from historic
+implementation simplicity (8-bit encoded characters were displayed
+single-width and 16-bit ones double-width, even for Greek,
+Cyrillic, etc.) and not any typographic considerations.
+
+Much less clear is the choice of width for the Not East Asian
+(Neutral) class. Existing practice does not dictate a width for any
+of these characters. It would nevertheless make sense
+typographically to allocate two character cells to characters such
+as for instance EM SPACE or VOLUME INTEGRAL, which cannot be
+represented adequately with a single-width glyph. The following
+routines at present merely assign a single-cell width to all
+neutral characters, in the interest of simplicity. This is not
+entirely satisfactory and should be reconsidered before
+establishing a formal standard in this area. At the moment, the
+decision which Not East Asian (Neutral) characters should be
+represented by double-width glyphs cannot yet be answered by
+applying a simple rule from the Unicode database content. Setting
+up a proper standard for the behavior of UTF-8 character terminals
+will require a careful analysis not only of each Unicode character,
+but also of each presentation form, something the author of these
+routines has avoided to do so far.
+
+http://www.unicode.org/unicode/reports/tr11/
+
+Markus Kuhn -- 2007-05-26 (Unicode 5.0)
+
+Permission to use, copy, modify, and distribute this software
+for any purpose and without fee is hereby granted. The author
+disclaims all warranties with regard to this software.
+
+Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
+
+
+
--- /dev/null
+"use strict"
+
+var defaults = require('defaults')
+var combining = require('./combining')
+
+var DEFAULTS = {
+ nul: 0,
+ control: 0
+}
+
+module.exports = function wcwidth(str) {
+ return wcswidth(str, DEFAULTS)
+}
+
+module.exports.config = function(opts) {
+ opts = defaults(opts || {}, DEFAULTS)
+ return function wcwidth(str) {
+ return wcswidth(str, opts)
+ }
+}
+
+/*
+ * The following functions define the column width of an ISO 10646
+ * character as follows:
+ * - The null character (U+0000) has a column width of 0.
+ * - Other C0/C1 control characters and DEL will lead to a return value
+ * of -1.
+ * - Non-spacing and enclosing combining characters (general category
+ * code Mn or Me in the
+ * Unicode database) have a column width of 0.
+ * - SOFT HYPHEN (U+00AD) has a column width of 1.
+ * - Other format characters (general category code Cf in the Unicode
+ * database) and ZERO WIDTH
+ * SPACE (U+200B) have a column width of 0.
+ * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF)
+ * have a column width of 0.
+ * - Spacing characters in the East Asian Wide (W) or East Asian
+ * Full-width (F) category as
+ * defined in Unicode Technical Report #11 have a column width of 2.
+ * - All remaining characters (including all printable ISO 8859-1 and
+ * WGL4 characters, Unicode control characters, etc.) have a column
+ * width of 1.
+ * This implementation assumes that characters are encoded in ISO 10646.
+*/
+
+function wcswidth(str, opts) {
+ if (typeof str !== 'string') return wcwidth(str, opts)
+
+ var s = 0
+ for (var i = 0; i < str.length; i++) {
+ var n = wcwidth(str.charCodeAt(i), opts)
+ if (n < 0) return -1
+ s += n
+ }
+
+ return s
+}
+
+function wcwidth(ucs, opts) {
+ // test for 8-bit control characters
+ if (ucs === 0) return opts.nul
+ if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) return opts.control
+
+ // binary search in table of non-spacing characters
+ if (bisearch(ucs)) return 0
+
+ // if we arrive here, ucs is not a combining or C0/C1 control character
+ return 1 +
+ (ucs >= 0x1100 &&
+ (ucs <= 0x115f || // Hangul Jamo init. consonants
+ ucs == 0x2329 || ucs == 0x232a ||
+ (ucs >= 0x2e80 && ucs <= 0xa4cf &&
+ ucs != 0x303f) || // CJK ... Yi
+ (ucs >= 0xac00 && ucs <= 0xd7a3) || // Hangul Syllables
+ (ucs >= 0xf900 && ucs <= 0xfaff) || // CJK Compatibility Ideographs
+ (ucs >= 0xfe10 && ucs <= 0xfe19) || // Vertical forms
+ (ucs >= 0xfe30 && ucs <= 0xfe6f) || // CJK Compatibility Forms
+ (ucs >= 0xff00 && ucs <= 0xff60) || // Fullwidth Forms
+ (ucs >= 0xffe0 && ucs <= 0xffe6) ||
+ (ucs >= 0x20000 && ucs <= 0x2fffd) ||
+ (ucs >= 0x30000 && ucs <= 0x3fffd)));
+}
+
+function bisearch(ucs) {
+ var min = 0
+ var max = combining.length - 1
+ var mid
+
+ if (ucs < combining[0][0] || ucs > combining[max][1]) return false
+
+ while (max >= min) {
+ mid = Math.floor((min + max) / 2)
+ if (ucs > combining[mid][1]) min = mid + 1
+ else if (ucs < combining[mid][0]) max = mid - 1
+ else return true
+ }
+
+ return false
+}
--- /dev/null
+node_modules
--- /dev/null
+# defaults
+
+A simple one level options merge utility
+
+## install
+
+`npm install defaults`
+
+## use
+
+```javascript
+
+var defaults = require('defaults');
+
+var handle = function(options, fn) {
+ options = defaults(options, {
+ timeout: 100
+ });
+
+ setTimeout(function() {
+ fn(options);
+ }, options.timeout);
+}
+
+handle({ timeout: 1000 }, function() {
+ // we're here 1000 ms later
+});
+
+handle({ timeout: 10000 }, function() {
+ // we're here 10s later
+});
+
+```
+
+## summary
+
+this module exports a function that takes 2 arguments: `options` and `defaults`. When called, it overrides all of `undefined` properties in `options` with the clones of properties defined in `defaults`
+
+Sidecases: if called with a falsy `options` value, options will be initialized to a new object before being merged onto.
+
+## license
+
+MIT
\ No newline at end of file
--- /dev/null
+var clone = require('clone');
+
+module.exports = function(options, defaults) {
+ options = options || {};
+
+ Object.keys(defaults).forEach(function(key) {
+ if (typeof options[key] === 'undefined') {
+ options[key] = clone(defaults[key]);
+ }
+ });
+
+ return options;
+};
\ No newline at end of file
--- /dev/null
+node_modules/
--- /dev/null
+language: node_js
+node_js:
+ - 0.6
+ - 0.8
+ - 0.10
--- /dev/null
+Copyright © 2011-2014 Paul Vorbach <paul@vorba.ch>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the “Software”), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null
+# clone
+
+[![build status](https://secure.travis-ci.org/pvorb/node-clone.png)](http://travis-ci.org/pvorb/node-clone)
+
+offers foolproof _deep cloning_ of variables in JavaScript.
+
+
+## Installation
+
+ npm install clone
+
+or
+
+ ender build clone
+
+
+## Example
+
+~~~ javascript
+var clone = require('clone');
+
+var a, b;
+
+a = { foo: { bar: 'baz' } }; // inital value of a
+
+b = clone(a); // clone a -> b
+a.foo.bar = 'foo'; // change a
+
+console.log(a); // show a
+console.log(b); // show b
+~~~
+
+This will print:
+
+~~~ javascript
+{ foo: { bar: 'foo' } }
+{ foo: { bar: 'baz' } }
+~~~
+
+**clone** masters cloning simple objects (even with custom prototype), arrays,
+Date objects, and RegExp objects. Everything is cloned recursively, so that you
+can clone dates in arrays in objects, for example.
+
+
+## API
+
+`clone(val, circular, depth)`
+
+ * `val` -- the value that you want to clone, any type allowed
+ * `circular` -- boolean
+
+ Call `clone` with `circular` set to `false` if you are certain that `obj`
+ contains no circular references. This will give better performance if needed.
+ There is no error if `undefined` or `null` is passed as `obj`.
+ * `depth` -- depth to wich the object is to be cloned (optional,
+ defaults to infinity)
+
+`clone.clonePrototype(obj)`
+
+ * `obj` -- the object that you want to clone
+
+Does a prototype clone as
+[described by Oran Looney](http://oranlooney.com/functional-javascript/).
+
+
+## Circular References
+
+~~~ javascript
+var a, b;
+
+a = { hello: 'world' };
+
+a.myself = a;
+b = clone(a);
+
+console.log(b);
+~~~
+
+This will print:
+
+~~~ javascript
+{ hello: "world", myself: [Circular] }
+~~~
+
+So, `b.myself` points to `b`, not `a`. Neat!
+
+
+## Test
+
+ npm test
+
+
+## Caveat
+
+Some special objects like a socket or `process.stdout`/`stderr` are known to not
+be cloneable. If you find other objects that cannot be cloned, please [open an
+issue](https://github.com/pvorb/node-clone/issues/new).
+
+
+## Bugs and Issues
+
+If you encounter any bugs or issues, feel free to [open an issue at
+github](https://github.com/pvorb/node-clone/issues) or send me an email to
+<paul@vorba.ch>. I also always like to hear from you, if you’re using my code.
+
+## License
+
+Copyright © 2011-2014 [Paul Vorbach](http://paul.vorba.ch/) and
+[contributors](https://github.com/pvorb/node-clone/graphs/contributors).
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the “Software”), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null
+'use strict';
+
+function objectToString(o) {
+ return Object.prototype.toString.call(o);
+}
+
+// shim for Node's 'util' package
+// DO NOT REMOVE THIS! It is required for compatibility with EnderJS (http://enderjs.com/).
+var util = {
+ isArray: function (ar) {
+ return Array.isArray(ar) || (typeof ar === 'object' && objectToString(ar) === '[object Array]');
+ },
+ isDate: function (d) {
+ return typeof d === 'object' && objectToString(d) === '[object Date]';
+ },
+ isRegExp: function (re) {
+ return typeof re === 'object' && objectToString(re) === '[object RegExp]';
+ },
+ getRegExpFlags: function (re) {
+ var flags = '';
+ re.global && (flags += 'g');
+ re.ignoreCase && (flags += 'i');
+ re.multiline && (flags += 'm');
+ return flags;
+ }
+};
+
+
+if (typeof module === 'object')
+ module.exports = clone;
+
+/**
+ * Clones (copies) an Object using deep copying.
+ *
+ * This function supports circular references by default, but if you are certain
+ * there are no circular references in your object, you can save some CPU time
+ * by calling clone(obj, false).
+ *
+ * Caution: if `circular` is false and `parent` contains circular references,
+ * your program may enter an infinite loop and crash.
+ *
+ * @param `parent` - the object to be cloned
+ * @param `circular` - set to true if the object to be cloned may contain
+ * circular references. (optional - true by default)
+ * @param `depth` - set to a number if the object is only to be cloned to
+ * a particular depth. (optional - defaults to Infinity)
+ * @param `prototype` - sets the prototype to be used when cloning an object.
+ * (optional - defaults to parent prototype).
+*/
+
+function clone(parent, circular, depth, prototype) {
+ // maintain two arrays for circular references, where corresponding parents
+ // and children have the same index
+ var allParents = [];
+ var allChildren = [];
+
+ var useBuffer = typeof Buffer != 'undefined';
+
+ if (typeof circular == 'undefined')
+ circular = true;
+
+ if (typeof depth == 'undefined')
+ depth = Infinity;
+
+ // recurse this function so we don't reset allParents and allChildren
+ function _clone(parent, depth) {
+ // cloning null always returns null
+ if (parent === null)
+ return null;
+
+ if (depth == 0)
+ return parent;
+
+ var child;
+ if (typeof parent != 'object') {
+ return parent;
+ }
+
+ if (util.isArray(parent)) {
+ child = [];
+ } else if (util.isRegExp(parent)) {
+ child = new RegExp(parent.source, util.getRegExpFlags(parent));
+ if (parent.lastIndex) child.lastIndex = parent.lastIndex;
+ } else if (util.isDate(parent)) {
+ child = new Date(parent.getTime());
+ } else if (useBuffer && Buffer.isBuffer(parent)) {
+ child = new Buffer(parent.length);
+ parent.copy(child);
+ return child;
+ } else {
+ if (typeof prototype == 'undefined') child = Object.create(Object.getPrototypeOf(parent));
+ else child = Object.create(prototype);
+ }
+
+ if (circular) {
+ var index = allParents.indexOf(parent);
+
+ if (index != -1) {
+ return allChildren[index];
+ }
+ allParents.push(parent);
+ allChildren.push(child);
+ }
+
+ for (var i in parent) {
+ child[i] = _clone(parent[i], depth - 1);
+ }
+
+ return child;
+ }
+
+ return _clone(parent, depth);
+}
+
+/**
+ * Simple flat clone using prototype, accepts only objects, usefull for property
+ * override on FLAT configuration object (no nested props).
+ *
+ * USE WITH CAUTION! This may not behave as you wish if you do not know how this
+ * works.
+ */
+clone.clonePrototype = function(parent) {
+ if (parent === null)
+ return null;
+
+ var c = function () {};
+ c.prototype = parent;
+ return new c();
+};
--- /dev/null
+{
+ "name": "clone",
+ "description": "deep cloning of objects and arrays",
+ "tags": [
+ "clone",
+ "object",
+ "array",
+ "function",
+ "date"
+ ],
+ "version": "0.1.18",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/pvorb/node-clone.git"
+ },
+ "bugs": {
+ "url": "https://github.com/pvorb/node-clone/issues"
+ },
+ "main": "clone.js",
+ "author": {
+ "name": "Paul Vorbach",
+ "email": "paul@vorba.ch",
+ "url": "http://paul.vorba.ch/"
+ },
+ "contributors": [
+ {
+ "name": "Blake Miner",
+ "email": "miner.blake@gmail.com",
+ "url": "http://www.blakeminer.com/"
+ },
+ {
+ "name": "Tian You",
+ "email": "axqd001@gmail.com",
+ "url": "http://blog.axqd.net/"
+ },
+ {
+ "name": "George Stagas",
+ "email": "gstagas@gmail.com",
+ "url": "http://stagas.com/"
+ },
+ {
+ "name": "Tobiasz Cudnik",
+ "email": "tobiasz.cudnik@gmail.com",
+ "url": "https://github.com/TobiaszCudnik"
+ },
+ {
+ "name": "Pavel Lang",
+ "email": "langpavel@phpskelet.org",
+ "url": "https://github.com/langpavel"
+ },
+ {
+ "name": "Dan MacTough",
+ "url": "http://yabfog.com/"
+ },
+ {
+ "name": "w1nk",
+ "url": "https://github.com/w1nk"
+ },
+ {
+ "name": "Hugh Kennedy",
+ "url": "http://twitter.com/hughskennedy"
+ },
+ {
+ "name": "Dustin Diaz",
+ "url": "http://dustindiaz.com"
+ },
+ {
+ "name": "Ilya Shaisultanov",
+ "url": "https://github.com/diversario"
+ },
+ {
+ "name": "Nathan MacInnes",
+ "email": "nathan@macinn.es",
+ "url": "http://macinn.es/"
+ },
+ {
+ "name": "Benjamin E. Coe",
+ "email": "ben@npmjs.com",
+ "url": "https://twitter.com/benjamincoe"
+ },
+ {
+ "name": "Nathan Zadoks",
+ "url": "https://github.com/nathan7"
+ }
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": "*"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "underscore": "*",
+ "nodeunit": "*"
+ },
+ "optionalDependencies": {},
+ "scripts": {
+ "test": "nodeunit test.js"
+ },
+ "gitHead": "17eea36140d61d97a9954c53417d0e04a00525d9",
+ "homepage": "https://github.com/pvorb/node-clone",
+ "_id": "clone@0.1.18",
+ "_shasum": "64a0d5d57eaa85a1a8af380cd1db8c7b3a895f66",
+ "_from": "clone@~0.1.5",
+ "_npmVersion": "1.4.14",
+ "_npmUser": {
+ "name": "pvorb",
+ "email": "paul@vorba.ch"
+ },
+ "maintainers": [
+ {
+ "name": "pvorb",
+ "email": "paul@vorb.de"
+ }
+ ],
+ "dist": {
+ "shasum": "64a0d5d57eaa85a1a8af380cd1db8c7b3a895f66",
+ "tarball": "http://registry.npmjs.org/clone/-/clone-0.1.18.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/clone/-/clone-0.1.18.tgz",
+ "readme": "ERROR: No README data found!"
+}
--- /dev/null
+if(module.parent === null) {
+ console.log('Run this test file with nodeunit:');
+ console.log('$ nodeunit test.js');
+}
+
+
+var clone = require('./');
+var util = require('util');
+var _ = require('underscore');
+
+
+
+exports["clone string"] = function(test) {
+ test.expect(2); // how many tests?
+
+ var a = "foo";
+ test.strictEqual(clone(a), a);
+ a = "";
+ test.strictEqual(clone(a), a);
+
+ test.done();
+};
+
+
+
+exports["clone number"] = function(test) {
+ test.expect(5); // how many tests?
+
+ var a = 0;
+ test.strictEqual(clone(a), a);
+ a = 1;
+ test.strictEqual(clone(a), a);
+ a = -1000;
+ test.strictEqual(clone(a), a);
+ a = 3.1415927;
+ test.strictEqual(clone(a), a);
+ a = -3.1415927;
+ test.strictEqual(clone(a), a);
+
+ test.done();
+};
+
+
+
+exports["clone date"] = function(test) {
+ test.expect(3); // how many tests?
+
+ var a = new Date;
+ var c = clone(a);
+ test.ok(a instanceof Date);
+ test.ok(c instanceof Date);
+ test.equal(c.getTime(), a.getTime());
+
+ test.done();
+};
+
+
+
+exports["clone object"] = function(test) {
+ test.expect(2); // how many tests?
+
+ var a = { foo: { bar: "baz" } };
+ var b = clone(a);
+
+ test.ok(_(a).isEqual(b), "underscore equal");
+ test.deepEqual(b, a);
+
+ test.done();
+};
+
+
+
+exports["clone array"] = function(test) {
+ test.expect(2); // how many tests?
+
+ var a = [
+ { foo: "bar" },
+ "baz"
+ ];
+ var b = clone(a);
+
+ test.ok(_(a).isEqual(b), "underscore equal");
+ test.deepEqual(b, a);
+
+ test.done();
+};
+
+exports["clone buffer"] = function(test) {
+ test.expect(1);
+
+ var a = new Buffer("this is a test buffer");
+ var b = clone(a);
+
+ // no underscore equal since it has no concept of Buffers
+ test.deepEqual(b, a);
+ test.done();
+};
+
+
+
+exports["clone regexp"] = function(test) {
+ test.expect(5);
+
+ var a = /abc123/gi;
+ var b = clone(a);
+
+ test.deepEqual(b, a);
+
+ var c = /a/g;
+ test.ok(c.lastIndex === 0);
+
+ c.exec('123a456a');
+ test.ok(c.lastIndex === 4);
+
+ var d = clone(c);
+ test.ok(d.global);
+ test.ok(d.lastIndex === 4);
+
+ test.done();
+};
+
+
+exports["clone object containing array"] = function(test) {
+ test.expect(2); // how many tests?
+
+ var a = {
+ arr1: [ { a: '1234', b: '2345' } ],
+ arr2: [ { c: '345', d: '456' } ]
+ };
+ var b = clone(a);
+
+ test.ok(_(a).isEqual(b), "underscore equal");
+ test.deepEqual(b, a);
+
+ test.done();
+};
+
+
+
+exports["clone object with circular reference"] = function(test) {
+ test.expect(8); // how many tests?
+
+ var _ = test.ok;
+ var c = [1, "foo", {'hello': 'bar'}, function() {}, false, [2]];
+ var b = [c, 2, 3, 4];
+ var a = {'b': b, 'c': c};
+ a.loop = a;
+ a.loop2 = a;
+ c.loop = c;
+ c.aloop = a;
+ var aCopy = clone(a);
+ _(a != aCopy);
+ _(a.c != aCopy.c);
+ _(aCopy.c == aCopy.b[0]);
+ _(aCopy.c.loop.loop.aloop == aCopy);
+ _(aCopy.c[0] == a.c[0]);
+
+ //console.log(util.inspect(aCopy, true, null) );
+ //console.log("------------------------------------------------------------");
+ //console.log(util.inspect(a, true, null) );
+ _(eq(a, aCopy));
+ aCopy.c[0] = 2;
+ _(!eq(a, aCopy));
+ aCopy.c = "2";
+ _(!eq(a, aCopy));
+ //console.log("------------------------------------------------------------");
+ //console.log(util.inspect(aCopy, true, null) );
+
+ function eq(x, y) {
+ return util.inspect(x, true, null) === util.inspect(y, true, null);
+ }
+
+ test.done();
+};
+
+
+
+exports['clonePrototype'] = function(test) {
+ test.expect(3); // how many tests?
+
+ var a = {
+ a: "aaa",
+ x: 123,
+ y: 45.65
+ };
+ var b = clone.clonePrototype(a);
+
+ test.strictEqual(b.a, a.a);
+ test.strictEqual(b.x, a.x);
+ test.strictEqual(b.y, a.y);
+
+ test.done();
+}
+
+exports['cloneWithinNewVMContext'] = function(test) {
+ test.expect(3);
+ var vm = require('vm');
+ var ctx = vm.createContext({ clone: clone });
+ var script = "clone( {array: [1, 2, 3], date: new Date(), regex: /^foo$/ig} );";
+ var results = vm.runInContext(script, ctx);
+ test.ok(results.array instanceof Array);
+ test.ok(results.date instanceof Date);
+ test.ok(results.regex instanceof RegExp);
+ test.done();
+}
+
+exports['cloneObjectWithNoConstructor'] = function(test) {
+ test.expect(3);
+ var n = null;
+ var a = { foo: 'bar' };
+ a.__proto__ = n;
+ test.ok(typeof a === 'object');
+ test.ok(typeof a !== null);
+ var b = clone(a);
+ test.ok(a.foo, b.foo);
+ test.done();
+}
+
+exports['clone object with depth argument'] = function (test) {
+ test.expect(6);
+ var a = {
+ foo: {
+ bar : {
+ baz : 'qux'
+ }
+ }
+ };
+ var b = clone(a, false, 1);
+ test.deepEqual(b, a);
+ test.notEqual(b, a);
+ test.strictEqual(b.foo, a.foo);
+
+ b = clone(a, true, 2);
+ test.deepEqual(b, a);
+ test.notEqual(b.foo, a.foo);
+ test.strictEqual(b.foo.bar, a.foo.bar);
+ test.done();
+}
+
+exports['maintain prototype chain in clones'] = function (test) {
+ test.expect(1);
+ function Constructor() {}
+ var a = new Constructor();
+ var b = clone(a);
+ test.strictEqual(Object.getPrototypeOf(a), Object.getPrototypeOf(b));
+ test.done();
+}
+
+exports['parent prototype is overriden with prototype provided'] = function (test) {
+ test.expect(1);
+ function Constructor() {}
+ var a = new Constructor();
+ var b = clone(a, true, Infinity, null);
+ test.strictEqual(b.__defineSetter__, undefined);
+ test.done();
+}
+
+exports['clone object with null children'] = function(test) {
+ test.expect(1);
+ var a = {
+ foo: {
+ bar: null,
+ baz: {
+ qux: false
+ }
+ }
+ };
+ var b = clone(a);
+ test.deepEqual(b, a);
+ test.done();
+}
--- /dev/null
+{
+ "name": "defaults",
+ "version": "1.0.0",
+ "description": "merge single level defaults over a config object",
+ "main": "index.js",
+ "scripts": {
+ "test": "node test.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/tmpvar/defaults.git"
+ },
+ "keywords": [
+ "config",
+ "defaults"
+ ],
+ "author": {
+ "name": "Elijah Insua",
+ "email": "tmpvar@gmail.com"
+ },
+ "license": "MIT",
+ "readmeFilename": "README.md",
+ "dependencies": {
+ "clone": "~0.1.5"
+ },
+ "devDependencies": {
+ "tap": "~0.4.0"
+ },
+ "readme": "# defaults\n\nA simple one level options merge utility\n\n## install\n\n`npm install defaults`\n\n## use\n\n```javascript\n\nvar defaults = require('defaults');\n\nvar handle = function(options, fn) {\n options = defaults(options, {\n timeout: 100\n });\n\n setTimeout(function() {\n fn(options);\n }, options.timeout);\n}\n\nhandle({ timeout: 1000 }, function() {\n // we're here 1000 ms later\n});\n\nhandle({ timeout: 10000 }, function() {\n // we're here 10s later\n});\n\n```\n\n## summary\n\nthis module exports a function that takes 2 arguments: `options` and `defaults`. When called, it overrides all of `undefined` properties in `options` with the clones of properties defined in `defaults`\n\nSidecases: if called with a falsy `options` value, options will be initialized to a new object before being merged onto.\n\n## license\n\nMIT",
+ "_id": "defaults@1.0.0",
+ "dist": {
+ "shasum": "3ae25f44416c6c01f9809a25fcdd285912d2a6b1",
+ "tarball": "http://registry.npmjs.org/defaults/-/defaults-1.0.0.tgz"
+ },
+ "_npmVersion": "1.1.65",
+ "_npmUser": {
+ "name": "tmpvar",
+ "email": "tmpvar@gmail.com"
+ },
+ "maintainers": [
+ {
+ "name": "tmpvar",
+ "email": "tmpvar@gmail.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "3ae25f44416c6c01f9809a25fcdd285912d2a6b1",
+ "_from": "defaults@^1.0.0",
+ "_resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.0.tgz",
+ "bugs": {
+ "url": "https://github.com/tmpvar/defaults/issues"
+ },
+ "homepage": "https://github.com/tmpvar/defaults"
+}
--- /dev/null
+var defaults = require('./'),
+ test = require('tap').test;
+
+test("ensure options is an object", function(t) {
+ var options = defaults(false, { a : true });
+ t.ok(options.a);
+ t.end()
+});
+
+test("ensure defaults override keys", function(t) {
+ var result = defaults({}, { a: false, b: true });
+ t.ok(result.b, 'b merges over undefined');
+ t.equal(result.a, false, 'a merges over undefined');
+ t.end();
+});
+
+test("ensure defined keys are not overwritten", function(t) {
+ var result = defaults({ b: false }, { a: false, b: true });
+ t.equal(result.b, false, 'b not merged');
+ t.equal(result.a, false, 'a merges over undefined');
+ t.end();
+});
+
+test("ensure defaults clone nested objects", function(t) {
+ var d = { a: [1,2,3], b: { hello : 'world' } };
+ var result = defaults({}, d);
+ t.equal(result.a.length, 3, 'objects should be clones');
+ t.ok(result.a !== d.a, 'objects should be clones');
+
+ t.equal(Object.keys(result.b).length, 1, 'objects should be clones');
+ t.ok(result.b !== d.b, 'objects should be clones');
+ t.end();
+});
+
--- /dev/null
+{
+ "name": "wcwidth",
+ "version": "1.0.0",
+ "description": "Port of C's wcwidth() and wcswidth()",
+ "author": {
+ "name": "Tim Oxley"
+ },
+ "contributors": [
+ {
+ "name": "Woong Jun",
+ "email": "woong.jun@gmail.com",
+ "url": "http://code.woong.org/"
+ }
+ ],
+ "main": "index.js",
+ "dependencies": {
+ "defaults": "^1.0.0"
+ },
+ "devDependencies": {
+ "tape": "^2.13.4"
+ },
+ "license": "MIT",
+ "keywords": [
+ "wide character",
+ "wc",
+ "wide character string",
+ "wcs",
+ "terminal",
+ "width",
+ "wcwidth",
+ "wcswidth"
+ ],
+ "directories": {
+ "doc": "docs",
+ "test": "test"
+ },
+ "scripts": {
+ "test": "tape test/*.js"
+ },
+ "gitHead": "5bc3aafd45c89f233c27b9479c18a23ca91ba660",
+ "_id": "wcwidth@1.0.0",
+ "_shasum": "02d059ff7a8fc741e0f6b5da1e69b2b40daeca6f",
+ "_from": "wcwidth@^1.0.0",
+ "_npmVersion": "1.4.23",
+ "_npmUser": {
+ "name": "timoxley",
+ "email": "secoif@gmail.com"
+ },
+ "maintainers": [
+ {
+ "name": "timoxley",
+ "email": "secoif@gmail.com"
+ }
+ ],
+ "dist": {
+ "shasum": "02d059ff7a8fc741e0f6b5da1e69b2b40daeca6f",
+ "tarball": "http://registry.npmjs.org/wcwidth/-/wcwidth-1.0.0.tgz"
+ },
+ "_resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.0.tgz",
+ "readme": "ERROR: No README data found!"
+}
--- /dev/null
+"use strict"
+
+var wcwidth = require('../')
+var test = require('tape')
+
+test('handles regular strings', function(t) {
+ t.strictEqual(wcwidth('abc'), 3)
+ t.end()
+})
+
+test('handles multibyte strings', function(t) {
+ t.strictEqual(wcwidth('字的模块'), 8)
+ t.end()
+})
+
+test('handles multibyte characters mixed with regular characters', function(t) {
+ t.strictEqual(wcwidth('abc 字的模块'), 12)
+ t.end()
+})
+
+test('ignores control characters e.g. \\n', function(t) {
+ t.strictEqual(wcwidth('abc\n字的模块\ndef'), 14)
+ t.end()
+})
+
+test('ignores bad input', function(t) {
+ t.strictEqual(wcwidth(''), 0)
+ t.strictEqual(wcwidth(3), 0)
+ t.strictEqual(wcwidth({}), 0)
+ t.strictEqual(wcwidth([]), 0)
+ t.strictEqual(wcwidth(), 0)
+ t.end()
+})
+
+test('ignores nul (charcode 0)', function(t) {
+ t.strictEqual(wcwidth(String.fromCharCode(0)), 0)
+ t.end()
+})
+
+test('ignores nul mixed with chars', function(t) {
+ t.strictEqual(wcwidth('a' + String.fromCharCode(0) + '\n字的'), 5)
+ t.end()
+})
+
+test('can have custom value for nul', function(t) {
+ t.strictEqual(wcwidth.config({
+ nul: 10
+ })(String.fromCharCode(0) + 'a字的'), 15)
+ t.end()
+})
+
+test('can have custom control char value', function(t) {
+ t.strictEqual(wcwidth.config({
+ control: 1
+ })('abc\n字的模块\ndef'), 16)
+ t.end()
+})
+
+test('negative custom control chars == -1', function(t) {
+ t.strictEqual(wcwidth.config({
+ control: -1
+ })('abc\n字的模块\ndef'), -1)
+ t.end()
+})
{
"name": "columnify",
- "version": "1.1.0",
+ "version": "1.2.1",
"description": "Render data in text columns, supports in-column text-wrap.",
"main": "index.js",
"scripts": {
+ "pretest": "npm prune",
"test": "faucet"
},
"author": {
},
"homepage": "https://github.com/timoxley/columnify",
"dependencies": {
- "strip-ansi": "^0.2.1",
- "wcwidth.js": "~0.0.4"
+ "strip-ansi": "^1.0.0",
+ "wcwidth": "^1.0.0"
},
"directories": {
"test": "test"
},
- "_id": "columnify@1.1.0",
- "_shasum": "0b908e6d4f1c80194358a1933aaf9dc49271c679",
- "_from": "columnify@latest",
- "_npmVersion": "1.4.10",
+ "gitHead": "14e77bef3f57acaa3f390145915a9f2d2a4f882c",
+ "_id": "columnify@1.2.1",
+ "_shasum": "921ec51c178f4126d3c07e9acecd67a55c7953e4",
+ "_from": "columnify@^1.2.1",
+ "_npmVersion": "1.4.23",
"_npmUser": {
"name": "timoxley",
"email": "secoif@gmail.com"
}
],
"dist": {
- "shasum": "0b908e6d4f1c80194358a1933aaf9dc49271c679",
- "tarball": "http://registry.npmjs.org/columnify/-/columnify-1.1.0.tgz"
+ "shasum": "921ec51c178f4126d3c07e9acecd67a55c7953e4",
+ "tarball": "http://registry.npmjs.org/columnify/-/columnify-1.2.1.tgz"
},
- "_resolved": "https://registry.npmjs.org/columnify/-/columnify-1.1.0.tgz",
+ "_resolved": "https://registry.npmjs.org/columnify/-/columnify-1.2.1.tgz",
"readme": "ERROR: No README data found!"
}
var wcwidth = require('./width')
/**
+ * repeat string `str` up to total length of `len`
+ *
+ * @param String str string to repeat
+ * @param Number len total length of output string
+ */
+
+function repeatString(str, len) {
+ return Array.apply(null, {length: len + 1}).join(str).slice(0, len)
+}
+
+/**
* Pad `str` up to total length `max` with `chr`.
* If `str` is longer than `max`, padRight will return `str` unaltered.
*
function padRight(str, max, chr) {
str = str != null ? str : ''
str = String(str)
- var length = 1 + max - wcwidth(str)
+ var length = max - wcwidth(str)
if (length <= 0) return str
- return str + Array.apply(null, {length: length})
- .join(chr || ' ')
+ return str + repeatString(chr || ' ', length)
+}
+
+/**
+ * Pad `str` up to total length `max` with `chr`.
+ * If `str` is longer than `max`, padCenter will return `str` unaltered.
+ *
+ * @param String str string to pad
+ * @param Number max total length of output string
+ * @param String chr optional. Character to pad with. default: ' '
+ * @return String padded str
+ */
+
+function padCenter(str, max, chr) {
+ str = str != null ? str : ''
+ str = String(str)
+ var length = max - wcwidth(str)
+ if (length <= 0) return str
+ var lengthLeft = Math.floor(length/2)
+ var lengthRight = length - lengthLeft
+ return repeatString(chr || ' ', lengthLeft) + str + repeatString(chr || ' ', lengthRight)
}
/**
function padLeft(str, max, chr) {
str = str != null ? str : ''
str = String(str)
- var length = 1 + max - wcwidth(str)
+ var length = max - wcwidth(str)
if (length <= 0) return str
- return Array.apply(null, {length: length}).join(chr || ' ') + str
+ return repeatString(chr || ' ', length) + str
}
/**
*/
module.exports.padRight = padRight
+module.exports.padCenter = padCenter
module.exports.padLeft = padLeft
module.exports.splitIntoLines = splitIntoLines
module.exports.splitLongWords = splitLongWords
module.exports.truncateString = truncateString
-
var stripAnsi = require('strip-ansi')
-var wcwidth = require('wcwidth.js')({ monkeypatch: false, control: 0 })
+var wcwidth = require('wcwidth')
module.exports = function(str) {
return wcwidth(stripAnsi(str))
Writer.prototype._finish = function () {
var me = this
+ if (me._finishing) return
+ me._finishing = true
+
// console.error(" W Finish", me._path, me.size)
// set up all the things.
},
"name": "fstream",
"description": "Advanced file system stream things",
- "version": "1.0.0",
+ "version": "1.0.2",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/fstream.git"
"node": ">=0.6"
},
"dependencies": {
- "graceful-fs": "^3.0.2",
+ "graceful-fs": "3",
"inherits": "~2.0.0",
- "mkdirp": "^0.5.0",
+ "mkdirp": ">=0.5 0",
"rimraf": "2"
},
"devDependencies": {
"license": "BSD",
"readme": "Like FS streams, but with stat on them, and supporting directories and\nsymbolic links, as well as normal files. Also, you can use this to set\nthe stats on a file, even if you don't change its contents, or to create\na symlink, etc.\n\nSo, for example, you can \"write\" a directory, and it'll call `mkdir`. You\ncan specify a uid and gid, and it'll call `chown`. You can specify a\n`mtime` and `atime`, and it'll call `utimes`. You can call it a symlink\nand provide a `linkpath` and it'll call `symlink`.\n\nNote that it won't automatically resolve symbolic links. So, if you\ncall `fstream.Reader('/some/symlink')` then you'll get an object\nthat stats and then ends immediately (since it has no data). To follow\nsymbolic links, do this: `fstream.Reader({path:'/some/symlink', follow:\ntrue })`.\n\nThere are various checks to make sure that the bytes emitted are the\nsame as the intended size, if the size is set.\n\n## Examples\n\n```javascript\nfstream\n .Writer({ path: \"path/to/file\"\n , mode: 0755\n , size: 6\n })\n .write(\"hello\\n\")\n .end()\n```\n\nThis will create the directories if they're missing, and then write\n`hello\\n` into the file, chmod it to 0755, and assert that 6 bytes have\nbeen written when it's done.\n\n```javascript\nfstream\n .Writer({ path: \"path/to/file\"\n , mode: 0755\n , size: 6\n , flags: \"a\"\n })\n .write(\"hello\\n\")\n .end()\n```\n\nYou can pass flags in, if you want to append to a file.\n\n```javascript\nfstream\n .Writer({ path: \"path/to/symlink\"\n , linkpath: \"./file\"\n , SymbolicLink: true\n , mode: \"0755\" // octal strings supported\n })\n .end()\n```\n\nIf isSymbolicLink is a function, it'll be called, and if it returns\ntrue, then it'll treat it as a symlink. If it's not a function, then\nany truish value will make a symlink, or you can set `type:\n'SymbolicLink'`, which does the same thing.\n\nNote that the linkpath is relative to the symbolic link location, not\nthe parent dir or cwd.\n\n```javascript\nfstream\n .Reader(\"path/to/dir\")\n .pipe(fstream.Writer(\"path/to/other/dir\"))\n```\n\nThis will do like `cp -Rp path/to/dir path/to/other/dir`. If the other\ndir exists and isn't a directory, then it'll emit an error. It'll also\nset the uid, gid, mode, etc. to be identical. In this way, it's more\nlike `rsync -a` than simply a copy.\n",
"readmeFilename": "README.md",
- "gitHead": "1468b5b583646cd4f5c535e6b53c8896a4fed40f",
+ "gitHead": "b3b74e92ef4a91ae206fab90b7998c7cd2e4290d",
"bugs": {
"url": "https://github.com/isaacs/fstream/issues"
},
"homepage": "https://github.com/isaacs/fstream",
- "_id": "fstream@1.0.0",
- "_shasum": "7feb8b42ebc588485bf3676a00bd048d4a2e1c28",
+ "_id": "fstream@1.0.2",
+ "_shasum": "56930ff1b4d4d7b1a689c8656b3a11e744ab92c6",
"_from": "fstream@latest"
}
parse(url).should.eql('https://github.com/bcoe/thumbd');
})
+ it('should parse git+https://github.com/bcoe/thumbd.git', function() {
+ var url = 'git+https://github.com/bcoe/thumbd.git';
+ parse(url).should.eql('https://github.com/bcoe/thumbd');
+ })
+
+ it('should parse git+ssh://github.com/bcoe/thumbd.git', function() {
+ var url = 'git+ssh://github.com/bcoe/thumbd.git';
+ parse(url).should.eql('https://github.com/bcoe/thumbd');
+ })
+
it('should parse https://EastCloud@github.com/EastCloud/node-websockets.git', function() {
var url = 'https://EastCloud@github.com/EastCloud/node-websockets.git';
parse(url).should.eql('https://github.com/EastCloud/node-websockets');
var baseUrls = ['gist.github.com', 'github.com'].concat(opts.extraBaseUrls || []);
// build regex from whitelist.
return new RegExp(
- /^(?:https?:\/\/|git:\/\/)?(?:[^@]+@)?/.source +
+ /^(?:https?:\/\/|git:\/\/|git\+ssh:\/\/|git\+https:\/\/)?(?:[^@]+@)?/.source +
'(' + baseUrls.join('|') + ')' +
/[:\/]([^\/]+\/[^\/]+?|[0-9]+)$/.source
);
{
"name": "github-url-from-git",
- "version": "1.3.0",
+ "version": "1.4.0",
"description": "Parse a github git url and return the github repo url",
"main": "index.js",
"scripts": {
"mocha": "~1.9.0",
"should": "~1.2.2"
},
- "gitHead": "d92a033d7e769264f17ae8ef4409e6a31e0cd016",
+ "gitHead": "154df00b0b590c29be5d2a5822e7b2e160b75345",
"bugs": {
"url": "https://github.com/visionmedia/node-github-url-from-git/issues"
},
"homepage": "https://github.com/visionmedia/node-github-url-from-git",
- "_id": "github-url-from-git@1.3.0",
- "_shasum": "6e79d9779632ca78aa645c67bb419f70e51d69f7",
- "_from": "github-url-from-git@latest",
- "_npmVersion": "1.5.0-alpha-4",
+ "_id": "github-url-from-git@1.4.0",
+ "_shasum": "285e6b520819001bde128674704379e4ff03e0de",
+ "_from": "github-url-from-git@^1.4.0",
+ "_npmVersion": "2.0.0-alpha.7",
"_npmUser": {
"name": "bcoe",
"email": "bencoe@gmail.com"
}
],
"dist": {
- "shasum": "6e79d9779632ca78aa645c67bb419f70e51d69f7",
- "tarball": "http://registry.npmjs.org/github-url-from-git/-/github-url-from-git-1.3.0.tgz"
+ "shasum": "285e6b520819001bde128674704379e4ff03e0de",
+ "tarball": "http://registry.npmjs.org/github-url-from-git/-/github-url-from-git-1.4.0.tgz"
},
"directories": {},
- "_resolved": "https://registry.npmjs.org/github-url-from-git/-/github-url-from-git-1.3.0.tgz",
+ "_resolved": "https://registry.npmjs.org/github-url-from-git/-/github-url-from-git-1.4.0.tgz",
"readme": "ERROR: No README data found!"
}
parse(url).should.eql('https://github.com/bcoe/thumbd');
})
+ it('should parse git+https://github.com/bcoe/thumbd.git', function() {
+ var url = 'git+https://github.com/bcoe/thumbd.git';
+ parse(url).should.eql('https://github.com/bcoe/thumbd');
+ })
+
+ it('should parse git+ssh://github.com/bcoe/thumbd.git', function() {
+ var url = 'git+ssh://github.com/bcoe/thumbd.git';
+ parse(url).should.eql('https://github.com/bcoe/thumbd');
+ })
+
it('should parse https://EastCloud@github.com/EastCloud/node-websockets.git', function() {
var url = 'https://EastCloud@github.com/EastCloud/node-websockets.git';
parse(url).should.eql('https://github.com/EastCloud/node-websockets');
describe('re', function() {
it('should expose GitHub url parsing regex', function() {
parse.re.source.should.equal(
- /^(?:https?:\/\/|git:\/\/)?(?:[^@]+@)?(gist.github.com|github.com)[:\/]([^\/]+\/[^\/]+?|[0-9]+)$/.source
+ /^(?:https?:\/\/|git:\/\/|git\+ssh:\/\/|git\+https:\/\/)?(?:[^@]+@)?(gist.github.com|github.com)[:\/]([^\/]+\/[^\/]+?|[0-9]+)$/.source
)
});
})
# github-url-from-username-repo
+## API
+
+### getUrl(url, [forBrowser])
+
+Get's the url normalized for npm.
+If `forBrowser` is true, return a GitHub url that is usable in a webbrowser.
+
## Usage
```javascript
var getUrl = require("github-url-from-username-repo")
-getUrl("visionmedia/express") // git://github.com/visionmedia/express
+getUrl("visionmedia/express") // https://github.com/visionmedia/express
-```
\ No newline at end of file
+```
module.exports = getUrl
-function getUrl (r) {
+function getUrl (r, forBrowser) {
if (!r) return null
- if (/^[\w-]+\/[\w\.-]+$/.test(r))
+ if (/^[\w-]+\/[\w\.-]+(#[a-z0-9]*)?$/.test(r)) {
+ if (forBrowser)
+ r = r.replace("#", "/tree/")
return "https://github.com/" + r
- else
- return null
+ }
+
+ return null
}
{
"name": "github-url-from-username-repo",
- "version": "0.2.0",
+ "version": "1.0.0",
"description": "Create urls from username/repo",
"main": "index.js",
"scripts": {
"github",
"repo"
],
+ "gitHead": "d5b3c01193504d67b3ecc030e93d5c58c9b0df63",
"homepage": "https://github.com/robertkowalski/github-url-from-username-repo",
- "_id": "github-url-from-username-repo@0.2.0",
- "_shasum": "7590b4fa605b7a6cbb7e06ffcd9d253210f9dbe1",
- "_from": "github-url-from-username-repo@latest",
- "_npmVersion": "1.4.9",
+ "_id": "github-url-from-username-repo@1.0.0",
+ "_shasum": "848d4f19bc838dc428484ce0dc33da593e8400ed",
+ "_from": "github-url-from-username-repo@^1.0.0",
+ "_npmVersion": "1.4.21",
"_npmUser": {
"name": "robertkowalski",
"email": "rok@kowalski.gd"
{
"name": "robertkowalski",
"email": "rok@kowalski.gd"
+ },
+ {
+ "name": "othiym23",
+ "email": "ogd@aoaioxxysz.net"
+ },
+ {
+ "name": "forbeslindesay",
+ "email": "forbes@lindesay.co.uk"
}
],
"dist": {
- "shasum": "7590b4fa605b7a6cbb7e06ffcd9d253210f9dbe1",
- "tarball": "http://registry.npmjs.org/github-url-from-username-repo/-/github-url-from-username-repo-0.2.0.tgz"
+ "shasum": "848d4f19bc838dc428484ce0dc33da593e8400ed",
+ "tarball": "http://registry.npmjs.org/github-url-from-username-repo/-/github-url-from-username-repo-1.0.0.tgz"
},
"directories": {},
- "_resolved": "https://registry.npmjs.org/github-url-from-username-repo/-/github-url-from-username-repo-0.2.0.tgz"
+ "_resolved": "https://registry.npmjs.org/github-url-from-username-repo/-/github-url-from-username-repo-1.0.0.tgz"
}
})
it("works with .", function () {
- var url = getUrl("component/downloader.js")
- assert.equal("https://github.com/component/downloader.js", url)
+ var url = getUrl("component/.download.er.js.")
+ assert.equal("https://github.com/component/.download.er.js.", url)
})
it("works with . in the beginning", function () {
var url = getUrl("component/-dow-nloader.j-s")
assert.equal("https://github.com/component/-dow-nloader.j-s", url)
})
+
+ it("can handle branches with #", function () {
+ var url = getUrl(
+ "component/entejs#1c3e1fe71640b4b477f04d947bd53c473799b277")
+
+ assert.equal("https://github.com/component/entejs#1c3e1fe71640b" +
+ "4b477f04d947bd53c473799b277", url)
+ })
+
+ describe("browser mode", function () {
+ it("is able to return urls for branches", function () {
+ var url = getUrl(
+ "component/entejs#1c3e1fe71640b4b477f04d947bd53c473799b277", true)
+
+ assert.equal("https://github.com/component/entejs/tree/1c3e1fe71640b" +
+ "4b477f04d947bd53c473799b277", url)
+ })
+ it("is able to return urls without a branch for the browser", function () {
+ var url = getUrl(
+ "component/entejs", true)
+
+ assert.equal("https://github.com/component/entejs", url)
+ })
+ })
})
### opts.wait
A number of milliseconds to wait for locks to expire before giving up.
-Only used by lockFile.lock. Relies on fs.watch. If the lock is not
-cleared by the time the wait expires, then it returns with the original
-error.
+Only used by lockFile.lock. Poll for `opts.wait` ms. If the lock is
+not cleared by the time the wait expires, then it returns with the
+original error.
+
+### opts.pollPeriod
+
+When using `opts.wait`, this is the period in ms in which it polls to
+check if the lock has expired. Defaults to `100`.
### opts.stale
}
var os = require('os')
-var filetime = 'ctime'
+exports.filetime = 'ctime'
if (os.platform() == "win32") {
- filetime = 'mtime'
+ exports.filetime = 'mtime'
}
var debug
})
fs.close(fd, function (er) {
- var age = Date.now() - st[filetime].getTime()
+ var age = Date.now() - st[exports.filetime].getTime()
return cb(er, age <= opts.stale)
})
})
} finally {
fs.closeSync(fd)
}
- var age = Date.now() - st[filetime].getTime()
+ var age = Date.now() - st[exports.filetime].getTime()
return (age <= opts.stale)
}
}
-var req = 0
+var req = 1
exports.lock = function (path, opts, cb) {
if (typeof opts === 'function') cb = opts, opts = {}
opts.req = opts.req || req++
debug('lock', path, opts)
+ opts.start = opts.start || Date.now()
if (typeof opts.retries === 'number' && opts.retries > 0) {
- cb = (function (orig) { return function (er, fd) {
- if (!er) return orig(er, fd)
- var newRT = opts.retries - 1
- opts_ = Object.create(opts, { retries: { value: newRT }})
- debug('lock retry', path, newRT)
- if (opts.retryWait) setTimeout(function() {
- exports.lock(path, opts_, orig)
- }, opts.retryWait)
- else exports.lock(path, opts_, orig)
+ debug('has retries', opts.retries)
+ var retries = opts.retries
+ opts.retries = 0
+ cb = (function (orig) { return function cb (er, fd) {
+ debug('retry-mutated callback')
+ retries -= 1
+ if (!er || retries < 0) return orig(er, fd)
+
+ debug('lock retry', path, opts)
+
+ if (opts.retryWait) setTimeout(retry, opts.retryWait)
+ else retry()
+
+ function retry () {
+ opts.start = Date.now()
+ debug('retrying', opts.start)
+ exports.lock(path, opts, cb)
+ }
}})(cb)
}
if (er.code !== 'EEXIST') return cb(er)
// someone's got this one. see if it's valid.
- if (opts.stale) fs.stat(path, function (statEr, st) {
- if (statEr) {
- if (statEr.code === 'ENOENT') {
- // expired already!
- var opts_ = Object.create(opts, { stale: { value: false }})
- debug('lock stale enoent retry', path, opts_)
- exports.lock(path, opts_, cb)
- return
- }
- return cb(statEr)
+ if (!opts.stale) return notStale(er, path, opts, cb)
+
+ return maybeStale(er, path, opts, false, cb)
+ })
+}
+
+
+// Staleness checking algorithm
+// 1. acquire $lock, fail
+// 2. stat $lock, find that it is stale
+// 3. acquire $lock.STALE
+// 4. stat $lock, assert that it is still stale
+// 5. unlink $lock
+// 6. link $lock.STALE $lock
+// 7. unlink $lock.STALE
+// On any failure, clean up whatever we've done, and raise the error.
+function maybeStale (originalEr, path, opts, hasStaleLock, cb) {
+ fs.stat(path, function (statEr, st) {
+ if (statEr) {
+ if (statEr.code === 'ENOENT') {
+ // expired already!
+ opts.stale = false
+ debug('lock stale enoent retry', path, opts)
+ exports.lock(path, opts, cb)
+ return
}
+ return cb(statEr)
+ }
- var age = Date.now() - st[filetime].getTime()
- if (age > opts.stale) {
- debug('lock stale', path, opts_)
- exports.unlock(path, function (er) {
- if (er) return cb(er)
- var opts_ = Object.create(opts, { stale: { value: false }})
- debug('lock stale retry', path, opts_)
- exports.lock(path, opts_, cb)
+ var age = Date.now() - st[exports.filetime].getTime()
+ if (age <= opts.stale) return notStale(originalEr, path, opts, cb)
+
+ debug('lock stale', path, opts)
+ if (hasStaleLock) {
+ exports.unlock(path, function (er) {
+ if (er) return cb(er)
+ debug('lock stale retry', path, opts)
+ fs.link(path + '.STALE', path, function (er) {
+ fs.unlink(path + '.STALE', function () {
+ // best effort. if the unlink fails, oh well.
+ cb(er)
+ })
})
- } else notStale(er, path, opts, cb)
- })
- else notStale(er, path, opts, cb)
+ })
+ } else {
+ debug('acquire .STALE file lock', opts)
+ exports.lock(path + '.STALE', opts, function (er) {
+ if (er) return cb(er)
+ maybeStale(originalEr, path, opts, true, cb)
+ })
+ }
})
}
if (typeof opts.wait !== 'number' || opts.wait <= 0)
return cb(er)
- // console.error('wait', path, opts.wait)
- // wait for some ms for the lock to clear
- var start = Date.now()
+ // poll for some ms for the lock to clear
+ var now = Date.now()
+ var start = opts.start || now
var end = start + opts.wait
- function retry () {
- debug('notStale retry', path, opts)
- var now = Date.now()
- var newWait = end - now
- var newOpts = Object.create(opts, { wait: { value: newWait }})
- exports.lock(path, newOpts, cb)
- }
+ if (end <= now)
+ return cb(er)
- var timer = setTimeout(retry, 100)
+ debug('now=%d, wait until %d (delta=%d)', start, end, end-start)
+ var wait = Math.min(end - start, opts.pollPeriod || 100)
+ var timer = setTimeout(poll, wait)
+
+ function poll () {
+ debug('notStale, polling', path, opts)
+ exports.lock(path, opts, cb)
+ }
}
exports.lockSync = function (path, opts) {
if (opts.stale) {
var st = fs.statSync(path)
- var ct = st[filetime].getTime()
+ var ct = st[exports.filetime].getTime()
if (!(ct % 1000) && (opts.stale % 1000)) {
// probably don't have subsecond resolution.
// round up the staleness indicator.
if (typeof opts.retries === 'number' && opts.retries > 0) {
var newRT = opts.retries - 1
debug('retryThrow', path, opts, newRT)
- var opts_ = Object.create(opts, { retries: { value: newRT }})
- return exports.lockSync(path, opts_)
+ opts.retries = newRT
+ return exports.lockSync(path, opts)
}
throw er
}
{
"name": "lockfile",
- "version": "0.4.2",
+ "version": "1.0.0",
"main": "lockfile.js",
"directories": {
"test": "test"
},
"license": "BSD",
"description": "A very polite lock file utility, which endeavors to not litter, and to wait patiently for others.",
- "readme": "# lockfile\n\nA very polite lock file utility, which endeavors to not litter, and to\nwait patiently for others.\n\n## Usage\n\n```javascript\nvar lockFile = require('lockfile')\n\n// opts is optional, and defaults to {}\nlockFile.lock('some-file.lock', opts, function (er) {\n // if the er happens, then it failed to acquire a lock.\n // if there was not an error, then the file was created,\n // and won't be deleted until we unlock it.\n\n // do my stuff, free of interruptions\n // then, some time later, do:\n lockFile.unlock('some-file.lock', function (er) {\n // er means that an error happened, and is probably bad.\n })\n})\n```\n\n## Methods\n\nSync methods return the value/throw the error, others don't. Standard\nnode fs stuff.\n\nAll known locks are removed when the process exits. Of course, it's\npossible for certain types of failures to cause this to fail, but a best\neffort is made to not be a litterbug.\n\n### lockFile.lock(path, [opts], cb)\n\nAcquire a file lock on the specified path\n\n### lockFile.lockSync(path, [opts])\n\nAcquire a file lock on the specified path\n\n### lockFile.unlock(path, cb)\n\nClose and unlink the lockfile.\n\n### lockFile.unlockSync(path)\n\nClose and unlink the lockfile.\n\n### lockFile.check(path, [opts], cb)\n\nCheck if the lockfile is locked and not stale.\n\nReturns boolean.\n\n### lockFile.checkSync(path, [opts], cb)\n\nCheck if the lockfile is locked and not stale.\n\nCallback is called with `cb(error, isLocked)`.\n\n## Options\n\n### opts.wait\n\nA number of milliseconds to wait for locks to expire before giving up.\nOnly used by lockFile.lock. Relies on fs.watch. If the lock is not\ncleared by the time the wait expires, then it returns with the original\nerror.\n\n### opts.stale\n\nA number of milliseconds before locks are considered to have expired.\n\n### opts.retries\n\nUsed by lock and lockSync. Retry `n` number of times before giving up.\n\n### opts.retryWait\n\nUsed by lock. Wait `n` milliseconds before retrying.\n",
+ "readme": "# lockfile\n\nA very polite lock file utility, which endeavors to not litter, and to\nwait patiently for others.\n\n## Usage\n\n```javascript\nvar lockFile = require('lockfile')\n\n// opts is optional, and defaults to {}\nlockFile.lock('some-file.lock', opts, function (er) {\n // if the er happens, then it failed to acquire a lock.\n // if there was not an error, then the file was created,\n // and won't be deleted until we unlock it.\n\n // do my stuff, free of interruptions\n // then, some time later, do:\n lockFile.unlock('some-file.lock', function (er) {\n // er means that an error happened, and is probably bad.\n })\n})\n```\n\n## Methods\n\nSync methods return the value/throw the error, others don't. Standard\nnode fs stuff.\n\nAll known locks are removed when the process exits. Of course, it's\npossible for certain types of failures to cause this to fail, but a best\neffort is made to not be a litterbug.\n\n### lockFile.lock(path, [opts], cb)\n\nAcquire a file lock on the specified path\n\n### lockFile.lockSync(path, [opts])\n\nAcquire a file lock on the specified path\n\n### lockFile.unlock(path, cb)\n\nClose and unlink the lockfile.\n\n### lockFile.unlockSync(path)\n\nClose and unlink the lockfile.\n\n### lockFile.check(path, [opts], cb)\n\nCheck if the lockfile is locked and not stale.\n\nReturns boolean.\n\n### lockFile.checkSync(path, [opts], cb)\n\nCheck if the lockfile is locked and not stale.\n\nCallback is called with `cb(error, isLocked)`.\n\n## Options\n\n### opts.wait\n\nA number of milliseconds to wait for locks to expire before giving up.\nOnly used by lockFile.lock. Poll for `opts.wait` ms. If the lock is\nnot cleared by the time the wait expires, then it returns with the\noriginal error.\n\n### opts.pollPeriod\n\nWhen using `opts.wait`, this is the period in ms in which it polls to\ncheck if the lock has expired. Defaults to `100`.\n\n### opts.stale\n\nA number of milliseconds before locks are considered to have expired.\n\n### opts.retries\n\nUsed by lock and lockSync. Retry `n` number of times before giving up.\n\n### opts.retryWait\n\nUsed by lock. Wait `n` milliseconds before retrying.\n",
"readmeFilename": "README.md",
+ "gitHead": "9590c6f02521eb1bb154ddc3ca9a7e84ce770c45",
"bugs": {
"url": "https://github.com/isaacs/lockfile/issues"
},
- "_id": "lockfile@0.4.2",
- "dist": {
- "shasum": "ab91f5d3745bc005ae4fa34d078910d1f2b9612d"
- },
- "_from": "lockfile@0.4.2",
- "_resolved": "https://registry.npmjs.org/lockfile/-/lockfile-0.4.2.tgz"
+ "homepage": "https://github.com/isaacs/lockfile",
+ "_id": "lockfile@1.0.0",
+ "_shasum": "b3a7609dda6012060083bacb0ab0ecbca58e9203",
+ "_from": "lockfile@latest"
}
var fs = require('fs')
var touch = require('touch')
+// On Unix systems, it uses ctime by default for staleness checks, since it's
+// the most reliable. However, because this test artificially sets some locks
+// to an earlier time to simulate staleness, we use mtime here.
+lockFile.filetime = 'mtime'
+
test('setup', function (t) {
try { lockFile.unlockSync('basic-lock') } catch (er) {}
try { lockFile.unlockSync('sync-lock') } catch (er) {}
lockFile.lock('stale-lock', function (er) {
if (er) throw er
+ // simulate 2s old
+ touch.sync('stale-lock', { time: new Date(Date.now() - 2000) })
+
var opts = { stale: 1 }
- setTimeout(next, 1000)
- function next () {
- lockFile.check('stale-lock', opts, function (er, locked) {
+ lockFile.check('stale-lock', opts, function (er, locked) {
+ if (er) throw er
+ t.notOk(locked)
+ lockFile.lock('stale-lock', opts, function (er) {
if (er) throw er
- t.notOk(locked)
- lockFile.lock('stale-lock', opts, function (er) {
+ lockFile.unlock('stale-lock', function (er) {
if (er) throw er
- lockFile.unlock('stale-lock', function (er) {
- if (er) throw er
- t.end()
- })
+ t.end()
})
})
- }
+ })
})
})
test('staleness sync test', function (t) {
var opts = { stale: 1 }
lockFile.lockSync('stale-lock')
- setTimeout(next, 1000)
- function next () {
- var locked
- locked = lockFile.checkSync('stale-lock', opts)
- t.notOk(locked)
- lockFile.lockSync('stale-lock', opts)
- lockFile.unlockSync('stale-lock')
- t.end()
- }
+ // simulate 2s old
+ touch.sync('stale-lock', { time: new Date(Date.now() - 2000) })
+ var locked
+ locked = lockFile.checkSync('stale-lock', opts)
+ t.notOk(locked)
+ lockFile.lockSync('stale-lock', opts)
+ lockFile.unlockSync('stale-lock')
+ t.end()
})
test('retries', function (t) {
}, 10)
// try to get another lock. this must fail!
- var opt = { stale: 1000, wait: 2000 }
+ var opt = { stale: 1000, wait: 2000, pollInterval: 1000 }
lockFile.lock('stale-wait-lock', opt, function (er) {
if (!er)
t.fail('got second lock? that unpossible!')
// nt file system tunneling feature will make file creation time not updated
var opts = { stale: 1000 }
lockFile.lockSync('stale-windows-lock')
- setTimeout(next, 2000)
- function next () {
- var locked
- lockFile.unlockSync('stale-windows-lock')
- lockFile.lockSync('stale-windows-lock', opts)
- locked = lockFile.checkSync('stale-windows-lock', opts)
- t.ok(locked, "should be locked and not stale")
- lockFile.lock('stale-windows-lock', opts, function (er) {
- if (!er)
- t.fail('got second lock? impossible, windows file tunneling problem!')
- else
- t.pass('second lock failed, windows file tunneling problem fixed')
- t.end()
- })
- }
+ touch.sync('stale-windows-lock', { time: new Date(Date.now() - 3000) })
+
+ var locked
+ lockFile.unlockSync('stale-windows-lock')
+ lockFile.lockSync('stale-windows-lock', opts)
+ locked = lockFile.checkSync('stale-windows-lock', opts)
+ t.ok(locked, "should be locked and not stale")
+ lockFile.lock('stale-windows-lock', opts, function (er) {
+ if (!er)
+ t.fail('got second lock? impossible, windows file tunneling problem!')
+ else
+ t.pass('second lock failed, windows file tunneling problem fixed')
+ t.end()
+ })
})
try { lockFile.unlockSync('retry-lock') } catch (er) {}
try { lockFile.unlockSync('contentious-lock') } catch (er) {}
try { lockFile.unlockSync('stale-wait-lock') } catch (er) {}
- try { lockFile.unlockSync('stale-windows-lock') } catch (er) {}
+ try { lockFile.unlockSync('stale-windows-lock') } catch (er) {}
t.end()
})
--- /dev/null
+// In these tests, we do the following:
+// try for 200ms (rt=2)
+// wait for 300ms
+// try for 200ms (rt=1)
+// wait for 300ms
+// try for 200ms (rt=0)
+// fail after 1200
+// Actual time will be more like 1220-ish for setTimeout irregularity
+// But it should NOT be as slow as 2000.
+
+var lockFile = require('../')
+var touch = require('touch')
+var test = require('tap').test
+var fs = require('fs')
+
+var RETRYWAIT = 100
+var WAIT = 100
+var RETRIES = 2
+var EXPECTTIME = (RETRYWAIT * RETRIES) + (WAIT * (RETRIES + 1))
+var TOOLONG = EXPECTTIME * 1.1
+
+test('setup', function (t) {
+ touch.sync('file.lock')
+ t.end()
+})
+
+var pollPeriods = [10, 100, 10000]
+pollPeriods.forEach(function (pp) {
+ test('retry+wait, poll=' + pp, function (t) {
+ var ended = false
+ var timer = setTimeout(function() {
+ t.fail('taking too long!')
+ ended = true
+ t.end()
+ }, 2000)
+ timer.unref()
+
+ var start = Date.now()
+ lockFile.lock('file.lock', {
+ wait: WAIT,
+ retries: RETRIES,
+ retryWait: RETRYWAIT,
+ pollPeriod: pp
+ }, function (er) {
+ if (ended) return
+ var time = Date.now() - start
+ console.error('t=%d', time)
+ t.ok(time >= EXPECTTIME, 'should take at least ' + EXPECTTIME)
+ t.ok(time < TOOLONG, 'should take less than ' + TOOLONG)
+ clearTimeout(timer)
+ t.end()
+ })
+ })
+})
+
+test('cleanup', function (t) {
+ fs.unlinkSync('file.lock')
+ t.end()
+ setTimeout(function() {
+ process.exit(1)
+ }, 500).unref()
+})
--- /dev/null
+var fs = require('fs')
+var lockFile = require('../')
+var test = require('tap').test
+var path = require('path')
+var lock = path.resolve(__dirname, 'stale.lock')
+var touch = require('touch')
+var spawn = require('child_process').spawn
+var node = process.execPath
+
+// We're using a lockfile with an artificially old date,
+// so make it use that instead of ctime.
+// Probably you should never do this in production!
+lockFile.filetime = 'mtime'
+
+if (process.argv[2] === 'child') {
+ return child()
+}
+
+function child () {
+ // Make fs.stat take 100ms to return its data
+ // This is important because, in a test scenario where
+ // we're statting the same exact file rapid-fire like this,
+ // it'll end up being cached by the FS, and never trigger
+ // the race condition we're trying to expose.
+ fs.stat = function (stat) { return function () {
+ var args = [].slice.call(arguments)
+ var cb = args.pop()
+ stat.apply(fs, args.concat(function(er, st) {
+ setTimeout(function () {
+ cb(er, st)
+ }, 100)
+ }))
+ }}(fs.stat)
+
+ lockFile.lock(lock, { stale: 100000 }, function (er) {
+ if (er && er.code !== 'EEXIST')
+ throw er
+ else if (er)
+ process.exit(17)
+ else
+ setTimeout(function(){}, 500)
+ })
+}
+
+test('create stale file', function (t) {
+ try { fs.unlinkSync(lock) } catch (er) {}
+ touch.sync(lock, { time: '1979-07-01T19:10:00.000Z' })
+ t.end()
+})
+
+test('contenders', function (t) {
+ var n = 10
+ var fails = 0
+ var wins = 0
+ var args = [ __filename, 'child' ]
+ var opt = { stdio: [0, "pipe", 2] }
+ for (var i = 0; i < n; i++) {
+ spawn(node, args, opt).on('close', then)
+ }
+
+ function then (code) {
+ if (code === 17) {
+ fails ++
+ } else if (code) {
+ t.fail("unexpected failure", code)
+ fails ++
+ } else {
+ wins ++
+ }
+ if (fails + wins === n) {
+ done()
+ }
+ }
+
+ function done () {
+ t.equal(wins, 1, "should have 1 lock winner")
+ t.equal(fails, n - 1, "all others should lose")
+ t.end()
+ }
+})
+
+test('remove stale file', function (t) {
+ try { fs.unlinkSync(lock) } catch (er) {}
+ t.end()
+})
}
if (auth && authRequired) {
- remote.auth = new Buffer(auth, "base64").toString("utf8")
+ // Escape any weird characters that might be in the auth string
+ // TODO(isaacs) Clean up this awful back and forth mess.
+ var remoteAuth = new Buffer(auth, "base64").toString("utf8")
+ remoteAuth = encodeURIComponent(remoteAuth).replace(/%3A/, ":")
+ remote.auth = remoteAuth
}
// Tuned to spread 3 attempts over about a minute.
self.log.info("retry", "will retry, error on last attempt: " + er)
return
}
- if (response)
+ if (response) {
this.log.verbose("headers", response.headers)
+ if (response.headers["npm-notice"]) {
+ this.log.warn("notice", response.headers["npm-notice"])
+ }
+ }
cb.apply(null, arguments)
}.bind(this))
}.bind(this))
},
"name": "npm-registry-client",
"description": "Client for the npm registry",
- "version": "2.0.4",
+ "version": "2.0.7",
"repository": {
"url": "git://github.com/isaacs/npm-registry-client"
},
"npmlog": ""
},
"license": "ISC",
- "gitHead": "a10f621d9cdc813b9d3092a14b661f65bfa6d40d",
+ "readme": "# npm-registry-client\n\nThe code that npm uses to talk to the registry.\n\nIt handles all the caching and HTTP calls.\n\n## Usage\n\n```javascript\nvar RegClient = require('npm-registry-client')\nvar client = new RegClient(config)\nvar uri = \"npm://registry.npmjs.org/npm\"\nvar options = {timeout: 1000}\n\nclient.get(uri, options, function (error, data, raw, res) {\n // error is an error if there was a problem.\n // data is the parsed data object\n // raw is the json string\n // res is the response from couch\n})\n```\n\n# Registry URLs\n\nThe registry calls take either a full URL pointing to a resource in the\nregistry, or a base URL for the registry as a whole (for the base URL, any path\nwill be ignored). In addition to `http` and `https`, `npm` URLs are allowed.\n`npm` URLs are `https` URLs with the additional restrictions that they will\nalways include authorization credentials, and the response is always registry\nmetadata (and not tarballs or other attachments).\n\n# Configuration\n\nThis program is designed to work with\n[npmconf](https://npmjs.org/package/npmconf), but you can also pass in\na plain-jane object with the appropriate configs, and it'll shim it\nfor you. Any configuration thingie that has get/set/del methods will\nalso be accepted.\n\n* `cache` **Required** {String} Path to the cache folder\n* `always-auth` {Boolean} Auth even for GET requests.\n* `auth` {String} A base64-encoded `username:password`\n* `email` {String} User's email address\n* `tag` {String} The default tag to use when publishing new packages.\n Default = `\"latest\"`\n* `ca` {String} Cerficate signing authority certificates to trust.\n* `cert` {String} Client certificate (PEM encoded). Enable access\n to servers that require client certificates\n* `key` {String} Private key (PEM encoded) for client certificate 'cert'\n* `strict-ssl` {Boolean} Whether or not to be strict with SSL\n certificates. Default = `true`\n* `user-agent` {String} User agent header to send. Default =\n `\"node/{process.version} {process.platform} {process.arch}\"`\n* `log` {Object} The logger to use. Defaults to `require(\"npmlog\")` if\n that works, otherwise logs are disabled.\n* `fetch-retries` {Number} Number of times to retry on GET failures.\n Default=2\n* `fetch-retry-factor` {Number} `factor` setting for `node-retry`. Default=10\n* `fetch-retry-mintimeout` {Number} `minTimeout` setting for `node-retry`.\n Default=10000 (10 seconds)\n* `fetch-retry-maxtimeout` {Number} `maxTimeout` setting for `node-retry`.\n Default=60000 (60 seconds)\n* `proxy` {URL} The url to proxy requests through.\n* `https-proxy` {URL} The url to proxy https requests through.\n Defaults to be the same as `proxy` if unset.\n* `_auth` {String} The base64-encoded authorization header.\n* `username` `_password` {String} Username/password to use to generate\n `_auth` if not supplied.\n* `_token` {Object} A token for use with\n [couch-login](https://npmjs.org/package/couch-login)\n\n# client.request(method, uri, options, cb)\n\n* `method` {String} HTTP method\n* `uri` {String} URI pointing to the resource to request\n* `options` {Object} Object containing optional per-request properties.\n * `what` {Stream | Buffer | String | Object} The request body. Objects\n that are not Buffers or Streams are encoded as JSON.\n * `etag` {String} The cached ETag\n * `follow` {Boolean} Follow 302/301 responses (defaults to true)\n* `cb` {Function}\n * `error` {Error | null}\n * `data` {Object} the parsed data object\n * `raw` {String} the json\n * `res` {Response Object} response from couch\n\nMake a request to the registry. All the other methods are wrappers around\n`request`.\n\n# client.adduser(base, username, password, email, cb)\n\n* `base` {String} Base registry URL\n* `username` {String}\n* `password` {String}\n* `email` {String}\n* `cb` {Function}\n\nAdd a user account to the registry, or verify the credentials.\n\n# client.deprecate(uri, version, message, cb)\n\n* `uri` {String} Full registry URI for the deprecated package\n* `version` {String} Semver version range\n* `message` {String} The message to use as a deprecation warning\n* `cb` {Function}\n\nDeprecate a version of a package in the registry.\n\n# client.bugs(uri, cb)\n\n* `uri` {String} Full registry URI for the package\n* `cb` {Function}\n\nGet the url for bugs of a package\n\n# client.get(uri, options, cb)\n\n* `uri` {String} The complete registry URI to fetch\n* `options` {Object} Object containing optional per-request properties.\n * `timeout` {Number} Duration before the request times out.\n * `follow` {Boolean} Follow 302/301 responses (defaults to true)\n * `staleOk` {Boolean} If there's cached data available, then return that\n to the callback quickly, and update the cache the background.\n\nFetches data from the registry via a GET request, saving it in the cache folder\nwith the ETag.\n\n# client.publish(uri, data, tarball, cb)\n\n* `uri` {String} The registry URI to publish to\n* `data` {Object} Package data\n* `tarball` {String | Stream} Filename or stream of the package tarball\n* `cb` {Function}\n\nPublish a package to the registry.\n\nNote that this does not create the tarball from a folder. However, it can\naccept a gzipped tar stream or a filename to a tarball.\n\n# client.star(uri, starred, cb)\n\n* `uri` {String} The complete registry URI to star\n* `starred` {Boolean} True to star the package, false to unstar it.\n* `cb` {Function}\n\nStar or unstar a package.\n\nNote that the user does not have to be the package owner to star or unstar a\npackage, though other writes do require that the user be the package owner.\n\n# client.stars(base, username, cb)\n\n* `base` {String} The base URL for the registry\n* `username` {String} Name of user to fetch starred packages for.\n* `cb` {Function}\n\nView your own or another user's starred packages.\n\n# client.tag(uri, version, tag, cb)\n\n* `uri` {String} The complete registry URI to tag\n* `version` {String} Version to tag\n* `tag` {String} Tag name to apply\n* `cb` {Function}\n\nMark a version in the `dist-tags` hash, so that `pkg@tag` will fetch the\nspecified version.\n\n# client.unpublish(uri, [ver], cb)\n\n* `uri` {String} The complete registry URI to unpublish\n* `ver` {String} version to unpublish. Leave blank to unpublish all\n versions.\n* `cb` {Function}\n\nRemove a version of a package (or all versions) from the registry. When the\nlast version us unpublished, the entire document is removed from the database.\n\n# client.upload(uri, file, [etag], [nofollow], cb)\n\n* `uri` {String} The complete registry URI to upload to\n* `file` {String | Stream} Either the filename or a readable stream\n* `etag` {String} Cache ETag\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `cb` {Function}\n\nUpload an attachment. Mostly used by `client.publish()`.\n",
+ "readmeFilename": "README.md",
+ "gitHead": "bb534a209f9a36d77aff57cd4318ba3985501360",
"bugs": {
"url": "https://github.com/isaacs/npm-registry-client/issues"
},
"homepage": "https://github.com/isaacs/npm-registry-client",
- "_id": "npm-registry-client@2.0.4",
- "_shasum": "528e08900d7655c12096d1637d1c3a7a5b451019",
- "_from": "npm-registry-client@2.0.4",
- "_npmVersion": "1.4.22",
- "_npmUser": {
- "name": "isaacs",
- "email": "i@izs.me"
- },
- "maintainers": [
- {
- "name": "isaacs",
- "email": "i@izs.me"
- },
- {
- "name": "othiym23",
- "email": "ogd@aoaioxxysz.net"
- }
- ],
- "dist": {
- "shasum": "528e08900d7655c12096d1637d1c3a7a5b451019",
- "tarball": "http://registry.npmjs.org/npm-registry-client/-/npm-registry-client-2.0.4.tgz"
- },
- "directories": {},
- "_resolved": "https://registry.npmjs.org/npm-registry-client/-/npm-registry-client-2.0.4.tgz"
+ "_id": "npm-registry-client@2.0.7",
+ "_shasum": "97a2cdca5aba753b4b5b334b4ae65669c6641085",
+ "_from": "npm-registry-client@^2.0.7"
}
var common = require("./lib/common.js")
var client = common.freshClient()
-var password = "password"
+var password = "%1234@asdf%"
, username = "username"
, email = "i@izs.me"
, userdata = {
var common = require("./lib/common.js")
var client = common.freshClient()
-var password = "password"
+var password = "%1234@asdf%"
, username = "username"
, email = "i@izs.me"
, userdata = {
var common = require("./lib/common.js")
var client = common.freshClient({
username : "username",
- password : "password",
+ password : "%1234@asdf%",
email : "ogd@aoaioxxysz.net",
- _auth : new Buffer("username : password").toString("base64"),
+ _auth : new Buffer("username:%1234@asdf%").toString("base64"),
"always-auth" : true
})
username : "username",
password : "password",
email : "ogd@aoaioxxysz.net",
- _auth : new Buffer("username : password").toString("base64"),
+ _auth : new Buffer("username:%1234@asdf%").toString("base64"),
"always-auth" : true
})
+++ /dev/null
-{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.3.3","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.3.3","dependencies":{},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.1","_nodeVersion":"v0.6.11","_defaultsLoaded":true,"dist":{"shasum":"47ac53683daf832bfa952e1774417da47817ae42","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.3.3.tgz"},"readme":" __ \n /\\ \\ __ \n __ __ ___ \\_\\ \\ __ _ __ ____ ___ ___ _ __ __ /\\_\\ ____ \n /\\ \\/\\ \\ /' _ `\\ /'_ \\ /'__`\\/\\ __\\/ ,__\\ / ___\\ / __`\\/\\ __\\/'__`\\ \\/\\ \\ /',__\\ \n \\ \\ \\_\\ \\/\\ \\/\\ \\/\\ \\ \\ \\/\\ __/\\ \\ \\//\\__, `\\/\\ \\__//\\ \\ \\ \\ \\ \\//\\ __/ __ \\ \\ \\/\\__, `\\\n \\ \\____/\\ \\_\\ \\_\\ \\___,_\\ \\____\\\\ \\_\\\\/\\____/\\ \\____\\ \\____/\\ \\_\\\\ \\____\\/\\_\\ _\\ \\ \\/\\____/\n \\/___/ \\/_/\\/_/\\/__,_ /\\/____/ \\/_/ \\/___/ \\/____/\\/___/ \\/_/ \\/____/\\/_//\\ \\_\\ \\/___/ \n \\ \\____/ \n \\/___/\n \nUnderscore.js is a utility-belt library for JavaScript that provides \nsupport for the usual functional suspects (each, map, reduce, filter...) \nwithout extending any core JavaScript objects.\n\nFor Docs, License, Tests, and pre-packed downloads, see:\nhttp://documentcloud.github.com/underscore/\n\nMany thanks to our contributors:\nhttps://github.com/documentcloud/underscore/contributors\n","maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}}
\ No newline at end of file
+++ /dev/null
-{"_id":"underscore","_rev":"72-47f2986bfd8e8b55068b204588bbf484","name":"underscore","description":"JavaScript's functional programming helper library.","dist-tags":{"latest":"1.3.3","stable":"1.3.3"},"versions":{"1.0.3":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.0.3","_id":"underscore@1.0.3","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.0.3.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.0.4":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.0.4","_id":"underscore@1.0.4","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.0.4.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.0":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.1.0","_id":"underscore@1.1.0","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.0.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.1":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.1.1","_id":"underscore@1.1.1","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.1.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.2":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.1.2","_id":"underscore@1.1.2","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.7-2","_nodeVersion":"v0.3.1-pre","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.2.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.3":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore","version":"1.1.3","_id":"underscore@1.1.3","engines":{"node":"*"},"_nodeSupported":true,"_npmVersion":"0.2.8-1","_nodeVersion":"v0.2.5","dist":{"tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.3.tgz"},"directories":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.4":{"name":"underscore","description":"Functional programming aid for JavaScript. Works well with jQuery.","url":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"lib":".","main":"underscore.js","version":"1.1.4","_id":"underscore@1.1.4","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"0.3.9","_nodeVersion":"v0.5.0-pre","dist":{"shasum":"9e82274902865625b3a6d4c315a38ffd80047dae","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.4.tgz"},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.1.5":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.1.5","_id":"underscore@1.1.5","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"0.3.16","_nodeVersion":"v0.4.2","directories":{},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"23601d62c75619998b2f0db24938102793336a56","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.5.tgz"},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.6":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.1.6","_id":"underscore@1.1.6","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"0.3.18","_nodeVersion":"v0.4.2","directories":{},"files":[""],"_defaultsLoaded":true,"dist":{"shasum":"6868da1bdd72d75285be0b4e50f228e70d001a2c","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.6.tgz"},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}]},"1.1.7":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.1.7","devDependencies":{},"_id":"underscore@1.1.7","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.3","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"40bab84bad19d230096e8d6ef628bff055d83db0","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.1.7.tgz"},"scripts":{},"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.2.0":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.2.0","_npmJsonOpts":{"file":"/Users/jashkenas/.npm/underscore/1.2.0/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"underscore@1.2.0","devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.22","_nodeVersion":"v0.4.10","_defaultsLoaded":true,"dist":{"shasum":"b32ce32c8c118caa8031c10b54c7f65ab3b557fd","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.2.0.tgz"},"scripts":{},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"directories":{}},"1.2.1":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.2.1","_npmJsonOpts":{"file":"/Users/jashkenas/.npm/underscore/1.2.1/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"underscore@1.2.1","devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.22","_nodeVersion":"v0.4.10","_defaultsLoaded":true,"dist":{"shasum":"fc5c6b0765673d92a2d4ac8b4dc0aa88702e2bd4","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.2.1.tgz"},"scripts":{},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"directories":{}},"1.2.2":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.2.2","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.2.2","devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.0","_defaultsLoaded":true,"dist":{"shasum":"74dd40e9face84e724eb2edae945b8aedc233ba3","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.2.2.tgz"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.2.3":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"dependencies":{},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.2.3","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.2.3","devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.0","_defaultsLoaded":true,"dist":{"shasum":"11b874da70f4683d7d48bba2b44be1e600d2f6cf","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.2.3.tgz"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.2.4":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.2.4","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.2.4","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.6","_defaultsLoaded":true,"dist":{"shasum":"e8da6241aa06f64df2473bb2590b8c17c84c3c7e","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.2.4.tgz"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.3.0":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"contributors":[],"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.3.0","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.3.0","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.6","_defaultsLoaded":true,"dist":{"shasum":"253b2d79b7bb67943ced0fc744eb18267963ede8","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.3.0.tgz"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.3.1":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.3.1","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.3.1","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.104","_nodeVersion":"v0.6.6","_defaultsLoaded":true,"dist":{"shasum":"6cb8aad0e77eb5dbbfb54b22bcd8697309cf9641","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.3.1.tgz"},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.3.2":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.3.2","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.3.2","dependencies":{},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.1","_nodeVersion":"v0.6.11","_defaultsLoaded":true,"dist":{"shasum":"1b4e455089ab1d1d38ab6794ffe6cf08f764394a","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.3.2.tgz"},"readme":" __ \n /\\ \\ __ \n __ __ ___ \\_\\ \\ __ _ __ ____ ___ ___ _ __ __ /\\_\\ ____ \n /\\ \\/\\ \\ /' _ `\\ /'_ \\ /'__`\\/\\ __\\/ ,__\\ / ___\\ / __`\\/\\ __\\/'__`\\ \\/\\ \\ /',__\\ \n \\ \\ \\_\\ \\/\\ \\/\\ \\/\\ \\ \\ \\/\\ __/\\ \\ \\//\\__, `\\/\\ \\__//\\ \\ \\ \\ \\ \\//\\ __/ __ \\ \\ \\/\\__, `\\\n \\ \\____/\\ \\_\\ \\_\\ \\___,_\\ \\____\\\\ \\_\\\\/\\____/\\ \\____\\ \\____/\\ \\_\\\\ \\____\\/\\_\\ _\\ \\ \\/\\____/\n \\/___/ \\/_/\\/_/\\/__,_ /\\/____/ \\/_/ \\/___/ \\/____/\\/___/ \\/_/ \\/____/\\/_//\\ \\_\\ \\/___/ \n \\ \\____/ \n \\/___/\n \nUnderscore.js is a utility-belt library for JavaScript that provides \nsupport for the usual functional suspects (each, map, reduce, filter...) \nwithout extending any core JavaScript objects.\n\nFor Docs, License, Tests, and pre-packed downloads, see:\nhttp://documentcloud.github.com/underscore/\n\nMany thanks to our contributors:\nhttps://github.com/documentcloud/underscore/contributors\n","maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}},"1.3.3":{"name":"underscore","description":"JavaScript's functional programming helper library.","homepage":"http://documentcloud.github.com/underscore/","keywords":["util","functional","server","client","browser"],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"main":"underscore.js","version":"1.3.3","_npmUser":{"name":"jashkenas","email":"jashkenas@gmail.com"},"_id":"underscore@1.3.3","dependencies":{},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.1","_nodeVersion":"v0.6.11","_defaultsLoaded":true,"dist":{"shasum":"47ac53683daf832bfa952e1774417da47817ae42","tarball":"http://registry.npmjs.org/underscore/-/underscore-1.3.3.tgz"},"readme":" __ \n /\\ \\ __ \n __ __ ___ \\_\\ \\ __ _ __ ____ ___ ___ _ __ __ /\\_\\ ____ \n /\\ \\/\\ \\ /' _ `\\ /'_ \\ /'__`\\/\\ __\\/ ,__\\ / ___\\ / __`\\/\\ __\\/'__`\\ \\/\\ \\ /',__\\ \n \\ \\ \\_\\ \\/\\ \\/\\ \\/\\ \\ \\ \\/\\ __/\\ \\ \\//\\__, `\\/\\ \\__//\\ \\ \\ \\ \\ \\//\\ __/ __ \\ \\ \\/\\__, `\\\n \\ \\____/\\ \\_\\ \\_\\ \\___,_\\ \\____\\\\ \\_\\\\/\\____/\\ \\____\\ \\____/\\ \\_\\\\ \\____\\/\\_\\ _\\ \\ \\/\\____/\n \\/___/ \\/_/\\/_/\\/__,_ /\\/____/ \\/_/ \\/___/ \\/____/\\/___/ \\/_/ \\/____/\\/_//\\ \\_\\ \\/___/ \n \\ \\____/ \n \\/___/\n \nUnderscore.js is a utility-belt library for JavaScript that provides \nsupport for the usual functional suspects (each, map, reduce, filter...) \nwithout extending any core JavaScript objects.\n\nFor Docs, License, Tests, and pre-packed downloads, see:\nhttp://documentcloud.github.com/underscore/\n\nMany thanks to our contributors:\nhttps://github.com/documentcloud/underscore/contributors\n","maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"directories":{}}},"maintainers":[{"name":"documentcloud","email":"jeremy@documentcloud.org"},{"name":"jashkenas","email":"jashkenas@gmail.com"}],"author":{"name":"Jeremy Ashkenas","email":"jeremy@documentcloud.org"},"time":{"1.0.3":"2011-12-07T15:12:18.045Z","1.0.4":"2011-12-07T15:12:18.045Z","1.1.0":"2011-12-07T15:12:18.045Z","1.1.1":"2011-12-07T15:12:18.045Z","1.1.2":"2011-12-07T15:12:18.045Z","1.1.3":"2011-12-07T15:12:18.045Z","1.1.4":"2011-12-07T15:12:18.045Z","1.1.5":"2011-12-07T15:12:18.045Z","1.1.6":"2011-12-07T15:12:18.045Z","1.1.7":"2011-12-07T15:12:18.045Z","1.2.0":"2011-12-07T15:12:18.045Z","1.2.1":"2011-12-07T15:12:18.045Z","1.2.2":"2011-11-14T20:28:47.115Z","1.2.3":"2011-12-07T15:12:18.045Z","1.2.4":"2012-01-09T17:23:14.818Z","1.3.0":"2012-01-11T16:41:38.459Z","1.3.1":"2012-01-23T22:57:36.474Z","1.3.2":"2012-04-09T18:38:14.345Z","1.3.3":"2012-04-10T14:43:48.089Z"},"repository":{"type":"git","url":"git://github.com/documentcloud/underscore.git"},"users":{"vesln":true,"mvolkmann":true,"lancehunt":true,"mikl":true,"linus":true,"vasc":true,"bat":true,"dmalam":true,"mbrevoort":true,"danielr":true,"rsimoes":true,"thlorenz":true}}
\ No newline at end of file
var http = require('http')
var server = http.createServer(handler)
var port = server.port = process.env.PORT || 1337
+var assert = require("assert")
server.listen(port)
module.exports = server
function handler (req, res) {
req.connection.setTimeout(1000)
+ // If we got authorization, make sure it's the right password.
+ if (req.headers.authorization) {
+ var auth = req.headers.authorization.replace(/^Basic /, "")
+ auth = new Buffer(auth, "base64").toString("utf8")
+ assert.equal(auth, "username:%1234@asdf%")
+ }
+
var u = '* ' + req.url
, mu = req.method + ' ' + req.url
var common = require("./lib/common.js")
var client = common.freshClient({
username: "username",
- password: "password",
+ password: "%1234@asdf%",
email: "i@izs.me",
- _auth: new Buffer("username:password").toString("base64"),
+ _auth: new Buffer("username:%1234@asdf%").toString("base64"),
"always-auth": true
})
var common = require("./lib/common.js")
var client = common.freshClient({
username: "username",
- password: "password",
+ password: "%1234@asdf%",
email: "i@izs.me",
- _auth: new Buffer("username:password").toString("base64"),
+ _auth: new Buffer("username:%1234@asdf%").toString("base64"),
"always-auth": true
})
var server = require("./lib/server.js")
var common = require("./lib/common.js")
var client = common.freshClient({
- username : "othiym23",
- password : "password",
+ username : "username",
+ password : "%1234@asdf%",
email : "ogd@aoaioxxysz.net",
- _auth : new Buffer("username : password").toString("base64"),
+ _auth : new Buffer("username:%1234@asdf%").toString("base64"),
"always-auth" : true
})
var cache = require("./fixtures/underscore/cache.json")
-var DEP_USER = "othiym23"
+var DEP_USER = "username"
tap.test("star a package", function (t) {
server.expect("GET", "/underscore?write=true", function (req, res) {
var common = require("./lib/common.js")
var client = common.freshClient({
username : "username",
- password : "password",
+ password : "%1234@asdf%",
email : "ogd@aoaioxxysz.net",
- _auth : new Buffer("username : password").toString("base64"),
+ _auth : new Buffer("username:%1234@asdf%").toString("base64"),
"always-auth" : true
})
var common = require("./lib/common.js")
var client = common.freshClient({
username : "username",
- password : "password",
+ password : "%1234@asdf%",
email : "ogd@aoaioxxysz.net",
- _auth : new Buffer("username : password").toString("base64"),
+ _auth : new Buffer("username:%1234@asdf%").toString("base64"),
"always-auth" : true
})
var server = require("./lib/server.js")
var common = require("./lib/common.js")
var client = common.freshClient({
- username : "othiym23",
- password : "password",
+ username : "username",
+ password : "%1234@asdf%",
email : "ogd@aoaioxxysz.net",
- _auth : new Buffer("username : password").toString("base64"),
+ _auth : new Buffer("username:%1234@asdf%").toString("base64"),
"always-auth" : true
})
var cache = require("./fixtures/underscore/cache.json")
var client = common.freshClient({
- username : "othiym23",
- password : "password",
+ username : "username",
+ password : "%1234@asdf%",
email : "ogd@aoaioxxysz.net",
- _auth : new Buffer("username : password").toString("base64"),
+ _auth : new Buffer("username:%1234@asdf%").toString("base64"),
"always-auth" : true
})
, "save-exact" : false
, "save-optional" : false
, "save-prefix": "^"
- //, scope : ""
, searchopts: ""
, searchexclude: null
, searchsort: "name"
, "save-exact" : Boolean
, "save-optional" : Boolean
, "save-prefix": String
- //, scope : String
, searchopts : String
, searchexclude: [null, String]
, searchsort: [ "name", "-name"
// leave first char untouched, even if
// it is a "_" - convert all other to "-"
- var p = k.replace(/^npm_config_/, '')
+ var p = k.toLowerCase()
+ .replace(/^npm_config_/, '')
.replace(/(?!^)_/g, '-')
conf[p] = env[k]
})
{
"name": "npmconf",
- "version": "1.1.5",
+ "version": "1.1.8",
"description": "The config thing npm uses",
"main": "npmconf.js",
"directories": {
"url": "http://blog.izs.me"
},
"license": "ISC",
- "gitHead": "73f125b2961d550bd9884d8945e653a9fe8066c6",
+ "readme": "# npmconf\n\nThe config thing npm uses\n\nIf you are interested in interacting with the config settings that npm\nuses, then use this module.\n\nHowever, if you are writing a new Node.js program, and want\nconfiguration functionality similar to what npm has, but for your\nown thing, then I'd recommend using [rc](https://github.com/dominictarr/rc),\nwhich is probably what you want.\n\nIf I were to do it all over again, that's what I'd do for npm. But,\nalas, there are many systems depending on many of the particulars of\nnpm's configuration setup, so it's not worth the cost of changing.\n\n## USAGE\n\n```javascript\nvar npmconf = require('npmconf')\n\n// pass in the cli options that you read from the cli\n// or whatever top-level configs you want npm to use for now.\nnpmconf.load({some:'configs'}, function (er, conf) {\n // do stuff with conf\n conf.get('some', 'cli') // 'configs'\n conf.get('username') // 'joebobwhatevers'\n conf.set('foo', 'bar', 'user')\n conf.save('user', function (er) {\n // foo = bar is now saved to ~/.npmrc or wherever\n })\n})\n```\n",
+ "readmeFilename": "README.md",
+ "gitHead": "98e8ed0e2a307470f8db14d2727a165d8524b567",
"bugs": {
"url": "https://github.com/isaacs/npmconf/issues"
},
"homepage": "https://github.com/isaacs/npmconf",
- "_id": "npmconf@1.1.5",
- "_shasum": "07777bea48d78eed75a4258962a09f3dc7b6b916",
- "_from": "npmconf@1.1.5",
- "_npmVersion": "1.4.22",
- "_npmUser": {
- "name": "isaacs",
- "email": "i@izs.me"
- },
- "maintainers": [
- {
- "name": "isaacs",
- "email": "i@izs.me"
- },
- {
- "name": "othiym23",
- "email": "ogd@aoaioxxysz.net"
- }
- ],
- "dist": {
- "shasum": "07777bea48d78eed75a4258962a09f3dc7b6b916",
- "tarball": "http://registry.npmjs.org/npmconf/-/npmconf-1.1.5.tgz"
- },
- "_resolved": "https://registry.npmjs.org/npmconf/-/npmconf-1.1.5.tgz"
+ "_id": "npmconf@1.1.8",
+ "_shasum": "350e3d7a4da8e4958dfd0391c81e9a750b01cde2",
+ "_from": "npmconf@^1.1.8"
}
process.env.npm_config_other_env_thing = 1000
process.env.random_env_var = 'asdf'
process.env.npm_config__underbar_env_thing = 'underful'
+process.env.NPM_CONFIG_UPPERCASE_ENV_THING = 42
exports.envData = {
userconfig: exports.userconfig,
'_underbar-env-thing': 'underful',
+ 'uppercase-env-thing': '42',
'other-env-thing': '1000'
}
exports.envDataFix = {
userconfig: exports.userconfig,
'_underbar-env-thing': 'underful',
+ 'uppercase-env-thing': 42,
'other-env-thing': 1000,
}
* If `bundledDependencies` field (a typo) exists and `bundleDependencies` field does not, `bundledDependencies` will get renamed to `bundleDependencies`.
* If the value of any of the dependencies fields (`dependencies`, `devDependencies`, `optionalDependencies`) is a string, it gets converted into an object with familiar `name=>value` pairs.
* The values in `optionalDependencies` get added to `dependencies`. The `optionalDependencies` array is left untouched.
-* If `description` field does not exists, but `readme` field does, then (more or less) the first paragraph of text that's found in the readme is taken as value for `description`.
+* If `description` field does not exist, but `readme` field does, then (more or less) the first paragraph of text that's found in the readme is taken as value for `description`.
* If `repository` field is a string, it will become an object with `url` set to the original string value, and `type` set to `"git"`.
* If `repository.url` is not a valid url, but in the style of "[owner-name]/[repo-name]", `repository.url` will be set to git://github.com/[owner-name]/[repo-name]
* If `bugs` field is a string, the value of `bugs` field is changed into an object with `url` set to the original string value.
## License
normalize-package-data is released under the [BSD 2-Clause License](http://opensource.org/licenses/MIT).
-Copyright (c) 2013 Meryn Stol
\ No newline at end of file
+Copyright (c) 2013 Meryn Stol
{
"name": "normalize-package-data",
- "version": "1.0.0",
+ "version": "1.0.1",
"author": {
"name": "Meryn Stol",
"email": "merynstol@gmail.com"
},
"dependencies": {
"github-url-from-git": "^1.3.0",
- "github-url-from-username-repo": "^0.2.0",
+ "github-url-from-username-repo": "^1.0.0",
"semver": "2 || 3"
},
"devDependencies": {
"tap": "~0.2.5",
"underscore": "~1.4.4",
- "async": "~0.2.7"
+ "async": "~0.9.0"
},
"contributors": [
{
"email": "rok@kowalski.gd"
}
],
- "readme": "# normalize-package-data [![Build Status](https://travis-ci.org/meryn/normalize-package-data.png?branch=master)](https://travis-ci.org/meryn/normalize-package-data)\n\nnormalize-package data exports a function that normalizes package metadata. This data is typically found in a package.json file, but in principle could come from any source - for example the npm registry.\n\nnormalize-package-data is used by [read-package-json](https://npmjs.org/package/read-package-json) to normalize the data it reads from a package.json file. In turn, read-package-json is used by [npm](https://npmjs.org/package/npm) and various npm-related tools.\n\n## Installation\n\n```\nnpm install normalize-package-data\n```\n\n## Usage\n\nBasic usage is really simple. You call the function that normalize-package-data exports. Let's call it `normalizeData`.\n\n```javascript\nnormalizeData = require('normalize-package-data')\npackageData = fs.readfileSync(\"package.json\")\nnormalizeData(packageData)\n// packageData is now normalized\n```\n\n#### Strict mode\n\nYou may activate strict validation by passing true as the second argument.\n\n```javascript\nnormalizeData = require('normalize-package-data')\npackageData = fs.readfileSync(\"package.json\")\nwarnFn = function(msg) { console.error(msg) }\nnormalizeData(packageData, true)\n// packageData is now normalized\n```\n\nIf strict mode is activated, only Semver 2.0 version strings are accepted. Otherwise, Semver 1.0 strings are accepted as well. Packages must have a name, and the name field must not have contain leading or trailing whitespace.\n\n#### Warnings\n\nOptionally, you may pass a \"warning\" function. It gets called whenever the `normalizeData` function encounters something that doesn't look right. It indicates less than perfect input data.\n\n```javascript\nnormalizeData = require('normalize-package-data')\npackageData = fs.readfileSync(\"package.json\")\nwarnFn = function(msg) { console.error(msg) }\nnormalizeData(packageData, warnFn)\n// packageData is now normalized. Any number of warnings may have been logged.\n```\n\nYou may combine strict validation with warnings by passing `true` as the second argument, and `warnFn` as third.\n\nWhen `private` field is set to `true`, warnings will be suppressed.\n\n### Potential exceptions\n\nIf the supplied data has an invalid name or version vield, `normalizeData` will throw an error. Depending on where you call `normalizeData`, you may want to catch these errors so can pass them to a callback.\n\n## What normalization (currently) entails\n\n* The value of `name` field gets trimmed (unless in strict mode).\n* The value of the `version` field gets cleaned by `semver.clean`. See [documentation for the semver module](https://github.com/isaacs/node-semver).\n* If `name` and/or `version` fields are missing, they are set to empty strings.\n* If `files` field is not an array, it will be removed.\n* If `bin` field is a string, then `bin` field will become an object with `name` set to the value of the `name` field, and `bin` set to the original string value.\n* If `man` field is a string, it will become an array with the original string as its sole member.\n* If `keywords` field is string, it is considered to be a list of keywords separated by one or more white-space characters. It gets converted to an array by splitting on `\\s+`.\n* All people fields (`author`, `maintainers`, `contributors`) get converted into objects with name, email and url properties.\n* If `bundledDependencies` field (a typo) exists and `bundleDependencies` field does not, `bundledDependencies` will get renamed to `bundleDependencies`.\n* If the value of any of the dependencies fields (`dependencies`, `devDependencies`, `optionalDependencies`) is a string, it gets converted into an object with familiar `name=>value` pairs.\n* The values in `optionalDependencies` get added to `dependencies`. The `optionalDependencies` array is left untouched.\n* If `description` field does not exists, but `readme` field does, then (more or less) the first paragraph of text that's found in the readme is taken as value for `description`.\n* If `repository` field is a string, it will become an object with `url` set to the original string value, and `type` set to `\"git\"`.\n* If `repository.url` is not a valid url, but in the style of \"[owner-name]/[repo-name]\", `repository.url` will be set to git://github.com/[owner-name]/[repo-name]\n* If `bugs` field is a string, the value of `bugs` field is changed into an object with `url` set to the original string value.\n* If `bugs` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `bugs` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]/issues . If the repository field points to a GitHub Gist repo url, the associated http url is chosen.\n* If `bugs` field is an object, the resulting value only has email and url properties. If email and url properties are not strings, they are ignored. If no valid values for either email or url is found, bugs field will be removed.\n* If `homepage` field is not a string, it will be removed.\n* If the url in the `homepage` field does not specify a protocol, then http is assumed. For example, `myproject.org` will be changed to `http://myproject.org`.\n* If `homepage` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `homepage` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]/ . If the repository field points to a GitHub Gist repo url, the associated http url is chosen.\n\n### Rules for name field\n\nIf `name` field is given, the value of the name field must be a string. The string may not:\n\n* start with a period.\n* contain the following characters: `/@\\s+%`\n* contain and characters that would need to be encoded for use in urls.\n* resemble the word `node_modules` or `favicon.ico` (case doesn't matter).\n\n### Rules for version field\n\nIf `version` field is given, the value of the version field must be a valid *semver* string, as determined by the `semver.valid` method. See [documentation for the semver module](https://github.com/isaacs/node-semver).\n\n## Credits\n\nThis package contains code based on read-package-json written by Isaac Z. Schlueter. Used with permisson.\n\n## License\n\nnormalize-package-data is released under the [BSD 2-Clause License](http://opensource.org/licenses/MIT). \nCopyright (c) 2013 Meryn Stol ",
- "readmeFilename": "README.md",
- "gitHead": "976920445743c647bd2c8f579764f2060c649db9",
+ "gitHead": "d260644f514672cc84f1cc471024679cccc4fd65",
"bugs": {
"url": "https://github.com/meryn/normalize-package-data/issues"
},
"homepage": "https://github.com/meryn/normalize-package-data",
- "_id": "normalize-package-data@1.0.0",
- "_shasum": "5239d9921791a8ad027607f580a74c76166623c8",
- "_from": "normalize-package-data@^1.0.0"
+ "_id": "normalize-package-data@1.0.1",
+ "_shasum": "2a4b5200c82cc47bb91c8c9cf47d645499d200bf",
+ "_from": "normalize-package-data@^1.0.0",
+ "_npmVersion": "2.0.0-beta.0",
+ "_npmUser": {
+ "name": "othiym23",
+ "email": "ogd@aoaioxxysz.net"
+ },
+ "maintainers": [
+ {
+ "name": "meryn",
+ "email": "merynstol@gmail.com"
+ },
+ {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ {
+ "name": "othiym23",
+ "email": "ogd@aoaioxxysz.net"
+ }
+ ],
+ "dist": {
+ "shasum": "2a4b5200c82cc47bb91c8c9cf47d645499d200bf",
+ "tarball": "http://registry.npmjs.org/normalize-package-data/-/normalize-package-data-1.0.1.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-1.0.1.tgz"
}
{
"name": "read-package-json",
- "version": "1.2.6",
+ "version": "1.2.7",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
},
"dependencies": {
"github-url-from-git": "^1.3.0",
+ "github-url-from-username-repo": "~1.0.0",
"glob": "^4.0.2",
"lru-cache": "2",
"normalize-package-data": "^1.0.0",
"graceful-fs": "2 || 3"
},
"license": "ISC",
- "readme": "# read-package-json\n\nThis is the thing that npm uses to read package.json files. It\nvalidates some stuff, and loads some default things.\n\nIt keeps a cache of the files you've read, so that you don't end\nup reading the same package.json file multiple times.\n\nNote that if you just want to see what's literally in the package.json\nfile, you can usually do `var data = require('some-module/package.json')`.\n\nThis module is basically only needed by npm, but it's handy to see what\nnpm will see when it looks at your package.\n\n## Usage\n\n```javascript\nvar readJson = require('read-package-json')\n\n// readJson(filename, [logFunction=noop], [strict=false], cb)\nreadJson('/path/to/package.json', console.error, false, function (er, data) {\n if (er) {\n console.error(\"There was an error reading the file\")\n return\n }\n\n console.error('the package data is', data)\n});\n```\n\n## readJson(file, [logFn = noop], [strict = false], cb)\n\n* `file` {String} The path to the package.json file\n* `logFn` {Function} Function to handle logging. Defaults to a noop.\n* `strict` {Boolean} True to enforce SemVer 2.0 version strings, and\n other strict requirements.\n* `cb` {Function} Gets called with `(er, data)`, as is The Node Way.\n\nReads the JSON file and does the things.\n\n## `package.json` Fields\n\nSee `man 5 package.json` or `npm help json`.\n\n## readJson.log\n\nBy default this is a reference to the `npmlog` module. But if that\nmodule can't be found, then it'll be set to just a dummy thing that does\nnothing.\n\nReplace with your own `{log,warn,error}` object for fun loggy time.\n\n## readJson.extras(file, data, cb)\n\nRun all the extra stuff relative to the file, with the parsed data.\n\nModifies the data as it does stuff. Calls the cb when it's done.\n\n## readJson.extraSet = [fn, fn, ...]\n\nArray of functions that are called by `extras`. Each one receives the\narguments `fn(file, data, cb)` and is expected to call `cb(er, data)`\nwhen done or when an error occurs.\n\nOrder is indeterminate, so each function should be completely\nindependent.\n\nMix and match!\n\n## readJson.cache\n\nThe `lru-cache` object that readJson uses to not read the same file over\nand over again. See\n[lru-cache](https://github.com/isaacs/node-lru-cache) for details.\n\n## Other Relevant Files Besides `package.json`\n\nSome other files have an effect on the resulting data object, in the\nfollowing ways:\n\n### `README?(.*)`\n\nIf there is a `README` or `README.*` file present, then npm will attach\na `readme` field to the data with the contents of this file.\n\nOwing to the fact that roughly 100% of existing node modules have\nMarkdown README files, it will generally be assumed to be Markdown,\nregardless of the extension. Please plan accordingly.\n\n### `server.js`\n\nIf there is a `server.js` file, and there is not already a\n`scripts.start` field, then `scripts.start` will be set to `node\nserver.js`.\n\n### `AUTHORS`\n\nIf there is not already a `contributors` field, then the `contributors`\nfield will be set to the contents of the `AUTHORS` file, split by lines,\nand parsed.\n\n### `bindings.gyp`\n\nIf a bindings.gyp file exists, and there is not already a\n`scripts.install` field, then the `scripts.install` field will be set to\n`node-gyp rebuild`.\n\n### `wscript`\n\nIf a wscript file exists, and there is not already a `scripts.install`\nfield, then the `scripts.install` field will be set to `node-waf clean ;\nnode-waf configure build`.\n\nNote that the `bindings.gyp` file supercedes this, since node-waf has\nbeen deprecated in favor of node-gyp.\n\n### `index.js`\n\nIf the json file does not exist, but there is a `index.js` file\npresent instead, and that file has a package comment, then it will try\nto parse the package comment, and use that as the data instead.\n\nA package comment looks like this:\n\n```javascript\n/**package\n * { \"name\": \"my-bare-module\"\n * , \"version\": \"1.2.3\"\n * , \"description\": \"etc....\" }\n **/\n\n// or...\n\n/**package\n{ \"name\": \"my-bare-module\"\n, \"version\": \"1.2.3\"\n, \"description\": \"etc....\" }\n**/\n```\n\nThe important thing is that it starts with `/**package`, and ends with\n`**/`. If the package.json file exists, then the index.js is not\nparsed.\n\n### `{directories.man}/*.[0-9]`\n\nIf there is not already a `man` field defined as an array of files or a\nsingle file, and\nthere is a `directories.man` field defined, then that directory will\nbe searched for manpages.\n\nAny valid manpages found in that directory will be assigned to the `man`\narray, and installed in the appropriate man directory at package install\ntime, when installed globally on a Unix system.\n\n### `{directories.bin}/*`\n\nIf there is not already a `bin` field defined as a string filename or a\nhash of `<name> : <filename>` pairs, then the `directories.bin`\ndirectory will be searched and all the files within it will be linked as\nexecutables at install time.\n\nWhen installing locally, npm links bins into `node_modules/.bin`, which\nis in the `PATH` environ when npm runs scripts. When\ninstalling globally, they are linked into `{prefix}/bin`, which is\npresumably in the `PATH` environment variable.\n",
- "readmeFilename": "README.md",
- "gitHead": "a6390214436eea17043130d7c7d961ae85786e4c",
+ "gitHead": "41d6696c527e32a1cb38ebf0b6fc91b489b0499c",
"bugs": {
"url": "https://github.com/isaacs/read-package-json/issues"
},
"homepage": "https://github.com/isaacs/read-package-json",
- "_id": "read-package-json@1.2.6",
- "_shasum": "eedcc11ba25a94f80e5941fdbccff4a21d8ab13a",
- "_from": "read-package-json@latest"
+ "_id": "read-package-json@1.2.7",
+ "_shasum": "f0b440c461a218f4dbf48b094e80fc65c5248502",
+ "_from": "read-package-json@^1.2.7",
+ "_npmVersion": "2.0.0-beta.0",
+ "_npmUser": {
+ "name": "othiym23",
+ "email": "ogd@aoaioxxysz.net"
+ },
+ "maintainers": [
+ {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ {
+ "name": "othiym23",
+ "email": "ogd@aoaioxxysz.net"
+ }
+ ],
+ "dist": {
+ "shasum": "f0b440c461a218f4dbf48b094e80fc65c5248502",
+ "tarball": "http://registry.npmjs.org/read-package-json/-/read-package-json-1.2.7.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-1.2.7.tgz"
}
language: node_js
node_js:
- - 0.8
- - 0.10
+ - "0.8"
+ - "0.10"
env:
- OPTIONALS=Y
--- /dev/null
+## Change Log
+
+### upcoming (2014/07/09 12:10 +00:00)
+- [#946](https://github.com/mikeal/request/pull/946) defaults: merge headers (@aj0strow)
+- [#844](https://github.com/mikeal/request/pull/844) Add support for HTTP[S]_PROXY environment variables. Fixes #595. (@jvmccarthy)
+
+### v2.37.1 (2014/07/07 17:25 +00:00)
+- [8711b2f](https://github.com/mikeal/request/commit/8711b2f3489553a7ddae69fa8c9f538182c9d5c8) 2.37.1 (@mikeal)
+
+### v2.37.0 (2014/07/07 17:25 +00:00)
+- [79472b2](https://github.com/mikeal/request/commit/79472b263cde77504a354913a16bdc9fbdc9ed5d) append secureOptions to poolKey (@medovob)
+- [#907](https://github.com/mikeal/request/pull/907) append secureOptions to poolKey (@medovob)
+- [b223a8a](https://github.com/mikeal/request/commit/b223a8add0cbdd4e699a52da66aeb0f0cb17a0c3) expose tough-cookie's getCookiesSync (@charlespwd)
+- [f4dcad0](https://github.com/mikeal/request/commit/f4dcad0fa6e2f2388abae508ad7256a1e1214ab2) test getCookies method (@charlespwd)
+- [adcf62b](https://github.com/mikeal/request/commit/adcf62bf45ec19a28198ca8d3f37e7d7babc883a) update readme (@charlespwd)
+- [4fdf13b](https://github.com/mikeal/request/commit/4fdf13b57dcd20b9fe03c0956f5df70c82d6e4a3) Merge branch 'charlespwd-master' (@lalitkapoor)
+- [83e370d](https://github.com/mikeal/request/commit/83e370d54ca2a5fb162e40e7e705e1e9d702ba0a) Bump version of hawk dep. (@samccone)
+- [#927](https://github.com/mikeal/request/pull/927) Bump version of hawk dep. (@samccone)
+- [c42dcec](https://github.com/mikeal/request/commit/c42dcec10a307cb2299861f87720d491a89142b4) package.json: use OSI-style license name (@isaacs)
+- [8892cb7](https://github.com/mikeal/request/commit/8892cb7bb8945807ff25038e888222d4e902acc8) Swap mime module. (@eiriksm)
+- [d92395e](https://github.com/mikeal/request/commit/d92395e638cbfe5c31eb4ff54941b98b09057486) Make package.json so node .8 understands it. (@eiriksm)
+- [6ebd748](https://github.com/mikeal/request/commit/6ebd748a02a49976d41ebbc4f8396acf8fda1c14) Add some additional hacks to work in the browser. (@eiriksm)
+- [#943](https://github.com/mikeal/request/pull/943) New mime module (@eiriksm)
+- [561454d](https://github.com/mikeal/request/commit/561454d18a68b7a03163308f6d29e127afe97426) Add some code comments about why we do the extra checks. (@eiriksm)
+- [#944](https://github.com/mikeal/request/pull/944) Make request work with browserify (@eiriksm)
+- [6a0add7](https://github.com/mikeal/request/commit/6a0add70b2687cf751b3446a15a513a1fd141738) defaults: merge headers (@aj0strow)
+- [407c1ad](https://github.com/mikeal/request/commit/407c1ada61afca4d4ba50155c6d9430754541df1) prefer late return statement (@aj0strow)
+- [4ab40ba](https://github.com/mikeal/request/commit/4ab40ba2f9aca8958cab149eb9cfbd9edb5534aa) Added support for manual querystring in form option (@charlespwd)
+- [a55627c](https://github.com/mikeal/request/commit/a55627cd9f468cefb2971bb501ebc0c2fc27aa8b) Updated README (@charlespwd)
+- [#949](https://github.com/mikeal/request/pull/949) Manually enter querystring in form option (@charlespwd)
+- [10246c8](https://github.com/mikeal/request/commit/10246c84819db14b32fccca040029b06449242a3) [PATCH v2] Add support for gzip content decoding (@kevinoid)
+- [6180c5f](https://github.com/mikeal/request/commit/6180c5f45c01fb2158b9a44f894a34263479fa84) check for content-length header before setting it in nextTick (@camilleanne)
+- [#951](https://github.com/mikeal/request/pull/951) Add support for gzip content decoding (@kevinoid)
+- [849c681](https://github.com/mikeal/request/commit/849c681846ce3b5492bd47261de391377a3ac19b) Silence EventEmitter memory leak warning #311 (@watson)
+- [#955](https://github.com/mikeal/request/pull/955) check for content-length header before setting it in nextTick (@camilleanne)
+- [#957](https://github.com/mikeal/request/pull/957) Silence EventEmitter memory leak warning #311 (@watson)
+- [c1d951e](https://github.com/mikeal/request/commit/c1d951e536bd41c957f0cade41d051c9d41d1462) Fixing for 0.8 (@mikeal)
+- [4851118](https://github.com/mikeal/request/commit/48511186495888a5f0cb15a107325001ac91990e) 2.37.0 (@mikeal)
+
+### v2.36.1 (2014/05/19 20:59 +00:00)
+- [c3914fc](https://github.com/mikeal/request/commit/c3914fcd4a74faf6dbf0fb6a4a188e871e0c51b8) 2.36.1 (@mikeal)
+
+### v2.36.0 (2014/05/19 20:59 +00:00)
+- [76a96de](https://github.com/mikeal/request/commit/76a96de75580042aa780e9587ff7a22522119c3f) Reventing lodash merge change. (@mikeal)
+- [b8bb57e](https://github.com/mikeal/request/commit/b8bb57efb17e72e2ac6d957c05c3f2570c7ba6a0) 2.36.0 (@mikeal)
+
+### v2.35.1 (2014/05/17 20:57 +00:00)
+- [4bbd153](https://github.com/mikeal/request/commit/4bbd1532a68cadf1a88dd69c277645e9b781f364) 2.35.1 (@mikeal)
+
+### v2.35.0 (2014/05/17 20:57 +00:00)
+- [2833da3](https://github.com/mikeal/request/commit/2833da3c3c1c34f4130ad1ba470354fc32410691) initial changelog (@lalitkapoor)
+- [49319e6](https://github.com/mikeal/request/commit/49319e6c09a8a169c95a8d282c900f9fecd50371) Merge branch 'master' of https://github.com/mikeal/request into create-changelog-based-on-pull-requests (@lalitkapoor)
+- [#815](https://github.com/mikeal/request/pull/815) Create changelog based on pull requests (@lalitkapoor)
+- [4b6ce1a](https://github.com/mikeal/request/commit/4b6ce1ac0f79cb8fa633e281d3eb4c0cb61794e1) It appears that secureOptions is an undocumented feature to fix issues with broken server. See joynet/node #5119 (@nw)
+- [#821](https://github.com/mikeal/request/pull/821) added secureOptions back (@nw)
+- [eddd488](https://github.com/mikeal/request/commit/eddd4889fb1bc95c741749e79d9749aab3e103fc) Fixing #825 (@mikeal)
+- [4627a7a](https://github.com/mikeal/request/commit/4627a7a14078494ded8c66c19c43efd07324cbd8) improve error reporting for invalid protocols (@FND)
+- [#840](https://github.com/mikeal/request/pull/840) improve error reporting for invalid protocols (@FND)
+- [#810](https://github.com/mikeal/request/pull/810) add some exposition to mpu example in README.md (@mikermcneil)
+- [8a0e2d6](https://github.com/mikeal/request/commit/8a0e2d65351560858275c73505df12b537f4d001) Added support for HTTP_PROXY and HTTPS_PROXY environment variables, if the proxy option isn't already set. (@jvmccarthy)
+- [f60d348](https://github.com/mikeal/request/commit/f60d348dc1840ee6d7b709efcc2b3cd1a03aef63) Fix word consistency
+- [#850](https://github.com/mikeal/request/pull/850) Fix word consistency in readme (@0xNobody)
+- [#809](https://github.com/mikeal/request/pull/809) upgrade tunnel-proxy to 0.4.0 (@ksato9700)
+- [e86377c](https://github.com/mikeal/request/commit/e86377c0c1e7695c3997f7802175ca37f5a5113b) Won't use HTTP(S)_PROXY env var if proxy explicitly set to null. (@jvmccarthy)
+- [f1bb537](https://github.com/mikeal/request/commit/f1bb537ee2440bd664ea8c445ac3a2c6e31e9932) Add support for RFC 6750 Bearer Tokens
+- [ba51a26](https://github.com/mikeal/request/commit/ba51a26079ec52c0a9145fbe8b6796d46e79bb8e) Add documentation about auth.bearer (@phedny)
+- [#861](https://github.com/mikeal/request/pull/861) Add support for RFC 6750 Bearer Tokens (@phedny)
+- [b8ee579](https://github.com/mikeal/request/commit/b8ee5790ace95440a56074f6afe866f4662e9e88) Fix typo (@dandv)
+- [#866](https://github.com/mikeal/request/pull/866) Fix typo (@dandv)
+- [b292b59](https://github.com/mikeal/request/commit/b292b59fadecb35dac3bee0959c4b4b782e772e3) Clean code syntax in test-pipes.js (@tgohn)
+- [f7996d5](https://github.com/mikeal/request/commit/f7996d5fcfed85e03f293a7c9739e385b64ecaad) Add test for request.pipefilter (@tgohn)
+- [#869](https://github.com/mikeal/request/pull/869) Pipefilter test (@tgohn)
+- [86b99b6](https://github.com/mikeal/request/commit/86b99b671a3c86f4f963a6c67047343fd8edae8f) Fix typo in form example (@mscdex)
+- [2ba4808](https://github.com/mikeal/request/commit/2ba48083ddf2607f85e2c479e0d254483c2610fe) failing test (@lalitkapoor)
+- [39396b0](https://github.com/mikeal/request/commit/39396b0bb2e90eb7ec4dfcf5d2e731a2cb156f5c) extend passed in options (@lalitkapoor)
+- [#891](https://github.com/mikeal/request/pull/891) fixes 857 - options object is mutated by calling request (@lalitkapoor)
+- [54a51c6](https://github.com/mikeal/request/commit/54a51c665887e162ccb9f6b17b9c1f3b017ccc29) merge options (@vohof)
+- [25b95db](https://github.com/mikeal/request/commit/25b95dbdddf874f014386a0a9fe35a7c903b7415) tilde? (@vohof)
+- [#897](https://github.com/mikeal/request/pull/897) merge with default options (@vohof)
+- [a1e4b1a](https://github.com/mikeal/request/commit/a1e4b1a9c2f39ce565fd023bb604da139f689d43) Fixes #555 (@pigulla)
+- [#901](https://github.com/mikeal/request/pull/901) Fixes #555 (@pigulla)
+- [6498a5f](https://github.com/mikeal/request/commit/6498a5f1ae68050cfeabf8f34f75bc72b08f1805) 2.35.0 (@mikeal)
+
+### v2.34.1 (2014/02/18 19:35 +00:00)
+- [aefea20](https://github.com/mikeal/request/commit/aefea20b215ff1a48f0d8d27dcac0186604e3b2d) 2.34.1 (@mikeal)
+
+### v2.34.0 (2014/02/18 19:35 +00:00)
+- [46edc90](https://github.com/mikeal/request/commit/46edc902e6ffdee39038a6702021728cb9d9b8fa) simpler (@joaojeronimo)
+- [#781](https://github.com/mikeal/request/pull/781) simpler isReadStream function (@joaojeronimo)
+- [fe2f59f](https://github.com/mikeal/request/commit/fe2f59fdc72de5c86404e51ab6bc4e0e8ece95f2) Provide ability to override content-type when `json` option used (@vvo)
+- [#785](https://github.com/mikeal/request/pull/785) Provide ability to override content-type when `json` option used (@vvo)
+- [d134f01](https://github.com/mikeal/request/commit/d134f012e64702e8f4070d61504b39524e1a07ba) Adds content-length calculation when submitting forms using form-data library. This is related to issue 345. (@Juul)
+- [#793](https://github.com/mikeal/request/pull/793) Adds content-length calculation when submitting forms using form-data li... (@Juul)
+- [3ebf25c](https://github.com/mikeal/request/commit/3ebf25c5af1194d8f7b3a3330fe89e729532809b) adding failing test (@lalitkapoor)
+- [0f57a90](https://github.com/mikeal/request/commit/0f57a90384588727a5446bb1f5bf4e0be2d85780) accept options in arguments (@lalitkapoor)
+- [7fb1647](https://github.com/mikeal/request/commit/7fb164731a5aad80c6539e33eda4ad4a51bb7871) silently ignore errors when adding cookie to jar (@lalitkapoor)
+- [d6b2b1c](https://github.com/mikeal/request/commit/d6b2b1c279d12cdddc6593060672d49b12e63fea) add additional header test (@lalitkapoor)
+- [f29e6df](https://github.com/mikeal/request/commit/f29e6dfadc6c3a45b6190998b6608059f87f3c32) Added the Apache license to the package.json. (@keskival)
+- [#802](https://github.com/mikeal/request/pull/802) Added the Apache license to the package.json. (@keskival)
+- [#801](https://github.com/mikeal/request/pull/801) 794 ignore cookie parsing and domain errors (@lalitkapoor)
+- [54e6dfb](https://github.com/mikeal/request/commit/54e6dfb77d57757d4006982f813ebaab9e005cd5) Rewrite UNIX Domain Socket support into 2.33.1. Add test. (@lyuzashi)
+- [3eaed2f](https://github.com/mikeal/request/commit/3eaed2f2e82d9d17a583bcc54270c16a7b674206) Use setImmediate when available, otherwise fallback to nextTick (@lyuzashi)
+- [746ca75](https://github.com/mikeal/request/commit/746ca757da24d5011e92e04cb00c90098a7680fd) Indent wrapped buildRequest function (@lyuzashi)
+- [#516](https://github.com/mikeal/request/pull/516) UNIX Socket URL Support (@native-digital)
+- [9a5b0a8](https://github.com/mikeal/request/commit/9a5b0a81eca9836f05b0192c05c0d41e79034461) initial format (@lalitkapoor)
+- [9380a49](https://github.com/mikeal/request/commit/9380a49779ddb081eba5d0ee51e4396d72d52066) upgrade tunnel-proxy to 0.4.0 (@ksato9700)
+- [1efea37](https://github.com/mikeal/request/commit/1efea374286c728c3c988ee2264fb44cd8c41d88) add some exposition to mpu example in README.md (@mikermcneil)
+- [ba0d63a](https://github.com/mikeal/request/commit/ba0d63ae23a3fc95dfe012df0bd6c8d7e87b1df7) made the language clearer (@mikermcneil)
+- [b43aa81](https://github.com/mikeal/request/commit/b43aa81789c0b8c7ae90d2b983f79dde4a125470) 2.34.0 (@mikeal)
+
+### v2.33.1 (2014/01/16 19:48 +00:00)
+- [afcf827](https://github.com/mikeal/request/commit/afcf827559b3223c96ac1bbd19bd1e4a6d7771e3) 2.33.1 (@mikeal)
+
+### v2.33.0 (2014/01/16 19:48 +00:00)
+- [7f1cc8f](https://github.com/mikeal/request/commit/7f1cc8ff5a8d9443e7a793f4655487e722b75b0d) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [3e43d3d](https://github.com/mikeal/request/commit/3e43d3d5175f5f18d1e97b2f5d4ca6ac6c216e4a) 2.33.0 (@mikeal)
+
+### v2.32.1 (2014/01/16 19:33 +00:00)
+- [dd44f39](https://github.com/mikeal/request/commit/dd44f39d37daacbbeb21f9e960f13adbb44eea0a) 2.32.1 (@mikeal)
+
+### v2.32.0 (2014/01/16 19:33 +00:00)
+- [#757](https://github.com/mikeal/request/pull/757) require aws-sign2 (@mafintosh)
+- [#744](https://github.com/mikeal/request/pull/744) Use Cookie.parse (@lalitkapoor)
+- [5eaee1c](https://github.com/mikeal/request/commit/5eaee1ce4008ede1df15201622ac478c892d6a8a) Upgrade tough-cookie to 0.10.0 (@stash)
+- [#763](https://github.com/mikeal/request/pull/763) Upgrade tough-cookie to 0.10.0 (@stash)
+- [d2489d0](https://github.com/mikeal/request/commit/d2489d0e24d9a538224f5c8c090dcdeb1f8d4969) Fixed auth error for some servers like twisted. According to rfc 2617 auth scheme token should be case-insensitive. (@bobyrizov)
+- [#764](https://github.com/mikeal/request/pull/764) Case-insensitive authentication scheme (@bobyrizov)
+- [cbee3d0](https://github.com/mikeal/request/commit/cbee3d04ee9f704501a64edb7b9b6d201e98494b) Use tough-cookie CookieJar sync API (@stash)
+- [3eeaf6a](https://github.com/mikeal/request/commit/3eeaf6a90df7b806d91ae1e8e2f56862ece2ea33) Emit error, not cookieError (@stash)
+- [#767](https://github.com/mikeal/request/pull/767) Use tough-cookie CookieJar sync API (@stash)
+- [9eac534](https://github.com/mikeal/request/commit/9eac534dd11e40bba65456491cb62ad68d8f41fa) 2.32.0 (@mikeal)
+
+### v2.31.1 (2014/01/08 02:57 +00:00)
+- [b1b5e91](https://github.com/mikeal/request/commit/b1b5e9161e149574ba5528c401a70bfadef1a98a) 2.31.1 (@mikeal)
+
+### v2.31.0 (2014/01/08 02:57 +00:00)
+- [dd2577f](https://github.com/mikeal/request/commit/dd2577f8264d4d4b07484dec7094b72c00c8416f) Removing s3 test. (@mikeal)
+- [fef5bf3](https://github.com/mikeal/request/commit/fef5bf34258e3695b61c048c683f1d4a7f99b368) Fix callback arguments documentation (@mmalecki)
+- [#736](https://github.com/mikeal/request/pull/736) Fix callback arguments documentation (@mmalecki)
+- [5531c20](https://github.com/mikeal/request/commit/5531c208678145ef35b06e948190be2fd6a8a1c8) updating README example: cookie jar api changed cookie module changed to tough-cookie (@emkay)
+- [#741](https://github.com/mikeal/request/pull/741) README example is using old cookie jar api (@emkay)
+- [9d73e5a](https://github.com/mikeal/request/commit/9d73e5a277af141a6e4fa9dbcae5d0c3b755d277) add note about JSON output body type (@iansltx)
+- [#742](https://github.com/mikeal/request/pull/742) Add note about JSON output body type (@iansltx)
+- [41e20a4](https://github.com/mikeal/request/commit/41e20a4d288e30101e493b383a0e4852a3271a98) Use Cookie.parse (@lalitkapoor)
+- [4d09556](https://github.com/mikeal/request/commit/4d095562a5c42ffb41b0ff194e9e6f32c0f44372) updating setCookie example to make it clear that the callback is required (@emkay)
+- [#745](https://github.com/mikeal/request/pull/745) updating setCookie example to make it clear that the callback is required (@emkay)
+- [b7ede1d](https://github.com/mikeal/request/commit/b7ede1d56f9a2764e4bf764687b81419df817e5a) README: Markdown code highlight (@weakish)
+- [#746](https://github.com/mikeal/request/pull/746) README: Markdown code highlight (@weakish)
+- [#645](https://github.com/mikeal/request/pull/645) update twitter api url to v1.1 (@mick)
+- [20dcd18](https://github.com/mikeal/request/commit/20dcd18ce8e3397ba7e0213da9c760b048ca5b49) require aws-sign2 (@mafintosh)
+- [df2c426](https://github.com/mikeal/request/commit/df2c4264321c3db1387ddf9a945d63b9ae7d57b8) 2.31.0 (@mikeal)
+
+### v2.30.1 (2013/12/13 19:17 +00:00)
+- [eba2d40](https://github.com/mikeal/request/commit/eba2d402fcdcf1ac878de8672b1c9f5da856dcc1) 2.30.1 (@mikeal)
+
+### v2.30.0 (2013/12/13 19:17 +00:00)
+- [aee3819](https://github.com/mikeal/request/commit/aee38191557574ef570fd9c764af0af7072cc92a) Fix TypeError when calling request.cookie
+- [#728](https://github.com/mikeal/request/pull/728) Fix TypeError when calling request.cookie (@scarletmeow)
+- [628ef76](https://github.com/mikeal/request/commit/628ef768b1f52710b8eb4e14be4db69d174d1dcb) better DIGEST support (@dai-shi)
+- [d919bc1](https://github.com/mikeal/request/commit/d919bc1ce97fa461c365437a0c739bbaa6b86de7) ignore null authValues (DIGEST) (@dai-shi)
+- [75fc209](https://github.com/mikeal/request/commit/75fc209c5a9e6c647a04e42048c30f46c66fc103) DIGEST support: pass algoritm and opaque, add TODO items, test case for compatible mode (@dai-shi)
+- [#730](https://github.com/mikeal/request/pull/730) better HTTP DIGEST support (@dai-shi)
+- [937a24a](https://github.com/mikeal/request/commit/937a24a168a126f406ee8eb55eb78169ddc53497) JSHINT: Creating global 'for' variable. Should be 'for (var ...'.
+- [#732](https://github.com/mikeal/request/pull/732) JSHINT: Creating global 'for' variable. Should be 'for (var ...'. (@Fritz-Lium)
+- [f03be23](https://github.com/mikeal/request/commit/f03be2309bd85a89d2e3c208b2fb4be1a2b95c79) Make digest qop regex more robust (see #730) (@nylen)
+- [c7d97ae](https://github.com/mikeal/request/commit/c7d97aefaebf773ce62c72e9ec656f0250b7a1e7) 2.30.0 (@mikeal)
+
+### v2.29.1 (2013/12/06 20:05 +00:00)
+- [e0f2c41](https://github.com/mikeal/request/commit/e0f2c41bd4e15518e97dd2f4c134be51ed4cb68b) 2.29.1 (@mikeal)
+
+### v2.29.0 (2013/12/06 20:05 +00:00)
+- [3c2cad1](https://github.com/mikeal/request/commit/3c2cad11301380f4056eb3ca4c0c124f7f7f72f5) make request.defaults(options, requester) run the requester for all methods (@jchris)
+- [#727](https://github.com/mikeal/request/pull/727) fix requester bug (@jchris)
+- [0c9f875](https://github.com/mikeal/request/commit/0c9f87542cd1f919751d3ed1f00208ce7705f8e7) 2.29.0 (@mikeal)
+
+### v2.28.1 (2013/12/04 19:42 +00:00)
+- [3e6a300](https://github.com/mikeal/request/commit/3e6a300121586da81b871f759a9feec52810474a) 2.28.1 (@mikeal)
+
+### v2.28.0 (2013/12/04 19:42 +00:00)
+- [ac26f43](https://github.com/mikeal/request/commit/ac26f43d9a8212289f92056d3029c207f755cef4) Update request.js (@wprl)
+- [adc2cb6](https://github.com/mikeal/request/commit/adc2cb6721e5980e8ed667a3f558cce8c89ee6c2) Use random cnonce (@wprl)
+- [ff16a9d](https://github.com/mikeal/request/commit/ff16a9daf93e01cecee7fabec64c3e1b423f7db5) Add test for random cnonce (@wprl)
+- [df64c2b](https://github.com/mikeal/request/commit/df64c2bc8f691ecc6f6c214e2254bab439830b88) Restore whitespace (@wprl)
+- [#630](https://github.com/mikeal/request/pull/630) Send random cnonce for HTTP Digest requests (@wprl)
+- [aca5a16](https://github.com/mikeal/request/commit/aca5a169c44cc658e8310691a2ae1cfc4c2b0958) update twitter api url to v1.1 (@mick)
+- [abcbadd](https://github.com/mikeal/request/commit/abcbadd1b2a113c34a37b62d36ddcfd74452850e) Test case for #304. (@diversario)
+- [b8cf874](https://github.com/mikeal/request/commit/b8cf8743b66d8eee4048561a7d81659f053393c8) fix failure when running with NODE_DEBUG=request, and a test for that (@jrgm)
+- [e6c7d1f](https://github.com/mikeal/request/commit/e6c7d1f6d23922480c09427d5f54f84eec60b7af) quiet, but check that stderr output has something reasonable for debug (@jrgm)
+- [#659](https://github.com/mikeal/request/pull/659) fix failure when running with NODE_DEBUG=request, and a test for that (@jrgm)
+- [23164e4](https://github.com/mikeal/request/commit/23164e4f33bd0837d796037c3d0121db23653c34) option.tunnel to explicitly disable tunneling (@seanmonstar)
+- [#662](https://github.com/mikeal/request/pull/662) option.tunnel to explicitly disable tunneling (@seanmonstar)
+- [#656](https://github.com/mikeal/request/pull/656) Test case for #304. (@diversario)
+- [da16120](https://github.com/mikeal/request/commit/da16120a8f0751b305a341c012dbdcfd62e83585) Change `secureOptions' to `secureProtocol' for HTTPS request (@richarddong)
+- [43d9d0a](https://github.com/mikeal/request/commit/43d9d0a76974d2c61681ddee04479d514ebfa320) add `ciphers' and `secureProtocol' to `options' in `getAgent' (@richarddong)
+- [#666](https://github.com/mikeal/request/pull/666) make `ciphers` and `secureProtocol` to work in https request (@richarddong)
+- [524e035](https://github.com/mikeal/request/commit/524e0356b73240409a11989d369511419526b5ed) change cookie module (@sxyizhiren)
+- [#674](https://github.com/mikeal/request/pull/674) change cookie module,to tough-cookie.please check it . (@sxyizhiren)
+- [e8dbcc8](https://github.com/mikeal/request/commit/e8dbcc83d4eff3c14e03bd754174e2c5d45f2872) tests: Fixed test-timeout.js events unit test (@Turbo87)
+- [aed1c71](https://github.com/mikeal/request/commit/aed1c71fac0047b66a236a990a5569445cfe995d) Added Travis CI configuration file (@Turbo87)
+- [#683](https://github.com/mikeal/request/pull/683) Travis CI support (@Turbo87)
+- [8bfa640](https://github.com/mikeal/request/commit/8bfa6403ce03cbd3f3de6b82388bfcc314e56c61) dependencies: Set `tough-cookie` as optional dependency (@Turbo87)
+- [bcc138d](https://github.com/mikeal/request/commit/bcc138da67b7e1cf29dc7d264a73d8b1d1f4b0e4) dependencies: Set `form-data` as optional dependency (@Turbo87)
+- [751ac28](https://github.com/mikeal/request/commit/751ac28b7f13bfeff2a0e920ca2926a005dcb6f0) dependencies: Set `tunnel-agent` as optional dependency (@Turbo87)
+- [6d7c1c9](https://github.com/mikeal/request/commit/6d7c1c9d8e3a300ff6f2a93e7f3361799acf716b) dependencies: Set `http-signature` as optional dependency (@Turbo87)
+- [733f1e3](https://github.com/mikeal/request/commit/733f1e3ae042a513a18cde1c6e444b18ee07ad66) Added .npmignore file (@Turbo87)
+- [e2fc346](https://github.com/mikeal/request/commit/e2fc346b7e5e470fcd36189bcadf63c53feebb22) dependencies: Set `hawk` as optional dependency (@Turbo87)
+- [e87d45f](https://github.com/mikeal/request/commit/e87d45fe89ea220035bf07696a70292763f7135f) dependencies: Set `aws-sign` as optional dependency (@Turbo87)
+- [1cd81ba](https://github.com/mikeal/request/commit/1cd81ba30908b77cff2fa618aeb232fefaa53ada) lib: Added optional() function (@Turbo87)
+- [28c2c38](https://github.com/mikeal/request/commit/28c2c3820feab0cc719df213a60838db019f3e1a) dependencies: Set `oauth-sign` as optional dependency (@Turbo87)
+- [2ceddf7](https://github.com/mikeal/request/commit/2ceddf7e793feb99c5b6a76998efe238965b22cd) TravisCI: Test with and without optional dependencies (@Turbo87)
+- [#682](https://github.com/mikeal/request/pull/682) Optional dependencies (@Turbo87)
+- [2afab5b](https://github.com/mikeal/request/commit/2afab5b665a2e03becbc4a42ad481bb737405655) Handle blank password in basic auth. (@diversario)
+- [cabe5a6](https://github.com/mikeal/request/commit/cabe5a62dc71282ce8725672184efe9d97ba79a5) Handle `auth.password` and `auth.username`. (@diversario)
+- [#690](https://github.com/mikeal/request/pull/690) Handle blank password in basic auth. (@diversario)
+- [33100c3](https://github.com/mikeal/request/commit/33100c3c7fa678f592374f7b2526fe9a0499b6f6) Typo (@VRMink)
+- [#694](https://github.com/mikeal/request/pull/694) Typo in README (@ExxKA)
+- [9072ff1](https://github.com/mikeal/request/commit/9072ff1556bcb002772838a94e1541585ef68f02) Edited README.md for formatting and clarity of phrasing (@Zearin)
+- [#696](https://github.com/mikeal/request/pull/696) Edited README.md for formatting and clarity of phrasing (@Zearin)
+- [07ee58d](https://github.com/mikeal/request/commit/07ee58d3a8145740ba34cc724f123518e4b3d1c3) Fixing listing in callback part of docs. (@lukasz-zak)
+- [#710](https://github.com/mikeal/request/pull/710) Fixing listing in callback part of docs. (@lukasz-zak)
+- [8ee21d0](https://github.com/mikeal/request/commit/8ee21d0dcc637090f98251eba22b9f4fd1602f0e) Request.multipart no longer crashes when header 'Content-type' is present (@pastaclub)
+- [#715](https://github.com/mikeal/request/pull/715) Request.multipart no longer crashes when header 'Content-type' present (@pastaclub)
+- [8b04ca6](https://github.com/mikeal/request/commit/8b04ca6ad8d025c275e40b806a69112ac53bd416) doc: Removed use of gendered pronouns (@oztu)
+- [#719](https://github.com/mikeal/request/pull/719) Made a comment gender neutral. (@oztu)
+- [8795fc6](https://github.com/mikeal/request/commit/8795fc68cce26b9a45d10db9eaffd4bc943aca3a) README.md: add custom HTTP Headers example. (@tcort)
+- [#724](https://github.com/mikeal/request/pull/724) README.md: add custom HTTP Headers example. (@tcort)
+- [c5d5b1f](https://github.com/mikeal/request/commit/c5d5b1fcf348e768943fe632a9a313d704d35c65) Changing dep. (@mikeal)
+- [bf04163](https://github.com/mikeal/request/commit/bf04163883fa9c62d4e1a9fdd64d6efd7723d5f8) 2.28.0 (@mikeal)
+
+### v2.27.1 (2013/08/15 21:30 +00:00)
+- [a80a026](https://github.com/mikeal/request/commit/a80a026e362a9462d6948adc1b0d2831432147d2) 2.27.1 (@mikeal)
+
+### v2.27.0 (2013/08/15 21:30 +00:00)
+- [3627b9c](https://github.com/mikeal/request/commit/3627b9cc7752cfe57ac609ed613509ff61017045) rename Request and remove .DS_Store (@joaojeronimo)
+- [920f9b8](https://github.com/mikeal/request/commit/920f9b88f7dd8f8d153e72371b1bf2d16d5e4160) rename Request (@joaojeronimo)
+- [c243cc6](https://github.com/mikeal/request/commit/c243cc66131216bb57bcc0fd79c250a7927ee424) for some reason it removed request.js (@joaojeronimo)
+- [#619](https://github.com/mikeal/request/pull/619) decouple things a bit (@CrowdProcess)
+- [ed4ecc5](https://github.com/mikeal/request/commit/ed4ecc5ae5cd1d9559a937e84638c9234244878b) Try normal stringify first, then fall back to safe stringify (@mikeal)
+- [5642ff5](https://github.com/mikeal/request/commit/5642ff56e64c19e8183dcd5b6f9d07cca295a79e) 2.27.0 (@mikeal)
+
+### v2.26.1 (2013/08/07 16:31 +00:00)
+- [b422510](https://github.com/mikeal/request/commit/b422510ba16315c3e0e1293a17f3a8fa7a653a77) 2.26.1 (@mikeal)
+
+### v2.26.0 (2013/08/07 16:31 +00:00)
+- [3b5b62c](https://github.com/mikeal/request/commit/3b5b62cdd4f3b92e63a65d3a7265f5a85b11c4c9) Only include :password in Basic Auth if it's defined (fixes #602) (@bendrucker)
+- [#605](https://github.com/mikeal/request/pull/605) Only include ":" + pass in Basic Auth if it's defined (fixes #602) (@bendrucker)
+- [cce2c2c](https://github.com/mikeal/request/commit/cce2c2c8ea5b0136932b2432e4e25c0124d58d5a) Moved init of self.uri.pathname (@lexander)
+- [08793ec](https://github.com/mikeal/request/commit/08793ec2f266ef88fbe6c947e6b334e04d4b9dc9) Fix all header casing issues forever. (@mikeal)
+- [#613](https://github.com/mikeal/request/pull/613) Fixes #583, moved initialization of self.uri.pathname (@lexander)
+- [f98ff99](https://github.com/mikeal/request/commit/f98ff990d294165498c9fbf79b2de12722e5c842) Update this old ass readme with some new HOTNESS! (@mikeal)
+- [3312010](https://github.com/mikeal/request/commit/3312010f72d035f22b87a6d8d463f0d91b88fea1) markdown badge instead. (@mikeal)
+- [9cf657c](https://github.com/mikeal/request/commit/9cf657c1f08bf460911b8bb0a8c5c0d3ae6135c7) Shorter title. (@mikeal)
+- [2c61d66](https://github.com/mikeal/request/commit/2c61d66f1dc323bb612729c7320797b79b22034c) put Request out (@joaojeronimo)
+- [28513a1](https://github.com/mikeal/request/commit/28513a1b371452699438c0eb73471f8969146264) 2.26.0 (@mikeal)
+
+### v2.25.1 (2013/07/23 21:51 +00:00)
+- [6387b21](https://github.com/mikeal/request/commit/6387b21a9fb2e16ee4dd2ab73b757eca298587b5) 2.25.1 (@mikeal)
+
+### v2.25.0 (2013/07/23 21:51 +00:00)
+- [828f12a](https://github.com/mikeal/request/commit/828f12a1ae0f187deee4d531b2eaf7531169aaf2) 2.25.0 (@mikeal)
+
+### v2.24.1 (2013/07/23 20:51 +00:00)
+- [29ae1bc](https://github.com/mikeal/request/commit/29ae1bc454c03216beeea69d65b538ce4f61e8c1) 2.24.1 (@mikeal)
+
+### v2.24.0 (2013/07/23 20:51 +00:00)
+- [f667318](https://github.com/mikeal/request/commit/f66731870d5f3e0e5655cd89612049b540c34714) Fixed a small typo (@michalstanko)
+- [#601](https://github.com/mikeal/request/pull/601) Fixed a small typo (@michalstanko)
+- [#594](https://github.com/mikeal/request/pull/594) Emit complete event when there is no callback (@RomainLK)
+- [#596](https://github.com/mikeal/request/pull/596) Global agent is being used when pool is specified (@Cauldrath)
+- [41ce492](https://github.com/mikeal/request/commit/41ce4926fb08242f19135fd3ae10b18991bc3ee0) New deps. (@mikeal)
+- [8176c94](https://github.com/mikeal/request/commit/8176c94d5d17bd14ef4bfe459fbfe9cee5cbcc6f) 2.24.0 (@mikeal)
+
+### v2.23.1 (2013/07/23 02:45 +00:00)
+- [63f31cb](https://github.com/mikeal/request/commit/63f31cb1d170a4af498fbdd7566f867423caf8e3) 2.23.1 (@mikeal)
+
+### v2.23.0 (2013/07/23 02:44 +00:00)
+- [758f598](https://github.com/mikeal/request/commit/758f598de8d6024db3fa8ee7d0a1fc3e45c50f53) Initial commit. Request package. (@mikeal)
+- [104cc94](https://github.com/mikeal/request/commit/104cc94839d4b71aaf3681142daefba7ace78c94) Removing unnecessary markup. (@mikeal)
+- [12a4cb8](https://github.com/mikeal/request/commit/12a4cb88b949cb4a81d51189d432c25c08522a87) Matching node documentation style. (@mikeal)
+- [ab96993](https://github.com/mikeal/request/commit/ab969931106b10b5f8658dc9e0f512c5dfc2a7da) Release tarball. (@mikeal)
+- [e7e37ad](https://github.com/mikeal/request/commit/e7e37ad537081a040ea3e527aac23ae859b40b2c) Removing old tarball. (@mikeal)
+- [e66e90d](https://github.com/mikeal/request/commit/e66e90dd814ae7bfbcd52003609d7bde9eafea57) Adding automatic redirect following. (@mikeal)
+- [2fc5b84](https://github.com/mikeal/request/commit/2fc5b84832ae42f6ddb081b1909d0a6ca00c8d51) Adding SSL support. (@mikeal)
+- [a3ac375](https://github.com/mikeal/request/commit/a3ac375d4b5800a038ae26233425fadc26866fbc) Fixing bug where callback fired for every redirect. (@mikeal)
+- [1139efe](https://github.com/mikeal/request/commit/1139efedb5aad4a328c1d8ff45fe77839a69169f) Cleaning up tests. (@mikeal)
+- [bb49fe6](https://github.com/mikeal/request/commit/bb49fe6709fa06257f4b7aadc2e450fd45a41328) Rolling version. (@mikeal)
+- [4ff3493](https://github.com/mikeal/request/commit/4ff349371931ec837339aa9082c4ac7ddd4c7c35) Updates to README.md (@mikeal)
+- [1c9cf71](https://github.com/mikeal/request/commit/1c9cf719c92b02ba85c4e47bd2b92a3303cbe1cf) Adding optional body buffer. (@mikeal)
+- [49dfef4](https://github.com/mikeal/request/commit/49dfef42630c4fda6fb208534c00638dc0f06a6b) Rolling version. (@mikeal)
+- [ab40cc8](https://github.com/mikeal/request/commit/ab40cc850652e325fcc3b0a44ee7303ae0a7b77f) Preserve the original full path. (@mikeal)
+- [6d70f62](https://github.com/mikeal/request/commit/6d70f62c356f18098ca738b3dbedcf212ac3d8d8) Rolling version. (@mikeal)
+- [e2ca15a](https://github.com/mikeal/request/commit/e2ca15a0f7e986e3063977ee9bd2eb69e86bdb1f) Fixing bugs and rolling version. (@mikeal)
+- [8165254](https://github.com/mikeal/request/commit/81652543d3a09553cbf33095a7932dec53ccecc2) Cleanup. Fixing '' === '/' path bug. (@mikeal)
+- [a0536a4](https://github.com/mikeal/request/commit/a0536a46d0b91e204fbde1e4341461bc827c9542) Rolling version. (@mikeal)
+- [9ccaad7](https://github.com/mikeal/request/commit/9ccaad7dce05e5dcc3eacaf1500404622a0d8067) Adding stream support for request and response bodies. (@mikeal)
+- [585166d](https://github.com/mikeal/request/commit/585166d979d4476e460e9835cc0516d04a9a3e11) Rolling version. (@mikeal)
+- [41111c8](https://github.com/mikeal/request/commit/41111c88d711da80ea123df238d62038b89769bf) Bugfix release for response stream. (@mikeal)
+- [86e375d](https://github.com/mikeal/request/commit/86e375d093700affe4d6d2b76a7acedbe8da140c) Remove host header when we add it. (@mikeal)
+- [3a6277c](https://github.com/mikeal/request/commit/3a6277c81cfd3457c760f2aaea44852ef832a1e8) Rolling version. (@mikeal)
+- [7a11f69](https://github.com/mikeal/request/commit/7a11f69d5353ecc1319e2e91ca4aefbaf0338136) writing requestBodyStream into request (@beanieboi)
+- [186e9cf](https://github.com/mikeal/request/commit/186e9cf692511d768f8016d311609a0a0a315af6) Using sys.pump (@mikeal)
+- [09e7ade](https://github.com/mikeal/request/commit/09e7ade541e1d40316a3f153128871a353e707b1) Fixing host port addition. Rolling version. (@mikeal)
+- [cec3f3f](https://github.com/mikeal/request/commit/cec3f3f619322f27e2a82c7fd8971722f98d04d6) Using builtin base64. (@mikeal)
+- [2a2e2a2](https://github.com/mikeal/request/commit/2a2e2a2f5c4760d4da3caa1a0f2d14c31a4222dc) new structure. new convenience methods (@mikeal)
+- [f835b5f](https://github.com/mikeal/request/commit/f835b5fb605506b8ecd3c17bebe9ed54f0066cfc) removing old files. (@mikeal)
+- [91616c4](https://github.com/mikeal/request/commit/91616c4e4f488f75a8b04b5b6f0ceef7e814cffd) Adding better redirect handling. (@mikeal)
+- [3a95433](https://github.com/mikeal/request/commit/3a95433cbec9693a16ff365148489a058720ae7c) Fixing tests. (@mikeal)
+- [38eb1d2](https://github.com/mikeal/request/commit/38eb1d2fa8dea582bb7c3fb37a7b05ff91857a46) By popular demand, proxy support! Not really tested yet but it seems to kinda work. (@mikeal)
+- [45d41df](https://github.com/mikeal/request/commit/45d41dff63f36b25b3403e59c8b172b7aa9ed373) Added proxy auth. (@mikeal)
+- [85e3d97](https://github.com/mikeal/request/commit/85e3d97e0dced39a3769c4e3f2707ba3aaab1eaa) Fixing for non-proxy case. (@mikeal)
+- [f796da7](https://github.com/mikeal/request/commit/f796da74849d2b0732bd1bae1d2dcaf1243142c1) Fixing relative uri's for forwards. (@mikeal)
+- [dead30e](https://github.com/mikeal/request/commit/dead30ebef9c3ff806b895e2bd32f52ba3988c69) Adding support for specifying an encoding for the response body. (@mikeal)
+- [9433344](https://github.com/mikeal/request/commit/943334488dcc8e7f90727b86f9eb1bc502c33b4f) Removing debugging statement (@mikeal)
+- [41efb7a](https://github.com/mikeal/request/commit/41efb7a7dcca3b47e97c23c6cdbd3e860d3bd82b) Error on maxRedirects exceeded. (@mikeal)
+- [9549570](https://github.com/mikeal/request/commit/95495701fa4e99a3ab85acdab71ecdaabe0dbd45) Allow options.url, people do it all the time, might as well just support it. (@mikeal)
+- [21a53c0](https://github.com/mikeal/request/commit/21a53c016edcc113e809219639807b46d29dba36) Pumping version. (@mikeal)
+- [aca9782](https://github.com/mikeal/request/commit/aca9782285fe1d727570fe8d799561f45d49048e) Fixing byteLength !== string lenght issues. (@mikeal)
+- [a77c296](https://github.com/mikeal/request/commit/a77c296431eda2a211f59bdb88654c4a64ed4ef3) Don't rely on automatic semicolon insertion (pretty please :) (@papandreou)
+- [8b02f29](https://github.com/mikeal/request/commit/8b02f29c9019dd1d1dd291dd85889b26f592a137) Also set content-length when options.body is the empty string. (@papandreou)
+- [023281c](https://github.com/mikeal/request/commit/023281ca9b4414a9bc0170c2b08aaf886a7a08f7) Simplified boolean logic. (@papandreou)
+- [4f897fd](https://github.com/mikeal/request/commit/4f897fdd6c7c93bea73dbf34623f09af63bb1ed4) Simplified check for whether response.headers.location starts with "http:" or "https:". (@papandreou)
+- [6d7db85](https://github.com/mikeal/request/commit/6d7db85cadf401dffdec07a4d66822207898c69e) Fixed double var declaration. (@papandreou)
+- [97255cf](https://github.com/mikeal/request/commit/97255cfd2a4aa8f34d307e7cd96fe1c1f13cb26a) Process redirects as soon as the response arrives. Prevents the uninteresting redirect response from being pumped into responseBodyStream. (@papandreou)
+- [b2af15f](https://github.com/mikeal/request/commit/b2af15f4fcbe1115cf8b53c5ae89fbf2365bfffc) New feature: If options.noBuffer is true, don't buffer up the response, just return it. Most of the time getting a readable stream is much more flexible than having the option to pipe the response into a writable stream. For one thing, the stream can be paused. (@papandreou)
+- [fee5f89](https://github.com/mikeal/request/commit/fee5f89159a8f36b25df509c55093bf7ebd1c993) A few fixes/changes from papandreou's code, also added new semantics for onResponse. (@mikeal)
+- [fa72fcb](https://github.com/mikeal/request/commit/fa72fcb950029b222f0621e2d49304e35d08c380) Updated documentation. (@mikeal)
+- [4fc7209](https://github.com/mikeal/request/commit/4fc72098e7eeb9518951b9306115340ffdcce7ce) Fix for both onResponse and callback (@mikeal)
+- [3153436](https://github.com/mikeal/request/commit/3153436404fca865a65649d46eb22d9797128c9d) Adding license information. (@mikeal)
+- [59570de](https://github.com/mikeal/request/commit/59570dec37913c7e530303a83f03781d9aca958c) Fix for unescaping passwords for basic auth. (@notmatt)
+- [0d771ab](https://github.com/mikeal/request/commit/0d771ab7882b97d776179972c51c59386f91b953) require querystring (@notmatt)
+- [875f79b](https://github.com/mikeal/request/commit/875f79b6a40340457fafafdadac813cfa5343689) Allow request's body to be an object. (@Stanley)
+- [86895b9](https://github.com/mikeal/request/commit/86895b9c37f7b412b7df963c2a75361ff402d8c5) Merge branch 'master' of github.com:Stanley/request (@Stanley)
+- [4c9c984](https://github.com/mikeal/request/commit/4c9c984cb37bfd4e901ce24b0e9b283604c27bf4) Better tests. (@mikeal)
+- [02f6b38](https://github.com/mikeal/request/commit/02f6b38c1697a55ed43940d1fd0bef6225d4faa2) Added specs for body option (@Stanley)
+- [af66607](https://github.com/mikeal/request/commit/af666072a22b8df4d75fe71885139059f56ea5ee) Made specs pass (@Stanley)
+- [641ec05](https://github.com/mikeal/request/commit/641ec052dd95797816e781b2c3ac2524841db7cb) Merge branch 'master' of https://github.com/Stanley/request into jsonbody (@mikeal)
+- [ab4c96b](https://github.com/mikeal/request/commit/ab4c96be1c002c10806d967a4b266543f8b0267c) Moved spec tests to normal node script tests. Style changes to code and docs. (@mikeal)
+- [fc2a7ef](https://github.com/mikeal/request/commit/fc2a7ef301c1266938a5aeb539e4f3fc3b5191dd) Clearer wording for json option. (@mikeal)
+- [01371d7](https://github.com/mikeal/request/commit/01371d728082e22aabeb840da82a30aec62d7d8a) Removing specs loader. (@mikeal)
+- [560dadd](https://github.com/mikeal/request/commit/560dadd6cbd293622c66cd82b5506704c9850b13) Adding newline to end of test files, makes for cleaner diffs in the future. (@mikeal)
+- [a0348dd](https://github.com/mikeal/request/commit/a0348dd0fef462c3c678a639619c27101c757035) Add pass message when tests finish. (@mikeal)
+- [da77a0e](https://github.com/mikeal/request/commit/da77a0e152c1dd43f5c1e698110d23e4d32280db) Adding better debug message on failures for GET tests. (@mikeal)
+- [6aade82](https://github.com/mikeal/request/commit/6aade822a90724a47176771d137e30b0a702e7ef) throw on error. (@mikeal)
+- [4f41b8d](https://github.com/mikeal/request/commit/4f41b8dbbf9a93c53d5ccdf483c9d7803e279916) Rolling version. (@mikeal)
+- [7cf01f0](https://github.com/mikeal/request/commit/7cf01f0481afb367b5d0d4878645ac535cfe9a2e) master is moving to node v0.3.6+ (@mikeal)
+- [cb403a4](https://github.com/mikeal/request/commit/cb403a4cfdbe3d98feb9151fdbdae1e1436e59ab) Initial support for 0.3.6+.\n\nExperimental support for Request objects as streams. It's untested and requires a pending patch to node.js (@mikeal)
+- [a3c80f9](https://github.com/mikeal/request/commit/a3c80f98f42f25d4cb02d5d9e34ba0e67cc89293) Adding defaults call. (@mikeal)
+- [55f22f9](https://github.com/mikeal/request/commit/55f22f96365c57aa8687de951e3f9ed982eba408) Request will keep it's own agent pool so that it can expose a maxSockets setting for easy pool sizing. (@mikeal)
+- [004741c](https://github.com/mikeal/request/commit/004741c23dc0eaf61f111161bb913ba418e033e4) Fixing reference error. (@mikeal)
+- [8548541](https://github.com/mikeal/request/commit/85485414150fbac58b08126b3684f81dcb930bf1) Simplified pool implementation. (@mikeal)
+- [9121c47](https://github.com/mikeal/request/commit/9121c47e4cbe47bccc20a75e0e6c6c098dce04fb) Default to globalPool. (@mikeal)
+- [9ec3490](https://github.com/mikeal/request/commit/9ec3490aefd52f05b57e6db13730ace54b4439d1) Support for https. Requires pending patch in node core for consistent Agent API. (@mikeal)
+- [146b154](https://github.com/mikeal/request/commit/146b154a1a31ae7a30aa9f28e891e4824af548fa) Fixes for reference errors. (@mikeal)
+- [8756120](https://github.com/mikeal/request/commit/8756120f83ceb94f8ba600acba274ba512696eef) Only create an agent when a relevant option is passed. (@mikeal)
+- [cc3cf03](https://github.com/mikeal/request/commit/cc3cf0322847982875ff32a7cef25c39c29630ba) New HTTP client doesn't require such explicit error listener management. (@mikeal)
+- [f7c0379](https://github.com/mikeal/request/commit/f7c0379b99ac7989df7f934be67cc3ae979591bb) Fixing bug in .pipe() handling. Thanks tanepiper. (@mikeal)
+- [897a7ef](https://github.com/mikeal/request/commit/897a7ef020cefcb7a36c04a11e286238df8ecdaa) Fixes for streams, docs, and convenience methods. (@mikeal)
+- [7c2899a](https://github.com/mikeal/request/commit/7c2899a046b750eda495b23b2d58604260deddbc) Doc fixes. (@mikeal)
+- [f535fe1](https://github.com/mikeal/request/commit/f535fe1008c8f11bb37e16f95fe287ed93343704) Doc fixes. (@mikeal)
+- [d1deb5b](https://github.com/mikeal/request/commit/d1deb5b4dda4474fe9d480ad42ace664d89e73ee) Pipe tests, all passing! (@mikeal)
+- [d67a041](https://github.com/mikeal/request/commit/d67a041783df8d724662d82f9fb792db1be3f4f0) Moving basic example to the top. (@mikeal)
+- [6a98b9e](https://github.com/mikeal/request/commit/6a98b9e4a561b516b14d325c48785a9d6f40c514) Do not mix encoding option with pipeing. (@mikeal)
+- [06b67ef](https://github.com/mikeal/request/commit/06b67ef01f73572a6a9b586854d4c21be427bdb2) Disable pooling with {pool:false} (@mikeal)
+- [1c24881](https://github.com/mikeal/request/commit/1c248815b5dfffda43541e367bd4d66955ca0325) Send all arguments passed to stream methods. (@mikeal)
+- [7946393](https://github.com/mikeal/request/commit/7946393893e75df24b390b7ab19eb5b9d6c23891) Better errors and warnings for different pipe conditions. (@mikeal)
+- [ee2108d](https://github.com/mikeal/request/commit/ee2108db592113a0fe3840c361277fdd89f0c89c) Removing commented out legacy code. (@mikeal)
+- [5f838b3](https://github.com/mikeal/request/commit/5f838b3582eda465f366d7df89c6dd69920405f2) Fixing redirect issue, thanks @linus (@mikeal)
+- [c08758e](https://github.com/mikeal/request/commit/c08758e25290ee12278b3eb95d502645e0d66e4e) Adding del alias, thanks tanepiper. (@mikeal)
+- [0b7d675](https://github.com/mikeal/request/commit/0b7d6756c120ebf17ce6c70fc1ff4ecd6850e704) Keep require('https') from throwing if node is compiled with --without-ssl. This will still throw for Invalid Protocol if https is used. Which makes more sense and makes request work without SSl support. (@davglass)
+- [02fc9f7](https://github.com/mikeal/request/commit/02fc9f7cc8912402a5a98ddefaffa5f6da870562) Rolling version. Pushed new version to npm. (@mikeal)
+- [0b30532](https://github.com/mikeal/request/commit/0b30532ee1a3cabb177017acfa7885b157031df2) Sent a patch today to fix this in core but this hack will fix node that predates that fix to core. (@mikeal)
+- [5d5d8f4](https://github.com/mikeal/request/commit/5d5d8f43156b04fd3ceb312cfdf47cc2b0c4104d) Rolling version. Pushed new version to npm. (@mikeal)
+- [1c00080](https://github.com/mikeal/request/commit/1c000809f1795d2e21635a626cf730aba2049d3e) Fixing reference to tls. (@mikeal)
+- [4c355d1](https://github.com/mikeal/request/commit/4c355d1f87fced167e4b21770bfe6f8208f32b53) Be a better stream. (@mikeal)
+- [9bed22f](https://github.com/mikeal/request/commit/9bed22f22e007201d4faeebdb486603c3bb088c3) Rolled version and pushed to npm (@mikeal)
+- [34df8e2](https://github.com/mikeal/request/commit/34df8e2301dcfd10705b9ff3b257741b0816c8a1) typo in `request.defaults` (@clement)
+- [4d7a6d4](https://github.com/mikeal/request/commit/4d7a6d46fa481e43fe873b8c8fad2f7dd816dbb5) default value only if undefined in `request.defaults` + misplaced `return` statement (@clement)
+- [243a565](https://github.com/mikeal/request/commit/243a56563f1014318a467e46113b2c61b485f377) Adding support for request(url) (@mikeal)
+- [83a9cec](https://github.com/mikeal/request/commit/83a9cec3cb2f7a43a1e10c13da8d0dd72b937965) Fixing case where + is in user or password. (@mikeal)
+- [8bb7f98](https://github.com/mikeal/request/commit/8bb7f98ba8b78c217552c979811c07f1299318fe) making Request a duplex stream rather than adding special handling for pipes out. (@mikeal)
+- [55a1fde](https://github.com/mikeal/request/commit/55a1fdedcad1e291502ce10010dda7e478a1b503) pause and resume should act on response instead of request (@tobowers)
+- [63125a3](https://github.com/mikeal/request/commit/63125a33523e72e449ceef76da57b63522998282) Making request really smart about pipeing to itself so that we can do simple proxy cats (@mikeal)
+- [2f9e257](https://github.com/mikeal/request/commit/2f9e257bc39eb329eec660c6d675fb40172fc5a5) Rolling version since master right now has some pretty hot new code in it. (@mikeal)
+- [#31](https://github.com/mikeal/request/pull/31) Error on piping a request to a destination (@tobowers)
+- [b1f3d54](https://github.com/mikeal/request/commit/b1f3d5439d24b848b2bf3a6459eea74cb0e43df3) The "end" event that was supposed to be emitted to fix a core bug in NodeJS wasn't fired because it wasn't emitted on the response object. (@voxpelli)
+- [#35](https://github.com/mikeal/request/pull/35) The "end" event isn't emitted for some responses (@voxpelli)
+- [40b1c67](https://github.com/mikeal/request/commit/40b1c676e1d3a292719ad2dd9cf9354c101bad47) Rolling version. (@mikeal)
+- [9a28022](https://github.com/mikeal/request/commit/9a28022d0e438d0028e61a53e897689470025e50) Fixing bug in forwarding with new pipes logic. (@mikeal)
+- [44e4e56](https://github.com/mikeal/request/commit/44e4e5605b0a9e02036393bcbd3a8d91280f5611) Fixing big bug in forwarding logic. (@mikeal)
+- [b0cff72](https://github.com/mikeal/request/commit/b0cff72d63689d96e0b1d49a8a5aef9ccc71cb8b) Added timeout option to abort the request before the response starts responding (@mbrevoort)
+- [cc76b10](https://github.com/mikeal/request/commit/cc76b109590437bfae54116e3424b2c6e44a3b3e) corrected spelling error in README (@mbrevoort)
+- [#45](https://github.com/mikeal/request/pull/45) Added timeout option (@mbrevoort)
+- [1cca56b](https://github.com/mikeal/request/commit/1cca56b29bb670c53d5995e76c0b075a747b5ad7) Fixing for node http client refactor. (@mikeal)
+- [2a78aa3](https://github.com/mikeal/request/commit/2a78aa3f827e76c548e001fa519448b24466b518) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [ce12273](https://github.com/mikeal/request/commit/ce12273d3990c1446d3166bbd9e35c0e2435f137) New fs.ReadStream handling hotness. (@mikeal)
+- [535e30a](https://github.com/mikeal/request/commit/535e30a4bd4a8e41d97ffa6a4e99630ac09a4bcb) Adding pipe support to HTTP ServerResponse objects. (@mikeal)
+- [2f0cf6b](https://github.com/mikeal/request/commit/2f0cf6bf44edbaec4c0a0cb15a679302de7f0aff) Setting proper statusCode. (@mikeal)
+- [6e3ecb1](https://github.com/mikeal/request/commit/6e3ecb106c3a32101d80ac0f87968fddd3ac5e2c) Adding test for pipeing file to disc. (@mikeal)
+- [bbbb52e](https://github.com/mikeal/request/commit/bbbb52e406b65100b557caa3687a1aa04fab6ff3) Pumping version. (@mikeal)
+- [a10b6e4](https://github.com/mikeal/request/commit/a10b6e4c08478364b8079801fdb23f3530fcc85f) Adding reference to Request instance on response to make it easier on inline callbacks. fixes #43. (@mikeal)
+- [b9aff1f](https://github.com/mikeal/request/commit/b9aff1fe007dab3f93e666f047fa03a4e8f5f8b7) Add body property to resp when we have it as a shorthand. fixes #28 (@mikeal)
+- [411b30d](https://github.com/mikeal/request/commit/411b30dab1fe5b20880113aa801a2fdbb7c35c40) If the error is handled and not throw we would still process redirects. Fixes #34. (@mikeal)
+- [8f3c2b4](https://github.com/mikeal/request/commit/8f3c2b4f6dee8838f30e2430a23d5071128148f0) w00t! request 2.0 (@mikeal)
+- [9957542](https://github.com/mikeal/request/commit/9957542cc6928443f3a7769510673665b5a90040) valid semver. (@mikeal)
+- [31f5ee2](https://github.com/mikeal/request/commit/31f5ee28726ac7e14355cad0c6d2785f9ca422c6) Drastically improved header handling. (@mikeal)
+- [c99b8fc](https://github.com/mikeal/request/commit/c99b8fcd706ae035f6248669b017ac2995e45f31) Return destination stream from pipe(). (@mikeal)
+- [cba588c](https://github.com/mikeal/request/commit/cba588cec1e204d70f40f8bd11df0e27dc78ef0c) Style fixes. Bye Bye semi-colons. Mostly lined up with npm style. (@mikeal)
+- [8515a51](https://github.com/mikeal/request/commit/8515a510ccc0a661d7c28fce6e513a7d71be7f8f) Clearer spacing. Slightly more consistent. (@mikeal)
+- [3acd82a](https://github.com/mikeal/request/commit/3acd82a10e7d973fc5dbaa574c2e8906e48e1ee9) add failing test for issue #51 (@benatkin)
+- [68c17f6](https://github.com/mikeal/request/commit/68c17f6c9a3d7217368b3b8bc61203e6a14eb4f0) implement parsing json response when json is truthy (@benatkin)
+- [1cb1ec1](https://github.com/mikeal/request/commit/1cb1ec114b03394a0a530f245a857d8424cad02d) allow empty string (@benatkin)
+- [4f8d2df](https://github.com/mikeal/request/commit/4f8d2df9f845690667a56e7698dbaf23b5028177) support JSON APIs that don't set the write content type (@benatkin)
+- [#53](https://github.com/mikeal/request/pull/53) Parse json: Issue #51 (@benatkin)
+- [c63e6e9](https://github.com/mikeal/request/commit/c63e6e96378a2b050bddbe1b39337662f304dc95) Adding proxy to docs, don't know why this wasn't already in. (@mikeal)
+- [ef767d1](https://github.com/mikeal/request/commit/ef767d12f13a9c78d3df89add7556f5421204843) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [1b12d3a](https://github.com/mikeal/request/commit/1b12d3a9f48a6142d75fa1790c80eb313388ca44) Emit a proper error. (@mikeal)
+- [47314d7](https://github.com/mikeal/request/commit/47314d7cb41fe9c3a7717a502bed9cf1b6074ffc) Greatly expanded documentation. (@mikeal)
+- [e477369](https://github.com/mikeal/request/commit/e477369b4bbc271248ee8b686c556567570a6cca) Doc refinements. (@mikeal)
+- [fe4d221](https://github.com/mikeal/request/commit/fe4d22109bc1411c29b253756d609856327ff146) Fix for newer npm (@mikeal)
+- [7b2f788](https://github.com/mikeal/request/commit/7b2f788293e205edc7b46a7fd5304296b5e800e3) More doc cleanup. (@mikeal)
+- [f8eb2e2](https://github.com/mikeal/request/commit/f8eb2e229aca38547236d48066a0b3f9f8f67638) Copy headers so that they survive mutation. (@mikeal)
+- [59eab0e](https://github.com/mikeal/request/commit/59eab0e5e49c6d32697822f712ed725843e70010) Rolling version. (@mikeal)
+- [76bf5f6](https://github.com/mikeal/request/commit/76bf5f6c6e37f6cb972b3d4f1ac495a4ceaaa00d) Improvements to json handling and defaults. (@mikeal)
+- [81e2c40](https://github.com/mikeal/request/commit/81e2c4040a9911a242148e1d4a482ac6c745d8eb) Rolling version. (@mikeal)
+- [76d8924](https://github.com/mikeal/request/commit/76d8924cab295f80518a71d5903f1e815618414f) Proper checking and handling of json bodies (@mikeal)
+- [a8422a8](https://github.com/mikeal/request/commit/a8422a80895ed70e3871c7826a51933a75c51b69) Rolling version. (@mikeal)
+- [f236376](https://github.com/mikeal/request/commit/f2363760782c3d532900a86d383c34f3c94f6d5f) Adding pipefilter. (@mikeal)
+- [dd85f8d](https://github.com/mikeal/request/commit/dd85f8da969c2cc1825a7dfec6eac430de36440c) Rolling version. (@mikeal)
+- [#66](https://github.com/mikeal/request/pull/66) Do not overwrite established content-type headers for read stream deliver (@voodootikigod)
+- [b09212f](https://github.com/mikeal/request/commit/b09212f38fe736c2c92a1ee076cae9d0f4c612c3) Do not overwrite established content-type headers for read stream deliveries. (@voodootikigod)
+- [01bc25d](https://github.com/mikeal/request/commit/01bc25d25343d73e9f5731b3d0df1cf5923398d4) Only apply workaround on pre-0.5 node.js and move test to assert.equal (@mikeal)
+- [d487131](https://github.com/mikeal/request/commit/d487131ebc2f7a4bf265061845f7f3ea2fd3ed34) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [1200df5](https://github.com/mikeal/request/commit/1200df52bd334f9a44a43846159146b8f938fd9e) Rolling version. (@mikeal)
+- [8279362](https://github.com/mikeal/request/commit/82793626f6965884a3720d66f5a276d7d4d30873) fix global var leaks (@aheckmann)
+- [#67](https://github.com/mikeal/request/pull/67) fixed global variable leaks (@aheckmann)
+- [ab91204](https://github.com/mikeal/request/commit/ab9120495a89536c7152e3cdf17d684323b40474) Test that chunked responses are properly toString'ed (@isaacs)
+- [9bff39f](https://github.com/mikeal/request/commit/9bff39fa485f28d7f1754e72f026418ca1186783) Properly flatten chunked responses (@isaacs)
+- [8e4e956](https://github.com/mikeal/request/commit/8e4e95654391c71c22933ffd422fdc82d20ac059) Fix #52 Make the tests runnable with npm (@isaacs)
+- [a9aa9d6](https://github.com/mikeal/request/commit/a9aa9d6d50ef0481553da3e50e40e723a58de10a) Fix #71 Respect the strictSSL flag (@isaacs)
+- [#69](https://github.com/mikeal/request/pull/69) Flatten chunked requests properly (@isaacs)
+- [#73](https://github.com/mikeal/request/pull/73) Fix #71 Respect the strictSSL flag (@isaacs)
+- [#70](https://github.com/mikeal/request/pull/70) add test script to package.json (@isaacs)
+- [08ca561](https://github.com/mikeal/request/commit/08ca5617e0d8bcadee98f10f94a49cbf2dd02862) Fixing case where encoding is set. Also cleaning up trailing whitespace because my editor likes to do that now. (@mikeal)
+- [0be269f](https://github.com/mikeal/request/commit/0be269f7d9da6c3a14a59d5579546fee9d038960) Fixing case where no body exists. (@mikeal)
+- [2f37bbc](https://github.com/mikeal/request/commit/2f37bbc51ff84c3c28ae419138a19bd33a9f0103) Fixing timeout tests. (@mikeal)
+- [f551a2f](https://github.com/mikeal/request/commit/f551a2f02a87994249c2fd37dc8f20a29e8bf529) Fixing legacy naming of self as options. (@mikeal)
+- [717789e](https://github.com/mikeal/request/commit/717789ec9f690e9d5216ce1c27688eef822940cc) Avoid duplicate emit when using a timeout (@Marsup)
+- [#76](https://github.com/mikeal/request/pull/76) Bug when a request fails and a timeout is set (@Marsup)
+- [c1d255e](https://github.com/mikeal/request/commit/c1d255e5bcc5791ab69809913fe6d917ab93c8b7) global leakage in request.defaults (@isaacs)
+- [14070f2](https://github.com/mikeal/request/commit/14070f269c79cae6ef9e7f7a415867150599bb8e) Don't require SSL for non-SSL requests (@isaacs)
+- [4b8f696](https://github.com/mikeal/request/commit/4b8f6965e14c6fb704cf16f5bc011e4787cf32b2) Set proxy auth instead of just setting auth a second time (@isaacs)
+- [cd22fbd](https://github.com/mikeal/request/commit/cd22fbdb00b90c5c75187ecf41373cfbb4af5bcd) Merge branch 'proxy-auth-bug' (@isaacs)
+- [#78](https://github.com/mikeal/request/pull/78) Don't try to do strictSSL for non-ssl connections (@isaacs)
+- [d8c53fc](https://github.com/mikeal/request/commit/d8c53fceca3af385753880395c680f6ec3d4d560) Removing legacy call to sys.puts (@mikeal)
+- [731b32b](https://github.com/mikeal/request/commit/731b32b654bb217de3466b8d149ce480988bb24b) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [9c897df](https://github.com/mikeal/request/commit/9c897dffc7e238f10eb7e14c61978d6821c70f56) Enhance redirect handling: (1) response._redirectsFollowed reports the total number of redirects followed instead of being reset to 0; (2) add response.redirects, an array of the response.statusCode and response.headers.location for each redirect. (@danmactough)
+- [#81](https://github.com/mikeal/request/pull/81) Enhance redirect handling (@danmactough)
+- [4c84001](https://github.com/mikeal/request/commit/4c8400103ec18a0729e29e9ffb17dda65ce02f6d) Document strictSSL option (@isaacs)
+- [d517ac0](https://github.com/mikeal/request/commit/d517ac03278b3ebd9a46ca9f263bea68d655822b) allow passing in buffers as multipart bodies (@kkaefer)
+- [6563865](https://github.com/mikeal/request/commit/6563865b80573ad3c68834a6633aff6d322b59d5) bugs[web] should be bugs[url] (@isaacs)
+- [2625854](https://github.com/mikeal/request/commit/262585480c148c56772dfc8386cfc59d5d262ca0) add option followAllRedirects to follow post/put redirects
+- [bc057af](https://github.com/mikeal/request/commit/bc057affb58272d9152766956e5cde4ea51ca043) fix typo, force redirects to always use GET
+- [d68b434](https://github.com/mikeal/request/commit/d68b434693dbf848dff4c570c4249a35329cc24f) Support node 0.5.11-style url parsing (@isaacs)
+- [#96](https://github.com/mikeal/request/pull/96) Authless parsed url host support (@isaacs)
+- [9f66c6d](https://github.com/mikeal/request/commit/9f66c6d79bc6515d870b906df39bd9d6d9164994) Typo, causing 'TypeError: Cannot read property 'length' of undefined' (@isaacs)
+- [#97](https://github.com/mikeal/request/pull/97) Typo in previous pull causes TypeError in non-0.5.11 versions (@isaacs)
+- [b320e05](https://github.com/mikeal/request/commit/b320e05f2d84510f47a6b6857d091c8cd4d3ae2e) When no request body is being sent set 'content-length':0. fixes #89 (@mikeal)
+- [059916c](https://github.com/mikeal/request/commit/059916c545a0faa953cb8ac66b8c3ae243b1c8ce) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [248e9d6](https://github.com/mikeal/request/commit/248e9d65e73ac868948a82d07feaf33387723a1d) Fix for pipe() after response. Added response event, fixed and updated tests, removed deprecated stream objects. (@mikeal)
+- [a2e5d6e](https://github.com/mikeal/request/commit/a2e5d6e30d3e101f8c5a034ef0401fdde8608ccf) Fixing double callback firing. node 0.5 is much better about calling errors on the client object which, when aborting on timeout, predictable emits an error which then triggers a double callback. (@mikeal)
+- [5f80577](https://github.com/mikeal/request/commit/5f805775e6aeaaf229cc781439b29108fb69f373) Release for 0.6 (@mikeal)
+- [bf906de](https://github.com/mikeal/request/commit/bf906de601121b52c433b0af208550f1db892cde) Adding some oauth support, tested with Twitter. (@mikeal)
+- [8869b2e](https://github.com/mikeal/request/commit/8869b2e88cc305e224556c5ca75b7b59311911d9) Removing irrelevant comments. (@mikeal)
+- [8323eed](https://github.com/mikeal/request/commit/8323eed4915bb73b33544bc276f3840c13969134) Closed issue 82 : handling cookies - added tests too
+- [739f841](https://github.com/mikeal/request/commit/739f84166d619778ab96fd0b0f4f1f43e8b0fdda) Closed issue 82 : handling cookies - added tests too
+- [7daf841](https://github.com/mikeal/request/commit/7daf8415fb1a4e707ec54eb413169e49d8bbe521) Closed issue 82 : handling cookies - added tests too
+- [6c22041](https://github.com/mikeal/request/commit/6c22041a4719bf081c827dda8f35e7b79b4c39d9) changed README
+- [3db7f7d](https://github.com/mikeal/request/commit/3db7f7d38e95406b84f06fed52b69038b0250904) Updated README
+- [6181b7a](https://github.com/mikeal/request/commit/6181b7a8a4be75bcf75cd3ff6dacb8e910737e92) Documented request.cookie() and request.jar()
+- [fc44260](https://github.com/mikeal/request/commit/fc44260d13f0094bfe96d18878a11c6fe88b69e5) Tiny cookie example error on README
+- [366831b](https://github.com/mikeal/request/commit/366831b705b5d5ebfbec5f63b4b140cbafcb4515) Remove instanceof check for CookieJar (mikeal suggestion)
+- [88488cf](https://github.com/mikeal/request/commit/88488cf076efbd916b0326e0981e280c993963a7) Also add cookie to the user defined cookie jar (mikeal's suggestion)
+- [f6fef5b](https://github.com/mikeal/request/commit/f6fef5bfa4ba8e1dfa3022df8991716e5cba7264) Updated cookie documentation in README file
+- [b519044](https://github.com/mikeal/request/commit/b5190441a889164dfeb4148fac643fd7a87cfb51) request.defaults({jar: false}) disables cookies && also updated README
+- [856a65c](https://github.com/mikeal/request/commit/856a65cd28402efbe3831a68d73937564a27ea9b) Update jar documentation in the options also
+- [#102](https://github.com/mikeal/request/pull/102) Implemented cookies - closes issue 82: https://github.com/mikeal/request/issues/82 (@alessioalex)
+- [62592e7](https://github.com/mikeal/request/commit/62592e7fe9ee5ecaee80b8f5bc2400e4a277e694) Cookie bugs (@janjongboom)
+- [a06ad2f](https://github.com/mikeal/request/commit/a06ad2f955270974409e75c088e1f5d1f5298ff5) Follow redirects should work on PUT and POST requests as well. This is more consistent to other frameworks, e.g. .NET (@janjongboom)
+- [bf3f5d3](https://github.com/mikeal/request/commit/bf3f5d30fdabf6946096623fc3398bb66ed19a1f) Cookies shouldn't be discarded when followRedirect = true (@janjongboom)
+- [16db85c](https://github.com/mikeal/request/commit/16db85c07e6c2516269299640fdddca6db7bc051) Revert "Follow redirects should work on PUT and POST requests as well. This is more consistent to other frameworks, e.g. .NET" (@janjongboom)
+- [841664e](https://github.com/mikeal/request/commit/841664e309f329be98c1a011c634f5291af1eebc) Add test for proxy option (@dominictarr)
+- [#105](https://github.com/mikeal/request/pull/105) added test for proxy option. (@dominictarr)
+- [50d2d39](https://github.com/mikeal/request/commit/50d2d3934cd86d7142a4aab66017bb1ef82329cf) Fixing test, emitter matches on req.url so it needs the full url. (@mikeal)
+- [668a291](https://github.com/mikeal/request/commit/668a291013380af305eba12b1d5c7a5376a74c76) Adding some documentation for OAuth signing support. (@mikeal)
+- [04faa3b](https://github.com/mikeal/request/commit/04faa3bf2b1f4ec710414c6ec7231b24767b2f89) Minor improvements in example (@mikeal)
+- [0fddc17](https://github.com/mikeal/request/commit/0fddc1798dcd9b213e3f8aec504c61cecf4d7997) Another small fix to the url in the docs. (@mikeal)
+- [337649a](https://github.com/mikeal/request/commit/337649a08b4263c0d108cd4621475c8ff9cf8dd0) Add oauth to options. (@mikeal)
+- [#86](https://github.com/mikeal/request/pull/86) Can't post binary to multipart requests (@developmentseed)
+- [4e4d428](https://github.com/mikeal/request/commit/4e4d4285490be20abf89ff1fb54fb5088c01c00e) Update to Iris Couch URL (@jhs)
+- [#110](https://github.com/mikeal/request/pull/110) Update to Iris Couch URL (@iriscouch)
+- [d7af099](https://github.com/mikeal/request/commit/d7af0994b382466367f2cafc5376150e661eeb9d) Remove the global `i` as it's causing my test suites to fail with leak detection turned on. (@3rd-Eden)
+- [#117](https://github.com/mikeal/request/pull/117) Remove the global `i` (@3rd-Eden)
+- [b2a4ad1](https://github.com/mikeal/request/commit/b2a4ad1e7d7553230e932ea093d7f77f38147ef9) Force all cookie keys into lower case as suggested by LinusU (@jhurliman)
+- [055a726](https://github.com/mikeal/request/commit/055a7268b40425643d23bd6a4f09c7268dbab680) Applying a modified version of pull request #106 as suggested by janjongboom (@jhurliman)
+- [#121](https://github.com/mikeal/request/pull/121) Another patch for cookie handling regression (@jhurliman)
+- [a353f4e](https://github.com/mikeal/request/commit/a353f4eeb312ea378d34b624f5c4df33eefa152c) Merge remote-tracking branch 'upstream/master' (@janjongboom)
+- [#104](https://github.com/mikeal/request/pull/104) Cookie handling contains bugs (@janjongboom)
+- [a3be5ad](https://github.com/mikeal/request/commit/a3be5ad5ea112422ed00da632530b93bcf54727c) Fix encoding of characters like ( (@mikeal)
+- [dd2067b](https://github.com/mikeal/request/commit/dd2067bbbf77d1132c9ed480848645136b8a5521) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [ddc4e45](https://github.com/mikeal/request/commit/ddc4e453c3b9a0e11da4df156c5e15206abfc1ef) Pushed new version to npm (@mikeal)
+- [feee5eb](https://github.com/mikeal/request/commit/feee5ebd2ca8c09db25b5cb13cd951f7c4322a49) Real fix for encoding issues in javascript and oauth. (@mikeal)
+- [23896cd](https://github.com/mikeal/request/commit/23896cdc66d75ec176876167ff21da72b7ff181b) Pushed new version to npm. (@mikeal)
+- [a471ed2](https://github.com/mikeal/request/commit/a471ed2ca8acdca1010a0fc20434c5c9956b0d0c) HTTP redirect tests (@jhs)
+- [a4a9aa1](https://github.com/mikeal/request/commit/a4a9aa199ff958630791e131092ec332ada00a49) A self-signed certificate for upcoming HTTPS testing (@jhs)
+- [10ac6b9](https://github.com/mikeal/request/commit/10ac6b9db40263bec1bf63ee7e057000ffd2d7e9) HTTPS tests, for now a copy of the test-body tests (@jhs)
+- [105aed1](https://github.com/mikeal/request/commit/105aed1ff99add1957f91df7efabf406e262f463) Support an "httpModules" object for custom http/https module behavior (@jhs)
+- [#112](https://github.com/mikeal/request/pull/112) Support using a custom http-like module (@iriscouch)
+- [d05a875](https://github.com/mikeal/request/commit/d05a8753af576fc1adccc7ffe9633690371c05ee) Test for #129 (@mikeal)
+- [06cdfaa](https://github.com/mikeal/request/commit/06cdfaa3c29233dac3f47e156f2b5b3a0f0ae4b8) return body as buffer when encoding is null
+- [#132](https://github.com/mikeal/request/pull/132) return the body as a Buffer when encoding is set to null (@jahewson)
+- [4882e51](https://github.com/mikeal/request/commit/4882e519ed6b8d08795da5de37166148ce0ee440) fixed cookies parsing, updated tests (@afanasy)
+- [2be228e](https://github.com/mikeal/request/commit/2be228ec8b48a60028bd1d80c8cbebf23964f913) Change `host` to `hostname` in request hash
+- [#135](https://github.com/mikeal/request/pull/135) host vs hostname (@iangreenleaf)
+- [e24abc5](https://github.com/mikeal/request/commit/e24abc5cc2c6fa154ae04fe58a16d135eeba4951) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [c99c809](https://github.com/mikeal/request/commit/c99c809bb48b9c0193aae3789c5c844f7f6cbe92) Reverting host -> hostname because it breaks in pre-0.6. (@mikeal)
+- [a1134d8](https://github.com/mikeal/request/commit/a1134d855f928fde5c4fe9ee255c111da0195bfc) adding logging (@mikeal)
+- [#133](https://github.com/mikeal/request/pull/133) Fixed cookies parsing (@afanasy)
+- [9179471](https://github.com/mikeal/request/commit/9179471f9f63b6ba9c9078a35cb888337ce295e8) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [cbb180b](https://github.com/mikeal/request/commit/cbb180b0399074995c235a555e3e3e162d738f7c) Fixes to oauth test. (@mikeal)
+- [e1c351f](https://github.com/mikeal/request/commit/e1c351f92958634ccf3fbe78aa2f5b06d9c9a5fa) Published new version. (@mikeal)
+- [3ceee86](https://github.com/mikeal/request/commit/3ceee86f1f3aad3a6877d6d3813e087549f3b485) Formatting fixes. (@mikeal)
+- [18e1af5](https://github.com/mikeal/request/commit/18e1af5e38168dcb95c8ae29bb234f1ad9bbbdf9) Fixing log error. (@mikeal)
+- [edc19b5](https://github.com/mikeal/request/commit/edc19b5249f655714efa0f8fa110cf663b742921) Pushed new version. (@mikeal)
+- [f51c32b](https://github.com/mikeal/request/commit/f51c32bd6f4da0419ed8404b610c43ee3f21cf92) added "form" option to readme. (@petejkim)
+- [#144](https://github.com/mikeal/request/pull/144) added "form" option to readme (@petejkim)
+- [b58022e](https://github.com/mikeal/request/commit/b58022ecda782af93e35e5f9601013b90b09ca73) add "forever" method (@thejh)
+- [79d4651](https://github.com/mikeal/request/commit/79d46510ddff2e2c12c69f7ae4072ec489e27b0e) remove logging (@thejh)
+- [f87cbf6](https://github.com/mikeal/request/commit/f87cbf6ec6fc0fc2869c340114514c887b304a80) retry on ECONNRESET on reused socket (@thejh)
+- [1a91675](https://github.com/mikeal/request/commit/1a916757f4ec48b1282fddfa0aaa0fa6a1bf1267) Multipart requests should respect content-type if set; Issue #145 (@apeace)
+- [#146](https://github.com/mikeal/request/pull/146) Multipart should respect content-type if previously set (@apeace)
+- [#148](https://github.com/mikeal/request/pull/148) Retry Agent (@thejh)
+- [70c5b63](https://github.com/mikeal/request/commit/70c5b63aca29a7d1629fa2909ff5b7199bbf0fd1) Publishing new version to npm. (@mikeal)
+- [fc0f04b](https://github.com/mikeal/request/commit/fc0f04bab5d6be56a2c19d47d3e8386bd9a0b29e) Fix: timeout on socket, timeout after redirect
+- [ef79e59](https://github.com/mikeal/request/commit/ef79e59bbb88ed3e7d4368fe3ca5eee411bda345) Fix: timeout after redirect 2
+- [c32a218](https://github.com/mikeal/request/commit/c32a218da2296e89a269f1832d95b12c4aa10852) merge master (@jroes)
+- [d2d9b54](https://github.com/mikeal/request/commit/d2d9b545e5679b829d33deeba0b22f9050fd78b1) add line to docs describing followAllRedirects option (@jroes)
+- [#90](https://github.com/mikeal/request/pull/90) add option followAllRedirects to follow post/put redirects (@jroes)
+- [c08ab7e](https://github.com/mikeal/request/commit/c08ab7efaefd39c04deb6986716efe5a6069528e) Emit an event after we create the request object so that people can manipulate it before nextTick(). (@mikeal)
+- [#162](https://github.com/mikeal/request/pull/162) Fix issue #159 (@dpetukhov)
+- [e77a169](https://github.com/mikeal/request/commit/e77a1695c5c632c067857e99274f28a1d74301fe) fixing streaming example. fixes #164 (@mikeal)
+- [ee53386](https://github.com/mikeal/request/commit/ee53386d85975c79b801edbb4f5bb7ff4c5dc90b) fixes #127 (@mikeal)
+- [e2cd9de](https://github.com/mikeal/request/commit/e2cd9de9a9d10e1aa4cf4e26006bb30fa5086f0b) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [a0ab977](https://github.com/mikeal/request/commit/a0ab9770a8fb89f970bb3783ed4e6dde9e33511b) Added failing test for #125. (@papandreou)
+- [c80800a](https://github.com/mikeal/request/commit/c80800a834b0f8bc0fb40d1fad4d4165a83369fd) Fix cookie jar/headers.cookie collision. Closes #125. (@papandreou)
+- [1ac9e2d](https://github.com/mikeal/request/commit/1ac9e2d1bf776728a1fe676dd3693ef66f50f7f7) Redirect test: Also assert that the request cookie doesn't get doubled in the request for the landing page. (@papandreou)
+- [07bbf33](https://github.com/mikeal/request/commit/07bbf331e2a0d40d261487f6222e8cafee0e50e3) Fixes #150 (@mikeal)
+- [c640eed](https://github.com/mikeal/request/commit/c640eed292c06eac3ec89f60031ddf0fc0add732) Cookie jar handling: Don't double the cookies on each redirect (see discussion on #139). (@papandreou)
+- [808de8b](https://github.com/mikeal/request/commit/808de8b0ba49d4bb81590ec37a873e6be4d9a416) Adding some missing mime types #138 (@serby)
+- [#161](https://github.com/mikeal/request/pull/161) Fix cookie jar/headers.cookie collision (#125) (@papandreou)
+- [#168](https://github.com/mikeal/request/pull/168) Picking off an EasyFix by adding some missing mimetypes. (@serby)
+- [2a30487](https://github.com/mikeal/request/commit/2a304879f4218c1e46195d882bc81c0f874be329) bugfix - allow add cookie to wrapped request (defaults) (@fabianonunes)
+- [a18b4f1](https://github.com/mikeal/request/commit/a18b4f14559f56cf52ca1b421daa6a934d28d51b) Making pipeDest a public prototype method rather than keeping it private. (@mikeal)
+- [#170](https://github.com/mikeal/request/pull/170) can't create a cookie in a wrapped request (defaults) (@fabianonunes)
+- [49a0f60](https://github.com/mikeal/request/commit/49a0f604779c91dd1759a02cbb195ccbd8d73f5d) Structural refactor, getting read for composable API. (@mikeal)
+- [5daa0b2](https://github.com/mikeal/request/commit/5daa0b28b06cf109614f19e76b0e0b9b25ee3baf) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [e4df85c](https://github.com/mikeal/request/commit/e4df85c72221bf09ee7e1eb54f6c881851bd4164) Composable API for OAuth. (@mikeal)
+- [945ec40](https://github.com/mikeal/request/commit/945ec40baef968ddd468c3b4dfce01621e4a0e31) Composable form API (@mikeal)
+- [c30b47f](https://github.com/mikeal/request/commit/c30b47f229522a75af85da269157377b4a7dc37d) Use this, return this. (@mikeal)
+- [e908644](https://github.com/mikeal/request/commit/e908644a69f9107b954f13635736f1e640216aec) Composable multipart API. (@mikeal)
+- [e115677](https://github.com/mikeal/request/commit/e115677b1a03576eb96386986c350f211a4f38cd) Composable jar. Guard against overwrites on retry. (@mikeal)
+- [a482e48](https://github.com/mikeal/request/commit/a482e4802e11fd122b12e18d1b18b49850fef823) Updating copyright for the new year. (@mikeal)
+- [3c6581a](https://github.com/mikeal/request/commit/3c6581a9d4508fe5d75e111ae0fb94c5e0078404) Adding clobber argument for appending to headers. thanks @isaacs (@mikeal)
+- [54e6aca](https://github.com/mikeal/request/commit/54e6aca0ab5982621fc9b35500f2154e50c0c95d) Fixes #144. (@mikeal)
+- [12f4997](https://github.com/mikeal/request/commit/12f4997ed83bfbfefa3fc5b5635bc9a6829aa0d7) Fixing clobber. (@mikeal)
+- [2f34fd1](https://github.com/mikeal/request/commit/2f34fd13b7ec86cb1c67e0a58664b9e060a34a50) Added support for a "query" option value that is a hash of querystring values that is merged (taking precedence over) with the querystring passed in the uri string. (@csainty)
+- [a32d9e7](https://github.com/mikeal/request/commit/a32d9e7069533fb727a71730dbaa0f62ebefb731) Added a js based test runner so I can run tests on windows. (@csainty)
+- [e0b6ce0](https://github.com/mikeal/request/commit/e0b6ce063de0c4223c97982128bb8203caf4a331) Tidied up an issue where ?> was being appended to URLs. (@csainty)
+- [d47150d](https://github.com/mikeal/request/commit/d47150d6748a452df336d8de9743218028a876db) Refactored to match the composable style (@csainty)
+- [b7e0929](https://github.com/mikeal/request/commit/b7e0929837873a8132476bb2b4d2e2a0fdc7cd0f) implemented issue #173 allow uri to be first argument (@twilson63)
+- [b7264a6](https://github.com/mikeal/request/commit/b7264a6626481d5da50a28c91ea0be7b688c9daf) removed debug line and reset ports (@twilson63)
+- [76598c9](https://github.com/mikeal/request/commit/76598c92bee64376e5d431285ac1bf6783140dbb) removed npm-debug (@twilson63)
+- [#177](https://github.com/mikeal/request/pull/177) Issue #173 Support uri as first and optional config as second argument (@twilson63)
+- [0f24051](https://github.com/mikeal/request/commit/0f240517dea65337636a49cb1cc2b5327504430e) Renamed query to qs. It was actually my first choice, but there appeared to be conflicts with the qs = require('querystring'). These are no longer present though and must have been unrelated. (@csainty)
+- [becedaa](https://github.com/mikeal/request/commit/becedaaa7681b0c4ad5c0a9b9922fc950f091af2) Changed test structure to no longer require a server, modeled on the oauth tests. This also lets me revert some of the changes I had to make to the test server and proxy tests (@csainty)
+- [9b2bbf0](https://github.com/mikeal/request/commit/9b2bbf0c12e87a59320efac67759041cd4af913f) Modified how the qs function works, it now no longer tweaks the existing request uri, instead it recreates a new one. This allows me to revert all the other changes I had to make previously and gives a nice clean commit that is self contained. (@csainty)
+- [5ac7e26](https://github.com/mikeal/request/commit/5ac7e26ce4f7bf5a334df91df83699891171c0ae) failing test for .pipe(dst, opts) (@substack)
+- [3b2422e](https://github.com/mikeal/request/commit/3b2422e62fbd6359b841e59a2c1888db71a22c2c) fix for failing pipe opts test (@substack)
+- [8788c8b](https://github.com/mikeal/request/commit/8788c8b8cba96662e9d94a96eb04d96b904adea3) added uri param for post, put, head, del shortcuts (@twilson63)
+- [#179](https://github.com/mikeal/request/pull/179) fix to add opts in .pipe(stream, opts) (@substack)
+- [#180](https://github.com/mikeal/request/pull/180) Modified the post, put, head and del shortcuts to support uri optional param (@twilson63)
+- [37d0699](https://github.com/mikeal/request/commit/37d0699eb681e85b7df4896b0a68b6865e596cb3) Fixing end bug i introduced being stupid. (@mikeal)
+- [3a97292](https://github.com/mikeal/request/commit/3a97292f45273fa2cc937c0698ba19964780b4bb) fixed defaults functionality to support (uri, options, callback) (@twilson63)
+- [#182](https://github.com/mikeal/request/pull/182) Fix request.defaults to support (uri, options, callback) api (@twilson63)
+- [c94b200](https://github.com/mikeal/request/commit/c94b200258fa48697e386121a3e114ab7bed2ecf) Switched npm test from the bash script to a node script so that it is cross-platform. (@csainty)
+- [#176](https://github.com/mikeal/request/pull/176) Querystring option (@csainty)
+- [3b1e609](https://github.com/mikeal/request/commit/3b1e6094451e8d34c93353177de9d76e9a805e43) Adding defaults test back in. (@mikeal)
+- [b4ae0c2](https://github.com/mikeal/request/commit/b4ae0c2d50f018a90a3ec8daa1d14c92a99873b9) Fixing idiotic bug I introduced. (@mikeal)
+- [32f76c8](https://github.com/mikeal/request/commit/32f76c8baaf784dc2f4f1871153b1796bcebdcfe) Pushed new version to npm. (@mikeal)
+- [00d0d9f](https://github.com/mikeal/request/commit/00d0d9f432182f13a5b8aa2e3a2a144b5c179015) Adding accept header to json support. (@mikeal)
+- [0f580e6](https://github.com/mikeal/request/commit/0f580e6f6317c5301a52c0b6963d58e27112abca) Add abort support to the returned request (@itay)
+- [4505e6d](https://github.com/mikeal/request/commit/4505e6d39a44229bfe5dc4d9a920233e05a7dfdb) Fixing some edge streaming cases with redirects by reusing the Request object. (@mikeal)
+- [eed57af](https://github.com/mikeal/request/commit/eed57af8fe3e16632e9e0043d4d7f4d147dbfb8f) Published new version. (@mikeal)
+- [97386b5](https://github.com/mikeal/request/commit/97386b5d7315b5c83702ffc7d0b09e34ecb67e04) Fixing pretty bad bug from the composable refactor. (@mikeal)
+- [b693ce6](https://github.com/mikeal/request/commit/b693ce64e16aaa859d4edc86f82fbb11e00d33c0) Move abort to a prototype method, don't raise error (@itay)
+- [1330eef](https://github.com/mikeal/request/commit/1330eef3ec84a651a435c95cf1ff1a4003086440) Merge branch 'master' of git://github.com/mikeal/request (@itay)
+- [#188](https://github.com/mikeal/request/pull/188) Add abort support to the returned request (@itay)
+- [5ff4645](https://github.com/mikeal/request/commit/5ff46453e713da1ae66a0d510eda4919e4080abe) Style changes. (@mikeal)
+- [2dbd1e4](https://github.com/mikeal/request/commit/2dbd1e4350c2941b795b0e5ee7c0a00cd04cce09) Fixing new params style on master for head request. (@mikeal)
+- [14989b2](https://github.com/mikeal/request/commit/14989b2dfc6830dbdad5364930fba1d2995aba06) Pushed new version to npm. (@mikeal)
+- [0ea2351](https://github.com/mikeal/request/commit/0ea2351ef017ada9b8472f8d73086715ebe30c6a) Fixes #190. outdated check on options.json from before we had boolean support. (@mikeal)
+- [21bf78c](https://github.com/mikeal/request/commit/21bf78c264316f75f4e6c571461521cda6ccf088) Adds a block on DELETE requests in status 300-400 (@goatslacker)
+- [0c0c201](https://github.com/mikeal/request/commit/0c0c20139b28b21a860f72b8ce0124046fae421d) Adds tests for GH-119 Fix (@goatslacker)
+- [#193](https://github.com/mikeal/request/pull/193) Fixes GH-119 (@goatslacker)
+- [5815a69](https://github.com/mikeal/request/commit/5815a697347f20658dc2bdfd0d06e41d0aa0dac4) Fixes #194. setTimeout only works on node 0.6+ (@mikeal)
+- [1ddcd60](https://github.com/mikeal/request/commit/1ddcd605bc8936c5b3534e1cf9aa1b29fa2b060b) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [7b35b4f](https://github.com/mikeal/request/commit/7b35b4ff63bbdf133f0f600a88a87b5723d29bdf) Removing old checks for self.req, it's ensured if start() is called. Implementing early pause/resume for when streams try to pause/resume before any data is emitted. Fixes #195. (@mikeal)
+- [f01b79b](https://github.com/mikeal/request/commit/f01b79bb651f64065bac8877739223527f5b5592) Make ForeverAgent work with HTTPS (@isaacs)
+- [#197](https://github.com/mikeal/request/pull/197) Make ForeverAgent work with HTTPS (@isaacs)
+- [8d85b57](https://github.com/mikeal/request/commit/8d85b57ebb81c9d2d0a6b94aed41bf2ab0e3ad09) Forever inherits bugfix (@isaacs)
+- [#198](https://github.com/mikeal/request/pull/198) Bugfix on forever usage of util.inherits (@isaacs)
+- [37446f5](https://github.com/mikeal/request/commit/37446f54bb21cf9c83ffa81d354d799ae7ecf9ed) Add a test of HTTPS strict with CA checking (@isaacs)
+- [8378d2e](https://github.com/mikeal/request/commit/8378d2ef9b8121a9851d21b3f6ec8304bde61c9d) Support tunneling HTTPS requests over proxies (@isaacs)
+- [#199](https://github.com/mikeal/request/pull/199) Tunnel (@isaacs)
+- [f0052ac](https://github.com/mikeal/request/commit/f0052ac5e6ca9f3f4aa49f6cda6ba15eb5d8b8e6) Published new version to npm. (@mikeal)
+- [cea668f](https://github.com/mikeal/request/commit/cea668f6f7d444831313ccc0e0d301d25f2bd421) Adding more explicit error when undefined is passed as uri or options. (@mikeal)
+- [047b7b5](https://github.com/mikeal/request/commit/047b7b52f3b11f4c44a02aeb1c3583940ddb59c7) Fix special method functions that get passed an options object. (@mikeal)
+- [746de0e](https://github.com/mikeal/request/commit/746de0ef2f564534b29eeb8f296a59bd2c3086a7) pass through Basic authorization option for HTTPS tunneling
+- [6fda9d7](https://github.com/mikeal/request/commit/6fda9d7d75e24cc1302995e41e26a91e03fdfc9a) Always clobber internal objects for qs but preserve old querystring args when clobber is present. (@mikeal)
+- [75ca7a2](https://github.com/mikeal/request/commit/75ca7a25bc9c6102e87f3660a25835c7fcd70edb) Merge branch 'master' of https://github.com/mikeal/request
+- [3b9f0fd](https://github.com/mikeal/request/commit/3b9f0fd3da4ae74de9ec76e7c66c57a7f8641df2) Fix cookies so that attributes are case insensitive
+- [fddbd6e](https://github.com/mikeal/request/commit/fddbd6ee7d531bc4a82f629633b9d1637cb039e8) Properly set cookies during redirects
+- [0d0bdb7](https://github.com/mikeal/request/commit/0d0bdb793f908492d4086fae8744f1e33e68d8c6) Remove request body when following non-GET redirects
+- [#203](https://github.com/mikeal/request/pull/203) Fix cookie and redirect bugs and add auth support for HTTPS tunnel (@milewise)
+- [b5fa773](https://github.com/mikeal/request/commit/b5fa773994de1799cf53491db7f5f3ba32825b20) Replace all occurrences of special chars in RFC3986 (@chriso)
+- [bc6cd6c](https://github.com/mikeal/request/commit/bc6cd6ca6c6157bad76f0b2b23d4993f389ba977) documenting additional behavior of json option (@jphaas)
+- [80e4e43](https://github.com/mikeal/request/commit/80e4e43186de1e9dcfaa1c9a921451560b91267c) Fixes #215. (@mikeal)
+- [51f343b](https://github.com/mikeal/request/commit/51f343b9adfc11ec1b2ddcfb52a57e1e13feacb2) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [89c0f1d](https://github.com/mikeal/request/commit/89c0f1dd324bc65ad9c07436fb2c8220de388c42) titlecase authorization for oauth (@visnup)
+- [#217](https://github.com/mikeal/request/pull/217) need to use Authorization (titlecase) header with Tumblr OAuth (@visnup)
+- [8c163eb](https://github.com/mikeal/request/commit/8c163eb9349459839fc720658979d5c97a955825) Double quotes are optional, and the space after the ; could be required (@janjongboom)
+- [#224](https://github.com/mikeal/request/pull/224) Multipart content-type change (@janjongboom)
+- [96f4b9b](https://github.com/mikeal/request/commit/96f4b9b1f7b937a92f3f94f10d6d02f8878b6107) Style changes. (@mikeal)
+- [b131c64](https://github.com/mikeal/request/commit/b131c64816f621cf15f8c51e76eb105778b4aad8) Adding safe .toJSON method. fixes #167 (@mikeal)
+- [05d6e02](https://github.com/mikeal/request/commit/05d6e02c31ec4e6fcfadbfbe5414e701710f6e55) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [74ca9a4](https://github.com/mikeal/request/commit/74ca9a4852b666d30dd71421e8cc8b8a83177148) Unified error and complete handling. Fixes #171 (@mikeal)
+- [a86c7dc](https://github.com/mikeal/request/commit/a86c7dc7d0a7c640c7def4c0215e46e76a11ff56) Fixing followAllRedirects and all the redirect tests. (@mikeal)
+- [#211](https://github.com/mikeal/request/pull/211) Replace all occurrences of special chars in RFC3986 (@chriso)
+- [7e24e8a](https://github.com/mikeal/request/commit/7e24e8a48d0dcfe10d0cc08b3c4e9627b9a95a97) New version on npm, first 3.0 release candidate. (@mikeal)
+- [22e0f0d](https://github.com/mikeal/request/commit/22e0f0d73459c11b81b0f66a2cde85492dd8e38f) Added test for .toJSON() (@mikeal)
+- [df32746](https://github.com/mikeal/request/commit/df32746f157948b6ae05e87a35cf1768e065ef0b) Adding toJSON to npm test. (@mikeal)
+- [e65bfba](https://github.com/mikeal/request/commit/e65bfba98f0886a059a268dcdceabf41aec1e5cc) New version in npm. (@mikeal)
+- [2b95921](https://github.com/mikeal/request/commit/2b959217151aaff7a6e7cc15e2acfccd1bbb9b85) Fixing defaults when url is passed instead of uri. (@mikeal)
+- [e0534d8](https://github.com/mikeal/request/commit/e0534d860b4931a7a6e645b328fd4418a5433057) Pushed new version to npm. (@mikeal)
+- [d2dc835](https://github.com/mikeal/request/commit/d2dc83538379e9e1fafb94f5698c56b4a5318d8d) don't error when null is passed for options (@polotek)
+- [db80bf0](https://github.com/mikeal/request/commit/db80bf0444bd98c45f635f305154b9da20eed328) expose initParams (@polotek)
+- [8cf019c](https://github.com/mikeal/request/commit/8cf019c9f9f719694408840823e92da08ab9dac3) allow request.defaults to override the main request method (@polotek)
+- [#240](https://github.com/mikeal/request/pull/240) don't error when null is passed for options (@polotek)
+- [69d017d](https://github.com/mikeal/request/commit/69d017de57622429f123235cc5855f36b3e18d1c) added dynamic boundary for multipart requests (@zephrax)
+- [fc13e18](https://github.com/mikeal/request/commit/fc13e185f5e28a280d347e61622ba708e1cd7bbc) added dynamic boundary for multipart requests (@zephrax)
+- [#243](https://github.com/mikeal/request/pull/243) Dynamic boundary (@zephrax)
+- [1764176](https://github.com/mikeal/request/commit/176417698a84c53c0a69bdfd2a05a2942919816c) Fixing the set-cookie header (@jeromegn)
+- [#246](https://github.com/mikeal/request/pull/246) Fixing the set-cookie header (@jeromegn)
+- [6f9da89](https://github.com/mikeal/request/commit/6f9da89348b848479c23192c04b3c0ddd5a4c8bc) do not set content-length header to 0 when self.method is GET or self.method is undefined (@sethbridges)
+- [efc0ea4](https://github.com/mikeal/request/commit/efc0ea44d63372a30011822ad9d37bd3d7b85952) Experimental AWS signing. Signing code from knox. (@mikeal)
+- [4c08a1c](https://github.com/mikeal/request/commit/4c08a1c10bc0ebb679e212ad87419f6c4cc341eb) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [fdb10eb](https://github.com/mikeal/request/commit/fdb10eb493110b8e6e4f679524f38cef946e3f08) Adding support for aws in options. (@mikeal)
+- [dac6a30](https://github.com/mikeal/request/commit/dac6a301ae03207af88fae6f5017e82157b79b41) Fixing upgraded stat size and supporting content-type and content-md5 properly. (@mikeal)
+- [98cb503](https://github.com/mikeal/request/commit/98cb50325e1d7789fd9f44523d2315df5f890d10) Allow body === '' /* the empty string */. (@Filirom1)
+- [0e9ac12](https://github.com/mikeal/request/commit/0e9ac12c69aaca370fbca94b41358e1c3a2f6170) fixed just another global leak of i (@sreuter)
+- [#260](https://github.com/mikeal/request/pull/260) fixed just another leak of 'i' (@sreuter)
+- [#255](https://github.com/mikeal/request/pull/255) multipart allow body === '' ( the empty string ) (@Filirom1)
+- [#249](https://github.com/mikeal/request/pull/249) Fix for the fix of your (closed) issue #89 where self.headers[content-length] is set to 0 for all methods (@sethbridges)
+- [adc9ab1](https://github.com/mikeal/request/commit/adc9ab1f563f3cb4681ac8241fcc75e6099efde2) style changes. making @rwaldron cry (@mikeal)
+- [155e6ee](https://github.com/mikeal/request/commit/155e6ee270924d5698d3fea37cefc1926cbaf998) Fixed `pool: false` to not use the global agent (@timshadel)
+- [1232a8e](https://github.com/mikeal/request/commit/1232a8e46752619d4d4b51d558e6725faf7bf3aa) JSON test should check for equality (@timshadel)
+- [#261](https://github.com/mikeal/request/pull/261) Setting 'pool' to 'false' does NOT disable Agent pooling (@timshadel)
+- [#262](https://github.com/mikeal/request/pull/262) JSON test should check for equality (@timshadel)
+- [914a723](https://github.com/mikeal/request/commit/914a72300702a78a08263fe98a43d25e25713a70) consumer_key and token_secret need to be encoded for OAuth v1 (@nanodocumet)
+- [500e790](https://github.com/mikeal/request/commit/500e790f8773f245ff43dd9c14ec3d5c92fe0b9e) Fix uncontrolled crash when "this.uri" is an invalid URI (@naholyr)
+- [#265](https://github.com/mikeal/request/pull/265) uncaughtException when redirected to invalid URI (@naholyr)
+- [#263](https://github.com/mikeal/request/pull/263) Bug in OAuth key generation for sha1 (@nanodocumet)
+- [f4b87cf](https://github.com/mikeal/request/commit/f4b87cf439453b3ca1d63e85b3aeb3373ee1f17e) I'm not OCD seriously (@TehShrike)
+- [#268](https://github.com/mikeal/request/pull/268) I'm not OCD seriously (@TehShrike)
+- [fcab7f1](https://github.com/mikeal/request/commit/fcab7f1953cd6fb141a7d98f60580c50b59fb73f) Adding a line break to the preamble as the first part of a multipart was not recognized by a server I was communicating with. (@proksoup)
+- [661b62e](https://github.com/mikeal/request/commit/661b62e5319bf0143312404f1fc81c895c46f6e6) Commenting out failing post test. Need to figure out a way to test this now that the default is to use a UUID for the frontier. (@mikeal)
+- [7165c86](https://github.com/mikeal/request/commit/7165c867fa5dea4dcb0aab74d2bf8ab5541e3f1b) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [5a7ca9b](https://github.com/mikeal/request/commit/5a7ca9b398c1300c08a28fb7f266054c3ce8c57a) Added drain event and returning the boolean from write to proper handle back pressure when piping. (@mafintosh)
+- [#273](https://github.com/mikeal/request/pull/273) Pipe back pressure issue (@mafintosh)
+- [f8ae8d1](https://github.com/mikeal/request/commit/f8ae8d18627e4743996d8600f77f4e4c05a2a590) New version in npm. (@mikeal)
+- [7ff5dae](https://github.com/mikeal/request/commit/7ff5daef152bcfac5b02e661e5476a57b9693489) Merge remote-tracking branch 'upstream/master' (@proksoup)
+- [1f34700](https://github.com/mikeal/request/commit/1f34700e5614ea2a2d78b80dd467c002c3e91cb3) fix tests with boundary by injecting boundry from header (@benatkin)
+- [ee2b2c2](https://github.com/mikeal/request/commit/ee2b2c2f7a8625fde4d71d79e19cdc5d98f09955) Like in [node.js](https://github.com/joyent/node/blob/master/lib/net.js#L52) print logs if NODE_DEBUG contains the word request (@Filirom1)
+- [#279](https://github.com/mikeal/request/pull/279) fix tests with boundary by injecting boundry from header (@benatkin)
+- [3daebaf](https://github.com/mikeal/request/commit/3daebaf2551c8d0df7dac1ebff0af4fe08608768) Merge branch 'master' of https://github.com/mikeal/request (@proksoup)
+- [dba2ebf](https://github.com/mikeal/request/commit/dba2ebf09552258f37b60122c19b236064b0d216) Updating with corresponding tests. (@proksoup)
+- [396531d](https://github.com/mikeal/request/commit/396531d083c94bc807a25f7c3a50a0c92a00c5f7) Removing console.log of multipart (@proksoup)
+- [54226a3](https://github.com/mikeal/request/commit/54226a38816b4169e0a7a5d8b1a7feba78235fec) Okay, trying it as an optional parameter, with a new test in test-body.js to verify (@proksoup)
+- [23ae7d5](https://github.com/mikeal/request/commit/23ae7d576cc63d645eecf057112b71d6cb73e7b1) Remove non-"oauth_" parameters from being added into the OAuth Authorization header (@jplock)
+- [8b82ef4](https://github.com/mikeal/request/commit/8b82ef4ff0b50b0c8dcfb830f62466fa30662666) Removing guard, there are some cases where this is valid. (@mikeal)
+- [82440f7](https://github.com/mikeal/request/commit/82440f76f22a5fca856735af66e2dc3fcf240c0d) Adding back in guard for _started, need to keep some measure of safety but we should defer this restriction for as long as possible. (@mikeal)
+- [#282](https://github.com/mikeal/request/pull/282) OAuth Authorization header contains non-"oauth_" parameters (@jplock)
+- [087be3e](https://github.com/mikeal/request/commit/087be3ebbada53699d14839374f1679f63f3138f) Remove stray `console.log()` call in multipart generator. (@bcherry)
+- [0a8a5ab](https://github.com/mikeal/request/commit/0a8a5ab6a08eaeffd45ef4e028be2259d61bb0ee) Merge remote-tracking branch 'upstream/master' (@proksoup)
+- [#241](https://github.com/mikeal/request/pull/241) Composability updates suggested by issue #239 (@polotek)
+- [#284](https://github.com/mikeal/request/pull/284) Remove stray `console.log()` call in multipart generator. (@bcherry)
+- [8344666](https://github.com/mikeal/request/commit/8344666f682a302c914cce7ae9cea8de054f9240) Fix #206 Change HTTP/HTTPS agent when redirecting between protocols (@isaacs)
+- [#272](https://github.com/mikeal/request/pull/272) Boundary begins with CRLF? (@proksoup)
+- [#214](https://github.com/mikeal/request/pull/214) documenting additional behavior of json option (@jphaas)
+- [#207](https://github.com/mikeal/request/pull/207) Fix #206 Change HTTP/HTTPS agent when redirecting between protocols (@isaacs)
+- [9cadd61](https://github.com/mikeal/request/commit/9cadd61d989e85715ea07da8770a3077db41cca3) Allow parser errors to bubble up to request (@mscdex)
+- [6a00fea](https://github.com/mikeal/request/commit/6a00fea09eed99257c0aec2bb66fbf109b0f573a) Only add socket error handler callback once (@mscdex)
+- [975ea90](https://github.com/mikeal/request/commit/975ea90bed9503c67055b20e36baf4bcba54a052) Fix style (@mscdex)
+- [205dfd2](https://github.com/mikeal/request/commit/205dfd2e21c13407d89d3ed92dc2b44b987d962b) Use .once() when listening for parser error (@mscdex)
+- [ff9b564](https://github.com/mikeal/request/commit/ff9b5643d6b5679a9e7d7997ec6275dac10b000e) Add a space after if (@Filirom1)
+- [#280](https://github.com/mikeal/request/pull/280) Like in node.js print options if NODE_DEBUG contains the word request (@Filirom1)
+- [d38e57b](https://github.com/mikeal/request/commit/d38e57bbb3d827aa87427f2130aa5a5a3a973161) Test for #289 (@isaacs)
+- [820af58](https://github.com/mikeal/request/commit/820af5839f2a193d091d98f23fd588bd919e3e58) A test of POST redirect following with 303 status (@isaacs)
+- [7adc5a2](https://github.com/mikeal/request/commit/7adc5a21869bc92cc3b5e84d32c585952c8e5e87) Use self.encoding when calling Buffer.toString() (@isaacs)
+- [#290](https://github.com/mikeal/request/pull/290) A test for #289 (@isaacs)
+- [#293](https://github.com/mikeal/request/pull/293) Allow parser errors to bubble up to request (@mscdex)
+- [ed68b8d](https://github.com/mikeal/request/commit/ed68b8dd024561e9d47d80df255fb79d783c13a7) Updated the twitter oauth dance. The comments weren't clear. Also removed token_key. No longer needed with twitter oauth. (@joemccann)
+- [6bc19cd](https://github.com/mikeal/request/commit/6bc19cda351b59f8e45405499a100abd0b456e42) Forgot to remove token_secret; no longer needed for twitter. (@joemccann)
+- [1f21b17](https://github.com/mikeal/request/commit/1f21b17fc4ff3a7011b23e3c9261d66effa3aa40) Adding form-data support. (@mikeal)
+- [827e950](https://github.com/mikeal/request/commit/827e950500746eb9d3a3fa6f174416b194c9dedf) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [b211200](https://github.com/mikeal/request/commit/b2112009a31fc7f9122970d392750f62b6e77111) Test fixes for relative import. Adding to run all (@mikeal)
+- [1268195](https://github.com/mikeal/request/commit/1268195b75bd5bb3954b4c4f2d9feb80a97994d1) Bundling mime module rather than keep around our own mime-map. (@mikeal)
+- [4f51cec](https://github.com/mikeal/request/commit/4f51cecdc363946b957585c3deccfd8c37e19aa0) Docs for the form API, pumping version. (@mikeal)
+- [90245d7](https://github.com/mikeal/request/commit/90245d7199215d7b195cf7e36b203ca0bd0a6bd3) Doc fixes. (@mikeal)
+- [d98ef41](https://github.com/mikeal/request/commit/d98ef411c560bd1168f242c524a378914ff8eac4) Pushed new version to npm. (@mikeal)
+- [3e11937](https://github.com/mikeal/request/commit/3e119375acda2da225afdb1596f6346dbd551fba) Pass servername to tunneling secure socket creation (@isaacs)
+- [7725b23](https://github.com/mikeal/request/commit/7725b235fdec8889c0c91d55c99992dc683e2e22) Declare dependencies more sanely (@isaacs)
+- [#317](https://github.com/mikeal/request/pull/317) Workaround for #313 (@isaacs)
+- [#318](https://github.com/mikeal/request/pull/318) Pass servername to tunneling secure socket creation (@isaacs)
+- [0c470bc](https://github.com/mikeal/request/commit/0c470bccf1ec097ae600b6116e6244cb624dc00e) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [0d98e5b](https://github.com/mikeal/request/commit/0d98e5b7ea6bd9c4f21535d3682bbed2f2e05df4) Pushed new version to npm. (@mikeal)
+- [64a4448](https://github.com/mikeal/request/commit/64a44488ac8c792a1f548f305fc5c61efe0d77fb) when setting defaults, the wrapper adds the jar method assuming it has the same signature as get, meaning undefined is passed into initParams, which subsequently fails. now passing jar function directly as it has no need of defaults anyway seeing as it only creates a new cookie jar (@StuartHarris)
+- [48c9881](https://github.com/mikeal/request/commit/48c988118bda4691fffbfcf30d5a39b6c1438736) Added test to illustrate #321 (@alexindigo)
+- [8ce0f2a](https://github.com/mikeal/request/commit/8ce0f2a3b6929cd0f7998e00d850eaf5401afdb7) Added *src* stream removal on redirect. #321 (@alexindigo)
+- [c32f0bb](https://github.com/mikeal/request/commit/c32f0bb9feaa71917843856c23b4aae99f78ad4d) Do not try to remove listener from an undefined connection (@strk)
+- [#326](https://github.com/mikeal/request/pull/326) Do not try to remove listener from an undefined connection (@CartoDB)
+- [#322](https://github.com/mikeal/request/pull/322) Fix + test for piped into request bumped into redirect. #321 (@alexindigo)
+- [85b6a63](https://github.com/mikeal/request/commit/85b6a632ac7d3456485fbf931043f10f5f6344a5) New version in npm. (@mikeal)
+- [f462bd3](https://github.com/mikeal/request/commit/f462bd3fa421fa5e5ca6c91852333db90297b80e) Rolling trunk version. (@mikeal)
+- [8a82c5b](https://github.com/mikeal/request/commit/8a82c5b0990cc58fa4cb7f81814d13ba7ae35453) Adding url to redirect error for better debugging. (@mikeal)
+- [013c986](https://github.com/mikeal/request/commit/013c986d0a8b5b2811cd06dd3733f4a3d37df1cc) Better debugging of max redirect errors. (@mikeal)
+- [#320](https://github.com/mikeal/request/pull/320) request.defaults() doesn't need to wrap jar() (@redbadger)
+- [4797f88](https://github.com/mikeal/request/commit/4797f88b42c3cf8680cbde09bf473678a5707aed) Fix #296 - Only set Content-Type if body exists (@Marsup)
+- [f6bcf3e](https://github.com/mikeal/request/commit/f6bcf3eb51982180e813c69cccb942734f815ffe) fixup aws function to work in more situations (@nlf)
+- [ba6c88a](https://github.com/mikeal/request/commit/ba6c88af5e771c2a0e007e6166e037a149561e09) added short blurb on using aws (@nlf)
+- [#343](https://github.com/mikeal/request/pull/343) Allow AWS to work in more situations, added a note in the README on its usage (@nathan-lafreniere)
+- [288c52a](https://github.com/mikeal/request/commit/288c52a2a1579164500c26136552827112801ff1) switch to a case insensitive getter when fetching headers for aws auth signing (@nlf)
+- [#332](https://github.com/mikeal/request/pull/332) Fix #296 - Only set Content-Type if body exists (@Marsup)
+- [7a16286](https://github.com/mikeal/request/commit/7a162868de65b6de15e00c1f707b5e0f292c5f86) Emit errors for anything in init so that it is catchable in a redirect. (@mikeal)
+- [d288d21](https://github.com/mikeal/request/commit/d288d21d709fa81067f5af53737dfde06f842262) fix bug (@azylman)
+- [#355](https://github.com/mikeal/request/pull/355) stop sending erroneous headers on redirected requests (@azylman)
+- [b0b97f5](https://github.com/mikeal/request/commit/b0b97f53a9e94f3aeaa05e2cda5b820668f6e3b2) delete _form along with everything else on a redirect (@jgautier)
+- [#360](https://github.com/mikeal/request/pull/360) Delete self._form along with everything else on redirect (@jgautier)
+- [61e3850](https://github.com/mikeal/request/commit/61e3850f0f91ca6732fbd06b46796fbcd2fea1ad) Made it so that if we pass in Content-Length or content-length in the headers, don't make a new version (@danjenkins)
+- [#361](https://github.com/mikeal/request/pull/361) Don't create a Content-Length header if we already have it set (@danjenkins)
+- [590452d](https://github.com/mikeal/request/commit/590452d6569e68e480d4f40b88022f1b81914ad6) inside oauth.hmacsign: running rfc3986 on base_uri instead of just encodeURIComponent.
+- [#362](https://github.com/mikeal/request/pull/362) Running `rfc3986` on `base_uri` in `oauth.hmacsign` instead of just `encodeURIComponent` (@jeffmarshall)
+- [f7dc90c](https://github.com/mikeal/request/commit/f7dc90c8dae743d5736dc6c807eecde613eb4fd4) Revert "Merge pull request #362 from jeffmarshall/master" (@mikeal)
+- [d631a26](https://github.com/mikeal/request/commit/d631a26e263077eca3d4925de9b0a8d57365ba90) reintroducing the WTF escape + encoding, also fixing a typo.
+- [#363](https://github.com/mikeal/request/pull/363) rfc3986 on base_uri, now passes tests (@jeffmarshall)
+- [bfe2791](https://github.com/mikeal/request/commit/bfe2791f596b749eed6961159d41a404c3aba0d0) oauth fix. (@mikeal)
+- [#344](https://github.com/mikeal/request/pull/344) Make AWS auth signing find headers correctly (@nathan-lafreniere)
+- [e863f25](https://github.com/mikeal/request/commit/e863f25336abc7b9f9936c20e0c06da8db0c6593) style change. (@mikeal)
+- [3e5a87c](https://github.com/mikeal/request/commit/3e5a87ce28b3bb45861b32f283cd20d0084d78a7) Don't remove x_auth_type for Twitter reverse auth (@drudge)
+- [#369](https://github.com/mikeal/request/pull/369) Don't remove x_auth_mode for Twitter reverse auth (@drudge)
+- [25d4667](https://github.com/mikeal/request/commit/25d466773c43949e2eea4236ffc62841757fd1f0) x_auth_mode not x_auth_type (@drudge)
+- [#370](https://github.com/mikeal/request/pull/370) Twitter reverse auth uses x_auth_mode not x_auth_type (@drudge)
+- [cadf4dc](https://github.com/mikeal/request/commit/cadf4dc54f4ee3fae821f6beb1ea6443e528bf6f) massive style commit. (@mikeal)
+- [33453a5](https://github.com/mikeal/request/commit/33453a53bc37e4499853b9d929b3603cdf7a31cd) New version in npm. (@mikeal)
+- [b638185](https://github.com/mikeal/request/commit/b6381854006470af1d0607f636992c7247b6720f) Setting master version. (@mikeal)
+- [8014d2a](https://github.com/mikeal/request/commit/8014d2a5b797f07cf56d2f39a346031436e1b064) correct Host header for proxy tunnel CONNECT (@ypocat)
+- [#374](https://github.com/mikeal/request/pull/374) Correct Host header for proxy tunnel CONNECT (@ypocat)
+- [8c3e9cb](https://github.com/mikeal/request/commit/8c3e9cb529767cff5e7206e2e76531183085b42a) If one of the request parameters is called "timestamp", the "oauth_timestamp" OAuth parameter will get removed during the parameter cleanup loop. (@jplock)
+- [#375](https://github.com/mikeal/request/pull/375) Fix for missing oauth_timestamp parameter (@jplock)
+- [69e6dc5](https://github.com/mikeal/request/commit/69e6dc5c80e67bbd7d135c3ceb657a1b2df58763) Fixed headers piping on redirects (@kapetan)
+- [#376](https://github.com/mikeal/request/pull/376) Headers lost on redirect (@kapetan)
+- [62dbbf3](https://github.com/mikeal/request/commit/62dbbf3d77b0851ba424d4f09d1d0c0be91c1f2d) Resolving the Invalid signature when using "qs" (@landeiro)
+- [d4cf4f9](https://github.com/mikeal/request/commit/d4cf4f98e11f9a85b6bdfd0481c85c8ac34061ce) fixes missing host header on retried request when using forever agent
+- [#380](https://github.com/mikeal/request/pull/380) Fixes missing host header on retried request when using forever agent (@mac-)
+- [#381](https://github.com/mikeal/request/pull/381) Resolving "Invalid signature. Expected signature base string: " (@landeiro)
+- [ea2f975](https://github.com/mikeal/request/commit/ea2f975ae83efe956b77cbcd0fd9ad42c0d5192f) Ensure that uuid is treated as a property name, not an index. (@othiym23)
+- [#388](https://github.com/mikeal/request/pull/388) Ensure "safe" toJSON doesn't break EventEmitters (@othiym23)
+- [11a3bc0](https://github.com/mikeal/request/commit/11a3bc0ea3063f6f0071248e03c8595bfa9fd046) Add more reporting to tests (@mmalecki)
+- [#398](https://github.com/mikeal/request/pull/398) Add more reporting to tests (@mmalecki)
+- [b85bf63](https://github.com/mikeal/request/commit/b85bf633fe8197dc38855f10016a0a76a8ab600a) Optimize environment lookup to happen once only (@mmalecki)
+- [#403](https://github.com/mikeal/request/pull/403) Optimize environment lookup to happen once only (@mmalecki)
+- [dbb9a20](https://github.com/mikeal/request/commit/dbb9a205fafd7bf5a05d2dbe7eb2c6833b4387dc) renaming tests/googledoodle.png to match it's actual image type of jpeg (@nfriedly)
+- [e2d7d4f](https://github.com/mikeal/request/commit/e2d7d4fd35869354ba14a333a4b4989b648e1971) Add more auth options, including digest support (@nylen)
+- [d0d536c](https://github.com/mikeal/request/commit/d0d536c1e5a9a342694ffa5f14ef8fbe8dcfa8bd) Add tests for basic and digest auth (@nylen)
+- [85fd359](https://github.com/mikeal/request/commit/85fd359890646ef9f55cc6e5c6a32e74f4fbb786) Document new auth options (@nylen)
+- [#338](https://github.com/mikeal/request/pull/338) Add more auth options, including digest support (@nylen)
+- [fd2e2fa](https://github.com/mikeal/request/commit/fd2e2fa1e6d580cbc34afd3ae1200682cecb3cf9) Fixed a typo. (@jerem)
+- [#415](https://github.com/mikeal/request/pull/415) Fixed a typo. (@jerem)
+- [53c1508](https://github.com/mikeal/request/commit/53c1508c9c6a58f7d846de82cad36402497a4a4f) Fix for #417 (@mikeal)
+- [b23f985](https://github.com/mikeal/request/commit/b23f985e02da4a96f1369541a128c4204a355666) Fixing merge conflict. (@mikeal)
+- [28e8be5](https://github.com/mikeal/request/commit/28e8be5175793ac99236df88e26c0139a143e32d) Lost a forever fix in the previous merge. Fixing. (@mikeal)
+- [e4d1e25](https://github.com/mikeal/request/commit/e4d1e25c1648ef91f6baf1ef407c712509af4b66) Copy options before adding callback. (@nrn)
+- [22bc67d](https://github.com/mikeal/request/commit/22bc67d7ac739e9c9f74c026f875a0a7c686e29d) Respect specified {Host,host} headers, not just {host} (@andrewschaaf)
+- [#430](https://github.com/mikeal/request/pull/430) Respect specified {Host,host} headers, not just {host} (@andrewschaaf)
+- [6b11acf](https://github.com/mikeal/request/commit/6b11acf3e29fb84daef4e940314cae5ac2e580c6) Updating form-data. (@mikeal)
+- [d195845](https://github.com/mikeal/request/commit/d195845c3e1de42c9aee752eec8efa4dda87ec74) Updating mime (@mikeal)
+- [20ba1d6](https://github.com/mikeal/request/commit/20ba1d6d38191aa7545b927a7262a18c5c63575b) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [0150d9f](https://github.com/mikeal/request/commit/0150d9fa13e51d99880013b9ec29343850b40c2f) Consider `options.rejectUnauthorized` when pooling https agents (@mmalecki)
+- [3e07b6d](https://github.com/mikeal/request/commit/3e07b6d4b81037d0e6e595670db483708ffa8698) Use `rejectUnauthorized: false` in tests (@mmalecki)
+- [3995878](https://github.com/mikeal/request/commit/3995878d9fff18a8707f27ffeb4ed6401086adce) Support `key` and `cert` options (@mmalecki)
+- [#433](https://github.com/mikeal/request/pull/433) Added support for HTTPS cert & key (@indexzero)
+- [8b0f4e8](https://github.com/mikeal/request/commit/8b0f4e8fba33d578a891218201d87e3316ea9844) Released 2.14.0 (@mikeal)
+- [54172c6](https://github.com/mikeal/request/commit/54172c68cab8360372e1e64e3fa14902662950bd) Rolling master version. (@mikeal)
+- [aa4a285](https://github.com/mikeal/request/commit/aa4a28586354901b0c9b298a0aa79abb5ed175af) Add patch convenience method. (@mloar)
+- [66501b9](https://github.com/mikeal/request/commit/66501b9872abc9a2065430cd5ed4a34dd45c8bee) protect against double callback (@spollack)
+- [#444](https://github.com/mikeal/request/pull/444) protect against double callbacks on error path (@spollack)
+- [#448](https://github.com/mikeal/request/pull/448) Convenience method for PATCH (@mloar)
+- [6f0f8c5](https://github.com/mikeal/request/commit/6f0f8c5ee2b2fdc7118804664c2215fe9cb5a2f2) No longer doing bundle dependencies (@mikeal)
+- [3997f98](https://github.com/mikeal/request/commit/3997f980722241c18454a00aeeda07d701c27a8f) No longer using bundle dependencies (@mikeal)
+- [cba36ce](https://github.com/mikeal/request/commit/cba36ce64e68bd26e230b65f81256776ac66e686) Adding hawk signing to request. (@mikeal)
+- [c7a8be6](https://github.com/mikeal/request/commit/c7a8be6d174eff05a9cb2fda987979e475d8543f) Fixing bug in empty options. (@mikeal)
+- [67d753f](https://github.com/mikeal/request/commit/67d753fec99fa1f5a3b35ec0bbbc98896418d86c) node-uuid is much better. (@mikeal)
+- [337718b](https://github.com/mikeal/request/commit/337718baa08cafb3e706d275fd7344a3c92363bb) Smarter test runner. (@mikeal)
+- [bcc33ac](https://github.com/mikeal/request/commit/bcc33aca57baf6fe2a81fbf5983048c9220c71b1) Moved the cookie jar in to it's own module. (@mikeal)
+- [3261be4](https://github.com/mikeal/request/commit/3261be4b5d6f45f62b9f50bec18af770cbb70957) Put aws signing in its own package. (@mikeal)
+- [fbed723](https://github.com/mikeal/request/commit/fbed7234d7b532813105efdc4c54777396a6773b) OAuth signing is now in its own library. (@mikeal)
+- [ef5ab90](https://github.com/mikeal/request/commit/ef5ab90277fb00d0e8eb1c565b0f6ef8c52601d3) Forever agent is now it's own package. (@mikeal)
+- [ca1ed81](https://github.com/mikeal/request/commit/ca1ed813c62c7493dc77108b3efc907cc36930cb) tunneling agent is now it's own library. (@mikeal)
+- [5c75621](https://github.com/mikeal/request/commit/5c75621ba5cea18bcf114117112121d361e5f3c9) Moving from main.js to index. cause it's not 2010 anymore. (@mikeal)
+- [#413](https://github.com/mikeal/request/pull/413) rename googledoodle.png to .jpg (@nfriedly)
+- [b4c4c28](https://github.com/mikeal/request/commit/b4c4c28424d906cd96a2131010b21d7facf8b666) Merge branch 'master' of github.com:mikeal/request (@nrn)
+- [#310](https://github.com/mikeal/request/pull/310) Twitter Oauth Stuff Out of Date; Now Updated (@joemccann)
+- [8b0e7e8](https://github.com/mikeal/request/commit/8b0e7e8c9d196d7286d1563aa54affcc4c8b0e1d) Comment to explain init() and start(). (@mikeal)
+- [43d578d](https://github.com/mikeal/request/commit/43d578dc0206388eeae9584f540d550a06308fc8) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [b7c5ed4](https://github.com/mikeal/request/commit/b7c5ed48b618f71f138f9f08f8d705336f907e01) destroy the response if present when destroying the request (@mafintosh)
+- [b279277](https://github.com/mikeal/request/commit/b279277dc2fb4b649640322980315d74db0d13f3) response.abort should be response.destroy (@mafintosh)
+- [#454](https://github.com/mikeal/request/pull/454) Destroy the response if present when destroying the request (clean merge) (@mafintosh)
+- [#429](https://github.com/mikeal/request/pull/429) Copy options before adding callback. (@nrn)
+- [e0e0fb4](https://github.com/mikeal/request/commit/e0e0fb451f17945a02203639e4836aa327b4e30b) hawk 0.9.0 (@hueniverse)
+- [#456](https://github.com/mikeal/request/pull/456) hawk 0.9.0 (@hueniverse)
+- [2f60bc2](https://github.com/mikeal/request/commit/2f60bc253ff6e28df58a33da24b710b6d506849f) Fixes #453 (@mikeal)
+- [805b6e4](https://github.com/mikeal/request/commit/805b6e4fe3afeeb407b4fca2e34e9caabe30f747) Fixing hawk README to match new usage. (@mikeal)
+- [8feb957](https://github.com/mikeal/request/commit/8feb957911083bce552d1898b7ffcaa87104cd21) Removing old logref code. (@mikeal)
+- [fcf6d67](https://github.com/mikeal/request/commit/fcf6d6765247a2645a233d95468ade2960294074) Safe stringify. (@mikeal)
+- [62455bc](https://github.com/mikeal/request/commit/62455bca81e8760f25a2bf1dec2b06c8e915de79) hawk 0.10 (@hueniverse)
+- [c361b41](https://github.com/mikeal/request/commit/c361b4140e7e6e4fe2a8f039951b65d54af65f42) hawk 0.10 (@hueniverse)
+- [fa1ef30](https://github.com/mikeal/request/commit/fa1ef30dcdac83b271ce38c71975df0ed96b08f7) Strip the UTF8 BOM from a UTF encoded response (@kppullin)
+- [9d636c0](https://github.com/mikeal/request/commit/9d636c0b3e882742e15ba989d0c2413f95364680) if query params are empty, then request path shouldn't end with a '?' (@jaipandya)
+- [#462](https://github.com/mikeal/request/pull/462) if query params are empty, then request path shouldn't end with a '?' (merges cleanly now) (@jaipandya)
+- [#460](https://github.com/mikeal/request/pull/460) hawk 0.10.0 (@hueniverse)
+- [#461](https://github.com/mikeal/request/pull/461) Strip the UTF8 BOM from a UTF encoded response (@kppullin)
+- [6d29ed7](https://github.com/mikeal/request/commit/6d29ed72e34f3b2b6d8a5cfadd96dd26b3dd246d) Moving response handlers to onResponse. (@mikeal)
+- [885d6eb](https://github.com/mikeal/request/commit/885d6ebeb6130c2ab7624304f4a01a898573390b) Using querystring library from visionmedia (@kbackowski)
+- [#471](https://github.com/mikeal/request/pull/471) Using querystring library from visionmedia (@kbackowski)
+- [346bb42](https://github.com/mikeal/request/commit/346bb42898c5804576d9e9b3adf40123260bf73b) On strictSSL set rejectUnauthorized. (@mikeal)
+- [8a45365](https://github.com/mikeal/request/commit/8a453656a705d2fa98fbf9092b1600d2ddadbb5a) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [32cfd3c](https://github.com/mikeal/request/commit/32cfd3cf7b3f23c2b1d36c5ccb475cbb3a4693ff) Style changes. (@mikeal)
+- [ec07ee2](https://github.com/mikeal/request/commit/ec07ee2d3eeb90b6d0ad9f6d7f3a36da72276841) Print debug logs NODE_DEBUG=request in environment (@isaacs)
+- [681af64](https://github.com/mikeal/request/commit/681af644a2ebccad8bcccb75984f7f10f909b382) Flow data in v0.10-style streams (@isaacs)
+- [#473](https://github.com/mikeal/request/pull/473) V0.10 compat (@isaacs)
+- [f07a8ba](https://github.com/mikeal/request/commit/f07a8baebf7001addbc0f7d7c869adddc21768ce) Release. (@mikeal)
+- [1f947a1](https://github.com/mikeal/request/commit/1f947a1d2728147fbf4f57aa361d0bedcebfc206) Rolling master version. (@mikeal)
+- [7a217bb](https://github.com/mikeal/request/commit/7a217bbdced9a05a786fe6534ab52734df342d3e) Reinstate querystring for `unescape` (@shimaore)
+- [b0b4ca9](https://github.com/mikeal/request/commit/b0b4ca913e119337e9313a157eee2f08f77ddc38) Test for `unescape` (@shimaore)
+- [#475](https://github.com/mikeal/request/pull/475) Use `unescape` from `querystring` (@shimaore)
+- [28fc741](https://github.com/mikeal/request/commit/28fc741fa958a9783031189964ef6f6d7e3f3264) Release. (@mikeal)
+- [d3e28ef](https://github.com/mikeal/request/commit/d3e28ef7144da4d9f22f8fb475bd5aa6a80fb947) Rolling master version. (@mikeal)
+- [8f8bb9e](https://github.com/mikeal/request/commit/8f8bb9ee8c4dcd9eb815249fbe2a7cf54f61b56f) Changing so if Accept header is explicitly set, sending json does not overwrite. (@RoryH)
+- [#479](https://github.com/mikeal/request/pull/479) Changing so if Accept header is explicitly set, sending json does not ov... (@RoryH)
+- [7694372](https://github.com/mikeal/request/commit/7694372f3dc9d57ac29ca7ee5c00146aa5e1e747) Proper version for latest. (@mikeal)
+- [aa208cf](https://github.com/mikeal/request/commit/aa208cf5c682262529d749f592db147182cacfaf) 0.8+ only now (@mikeal)
+- [16b5ab9](https://github.com/mikeal/request/commit/16b5ab9151823067b05b382241483ef10811c3e1) Upgrading qs. (@mikeal)
+- [7d10c1e](https://github.com/mikeal/request/commit/7d10c1e83b4663f592c773e7fece83435585a06f) Merge branch 'master' of github.com:mikeal/request (@mikeal)
+- [b8ca4b4](https://github.com/mikeal/request/commit/b8ca4b474b8215cab44ef8ef789303571b3d016f) pumping hawk version. (@mikeal)
+- [9c0e484](https://github.com/mikeal/request/commit/9c0e48430e3a9de8715e77c07c98301399eaf6e3) release (@mikeal)
+- [a9f1896](https://github.com/mikeal/request/commit/a9f189697e2a813bee9bff31de32a25e99e55cf2) rolling master version. (@mikeal)
+- [560a1f8](https://github.com/mikeal/request/commit/560a1f8b927099e44b75274375a690df2a05de67) Set content-type on input. (@mikeal)
+- [5fec436](https://github.com/mikeal/request/commit/5fec436b6602bc8c76133664bca23e98f511b096) Release. (@mikeal)
+- [88d8d5b](https://github.com/mikeal/request/commit/88d8d5bc80679b78a39cab8e6d8295728a0a150d) Rolling version. (@mikeal)
+- [d05b6ba](https://github.com/mikeal/request/commit/d05b6ba72702c2411b4627d4d89190a5f2aba562) Empty body must be passed as empty string, exclude JSON case (@Olegas)
+- [#490](https://github.com/mikeal/request/pull/490) Empty response body (3-rd argument) must be passed to callback as an empty string (@Olegas)
+- [8aa13cd](https://github.com/mikeal/request/commit/8aa13cd5b5e22b24466ef0e59fa8b5f1d0f0795a) Added redirect event (@Cauldrath)
+- [4d63a04](https://github.com/mikeal/request/commit/4d63a042553c90718bf0b90652921b26c52dcb31) Moving response emit above setHeaders on destination streams (@kenperkins)
+- [#498](https://github.com/mikeal/request/pull/498) Moving response emit above setHeaders on destination streams (@kenperkins)
+- [c40993f](https://github.com/mikeal/request/commit/c40993fc987b1a8a3cb08cd5699b2f1b2bd4b28b) Fix a regression introduced by cba36ce6 (@nylen)
+- [edc2e17](https://github.com/mikeal/request/commit/edc2e17e8154239efa6bd2914435798c18882635) Don't delete headers when retrying a request with proper authentication (@nylen)
+- [a375ac1](https://github.com/mikeal/request/commit/a375ac15460f4f3b679f4418d7fc467a5cc94499) Refactor and expand basic auth tests (@nylen)
+- [9bc28bf](https://github.com/mikeal/request/commit/9bc28bf912fb0afdd14b36b0ccbafb185a32546a) Cleanup whitespace. (@mikeal)
+- [9a35cd2](https://github.com/mikeal/request/commit/9a35cd2248d9492b099c7ee46d68ca017b6a701c) Fix basic auth for passwords that contain colons (@tonistiigi)
+- [f724810](https://github.com/mikeal/request/commit/f724810c7b9f82fa1423d0a4d19fcb5aaca98137) Honor the .strictSSL option when using proxies (tunnel-agent) (@jhs)
+- [95a2558](https://github.com/mikeal/request/commit/95a25580375be1b9c39cc2e88a36a8387395bc13) Add HTTP Signature support. (@davidlehn)
+- [921c973](https://github.com/mikeal/request/commit/921c973015721ee0f92ed670f5e88bca057104cc) * Make password optional to support the format: http://username@hostname/
+- [2759ebb](https://github.com/mikeal/request/commit/2759ebbe07e8563fd3ded698d2236309fb28176b) add 'localAddress' support (@yyfrankyy)
+- [#513](https://github.com/mikeal/request/pull/513) add 'localAddress' support (@yyfrankyy)
+- [#512](https://github.com/mikeal/request/pull/512) Make password optional to support the format: http://username@hostname/ (@pajato1)
+- [#508](https://github.com/mikeal/request/pull/508) Honor the .strictSSL option when using proxies (tunnel-agent) (@iriscouch)
+- [5f036e6](https://github.com/mikeal/request/commit/5f036e6f5d3102a89e5401a53090a0627a7850a8) Conflicts: index.js (@nylen)
+- [89d2602](https://github.com/mikeal/request/commit/89d2602ef4e3a4e6e51284f6a29b5767c79ffaba) Conflicts: README.md (@davidlehn)
+- [#502](https://github.com/mikeal/request/pull/502) Fix POST (and probably other) requests that are retried after 401 Unauthorized (@nylen)
+- [eb3e033](https://github.com/mikeal/request/commit/eb3e033170403832fe7070955db32112ec46005f) Merge branch 'master' of git://github.com/mikeal/request (@davidlehn)
+- [#510](https://github.com/mikeal/request/pull/510) Add HTTP Signature support. (@digitalbazaar)
+- [227d998](https://github.com/mikeal/request/commit/227d9985426214b6ac68702933346000298d7790) Update the internal path variable when querystring is changed (@jblebrun)
+- [#519](https://github.com/mikeal/request/pull/519) Update internal path state on post-creation QS changes (@incredible-labs)
+- [428b9c1](https://github.com/mikeal/request/commit/428b9c1ad9831b7dfd6cec4ce68df358590c6d65) Fixing test-tunnel.js (@noway421)
+- [2417599](https://github.com/mikeal/request/commit/24175993f6c362f7fca5965feb0a11756f00baf3) Improving test-localAddress.js (@noway421)
+- [#520](https://github.com/mikeal/request/pull/520) Fixing test-tunnel.js (@noway421)
+- [1e37f1b](https://github.com/mikeal/request/commit/1e37f1bea45174e09e6450bc71dfc081c8cd94de) Some explaining comments (@noway421)
+- [909b024](https://github.com/mikeal/request/commit/909b024619c9e47f615749661d610cccd8421d80) Updating dependencies (@noway421)
+- [#523](https://github.com/mikeal/request/pull/523) Updating dependencies (@noway421)
+- [47191e1](https://github.com/mikeal/request/commit/47191e1a5e29714fb0c5f8b2162b2971570df644) 2.17.0 (@mikeal)
+- [14def5a](https://github.com/mikeal/request/commit/14def5af5903d03f66bd6c9be534e6b76f47c063) 2.18.0 (@mikeal)
+- [56fd6b7](https://github.com/mikeal/request/commit/56fd6b7ec6da162894df0809126d688f30900d25) 2.18.1 (@mikeal)
+- [37dd689](https://github.com/mikeal/request/commit/37dd68989670f8937b537579a4299d9649b8aa16) Fixing dep. (@mikeal)
+- [dd7209a](https://github.com/mikeal/request/commit/dd7209a84dd40afe87db31c6ab66885e2015cb8f) 2.19.0 (@mikeal)
+- [62f3b92](https://github.com/mikeal/request/commit/62f3b9203690d4ad34486fc506fc78a1c9971e03) 2.19.1 (@mikeal)
+- [74c6b2e](https://github.com/mikeal/request/commit/74c6b2e315872980ee9a9a000d25e724138f28b1) Adding test for onelineproxy. (@mikeal)
+- [2a01cc0](https://github.com/mikeal/request/commit/2a01cc082f544647f7176a992e02668519a694be) Fixing onelineproxy. (@mikeal)
+- [8b4c920](https://github.com/mikeal/request/commit/8b4c9203adb372f2ee99b1b012406b482b27c68d) 2.20.0 (@mikeal)
+- [d8d4a33](https://github.com/mikeal/request/commit/d8d4a3311d8d31df88fa8a2ab3265872e5cb97ae) 2.20.1 (@mikeal)
+- [5937012](https://github.com/mikeal/request/commit/59370123b22e8c971e4ee48c3d0caf920d890bda) dependencies versions bump (@jodaka)
+- [#529](https://github.com/mikeal/request/pull/529) dependencies versions bump (@jodaka)
+- [#521](https://github.com/mikeal/request/pull/521) Improving test-localAddress.js (@noway421)
+- [#503](https://github.com/mikeal/request/pull/503) Fix basic auth for passwords that contain colons (@tonistiigi)
+- [#497](https://github.com/mikeal/request/pull/497) Added redirect event (@Cauldrath)
+- [297a9ea](https://github.com/mikeal/request/commit/297a9ea827655e5fb406a86907bb0d89b01deae8) fix typo (@fredericosilva)
+- [#532](https://github.com/mikeal/request/pull/532) fix typo (@fredericosilva)
+- [3691db5](https://github.com/mikeal/request/commit/3691db5a2d0981d4aeabfda5b988a5c69074e187) Allow explicitly empty user field for basic authentication. (@mikeando)
+- [#536](https://github.com/mikeal/request/pull/536) Allow explicitly empty user field for basic authentication. (@mikeando)
+- [5d36e32](https://github.com/mikeal/request/commit/5d36e324047f79cbbf3bb9b71fef633f02b36367) 2.21.0 (@mikeal)
+- [9bd98d6](https://github.com/mikeal/request/commit/9bd98d6052f222aa348635c1acb2e2c99eed0f8c) 2.21.1 (@mikeal)
+- [a918e04](https://github.com/mikeal/request/commit/a918e04a8d767a2948567ea29ed3fdd1650c16b1) The exported request function doesn't have an auth method (@tschaub)
+- [1ebe1ac](https://github.com/mikeal/request/commit/1ebe1ac2f78e8a6149c03ce68fcb23d56df2316e) exposing Request class (@regality)
+- [#542](https://github.com/mikeal/request/pull/542) Expose Request class (@ifit)
+- [467573d](https://github.com/mikeal/request/commit/467573d17b4db5f93ed425ace0594370a7820c7c) Update http-signatures version. (@davidlehn)
+- [#541](https://github.com/mikeal/request/pull/541) The exported request function doesn't have an auth method (@tschaub)
+- [3040bbe](https://github.com/mikeal/request/commit/3040bbe5de846811151dab8dc09944acc93a338e) Fix redirections, (@criloz)
+- [#564](https://github.com/mikeal/request/pull/564) Fix redirections (@NebTex)
+- [397b435](https://github.com/mikeal/request/commit/397b4350fcf885460d7dced94cf1db1f5c167f80) handle ciphers and secureOptions in agentOptions (@SamPlacette)
+- [65a2778](https://github.com/mikeal/request/commit/65a27782db7d2798b6490ea08efacb8f3b0a401c) tests and fix for null agentOptions case (@SamPlacette)
+- [#568](https://github.com/mikeal/request/pull/568) use agentOptions to create agent when specified in request (@SamPlacette)
+- [c116920](https://github.com/mikeal/request/commit/c116920a2cbef25afe2e1bbcf4df074e1e2f9dbb) Let's see how we do with only the main guard. (@mikeal)
+- [f54a335](https://github.com/mikeal/request/commit/f54a3358119298634a7b0c29a21bf1471fc23d98) Fix spelling of "ignoring." (@bigeasy)
+- [5cd215f](https://github.com/mikeal/request/commit/5cd215f327e113dc6c062634e405c577986cfd3c) Change isUrl regex to accept mixed case (@lexander)
+- [02c8e74](https://github.com/mikeal/request/commit/02c8e749360a47d45e3e7b51b7f751fe498d2f25) #583 added tests for isUrl regex change. (@lexander)
+- [#581](https://github.com/mikeal/request/pull/581) Fix spelling of "ignoring." (@bigeasy)
+- [#544](https://github.com/mikeal/request/pull/544) Update http-signature version. (@digitalbazaar)
+- [e77746b](https://github.com/mikeal/request/commit/e77746bf42e974dc91a84d03f44f750dd7ee0989) global cookie jar disabled by default, send jar: true to enable. (@threepointone)
+- [46015ac](https://github.com/mikeal/request/commit/46015ac8d5b74f8107a6ec9fd07c133f46c5d833) 2.22.0 (@mikeal)
+- [e5da4a5](https://github.com/mikeal/request/commit/e5da4a5e1a20bf4f23681f7b996f22c5fadae91d) 2.22.1 (@mikeal)
+- [#587](https://github.com/mikeal/request/pull/587) Global cookie jar disabled by default (@threepointone)
+- [fac9da1](https://github.com/mikeal/request/commit/fac9da1cc426bf0a4bcc5f0b7d0d0aea8b1cce38) Prevent setting headers after they are sent (@wpreul)
+- [#589](https://github.com/mikeal/request/pull/589) Prevent setting headers after they are sent (@wpreul)
+- [bc1537a](https://github.com/mikeal/request/commit/bc1537ab79064cea532b0d14110ce4e49a663bde) Emit complete event when there is no callback
+- [de8508e](https://github.com/mikeal/request/commit/de8508e9feac10563596aeee26727567b3c2e33c) Added check to see if the global pool is being used before using the global agent (@Cauldrath)
+- [03441ef](https://github.com/mikeal/request/commit/03441ef919e51a742aaf9e168d917e97e2d9eb6b) 2.23.0 (@mikeal)
--- /dev/null
+# This is an OPEN Open Source Project
+
+-----------------------------------------
+
+## What?
+
+Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.
+
+## Rules
+
+There are a few basic ground-rules for contributors:
+
+1. **No `--force` pushes** or modifying the Git history in any way.
+1. **Non-master branches** ought to be used for ongoing work.
+1. **External API changes and significant modifications** ought to be subject to an **internal pull-request** to solicit feedback from other contributors.
+1. Internal pull-requests to solicit feedback are *encouraged* for any other non-trivial contribution but left to the discretion of the contributor.
+1. For significant changes wait a full 24 hours before merging so that active contributors who are distributed throughout the world have a chance to weigh in.
+1. Contributors should attempt to adhere to the prevailing code-style.
+
+
+## Releases
+
+Declaring formal releases remains the prerogative of the project maintainer.
+
+## Changes to this arrangement
+
+This is an experiment and feedback is welcome! This document may also be subject to pull-requests or changes by contributors where you believe you have something valuable to add or change.
+
+-----------------------------------------
-# Request -- Simplified HTTP client
+# Request — Simplified HTTP client
-[![NPM](https://nodei.co/npm/request.png)](https://nodei.co/npm/request/)
+[![NPM](https://nodei.co/npm/request.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/request/)
## Super simple to use
You can still use intermediate proxies, the requests will still follow HTTP forwards, etc.
+## Proxies
+
+If you specify a `proxy` option, then the request (and any subsequent
+redirects) will be sent via a connection to the proxy server.
+
+If your endpoint is an `https` url, and you are using a proxy, then
+request will send a `CONNECT` request to the proxy server *first*, and
+then use the supplied connection to connect to the endpoint.
+
+That is, first it will make a request like:
+
+```
+HTTP/1.1 CONNECT endpoint-server.com:80
+Host: proxy-server.com
+User-Agent: whatever user agent you specify
+```
+
+and then the proxy server make a TCP connection to `endpoint-server`
+on port `80`, and return a response that looks like:
+
+```
+HTTP/1.1 200 OK
+```
+
+At this point, the connection is left open, and the client is
+communicating directly with the `endpoint-server.com` machine.
+
+See (the wikipedia page on HTTP
+Tunneling)[http://en.wikipedia.org/wiki/HTTP_tunnel] for more
+information.
+
+By default, when proxying `http` traffic, request will simply make a
+standard proxied `http` request. This is done by making the `url`
+section of the initial line of the request a fully qualified url to
+the endpoint.
+
+For example, it will make a single request that looks like:
+
+```
+HTTP/1.1 GET http://endpoint-server.com/some-url
+Host: proxy-server.com
+Other-Headers: all go here
+
+request body or whatever
+```
+
+Because a pure "http over http" tunnel offers no additional security
+or other features, it is generally simpler to go with a
+straightforward HTTP proxy in this case. However, if you would like
+to force a tunneling proxy, you may set the `tunnel` option to `true`.
+
+If you are using a tunneling proxy, you may set the
+`proxyHeaderWhiteList` to share certain headers with the proxy.
+
+By default, this set is:
+
+```
+accept
+accept-charset
+accept-encoding
+accept-language
+accept-ranges
+cache-control
+content-encoding
+content-language
+content-length
+content-location
+content-md5
+content-range
+content-type
+connection
+date
+expect
+max-forwards
+pragma
+proxy-authorization
+referer
+te
+transfer-encoding
+user-agent
+via
+```
+
+Note that, when using a tunneling proxy, the `proxy-authorization`
+header is *never* sent to the endpoint server, but only to the proxy
+server. All other headers are sent as-is over the established
+connection.
+
+## UNIX Socket
+
+`request` supports the `unix://` protocol for all requests. The path is assumed to be absolute to the root of the host file system.
+
+HTTP paths are extracted from the supplied URL by testing each level of the full URL against net.connect for a socket response.
+
+Thus the following request will GET `/httppath` from the HTTP server listening on `/tmp/unix.socket`
+
+```javascript
+request.get('unix://tmp/unix.socket/httppath')
+```
+
## Forms
`request` supports `application/x-www-form-urlencoded` and `multipart/form-data` form uploads. For `multipart/related` refer to the `multipart` API.
For `multipart/form-data` we use the [form-data](https://github.com/felixge/node-form-data) library by [@felixge](https://github.com/felixge). You don’t need to worry about piping the form object or setting the headers, `request` will handle that for you.
```javascript
-var r = request.post('http://service.com/upload')
+var r = request.post('http://service.com/upload', function optionalCallback (err, httpResponse, body) {
+ if (err) {
+ return console.error('upload failed:', err);
+ }
+ console.log('Upload successful! Server responded with:', body);
+})
var form = r.form()
form.append('my_field', 'my_value')
form.append('my_buffer', new Buffer([1, 2, 3]))
-form.append('my_file', fs.createReadStream(path.join(__dirname, 'doodle.png'))
+form.append('my_file', fs.createReadStream(path.join(__dirname, 'doodle.png')))
form.append('remote_file', request('http://google.com/doodle.png'))
+
+// Just like always, `r` is a writable stream, and can be used as such (you have until nextTick to pipe it, etc.)
+// Alternatively, you can provide a callback (that's what this example does — see `optionalCallback` above).
```
## HTTP Authentication
'sendImmediately': false
}
});
+// or
+request.get('http://some.server.com/').auth(null, null, true, 'bearerToken');
+// or
+request.get('http://some.server.com/', {
+ 'auth': {
+ 'bearer': 'bearerToken'
+ }
+});
```
-If passed as an option, `auth` should be a hash containing values `user` || `username`, `password` || `pass`, and `sendImmediately` (optional). The method form takes parameters `auth(username, password, sendImmediately)`.
+If passed as an option, `auth` should be a hash containing values `user` || `username`, `pass` || `password`, and `sendImmediately` (optional). The method form takes parameters `auth(username, password, sendImmediately)`.
`sendImmediately` defaults to `true`, which causes a basic authentication header to be sent. If `sendImmediately` is `false`, then `request` will retry with a proper authentication header after receiving a `401` response from the server (which must contain a `WWW-Authenticate` header indicating the required authentication method).
+Note that you can also use for basic authentication a trick using the URL itself, as specified in [RFC 1738](http://www.ietf.org/rfc/rfc1738.txt).
+Simply pass the `user:password` before the host with an `@` sign.
+
+```javascript
+var username = 'username',
+ password = 'password',
+ url = 'http://' + username + ':' + password + '@some.server.com';
+
+request({url: url}, function (error, response, body) {
+ // Do more stuff with 'body' here
+});
+```
+
Digest authentication is supported, but it only works with `sendImmediately` set to `false`; otherwise `request` will send basic authentication on the initial request, which will probably cause the request to fail.
+Bearer authentication is supported, and is activated when the `bearer` value is available. The value may be either a `String` or a `Function` returning a `String`. Using a function to supply the bearer token is particularly useful if used in conjuction with `defaults` to allow a single function to supply the last known token at the time or sending a request or to compute one on the fly.
+
## OAuth Signing
```javascript
, token: perm_token.oauth_token
, token_secret: perm_token.oauth_token_secret
}
- , url = 'https://api.twitter.com/1/users/show.json?'
+ , url = 'https://api.twitter.com/1.1/users/show.json?'
, params =
{ screen_name: perm_token.screen_name
, user_id: perm_token.user_id
})
```
-### Custom HTTP Headers
+## Custom HTTP Headers
HTTP Headers, such as `User-Agent`, can be set in the `options` object.
In the example below, we call the github API to find out the number
of stars and forks for the request repository. This requires a
custom `User-Agent` header as well as https.
-```
+```javascript
var request = require('request');
var options = {
request(options, callback);
```
-### request(options, callback)
+## request(options, callback)
The first argument can be either a `url` or an `options` object. The only required option is `uri`; all others are optional.
* `method` - http method (default: `"GET"`)
* `headers` - http headers (default: `{}`)
* `body` - entity body for PATCH, POST and PUT requests. Must be a `Buffer` or `String`.
-* `form` - when passed an object, this sets `body` to a querystring representation of value, and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. When passed no options, a `FormData` instance is returned (and is piped to request).
-* `auth` - A hash containing values `user` || `username`, `password` || `pass`, and `sendImmediately` (optional). See documentation above.
+* `form` - when passed an object or a querystring, this sets `body` to a querystring representation of value, and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. When passed no options, a `FormData` instance is returned (and is piped to request).
+* `auth` - A hash containing values `user` || `username`, `pass` || `password`, and `sendImmediately` (optional). See documentation above.
* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as JSON.
* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below.
-* `followRedirect` - follow HTTP 3xx responses as redirects (default: `true`)
+* `followRedirect` - follow HTTP 3xx responses as redirects (default: `true`). This property can also be implemented as function which gets `response` object as a single argument and should return `true` if redirects should continue or `false` otherwise.
* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects (default: `false`)
* `maxRedirects` - the maximum number of redirects to follow (default: `10`)
* `encoding` - Encoding to be used on `setEncoding` of response data. If `null`, the `body` is returned as a `Buffer`.
* `oauth` - Options for OAuth HMAC-SHA1 signing. See documentation above.
* `hawk` - Options for [Hawk signing](https://github.com/hueniverse/hawk). The `credentials` key must contain the necessary signing info, [see hawk docs for details](https://github.com/hueniverse/hawk#usage-example).
* `strictSSL` - If `true`, requires SSL certificates be valid. **Note:** to use your own certificate authority, you need to specify an agent that was created with that CA as an option.
-* `jar` - If `true`, remember cookies for future use (or define your custom cookie jar; see examples section)
+* `jar` - If `true` and `tough-cookie` is installed, remember cookies for future use (or define your custom cookie jar; see examples section)
* `aws` - `object` containing AWS signing information. Should have the properties `key`, `secret`. Also requires the property `bucket`, unless you’re specifying your `bucket` as part of the path, or the request doesn’t use a bucket (i.e. GET Services)
* `httpSignature` - Options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options.
* `localAddress` - Local interface to bind for network connections.
+* `gzip` - If `true`, add an `Accept-Encoding` header to request compressed content encodings from the server (if not already present) and decode supported content encodings in the response.
+* `tunnel` - If `true`, then *always* use a tunneling proxy. If
+ `false` (default), then tunneling will only be used if the
+ destination is `https`, or if a previous request in the redirect
+ chain used a tunneling proxy.
+* `proxyHeaderWhiteList` - A whitelist of headers to send to a
+ tunneling proxy.
The callback argument gets 3 arguments:
-1. An `error` when applicable (usually from the `http.Client` option, not the `http.ClientRequest` object)
-2. An `http.ClientResponse` object
-3. The third is the `response` body (`String` or `Buffer`)
+1. An `error` when applicable (usually from [`http.ClientRequest`](http://nodejs.org/api/http.html#http_class_http_clientrequest) object)
+2. An [`http.IncomingMessage`](http://nodejs.org/api/http.html#http_http_incomingmessage) object
+3. The third is the `response` body (`String` or `Buffer`, or JSON object if the `json` option is supplied)
## Convenience methods
This method returns a wrapper around the normal request API that defaults to whatever options you pass in to it.
+**Note:** You can call `.defaults()` on the wrapper that is returned from `request.defaults` to add/override defaults that were previously defaulted.
+
+For example:
+```javascript
+//requests using baseRequest() will set the 'x-token' header
+var baseRequest = request.defaults({
+ headers: {x-token: 'my-token'}
+})
+
+//requests using specialRequest() will include the 'x-token' header set in
+//baseRequest and will also include the 'special' header
+var specialRequest = baseRequest.defaults({
+ headers: {special: 'special value'}
+})
+```
+
### request.put
Same as `request()`, but defaults to `method: "PUT"`.
)
```
-Cookies are disabled by default (else, they would be used in subsequent requests). To enable cookies, set `jar` to `true` (either in `defaults` or `options`).
+Cookies are disabled by default (else, they would be used in subsequent requests). To enable cookies, set `jar` to `true` (either in `defaults` or `options`) and install `tough-cookie`.
```javascript
var request = request.defaults({jar: true})
})
```
-To use a custom cookie jar (instead `request`’s global cookie jar), set `jar` to an instance of `request.jar()` (either in `defaults` or `options`)
+To use a custom cookie jar (instead of `request`’s global cookie jar), set `jar` to an instance of `request.jar()` (either in `defaults` or `options`)
```javascript
var j = request.jar()
request('http://images.google.com')
})
```
+
OR
```javascript
+// `npm install --save tough-cookie` before this works
var j = request.jar()
var cookie = request.cookie('your_cookie_here')
-j.add(cookie)
+j.setCookie(cookie, uri);
request({url: 'http://www.google.com', jar: j}, function () {
request('http://images.google.com')
})
```
+
+To inspect your cookie jar after a request
+
+```javascript
+var j = request.jar()
+request({url: 'http://www.google.com', jar: j}, function () {
+ var cookie_string = j.getCookieString(uri); // "key1=value1; key2=value2; ..."
+ var cookies = j.getCookies(uri);
+ // [{key: 'key1', value: 'value1', domain: "www.google.com", ...}, ...]
+})
+```
+
+## Debugging
+
+There are at least three ways to debug the operation of `request`:
+
+1. Launch the node process like `NODE_DEBUG=request node script.js`
+ (`lib,request,otherlib` works too).
+
+2. Set `require('request').debug = true` at any time (this does the same thing
+ as #1).
+
+3. Use the [request-debug module](https://github.com/nylen/request-debug) to
+ view request and response headers and bodies.
--- /dev/null
+# http://www.appveyor.com/docs/appveyor-yml
+
+# Fix line endings in Windows. (runs before repo cloning)
+init:
+ - git config --global core.autocrlf input
+
+# Test against these versions of Node.js.
+environment:
+ matrix:
+ - nodejs_version: "0.10"
+ - nodejs_version: "0.8"
+ - nodejs_version: "0.11"
+
+# Allow failing jobs for bleeding-edge Node.js versions.
+matrix:
+ allow_failures:
+ - nodejs_version: "0.11"
+
+# Install scripts. (runs after repo cloning)
+install:
+ # Get the latest stable version of Node 0.STABLE.latest
+ - ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)
+ # Typical npm stuff.
+ - npm install
+
+# Post-install test scripts.
+test_script:
+ # Output useful info for debugging.
+ - ps: "npm test # PowerShell" # Pass comment to PS for easier debugging
+ - cmd: npm test
+
+# Don't actually build.
+build: off
+
+# Set build version format here instead of in the admin panel.
+version: "{build}"
// See the License for the specific language governing permissions and
// limitations under the License.
-var optional = require('./lib/optional')
- , cookie = optional('tough-cookie')
- , Cookie = cookie && cookie.Cookie
- , CookieJar = cookie && cookie.CookieJar
- , cookieJar = CookieJar && new CookieJar
-
- , copy = require('./lib/copy')
- , Request = require('./request')
+var extend = require('util')._extend
+ , cookies = require('./lib/cookies')
+ , copy = require('./lib/copy')
+ , helpers = require('./lib/helpers')
+ , isFunction = helpers.isFunction
+ , constructObject = helpers.constructObject
+ , filterForCallback = helpers.filterForCallback
+ , constructOptionsFrom = helpers.constructOptionsFrom
+ , paramsHaveRequestBody = helpers.paramsHaveRequestBody
;
-
-
// organize params for patch, post, put, head, del
function initParams(uri, options, callback) {
- if ((typeof options === 'function') && !callback) callback = options
- if (options && typeof options === 'object') {
- options.uri = uri
- } else if (typeof uri === 'string') {
- options = {uri:uri}
- } else {
- options = uri
- uri = options.uri
- }
- return { uri: uri, options: options, callback: callback }
+ callback = filterForCallback([options, callback])
+ options = constructOptionsFrom(uri, options)
+
+ return constructObject()
+ .extend({callback: callback})
+ .extend({options: options})
+ .extend({uri: options.uri})
+ .done()
}
function request (uri, options, callback) {
- if (typeof uri === 'undefined') throw new Error('undefined is not a valid uri or options object.')
- if ((typeof options === 'function') && !callback) callback = options
- if (options && typeof options === 'object') {
- options.uri = uri
- } else if (typeof uri === 'string') {
- options = {uri:uri}
- } else {
- options = uri
- }
+ if (typeof uri === 'undefined')
+ throw new Error('undefined is not a valid uri or options object.')
- options = copy(options)
+ var params = initParams(uri, options, callback)
+ options = params.options
+ options.callback = params.callback
+ options.uri = params.uri
- if (callback) options.callback = callback
- var r = new Request(options)
- return r
-}
-
-module.exports = request
-
-request.Request = Request;
-
-request.debug = process.env.NODE_DEBUG && /request/.test(process.env.NODE_DEBUG)
-
-request.initParams = initParams
-
-request.defaults = function (options, requester) {
- var def = function (method) {
- var d = function (uri, opts, callback) {
- var params = initParams(uri, opts, callback)
- for (var i in options) {
- if (params.options[i] === undefined) params.options[i] = options[i]
- }
- if(typeof requester === 'function') {
- if(method === request) {
- method = requester
- } else {
- params.options._requester = requester
- }
- }
- return method(params.options, params.callback)
- }
- return d
- }
- var de = def(request)
- de.get = def(request.get)
- de.patch = def(request.patch)
- de.post = def(request.post)
- de.put = def(request.put)
- de.head = def(request.head)
- de.del = def(request.del)
- de.cookie = def(request.cookie)
- de.jar = request.jar
- return de
+ return new request.Request(options)
}
function requester(params) {
- if(typeof params.options._requester === 'function') {
+ if(typeof params.options._requester === 'function')
return params.options._requester
- } else {
- return request
- }
+ return request
}
-request.forever = function (agentOptions, optionsArg) {
- var options = {}
- if (optionsArg) {
- for (var option in optionsArg) {
- options[option] = optionsArg[option]
- }
- }
- if (agentOptions) options.agentOptions = agentOptions
- options.forever = true
- return request.defaults(options)
+request.get = function (uri, options, callback) {
+ var params = initParams(uri, options, callback)
+ params.options.method = 'GET'
+ return requester(params)(params.uri || null, params.options, params.callback)
+}
+
+request.head = function (uri, options, callback) {
+ var params = initParams(uri, options, callback)
+ params.options.method = 'HEAD'
+
+ if (paramsHaveRequestBody(params))
+ throw new Error("HTTP HEAD requests MUST NOT include a request body.")
+
+ return requester(params)(params.uri || null, params.options, params.callback)
}
-request.get = request
request.post = function (uri, options, callback) {
var params = initParams(uri, options, callback)
params.options.method = 'POST'
return requester(params)(params.uri || null, params.options, params.callback)
}
+
request.put = function (uri, options, callback) {
var params = initParams(uri, options, callback)
params.options.method = 'PUT'
return requester(params)(params.uri || null, params.options, params.callback)
}
+
request.patch = function (uri, options, callback) {
var params = initParams(uri, options, callback)
params.options.method = 'PATCH'
return requester(params)(params.uri || null, params.options, params.callback)
}
-request.head = function (uri, options, callback) {
- var params = initParams(uri, options, callback)
- params.options.method = 'HEAD'
- if (params.options.body ||
- params.options.requestBodyStream ||
- (params.options.json && typeof params.options.json !== 'boolean') ||
- params.options.multipart) {
- throw new Error("HTTP HEAD requests MUST NOT include a request body.")
- }
- return requester(params)(params.uri || null, params.options, params.callback)
-}
request.del = function (uri, options, callback) {
var params = initParams(uri, options, callback)
params.options.method = 'DELETE'
return requester(params)(params.uri || null, params.options, params.callback)
}
+
request.jar = function () {
- return new CookieJar
+ return cookies.jar()
}
+
request.cookie = function (str) {
- if (str && str.uri) str = str.uri
- if (typeof str !== 'string') throw new Error("The cookie function only accepts STRING as param")
- return new Cookie(str)
+ return cookies.parse(str)
+}
+
+request.defaults = function (options, requester) {
+
+ var wrap = function (method) {
+ var headerlessOptions = function (options) {
+ options = extend({}, options)
+ delete options.headers
+ return options
+ }
+
+ var getHeaders = function (params, options) {
+ return constructObject()
+ .extend(options.headers)
+ .extend(params.options.headers)
+ .done()
+ }
+
+ return function (uri, opts, callback) {
+ var params = initParams(uri, opts, callback)
+ params.options = extend(params.options, headerlessOptions(options))
+
+ if (options.headers)
+ params.options.headers = getHeaders(params, options)
+
+ if (isFunction(requester)) {
+ if (method === request) {
+ method = requester
+ } else {
+ params.options._requester = requester
+ }
+ }
+
+ return method(params.options, params.callback)
+ }
+ }
+
+ defaults = wrap(this)
+ defaults.get = wrap(this.get)
+ defaults.patch = wrap(this.patch)
+ defaults.post = wrap(this.post)
+ defaults.put = wrap(this.put)
+ defaults.head = wrap(this.head)
+ defaults.del = wrap(this.del)
+ defaults.cookie = wrap(this.cookie)
+ defaults.jar = this.jar
+ defaults.defaults = this.defaults
+ return defaults
+}
+
+request.forever = function (agentOptions, optionsArg) {
+ var options = constructObject()
+ if (optionsArg) options.extend(optionsArg)
+ if (agentOptions) options.agentOptions = agentOptions
+
+ options.extend({forever: true})
+ return request.defaults(options.done())
}
+
+// Exports
+
+module.exports = request
+request.Request = require('./request')
+request.debug = process.env.NODE_DEBUG && /\brequest\b/.test(process.env.NODE_DEBUG)
+request.initParams = initParams
--- /dev/null
+var optional = require('./optional')
+ , tough = optional('tough-cookie')
+ , Cookie = tough && tough.Cookie
+ , CookieJar = tough && tough.CookieJar
+ ;
+
+exports.parse = function(str) {
+ if (str && str.uri) str = str.uri
+ if (typeof str !== 'string') throw new Error("The cookie function only accepts STRING as param")
+ if (!Cookie) {
+ return null;
+ }
+ return Cookie.parse(str)
+};
+
+// Adapt the sometimes-Async api of tough.CookieJar to our requirements
+function RequestJar() {
+ this._jar = new CookieJar();
+}
+RequestJar.prototype.setCookie = function(cookieOrStr, uri, options) {
+ return this._jar.setCookieSync(cookieOrStr, uri, options || {});
+};
+RequestJar.prototype.getCookieString = function(uri) {
+ return this._jar.getCookieStringSync(uri);
+};
+RequestJar.prototype.getCookies = function(uri) {
+ return this._jar.getCookiesSync(uri);
+};
+
+exports.jar = function() {
+ if (!CookieJar) {
+ // tough-cookie not loaded, return a stub object:
+ return {
+ setCookie: function(){},
+ getCookieString: function(){},
+ getCookies: function(){}
+ };
+ }
+ return new RequestJar();
+};
var util = require('util')
+ , request = require('../index')
+ ;
-module.exports =
-function debug () {
- if (/\brequest\b/.test(process.env.NODE_DEBUG))
+module.exports = function debug() {
+ if (request.debug) {
console.error('REQUEST %s', util.format.apply(util, arguments))
+ }
}
+++ /dev/null
-// Safe toJSON
-module.exports =
-function getSafe (self, uuid) {
- if (typeof self === 'object' || typeof self === 'function') var safe = {}
- if (Array.isArray(self)) var safe = []
-
- var recurse = []
-
- Object.defineProperty(self, uuid, {})
-
- var attrs = Object.keys(self).filter(function (i) {
- if (i === uuid) return false
- if ( (typeof self[i] !== 'object' && typeof self[i] !== 'function') || self[i] === null) return true
- return !(Object.getOwnPropertyDescriptor(self[i], uuid))
- })
-
-
- for (var i=0;i<attrs.length;i++) {
- if ( (typeof self[attrs[i]] !== 'object' && typeof self[attrs[i]] !== 'function') ||
- self[attrs[i]] === null
- ) {
- safe[attrs[i]] = self[attrs[i]]
- } else {
- recurse.push(attrs[i])
- Object.defineProperty(self[attrs[i]], uuid, {})
- }
- }
-
- for (var i=0;i<recurse.length;i++) {
- safe[recurse[i]] = getSafe(self[recurse[i]], uuid)
- }
-
- return safe
-}
\ No newline at end of file
--- /dev/null
+var extend = require('util')._extend
+
+function constructObject(initialObject) {
+ initialObject = initialObject || {}
+
+ return {
+ extend: function (object) {
+ return constructObject(extend(initialObject, object))
+ },
+ done: function () {
+ return initialObject
+ }
+ }
+}
+
+function constructOptionsFrom(uri, options) {
+ var params = constructObject()
+ if (typeof uri === 'object') params.extend(uri)
+ if (typeof uri === 'string') params.extend({uri: uri})
+ params.extend(options)
+ return params.done()
+}
+
+function filterForCallback(values) {
+ var callbacks = values.filter(isFunction)
+ return callbacks[0]
+}
+
+function isFunction(value) {
+ return typeof value === 'function'
+}
+
+function paramsHaveRequestBody(params) {
+ return (
+ params.options.body ||
+ params.options.requestBodyStream ||
+ (params.options.json && typeof params.options.json !== 'boolean') ||
+ params.options.multipart
+ )
+}
+
+exports.isFunction = isFunction
+exports.constructObject = constructObject
+exports.constructOptionsFrom = constructOptionsFrom
+exports.filterForCallback = filterForCallback
+exports.paramsHaveRequestBody = paramsHaveRequestBody
-module.exports = function(module) {
+module.exports = function(moduleName) {
try {
- return require(module);
- } catch (e) {}
+ return module.parent.require(moduleName);
+ } catch (e) {
+ // This could mean that we are in a browser context.
+ // Add another try catch like it used to be, for backwards compability
+ // and browserify reasons.
+ try {
+ return require(moduleName);
+ }
+ catch (e) {}
+ }
};
"bugs": {
"url": "https://github.com/mikeal/aws-sign/issues"
},
- "homepage": "https://github.com/mikeal/aws-sign",
"_id": "aws-sign2@0.5.0",
- "_from": "aws-sign2@~0.5.0"
+ "dist": {
+ "shasum": "c57103f7a17fc037f02d7c2e64b602ea223f7d63",
+ "tarball": "http://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz"
+ },
+ "_from": "aws-sign2@~0.5.0",
+ "_npmVersion": "1.3.2",
+ "_npmUser": {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ },
+ "maintainers": [
+ {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "c57103f7a17fc037f02d7c2e64b602ea223f7d63",
+ "_resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz",
+ "homepage": "https://github.com/mikeal/aws-sign"
}
--- /dev/null
+{
+ "predef": [ ]
+ , "bitwise": false
+ , "camelcase": false
+ , "curly": false
+ , "eqeqeq": false
+ , "forin": false
+ , "immed": false
+ , "latedef": false
+ , "noarg": true
+ , "noempty": true
+ , "nonew": true
+ , "plusplus": false
+ , "quotmark": true
+ , "regexp": false
+ , "undef": true
+ , "unused": true
+ , "strict": false
+ , "trailing": true
+ , "maxlen": 120
+ , "asi": true
+ , "boss": true
+ , "debug": true
+ , "eqnull": true
+ , "esnext": true
+ , "evil": true
+ , "expr": true
+ , "funcscope": false
+ , "globalstrict": false
+ , "iterator": false
+ , "lastsemic": true
+ , "laxbreak": true
+ , "laxcomma": true
+ , "loopfunc": true
+ , "multistr": false
+ , "onecase": false
+ , "proto": false
+ , "regexdash": false
+ , "scripturl": true
+ , "smarttabs": false
+ , "shadow": false
+ , "sub": true
+ , "supernew": false
+ , "validthis": true
+ , "browser": true
+ , "couch": false
+ , "devel": false
+ , "dojo": false
+ , "mootools": false
+ , "node": true
+ , "nonstandard": true
+ , "prototypejs": false
+ , "rhino": false
+ , "worker": true
+ , "wsh": false
+ , "nomen": false
+ , "onevar": false
+ , "passfail": false
+}
\ No newline at end of file
--- /dev/null
+node_modules/
\ No newline at end of file
--- /dev/null
+language: node_js
+node_js:
+ - 0.8
+ - "0.10"
+branches:
+ only:
+ - master
+notifications:
+ email:
+ - rod@vagg.org
+script: npm test
\ No newline at end of file
-Copyright (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative
-Reporters & Editors
+Copyright 2013, Rod Vagg (the "Original Author")
+All rights reserved.
+
+MIT +no-false-attribs License
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
+Distributions of all or part of the Software intended to be used
+by the recipients as they would use the unmodified Software,
+containing modifications that substantially alter, remove, or
+disable functionality of the Software, outside of the documented
+configuration mechanisms provided by the Software, shall be
+modified such that the Original Author's bug reporting email
+addresses and urls are either replaced with the contact information
+of the parties responsible for the changes, or removed entirely.
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
+
+
+Except where noted, this license applies to any and all software
+programs and associated documentation files created by the
+Original Author, when distributed with the Software.
\ No newline at end of file
--- /dev/null
+# bl *(BufferList)*
+
+[![Build Status](https://secure.travis-ci.org/rvagg/bl.png)](http://travis-ci.org/rvagg/bl)
+
+**A Node.js Buffer list collector, reader and streamer thingy.**
+
+[![NPM](https://nodei.co/npm/bl.png?downloads=true&downloadRank=true)](https://nodei.co/npm/bl/)
+[![NPM](https://nodei.co/npm-dl/bl.png?months=6&height=3)](https://nodei.co/npm/bl/)
+
+**bl** is a storage object for collections of Node Buffers, exposing them with the main Buffer readable API. Also works as a duplex stream so you can collect buffers from a stream that emits them and emit buffers to a stream that consumes them!
+
+The original buffers are kept intact and copies are only done as necessary. Any reads that require the use of a single original buffer will return a slice of that buffer only (which references the same memory as the original buffer). Reads that span buffers perform concatenation as required and return the results transparently.
+
+```js
+const BufferList = require('bl')
+
+var bl = new BufferList()
+bl.append(new Buffer('abcd'))
+bl.append(new Buffer('efg'))
+bl.append('hi') // bl will also accept & convert Strings
+bl.append(new Buffer('j'))
+bl.append(new Buffer([ 0x3, 0x4 ]))
+
+console.log(bl.length) // 12
+
+console.log(bl.slice(0, 10).toString('ascii')) // 'abcdefghij'
+console.log(bl.slice(3, 10).toString('ascii')) // 'defghij'
+console.log(bl.slice(3, 6).toString('ascii')) // 'def'
+console.log(bl.slice(3, 8).toString('ascii')) // 'defgh'
+console.log(bl.slice(5, 10).toString('ascii')) // 'fghij'
+
+// or just use toString!
+console.log(bl.toString()) // 'abcdefghij\u0003\u0004'
+console.log(bl.toString('ascii', 3, 8)) // 'defgh'
+console.log(bl.toString('ascii', 5, 10)) // 'fghij'
+
+// other standard Buffer readables
+console.log(bl.readUInt16BE(10)) // 0x0304
+console.log(bl.readUInt16LE(10)) // 0x0403
+```
+
+Give it a callback in the constructor and use it just like **[concat-stream](https://github.com/maxogden/node-concat-stream)**:
+
+```js
+const bl = require('bl')
+ , fs = require('fs')
+
+fs.createReadStream('README.md')
+ .pipe(bl(function (err, data) { // note 'new' isn't strictly required
+ // `data` is a complete Buffer object containing the full data
+ console.log(data.toString())
+ }))
+```
+
+Note that when you use the *callback* method like this, the resulting `data` parameter is a concatenation of all `Buffer` objects in the list. If you want to avoid the overhead of this concatenation (in cases of extreme performance consciousness), then avoid the *callback* method and just listen to `'end'` instead, like a standard Stream.
+
+Or to fetch a URL using [hyperquest](https://github.com/substack/hyperquest) (should work with [request](http://github.com/mikeal/request) and even plain Node http too!):
+```js
+const hyperquest = require('hyperquest')
+ , bl = require('bl')
+ , url = 'https://raw.github.com/rvagg/bl/master/README.md'
+
+hyperquest(url).pipe(bl(function (err, data) {
+ console.log(data.toString())
+}))
+```
+
+Or, use it as a readable stream to recompose a list of Buffers to an output source:
+
+```js
+const BufferList = require('bl')
+ , fs = require('fs')
+
+var bl = new BufferList()
+bl.append(new Buffer('abcd'))
+bl.append(new Buffer('efg'))
+bl.append(new Buffer('hi'))
+bl.append(new Buffer('j'))
+
+bl.pipe(fs.createWriteStream('gibberish.txt'))
+```
+
+## API
+
+ * <a href="#ctor"><code><b>new BufferList([ callback ])</b></code></a>
+ * <a href="#length"><code>bl.<b>length</b></code></a>
+ * <a href="#append"><code>bl.<b>append(buffer)</b></code></a>
+ * <a href="#get"><code>bl.<b>get(index)</b></code></a>
+ * <a href="#slice"><code>bl.<b>slice([ start[, end ] ])</b></code></a>
+ * <a href="#copy"><code>bl.<b>copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ])</b></code></a>
+ * <a href="#duplicate"><code>bl.<b>duplicate()</b></code></a>
+ * <a href="#consume"><code>bl.<b>consume(bytes)</b></code></a>
+ * <a href="#toString"><code>bl.<b>toString([encoding, [ start, [ end ]]])</b></code></a>
+ * <a href="#readXX"><code>bl.<b>readDoubleBE()</b></code>, <code>bl.<b>readDoubleLE()</b></code>, <code>bl.<b>readFloatBE()</b></code>, <code>bl.<b>readFloatLE()</b></code>, <code>bl.<b>readInt32BE()</b></code>, <code>bl.<b>readInt32LE()</b></code>, <code>bl.<b>readUInt32BE()</b></code>, <code>bl.<b>readUInt32LE()</b></code>, <code>bl.<b>readInt16BE()</b></code>, <code>bl.<b>readInt16LE()</b></code>, <code>bl.<b>readUInt16BE()</b></code>, <code>bl.<b>readUInt16LE()</b></code>, <code>bl.<b>readInt8()</b></code>, <code>bl.<b>readUInt8()</b></code></a>
+ * <a href="#streams">Streams</a>
+
+--------------------------------------------------------
+<a name="ctor"></a>
+### new BufferList([ callback | buffer | buffer array ])
+The constructor takes an optional callback, if supplied, the callback will be called with an error argument followed by a reference to the **bl** instance, when `bl.end()` is called (i.e. from a piped stream). This is a convenient method of collecting the entire contents of a stream, particularly when the stream is *chunky*, such as a network stream.
+
+Normally, no arguments are required for the constructor, but you can initialise the list by passing in a single `Buffer` object or an array of `Buffer` object.
+
+`new` is not strictly required, if you don't instantiate a new object, it will be done automatically for you so you can create a new instance simply with:
+
+```js
+var bl = require('bl')
+var myinstance = bl()
+
+// equivilant to:
+
+var BufferList = require('bl')
+var myinstance = new BufferList()
+```
+
+--------------------------------------------------------
+<a name="length"></a>
+### bl.length
+Get the length of the list in bytes. This is the sum of the lengths of all of the buffers contained in the list, minus any initial offset for a semi-consumed buffer at the beginning. Should accurately represent the total number of bytes that can be read from the list.
+
+--------------------------------------------------------
+<a name="append"></a>
+### bl.append(buffer)
+`append(buffer)` adds an additional buffer or BufferList to the internal list.
+
+--------------------------------------------------------
+<a name="get"></a>
+### bl.get(index)
+`get()` will return the byte at the specified index.
+
+--------------------------------------------------------
+<a name="slice"></a>
+### bl.slice([ start, [ end ] ])
+`slice()` returns a new `Buffer` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively.
+
+If the requested range spans a single internal buffer then a slice of that buffer will be returned which shares the original memory range of that Buffer. If the range spans multiple buffers then copy operations will likely occur to give you a uniform Buffer.
+
+--------------------------------------------------------
+<a name="copy"></a>
+### bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ])
+`copy()` copies the content of the list in the `dest` buffer, starting from `destStart` and containing the bytes within the range specified with `srcStart` to `srcEnd`. `destStart`, `start` and `end` are optional and will default to the beginning of the `dest` buffer, and the beginning and end of the list respectively.
+
+--------------------------------------------------------
+<a name="duplicate"></a>
+### bl.duplicate()
+`duplicate()` performs a **shallow-copy** of the list. The internal Buffers remains the same, so if you change the underlying Buffers, the change will be reflected in both the original and the duplicate. This method is needed if you want to call `consume()` or `pipe()` and still keep the original list.Example:
+
+```js
+var bl = new BufferList()
+
+bl.append('hello')
+bl.append(' world')
+bl.append('\n')
+
+bl.duplicate().pipe(process.stdout, { end: false })
+
+console.log(bl.toString())
+```
+
+--------------------------------------------------------
+<a name="consume"></a>
+### bl.consume(bytes)
+`consume()` will shift bytes *off the start of the list*. The number of bytes consumed don't need to line up with the sizes of the internal Buffers—initial offsets will be calculated accordingly in order to give you a consistent view of the data.
+
+--------------------------------------------------------
+<a name="toString"></a>
+### bl.toString([encoding, [ start, [ end ]]])
+`toString()` will return a string representation of the buffer. The optional `start` and `end` arguments are passed on to `slice()`, while the `encoding` is passed on to `toString()` of the resulting Buffer. See the [Buffer#toString()](http://nodejs.org/docs/latest/api/buffer.html#buffer_buf_tostring_encoding_start_end) documentation for more information.
+
+--------------------------------------------------------
+<a name="readXX"></a>
+### <code>bl.readDoubleBE()</code>, <code>bl.readDoubleLE()</code>, <code>bl.readFloatBE()</code>, <code>bl.readFloatLE()</code>, <code>bl.readInt32BE()</code>, <code>bl.readInt32LE()</code>, <code>bl.readUInt32BE()</code>, <code>bl.readUInt32LE()</code>, <code>bl.readInt16BE()</code>, <code>bl.readInt16LE()</code>, <code>bl.readUInt16BE()</code>, <code>bl.readUInt16LE()</code>, <code>bl.readInt8()</code>, <code>bl.readUInt8()</code>
+
+All of the standard byte-reading methods of the `Buffer` interface are implemented and will operate across internal Buffer boundaries transparently.
+
+See the <b><code>[Buffer](http://nodejs.org/docs/latest/api/buffer.html)</code></b> documentation for how these work.
+
+--------------------------------------------------------
+<a name="streams"></a>
+### Streams
+**bl** is a Node **[Duplex Stream](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_duplex)**, so it can be read from and written to like a standard Node stream. You can also `pipe()` to and from a **bl** instance.
+
+--------------------------------------------------------
+
+## Contributors
+
+**bl** is brought to you by the following hackers:
+
+ * [Rod Vagg](https://github.com/rvagg)
+ * [Matteo Collina](https://github.com/mcollina)
+
+=======
+
+## License
+
+**bl** is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
--- /dev/null
+var DuplexStream = require('readable-stream').Duplex
+ , util = require('util')
+
+function BufferList (callback) {
+ if (!(this instanceof BufferList))
+ return new BufferList(callback)
+
+ this._bufs = []
+ this.length = 0
+
+ if (typeof callback == 'function') {
+ this._callback = callback
+
+ var piper = function (err) {
+ if (this._callback) {
+ this._callback(err)
+ this._callback = null
+ }
+ }.bind(this)
+
+ this.on('pipe', function (src) {
+ src.on('error', piper)
+ })
+ this.on('unpipe', function (src) {
+ src.removeListener('error', piper)
+ })
+ }
+ else if (Buffer.isBuffer(callback))
+ this.append(callback)
+ else if (Array.isArray(callback)) {
+ callback.forEach(function (b) {
+ Buffer.isBuffer(b) && this.append(b)
+ }.bind(this))
+ }
+
+ DuplexStream.call(this)
+}
+
+util.inherits(BufferList, DuplexStream)
+
+BufferList.prototype._offset = function (offset) {
+ var tot = 0, i = 0, _t
+ for (; i < this._bufs.length; i++) {
+ _t = tot + this._bufs[i].length
+ if (offset < _t)
+ return [ i, offset - tot ]
+ tot = _t
+ }
+}
+
+BufferList.prototype.append = function (buf) {
+ var isBuffer = Buffer.isBuffer(buf) ||
+ buf instanceof BufferList
+
+ this._bufs.push(isBuffer ? buf : new Buffer(buf))
+ this.length += buf.length
+ return this
+}
+
+BufferList.prototype._write = function (buf, encoding, callback) {
+ this.append(buf)
+ if (callback)
+ callback()
+}
+
+BufferList.prototype._read = function (size) {
+ if (!this.length)
+ return this.push(null)
+ size = Math.min(size, this.length)
+ this.push(this.slice(0, size))
+ this.consume(size)
+}
+
+BufferList.prototype.end = function (chunk) {
+ DuplexStream.prototype.end.call(this, chunk)
+
+ if (this._callback) {
+ this._callback(null, this.slice())
+ this._callback = null
+ }
+}
+
+BufferList.prototype.get = function (index) {
+ return this.slice(index, index + 1)[0]
+}
+
+BufferList.prototype.slice = function (start, end) {
+ return this.copy(null, 0, start, end)
+}
+
+BufferList.prototype.copy = function (dst, dstStart, srcStart, srcEnd) {
+ if (typeof srcStart != 'number' || srcStart < 0)
+ srcStart = 0
+ if (typeof srcEnd != 'number' || srcEnd > this.length)
+ srcEnd = this.length
+ if (srcStart >= this.length)
+ return dst || new Buffer(0)
+ if (srcEnd <= 0)
+ return dst || new Buffer(0)
+
+ var copy = !!dst
+ , off = this._offset(srcStart)
+ , len = srcEnd - srcStart
+ , bytes = len
+ , bufoff = (copy && dstStart) || 0
+ , start = off[1]
+ , l
+ , i
+
+ // copy/slice everything
+ if (srcStart === 0 && srcEnd == this.length) {
+ if (!copy) // slice, just return a full concat
+ return Buffer.concat(this._bufs)
+
+ // copy, need to copy individual buffers
+ for (i = 0; i < this._bufs.length; i++) {
+ this._bufs[i].copy(dst, bufoff)
+ bufoff += this._bufs[i].length
+ }
+
+ return dst
+ }
+
+ // easy, cheap case where it's a subset of one of the buffers
+ if (bytes <= this._bufs[off[0]].length - start) {
+ return copy
+ ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes)
+ : this._bufs[off[0]].slice(start, start + bytes)
+ }
+
+ if (!copy) // a slice, we need something to copy in to
+ dst = new Buffer(len)
+
+ for (i = off[0]; i < this._bufs.length; i++) {
+ l = this._bufs[i].length - start
+
+ if (bytes > l) {
+ this._bufs[i].copy(dst, bufoff, start)
+ } else {
+ this._bufs[i].copy(dst, bufoff, start, start + bytes)
+ break
+ }
+
+ bufoff += l
+ bytes -= l
+
+ if (start)
+ start = 0
+ }
+
+ return dst
+}
+
+BufferList.prototype.toString = function (encoding, start, end) {
+ return this.slice(start, end).toString(encoding)
+}
+
+BufferList.prototype.consume = function (bytes) {
+ while (this._bufs.length) {
+ if (bytes > this._bufs[0].length) {
+ bytes -= this._bufs[0].length
+ this.length -= this._bufs[0].length
+ this._bufs.shift()
+ } else {
+ this._bufs[0] = this._bufs[0].slice(bytes)
+ this.length -= bytes
+ break
+ }
+ }
+ return this
+}
+
+BufferList.prototype.duplicate = function () {
+ var i = 0
+ , copy = new BufferList()
+
+ for (; i < this._bufs.length; i++)
+ copy.append(this._bufs[i])
+
+ return copy
+}
+
+BufferList.prototype.destroy = function () {
+ this._bufs.length = 0;
+ this.length = 0;
+ this.push(null);
+}
+
+;(function () {
+ var methods = {
+ 'readDoubleBE' : 8
+ , 'readDoubleLE' : 8
+ , 'readFloatBE' : 4
+ , 'readFloatLE' : 4
+ , 'readInt32BE' : 4
+ , 'readInt32LE' : 4
+ , 'readUInt32BE' : 4
+ , 'readUInt32LE' : 4
+ , 'readInt16BE' : 2
+ , 'readInt16LE' : 2
+ , 'readUInt16BE' : 2
+ , 'readUInt16LE' : 2
+ , 'readInt8' : 1
+ , 'readUInt8' : 1
+ }
+
+ for (var m in methods) {
+ (function (m) {
+ BufferList.prototype[m] = function (offset) {
+ return this.slice(offset, offset + methods[m])[m](0)
+ }
+ }(m))
+ }
+}())
+
+module.exports = BufferList
--- /dev/null
+build/
+test/
+examples/
+fs.js
+zlib.js
\ No newline at end of file
--- /dev/null
+Copyright (c) Isaac Z. Schlueter ("Author")
+All rights reserved.
+
+The BSD License
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--- /dev/null
+# readable-stream
+
+***Node-core streams for userland***
+
+[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true)](https://nodei.co/npm/readable-stream/)
+[![NPM](https://nodei.co/npm-dl/readable-stream.png)](https://nodei.co/npm/readable-stream/)
+
+This package is a mirror of the Streams2 and Streams3 implementations in Node-core.
+
+If you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core.
+
+**readable-stream** comes in two major versions, v1.0.x and v1.1.x. The former tracks the Streams2 implementation in Node 0.10, including bug-fixes and minor improvements as they are added. The latter tracks Streams3 as it develops in Node 0.11; we will likely see a v1.2.x branch for Node 0.12.
+
+**readable-stream** uses proper patch-level versioning so if you pin to `"~1.0.0"` you’ll get the latest Node 0.10 Streams2 implementation, including any fixes and minor non-breaking improvements. The patch-level versions of 1.0.x and 1.1.x should mirror the patch-level versions of Node-core releases. You should prefer the **1.0.x** releases for now and when you’re ready to start using Streams3, pin to `"~1.1.0"`
+
--- /dev/null
+module.exports = require("./lib/_stream_duplex.js")
--- /dev/null
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// a duplex stream is just a stream that is both readable and writable.
+// Since JS doesn't have multiple prototypal inheritance, this class
+// prototypally inherits from Readable, and then parasitically from
+// Writable.
+
+module.exports = Duplex;
+
+/*<replacement>*/
+var objectKeys = Object.keys || function (obj) {
+ var keys = [];
+ for (var key in obj) keys.push(key);
+ return keys;
+}
+/*</replacement>*/
+
+
+/*<replacement>*/
+var util = require('core-util-is');
+util.inherits = require('inherits');
+/*</replacement>*/
+
+var Readable = require('./_stream_readable');
+var Writable = require('./_stream_writable');
+
+util.inherits(Duplex, Readable);
+
+forEach(objectKeys(Writable.prototype), function(method) {
+ if (!Duplex.prototype[method])
+ Duplex.prototype[method] = Writable.prototype[method];
+});
+
+function Duplex(options) {
+ if (!(this instanceof Duplex))
+ return new Duplex(options);
+
+ Readable.call(this, options);
+ Writable.call(this, options);
+
+ if (options && options.readable === false)
+ this.readable = false;
+
+ if (options && options.writable === false)
+ this.writable = false;
+
+ this.allowHalfOpen = true;
+ if (options && options.allowHalfOpen === false)
+ this.allowHalfOpen = false;
+
+ this.once('end', onend);
+}
+
+// the no-half-open enforcer
+function onend() {
+ // if we allow half-open state, or if the writable side ended,
+ // then we're ok.
+ if (this.allowHalfOpen || this._writableState.ended)
+ return;
+
+ // no more data can be written.
+ // But allow more writes to happen in this tick.
+ process.nextTick(this.end.bind(this));
+}
+
+function forEach (xs, f) {
+ for (var i = 0, l = xs.length; i < l; i++) {
+ f(xs[i], i);
+ }
+}
--- /dev/null
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// a passthrough stream.
+// basically just the most minimal sort of Transform stream.
+// Every written chunk gets output as-is.
+
+module.exports = PassThrough;
+
+var Transform = require('./_stream_transform');
+
+/*<replacement>*/
+var util = require('core-util-is');
+util.inherits = require('inherits');
+/*</replacement>*/
+
+util.inherits(PassThrough, Transform);
+
+function PassThrough(options) {
+ if (!(this instanceof PassThrough))
+ return new PassThrough(options);
+
+ Transform.call(this, options);
+}
+
+PassThrough.prototype._transform = function(chunk, encoding, cb) {
+ cb(null, chunk);
+};
--- /dev/null
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+module.exports = Readable;
+
+/*<replacement>*/
+var isArray = require('isarray');
+/*</replacement>*/
+
+
+/*<replacement>*/
+var Buffer = require('buffer').Buffer;
+/*</replacement>*/
+
+Readable.ReadableState = ReadableState;
+
+var EE = require('events').EventEmitter;
+
+/*<replacement>*/
+if (!EE.listenerCount) EE.listenerCount = function(emitter, type) {
+ return emitter.listeners(type).length;
+};
+/*</replacement>*/
+
+var Stream = require('stream');
+
+/*<replacement>*/
+var util = require('core-util-is');
+util.inherits = require('inherits');
+/*</replacement>*/
+
+var StringDecoder;
+
+util.inherits(Readable, Stream);
+
+function ReadableState(options, stream) {
+ options = options || {};
+
+ // the point at which it stops calling _read() to fill the buffer
+ // Note: 0 is a valid value, means "don't call _read preemptively ever"
+ var hwm = options.highWaterMark;
+ this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;
+
+ // cast to ints.
+ this.highWaterMark = ~~this.highWaterMark;
+
+ this.buffer = [];
+ this.length = 0;
+ this.pipes = null;
+ this.pipesCount = 0;
+ this.flowing = false;
+ this.ended = false;
+ this.endEmitted = false;
+ this.reading = false;
+
+ // In streams that never have any data, and do push(null) right away,
+ // the consumer can miss the 'end' event if they do some I/O before
+ // consuming the stream. So, we don't emit('end') until some reading
+ // happens.
+ this.calledRead = false;
+
+ // a flag to be able to tell if the onwrite cb is called immediately,
+ // or on a later tick. We set this to true at first, becuase any
+ // actions that shouldn't happen until "later" should generally also
+ // not happen before the first write call.
+ this.sync = true;
+
+ // whenever we return null, then we set a flag to say
+ // that we're awaiting a 'readable' event emission.
+ this.needReadable = false;
+ this.emittedReadable = false;
+ this.readableListening = false;
+
+
+ // object stream flag. Used to make read(n) ignore n and to
+ // make all the buffer merging and length checks go away
+ this.objectMode = !!options.objectMode;
+
+ // Crypto is kind of old and crusty. Historically, its default string
+ // encoding is 'binary' so we have to make this configurable.
+ // Everything else in the universe uses 'utf8', though.
+ this.defaultEncoding = options.defaultEncoding || 'utf8';
+
+ // when piping, we only care about 'readable' events that happen
+ // after read()ing all the bytes and not getting any pushback.
+ this.ranOut = false;
+
+ // the number of writers that are awaiting a drain event in .pipe()s
+ this.awaitDrain = 0;
+
+ // if true, a maybeReadMore has been scheduled
+ this.readingMore = false;
+
+ this.decoder = null;
+ this.encoding = null;
+ if (options.encoding) {
+ if (!StringDecoder)
+ StringDecoder = require('string_decoder/').StringDecoder;
+ this.decoder = new StringDecoder(options.encoding);
+ this.encoding = options.encoding;
+ }
+}
+
+function Readable(options) {
+ if (!(this instanceof Readable))
+ return new Readable(options);
+
+ this._readableState = new ReadableState(options, this);
+
+ // legacy
+ this.readable = true;
+
+ Stream.call(this);
+}
+
+// Manually shove something into the read() buffer.
+// This returns true if the highWaterMark has not been hit yet,
+// similar to how Writable.write() returns true if you should
+// write() some more.
+Readable.prototype.push = function(chunk, encoding) {
+ var state = this._readableState;
+
+ if (typeof chunk === 'string' && !state.objectMode) {
+ encoding = encoding || state.defaultEncoding;
+ if (encoding !== state.encoding) {
+ chunk = new Buffer(chunk, encoding);
+ encoding = '';
+ }
+ }
+
+ return readableAddChunk(this, state, chunk, encoding, false);
+};
+
+// Unshift should *always* be something directly out of read()
+Readable.prototype.unshift = function(chunk) {
+ var state = this._readableState;
+ return readableAddChunk(this, state, chunk, '', true);
+};
+
+function readableAddChunk(stream, state, chunk, encoding, addToFront) {
+ var er = chunkInvalid(state, chunk);
+ if (er) {
+ stream.emit('error', er);
+ } else if (chunk === null || chunk === undefined) {
+ state.reading = false;
+ if (!state.ended)
+ onEofChunk(stream, state);
+ } else if (state.objectMode || chunk && chunk.length > 0) {
+ if (state.ended && !addToFront) {
+ var e = new Error('stream.push() after EOF');
+ stream.emit('error', e);
+ } else if (state.endEmitted && addToFront) {
+ var e = new Error('stream.unshift() after end event');
+ stream.emit('error', e);
+ } else {
+ if (state.decoder && !addToFront && !encoding)
+ chunk = state.decoder.write(chunk);
+
+ // update the buffer info.
+ state.length += state.objectMode ? 1 : chunk.length;
+ if (addToFront) {
+ state.buffer.unshift(chunk);
+ } else {
+ state.reading = false;
+ state.buffer.push(chunk);
+ }
+
+ if (state.needReadable)
+ emitReadable(stream);
+
+ maybeReadMore(stream, state);
+ }
+ } else if (!addToFront) {
+ state.reading = false;
+ }
+
+ return needMoreData(state);
+}
+
+
+
+// if it's past the high water mark, we can push in some more.
+// Also, if we have no data yet, we can stand some
+// more bytes. This is to work around cases where hwm=0,
+// such as the repl. Also, if the push() triggered a
+// readable event, and the user called read(largeNumber) such that
+// needReadable was set, then we ought to push more, so that another
+// 'readable' event will be triggered.
+function needMoreData(state) {
+ return !state.ended &&
+ (state.needReadable ||
+ state.length < state.highWaterMark ||
+ state.length === 0);
+}
+
+// backwards compatibility.
+Readable.prototype.setEncoding = function(enc) {
+ if (!StringDecoder)
+ StringDecoder = require('string_decoder/').StringDecoder;
+ this._readableState.decoder = new StringDecoder(enc);
+ this._readableState.encoding = enc;
+};
+
+// Don't raise the hwm > 128MB
+var MAX_HWM = 0x800000;
+function roundUpToNextPowerOf2(n) {
+ if (n >= MAX_HWM) {
+ n = MAX_HWM;
+ } else {
+ // Get the next highest power of 2
+ n--;
+ for (var p = 1; p < 32; p <<= 1) n |= n >> p;
+ n++;
+ }
+ return n;
+}
+
+function howMuchToRead(n, state) {
+ if (state.length === 0 && state.ended)
+ return 0;
+
+ if (state.objectMode)
+ return n === 0 ? 0 : 1;
+
+ if (n === null || isNaN(n)) {
+ // only flow one buffer at a time
+ if (state.flowing && state.buffer.length)
+ return state.buffer[0].length;
+ else
+ return state.length;
+ }
+
+ if (n <= 0)
+ return 0;
+
+ // If we're asking for more than the target buffer level,
+ // then raise the water mark. Bump up to the next highest
+ // power of 2, to prevent increasing it excessively in tiny
+ // amounts.
+ if (n > state.highWaterMark)
+ state.highWaterMark = roundUpToNextPowerOf2(n);
+
+ // don't have that much. return null, unless we've ended.
+ if (n > state.length) {
+ if (!state.ended) {
+ state.needReadable = true;
+ return 0;
+ } else
+ return state.length;
+ }
+
+ return n;
+}
+
+// you can override either this method, or the async _read(n) below.
+Readable.prototype.read = function(n) {
+ var state = this._readableState;
+ state.calledRead = true;
+ var nOrig = n;
+ var ret;
+
+ if (typeof n !== 'number' || n > 0)
+ state.emittedReadable = false;
+
+ // if we're doing read(0) to trigger a readable event, but we
+ // already have a bunch of data in the buffer, then just trigger
+ // the 'readable' event and move on.
+ if (n === 0 &&
+ state.needReadable &&
+ (state.length >= state.highWaterMark || state.ended)) {
+ emitReadable(this);
+ return null;
+ }
+
+ n = howMuchToRead(n, state);
+
+ // if we've ended, and we're now clear, then finish it up.
+ if (n === 0 && state.ended) {
+ ret = null;
+
+ // In cases where the decoder did not receive enough data
+ // to produce a full chunk, then immediately received an
+ // EOF, state.buffer will contain [<Buffer >, <Buffer 00 ...>].
+ // howMuchToRead will see this and coerce the amount to
+ // read to zero (because it's looking at the length of the
+ // first <Buffer > in state.buffer), and we'll end up here.
+ //
+ // This can only happen via state.decoder -- no other venue
+ // exists for pushing a zero-length chunk into state.buffer
+ // and triggering this behavior. In this case, we return our
+ // remaining data and end the stream, if appropriate.
+ if (state.length > 0 && state.decoder) {
+ ret = fromList(n, state);
+ state.length -= ret.length;
+ }
+
+ if (state.length === 0)
+ endReadable(this);
+
+ return ret;
+ }
+
+ // All the actual chunk generation logic needs to be
+ // *below* the call to _read. The reason is that in certain
+ // synthetic stream cases, such as passthrough streams, _read
+ // may be a completely synchronous operation which may change
+ // the state of the read buffer, providing enough data when
+ // before there was *not* enough.
+ //
+ // So, the steps are:
+ // 1. Figure out what the state of things will be after we do
+ // a read from the buffer.
+ //
+ // 2. If that resulting state will trigger a _read, then call _read.
+ // Note that this may be asynchronous, or synchronous. Yes, it is
+ // deeply ugly to write APIs this way, but that still doesn't mean
+ // that the Readable class should behave improperly, as streams are
+ // designed to be sync/async agnostic.
+ // Take note if the _read call is sync or async (ie, if the read call
+ // has returned yet), so that we know whether or not it's safe to emit
+ // 'readable' etc.
+ //
+ // 3. Actually pull the requested chunks out of the buffer and return.
+
+ // if we need a readable event, then we need to do some reading.
+ var doRead = state.needReadable;
+
+ // if we currently have less than the highWaterMark, then also read some
+ if (state.length - n <= state.highWaterMark)
+ doRead = true;
+
+ // however, if we've ended, then there's no point, and if we're already
+ // reading, then it's unnecessary.
+ if (state.ended || state.reading)
+ doRead = false;
+
+ if (doRead) {
+ state.reading = true;
+ state.sync = true;
+ // if the length is currently zero, then we *need* a readable event.
+ if (state.length === 0)
+ state.needReadable = true;
+ // call internal read method
+ this._read(state.highWaterMark);
+ state.sync = false;
+ }
+
+ // If _read called its callback synchronously, then `reading`
+ // will be false, and we need to re-evaluate how much data we
+ // can return to the user.
+ if (doRead && !state.reading)
+ n = howMuchToRead(nOrig, state);
+
+ if (n > 0)
+ ret = fromList(n, state);
+ else
+ ret = null;
+
+ if (ret === null) {
+ state.needReadable = true;
+ n = 0;
+ }
+
+ state.length -= n;
+
+ // If we have nothing in the buffer, then we want to know
+ // as soon as we *do* get something into the buffer.
+ if (state.length === 0 && !state.ended)
+ state.needReadable = true;
+
+ // If we happened to read() exactly the remaining amount in the
+ // buffer, and the EOF has been seen at this point, then make sure
+ // that we emit 'end' on the very next tick.
+ if (state.ended && !state.endEmitted && state.length === 0)
+ endReadable(this);
+
+ return ret;
+};
+
+function chunkInvalid(state, chunk) {
+ var er = null;
+ if (!Buffer.isBuffer(chunk) &&
+ 'string' !== typeof chunk &&
+ chunk !== null &&
+ chunk !== undefined &&
+ !state.objectMode) {
+ er = new TypeError('Invalid non-string/buffer chunk');
+ }
+ return er;
+}
+
+
+function onEofChunk(stream, state) {
+ if (state.decoder && !state.ended) {
+ var chunk = state.decoder.end();
+ if (chunk && chunk.length) {
+ state.buffer.push(chunk);
+ state.length += state.objectMode ? 1 : chunk.length;
+ }
+ }
+ state.ended = true;
+
+ // if we've ended and we have some data left, then emit
+ // 'readable' now to make sure it gets picked up.
+ if (state.length > 0)
+ emitReadable(stream);
+ else
+ endReadable(stream);
+}
+
+// Don't emit readable right away in sync mode, because this can trigger
+// another read() call => stack overflow. This way, it might trigger
+// a nextTick recursion warning, but that's not so bad.
+function emitReadable(stream) {
+ var state = stream._readableState;
+ state.needReadable = false;
+ if (state.emittedReadable)
+ return;
+
+ state.emittedReadable = true;
+ if (state.sync)
+ process.nextTick(function() {
+ emitReadable_(stream);
+ });
+ else
+ emitReadable_(stream);
+}
+
+function emitReadable_(stream) {
+ stream.emit('readable');
+}
+
+
+// at this point, the user has presumably seen the 'readable' event,
+// and called read() to consume some data. that may have triggered
+// in turn another _read(n) call, in which case reading = true if
+// it's in progress.
+// However, if we're not ended, or reading, and the length < hwm,
+// then go ahead and try to read some more preemptively.
+function maybeReadMore(stream, state) {
+ if (!state.readingMore) {
+ state.readingMore = true;
+ process.nextTick(function() {
+ maybeReadMore_(stream, state);
+ });
+ }
+}
+
+function maybeReadMore_(stream, state) {
+ var len = state.length;
+ while (!state.reading && !state.flowing && !state.ended &&
+ state.length < state.highWaterMark) {
+ stream.read(0);
+ if (len === state.length)
+ // didn't get any data, stop spinning.
+ break;
+ else
+ len = state.length;
+ }
+ state.readingMore = false;
+}
+
+// abstract method. to be overridden in specific implementation classes.
+// call cb(er, data) where data is <= n in length.
+// for virtual (non-string, non-buffer) streams, "length" is somewhat
+// arbitrary, and perhaps not very meaningful.
+Readable.prototype._read = function(n) {
+ this.emit('error', new Error('not implemented'));
+};
+
+Readable.prototype.pipe = function(dest, pipeOpts) {
+ var src = this;
+ var state = this._readableState;
+
+ switch (state.pipesCount) {
+ case 0:
+ state.pipes = dest;
+ break;
+ case 1:
+ state.pipes = [state.pipes, dest];
+ break;
+ default:
+ state.pipes.push(dest);
+ break;
+ }
+ state.pipesCount += 1;
+
+ var doEnd = (!pipeOpts || pipeOpts.end !== false) &&
+ dest !== process.stdout &&
+ dest !== process.stderr;
+
+ var endFn = doEnd ? onend : cleanup;
+ if (state.endEmitted)
+ process.nextTick(endFn);
+ else
+ src.once('end', endFn);
+
+ dest.on('unpipe', onunpipe);
+ function onunpipe(readable) {
+ if (readable !== src) return;
+ cleanup();
+ }
+
+ function onend() {
+ dest.end();
+ }
+
+ // when the dest drains, it reduces the awaitDrain counter
+ // on the source. This would be more elegant with a .once()
+ // handler in flow(), but adding and removing repeatedly is
+ // too slow.
+ var ondrain = pipeOnDrain(src);
+ dest.on('drain', ondrain);
+
+ function cleanup() {
+ // cleanup event handlers once the pipe is broken
+ dest.removeListener('close', onclose);
+ dest.removeListener('finish', onfinish);
+ dest.removeListener('drain', ondrain);
+ dest.removeListener('error', onerror);
+ dest.removeListener('unpipe', onunpipe);
+ src.removeListener('end', onend);
+ src.removeListener('end', cleanup);
+
+ // if the reader is waiting for a drain event from this
+ // specific writer, then it would cause it to never start
+ // flowing again.
+ // So, if this is awaiting a drain, then we just call it now.
+ // If we don't know, then assume that we are waiting for one.
+ if (!dest._writableState || dest._writableState.needDrain)
+ ondrain();
+ }
+
+ // if the dest has an error, then stop piping into it.
+ // however, don't suppress the throwing behavior for this.
+ function onerror(er) {
+ unpipe();
+ dest.removeListener('error', onerror);
+ if (EE.listenerCount(dest, 'error') === 0)
+ dest.emit('error', er);
+ }
+ // This is a brutally ugly hack to make sure that our error handler
+ // is attached before any userland ones. NEVER DO THIS.
+ if (!dest._events || !dest._events.error)
+ dest.on('error', onerror);
+ else if (isArray(dest._events.error))
+ dest._events.error.unshift(onerror);
+ else
+ dest._events.error = [onerror, dest._events.error];
+
+
+
+ // Both close and finish should trigger unpipe, but only once.
+ function onclose() {
+ dest.removeListener('finish', onfinish);
+ unpipe();
+ }
+ dest.once('close', onclose);
+ function onfinish() {
+ dest.removeListener('close', onclose);
+ unpipe();
+ }
+ dest.once('finish', onfinish);
+
+ function unpipe() {
+ src.unpipe(dest);
+ }
+
+ // tell the dest that it's being piped to
+ dest.emit('pipe', src);
+
+ // start the flow if it hasn't been started already.
+ if (!state.flowing) {
+ // the handler that waits for readable events after all
+ // the data gets sucked out in flow.
+ // This would be easier to follow with a .once() handler
+ // in flow(), but that is too slow.
+ this.on('readable', pipeOnReadable);
+
+ state.flowing = true;
+ process.nextTick(function() {
+ flow(src);
+ });
+ }
+
+ return dest;
+};
+
+function pipeOnDrain(src) {
+ return function() {
+ var dest = this;
+ var state = src._readableState;
+ state.awaitDrain--;
+ if (state.awaitDrain === 0)
+ flow(src);
+ };
+}
+
+function flow(src) {
+ var state = src._readableState;
+ var chunk;
+ state.awaitDrain = 0;
+
+ function write(dest, i, list) {
+ var written = dest.write(chunk);
+ if (false === written) {
+ state.awaitDrain++;
+ }
+ }
+
+ while (state.pipesCount && null !== (chunk = src.read())) {
+
+ if (state.pipesCount === 1)
+ write(state.pipes, 0, null);
+ else
+ forEach(state.pipes, write);
+
+ src.emit('data', chunk);
+
+ // if anyone needs a drain, then we have to wait for that.
+ if (state.awaitDrain > 0)
+ return;
+ }
+
+ // if every destination was unpiped, either before entering this
+ // function, or in the while loop, then stop flowing.
+ //
+ // NB: This is a pretty rare edge case.
+ if (state.pipesCount === 0) {
+ state.flowing = false;
+
+ // if there were data event listeners added, then switch to old mode.
+ if (EE.listenerCount(src, 'data') > 0)
+ emitDataEvents(src);
+ return;
+ }
+
+ // at this point, no one needed a drain, so we just ran out of data
+ // on the next readable event, start it over again.
+ state.ranOut = true;
+}
+
+function pipeOnReadable() {
+ if (this._readableState.ranOut) {
+ this._readableState.ranOut = false;
+ flow(this);
+ }
+}
+
+
+Readable.prototype.unpipe = function(dest) {
+ var state = this._readableState;
+
+ // if we're not piping anywhere, then do nothing.
+ if (state.pipesCount === 0)
+ return this;
+
+ // just one destination. most common case.
+ if (state.pipesCount === 1) {
+ // passed in one, but it's not the right one.
+ if (dest && dest !== state.pipes)
+ return this;
+
+ if (!dest)
+ dest = state.pipes;
+
+ // got a match.
+ state.pipes = null;
+ state.pipesCount = 0;
+ this.removeListener('readable', pipeOnReadable);
+ state.flowing = false;
+ if (dest)
+ dest.emit('unpipe', this);
+ return this;
+ }
+
+ // slow case. multiple pipe destinations.
+
+ if (!dest) {
+ // remove all.
+ var dests = state.pipes;
+ var len = state.pipesCount;
+ state.pipes = null;
+ state.pipesCount = 0;
+ this.removeListener('readable', pipeOnReadable);
+ state.flowing = false;
+
+ for (var i = 0; i < len; i++)
+ dests[i].emit('unpipe', this);
+ return this;
+ }
+
+ // try to find the right one.
+ var i = indexOf(state.pipes, dest);
+ if (i === -1)
+ return this;
+
+ state.pipes.splice(i, 1);
+ state.pipesCount -= 1;
+ if (state.pipesCount === 1)
+ state.pipes = state.pipes[0];
+
+ dest.emit('unpipe', this);
+
+ return this;
+};
+
+// set up data events if they are asked for
+// Ensure readable listeners eventually get something
+Readable.prototype.on = function(ev, fn) {
+ var res = Stream.prototype.on.call(this, ev, fn);
+
+ if (ev === 'data' && !this._readableState.flowing)
+ emitDataEvents(this);
+
+ if (ev === 'readable' && this.readable) {
+ var state = this._readableState;
+ if (!state.readableListening) {
+ state.readableListening = true;
+ state.emittedReadable = false;
+ state.needReadable = true;
+ if (!state.reading) {
+ this.read(0);
+ } else if (state.length) {
+ emitReadable(this, state);
+ }
+ }
+ }
+
+ return res;
+};
+Readable.prototype.addListener = Readable.prototype.on;
+
+// pause() and resume() are remnants of the legacy readable stream API
+// If the user uses them, then switch into old mode.
+Readable.prototype.resume = function() {
+ emitDataEvents(this);
+ this.read(0);
+ this.emit('resume');
+};
+
+Readable.prototype.pause = function() {
+ emitDataEvents(this, true);
+ this.emit('pause');
+};
+
+function emitDataEvents(stream, startPaused) {
+ var state = stream._readableState;
+
+ if (state.flowing) {
+ // https://github.com/isaacs/readable-stream/issues/16
+ throw new Error('Cannot switch to old mode now.');
+ }
+
+ var paused = startPaused || false;
+ var readable = false;
+
+ // convert to an old-style stream.
+ stream.readable = true;
+ stream.pipe = Stream.prototype.pipe;
+ stream.on = stream.addListener = Stream.prototype.on;
+
+ stream.on('readable', function() {
+ readable = true;
+
+ var c;
+ while (!paused && (null !== (c = stream.read())))
+ stream.emit('data', c);
+
+ if (c === null) {
+ readable = false;
+ stream._readableState.needReadable = true;
+ }
+ });
+
+ stream.pause = function() {
+ paused = true;
+ this.emit('pause');
+ };
+
+ stream.resume = function() {
+ paused = false;
+ if (readable)
+ process.nextTick(function() {
+ stream.emit('readable');
+ });
+ else
+ this.read(0);
+ this.emit('resume');
+ };
+
+ // now make it start, just in case it hadn't already.
+ stream.emit('readable');
+}
+
+// wrap an old-style stream as the async data source.
+// This is *not* part of the readable stream interface.
+// It is an ugly unfortunate mess of history.
+Readable.prototype.wrap = function(stream) {
+ var state = this._readableState;
+ var paused = false;
+
+ var self = this;
+ stream.on('end', function() {
+ if (state.decoder && !state.ended) {
+ var chunk = state.decoder.end();
+ if (chunk && chunk.length)
+ self.push(chunk);
+ }
+
+ self.push(null);
+ });
+
+ stream.on('data', function(chunk) {
+ if (state.decoder)
+ chunk = state.decoder.write(chunk);
+
+ // don't skip over falsy values in objectMode
+ //if (state.objectMode && util.isNullOrUndefined(chunk))
+ if (state.objectMode && (chunk === null || chunk === undefined))
+ return;
+ else if (!state.objectMode && (!chunk || !chunk.length))
+ return;
+
+ var ret = self.push(chunk);
+ if (!ret) {
+ paused = true;
+ stream.pause();
+ }
+ });
+
+ // proxy all the other methods.
+ // important when wrapping filters and duplexes.
+ for (var i in stream) {
+ if (typeof stream[i] === 'function' &&
+ typeof this[i] === 'undefined') {
+ this[i] = function(method) { return function() {
+ return stream[method].apply(stream, arguments);
+ }}(i);
+ }
+ }
+
+ // proxy certain important events.
+ var events = ['error', 'close', 'destroy', 'pause', 'resume'];
+ forEach(events, function(ev) {
+ stream.on(ev, self.emit.bind(self, ev));
+ });
+
+ // when we try to consume some more bytes, simply unpause the
+ // underlying stream.
+ self._read = function(n) {
+ if (paused) {
+ paused = false;
+ stream.resume();
+ }
+ };
+
+ return self;
+};
+
+
+
+// exposed for testing purposes only.
+Readable._fromList = fromList;
+
+// Pluck off n bytes from an array of buffers.
+// Length is the combined lengths of all the buffers in the list.
+function fromList(n, state) {
+ var list = state.buffer;
+ var length = state.length;
+ var stringMode = !!state.decoder;
+ var objectMode = !!state.objectMode;
+ var ret;
+
+ // nothing in the list, definitely empty.
+ if (list.length === 0)
+ return null;
+
+ if (length === 0)
+ ret = null;
+ else if (objectMode)
+ ret = list.shift();
+ else if (!n || n >= length) {
+ // read it all, truncate the array.
+ if (stringMode)
+ ret = list.join('');
+ else
+ ret = Buffer.concat(list, length);
+ list.length = 0;
+ } else {
+ // read just some of it.
+ if (n < list[0].length) {
+ // just take a part of the first list item.
+ // slice is the same for buffers and strings.
+ var buf = list[0];
+ ret = buf.slice(0, n);
+ list[0] = buf.slice(n);
+ } else if (n === list[0].length) {
+ // first list is a perfect match
+ ret = list.shift();
+ } else {
+ // complex case.
+ // we have enough to cover it, but it spans past the first buffer.
+ if (stringMode)
+ ret = '';
+ else
+ ret = new Buffer(n);
+
+ var c = 0;
+ for (var i = 0, l = list.length; i < l && c < n; i++) {
+ var buf = list[0];
+ var cpy = Math.min(n - c, buf.length);
+
+ if (stringMode)
+ ret += buf.slice(0, cpy);
+ else
+ buf.copy(ret, c, 0, cpy);
+
+ if (cpy < buf.length)
+ list[0] = buf.slice(cpy);
+ else
+ list.shift();
+
+ c += cpy;
+ }
+ }
+ }
+
+ return ret;
+}
+
+function endReadable(stream) {
+ var state = stream._readableState;
+
+ // If we get here before consuming all the bytes, then that is a
+ // bug in node. Should never happen.
+ if (state.length > 0)
+ throw new Error('endReadable called on non-empty stream');
+
+ if (!state.endEmitted && state.calledRead) {
+ state.ended = true;
+ process.nextTick(function() {
+ // Check that we didn't get one last unshift.
+ if (!state.endEmitted && state.length === 0) {
+ state.endEmitted = true;
+ stream.readable = false;
+ stream.emit('end');
+ }
+ });
+ }
+}
+
+function forEach (xs, f) {
+ for (var i = 0, l = xs.length; i < l; i++) {
+ f(xs[i], i);
+ }
+}
+
+function indexOf (xs, x) {
+ for (var i = 0, l = xs.length; i < l; i++) {
+ if (xs[i] === x) return i;
+ }
+ return -1;
+}
--- /dev/null
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+// a transform stream is a readable/writable stream where you do
+// something with the data. Sometimes it's called a "filter",
+// but that's not a great name for it, since that implies a thing where
+// some bits pass through, and others are simply ignored. (That would
+// be a valid example of a transform, of course.)
+//
+// While the output is causally related to the input, it's not a
+// necessarily symmetric or synchronous transformation. For example,
+// a zlib stream might take multiple plain-text writes(), and then
+// emit a single compressed chunk some time in the future.
+//
+// Here's how this works:
+//
+// The Transform stream has all the aspects of the readable and writable
+// stream classes. When you write(chunk), that calls _write(chunk,cb)
+// internally, and returns false if there's a lot of pending writes
+// buffered up. When you call read(), that calls _read(n) until
+// there's enough pending readable data buffered up.
+//
+// In a transform stream, the written data is placed in a buffer. When
+// _read(n) is called, it transforms the queued up data, calling the
+// buffered _write cb's as it consumes chunks. If consuming a single
+// written chunk would result in multiple output chunks, then the first
+// outputted bit calls the readcb, and subsequent chunks just go into
+// the read buffer, and will cause it to emit 'readable' if necessary.
+//
+// This way, back-pressure is actually determined by the reading side,
+// since _read has to be called to start processing a new chunk. However,
+// a pathological inflate type of transform can cause excessive buffering
+// here. For example, imagine a stream where every byte of input is
+// interpreted as an integer from 0-255, and then results in that many
+// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
+// 1kb of data being output. In this case, you could write a very small
+// amount of input, and end up with a very large amount of output. In
+// such a pathological inflating mechanism, there'd be no way to tell
+// the system to stop doing the transform. A single 4MB write could
+// cause the system to run out of memory.
+//
+// However, even in such a pathological case, only a single written chunk
+// would be consumed, and then the rest would wait (un-transformed) until
+// the results of the previous transformed chunk were consumed.
+
+module.exports = Transform;
+
+var Duplex = require('./_stream_duplex');
+
+/*<replacement>*/
+var util = require('core-util-is');
+util.inherits = require('inherits');
+/*</replacement>*/
+
+util.inherits(Transform, Duplex);
+
+
+function TransformState(options, stream) {
+ this.afterTransform = function(er, data) {
+ return afterTransform(stream, er, data);
+ };
+
+ this.needTransform = false;
+ this.transforming = false;
+ this.writecb = null;
+ this.writechunk = null;
+}
+
+function afterTransform(stream, er, data) {
+ var ts = stream._transformState;
+ ts.transforming = false;
+
+ var cb = ts.writecb;
+
+ if (!cb)
+ return stream.emit('error', new Error('no writecb in Transform class'));
+
+ ts.writechunk = null;
+ ts.writecb = null;
+
+ if (data !== null && data !== undefined)
+ stream.push(data);
+
+ if (cb)
+ cb(er);
+
+ var rs = stream._readableState;
+ rs.reading = false;
+ if (rs.needReadable || rs.length < rs.highWaterMark) {
+ stream._read(rs.highWaterMark);
+ }
+}
+
+
+function Transform(options) {
+ if (!(this instanceof Transform))
+ return new Transform(options);
+
+ Duplex.call(this, options);
+
+ var ts = this._transformState = new TransformState(options, this);
+
+ // when the writable side finishes, then flush out anything remaining.
+ var stream = this;
+
+ // start out asking for a readable event once data is transformed.
+ this._readableState.needReadable = true;
+
+ // we have implemented the _read method, and done the other things
+ // that Readable wants before the first _read call, so unset the
+ // sync guard flag.
+ this._readableState.sync = false;
+
+ this.once('finish', function() {
+ if ('function' === typeof this._flush)
+ this._flush(function(er) {
+ done(stream, er);
+ });
+ else
+ done(stream);
+ });
+}
+
+Transform.prototype.push = function(chunk, encoding) {
+ this._transformState.needTransform = false;
+ return Duplex.prototype.push.call(this, chunk, encoding);
+};
+
+// This is the part where you do stuff!
+// override this function in implementation classes.
+// 'chunk' is an input chunk.
+//
+// Call `push(newChunk)` to pass along transformed output
+// to the readable side. You may call 'push' zero or more times.
+//
+// Call `cb(err)` when you are done with this chunk. If you pass
+// an error, then that'll put the hurt on the whole operation. If you
+// never call cb(), then you'll never get another chunk.
+Transform.prototype._transform = function(chunk, encoding, cb) {
+ throw new Error('not implemented');
+};
+
+Transform.prototype._write = function(chunk, encoding, cb) {
+ var ts = this._transformState;
+ ts.writecb = cb;
+ ts.writechunk = chunk;
+ ts.writeencoding = encoding;
+ if (!ts.transforming) {
+ var rs = this._readableState;
+ if (ts.needTransform ||
+ rs.needReadable ||
+ rs.length < rs.highWaterMark)
+ this._read(rs.highWaterMark);
+ }
+};
+
+// Doesn't matter what the args are here.
+// _transform does all the work.
+// That we got here means that the readable side wants more data.
+Transform.prototype._read = function(n) {
+ var ts = this._transformState;
+
+ if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
+ ts.transforming = true;
+ this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
+ } else {
+ // mark that we need a transform, so that any data that comes in
+ // will get processed, now that we've asked for it.
+ ts.needTransform = true;
+ }
+};
+
+
+function done(stream, er) {
+ if (er)
+ return stream.emit('error', er);
+
+ // if there's nothing in the write buffer, then that means
+ // that nothing more will ever be provided
+ var ws = stream._writableState;
+ var rs = stream._readableState;
+ var ts = stream._transformState;
+
+ if (ws.length)
+ throw new Error('calling transform done when ws.length != 0');
+
+ if (ts.transforming)
+ throw new Error('calling transform done when still transforming');
+
+ return stream.push(null);
+}
--- /dev/null
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// A bit simpler than readable streams.
+// Implement an async ._write(chunk, cb), and it'll handle all
+// the drain event emission and buffering.
+
+module.exports = Writable;
+
+/*<replacement>*/
+var Buffer = require('buffer').Buffer;
+/*</replacement>*/
+
+Writable.WritableState = WritableState;
+
+
+/*<replacement>*/
+var util = require('core-util-is');
+util.inherits = require('inherits');
+/*</replacement>*/
+
+var Stream = require('stream');
+
+util.inherits(Writable, Stream);
+
+function WriteReq(chunk, encoding, cb) {
+ this.chunk = chunk;
+ this.encoding = encoding;
+ this.callback = cb;
+}
+
+function WritableState(options, stream) {
+ options = options || {};
+
+ // the point at which write() starts returning false
+ // Note: 0 is a valid value, means that we always return false if
+ // the entire buffer is not flushed immediately on write()
+ var hwm = options.highWaterMark;
+ this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;
+
+ // object stream flag to indicate whether or not this stream
+ // contains buffers or objects.
+ this.objectMode = !!options.objectMode;
+
+ // cast to ints.
+ this.highWaterMark = ~~this.highWaterMark;
+
+ this.needDrain = false;
+ // at the start of calling end()
+ this.ending = false;
+ // when end() has been called, and returned
+ this.ended = false;
+ // when 'finish' is emitted
+ this.finished = false;
+
+ // should we decode strings into buffers before passing to _write?
+ // this is here so that some node-core streams can optimize string
+ // handling at a lower level.
+ var noDecode = options.decodeStrings === false;
+ this.decodeStrings = !noDecode;
+
+ // Crypto is kind of old and crusty. Historically, its default string
+ // encoding is 'binary' so we have to make this configurable.
+ // Everything else in the universe uses 'utf8', though.
+ this.defaultEncoding = options.defaultEncoding || 'utf8';
+
+ // not an actual buffer we keep track of, but a measurement
+ // of how much we're waiting to get pushed to some underlying
+ // socket or file.
+ this.length = 0;
+
+ // a flag to see when we're in the middle of a write.
+ this.writing = false;
+
+ // a flag to be able to tell if the onwrite cb is called immediately,
+ // or on a later tick. We set this to true at first, becuase any
+ // actions that shouldn't happen until "later" should generally also
+ // not happen before the first write call.
+ this.sync = true;
+
+ // a flag to know if we're processing previously buffered items, which
+ // may call the _write() callback in the same tick, so that we don't
+ // end up in an overlapped onwrite situation.
+ this.bufferProcessing = false;
+
+ // the callback that's passed to _write(chunk,cb)
+ this.onwrite = function(er) {
+ onwrite(stream, er);
+ };
+
+ // the callback that the user supplies to write(chunk,encoding,cb)
+ this.writecb = null;
+
+ // the amount that is being written when _write is called.
+ this.writelen = 0;
+
+ this.buffer = [];
+
+ // True if the error was already emitted and should not be thrown again
+ this.errorEmitted = false;
+}
+
+function Writable(options) {
+ var Duplex = require('./_stream_duplex');
+
+ // Writable ctor is applied to Duplexes, though they're not
+ // instanceof Writable, they're instanceof Readable.
+ if (!(this instanceof Writable) && !(this instanceof Duplex))
+ return new Writable(options);
+
+ this._writableState = new WritableState(options, this);
+
+ // legacy.
+ this.writable = true;
+
+ Stream.call(this);
+}
+
+// Otherwise people can pipe Writable streams, which is just wrong.
+Writable.prototype.pipe = function() {
+ this.emit('error', new Error('Cannot pipe. Not readable.'));
+};
+
+
+function writeAfterEnd(stream, state, cb) {
+ var er = new Error('write after end');
+ // TODO: defer error events consistently everywhere, not just the cb
+ stream.emit('error', er);
+ process.nextTick(function() {
+ cb(er);
+ });
+}
+
+// If we get something that is not a buffer, string, null, or undefined,
+// and we're not in objectMode, then that's an error.
+// Otherwise stream chunks are all considered to be of length=1, and the
+// watermarks determine how many objects to keep in the buffer, rather than
+// how many bytes or characters.
+function validChunk(stream, state, chunk, cb) {
+ var valid = true;
+ if (!Buffer.isBuffer(chunk) &&
+ 'string' !== typeof chunk &&
+ chunk !== null &&
+ chunk !== undefined &&
+ !state.objectMode) {
+ var er = new TypeError('Invalid non-string/buffer chunk');
+ stream.emit('error', er);
+ process.nextTick(function() {
+ cb(er);
+ });
+ valid = false;
+ }
+ return valid;
+}
+
+Writable.prototype.write = function(chunk, encoding, cb) {
+ var state = this._writableState;
+ var ret = false;
+
+ if (typeof encoding === 'function') {
+ cb = encoding;
+ encoding = null;
+ }
+
+ if (Buffer.isBuffer(chunk))
+ encoding = 'buffer';
+ else if (!encoding)
+ encoding = state.defaultEncoding;
+
+ if (typeof cb !== 'function')
+ cb = function() {};
+
+ if (state.ended)
+ writeAfterEnd(this, state, cb);
+ else if (validChunk(this, state, chunk, cb))
+ ret = writeOrBuffer(this, state, chunk, encoding, cb);
+
+ return ret;
+};
+
+function decodeChunk(state, chunk, encoding) {
+ if (!state.objectMode &&
+ state.decodeStrings !== false &&
+ typeof chunk === 'string') {
+ chunk = new Buffer(chunk, encoding);
+ }
+ return chunk;
+}
+
+// if we're already writing something, then just put this
+// in the queue, and wait our turn. Otherwise, call _write
+// If we return false, then we need a drain event, so set that flag.
+function writeOrBuffer(stream, state, chunk, encoding, cb) {
+ chunk = decodeChunk(state, chunk, encoding);
+ if (Buffer.isBuffer(chunk))
+ encoding = 'buffer';
+ var len = state.objectMode ? 1 : chunk.length;
+
+ state.length += len;
+
+ var ret = state.length < state.highWaterMark;
+ // we must ensure that previous needDrain will not be reset to false.
+ if (!ret)
+ state.needDrain = true;
+
+ if (state.writing)
+ state.buffer.push(new WriteReq(chunk, encoding, cb));
+ else
+ doWrite(stream, state, len, chunk, encoding, cb);
+
+ return ret;
+}
+
+function doWrite(stream, state, len, chunk, encoding, cb) {
+ state.writelen = len;
+ state.writecb = cb;
+ state.writing = true;
+ state.sync = true;
+ stream._write(chunk, encoding, state.onwrite);
+ state.sync = false;
+}
+
+function onwriteError(stream, state, sync, er, cb) {
+ if (sync)
+ process.nextTick(function() {
+ cb(er);
+ });
+ else
+ cb(er);
+
+ stream._writableState.errorEmitted = true;
+ stream.emit('error', er);
+}
+
+function onwriteStateUpdate(state) {
+ state.writing = false;
+ state.writecb = null;
+ state.length -= state.writelen;
+ state.writelen = 0;
+}
+
+function onwrite(stream, er) {
+ var state = stream._writableState;
+ var sync = state.sync;
+ var cb = state.writecb;
+
+ onwriteStateUpdate(state);
+
+ if (er)
+ onwriteError(stream, state, sync, er, cb);
+ else {
+ // Check if we're actually ready to finish, but don't emit yet
+ var finished = needFinish(stream, state);
+
+ if (!finished && !state.bufferProcessing && state.buffer.length)
+ clearBuffer(stream, state);
+
+ if (sync) {
+ process.nextTick(function() {
+ afterWrite(stream, state, finished, cb);
+ });
+ } else {
+ afterWrite(stream, state, finished, cb);
+ }
+ }
+}
+
+function afterWrite(stream, state, finished, cb) {
+ if (!finished)
+ onwriteDrain(stream, state);
+ cb();
+ if (finished)
+ finishMaybe(stream, state);
+}
+
+// Must force callback to be called on nextTick, so that we don't
+// emit 'drain' before the write() consumer gets the 'false' return
+// value, and has a chance to attach a 'drain' listener.
+function onwriteDrain(stream, state) {
+ if (state.length === 0 && state.needDrain) {
+ state.needDrain = false;
+ stream.emit('drain');
+ }
+}
+
+
+// if there's something in the buffer waiting, then process it
+function clearBuffer(stream, state) {
+ state.bufferProcessing = true;
+
+ for (var c = 0; c < state.buffer.length; c++) {
+ var entry = state.buffer[c];
+ var chunk = entry.chunk;
+ var encoding = entry.encoding;
+ var cb = entry.callback;
+ var len = state.objectMode ? 1 : chunk.length;
+
+ doWrite(stream, state, len, chunk, encoding, cb);
+
+ // if we didn't call the onwrite immediately, then
+ // it means that we need to wait until it does.
+ // also, that means that the chunk and cb are currently
+ // being processed, so move the buffer counter past them.
+ if (state.writing) {
+ c++;
+ break;
+ }
+ }
+
+ state.bufferProcessing = false;
+ if (c < state.buffer.length)
+ state.buffer = state.buffer.slice(c);
+ else
+ state.buffer.length = 0;
+}
+
+Writable.prototype._write = function(chunk, encoding, cb) {
+ cb(new Error('not implemented'));
+};
+
+Writable.prototype.end = function(chunk, encoding, cb) {
+ var state = this._writableState;
+
+ if (typeof chunk === 'function') {
+ cb = chunk;
+ chunk = null;
+ encoding = null;
+ } else if (typeof encoding === 'function') {
+ cb = encoding;
+ encoding = null;
+ }
+
+ if (typeof chunk !== 'undefined' && chunk !== null)
+ this.write(chunk, encoding);
+
+ // ignore unnecessary end() calls.
+ if (!state.ending && !state.finished)
+ endWritable(this, state, cb);
+};
+
+
+function needFinish(stream, state) {
+ return (state.ending &&
+ state.length === 0 &&
+ !state.finished &&
+ !state.writing);
+}
+
+function finishMaybe(stream, state) {
+ var need = needFinish(stream, state);
+ if (need) {
+ state.finished = true;
+ stream.emit('finish');
+ }
+ return need;
+}
+
+function endWritable(stream, state, cb) {
+ state.ending = true;
+ finishMaybe(stream, state);
+ if (cb) {
+ if (state.finished)
+ process.nextTick(cb);
+ else
+ stream.once('finish', cb);
+ }
+ state.ended = true;
+}
--- /dev/null
+# core-util-is
+
+The `util.is*` functions introduced in Node v0.12.
--- /dev/null
+diff --git a/lib/util.js b/lib/util.js
+index a03e874..9074e8e 100644
+--- a/lib/util.js
++++ b/lib/util.js
+@@ -19,430 +19,6 @@
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+-var formatRegExp = /%[sdj%]/g;
+-exports.format = function(f) {
+- if (!isString(f)) {
+- var objects = [];
+- for (var i = 0; i < arguments.length; i++) {
+- objects.push(inspect(arguments[i]));
+- }
+- return objects.join(' ');
+- }
+-
+- var i = 1;
+- var args = arguments;
+- var len = args.length;
+- var str = String(f).replace(formatRegExp, function(x) {
+- if (x === '%%') return '%';
+- if (i >= len) return x;
+- switch (x) {
+- case '%s': return String(args[i++]);
+- case '%d': return Number(args[i++]);
+- case '%j':
+- try {
+- return JSON.stringify(args[i++]);
+- } catch (_) {
+- return '[Circular]';
+- }
+- default:
+- return x;
+- }
+- });
+- for (var x = args[i]; i < len; x = args[++i]) {
+- if (isNull(x) || !isObject(x)) {
+- str += ' ' + x;
+- } else {
+- str += ' ' + inspect(x);
+- }
+- }
+- return str;
+-};
+-
+-
+-// Mark that a method should not be used.
+-// Returns a modified function which warns once by default.
+-// If --no-deprecation is set, then it is a no-op.
+-exports.deprecate = function(fn, msg) {
+- // Allow for deprecating things in the process of starting up.
+- if (isUndefined(global.process)) {
+- return function() {
+- return exports.deprecate(fn, msg).apply(this, arguments);
+- };
+- }
+-
+- if (process.noDeprecation === true) {
+- return fn;
+- }
+-
+- var warned = false;
+- function deprecated() {
+- if (!warned) {
+- if (process.throwDeprecation) {
+- throw new Error(msg);
+- } else if (process.traceDeprecation) {
+- console.trace(msg);
+- } else {
+- console.error(msg);
+- }
+- warned = true;
+- }
+- return fn.apply(this, arguments);
+- }
+-
+- return deprecated;
+-};
+-
+-
+-var debugs = {};
+-var debugEnviron;
+-exports.debuglog = function(set) {
+- if (isUndefined(debugEnviron))
+- debugEnviron = process.env.NODE_DEBUG || '';
+- set = set.toUpperCase();
+- if (!debugs[set]) {
+- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
+- var pid = process.pid;
+- debugs[set] = function() {
+- var msg = exports.format.apply(exports, arguments);
+- console.error('%s %d: %s', set, pid, msg);
+- };
+- } else {
+- debugs[set] = function() {};
+- }
+- }
+- return debugs[set];
+-};
+-
+-
+-/**
+- * Echos the value of a value. Trys to print the value out
+- * in the best way possible given the different types.
+- *
+- * @param {Object} obj The object to print out.
+- * @param {Object} opts Optional options object that alters the output.
+- */
+-/* legacy: obj, showHidden, depth, colors*/
+-function inspect(obj, opts) {
+- // default options
+- var ctx = {
+- seen: [],
+- stylize: stylizeNoColor
+- };
+- // legacy...
+- if (arguments.length >= 3) ctx.depth = arguments[2];
+- if (arguments.length >= 4) ctx.colors = arguments[3];
+- if (isBoolean(opts)) {
+- // legacy...
+- ctx.showHidden = opts;
+- } else if (opts) {
+- // got an "options" object
+- exports._extend(ctx, opts);
+- }
+- // set default options
+- if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
+- if (isUndefined(ctx.depth)) ctx.depth = 2;
+- if (isUndefined(ctx.colors)) ctx.colors = false;
+- if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
+- if (ctx.colors) ctx.stylize = stylizeWithColor;
+- return formatValue(ctx, obj, ctx.depth);
+-}
+-exports.inspect = inspect;
+-
+-
+-// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
+-inspect.colors = {
+- 'bold' : [1, 22],
+- 'italic' : [3, 23],
+- 'underline' : [4, 24],
+- 'inverse' : [7, 27],
+- 'white' : [37, 39],
+- 'grey' : [90, 39],
+- 'black' : [30, 39],
+- 'blue' : [34, 39],
+- 'cyan' : [36, 39],
+- 'green' : [32, 39],
+- 'magenta' : [35, 39],
+- 'red' : [31, 39],
+- 'yellow' : [33, 39]
+-};
+-
+-// Don't use 'blue' not visible on cmd.exe
+-inspect.styles = {
+- 'special': 'cyan',
+- 'number': 'yellow',
+- 'boolean': 'yellow',
+- 'undefined': 'grey',
+- 'null': 'bold',
+- 'string': 'green',
+- 'date': 'magenta',
+- // "name": intentionally not styling
+- 'regexp': 'red'
+-};
+-
+-
+-function stylizeWithColor(str, styleType) {
+- var style = inspect.styles[styleType];
+-
+- if (style) {
+- return '\u001b[' + inspect.colors[style][0] + 'm' + str +
+- '\u001b[' + inspect.colors[style][1] + 'm';
+- } else {
+- return str;
+- }
+-}
+-
+-
+-function stylizeNoColor(str, styleType) {
+- return str;
+-}
+-
+-
+-function arrayToHash(array) {
+- var hash = {};
+-
+- array.forEach(function(val, idx) {
+- hash[val] = true;
+- });
+-
+- return hash;
+-}
+-
+-
+-function formatValue(ctx, value, recurseTimes) {
+- // Provide a hook for user-specified inspect functions.
+- // Check that value is an object with an inspect function on it
+- if (ctx.customInspect &&
+- value &&
+- isFunction(value.inspect) &&
+- // Filter out the util module, it's inspect function is special
+- value.inspect !== exports.inspect &&
+- // Also filter out any prototype objects using the circular check.
+- !(value.constructor && value.constructor.prototype === value)) {
+- var ret = value.inspect(recurseTimes, ctx);
+- if (!isString(ret)) {
+- ret = formatValue(ctx, ret, recurseTimes);
+- }
+- return ret;
+- }
+-
+- // Primitive types cannot have properties
+- var primitive = formatPrimitive(ctx, value);
+- if (primitive) {
+- return primitive;
+- }
+-
+- // Look up the keys of the object.
+- var keys = Object.keys(value);
+- var visibleKeys = arrayToHash(keys);
+-
+- if (ctx.showHidden) {
+- keys = Object.getOwnPropertyNames(value);
+- }
+-
+- // Some type of object without properties can be shortcutted.
+- if (keys.length === 0) {
+- if (isFunction(value)) {
+- var name = value.name ? ': ' + value.name : '';
+- return ctx.stylize('[Function' + name + ']', 'special');
+- }
+- if (isRegExp(value)) {
+- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
+- }
+- if (isDate(value)) {
+- return ctx.stylize(Date.prototype.toString.call(value), 'date');
+- }
+- if (isError(value)) {
+- return formatError(value);
+- }
+- }
+-
+- var base = '', array = false, braces = ['{', '}'];
+-
+- // Make Array say that they are Array
+- if (isArray(value)) {
+- array = true;
+- braces = ['[', ']'];
+- }
+-
+- // Make functions say that they are functions
+- if (isFunction(value)) {
+- var n = value.name ? ': ' + value.name : '';
+- base = ' [Function' + n + ']';
+- }
+-
+- // Make RegExps say that they are RegExps
+- if (isRegExp(value)) {
+- base = ' ' + RegExp.prototype.toString.call(value);
+- }
+-
+- // Make dates with properties first say the date
+- if (isDate(value)) {
+- base = ' ' + Date.prototype.toUTCString.call(value);
+- }
+-
+- // Make error with message first say the error
+- if (isError(value)) {
+- base = ' ' + formatError(value);
+- }
+-
+- if (keys.length === 0 && (!array || value.length == 0)) {
+- return braces[0] + base + braces[1];
+- }
+-
+- if (recurseTimes < 0) {
+- if (isRegExp(value)) {
+- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
+- } else {
+- return ctx.stylize('[Object]', 'special');
+- }
+- }
+-
+- ctx.seen.push(value);
+-
+- var output;
+- if (array) {
+- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
+- } else {
+- output = keys.map(function(key) {
+- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
+- });
+- }
+-
+- ctx.seen.pop();
+-
+- return reduceToSingleString(output, base, braces);
+-}
+-
+-
+-function formatPrimitive(ctx, value) {
+- if (isUndefined(value))
+- return ctx.stylize('undefined', 'undefined');
+- if (isString(value)) {
+- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
+- .replace(/'/g, "\\'")
+- .replace(/\\"/g, '"') + '\'';
+- return ctx.stylize(simple, 'string');
+- }
+- if (isNumber(value)) {
+- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0,
+- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 .
+- if (value === 0 && 1 / value < 0)
+- return ctx.stylize('-0', 'number');
+- return ctx.stylize('' + value, 'number');
+- }
+- if (isBoolean(value))
+- return ctx.stylize('' + value, 'boolean');
+- // For some reason typeof null is "object", so special case here.
+- if (isNull(value))
+- return ctx.stylize('null', 'null');
+-}
+-
+-
+-function formatError(value) {
+- return '[' + Error.prototype.toString.call(value) + ']';
+-}
+-
+-
+-function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
+- var output = [];
+- for (var i = 0, l = value.length; i < l; ++i) {
+- if (hasOwnProperty(value, String(i))) {
+- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
+- String(i), true));
+- } else {
+- output.push('');
+- }
+- }
+- keys.forEach(function(key) {
+- if (!key.match(/^\d+$/)) {
+- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
+- key, true));
+- }
+- });
+- return output;
+-}
+-
+-
+-function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
+- var name, str, desc;
+- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
+- if (desc.get) {
+- if (desc.set) {
+- str = ctx.stylize('[Getter/Setter]', 'special');
+- } else {
+- str = ctx.stylize('[Getter]', 'special');
+- }
+- } else {
+- if (desc.set) {
+- str = ctx.stylize('[Setter]', 'special');
+- }
+- }
+- if (!hasOwnProperty(visibleKeys, key)) {
+- name = '[' + key + ']';
+- }
+- if (!str) {
+- if (ctx.seen.indexOf(desc.value) < 0) {
+- if (isNull(recurseTimes)) {
+- str = formatValue(ctx, desc.value, null);
+- } else {
+- str = formatValue(ctx, desc.value, recurseTimes - 1);
+- }
+- if (str.indexOf('\n') > -1) {
+- if (array) {
+- str = str.split('\n').map(function(line) {
+- return ' ' + line;
+- }).join('\n').substr(2);
+- } else {
+- str = '\n' + str.split('\n').map(function(line) {
+- return ' ' + line;
+- }).join('\n');
+- }
+- }
+- } else {
+- str = ctx.stylize('[Circular]', 'special');
+- }
+- }
+- if (isUndefined(name)) {
+- if (array && key.match(/^\d+$/)) {
+- return str;
+- }
+- name = JSON.stringify('' + key);
+- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
+- name = name.substr(1, name.length - 2);
+- name = ctx.stylize(name, 'name');
+- } else {
+- name = name.replace(/'/g, "\\'")
+- .replace(/\\"/g, '"')
+- .replace(/(^"|"$)/g, "'");
+- name = ctx.stylize(name, 'string');
+- }
+- }
+-
+- return name + ': ' + str;
+-}
+-
+-
+-function reduceToSingleString(output, base, braces) {
+- var numLinesEst = 0;
+- var length = output.reduce(function(prev, cur) {
+- numLinesEst++;
+- if (cur.indexOf('\n') >= 0) numLinesEst++;
+- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
+- }, 0);
+-
+- if (length > 60) {
+- return braces[0] +
+- (base === '' ? '' : base + '\n ') +
+- ' ' +
+- output.join(',\n ') +
+- ' ' +
+- braces[1];
+- }
+-
+- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
+-}
+-
+-
+ // NOTE: These type checking functions intentionally don't use `instanceof`
+ // because it is fragile and can be easily faked with `Object.create()`.
+ function isArray(ar) {
+@@ -522,166 +98,10 @@ function isPrimitive(arg) {
+ exports.isPrimitive = isPrimitive;
+
+ function isBuffer(arg) {
+- return arg instanceof Buffer;
++ return Buffer.isBuffer(arg);
+ }
+ exports.isBuffer = isBuffer;
+
+ function objectToString(o) {
+ return Object.prototype.toString.call(o);
+-}
+-
+-
+-function pad(n) {
+- return n < 10 ? '0' + n.toString(10) : n.toString(10);
+-}
+-
+-
+-var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
+- 'Oct', 'Nov', 'Dec'];
+-
+-// 26 Feb 16:19:34
+-function timestamp() {
+- var d = new Date();
+- var time = [pad(d.getHours()),
+- pad(d.getMinutes()),
+- pad(d.getSeconds())].join(':');
+- return [d.getDate(), months[d.getMonth()], time].join(' ');
+-}
+-
+-
+-// log is just a thin wrapper to console.log that prepends a timestamp
+-exports.log = function() {
+- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
+-};
+-
+-
+-/**
+- * Inherit the prototype methods from one constructor into another.
+- *
+- * The Function.prototype.inherits from lang.js rewritten as a standalone
+- * function (not on Function.prototype). NOTE: If this file is to be loaded
+- * during bootstrapping this function needs to be rewritten using some native
+- * functions as prototype setup using normal JavaScript does not work as
+- * expected during bootstrapping (see mirror.js in r114903).
+- *
+- * @param {function} ctor Constructor function which needs to inherit the
+- * prototype.
+- * @param {function} superCtor Constructor function to inherit prototype from.
+- */
+-exports.inherits = function(ctor, superCtor) {
+- ctor.super_ = superCtor;
+- ctor.prototype = Object.create(superCtor.prototype, {
+- constructor: {
+- value: ctor,
+- enumerable: false,
+- writable: true,
+- configurable: true
+- }
+- });
+-};
+-
+-exports._extend = function(origin, add) {
+- // Don't do anything if add isn't an object
+- if (!add || !isObject(add)) return origin;
+-
+- var keys = Object.keys(add);
+- var i = keys.length;
+- while (i--) {
+- origin[keys[i]] = add[keys[i]];
+- }
+- return origin;
+-};
+-
+-function hasOwnProperty(obj, prop) {
+- return Object.prototype.hasOwnProperty.call(obj, prop);
+-}
+-
+-
+-// Deprecated old stuff.
+-
+-exports.p = exports.deprecate(function() {
+- for (var i = 0, len = arguments.length; i < len; ++i) {
+- console.error(exports.inspect(arguments[i]));
+- }
+-}, 'util.p: Use console.error() instead');
+-
+-
+-exports.exec = exports.deprecate(function() {
+- return require('child_process').exec.apply(this, arguments);
+-}, 'util.exec is now called `child_process.exec`.');
+-
+-
+-exports.print = exports.deprecate(function() {
+- for (var i = 0, len = arguments.length; i < len; ++i) {
+- process.stdout.write(String(arguments[i]));
+- }
+-}, 'util.print: Use console.log instead');
+-
+-
+-exports.puts = exports.deprecate(function() {
+- for (var i = 0, len = arguments.length; i < len; ++i) {
+- process.stdout.write(arguments[i] + '\n');
+- }
+-}, 'util.puts: Use console.log instead');
+-
+-
+-exports.debug = exports.deprecate(function(x) {
+- process.stderr.write('DEBUG: ' + x + '\n');
+-}, 'util.debug: Use console.error instead');
+-
+-
+-exports.error = exports.deprecate(function(x) {
+- for (var i = 0, len = arguments.length; i < len; ++i) {
+- process.stderr.write(arguments[i] + '\n');
+- }
+-}, 'util.error: Use console.error instead');
+-
+-
+-exports.pump = exports.deprecate(function(readStream, writeStream, callback) {
+- var callbackCalled = false;
+-
+- function call(a, b, c) {
+- if (callback && !callbackCalled) {
+- callback(a, b, c);
+- callbackCalled = true;
+- }
+- }
+-
+- readStream.addListener('data', function(chunk) {
+- if (writeStream.write(chunk) === false) readStream.pause();
+- });
+-
+- writeStream.addListener('drain', function() {
+- readStream.resume();
+- });
+-
+- readStream.addListener('end', function() {
+- writeStream.end();
+- });
+-
+- readStream.addListener('close', function() {
+- call();
+- });
+-
+- readStream.addListener('error', function(err) {
+- writeStream.end();
+- call(err);
+- });
+-
+- writeStream.addListener('error', function(err) {
+- readStream.destroy();
+- call(err);
+- });
+-}, 'util.pump(): Use readableStream.pipe() instead');
+-
+-
+-var uv;
+-exports._errnoException = function(err, syscall) {
+- if (isUndefined(uv)) uv = process.binding('uv');
+- var errname = uv.errname(err);
+- var e = new Error(syscall + ' ' + errname);
+- e.code = errname;
+- e.errno = errname;
+- e.syscall = syscall;
+- return e;
+-};
++}
\ No newline at end of file
--- /dev/null
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// NOTE: These type checking functions intentionally don't use `instanceof`
+// because it is fragile and can be easily faked with `Object.create()`.
+function isArray(ar) {
+ return Array.isArray(ar);
+}
+exports.isArray = isArray;
+
+function isBoolean(arg) {
+ return typeof arg === 'boolean';
+}
+exports.isBoolean = isBoolean;
+
+function isNull(arg) {
+ return arg === null;
+}
+exports.isNull = isNull;
+
+function isNullOrUndefined(arg) {
+ return arg == null;
+}
+exports.isNullOrUndefined = isNullOrUndefined;
+
+function isNumber(arg) {
+ return typeof arg === 'number';
+}
+exports.isNumber = isNumber;
+
+function isString(arg) {
+ return typeof arg === 'string';
+}
+exports.isString = isString;
+
+function isSymbol(arg) {
+ return typeof arg === 'symbol';
+}
+exports.isSymbol = isSymbol;
+
+function isUndefined(arg) {
+ return arg === void 0;
+}
+exports.isUndefined = isUndefined;
+
+function isRegExp(re) {
+ return isObject(re) && objectToString(re) === '[object RegExp]';
+}
+exports.isRegExp = isRegExp;
+
+function isObject(arg) {
+ return typeof arg === 'object' && arg !== null;
+}
+exports.isObject = isObject;
+
+function isDate(d) {
+ return isObject(d) && objectToString(d) === '[object Date]';
+}
+exports.isDate = isDate;
+
+function isError(e) {
+ return isObject(e) &&
+ (objectToString(e) === '[object Error]' || e instanceof Error);
+}
+exports.isError = isError;
+
+function isFunction(arg) {
+ return typeof arg === 'function';
+}
+exports.isFunction = isFunction;
+
+function isPrimitive(arg) {
+ return arg === null ||
+ typeof arg === 'boolean' ||
+ typeof arg === 'number' ||
+ typeof arg === 'string' ||
+ typeof arg === 'symbol' || // ES6 symbol
+ typeof arg === 'undefined';
+}
+exports.isPrimitive = isPrimitive;
+
+function isBuffer(arg) {
+ return Buffer.isBuffer(arg);
+}
+exports.isBuffer = isBuffer;
+
+function objectToString(o) {
+ return Object.prototype.toString.call(o);
+}
\ No newline at end of file
--- /dev/null
+{
+ "name": "core-util-is",
+ "version": "1.0.1",
+ "description": "The `util.is*` functions introduced in Node v0.12.",
+ "main": "lib/util.js",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/isaacs/core-util-is"
+ },
+ "keywords": [
+ "util",
+ "isBuffer",
+ "isArray",
+ "isNumber",
+ "isString",
+ "isRegExp",
+ "isThis",
+ "isThat",
+ "polyfill"
+ ],
+ "author": {
+ "name": "Isaac Z. Schlueter",
+ "email": "i@izs.me",
+ "url": "http://blog.izs.me/"
+ },
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/isaacs/core-util-is/issues"
+ },
+ "readme": "# core-util-is\n\nThe `util.is*` functions introduced in Node v0.12.\n",
+ "readmeFilename": "README.md",
+ "homepage": "https://github.com/isaacs/core-util-is",
+ "_id": "core-util-is@1.0.1",
+ "dist": {
+ "shasum": "6b07085aef9a3ccac6ee53bf9d3df0c1521a5538",
+ "tarball": "http://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz"
+ },
+ "_from": "core-util-is@~1.0.0",
+ "_npmVersion": "1.3.23",
+ "_npmUser": {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ "maintainers": [
+ {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ }
+ ],
+ "directories": {},
+ "_shasum": "6b07085aef9a3ccac6ee53bf9d3df0c1521a5538",
+ "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz"
+}
--- /dev/null
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+// NOTE: These type checking functions intentionally don't use `instanceof`
+// because it is fragile and can be easily faked with `Object.create()`.
+function isArray(ar) {
+ return Array.isArray(ar);
+}
+exports.isArray = isArray;
+
+function isBoolean(arg) {
+ return typeof arg === 'boolean';
+}
+exports.isBoolean = isBoolean;
+
+function isNull(arg) {
+ return arg === null;
+}
+exports.isNull = isNull;
+
+function isNullOrUndefined(arg) {
+ return arg == null;
+}
+exports.isNullOrUndefined = isNullOrUndefined;
+
+function isNumber(arg) {
+ return typeof arg === 'number';
+}
+exports.isNumber = isNumber;
+
+function isString(arg) {
+ return typeof arg === 'string';
+}
+exports.isString = isString;
+
+function isSymbol(arg) {
+ return typeof arg === 'symbol';
+}
+exports.isSymbol = isSymbol;
+
+function isUndefined(arg) {
+ return arg === void 0;
+}
+exports.isUndefined = isUndefined;
+
+function isRegExp(re) {
+ return isObject(re) && objectToString(re) === '[object RegExp]';
+}
+exports.isRegExp = isRegExp;
+
+function isObject(arg) {
+ return typeof arg === 'object' && arg !== null;
+}
+exports.isObject = isObject;
+
+function isDate(d) {
+ return isObject(d) && objectToString(d) === '[object Date]';
+}
+exports.isDate = isDate;
+
+function isError(e) {
+ return isObject(e) && objectToString(e) === '[object Error]';
+}
+exports.isError = isError;
+
+function isFunction(arg) {
+ return typeof arg === 'function';
+}
+exports.isFunction = isFunction;
+
+function isPrimitive(arg) {
+ return arg === null ||
+ typeof arg === 'boolean' ||
+ typeof arg === 'number' ||
+ typeof arg === 'string' ||
+ typeof arg === 'symbol' || // ES6 symbol
+ typeof arg === 'undefined';
+}
+exports.isPrimitive = isPrimitive;
+
+function isBuffer(arg) {
+ return arg instanceof Buffer;
+}
+exports.isBuffer = isBuffer;
+
+function objectToString(o) {
+ return Object.prototype.toString.call(o);
+}
--- /dev/null
+
+# isarray
+
+`Array#isArray` for older browsers.
+
+## Usage
+
+```js
+var isArray = require('isarray');
+
+console.log(isArray([])); // => true
+console.log(isArray({})); // => false
+```
+
+## Installation
+
+With [npm](http://npmjs.org) do
+
+```bash
+$ npm install isarray
+```
+
+Then bundle for the browser with
+[browserify](https://github.com/substack/browserify).
+
+With [component](http://component.io) do
+
+```bash
+$ component install juliangruber/isarray
+```
+
+## License
+
+(MIT)
+
+Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
--- /dev/null
+
+/**
+ * Require the given path.
+ *
+ * @param {String} path
+ * @return {Object} exports
+ * @api public
+ */
+
+function require(path, parent, orig) {
+ var resolved = require.resolve(path);
+
+ // lookup failed
+ if (null == resolved) {
+ orig = orig || path;
+ parent = parent || 'root';
+ var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
+ err.path = orig;
+ err.parent = parent;
+ err.require = true;
+ throw err;
+ }
+
+ var module = require.modules[resolved];
+
+ // perform real require()
+ // by invoking the module's
+ // registered function
+ if (!module.exports) {
+ module.exports = {};
+ module.client = module.component = true;
+ module.call(this, module.exports, require.relative(resolved), module);
+ }
+
+ return module.exports;
+}
+
+/**
+ * Registered modules.
+ */
+
+require.modules = {};
+
+/**
+ * Registered aliases.
+ */
+
+require.aliases = {};
+
+/**
+ * Resolve `path`.
+ *
+ * Lookup:
+ *
+ * - PATH/index.js
+ * - PATH.js
+ * - PATH
+ *
+ * @param {String} path
+ * @return {String} path or null
+ * @api private
+ */
+
+require.resolve = function(path) {
+ if (path.charAt(0) === '/') path = path.slice(1);
+ var index = path + '/index.js';
+
+ var paths = [
+ path,
+ path + '.js',
+ path + '.json',
+ path + '/index.js',
+ path + '/index.json'
+ ];
+
+ for (var i = 0; i < paths.length; i++) {
+ var path = paths[i];
+ if (require.modules.hasOwnProperty(path)) return path;
+ }
+
+ if (require.aliases.hasOwnProperty(index)) {
+ return require.aliases[index];
+ }
+};
+
+/**
+ * Normalize `path` relative to the current path.
+ *
+ * @param {String} curr
+ * @param {String} path
+ * @return {String}
+ * @api private
+ */
+
+require.normalize = function(curr, path) {
+ var segs = [];
+
+ if ('.' != path.charAt(0)) return path;
+
+ curr = curr.split('/');
+ path = path.split('/');
+
+ for (var i = 0; i < path.length; ++i) {
+ if ('..' == path[i]) {
+ curr.pop();
+ } else if ('.' != path[i] && '' != path[i]) {
+ segs.push(path[i]);
+ }
+ }
+
+ return curr.concat(segs).join('/');
+};
+
+/**
+ * Register module at `path` with callback `definition`.
+ *
+ * @param {String} path
+ * @param {Function} definition
+ * @api private
+ */
+
+require.register = function(path, definition) {
+ require.modules[path] = definition;
+};
+
+/**
+ * Alias a module definition.
+ *
+ * @param {String} from
+ * @param {String} to
+ * @api private
+ */
+
+require.alias = function(from, to) {
+ if (!require.modules.hasOwnProperty(from)) {
+ throw new Error('Failed to alias "' + from + '", it does not exist');
+ }
+ require.aliases[to] = from;
+};
+
+/**
+ * Return a require function relative to the `parent` path.
+ *
+ * @param {String} parent
+ * @return {Function}
+ * @api private
+ */
+
+require.relative = function(parent) {
+ var p = require.normalize(parent, '..');
+
+ /**
+ * lastIndexOf helper.
+ */
+
+ function lastIndexOf(arr, obj) {
+ var i = arr.length;
+ while (i--) {
+ if (arr[i] === obj) return i;
+ }
+ return -1;
+ }
+
+ /**
+ * The relative require() itself.
+ */
+
+ function localRequire(path) {
+ var resolved = localRequire.resolve(path);
+ return require(resolved, parent, path);
+ }
+
+ /**
+ * Resolve relative to the parent.
+ */
+
+ localRequire.resolve = function(path) {
+ var c = path.charAt(0);
+ if ('/' == c) return path.slice(1);
+ if ('.' == c) return require.normalize(p, path);
+
+ // resolve deps by returning
+ // the dep in the nearest "deps"
+ // directory
+ var segs = parent.split('/');
+ var i = lastIndexOf(segs, 'deps') + 1;
+ if (!i) i = 0;
+ path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
+ return path;
+ };
+
+ /**
+ * Check if module is defined at `path`.
+ */
+
+ localRequire.exists = function(path) {
+ return require.modules.hasOwnProperty(localRequire.resolve(path));
+ };
+
+ return localRequire;
+};
+require.register("isarray/index.js", function(exports, require, module){
+module.exports = Array.isArray || function (arr) {
+ return Object.prototype.toString.call(arr) == '[object Array]';
+};
+
+});
+require.alias("isarray/index.js", "isarray/index.js");
+
--- /dev/null
+{
+ "name" : "isarray",
+ "description" : "Array#isArray for older browsers",
+ "version" : "0.0.1",
+ "repository" : "juliangruber/isarray",
+ "homepage": "https://github.com/juliangruber/isarray",
+ "main" : "index.js",
+ "scripts" : [
+ "index.js"
+ ],
+ "dependencies" : {},
+ "keywords": ["browser","isarray","array"],
+ "author": {
+ "name": "Julian Gruber",
+ "email": "mail@juliangruber.com",
+ "url": "http://juliangruber.com"
+ },
+ "license": "MIT"
+}
--- /dev/null
+module.exports = Array.isArray || function (arr) {
+ return Object.prototype.toString.call(arr) == '[object Array]';
+};
--- /dev/null
+{
+ "name": "isarray",
+ "description": "Array#isArray for older browsers",
+ "version": "0.0.1",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/juliangruber/isarray.git"
+ },
+ "homepage": "https://github.com/juliangruber/isarray",
+ "main": "index.js",
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "tap": "*"
+ },
+ "keywords": [
+ "browser",
+ "isarray",
+ "array"
+ ],
+ "author": {
+ "name": "Julian Gruber",
+ "email": "mail@juliangruber.com",
+ "url": "http://juliangruber.com"
+ },
+ "license": "MIT",
+ "readme": "\n# isarray\n\n`Array#isArray` for older browsers.\n\n## Usage\n\n```js\nvar isArray = require('isarray');\n\nconsole.log(isArray([])); // => true\nconsole.log(isArray({})); // => false\n```\n\n## Installation\n\nWith [npm](http://npmjs.org) do\n\n```bash\n$ npm install isarray\n```\n\nThen bundle for the browser with\n[browserify](https://github.com/substack/browserify).\n\nWith [component](http://component.io) do\n\n```bash\n$ component install juliangruber/isarray\n```\n\n## License\n\n(MIT)\n\nCopyright (c) 2013 Julian Gruber <julian@juliangruber.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
+ "readmeFilename": "README.md",
+ "_id": "isarray@0.0.1",
+ "dist": {
+ "shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf",
+ "tarball": "http://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
+ },
+ "_from": "isarray@0.0.1",
+ "_npmVersion": "1.2.18",
+ "_npmUser": {
+ "name": "juliangruber",
+ "email": "julian@juliangruber.com"
+ },
+ "maintainers": [
+ {
+ "name": "juliangruber",
+ "email": "julian@juliangruber.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf",
+ "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+ "bugs": {
+ "url": "https://github.com/juliangruber/isarray/issues"
+ }
+}
--- /dev/null
+build
+test
--- /dev/null
+Copyright Joyent, Inc. and other Node contributors.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to permit
+persons to whom the Software is furnished to do so, subject to the
+following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null
+**string_decoder.js** (`require('string_decoder')`) from Node.js core
+
+Copyright Joyent, Inc. and other Node contributors. See LICENCE file for details.
+
+Version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. **Prefer the stable version over the unstable.**
+
+The *build/* directory contains a build script that will scrape the source from the [joyent/node](https://github.com/joyent/node) repo given a specific Node version.
\ No newline at end of file
--- /dev/null
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+var Buffer = require('buffer').Buffer;
+
+var isBufferEncoding = Buffer.isEncoding
+ || function(encoding) {
+ switch (encoding && encoding.toLowerCase()) {
+ case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;
+ default: return false;
+ }
+ }
+
+
+function assertEncoding(encoding) {
+ if (encoding && !isBufferEncoding(encoding)) {
+ throw new Error('Unknown encoding: ' + encoding);
+ }
+}
+
+// StringDecoder provides an interface for efficiently splitting a series of
+// buffers into a series of JS strings without breaking apart multi-byte
+// characters. CESU-8 is handled as part of the UTF-8 encoding.
+//
+// @TODO Handling all encodings inside a single object makes it very difficult
+// to reason about this code, so it should be split up in the future.
+// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
+// points as used by CESU-8.
+var StringDecoder = exports.StringDecoder = function(encoding) {
+ this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
+ assertEncoding(encoding);
+ switch (this.encoding) {
+ case 'utf8':
+ // CESU-8 represents each of Surrogate Pair by 3-bytes
+ this.surrogateSize = 3;
+ break;
+ case 'ucs2':
+ case 'utf16le':
+ // UTF-16 represents each of Surrogate Pair by 2-bytes
+ this.surrogateSize = 2;
+ this.detectIncompleteChar = utf16DetectIncompleteChar;
+ break;
+ case 'base64':
+ // Base-64 stores 3 bytes in 4 chars, and pads the remainder.
+ this.surrogateSize = 3;
+ this.detectIncompleteChar = base64DetectIncompleteChar;
+ break;
+ default:
+ this.write = passThroughWrite;
+ return;
+ }
+
+ // Enough space to store all bytes of a single character. UTF-8 needs 4
+ // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
+ this.charBuffer = new Buffer(6);
+ // Number of bytes received for the current incomplete multi-byte character.
+ this.charReceived = 0;
+ // Number of bytes expected for the current incomplete multi-byte character.
+ this.charLength = 0;
+};
+
+
+// write decodes the given buffer and returns it as JS string that is
+// guaranteed to not contain any partial multi-byte characters. Any partial
+// character found at the end of the buffer is buffered up, and will be
+// returned when calling write again with the remaining bytes.
+//
+// Note: Converting a Buffer containing an orphan surrogate to a String
+// currently works, but converting a String to a Buffer (via `new Buffer`, or
+// Buffer#write) will replace incomplete surrogates with the unicode
+// replacement character. See https://codereview.chromium.org/121173009/ .
+StringDecoder.prototype.write = function(buffer) {
+ var charStr = '';
+ // if our last write ended with an incomplete multibyte character
+ while (this.charLength) {
+ // determine how many remaining bytes this buffer has to offer for this char
+ var available = (buffer.length >= this.charLength - this.charReceived) ?
+ this.charLength - this.charReceived :
+ buffer.length;
+
+ // add the new bytes to the char buffer
+ buffer.copy(this.charBuffer, this.charReceived, 0, available);
+ this.charReceived += available;
+
+ if (this.charReceived < this.charLength) {
+ // still not enough chars in this buffer? wait for more ...
+ return '';
+ }
+
+ // remove bytes belonging to the current character from the buffer
+ buffer = buffer.slice(available, buffer.length);
+
+ // get the character that was split
+ charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
+
+ // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
+ var charCode = charStr.charCodeAt(charStr.length - 1);
+ if (charCode >= 0xD800 && charCode <= 0xDBFF) {
+ this.charLength += this.surrogateSize;
+ charStr = '';
+ continue;
+ }
+ this.charReceived = this.charLength = 0;
+
+ // if there are no more bytes in this buffer, just emit our char
+ if (buffer.length === 0) {
+ return charStr;
+ }
+ break;
+ }
+
+ // determine and set charLength / charReceived
+ this.detectIncompleteChar(buffer);
+
+ var end = buffer.length;
+ if (this.charLength) {
+ // buffer the incomplete character bytes we got
+ buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
+ end -= this.charReceived;
+ }
+
+ charStr += buffer.toString(this.encoding, 0, end);
+
+ var end = charStr.length - 1;
+ var charCode = charStr.charCodeAt(end);
+ // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
+ if (charCode >= 0xD800 && charCode <= 0xDBFF) {
+ var size = this.surrogateSize;
+ this.charLength += size;
+ this.charReceived += size;
+ this.charBuffer.copy(this.charBuffer, size, 0, size);
+ buffer.copy(this.charBuffer, 0, 0, size);
+ return charStr.substring(0, end);
+ }
+
+ // or just emit the charStr
+ return charStr;
+};
+
+// detectIncompleteChar determines if there is an incomplete UTF-8 character at
+// the end of the given buffer. If so, it sets this.charLength to the byte
+// length that character, and sets this.charReceived to the number of bytes
+// that are available for this character.
+StringDecoder.prototype.detectIncompleteChar = function(buffer) {
+ // determine how many bytes we have to check at the end of this buffer
+ var i = (buffer.length >= 3) ? 3 : buffer.length;
+
+ // Figure out if one of the last i bytes of our buffer announces an
+ // incomplete char.
+ for (; i > 0; i--) {
+ var c = buffer[buffer.length - i];
+
+ // See http://en.wikipedia.org/wiki/UTF-8#Description
+
+ // 110XXXXX
+ if (i == 1 && c >> 5 == 0x06) {
+ this.charLength = 2;
+ break;
+ }
+
+ // 1110XXXX
+ if (i <= 2 && c >> 4 == 0x0E) {
+ this.charLength = 3;
+ break;
+ }
+
+ // 11110XXX
+ if (i <= 3 && c >> 3 == 0x1E) {
+ this.charLength = 4;
+ break;
+ }
+ }
+ this.charReceived = i;
+};
+
+StringDecoder.prototype.end = function(buffer) {
+ var res = '';
+ if (buffer && buffer.length)
+ res = this.write(buffer);
+
+ if (this.charReceived) {
+ var cr = this.charReceived;
+ var buf = this.charBuffer;
+ var enc = this.encoding;
+ res += buf.slice(0, cr).toString(enc);
+ }
+
+ return res;
+};
+
+function passThroughWrite(buffer) {
+ return buffer.toString(this.encoding);
+}
+
+function utf16DetectIncompleteChar(buffer) {
+ this.charReceived = buffer.length % 2;
+ this.charLength = this.charReceived ? 2 : 0;
+}
+
+function base64DetectIncompleteChar(buffer) {
+ this.charReceived = buffer.length % 3;
+ this.charLength = this.charReceived ? 3 : 0;
+}
--- /dev/null
+{
+ "name": "string_decoder",
+ "version": "0.10.31",
+ "description": "The string_decoder module from Node core",
+ "main": "index.js",
+ "dependencies": {},
+ "devDependencies": {
+ "tap": "~0.4.8"
+ },
+ "scripts": {
+ "test": "tap test/simple/*.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/rvagg/string_decoder.git"
+ },
+ "homepage": "https://github.com/rvagg/string_decoder",
+ "keywords": [
+ "string",
+ "decoder",
+ "browser",
+ "browserify"
+ ],
+ "license": "MIT",
+ "gitHead": "d46d4fd87cf1d06e031c23f1ba170ca7d4ade9a0",
+ "bugs": {
+ "url": "https://github.com/rvagg/string_decoder/issues"
+ },
+ "_id": "string_decoder@0.10.31",
+ "_shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94",
+ "_from": "string_decoder@~0.10.x",
+ "_npmVersion": "1.4.23",
+ "_npmUser": {
+ "name": "rvagg",
+ "email": "rod@vagg.org"
+ },
+ "maintainers": [
+ {
+ "name": "substack",
+ "email": "mail@substack.net"
+ },
+ {
+ "name": "rvagg",
+ "email": "rod@vagg.org"
+ }
+ ],
+ "dist": {
+ "shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94",
+ "tarball": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
+ "readme": "ERROR: No README data found!"
+}
--- /dev/null
+{
+ "name": "readable-stream",
+ "version": "1.0.31",
+ "description": "Streams2, a user-land copy of the stream library from Node.js v0.10.x",
+ "main": "readable.js",
+ "dependencies": {
+ "core-util-is": "~1.0.0",
+ "isarray": "0.0.1",
+ "string_decoder": "~0.10.x",
+ "inherits": "~2.0.1"
+ },
+ "devDependencies": {
+ "tap": "~0.2.6"
+ },
+ "scripts": {
+ "test": "tap test/simple/*.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/isaacs/readable-stream"
+ },
+ "keywords": [
+ "readable",
+ "stream",
+ "pipe"
+ ],
+ "browser": {
+ "util": false
+ },
+ "author": {
+ "name": "Isaac Z. Schlueter",
+ "email": "i@izs.me",
+ "url": "http://blog.izs.me/"
+ },
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/isaacs/readable-stream/issues"
+ },
+ "homepage": "https://github.com/isaacs/readable-stream",
+ "_id": "readable-stream@1.0.31",
+ "_shasum": "8f2502e0bc9e3b0da1b94520aabb4e2603ecafae",
+ "_from": "readable-stream@~1.0.26",
+ "_npmVersion": "1.4.9",
+ "_npmUser": {
+ "name": "rvagg",
+ "email": "rod@vagg.org"
+ },
+ "maintainers": [
+ {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ {
+ "name": "tootallnate",
+ "email": "nathan@tootallnate.net"
+ },
+ {
+ "name": "rvagg",
+ "email": "rod@vagg.org"
+ }
+ ],
+ "dist": {
+ "shasum": "8f2502e0bc9e3b0da1b94520aabb4e2603ecafae",
+ "tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.31.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.31.tgz",
+ "readme": "ERROR: No README data found!"
+}
--- /dev/null
+module.exports = require("./lib/_stream_passthrough.js")
--- /dev/null
+exports = module.exports = require('./lib/_stream_readable.js');
+exports.Readable = exports;
+exports.Writable = require('./lib/_stream_writable.js');
+exports.Duplex = require('./lib/_stream_duplex.js');
+exports.Transform = require('./lib/_stream_transform.js');
+exports.PassThrough = require('./lib/_stream_passthrough.js');
--- /dev/null
+module.exports = require("./lib/_stream_transform.js")
--- /dev/null
+module.exports = require("./lib/_stream_writable.js")
--- /dev/null
+{
+ "name": "bl",
+ "version": "0.9.1",
+ "description": "Buffer List: collect buffers and access with a standard readable Buffer interface, streamable too!",
+ "main": "bl.js",
+ "scripts": {
+ "test": "node test/test.js | faucet",
+ "test-local": "brtapsauce-local test/basic-test.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/rvagg/bl.git"
+ },
+ "homepage": "https://github.com/rvagg/bl",
+ "authors": [
+ "Rod Vagg <rod@vagg.org> (https://github.com/rvagg)",
+ "Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)"
+ ],
+ "keywords": [
+ "buffer",
+ "buffers",
+ "stream",
+ "awesomesauce"
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "readable-stream": "~1.0.26"
+ },
+ "devDependencies": {
+ "tape": "~2.12.3",
+ "hash_file": "~0.1.1",
+ "faucet": "~0.0.1",
+ "brtapsauce": "~0.3.0"
+ },
+ "gitHead": "53d3d10e39be326feb049ab27437173b3ce47ec4",
+ "bugs": {
+ "url": "https://github.com/rvagg/bl/issues"
+ },
+ "_id": "bl@0.9.1",
+ "_shasum": "d262c5b83aa5cf4386cea1d998c82b36d7ae2942",
+ "_from": "bl@~0.9.0",
+ "_npmVersion": "1.4.21",
+ "_npmUser": {
+ "name": "rvagg",
+ "email": "rod@vagg.org"
+ },
+ "maintainers": [
+ {
+ "name": "rvagg",
+ "email": "rod@vagg.org"
+ }
+ ],
+ "dist": {
+ "shasum": "d262c5b83aa5cf4386cea1d998c82b36d7ae2942",
+ "tarball": "http://registry.npmjs.org/bl/-/bl-0.9.1.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/bl/-/bl-0.9.1.tgz",
+ "readme": "ERROR: No README data found!"
+}
--- /dev/null
+var tape = require('tape')
+ , crypto = require('crypto')
+ , fs = require('fs')
+ , hash = require('hash_file')
+ , BufferList = require('../')
+
+ , encodings =
+ ('hex utf8 utf-8 ascii binary base64'
+ + (process.browser ? '' : ' ucs2 ucs-2 utf16le utf-16le')).split(' ')
+
+tape('single bytes from single buffer', function (t) {
+ var bl = new BufferList()
+ bl.append(new Buffer('abcd'))
+
+ t.equal(bl.length, 4)
+
+ t.equal(bl.get(0), 97)
+ t.equal(bl.get(1), 98)
+ t.equal(bl.get(2), 99)
+ t.equal(bl.get(3), 100)
+
+ t.end()
+})
+
+tape('single bytes from multiple buffers', function (t) {
+ var bl = new BufferList()
+ bl.append(new Buffer('abcd'))
+ bl.append(new Buffer('efg'))
+ bl.append(new Buffer('hi'))
+ bl.append(new Buffer('j'))
+
+ t.equal(bl.length, 10)
+
+ t.equal(bl.get(0), 97)
+ t.equal(bl.get(1), 98)
+ t.equal(bl.get(2), 99)
+ t.equal(bl.get(3), 100)
+ t.equal(bl.get(4), 101)
+ t.equal(bl.get(5), 102)
+ t.equal(bl.get(6), 103)
+ t.equal(bl.get(7), 104)
+ t.equal(bl.get(8), 105)
+ t.equal(bl.get(9), 106)
+ t.end()
+})
+
+tape('multi bytes from single buffer', function (t) {
+ var bl = new BufferList()
+ bl.append(new Buffer('abcd'))
+
+ t.equal(bl.length, 4)
+
+ t.equal(bl.slice(0, 4).toString('ascii'), 'abcd')
+ t.equal(bl.slice(0, 3).toString('ascii'), 'abc')
+ t.equal(bl.slice(1, 4).toString('ascii'), 'bcd')
+
+ t.end()
+})
+
+tape('multiple bytes from multiple buffers', function (t) {
+ var bl = new BufferList()
+
+ bl.append(new Buffer('abcd'))
+ bl.append(new Buffer('efg'))
+ bl.append(new Buffer('hi'))
+ bl.append(new Buffer('j'))
+
+ t.equal(bl.length, 10)
+
+ t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
+ t.equal(bl.slice(3, 10).toString('ascii'), 'defghij')
+ t.equal(bl.slice(3, 6).toString('ascii'), 'def')
+ t.equal(bl.slice(3, 8).toString('ascii'), 'defgh')
+ t.equal(bl.slice(5, 10).toString('ascii'), 'fghij')
+
+ t.end()
+})
+
+tape('multiple bytes from multiple buffer lists', function (t) {
+ var bl = new BufferList()
+
+ bl.append(new BufferList([new Buffer('abcd'), new Buffer('efg')]))
+ bl.append(new BufferList([new Buffer('hi'), new Buffer('j')]))
+
+ t.equal(bl.length, 10)
+
+ t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
+ t.equal(bl.slice(3, 10).toString('ascii'), 'defghij')
+ t.equal(bl.slice(3, 6).toString('ascii'), 'def')
+ t.equal(bl.slice(3, 8).toString('ascii'), 'defgh')
+ t.equal(bl.slice(5, 10).toString('ascii'), 'fghij')
+
+ t.end()
+})
+
+tape('consuming from multiple buffers', function (t) {
+ var bl = new BufferList()
+
+ bl.append(new Buffer('abcd'))
+ bl.append(new Buffer('efg'))
+ bl.append(new Buffer('hi'))
+ bl.append(new Buffer('j'))
+
+ t.equal(bl.length, 10)
+
+ t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
+
+ bl.consume(3)
+ t.equal(bl.length, 7)
+ t.equal(bl.slice(0, 7).toString('ascii'), 'defghij')
+
+ bl.consume(2)
+ t.equal(bl.length, 5)
+ t.equal(bl.slice(0, 5).toString('ascii'), 'fghij')
+
+ bl.consume(1)
+ t.equal(bl.length, 4)
+ t.equal(bl.slice(0, 4).toString('ascii'), 'ghij')
+
+ bl.consume(1)
+ t.equal(bl.length, 3)
+ t.equal(bl.slice(0, 3).toString('ascii'), 'hij')
+
+ bl.consume(2)
+ t.equal(bl.length, 1)
+ t.equal(bl.slice(0, 1).toString('ascii'), 'j')
+
+ t.end()
+})
+
+tape('test readUInt8 / readInt8', function (t) {
+ var buf1 = new Buffer(1)
+ , buf2 = new Buffer(3)
+ , buf3 = new Buffer(3)
+ , bl = new BufferList()
+
+ buf2[1] = 0x3
+ buf2[2] = 0x4
+ buf3[0] = 0x23
+ buf3[1] = 0x42
+
+ bl.append(buf1)
+ bl.append(buf2)
+ bl.append(buf3)
+
+ t.equal(bl.readUInt8(2), 0x3)
+ t.equal(bl.readInt8(2), 0x3)
+ t.equal(bl.readUInt8(3), 0x4)
+ t.equal(bl.readInt8(3), 0x4)
+ t.equal(bl.readUInt8(4), 0x23)
+ t.equal(bl.readInt8(4), 0x23)
+ t.equal(bl.readUInt8(5), 0x42)
+ t.equal(bl.readInt8(5), 0x42)
+ t.end()
+})
+
+tape('test readUInt16LE / readUInt16BE / readInt16LE / readInt16BE', function (t) {
+ var buf1 = new Buffer(1)
+ , buf2 = new Buffer(3)
+ , buf3 = new Buffer(3)
+ , bl = new BufferList()
+
+ buf2[1] = 0x3
+ buf2[2] = 0x4
+ buf3[0] = 0x23
+ buf3[1] = 0x42
+
+ bl.append(buf1)
+ bl.append(buf2)
+ bl.append(buf3)
+
+ t.equal(bl.readUInt16BE(2), 0x0304)
+ t.equal(bl.readUInt16LE(2), 0x0403)
+ t.equal(bl.readInt16BE(2), 0x0304)
+ t.equal(bl.readInt16LE(2), 0x0403)
+ t.equal(bl.readUInt16BE(3), 0x0423)
+ t.equal(bl.readUInt16LE(3), 0x2304)
+ t.equal(bl.readInt16BE(3), 0x0423)
+ t.equal(bl.readInt16LE(3), 0x2304)
+ t.equal(bl.readUInt16BE(4), 0x2342)
+ t.equal(bl.readUInt16LE(4), 0x4223)
+ t.equal(bl.readInt16BE(4), 0x2342)
+ t.equal(bl.readInt16LE(4), 0x4223)
+ t.end()
+})
+
+tape('test readUInt32LE / readUInt32BE / readInt32LE / readInt32BE', function (t) {
+ var buf1 = new Buffer(1)
+ , buf2 = new Buffer(3)
+ , buf3 = new Buffer(3)
+ , bl = new BufferList()
+
+ buf2[1] = 0x3
+ buf2[2] = 0x4
+ buf3[0] = 0x23
+ buf3[1] = 0x42
+
+ bl.append(buf1)
+ bl.append(buf2)
+ bl.append(buf3)
+
+ t.equal(bl.readUInt32BE(2), 0x03042342)
+ t.equal(bl.readUInt32LE(2), 0x42230403)
+ t.equal(bl.readInt32BE(2), 0x03042342)
+ t.equal(bl.readInt32LE(2), 0x42230403)
+ t.end()
+})
+
+tape('test readFloatLE / readFloatBE', function (t) {
+ var buf1 = new Buffer(1)
+ , buf2 = new Buffer(3)
+ , buf3 = new Buffer(3)
+ , bl = new BufferList()
+
+ buf2[1] = 0x00
+ buf2[2] = 0x00
+ buf3[0] = 0x80
+ buf3[1] = 0x3f
+
+ bl.append(buf1)
+ bl.append(buf2)
+ bl.append(buf3)
+
+ t.equal(bl.readFloatLE(2), 0x01)
+ t.end()
+})
+
+tape('test readDoubleLE / readDoubleBE', function (t) {
+ var buf1 = new Buffer(1)
+ , buf2 = new Buffer(3)
+ , buf3 = new Buffer(10)
+ , bl = new BufferList()
+
+ buf2[1] = 0x55
+ buf2[2] = 0x55
+ buf3[0] = 0x55
+ buf3[1] = 0x55
+ buf3[2] = 0x55
+ buf3[3] = 0x55
+ buf3[4] = 0xd5
+ buf3[5] = 0x3f
+
+ bl.append(buf1)
+ bl.append(buf2)
+ bl.append(buf3)
+
+ t.equal(bl.readDoubleLE(2), 0.3333333333333333)
+ t.end()
+})
+
+tape('test toString', function (t) {
+ var bl = new BufferList()
+
+ bl.append(new Buffer('abcd'))
+ bl.append(new Buffer('efg'))
+ bl.append(new Buffer('hi'))
+ bl.append(new Buffer('j'))
+
+ t.equal(bl.toString('ascii', 0, 10), 'abcdefghij')
+ t.equal(bl.toString('ascii', 3, 10), 'defghij')
+ t.equal(bl.toString('ascii', 3, 6), 'def')
+ t.equal(bl.toString('ascii', 3, 8), 'defgh')
+ t.equal(bl.toString('ascii', 5, 10), 'fghij')
+
+ t.end()
+})
+
+tape('test toString encoding', function (t) {
+ var bl = new BufferList()
+ , b = new Buffer('abcdefghij\xff\x00')
+
+ bl.append(new Buffer('abcd'))
+ bl.append(new Buffer('efg'))
+ bl.append(new Buffer('hi'))
+ bl.append(new Buffer('j'))
+ bl.append(new Buffer('\xff\x00'))
+
+ encodings.forEach(function (enc) {
+ t.equal(bl.toString(enc), b.toString(enc), enc)
+ })
+
+ t.end()
+})
+
+!process.browser && tape('test stream', function (t) {
+ var random = crypto.randomBytes(65534)
+ , rndhash = hash(random, 'md5')
+ , md5sum = crypto.createHash('md5')
+ , bl = new BufferList(function (err, buf) {
+ t.ok(Buffer.isBuffer(buf))
+ t.ok(err === null)
+ t.equal(rndhash, hash(bl.slice(), 'md5'))
+ t.equal(rndhash, hash(buf, 'md5'))
+
+ bl.pipe(fs.createWriteStream('/tmp/bl_test_rnd_out.dat'))
+ .on('close', function () {
+ var s = fs.createReadStream('/tmp/bl_test_rnd_out.dat')
+ s.on('data', md5sum.update.bind(md5sum))
+ s.on('end', function() {
+ t.equal(rndhash, md5sum.digest('hex'), 'woohoo! correct hash!')
+ t.end()
+ })
+ })
+
+ })
+
+ fs.writeFileSync('/tmp/bl_test_rnd.dat', random)
+ fs.createReadStream('/tmp/bl_test_rnd.dat').pipe(bl)
+})
+
+tape('instantiation with Buffer', function (t) {
+ var buf = crypto.randomBytes(1024)
+ , buf2 = crypto.randomBytes(1024)
+ , b = BufferList(buf)
+
+ t.equal(buf.toString('hex'), b.slice().toString('hex'), 'same buffer')
+ b = BufferList([ buf, buf2 ])
+ t.equal(b.slice().toString('hex'), Buffer.concat([ buf, buf2 ]).toString('hex'), 'same buffer')
+ t.end()
+})
+
+tape('test String appendage', function (t) {
+ var bl = new BufferList()
+ , b = new Buffer('abcdefghij\xff\x00')
+
+ bl.append('abcd')
+ bl.append('efg')
+ bl.append('hi')
+ bl.append('j')
+ bl.append('\xff\x00')
+
+ encodings.forEach(function (enc) {
+ t.equal(bl.toString(enc), b.toString(enc))
+ })
+
+ t.end()
+})
+
+tape('write nothing, should get empty buffer', function (t) {
+ t.plan(3)
+ BufferList(function (err, data) {
+ t.notOk(err, 'no error')
+ t.ok(Buffer.isBuffer(data), 'got a buffer')
+ t.equal(0, data.length, 'got a zero-length buffer')
+ t.end()
+ }).end()
+})
+
+tape('unicode string', function (t) {
+ t.plan(2)
+ var inp1 = '\u2600'
+ , inp2 = '\u2603'
+ , exp = inp1 + ' and ' + inp2
+ , bl = BufferList()
+ bl.write(inp1)
+ bl.write(' and ')
+ bl.write(inp2)
+ t.equal(exp, bl.toString())
+ t.equal(new Buffer(exp).toString('hex'), bl.toString('hex'))
+})
+
+tape('should emit finish', function (t) {
+ var source = BufferList()
+ , dest = BufferList()
+
+ source.write('hello')
+ source.pipe(dest)
+
+ dest.on('finish', function () {
+ t.equal(dest.toString('utf8'), 'hello')
+ t.end()
+ })
+})
+
+tape('basic copy', function (t) {
+ var buf = crypto.randomBytes(1024)
+ , buf2 = new Buffer(1024)
+ , b = BufferList(buf)
+
+ b.copy(buf2)
+ t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer')
+ t.end()
+})
+
+tape('copy after many appends', function (t) {
+ var buf = crypto.randomBytes(512)
+ , buf2 = new Buffer(1024)
+ , b = BufferList(buf)
+
+ b.append(buf)
+ b.copy(buf2)
+ t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer')
+ t.end()
+})
+
+tape('copy at a precise position', function (t) {
+ var buf = crypto.randomBytes(1004)
+ , buf2 = new Buffer(1024)
+ , b = BufferList(buf)
+
+ b.copy(buf2, 20)
+ t.equal(b.slice().toString('hex'), buf2.slice(20).toString('hex'), 'same buffer')
+ t.end()
+})
+
+tape('copy starting from a precise location', function (t) {
+ var buf = crypto.randomBytes(10)
+ , buf2 = new Buffer(5)
+ , b = BufferList(buf)
+
+ b.copy(buf2, 0, 5)
+ t.equal(b.slice(5).toString('hex'), buf2.toString('hex'), 'same buffer')
+ t.end()
+})
+
+tape('copy in an interval', function (t) {
+ var rnd = crypto.randomBytes(10)
+ , b = BufferList(rnd) // put the random bytes there
+ , actual = new Buffer(3)
+ , expected = new Buffer(3)
+
+ rnd.copy(expected, 0, 5, 8)
+ b.copy(actual, 0, 5, 8)
+
+ t.equal(actual.toString('hex'), expected.toString('hex'), 'same buffer')
+ t.end()
+})
+
+tape('copy an interval between two buffers', function (t) {
+ var buf = crypto.randomBytes(10)
+ , buf2 = new Buffer(10)
+ , b = BufferList(buf)
+
+ b.append(buf)
+ b.copy(buf2, 0, 5, 15)
+
+ t.equal(b.slice(5, 15).toString('hex'), buf2.toString('hex'), 'same buffer')
+ t.end()
+})
+
+tape('duplicate', function (t) {
+ t.plan(2)
+
+ var bl = new BufferList('abcdefghij\xff\x00')
+ , dup = bl.duplicate()
+
+ t.equal(bl.prototype, dup.prototype)
+ t.equal(bl.toString('hex'), dup.toString('hex'))
+})
+
+tape('destroy no pipe', function (t) {
+ t.plan(2)
+
+ var bl = new BufferList('alsdkfja;lsdkfja;lsdk')
+ bl.destroy()
+
+ t.equal(bl._bufs.length, 0)
+ t.equal(bl.length, 0)
+})
+
+!process.browser && tape('destroy with pipe before read end', function (t) {
+ t.plan(2)
+
+ var bl = new BufferList()
+ fs.createReadStream(__dirname + '/sauce.js')
+ .pipe(bl)
+
+ bl.destroy()
+
+ t.equal(bl._bufs.length, 0)
+ t.equal(bl.length, 0)
+
+})
+
+!process.browser && tape('destroy with pipe before read end with race', function (t) {
+ t.plan(2)
+
+ var bl = new BufferList()
+ fs.createReadStream(__dirname + '/sauce.js')
+ .pipe(bl)
+
+ setTimeout(function () {
+ bl.destroy()
+ setTimeout(function () {
+ t.equal(bl._bufs.length, 0)
+ t.equal(bl.length, 0)
+ }, 500)
+ }, 500)
+})
+
+!process.browser && tape('destroy with pipe after read end', function (t) {
+ t.plan(2)
+
+ var bl = new BufferList()
+ fs.createReadStream(__dirname + '/sauce.js')
+ .on('end', onEnd)
+ .pipe(bl)
+
+ function onEnd () {
+ bl.destroy()
+
+ t.equal(bl._bufs.length, 0)
+ t.equal(bl.length, 0)
+ }
+})
+
+!process.browser && tape('destroy with pipe while writing to a destination', function (t) {
+ t.plan(4)
+
+ var bl = new BufferList()
+ , ds = new BufferList()
+
+ fs.createReadStream(__dirname + '/sauce.js')
+ .on('end', onEnd)
+ .pipe(bl)
+
+ function onEnd () {
+ bl.pipe(ds)
+
+ setTimeout(function () {
+ bl.destroy()
+
+ t.equals(bl._bufs.length, 0)
+ t.equals(bl.length, 0)
+
+ ds.destroy()
+
+ t.equals(bl._bufs.length, 0)
+ t.equals(bl.length, 0)
+
+ }, 100)
+ }
+})
+
+!process.browser && tape('handle error', function (t) {
+ t.plan(2)
+ fs.createReadStream('/does/not/exist').pipe(BufferList(function (err, data) {
+ t.ok(err instanceof Error, 'has error')
+ t.notOk(data, 'no data')
+ }))
+})
--- /dev/null
+#!/usr/bin/env node
+
+const user = process.env.SAUCE_USER
+ , key = process.env.SAUCE_KEY
+ , path = require('path')
+ , brtapsauce = require('brtapsauce')
+ , testFile = path.join(__dirname, 'basic-test.js')
+
+ , capabilities = [
+ { browserName: 'chrome' , platform: 'Windows XP', version: '' }
+ , { browserName: 'firefox' , platform: 'Windows 8' , version: '' }
+ , { browserName: 'firefox' , platform: 'Windows XP', version: '4' }
+ , { browserName: 'internet explorer' , platform: 'Windows 8' , version: '10' }
+ , { browserName: 'internet explorer' , platform: 'Windows 7' , version: '9' }
+ , { browserName: 'internet explorer' , platform: 'Windows 7' , version: '8' }
+ , { browserName: 'internet explorer' , platform: 'Windows XP', version: '7' }
+ , { browserName: 'internet explorer' , platform: 'Windows XP', version: '6' }
+ , { browserName: 'safari' , platform: 'Windows 7' , version: '5' }
+ , { browserName: 'safari' , platform: 'OS X 10.8' , version: '6' }
+ , { browserName: 'opera' , platform: 'Windows 7' , version: '' }
+ , { browserName: 'opera' , platform: 'Windows 7' , version: '11' }
+ , { browserName: 'ipad' , platform: 'OS X 10.8' , version: '6' }
+ , { browserName: 'android' , platform: 'Linux' , version: '4.0', 'device-type': 'tablet' }
+ ]
+
+if (!user)
+ throw new Error('Must set a SAUCE_USER env var')
+if (!key)
+ throw new Error('Must set a SAUCE_KEY env var')
+
+brtapsauce({
+ name : 'Traversty'
+ , user : user
+ , key : key
+ , brsrc : testFile
+ , capabilities : capabilities
+ , options : { timeout: 60 * 6 }
+})
\ No newline at end of file
--- /dev/null
+require('./basic-test')
+
+if (!process.env.SAUCE_KEY || !process.env.SAUCE_USER)
+ return console.log('SAUCE_KEY and/or SAUCE_USER not set, not running sauce tests')
+
+if (!/v0\.10/.test(process.version))
+ return console.log('Not Node v0.10.x, not running sauce tests')
+
+require('./sauce.js')
\ No newline at end of file
--- /dev/null
+## Caseless -- wrap an object to set and get property with caseless semantics but also preserve caseing.
+
+This library is incredibly useful when working with HTTP headers. It allows you to get/set/check for headers in a caseless manor while also preserving the caseing of headers the first time they are set.
+
+## Usage
+
+```javascript
+var headers = {}
+ , c = caseless(headers)
+ ;
+c.set('a-Header', 'asdf')
+c.get('a-header') === 'asdf'
+```
+
+## has(key)
+
+Has takes a name and if it finds a matching header will return that header name with the preserved caseing it was set with.
+
+```javascript
+c.has('a-header') === 'a-Header'
+```
+
+## set(key, value[, clobber=true])
+
+Set is fairly straight forward except that if the header exists and clobber is disabled it will add `','+value` to the existing header.
+
+```javascript
+c.set('a-Header', 'fdas')
+c.set('a-HEADER', 'more', false)
+c.get('a-header') === 'fdsa,more'
+```
+
+## swap(key)
+
+Swaps the casing of a header with the new one that is passed in.
+
+```javascript
+var headers = {}
+ , c = caseless(headers)
+ ;
+c.set('a-Header', 'fdas')
+c.swap('a-HEADER')
+c.has('a-header') === 'a-HEADER'
+headers === {'a-HEADER': 'fdas'}
+```
--- /dev/null
+function Caseless (dict) {
+ this.dict = dict
+}
+Caseless.prototype.set = function (name, value, clobber) {
+ if (typeof name === 'object') {
+ for (var i in name) {
+ this.set(i, name[i], value)
+ }
+ } else {
+ if (typeof clobber === 'undefined') clobber = true
+ var has = this.has(name)
+
+ if (!clobber && has) this.dict[has] = this.dict[has] + ',' + value
+ else this.dict[has || name] = value
+ return has
+ }
+}
+Caseless.prototype.has = function (name) {
+ var keys = Object.keys(this.dict)
+ , name = name.toLowerCase()
+ ;
+ for (var i=0;i<keys.length;i++) {
+ if (keys[i].toLowerCase() === name) return keys[i]
+ }
+ return false
+}
+Caseless.prototype.get = function (name) {
+ var result, re, match
+ var headers = this.dict
+ Object.keys(headers).forEach(function (key) {
+ re = new RegExp(name, 'i')
+ match = key.match(re)
+ if (match) result = headers[key]
+ })
+ return result
+}
+Caseless.prototype.swap = function (name) {
+ var has = this.has(name)
+ if (!has) throw new Error('There is no header than matches "'+name+'"')
+ this.dict[name] = this.dict[has]
+ delete this.dict[has]
+}
+Caseless.prototype.del = function (name) {
+ var has = this.has(name)
+ return delete this.dict[has || name]
+}
+
+module.exports = function (dict) {return new Caseless(dict)}
+module.exports.httpify = function (resp, headers) {
+ var c = new Caseless(headers)
+ resp.setHeader = function (key, value, clobber) {
+ return c.set(key, value, clobber)
+ }
+ resp.hasHeader = function (key) {
+ return c.has(key)
+ }
+ resp.getHeader = function (key) {
+ return c.get(key)
+ }
+ resp.removeHeader = function (key) {
+ return c.del(key)
+ }
+ resp.headers = c.dict
+ return c
+}
--- /dev/null
+{
+ "name": "caseless",
+ "version": "0.6.0",
+ "description": "Caseless object set/get/has, very useful when working with HTTP headers.",
+ "main": "index.js",
+ "scripts": {
+ "test": "node test.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/mikeal/caseless"
+ },
+ "keywords": [
+ "headers",
+ "http",
+ "caseless"
+ ],
+ "test": "node test.js",
+ "author": {
+ "name": "Mikeal Rogers",
+ "email": "mikeal.rogers@gmail.com"
+ },
+ "license": "BSD",
+ "bugs": {
+ "url": "https://github.com/mikeal/caseless/issues"
+ },
+ "devDependencies": {
+ "tape": "^2.10.2"
+ },
+ "homepage": "https://github.com/mikeal/caseless",
+ "_id": "caseless@0.6.0",
+ "_shasum": "8167c1ab8397fb5bb95f96d28e5a81c50f247ac4",
+ "_from": "caseless@~0.6.0",
+ "_npmVersion": "1.4.9",
+ "_npmUser": {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ },
+ "maintainers": [
+ {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ }
+ ],
+ "dist": {
+ "shasum": "8167c1ab8397fb5bb95f96d28e5a81c50f247ac4",
+ "tarball": "http://registry.npmjs.org/caseless/-/caseless-0.6.0.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/caseless/-/caseless-0.6.0.tgz",
+ "readme": "ERROR: No README data found!"
+}
--- /dev/null
+var tape = require('tape')
+ , caseless = require('./')
+ ;
+
+tape('set get has', function (t) {
+ var headers = {}
+ , c = caseless(headers)
+ ;
+ t.plan(14)
+ c.set('a-Header', 'asdf')
+ t.equal(c.get('a-header'), 'asdf')
+ t.equal(c.has('a-header'), 'a-Header')
+ t.ok(!c.has('nothing'))
+ // old bug where we used the wrong regex
+ t.ok(!c.has('a-hea'))
+ c.set('a-header', 'fdsa')
+ t.equal(c.get('a-header'), 'fdsa')
+ t.equal(c.get('a-Header'), 'fdsa')
+ c.set('a-HEADER', 'more', false)
+ t.equal(c.get('a-header'), 'fdsa,more')
+
+ t.deepEqual(headers, {'a-Header': 'fdsa,more'})
+ c.swap('a-HEADER')
+ t.deepEqual(headers, {'a-HEADER': 'fdsa,more'})
+
+ c.set('deleteme', 'foobar')
+ t.ok(c.has('deleteme'))
+ t.ok(c.del('deleteme'))
+ t.notOk(c.has('deleteme'))
+ t.notOk(c.has('idonotexist'))
+ t.ok(c.del('idonotexist'))
+
+})
self.freeSockets[name].push(socket)
// if an error happens while we don't use the socket anyway, meh, throw the socket away
- function onIdleError() {
+ var onIdleError = function() {
socket.destroy()
}
socket._onIdleError = onIdleError
},
"name": "forever-agent",
"description": "HTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module.",
- "version": "0.5.0",
+ "version": "0.5.2",
"repository": {
"url": "https://github.com/mikeal/forever-agent"
},
"engines": {
"node": "*"
},
- "readme": "forever-agent\n=============\n\nHTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module.\n",
- "readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/mikeal/forever-agent/issues"
},
"homepage": "https://github.com/mikeal/forever-agent",
- "_id": "forever-agent@0.5.0",
- "_from": "forever-agent@~0.5.0"
+ "_id": "forever-agent@0.5.2",
+ "dist": {
+ "shasum": "6d0e09c4921f94a27f63d3b49c5feff1ea4c5130",
+ "tarball": "http://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz"
+ },
+ "_from": "forever-agent@~0.5.0",
+ "_npmVersion": "1.3.21",
+ "_npmUser": {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ },
+ "maintainers": [
+ {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "6d0e09c4921f94a27f63d3b49c5feff1ea4c5130",
+ "_resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz",
+ "readme": "ERROR: No README data found!"
}
});
```
+In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`:
+
+``` javascript
+form.submit({
+ host: 'example.com',
+ path: '/surelynot.php',
+ headers: {'x-test-header': 'test-header-value'}
+}, function(err, res) {
+ console.log(res.statusCode);
+});
+```
+
## Notes
- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround.
this._lengthRetrievers.push(function(next) {
if (value.hasOwnProperty('fd')) {
- fs.stat(value.path, function(err, stat) {
- if (err) {
- next(err);
- return;
- }
- next(null, stat.size);
- });
+ // take read range into a account
+ // `end` = Infinity –> read file till the end
+ //
+ // TODO: Looks like there is bug in Node fs.createReadStream
+ // it doesn't respect `end` options without `start` options
+ // Fix it when node fixes it.
+ // https://github.com/joyent/node/issues/7819
+ if (value.end != undefined && value.end != Infinity && value.start != undefined) {
+
+ // when end specified
+ // no need to calculate range
+ // inclusive, starts with 0
+ next(null, value.end+1 - (value.start ? value.start : 0));
+
+ // not that fast snoopy
+ } else {
+ // still need to fetch file size from fs
+ fs.stat(value.path, function(err, stat) {
+
+ var fileSize;
+
+ if (err) {
+ next(err);
+ return;
+ }
+
+ // update final size based on the range options
+ fileSize = stat.size - (value.start ? value.start : 0);
+ next(null, fileSize);
+ });
+ }
// or http response
} else if (value.hasOwnProperty('httpVersion')) {
var request
, options
, defaults = {
- method : 'post',
- headers: this.getHeaders()
+ method : 'post'
};
// parse provided url if it's string
}
}
+ // put that good code in getHeaders to some use
+ options.headers = this.getHeaders(params.headers);
+
// https if specified, fallback to http in any other case
if (params.protocol == 'https:') {
request = https.request(options);
--- /dev/null
+language: node_js
+node_js:
+ - "0.10"
-Copyright (c) 2010 Caolan McMahon
+Copyright (c) 2010-2014 Caolan McMahon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
# Async.js
+[![Build Status via Travis CI](https://travis-ci.org/caolan/async.svg?branch=master)](https://travis-ci.org/caolan/async)
+
+
Async is a utility module which provides straight-forward, powerful functions
for working with asynchronous JavaScript. Although originally designed for
-use with [node.js](http://nodejs.org), it can also be used directly in the
+use with [Node.js](http://nodejs.org), it can also be used directly in the
browser. Also supports [component](https://github.com/component/component).
Async provides around 20 functions that include the usual 'functional'
-suspects (map, reduce, filter, each…) as well as some common patterns
-for asynchronous control flow (parallel, series, waterfall…). All these
-functions assume you follow the node.js convention of providing a single
-callback as the last argument of your async function.
+suspects (`map`, `reduce`, `filter`, `each`…) as well as some common patterns
+for asynchronous control flow (`parallel`, `series`, `waterfall`…). All these
+functions assume you follow the Node.js convention of providing a single
+callback as the last argument of your `async` function.
## Quick Examples
### Binding a context to an iterator
-This section is really about bind, not about async. If you are wondering how to
-make async execute your iterators in a given context, or are confused as to why
+This section is really about `bind`, not about `async`. If you are wondering how to
+make `async` execute your iterators in a given context, or are confused as to why
a method of another library isn't working as an iterator, study this example:
```js
The source is available for download from
[GitHub](http://github.com/caolan/async).
-Alternatively, you can install using Node Package Manager (npm):
+Alternatively, you can install using Node Package Manager (`npm`):
npm install async
## In the Browser
-So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage:
+So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5.
+
+Usage:
```html
<script type="text/javascript" src="async.js"></script>
### Collections
-* [each](#each)
-* [map](#map)
-* [filter](#filter)
-* [reject](#reject)
-* [reduce](#reduce)
-* [detect](#detect)
-* [sortBy](#sortBy)
-* [some](#some)
-* [every](#every)
-* [concat](#concat)
+* [`each`](#each)
+* [`eachSeries`](#eachSeries)
+* [`eachLimit`](#eachLimit)
+* [`map`](#map)
+* [`mapSeries`](#mapSeries)
+* [`mapLimit`](#mapLimit)
+* [`filter`](#filter)
+* [`filterSeries`](#filterSeries)
+* [`reject`](#reject)
+* [`rejectSeries`](#rejectSeries)
+* [`reduce`](#reduce)
+* [`reduceRight`](#reduceRight)
+* [`detect`](#detect)
+* [`detectSeries`](#detectSeries)
+* [`sortBy`](#sortBy)
+* [`some`](#some)
+* [`every`](#every)
+* [`concat`](#concat)
+* [`concatSeries`](#concatSeries)
### Control Flow
-* [series](#series)
-* [parallel](#parallel)
-* [whilst](#whilst)
-* [doWhilst](#doWhilst)
-* [until](#until)
-* [doUntil](#doUntil)
-* [forever](#forever)
-* [waterfall](#waterfall)
-* [compose](#compose)
-* [applyEach](#applyEach)
-* [queue](#queue)
-* [cargo](#cargo)
-* [auto](#auto)
-* [iterator](#iterator)
-* [apply](#apply)
-* [nextTick](#nextTick)
-* [times](#times)
-* [timesSeries](#timesSeries)
+* [`series`](#seriestasks-callback)
+* [`parallel`](#parallel)
+* [`parallelLimit`](#parallellimittasks-limit-callback)
+* [`whilst`](#whilst)
+* [`doWhilst`](#doWhilst)
+* [`until`](#until)
+* [`doUntil`](#doUntil)
+* [`forever`](#forever)
+* [`waterfall`](#waterfall)
+* [`compose`](#compose)
+* [`seq`](#seq)
+* [`applyEach`](#applyEach)
+* [`applyEachSeries`](#applyEachSeries)
+* [`queue`](#queue)
+* [`priorityQueue`](#priorityQueue)
+* [`cargo`](#cargo)
+* [`auto`](#auto)
+* [`retry`](#retry)
+* [`iterator`](#iterator)
+* [`apply`](#apply)
+* [`nextTick`](#nextTick)
+* [`times`](#times)
+* [`timesSeries`](#timesSeries)
### Utils
-* [memoize](#memoize)
-* [unmemoize](#unmemoize)
-* [log](#log)
-* [dir](#dir)
-* [noConflict](#noConflict)
+* [`memoize`](#memoize)
+* [`unmemoize`](#unmemoize)
+* [`log`](#log)
+* [`dir`](#dir)
+* [`noConflict`](#noConflict)
## Collections
<a name="each" />
### each(arr, iterator, callback)
-Applies an iterator function to each item in an array, in parallel.
-The iterator is called with an item from the list and a callback for when it
-has finished. If the iterator passes an error to this callback, the main
-callback for the each function is immediately called with the error.
+Applies the function `iterator` to each item in `arr`, in parallel.
+The `iterator` is called with an item from the list, and a callback for when it
+has finished. If the `iterator` passes an error to its `callback`, the main
+`callback` (for the `each` function) is immediately called with the error.
-Note, that since this function applies the iterator to each item in parallel
+Note, that since this function applies `iterator` to each item in parallel,
there is no guarantee that the iterator functions will complete in order.
__Arguments__
-* arr - An array to iterate over.
-* iterator(item, callback) - A function to apply to each item in the array.
- The iterator is passed a callback(err) which must be called once it has
- completed. If no error has occured, the callback should be run without
- arguments or with an explicit null argument.
-* callback(err) - A callback which is called after all the iterator functions
- have finished, or an error has occurred.
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+ The iterator is passed a `callback(err)` which must be called once it has
+ completed. If no error has occured, the `callback` should be run without
+ arguments or with an explicit `null` argument.
+* `callback(err)` - A callback which is called when all `iterator` functions
+ have finished, or an error occurs.
+
+__Examples__
-__Example__
```js
// assuming openFiles is an array of file names and saveFile is a function
});
```
+```js
+// assuming openFiles is an array of file names
+
+async.each(openFiles, function( file, callback) {
+
+ // Perform operation on file here.
+ console.log('Processing file ' + file);
+
+ if( file.length > 32 ) {
+ console.log('This file name is too long');
+ callback('File name too long');
+ } else {
+ // Do work to process file here
+ console.log('File processed');
+ callback();
+ }
+}, function(err){
+ // if any of the file processing produced an error, err would equal that error
+ if( err ) {
+ // One of the iterations produced an error.
+ // All processing will now stop.
+ console.log('A file failed to process');
+ } else {
+ console.log('All files have been processed successfully');
+ }
+});
+```
+
---------------------------------------
<a name="forEachSeries" />
<a name="eachSeries" />
### eachSeries(arr, iterator, callback)
-The same as each only the iterator is applied to each item in the array in
-series. The next iterator is only called once the current one has completed
-processing. This means the iterator functions will complete in order.
+The same as [`each`](#each), only `iterator` is applied to each item in `arr` in
+series. The next `iterator` is only called once the current one has completed.
+This means the `iterator` functions will complete in order.
---------------------------------------
<a name="eachLimit" />
### eachLimit(arr, limit, iterator, callback)
-The same as each only no more than "limit" iterators will be simultaneously
+The same as [`each`](#each), only no more than `limit` `iterator`s will be simultaneously
running at any time.
-Note that the items are not processed in batches, so there is no guarantee that
- the first "limit" iterator functions will complete before any others are
-started.
+Note that the items in `arr` are not processed in batches, so there is no guarantee that
+the first `limit` `iterator` functions will complete before any others are started.
__Arguments__
-* arr - An array to iterate over.
-* limit - The maximum number of iterators to run at any time.
-* iterator(item, callback) - A function to apply to each item in the array.
- The iterator is passed a callback(err) which must be called once it has
+* `arr` - An array to iterate over.
+* `limit` - The maximum number of `iterator`s to run at any time.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+ The iterator is passed a `callback(err)` which must be called once it has
completed. If no error has occured, the callback should be run without
- arguments or with an explicit null argument.
-* callback(err) - A callback which is called after all the iterator functions
- have finished, or an error has occurred.
+ arguments or with an explicit `null` argument.
+* `callback(err)` - A callback which is called when all `iterator` functions
+ have finished, or an error occurs.
__Example__
<a name="map" />
### map(arr, iterator, callback)
-Produces a new array of values by mapping each value in the given array through
-the iterator function. The iterator is called with an item from the array and a
-callback for when it has finished processing. The callback takes 2 arguments,
-an error and the transformed item from the array. If the iterator passes an
-error to this callback, the main callback for the map function is immediately
-called with the error.
+Produces a new array of values by mapping each value in `arr` through
+the `iterator` function. The `iterator` is called with an item from `arr` and a
+callback for when it has finished processing. Each of these callback takes 2 arguments:
+an `error`, and the transformed item from `arr`. If `iterator` passes an error to this
+callback, the main `callback` (for the `map` function) is immediately called with the error.
-Note, that since this function applies the iterator to each item in parallel
-there is no guarantee that the iterator functions will complete in order, however
-the results array will be in the same order as the original array.
+Note, that since this function applies the `iterator` to each item in parallel,
+there is no guarantee that the `iterator` functions will complete in order.
+However, the results array will be in the same order as the original `arr`.
__Arguments__
-* arr - An array to iterate over.
-* iterator(item, callback) - A function to apply to each item in the array.
- The iterator is passed a callback(err, transformed) which must be called once
- it has completed with an error (which can be null) and a transformed item.
-* callback(err, results) - A callback which is called after all the iterator
- functions have finished, or an error has occurred. Results is an array of the
- transformed items from the original array.
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+ The iterator is passed a `callback(err, transformed)` which must be called once
+ it has completed with an error (which can be `null`) and a transformed item.
+* `callback(err, results)` - A callback which is called when all `iterator`
+ functions have finished, or an error occurs. Results is an array of the
+ transformed items from the `arr`.
__Example__
<a name="mapSeries" />
### mapSeries(arr, iterator, callback)
-The same as map only the iterator is applied to each item in the array in
-series. The next iterator is only called once the current one has completed
-processing. The results array will be in the same order as the original.
+The same as [`map`](#map), only the `iterator` is applied to each item in `arr` in
+series. The next `iterator` is only called once the current one has completed.
+The results array will be in the same order as the original.
---------------------------------------
<a name="mapLimit" />
### mapLimit(arr, limit, iterator, callback)
-The same as map only no more than "limit" iterators will be simultaneously
+The same as [`map`](#map), only no more than `limit` `iterator`s will be simultaneously
running at any time.
-Note that the items are not processed in batches, so there is no guarantee that
- the first "limit" iterator functions will complete before any others are
-started.
+Note that the items are not processed in batches, so there is no guarantee that
+the first `limit` `iterator` functions will complete before any others are started.
__Arguments__
-* arr - An array to iterate over.
-* limit - The maximum number of iterators to run at any time.
-* iterator(item, callback) - A function to apply to each item in the array.
- The iterator is passed a callback(err, transformed) which must be called once
- it has completed with an error (which can be null) and a transformed item.
-* callback(err, results) - A callback which is called after all the iterator
- functions have finished, or an error has occurred. Results is an array of the
- transformed items from the original array.
+* `arr` - An array to iterate over.
+* `limit` - The maximum number of `iterator`s to run at any time.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+ The iterator is passed a `callback(err, transformed)` which must be called once
+ it has completed with an error (which can be `null`) and a transformed item.
+* `callback(err, results)` - A callback which is called when all `iterator`
+ calls have finished, or an error occurs. The result is an array of the
+ transformed items from the original `arr`.
__Example__
```js
-async.map(['file1','file2','file3'], 1, fs.stat, function(err, results){
+async.mapLimit(['file1','file2','file3'], 1, fs.stat, function(err, results){
// results is now an array of stats for each file
});
```
---------------------------------------
+<a name="select" />
<a name="filter" />
### filter(arr, iterator, callback)
-__Alias:__ select
+__Alias:__ `select`
-Returns a new array of all the values which pass an async truth test.
-_The callback for each iterator call only accepts a single argument of true or
-false, it does not accept an error argument first!_ This is in-line with the
-way node libraries work with truth tests like fs.exists. This operation is
+Returns a new array of all the values in `arr` which pass an async truth test.
+_The callback for each `iterator` call only accepts a single argument of `true` or
+`false`; it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like `fs.exists`. This operation is
performed in parallel, but the results array will be in the same order as the
original.
__Arguments__
-* arr - An array to iterate over.
-* iterator(item, callback) - A truth test to apply to each item in the array.
- The iterator is passed a callback(truthValue) which must be called with a
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A truth test to apply to each item in `arr`.
+ The `iterator` is passed a `callback(truthValue)`, which must be called with a
boolean argument once it has completed.
-* callback(results) - A callback which is called after all the iterator
+* `callback(results)` - A callback which is called after all the `iterator`
functions have finished.
__Example__
---------------------------------------
+<a name="selectSeries" />
<a name="filterSeries" />
### filterSeries(arr, iterator, callback)
-__alias:__ selectSeries
+__Alias:__ `selectSeries`
-The same as filter only the iterator is applied to each item in the array in
-series. The next iterator is only called once the current one has completed
-processing. The results array will be in the same order as the original.
+The same as [`filter`](#filter) only the `iterator` is applied to each item in `arr` in
+series. The next `iterator` is only called once the current one has completed.
+The results array will be in the same order as the original.
---------------------------------------
<a name="reject" />
### reject(arr, iterator, callback)
-The opposite of filter. Removes values that pass an async truth test.
+The opposite of [`filter`](#filter). Removes values that pass an `async` truth test.
---------------------------------------
<a name="rejectSeries" />
### rejectSeries(arr, iterator, callback)
-The same as reject, only the iterator is applied to each item in the array
+The same as [`reject`](#reject), only the `iterator` is applied to each item in `arr`
in series.
<a name="reduce" />
### reduce(arr, memo, iterator, callback)
-__aliases:__ inject, foldl
+__Aliases:__ `inject`, `foldl`
+
+Reduces `arr` into a single value using an async `iterator` to return
+each successive step. `memo` is the initial state of the reduction.
+This function only operates in series.
-Reduces a list of values into a single value using an async iterator to return
-each successive step. Memo is the initial state of the reduction. This
-function only operates in series. For performance reasons, it may make sense to
-split a call to this function into a parallel map, then use the normal
-Array.prototype.reduce on the results. This function is for situations where
-each step in the reduction needs to be async, if you can get the data before
-reducing it then it's probably a good idea to do so.
+For performance reasons, it may make sense to split a call to this function into
+a parallel map, and then use the normal `Array.prototype.reduce` on the results.
+This function is for situations where each step in the reduction needs to be async;
+if you can get the data before reducing it, then it's probably a good idea to do so.
__Arguments__
-* arr - An array to iterate over.
-* memo - The initial state of the reduction.
-* iterator(memo, item, callback) - A function applied to each item in the
- array to produce the next step in the reduction. The iterator is passed a
- callback(err, reduction) which accepts an optional error as its first
+* `arr` - An array to iterate over.
+* `memo` - The initial state of the reduction.
+* `iterator(memo, item, callback)` - A function applied to each item in the
+ array to produce the next step in the reduction. The `iterator` is passed a
+ `callback(err, reduction)` which accepts an optional error as its first
argument, and the state of the reduction as the second. If an error is
- passed to the callback, the reduction is stopped and the main callback is
+ passed to the callback, the reduction is stopped and the main `callback` is
immediately called with the error.
-* callback(err, result) - A callback which is called after all the iterator
+* `callback(err, result)` - A callback which is called after all the `iterator`
functions have finished. Result is the reduced value.
__Example__
<a name="reduceRight" />
### reduceRight(arr, memo, iterator, callback)
-__Alias:__ foldr
+__Alias:__ `foldr`
-Same as reduce, only operates on the items in the array in reverse order.
+Same as [`reduce`](#reduce), only operates on `arr` in reverse order.
---------------------------------------
<a name="detect" />
### detect(arr, iterator, callback)
-Returns the first value in a list that passes an async truth test. The
-iterator is applied in parallel, meaning the first iterator to return true will
-fire the detect callback with that result. That means the result might not be
-the first item in the original array (in terms of order) that passes the test.
+Returns the first value in `arr` that passes an async truth test. The
+`iterator` is applied in parallel, meaning the first iterator to return `true` will
+fire the detect `callback` with that result. That means the result might not be
+the first item in the original `arr` (in terms of order) that passes the test.
-If order within the original array is important then look at detectSeries.
+If order within the original `arr` is important, then look at [`detectSeries`](#detectSeries).
__Arguments__
-* arr - An array to iterate over.
-* iterator(item, callback) - A truth test to apply to each item in the array.
- The iterator is passed a callback(truthValue) which must be called with a
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A truth test to apply to each item in `arr`.
+ The iterator is passed a `callback(truthValue)` which must be called with a
boolean argument once it has completed.
-* callback(result) - A callback which is called as soon as any iterator returns
- true, or after all the iterator functions have finished. Result will be
+* `callback(result)` - A callback which is called as soon as any iterator returns
+ `true`, or after all the `iterator` functions have finished. Result will be
the first item in the array that passes the truth test (iterator) or the
- value undefined if none passed.
+ value `undefined` if none passed.
__Example__
<a name="detectSeries" />
### detectSeries(arr, iterator, callback)
-The same as detect, only the iterator is applied to each item in the array
-in series. This means the result is always the first in the original array (in
+The same as [`detect`](#detect), only the `iterator` is applied to each item in `arr`
+in series. This means the result is always the first in the original `arr` (in
terms of array order) that passes the truth test.
<a name="sortBy" />
### sortBy(arr, iterator, callback)
-Sorts a list by the results of running each value through an async iterator.
+Sorts a list by the results of running each `arr` value through an async `iterator`.
__Arguments__
-* arr - An array to iterate over.
-* iterator(item, callback) - A function to apply to each item in the array.
- The iterator is passed a callback(err, sortValue) which must be called once it
- has completed with an error (which can be null) and a value to use as the sort
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+ The iterator is passed a `callback(err, sortValue)` which must be called once it
+ has completed with an error (which can be `null`) and a value to use as the sort
criteria.
-* callback(err, results) - A callback which is called after all the iterator
- functions have finished, or an error has occurred. Results is the items from
- the original array sorted by the values returned by the iterator calls.
+* `callback(err, results)` - A callback which is called after all the `iterator`
+ functions have finished, or an error occurs. Results is the items from
+ the original `arr` sorted by the values returned by the `iterator` calls.
__Example__
});
```
+__Sort Order__
+
+By modifying the callback parameter the sorting order can be influenced:
+
+```js
+//ascending order
+async.sortBy([1,9,3,5], function(x, callback){
+ callback(err, x);
+}, function(err,result){
+ //result callback
+} );
+
+//descending order
+async.sortBy([1,9,3,5], function(x, callback){
+ callback(err, x*-1); //<- x*-1 instead of x, turns the order around
+}, function(err,result){
+ //result callback
+} );
+```
+
---------------------------------------
<a name="some" />
### some(arr, iterator, callback)
-__Alias:__ any
+__Alias:__ `any`
-Returns true if at least one element in the array satisfies an async test.
-_The callback for each iterator call only accepts a single argument of true or
-false, it does not accept an error argument first!_ This is in-line with the
-way node libraries work with truth tests like fs.exists. Once any iterator
-call returns true, the main callback is immediately called.
+Returns `true` if at least one element in the `arr` satisfies an async test.
+_The callback for each iterator call only accepts a single argument of `true` or
+`false`; it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like `fs.exists`. Once any iterator
+call returns `true`, the main `callback` is immediately called.
__Arguments__
-* arr - An array to iterate over.
-* iterator(item, callback) - A truth test to apply to each item in the array.
- The iterator is passed a callback(truthValue) which must be called with a
- boolean argument once it has completed.
-* callback(result) - A callback which is called as soon as any iterator returns
- true, or after all the iterator functions have finished. Result will be
- either true or false depending on the values of the async tests.
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A truth test to apply to each item in the array
+ in parallel. The iterator is passed a callback(truthValue) which must be
+ called with a boolean argument once it has completed.
+* `callback(result)` - A callback which is called as soon as any iterator returns
+ `true`, or after all the iterator functions have finished. Result will be
+ either `true` or `false` depending on the values of the async tests.
__Example__
<a name="every" />
### every(arr, iterator, callback)
-__Alias:__ all
+__Alias:__ `all`
-Returns true if every element in the array satisfies an async test.
-_The callback for each iterator call only accepts a single argument of true or
-false, it does not accept an error argument first!_ This is in-line with the
-way node libraries work with truth tests like fs.exists.
+Returns `true` if every element in `arr` satisfies an async test.
+_The callback for each `iterator` call only accepts a single argument of `true` or
+`false`; it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like `fs.exists`.
__Arguments__
-* arr - An array to iterate over.
-* iterator(item, callback) - A truth test to apply to each item in the array.
- The iterator is passed a callback(truthValue) which must be called with a
- boolean argument once it has completed.
-* callback(result) - A callback which is called after all the iterator
- functions have finished. Result will be either true or false depending on
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A truth test to apply to each item in the array
+ in parallel. The iterator is passed a callback(truthValue) which must be
+ called with a boolean argument once it has completed.
+* `callback(result)` - A callback which is called after all the `iterator`
+ functions have finished. Result will be either `true` or `false` depending on
the values of the async tests.
__Example__
<a name="concat" />
### concat(arr, iterator, callback)
-Applies an iterator to each item in a list, concatenating the results. Returns the
-concatenated list. The iterators are called in parallel, and the results are
+Applies `iterator` to each item in `arr`, concatenating the results. Returns the
+concatenated list. The `iterator`s are called in parallel, and the results are
concatenated as they return. There is no guarantee that the results array will
-be returned in the original order of the arguments passed to the iterator function.
+be returned in the original order of `arr` passed to the `iterator` function.
__Arguments__
-* arr - An array to iterate over
-* iterator(item, callback) - A function to apply to each item in the array.
- The iterator is passed a callback(err, results) which must be called once it
- has completed with an error (which can be null) and an array of results.
-* callback(err, results) - A callback which is called after all the iterator
- functions have finished, or an error has occurred. Results is an array containing
- the concatenated results of the iterator function.
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+ The iterator is passed a `callback(err, results)` which must be called once it
+ has completed with an error (which can be `null`) and an array of results.
+* `callback(err, results)` - A callback which is called after all the `iterator`
+ functions have finished, or an error occurs. Results is an array containing
+ the concatenated results of the `iterator` function.
__Example__
<a name="concatSeries" />
### concatSeries(arr, iterator, callback)
-Same as async.concat, but executes in series instead of parallel.
+Same as [`concat`](#concat), but executes in series instead of parallel.
## Control Flow
<a name="series" />
### series(tasks, [callback])
-Run an array of functions in series, each one running once the previous
+Run the functions in the `tasks` array in series, each one running once the previous
function has completed. If any functions in the series pass an error to its
-callback, no more functions are run and the callback for the series is
-immediately called with the value of the error. Once the tasks have completed,
-the results are passed to the final callback as an array.
+callback, no more functions are run, and `callback` is immediately called with the value of the error.
+Otherwise, `callback` receives an array of results when `tasks` have completed.
It is also possible to use an object instead of an array. Each property will be
-run as a function and the results will be passed to the final callback as an object
+run as a function, and the results will be passed to the final `callback` as an object
instead of an array. This can be a more readable way of handling results from
-async.series.
+[`series`](#series).
+
+**Note** that while many implementations preserve the order of object properties, the
+[ECMAScript Language Specifcation](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6)
+explicitly states that
+
+> The mechanics and order of enumerating the properties is not specified.
+So if you rely on the order in which your series of functions are executed, and want
+this to work on all platforms, consider using an array.
__Arguments__
-* tasks - An array or object containing functions to run, each function is passed
- a callback(err, result) it must call on completion with an error (which can
- be null) and an optional result value.
-* callback(err, results) - An optional callback to run once all the functions
+* `tasks` - An array or object containing functions to run, each function is passed
+ a `callback(err, result)` it must call on completion with an error `err` (which can
+ be `null`) and an optional `result` value.
+* `callback(err, results)` - An optional callback to run once all the functions
have completed. This function gets a results array (or object) containing all
- the result arguments passed to the task callbacks.
+ the result arguments passed to the `task` callbacks.
__Example__
<a name="parallel" />
### parallel(tasks, [callback])
-Run an array of functions in parallel, without waiting until the previous
+Run the `tasks` array of functions in parallel, without waiting until the previous
function has completed. If any of the functions pass an error to its
-callback, the main callback is immediately called with the value of the error.
-Once the tasks have completed, the results are passed to the final callback as an
+callback, the main `callback` is immediately called with the value of the error.
+Once the `tasks` have completed, the results are passed to the final `callback` as an
array.
It is also possible to use an object instead of an array. Each property will be
-run as a function and the results will be passed to the final callback as an object
+run as a function and the results will be passed to the final `callback` as an object
instead of an array. This can be a more readable way of handling results from
-async.parallel.
+[`parallel`](#parallel).
__Arguments__
-* tasks - An array or object containing functions to run, each function is passed
- a callback(err, result) it must call on completion with an error (which can
- be null) and an optional result value.
-* callback(err, results) - An optional callback to run once all the functions
+* `tasks` - An array or object containing functions to run. Each function is passed
+ a `callback(err, result)` which it must call on completion with an error `err`
+ (which can be `null`) and an optional `result` value.
+* `callback(err, results)` - An optional callback to run once all the functions
have completed. This function gets a results array (or object) containing all
the result arguments passed to the task callbacks.
---------------------------------------
-<a name="parallel" />
+<a name="parallelLimit" />
### parallelLimit(tasks, limit, [callback])
-The same as parallel only the tasks are executed in parallel with a maximum of "limit"
-tasks executing at any time.
+The same as [`parallel`](#parallel), only `tasks` are executed in parallel
+with a maximum of `limit` tasks executing at any time.
-Note that the tasks are not executed in batches, so there is no guarantee that
-the first "limit" tasks will complete before any others are started.
+Note that the `tasks` are not executed in batches, so there is no guarantee that
+the first `limit` tasks will complete before any others are started.
__Arguments__
-* tasks - An array or object containing functions to run, each function is passed
- a callback(err, result) it must call on completion with an error (which can
- be null) and an optional result value.
-* limit - The maximum number of tasks to run at any time.
-* callback(err, results) - An optional callback to run once all the functions
+* `tasks` - An array or object containing functions to run, each function is passed
+ a `callback(err, result)` it must call on completion with an error `err` (which can
+ be `null`) and an optional `result` value.
+* `limit` - The maximum number of `tasks` to run at any time.
+* `callback(err, results)` - An optional callback to run once all the functions
have completed. This function gets a results array (or object) containing all
- the result arguments passed to the task callbacks.
+ the result arguments passed to the `task` callbacks.
---------------------------------------
<a name="whilst" />
### whilst(test, fn, callback)
-Repeatedly call fn, while test returns true. Calls the callback when stopped,
+Repeatedly call `fn`, while `test` returns `true`. Calls `callback` when stopped,
or an error occurs.
__Arguments__
-* test() - synchronous truth test to perform before each execution of fn.
-* fn(callback) - A function to call each time the test passes. The function is
- passed a callback(err) which must be called once it has completed with an
- optional error argument.
-* callback(err) - A callback which is called after the test fails and repeated
- execution of fn has stopped.
+* `test()` - synchronous truth test to perform before each execution of `fn`.
+* `fn(callback)` - A function which is called each time `test` passes. The function is
+ passed a `callback(err)`, which must be called once it has completed with an
+ optional `err` argument.
+* `callback(err)` - A callback which is called after the test fails and repeated
+ execution of `fn` has stopped.
__Example__
<a name="doWhilst" />
### doWhilst(fn, test, callback)
-The post check version of whilst. To reflect the difference in the order of operations `test` and `fn` arguments are switched. `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
+The post-check version of [`whilst`](#whilst). To reflect the difference in
+the order of operations, the arguments `test` and `fn` are switched.
+
+`doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
---------------------------------------
<a name="until" />
### until(test, fn, callback)
-Repeatedly call fn, until test returns true. Calls the callback when stopped,
+Repeatedly call `fn` until `test` returns `true`. Calls `callback` when stopped,
or an error occurs.
-The inverse of async.whilst.
+The inverse of [`whilst`](#whilst).
---------------------------------------
<a name="doUntil" />
### doUntil(fn, test, callback)
-Like doWhilst except the test is inverted. Note the argument ordering differs from `until`.
+Like [`doWhilst`](#doWhilst), except the `test` is inverted. Note the argument ordering differs from `until`.
---------------------------------------
<a name="forever" />
-### forever(fn, callback)
+### forever(fn, errback)
+
+Calls the asynchronous function `fn` with a callback parameter that allows it to
+call itself again, in series, indefinitely.
-Calls the asynchronous function 'fn' repeatedly, in series, indefinitely.
-If an error is passed to fn's callback then 'callback' is called with the
-error, otherwise it will never be called.
+If an error is passed to the callback then `errback` is called with the
+error, and execution stops, otherwise it will never be called.
+
+```js
+async.forever(
+ function(next) {
+ // next is suitable for passing to things that need a callback(err [, whatever]);
+ // it will result in this function being called again.
+ },
+ function(err) {
+ // if next is called with a value in its first parameter, it will appear
+ // in here as 'err', and execution will stop.
+ }
+);
+```
---------------------------------------
<a name="waterfall" />
### waterfall(tasks, [callback])
-Runs an array of functions in series, each passing their results to the next in
-the array. However, if any of the functions pass an error to the callback, the
-next function is not executed and the main callback is immediately called with
+Runs the `tasks` array of functions in series, each passing their results to the next in
+the array. However, if any of the `tasks` pass an error to their own callback, the
+next function is not executed, and the main `callback` is immediately called with
the error.
__Arguments__
-* tasks - An array of functions to run, each function is passed a
- callback(err, result1, result2, ...) it must call on completion. The first
- argument is an error (which can be null) and any further arguments will be
+* `tasks` - An array of functions to run, each function is passed a
+ `callback(err, result1, result2, ...)` it must call on completion. The first
+ argument is an error (which can be `null`) and any further arguments will be
passed as arguments in order to the next task.
-* callback(err, [results]) - An optional callback to run once all the functions
+* `callback(err, [results])` - An optional callback to run once all the functions
have completed. This will be passed the results of the last task's callback.
callback(null, 'one', 'two');
},
function(arg1, arg2, callback){
+ // arg1 now equals 'one' and arg2 now equals 'two'
callback(null, 'three');
},
function(arg1, callback){
Creates a function which is a composition of the passed asynchronous
functions. Each function consumes the return value of the function that
-follows. Composing functions f(), g() and h() would produce the result of
-f(g(h())), only this version uses callbacks to obtain the return values.
+follows. Composing functions `f()`, `g()`, and `h()` would produce the result of
+`f(g(h()))`, only this version uses callbacks to obtain the return values.
Each function is executed with the `this` binding of the composed function.
__Arguments__
-* functions... - the asynchronous functions to compose
+* `functions...` - the asynchronous functions to compose
__Example__
```
---------------------------------------
+<a name="seq" />
+### seq(fn1, fn2...)
+
+Version of the compose function that is more natural to read.
+Each following function consumes the return value of the latter function.
+
+Each function is executed with the `this` binding of the composed function.
+
+__Arguments__
+
+* functions... - the asynchronous functions to compose
+
+
+__Example__
+
+```js
+// Requires lodash (or underscore), express3 and dresende's orm2.
+// Part of an app, that fetches cats of the logged user.
+// This example uses `seq` function to avoid overnesting and error
+// handling clutter.
+app.get('/cats', function(request, response) {
+ function handleError(err, data, callback) {
+ if (err) {
+ console.error(err);
+ response.json({ status: 'error', message: err.message });
+ }
+ else {
+ callback(data);
+ }
+ }
+ var User = request.models.User;
+ async.seq(
+ _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data))
+ handleError,
+ function(user, fn) {
+ user.getCats(fn); // 'getCats' has signature (callback(err, data))
+ },
+ handleError,
+ function(cats) {
+ response.json({ status: 'ok', message: 'Cats found', data: cats });
+ }
+ )(req.session.user_id);
+ }
+});
+```
+
+---------------------------------------
<a name="applyEach" />
### applyEach(fns, args..., callback)
-Applies the provided arguments to each function in the array, calling the
-callback after all functions have completed. If you only provide the first
-argument then it will return a function which lets you pass in the
+Applies the provided arguments to each function in the array, calling
+`callback` after all functions have completed. If you only provide the first
+argument, then it will return a function which lets you pass in the
arguments as if it were a single function call.
__Arguments__
-* fns - the asynchronous functions to all call with the same arguments
-* args... - any number of separate arguments to pass to the function
-* callback - the final argument should be the callback, called when all
+* `fns` - the asynchronous functions to all call with the same arguments
+* `args...` - any number of separate arguments to pass to the function
+* `callback` - the final argument should be the callback, called when all
functions have completed processing
<a name="applyEachSeries" />
### applyEachSeries(arr, iterator, callback)
-The same as applyEach only the functions are applied in series.
+The same as [`applyEach`](#applyEach) only the functions are applied in series.
---------------------------------------
<a name="queue" />
### queue(worker, concurrency)
-Creates a queue object with the specified concurrency. Tasks added to the
-queue will be processed in parallel (up to the concurrency limit). If all
-workers are in progress, the task is queued until one is available. Once
-a worker has completed a task, the task's callback is called.
+Creates a `queue` object with the specified `concurrency`. Tasks added to the
+`queue` are processed in parallel (up to the `concurrency` limit). If all
+`worker`s are in progress, the task is queued until one becomes available.
+Once a `worker` completes a `task`, that `task`'s callback is called.
__Arguments__
-* worker(task, callback) - An asynchronous function for processing a queued
- task, which must call its callback(err) argument when finished, with an
- optional error as an argument.
-* concurrency - An integer for determining how many worker functions should be
+* `worker(task, callback)` - An asynchronous function for processing a queued
+ task, which must call its `callback(err)` argument when finished, with an
+ optional `error` as an argument.
+* `concurrency` - An `integer` for determining how many `worker` functions should be
run in parallel.
__Queue objects__
-The queue object returned by this function has the following properties and
+The `queue` object returned by this function has the following properties and
methods:
-* length() - a function returning the number of items waiting to be processed.
-* concurrency - an integer for determining how many worker functions should be
- run in parallel. This property can be changed after a queue is created to
+* `length()` - a function returning the number of items waiting to be processed.
+* `started` - a function returning whether or not any items have been pushed and processed by the queue
+* `running()` - a function returning the number of items currently being processed.
+* `idle()` - a function returning false if there are items waiting or being processed, or true if not.
+* `concurrency` - an integer for determining how many `worker` functions should be
+ run in parallel. This property can be changed after a `queue` is created to
alter the concurrency on-the-fly.
-* push(task, [callback]) - add a new task to the queue, the callback is called
- once the worker has finished processing the task.
- instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.
-* unshift(task, [callback]) - add a new task to the front of the queue.
-* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued
-* empty - a callback that is called when the last item from the queue is given to a worker
-* drain - a callback that is called when the last item from the queue has returned from the worker
+* `push(task, [callback])` - add a new task to the `queue`. Calls `callback` once
+ the `worker` has finished processing the task. Instead of a single task, a `tasks` array
+ can be submitted. The respective callback is used for every task in the list.
+* `unshift(task, [callback])` - add a new task to the front of the `queue`.
+* `saturated` - a callback that is called when the `queue` length hits the `concurrency` limit,
+ and further tasks will be queued.
+* `empty` - a callback that is called when the last item from the `queue` is given to a `worker`.
+* `drain` - a callback that is called when the last item from the `queue` has returned from the `worker`.
+* `paused` - a boolean for determining whether the queue is in a paused state
+* `pause()` - a function that pauses the processing of tasks until `resume()` is called.
+* `resume()` - a function that resumes the processing of queued tasks when the queue is paused.
+* `kill()` - a function that empties remaining tasks from the queue forcing it to go idle.
__Example__
});
```
+
+---------------------------------------
+
+<a name="priorityQueue" />
+### priorityQueue(worker, concurrency)
+
+The same as [`queue`](#queue) only tasks are assigned a priority and completed in ascending priority order. There are two differences between `queue` and `priorityQueue` objects:
+
+* `push(task, priority, [callback])` - `priority` should be a number. If an array of
+ `tasks` is given, all tasks will be assigned the same priority.
+* The `unshift` method was removed.
+
---------------------------------------
<a name="cargo" />
### cargo(worker, [payload])
-Creates a cargo object with the specified payload. Tasks added to the
-cargo will be processed altogether (up to the payload limit). If the
-worker is in progress, the task is queued until it is available. Once
-the worker has completed some tasks, each callback of those tasks is called.
+Creates a `cargo` object with the specified payload. Tasks added to the
+cargo will be processed altogether (up to the `payload` limit). If the
+`worker` is in progress, the task is queued until it becomes available. Once
+the `worker` has completed some tasks, each callback of those tasks is called.
+Check out [this animation](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) for how `cargo` and `queue` work.
+
+While [queue](#queue) passes only one task to one of a group of workers
+at a time, cargo passes an array of tasks to a single worker, repeating
+when the worker is finished.
__Arguments__
-* worker(tasks, callback) - An asynchronous function for processing an array of
- queued tasks, which must call its callback(err) argument when finished, with
- an optional error as an argument.
-* payload - An optional integer for determining how many tasks should be
+* `worker(tasks, callback)` - An asynchronous function for processing an array of
+ queued tasks, which must call its `callback(err)` argument when finished, with
+ an optional `err` argument.
+* `payload` - An optional `integer` for determining how many tasks should be
processed per round; if omitted, the default is unlimited.
__Cargo objects__
-The cargo object returned by this function has the following properties and
+The `cargo` object returned by this function has the following properties and
methods:
-* length() - a function returning the number of items waiting to be processed.
-* payload - an integer for determining how many tasks should be
- process per round. This property can be changed after a cargo is created to
+* `length()` - A function returning the number of items waiting to be processed.
+* `payload` - An `integer` for determining how many tasks should be
+ process per round. This property can be changed after a `cargo` is created to
alter the payload on-the-fly.
-* push(task, [callback]) - add a new task to the queue, the callback is called
- once the worker has finished processing the task.
- instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.
-* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued
-* empty - a callback that is called when the last item from the queue is given to a worker
-* drain - a callback that is called when the last item from the queue has returned from the worker
+* `push(task, [callback])` - Adds `task` to the `queue`. The callback is called
+ once the `worker` has finished processing the task. Instead of a single task, an array of `tasks`
+ can be submitted. The respective callback is used for every task in the list.
+* `saturated` - A callback that is called when the `queue.length()` hits the concurrency and further tasks will be queued.
+* `empty` - A callback that is called when the last item from the `queue` is given to a `worker`.
+* `drain` - A callback that is called when the last item from the `queue` has returned from the `worker`.
__Example__
<a name="auto" />
### auto(tasks, [callback])
-Determines the best order for running functions based on their requirements.
-Each function can optionally depend on other functions being completed first,
-and each function is run as soon as its requirements are satisfied. If any of
-the functions pass an error to their callback, that function will not complete
-(so any other functions depending on it will not run) and the main callback
-will be called immediately with the error. Functions also receive an object
-containing the results of functions which have completed so far.
+Determines the best order for running the functions in `tasks`, based on their
+requirements. Each function can optionally depend on other functions being completed
+first, and each function is run as soon as its requirements are satisfied.
+
+If any of the functions pass an error to their callback, it will not
+complete (so any other functions depending on it will not run), and the main
+`callback` is immediately called with the error. Functions also receive an
+object containing the results of functions which have completed so far.
+
+Note, all functions are called with a `results` object as a second argument,
+so it is unsafe to pass functions in the `tasks` object which cannot handle the
+extra argument.
-Note, all functions are called with a results object as a second argument,
-so it is unsafe to pass functions in the tasks object which cannot handle the
-extra argument. For example, this snippet of code:
+For example, this snippet of code:
```js
async.auto({
- readData: async.apply(fs.readFile, 'data.txt', 'utf-8');
+ readData: async.apply(fs.readFile, 'data.txt', 'utf-8')
}, callback);
```
-will have the effect of calling readFile with the results object as the last
+will have the effect of calling `readFile` with the results object as the last
argument, which will fail:
```js
fs.readFile('data.txt', 'utf-8', cb, {});
```
-Instead, wrap the call to readFile in a function which does not forward the
-results object:
+Instead, wrap the call to `readFile` in a function which does not forward the
+`results` object:
```js
async.auto({
__Arguments__
-* tasks - An object literal containing named functions or an array of
- requirements, with the function itself the last item in the array. The key
- used for each function or array is used when specifying requirements. The
- function receives two arguments: (1) a callback(err, result) which must be
- called when finished, passing an error (which can be null) and the result of
- the function's execution, and (2) a results object, containing the results of
+* `tasks` - An object. Each of its properties is either a function or an array of
+ requirements, with the function itself the last item in the array. The object's key
+ of a property serves as the name of the task defined by that property,
+ i.e. can be used when specifying requirements for other tasks.
+ The function receives two arguments: (1) a `callback(err, result)` which must be
+ called when finished, passing an `error` (which can be `null`) and the result of
+ the function's execution, and (2) a `results` object, containing the results of
the previously executed functions.
-* callback(err, results) - An optional callback which is called when all the
- tasks have been completed. The callback will receive an error as an argument
- if any tasks pass an error to their callback. Results will always be passed
- but if an error occurred, no other tasks will be performed, and the results
- object will only contain partial results.
-
+* `callback(err, results)` - An optional callback which is called when all the
+ tasks have been completed. It receives the `err` argument if any `tasks`
+ pass an error to their callback. Results are always returned; however, if
+ an error occurs, no further `tasks` will be performed, and the results
+ object will only contain partial results.
+
__Example__
```js
async.auto({
get_data: function(callback){
+ console.log('in get_data');
// async code to get some data
+ callback(null, 'data', 'converted to array');
},
make_folder: function(callback){
+ console.log('in make_folder');
// async code to create a directory to store a file in
// this is run at the same time as getting the data
+ callback(null, 'folder');
},
- write_file: ['get_data', 'make_folder', function(callback){
+ write_file: ['get_data', 'make_folder', function(callback, results){
+ console.log('in write_file', JSON.stringify(results));
// once there is some data and the directory exists,
// write the data to a file in the directory
- callback(null, filename);
+ callback(null, 'filename');
}],
email_link: ['write_file', function(callback, results){
+ console.log('in email_link', JSON.stringify(results));
// once the file is written let's email a link to it...
// results.write_file contains the filename returned by write_file.
+ callback(null, {'file':results.write_file, 'email':'user@example.com'});
}]
+}, function(err, results) {
+ console.log('err = ', err);
+ console.log('results = ', results);
});
```
```js
async.parallel([
function(callback){
+ console.log('in get_data');
// async code to get some data
+ callback(null, 'data', 'converted to array');
},
function(callback){
+ console.log('in make_folder');
// async code to create a directory to store a file in
// this is run at the same time as getting the data
+ callback(null, 'folder');
}
],
function(err, results){
async.series([
function(callback){
+ console.log('in write_file', JSON.stringify(results));
// once there is some data and the directory exists,
// write the data to a file in the directory
+ results.push('filename');
+ callback(null);
},
function(callback){
+ console.log('in email_link', JSON.stringify(results));
// once the file is written let's email a link to it...
+ callback(null, {'file':results.pop(), 'email':'user@example.com'});
}
]);
});
```
-For a complicated series of async tasks using the auto function makes adding
-new tasks much easier and makes the code more readable.
+For a complicated series of `async` tasks, using the [`auto`](#auto) function makes adding
+new tasks much easier (and the code more readable).
+
+
+---------------------------------------
+
+<a name="retry" />
+### retry([times = 5], task, [callback])
+
+Attempts to get a successful response from `task` no more than `times` times before
+returning an error. If the task is successful, the `callback` will be passed the result
+of the successfull task. If all attemps fail, the callback will be passed the error and
+result (if any) of the final attempt.
+
+__Arguments__
+
+* `times` - An integer indicating how many times to attempt the `task` before giving up. Defaults to 5.
+* `task(callback, results)` - A function which receives two arguments: (1) a `callback(err, result)`
+ which must be called when finished, passing `err` (which can be `null`) and the `result` of
+ the function's execution, and (2) a `results` object, containing the results of
+ the previously executed functions (if nested inside another control flow).
+* `callback(err, results)` - An optional callback which is called when the
+ task has succeeded, or after the final failed attempt. It receives the `err` and `result` arguments of the last attempt at completing the `task`.
+
+The [`retry`](#retry) function can be used as a stand-alone control flow by passing a
+callback, as shown below:
+
+```js
+async.retry(3, apiMethod, function(err, result) {
+ // do something with the result
+});
+```
+
+It can also be embeded within other control flow functions to retry individual methods
+that are not as reliable, like this:
+
+```js
+async.auto({
+ users: api.getUsers.bind(api),
+ payments: async.retry(3, api.getPayments.bind(api))
+}, function(err, results) {
+ // do something with the results
+});
+```
---------------------------------------
<a name="iterator" />
### iterator(tasks)
-Creates an iterator function which calls the next function in the array,
+Creates an iterator function which calls the next function in the `tasks` array,
returning a continuation to call the next one after that. It's also possible to
-'peek' the next iterator by doing iterator.next().
+“peek” at the next iterator with `iterator.next()`.
-This function is used internally by the async module but can be useful when
+This function is used internally by the `async` module, but can be useful when
you want to manually control the flow of functions in series.
__Arguments__
-* tasks - An array of functions to run.
+* `tasks` - An array of functions to run.
__Example__
<a name="apply" />
### apply(function, arguments..)
-Creates a continuation function with some arguments already applied, a useful
-shorthand when combined with other control flow functions. Any arguments
+Creates a continuation function with some arguments already applied.
+
+Useful as a shorthand when combined with other control flow functions. Any arguments
passed to the returned function are added to the arguments originally passed
to apply.
__Arguments__
-* function - The function you want to eventually apply all arguments to.
-* arguments... - Any number of arguments to automatically apply when the
+* `function` - The function you want to eventually apply all arguments to.
+* `arguments...` - Any number of arguments to automatically apply when the
continuation is called.
__Example__
<a name="nextTick" />
### nextTick(callback)
-Calls the callback on a later loop around the event loop. In node.js this just
-calls process.nextTick, in the browser it falls back to setImmediate(callback)
-if available, otherwise setTimeout(callback, 0), which means other higher priority
-events may precede the execution of the callback.
+Calls `callback` on a later loop around the event loop. In Node.js this just
+calls `process.nextTick`; in the browser it falls back to `setImmediate(callback)`
+if available, otherwise `setTimeout(callback, 0)`, which means other higher priority
+events may precede the execution of `callback`.
This is used internally for browser-compatibility purposes.
__Arguments__
-* callback - The function to call on a later loop around the event loop.
+* `callback` - The function to call on a later loop around the event loop.
__Example__
<a name="times" />
### times(n, callback)
-Calls the callback n times and accumulates results in the same manner
-you would use with async.map.
+Calls the `callback` function `n` times, and accumulates results in the same manner
+you would use with [`map`](#map).
__Arguments__
-* n - The number of times to run the function.
-* callback - The function to call n times.
+* `n` - The number of times to run the function.
+* `callback` - The function to call `n` times.
__Example__
<a name="timesSeries" />
### timesSeries(n, callback)
-The same as times only the iterator is applied to each item in the array in
-series. The next iterator is only called once the current one has completed
-processing. The results array will be in the same order as the original.
+The same as [`times`](#times), only the iterator is applied to each item in `arr` in
+series. The next `iterator` is only called once the current one has completed.
+The results array will be in the same order as the original.
## Utils
<a name="memoize" />
### memoize(fn, [hasher])
-Caches the results of an async function. When creating a hash to store function
+Caches the results of an `async` function. When creating a hash to store function
results against, the callback is omitted from the hash and an optional hash
function can be used.
__Arguments__
-* fn - the function you to proxy and cache results from.
-* hasher - an optional function for generating a custom hash for storing
- results, it has all the arguments applied to it apart from the callback, and
+* `fn` - The function to proxy and cache results from.
+* `hasher` - Tn optional function for generating a custom hash for storing
+ results. It has all the arguments applied to it apart from the callback, and
must be synchronous.
__Example__
<a name="unmemoize" />
### unmemoize(fn)
-Undoes a memoized function, reverting it to the original, unmemoized
-form. Comes handy in tests.
+Undoes a [`memoize`](#memoize)d function, reverting it to the original, unmemoized
+form. Handy for testing.
__Arguments__
-* fn - the memoized function
+* `fn` - the memoized function
<a name="log" />
### log(function, arguments)
-Logs the result of an async function to the console. Only works in node.js or
-in browsers that support console.log and console.error (such as FF and Chrome).
-If multiple arguments are returned from the async function, console.log is
+Logs the result of an `async` function to the `console`. Only works in Node.js or
+in browsers that support `console.log` and `console.error` (such as FF and Chrome).
+If multiple arguments are returned from the async function, `console.log` is
called on each argument in order.
__Arguments__
-* function - The function you want to eventually apply all arguments to.
-* arguments... - Any number of arguments to apply to the function.
+* `function` - The function you want to eventually apply all arguments to.
+* `arguments...` - Any number of arguments to apply to the function.
__Example__
<a name="dir" />
### dir(function, arguments)
-Logs the result of an async function to the console using console.dir to
-display the properties of the resulting object. Only works in node.js or
-in browsers that support console.dir and console.error (such as FF and Chrome).
-If multiple arguments are returned from the async function, console.dir is
+Logs the result of an `async` function to the `console` using `console.dir` to
+display the properties of the resulting object. Only works in Node.js or
+in browsers that support `console.dir` and `console.error` (such as FF and Chrome).
+If multiple arguments are returned from the async function, `console.dir` is
called on each argument in order.
__Arguments__
-* function - The function you want to eventually apply all arguments to.
-* arguments... - Any number of arguments to apply to the function.
+* `function` - The function you want to eventually apply all arguments to.
+* `arguments...` - Any number of arguments to apply to the function.
__Example__
<a name="noConflict" />
### noConflict()
-Changes the value of async back to its original value, returning a reference to the
-async object.
+Changes the value of `async` back to its original value, returning a reference to the
+`async` object.
+/*!
+ * async
+ * https://github.com/caolan/async
+ *
+ * Copyright 2010-2014 Caolan McMahon
+ * Released under the MIT license
+ */
+/*jshint onevar: false, indent:4 */
/*global setImmediate: false, setTimeout: false, console: false */
(function () {
//// cross-browser compatiblity functions ////
+ var _toString = Object.prototype.toString;
+
+ var _isArray = Array.isArray || function (obj) {
+ return _toString.call(obj) === '[object Array]';
+ };
+
var _each = function (arr, iterator) {
if (arr.forEach) {
return arr.forEach(iterator);
else {
async.nextTick = process.nextTick;
if (typeof setImmediate !== 'undefined') {
- async.setImmediate = setImmediate;
+ async.setImmediate = function (fn) {
+ // not a direct alias for IE10 compatibility
+ setImmediate(fn);
+ };
}
else {
async.setImmediate = async.nextTick;
}
var completed = 0;
_each(arr, function (x) {
- iterator(x, only_once(function (err) {
- if (err) {
- callback(err);
- callback = function () {};
- }
- else {
- completed += 1;
- if (completed >= arr.length) {
- callback(null);
- }
- }
- }));
+ iterator(x, only_once(done) );
});
+ function done(err) {
+ if (err) {
+ callback(err);
+ callback = function () {};
+ }
+ else {
+ completed += 1;
+ if (completed >= arr.length) {
+ callback();
+ }
+ }
+ }
};
async.forEach = async.each;
else {
completed += 1;
if (completed >= arr.length) {
- callback(null);
+ callback();
}
else {
iterate();
var _asyncMap = function (eachfn, arr, iterator, callback) {
- var results = [];
arr = _map(arr, function (x, i) {
return {index: i, value: x};
});
- eachfn(arr, function (x, callback) {
- iterator(x.value, function (err, v) {
- results[x.index] = v;
- callback(err);
+ if (!callback) {
+ eachfn(arr, function (x, callback) {
+ iterator(x.value, function (err) {
+ callback(err);
+ });
});
- }, function (err) {
- callback(err, results);
- });
+ } else {
+ var results = [];
+ eachfn(arr, function (x, callback) {
+ iterator(x.value, function (err, v) {
+ results[x.index] = v;
+ callback(err);
+ });
+ }, function (err) {
+ callback(err, results);
+ });
+ }
};
async.map = doParallel(_asyncMap);
async.mapSeries = doSeries(_asyncMap);
async.auto = function (tasks, callback) {
callback = callback || function () {};
var keys = _keys(tasks);
- if (!keys.length) {
- return callback(null);
+ var remainingTasks = keys.length
+ if (!remainingTasks) {
+ return callback();
}
var results = {};
}
};
var taskComplete = function () {
+ remainingTasks--
_each(listeners.slice(0), function (fn) {
fn();
});
};
addListener(function () {
- if (_keys(results).length === keys.length) {
- callback(null, results);
+ if (!remainingTasks) {
+ var theCallback = callback;
+ // prevent final callback from calling itself if it errors
callback = function () {};
+
+ theCallback(null, results);
}
});
_each(keys, function (k) {
- var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k];
+ var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]];
var taskCallback = function (err) {
var args = Array.prototype.slice.call(arguments, 1);
if (args.length <= 1) {
});
};
+ async.retry = function(times, task, callback) {
+ var DEFAULT_TIMES = 5;
+ var attempts = [];
+ // Use defaults if times not passed
+ if (typeof times === 'function') {
+ callback = task;
+ task = times;
+ times = DEFAULT_TIMES;
+ }
+ // Make sure times is a number
+ times = parseInt(times, 10) || DEFAULT_TIMES;
+ var wrappedTask = function(wrappedCallback, wrappedResults) {
+ var retryAttempt = function(task, finalAttempt) {
+ return function(seriesCallback) {
+ task(function(err, result){
+ seriesCallback(!err || finalAttempt, {err: err, result: result});
+ }, wrappedResults);
+ };
+ };
+ while (times) {
+ attempts.push(retryAttempt(task, !(times-=1)));
+ }
+ async.series(attempts, function(done, data){
+ data = data[data.length - 1];
+ (wrappedCallback || callback)(data.err, data.result);
+ });
+ }
+ // If a callback is passed, run this as a controll flow
+ return callback ? wrappedTask() : wrappedTask
+ };
+
async.waterfall = function (tasks, callback) {
callback = callback || function () {};
- if (tasks.constructor !== Array) {
+ if (!_isArray(tasks)) {
var err = new Error('First argument to waterfall must be an array of functions');
return callback(err);
}
var _parallel = function(eachfn, tasks, callback) {
callback = callback || function () {};
- if (tasks.constructor === Array) {
+ if (_isArray(tasks)) {
eachfn.map(tasks, function (fn, callback) {
if (fn) {
fn(function (err) {
async.series = function (tasks, callback) {
callback = callback || function () {};
- if (tasks.constructor === Array) {
+ if (_isArray(tasks)) {
async.mapSeries(tasks, function (fn, callback) {
if (fn) {
fn(function (err) {
if (err) {
return callback(err);
}
- if (test()) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (test.apply(null, args)) {
async.doWhilst(iterator, test, callback);
}
else {
if (err) {
return callback(err);
}
- if (!test()) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ if (!test.apply(null, args)) {
async.doUntil(iterator, test, callback);
}
else {
concurrency = 1;
}
function _insert(q, data, pos, callback) {
- if(data.constructor !== Array) {
+ if (!q.started){
+ q.started = true;
+ }
+ if (!_isArray(data)) {
data = [data];
}
+ if(data.length == 0) {
+ // call drain immediately if there are no tasks
+ return async.setImmediate(function() {
+ if (q.drain) {
+ q.drain();
+ }
+ });
+ }
_each(data, function(task) {
var item = {
data: task,
q.tasks.push(item);
}
- if (q.saturated && q.tasks.length === concurrency) {
+ if (q.saturated && q.tasks.length === q.concurrency) {
q.saturated();
}
async.setImmediate(q.process);
saturated: null,
empty: null,
drain: null,
+ started: false,
+ paused: false,
push: function (data, callback) {
_insert(q, data, false, callback);
},
+ kill: function () {
+ q.drain = null;
+ q.tasks = [];
+ },
unshift: function (data, callback) {
_insert(q, data, true, callback);
},
process: function () {
- if (workers < q.concurrency && q.tasks.length) {
+ if (!q.paused && workers < q.concurrency && q.tasks.length) {
var task = q.tasks.shift();
if (q.empty && q.tasks.length === 0) {
q.empty();
},
running: function () {
return workers;
+ },
+ idle: function() {
+ return q.tasks.length + workers === 0;
+ },
+ pause: function () {
+ if (q.paused === true) { return; }
+ q.paused = true;
+ q.process();
+ },
+ resume: function () {
+ if (q.paused === false) { return; }
+ q.paused = false;
+ q.process();
}
};
return q;
};
+
+ async.priorityQueue = function (worker, concurrency) {
+
+ function _compareTasks(a, b){
+ return a.priority - b.priority;
+ };
+
+ function _binarySearch(sequence, item, compare) {
+ var beg = -1,
+ end = sequence.length - 1;
+ while (beg < end) {
+ var mid = beg + ((end - beg + 1) >>> 1);
+ if (compare(item, sequence[mid]) >= 0) {
+ beg = mid;
+ } else {
+ end = mid - 1;
+ }
+ }
+ return beg;
+ }
+
+ function _insert(q, data, priority, callback) {
+ if (!q.started){
+ q.started = true;
+ }
+ if (!_isArray(data)) {
+ data = [data];
+ }
+ if(data.length == 0) {
+ // call drain immediately if there are no tasks
+ return async.setImmediate(function() {
+ if (q.drain) {
+ q.drain();
+ }
+ });
+ }
+ _each(data, function(task) {
+ var item = {
+ data: task,
+ priority: priority,
+ callback: typeof callback === 'function' ? callback : null
+ };
+
+ q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);
+
+ if (q.saturated && q.tasks.length === q.concurrency) {
+ q.saturated();
+ }
+ async.setImmediate(q.process);
+ });
+ }
+
+ // Start with a normal queue
+ var q = async.queue(worker, concurrency);
+
+ // Override push to accept second parameter representing priority
+ q.push = function (data, priority, callback) {
+ _insert(q, data, priority, callback);
+ };
+
+ // Remove unshift function
+ delete q.unshift;
+
+ return q;
+ };
async.cargo = function (worker, payload) {
var working = false,
saturated: null,
empty: null,
drain: null,
+ drained: true,
push: function (data, callback) {
- if(data.constructor !== Array) {
+ if (!_isArray(data)) {
data = [data];
}
_each(data, function(task) {
data: task,
callback: typeof callback === 'function' ? callback : null
});
+ cargo.drained = false;
if (cargo.saturated && tasks.length === payload) {
cargo.saturated();
}
process: function process() {
if (working) return;
if (tasks.length === 0) {
- if(cargo.drain) cargo.drain();
+ if(cargo.drain && !cargo.drained) cargo.drain();
+ cargo.drained = true;
return;
}
var ts = typeof payload === 'number'
? tasks.splice(0, payload)
- : tasks.splice(0);
+ : tasks.splice(0, tasks.length);
var ds = _map(ts, function (task) {
return task.data;
var callback = args.pop();
var key = hasher.apply(null, args);
if (key in memo) {
- callback.apply(null, memo[key]);
+ async.nextTick(function () {
+ callback.apply(null, memo[key]);
+ });
}
else if (key in queues) {
queues[key].push(callback);
return async.mapSeries(counter, iterator, callback);
};
- async.compose = function (/* functions... */) {
- var fns = Array.prototype.reverse.call(arguments);
+ async.seq = function (/* functions... */) {
+ var fns = arguments;
return function () {
var that = this;
var args = Array.prototype.slice.call(arguments);
};
};
+ async.compose = function (/* functions... */) {
+ return async.seq.apply(null, Array.prototype.reverse.call(arguments));
+ };
+
var _applyEach = function (eachfn, fns /*args...*/) {
var go = function () {
var that = this;
next();
};
+ // Node.js
+ if (typeof module !== 'undefined' && module.exports) {
+ module.exports = async;
+ }
// AMD / RequireJS
- if (typeof define !== 'undefined' && define.amd) {
+ else if (typeof define !== 'undefined' && define.amd) {
define([], function () {
return async;
});
}
- // Node.js
- else if (typeof module !== 'undefined' && module.exports) {
- module.exports = async;
- }
// included directly via <script> tag
else {
root.async = async;
"author": {
"name": "Caolan McMahon"
},
- "version": "0.2.9",
+ "version": "0.9.0",
"repository": {
"type": "git",
"url": "https://github.com/caolan/async.git"
"scripts": {
"test": "nodeunit test/test-async.js"
},
- "readme": "# Async.js\n\nAsync is a utility module which provides straight-forward, powerful functions\nfor working with asynchronous JavaScript. Although originally designed for\nuse with [node.js](http://nodejs.org), it can also be used directly in the\nbrowser. Also supports [component](https://github.com/component/component).\n\nAsync provides around 20 functions that include the usual 'functional'\nsuspects (map, reduce, filter, each…) as well as some common patterns\nfor asynchronous control flow (parallel, series, waterfall…). All these\nfunctions assume you follow the node.js convention of providing a single\ncallback as the last argument of your async function.\n\n\n## Quick Examples\n\n```javascript\nasync.map(['file1','file2','file3'], fs.stat, function(err, results){\n // results is now an array of stats for each file\n});\n\nasync.filter(['file1','file2','file3'], fs.exists, function(results){\n // results now equals an array of the existing files\n});\n\nasync.parallel([\n function(){ ... },\n function(){ ... }\n], callback);\n\nasync.series([\n function(){ ... },\n function(){ ... }\n]);\n```\n\nThere are many more functions available so take a look at the docs below for a\nfull list. This module aims to be comprehensive, so if you feel anything is\nmissing please create a GitHub issue for it.\n\n## Common Pitfalls\n\n### Binding a context to an iterator\n\nThis section is really about bind, not about async. If you are wondering how to\nmake async execute your iterators in a given context, or are confused as to why\na method of another library isn't working as an iterator, study this example:\n\n```js\n// Here is a simple object with an (unnecessarily roundabout) squaring method\nvar AsyncSquaringLibrary = {\n squareExponent: 2,\n square: function(number, callback){ \n var result = Math.pow(number, this.squareExponent);\n setTimeout(function(){\n callback(null, result);\n }, 200);\n }\n};\n\nasync.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){\n // result is [NaN, NaN, NaN]\n // This fails because the `this.squareExponent` expression in the square\n // function is not evaluated in the context of AsyncSquaringLibrary, and is\n // therefore undefined.\n});\n\nasync.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){\n // result is [1, 4, 9]\n // With the help of bind we can attach a context to the iterator before\n // passing it to async. Now the square function will be executed in its \n // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent`\n // will be as expected.\n});\n```\n\n## Download\n\nThe source is available for download from\n[GitHub](http://github.com/caolan/async).\nAlternatively, you can install using Node Package Manager (npm):\n\n npm install async\n\n__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed\n\n## In the Browser\n\nSo far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage:\n\n```html\n<script type=\"text/javascript\" src=\"async.js\"></script>\n<script type=\"text/javascript\">\n\n async.map(data, asyncProcess, function(err, results){\n alert(results);\n });\n\n</script>\n```\n\n## Documentation\n\n### Collections\n\n* [each](#each)\n* [map](#map)\n* [filter](#filter)\n* [reject](#reject)\n* [reduce](#reduce)\n* [detect](#detect)\n* [sortBy](#sortBy)\n* [some](#some)\n* [every](#every)\n* [concat](#concat)\n\n### Control Flow\n\n* [series](#series)\n* [parallel](#parallel)\n* [whilst](#whilst)\n* [doWhilst](#doWhilst)\n* [until](#until)\n* [doUntil](#doUntil)\n* [forever](#forever)\n* [waterfall](#waterfall)\n* [compose](#compose)\n* [applyEach](#applyEach)\n* [queue](#queue)\n* [cargo](#cargo)\n* [auto](#auto)\n* [iterator](#iterator)\n* [apply](#apply)\n* [nextTick](#nextTick)\n* [times](#times)\n* [timesSeries](#timesSeries)\n\n### Utils\n\n* [memoize](#memoize)\n* [unmemoize](#unmemoize)\n* [log](#log)\n* [dir](#dir)\n* [noConflict](#noConflict)\n\n\n## Collections\n\n<a name=\"forEach\" />\n<a name=\"each\" />\n### each(arr, iterator, callback)\n\nApplies an iterator function to each item in an array, in parallel.\nThe iterator is called with an item from the list and a callback for when it\nhas finished. If the iterator passes an error to this callback, the main\ncallback for the each function is immediately called with the error.\n\nNote, that since this function applies the iterator to each item in parallel\nthere is no guarantee that the iterator functions will complete in order.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err) which must be called once it has \n completed. If no error has occured, the callback should be run without \n arguments or with an explicit null argument.\n* callback(err) - A callback which is called after all the iterator functions\n have finished, or an error has occurred.\n\n__Example__\n\n```js\n// assuming openFiles is an array of file names and saveFile is a function\n// to save the modified contents of that file:\n\nasync.each(openFiles, saveFile, function(err){\n // if any of the saves produced an error, err would equal that error\n});\n```\n\n---------------------------------------\n\n<a name=\"forEachSeries\" />\n<a name=\"eachSeries\" />\n### eachSeries(arr, iterator, callback)\n\nThe same as each only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. This means the iterator functions will complete in order.\n\n\n---------------------------------------\n\n<a name=\"forEachLimit\" />\n<a name=\"eachLimit\" />\n### eachLimit(arr, limit, iterator, callback)\n\nThe same as each only no more than \"limit\" iterators will be simultaneously \nrunning at any time.\n\nNote that the items are not processed in batches, so there is no guarantee that\n the first \"limit\" iterator functions will complete before any others are \nstarted.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* limit - The maximum number of iterators to run at any time.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err) which must be called once it has \n completed. If no error has occured, the callback should be run without \n arguments or with an explicit null argument.\n* callback(err) - A callback which is called after all the iterator functions\n have finished, or an error has occurred.\n\n__Example__\n\n```js\n// Assume documents is an array of JSON objects and requestApi is a\n// function that interacts with a rate-limited REST api.\n\nasync.eachLimit(documents, 20, requestApi, function(err){\n // if any of the saves produced an error, err would equal that error\n});\n```\n\n---------------------------------------\n\n<a name=\"map\" />\n### map(arr, iterator, callback)\n\nProduces a new array of values by mapping each value in the given array through\nthe iterator function. The iterator is called with an item from the array and a\ncallback for when it has finished processing. The callback takes 2 arguments, \nan error and the transformed item from the array. If the iterator passes an\nerror to this callback, the main callback for the map function is immediately\ncalled with the error.\n\nNote, that since this function applies the iterator to each item in parallel\nthere is no guarantee that the iterator functions will complete in order, however\nthe results array will be in the same order as the original array.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err, transformed) which must be called once \n it has completed with an error (which can be null) and a transformed item.\n* callback(err, results) - A callback which is called after all the iterator\n functions have finished, or an error has occurred. Results is an array of the\n transformed items from the original array.\n\n__Example__\n\n```js\nasync.map(['file1','file2','file3'], fs.stat, function(err, results){\n // results is now an array of stats for each file\n});\n```\n\n---------------------------------------\n\n<a name=\"mapSeries\" />\n### mapSeries(arr, iterator, callback)\n\nThe same as map only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. The results array will be in the same order as the original.\n\n\n---------------------------------------\n\n<a name=\"mapLimit\" />\n### mapLimit(arr, limit, iterator, callback)\n\nThe same as map only no more than \"limit\" iterators will be simultaneously \nrunning at any time.\n\nNote that the items are not processed in batches, so there is no guarantee that\n the first \"limit\" iterator functions will complete before any others are \nstarted.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* limit - The maximum number of iterators to run at any time.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err, transformed) which must be called once \n it has completed with an error (which can be null) and a transformed item.\n* callback(err, results) - A callback which is called after all the iterator\n functions have finished, or an error has occurred. Results is an array of the\n transformed items from the original array.\n\n__Example__\n\n```js\nasync.map(['file1','file2','file3'], 1, fs.stat, function(err, results){\n // results is now an array of stats for each file\n});\n```\n\n---------------------------------------\n\n<a name=\"filter\" />\n### filter(arr, iterator, callback)\n\n__Alias:__ select\n\nReturns a new array of all the values which pass an async truth test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like fs.exists. This operation is\nperformed in parallel, but the results array will be in the same order as the\noriginal.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n The iterator is passed a callback(truthValue) which must be called with a \n boolean argument once it has completed.\n* callback(results) - A callback which is called after all the iterator\n functions have finished.\n\n__Example__\n\n```js\nasync.filter(['file1','file2','file3'], fs.exists, function(results){\n // results now equals an array of the existing files\n});\n```\n\n---------------------------------------\n\n<a name=\"filterSeries\" />\n### filterSeries(arr, iterator, callback)\n\n__alias:__ selectSeries\n\nThe same as filter only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. The results array will be in the same order as the original.\n\n---------------------------------------\n\n<a name=\"reject\" />\n### reject(arr, iterator, callback)\n\nThe opposite of filter. Removes values that pass an async truth test.\n\n---------------------------------------\n\n<a name=\"rejectSeries\" />\n### rejectSeries(arr, iterator, callback)\n\nThe same as reject, only the iterator is applied to each item in the array\nin series.\n\n\n---------------------------------------\n\n<a name=\"reduce\" />\n### reduce(arr, memo, iterator, callback)\n\n__aliases:__ inject, foldl\n\nReduces a list of values into a single value using an async iterator to return\neach successive step. Memo is the initial state of the reduction. This\nfunction only operates in series. For performance reasons, it may make sense to\nsplit a call to this function into a parallel map, then use the normal\nArray.prototype.reduce on the results. This function is for situations where\neach step in the reduction needs to be async, if you can get the data before\nreducing it then it's probably a good idea to do so.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* memo - The initial state of the reduction.\n* iterator(memo, item, callback) - A function applied to each item in the\n array to produce the next step in the reduction. The iterator is passed a\n callback(err, reduction) which accepts an optional error as its first \n argument, and the state of the reduction as the second. If an error is \n passed to the callback, the reduction is stopped and the main callback is \n immediately called with the error.\n* callback(err, result) - A callback which is called after all the iterator\n functions have finished. Result is the reduced value.\n\n__Example__\n\n```js\nasync.reduce([1,2,3], 0, function(memo, item, callback){\n // pointless async:\n process.nextTick(function(){\n callback(null, memo + item)\n });\n}, function(err, result){\n // result is now equal to the last value of memo, which is 6\n});\n```\n\n---------------------------------------\n\n<a name=\"reduceRight\" />\n### reduceRight(arr, memo, iterator, callback)\n\n__Alias:__ foldr\n\nSame as reduce, only operates on the items in the array in reverse order.\n\n\n---------------------------------------\n\n<a name=\"detect\" />\n### detect(arr, iterator, callback)\n\nReturns the first value in a list that passes an async truth test. The\niterator is applied in parallel, meaning the first iterator to return true will\nfire the detect callback with that result. That means the result might not be\nthe first item in the original array (in terms of order) that passes the test.\n\nIf order within the original array is important then look at detectSeries.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n The iterator is passed a callback(truthValue) which must be called with a \n boolean argument once it has completed.\n* callback(result) - A callback which is called as soon as any iterator returns\n true, or after all the iterator functions have finished. Result will be\n the first item in the array that passes the truth test (iterator) or the\n value undefined if none passed.\n\n__Example__\n\n```js\nasync.detect(['file1','file2','file3'], fs.exists, function(result){\n // result now equals the first file in the list that exists\n});\n```\n\n---------------------------------------\n\n<a name=\"detectSeries\" />\n### detectSeries(arr, iterator, callback)\n\nThe same as detect, only the iterator is applied to each item in the array\nin series. This means the result is always the first in the original array (in\nterms of array order) that passes the truth test.\n\n\n---------------------------------------\n\n<a name=\"sortBy\" />\n### sortBy(arr, iterator, callback)\n\nSorts a list by the results of running each value through an async iterator.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err, sortValue) which must be called once it\n has completed with an error (which can be null) and a value to use as the sort\n criteria.\n* callback(err, results) - A callback which is called after all the iterator\n functions have finished, or an error has occurred. Results is the items from\n the original array sorted by the values returned by the iterator calls.\n\n__Example__\n\n```js\nasync.sortBy(['file1','file2','file3'], function(file, callback){\n fs.stat(file, function(err, stats){\n callback(err, stats.mtime);\n });\n}, function(err, results){\n // results is now the original array of files sorted by\n // modified date\n});\n```\n\n---------------------------------------\n\n<a name=\"some\" />\n### some(arr, iterator, callback)\n\n__Alias:__ any\n\nReturns true if at least one element in the array satisfies an async test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like fs.exists. Once any iterator\ncall returns true, the main callback is immediately called.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n The iterator is passed a callback(truthValue) which must be called with a \n boolean argument once it has completed.\n* callback(result) - A callback which is called as soon as any iterator returns\n true, or after all the iterator functions have finished. Result will be\n either true or false depending on the values of the async tests.\n\n__Example__\n\n```js\nasync.some(['file1','file2','file3'], fs.exists, function(result){\n // if result is true then at least one of the files exists\n});\n```\n\n---------------------------------------\n\n<a name=\"every\" />\n### every(arr, iterator, callback)\n\n__Alias:__ all\n\nReturns true if every element in the array satisfies an async test.\n_The callback for each iterator call only accepts a single argument of true or\nfalse, it does not accept an error argument first!_ This is in-line with the\nway node libraries work with truth tests like fs.exists.\n\n__Arguments__\n\n* arr - An array to iterate over.\n* iterator(item, callback) - A truth test to apply to each item in the array.\n The iterator is passed a callback(truthValue) which must be called with a \n boolean argument once it has completed.\n* callback(result) - A callback which is called after all the iterator\n functions have finished. Result will be either true or false depending on\n the values of the async tests.\n\n__Example__\n\n```js\nasync.every(['file1','file2','file3'], fs.exists, function(result){\n // if result is true then every file exists\n});\n```\n\n---------------------------------------\n\n<a name=\"concat\" />\n### concat(arr, iterator, callback)\n\nApplies an iterator to each item in a list, concatenating the results. Returns the\nconcatenated list. The iterators are called in parallel, and the results are\nconcatenated as they return. There is no guarantee that the results array will\nbe returned in the original order of the arguments passed to the iterator function.\n\n__Arguments__\n\n* arr - An array to iterate over\n* iterator(item, callback) - A function to apply to each item in the array.\n The iterator is passed a callback(err, results) which must be called once it \n has completed with an error (which can be null) and an array of results.\n* callback(err, results) - A callback which is called after all the iterator\n functions have finished, or an error has occurred. Results is an array containing\n the concatenated results of the iterator function.\n\n__Example__\n\n```js\nasync.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){\n // files is now a list of filenames that exist in the 3 directories\n});\n```\n\n---------------------------------------\n\n<a name=\"concatSeries\" />\n### concatSeries(arr, iterator, callback)\n\nSame as async.concat, but executes in series instead of parallel.\n\n\n## Control Flow\n\n<a name=\"series\" />\n### series(tasks, [callback])\n\nRun an array of functions in series, each one running once the previous\nfunction has completed. If any functions in the series pass an error to its\ncallback, no more functions are run and the callback for the series is\nimmediately called with the value of the error. Once the tasks have completed,\nthe results are passed to the final callback as an array.\n\nIt is also possible to use an object instead of an array. Each property will be\nrun as a function and the results will be passed to the final callback as an object\ninstead of an array. This can be a more readable way of handling results from\nasync.series.\n\n\n__Arguments__\n\n* tasks - An array or object containing functions to run, each function is passed\n a callback(err, result) it must call on completion with an error (which can\n be null) and an optional result value.\n* callback(err, results) - An optional callback to run once all the functions\n have completed. This function gets a results array (or object) containing all \n the result arguments passed to the task callbacks.\n\n__Example__\n\n```js\nasync.series([\n function(callback){\n // do some stuff ...\n callback(null, 'one');\n },\n function(callback){\n // do some more stuff ...\n callback(null, 'two');\n }\n],\n// optional callback\nfunction(err, results){\n // results is now equal to ['one', 'two']\n});\n\n\n// an example using an object instead of an array\nasync.series({\n one: function(callback){\n setTimeout(function(){\n callback(null, 1);\n }, 200);\n },\n two: function(callback){\n setTimeout(function(){\n callback(null, 2);\n }, 100);\n }\n},\nfunction(err, results) {\n // results is now equal to: {one: 1, two: 2}\n});\n```\n\n---------------------------------------\n\n<a name=\"parallel\" />\n### parallel(tasks, [callback])\n\nRun an array of functions in parallel, without waiting until the previous\nfunction has completed. If any of the functions pass an error to its\ncallback, the main callback is immediately called with the value of the error.\nOnce the tasks have completed, the results are passed to the final callback as an\narray.\n\nIt is also possible to use an object instead of an array. Each property will be\nrun as a function and the results will be passed to the final callback as an object\ninstead of an array. This can be a more readable way of handling results from\nasync.parallel.\n\n\n__Arguments__\n\n* tasks - An array or object containing functions to run, each function is passed \n a callback(err, result) it must call on completion with an error (which can\n be null) and an optional result value.\n* callback(err, results) - An optional callback to run once all the functions\n have completed. This function gets a results array (or object) containing all \n the result arguments passed to the task callbacks.\n\n__Example__\n\n```js\nasync.parallel([\n function(callback){\n setTimeout(function(){\n callback(null, 'one');\n }, 200);\n },\n function(callback){\n setTimeout(function(){\n callback(null, 'two');\n }, 100);\n }\n],\n// optional callback\nfunction(err, results){\n // the results array will equal ['one','two'] even though\n // the second function had a shorter timeout.\n});\n\n\n// an example using an object instead of an array\nasync.parallel({\n one: function(callback){\n setTimeout(function(){\n callback(null, 1);\n }, 200);\n },\n two: function(callback){\n setTimeout(function(){\n callback(null, 2);\n }, 100);\n }\n},\nfunction(err, results) {\n // results is now equals to: {one: 1, two: 2}\n});\n```\n\n---------------------------------------\n\n<a name=\"parallel\" />\n### parallelLimit(tasks, limit, [callback])\n\nThe same as parallel only the tasks are executed in parallel with a maximum of \"limit\" \ntasks executing at any time.\n\nNote that the tasks are not executed in batches, so there is no guarantee that \nthe first \"limit\" tasks will complete before any others are started.\n\n__Arguments__\n\n* tasks - An array or object containing functions to run, each function is passed \n a callback(err, result) it must call on completion with an error (which can\n be null) and an optional result value.\n* limit - The maximum number of tasks to run at any time.\n* callback(err, results) - An optional callback to run once all the functions\n have completed. This function gets a results array (or object) containing all \n the result arguments passed to the task callbacks.\n\n---------------------------------------\n\n<a name=\"whilst\" />\n### whilst(test, fn, callback)\n\nRepeatedly call fn, while test returns true. Calls the callback when stopped,\nor an error occurs.\n\n__Arguments__\n\n* test() - synchronous truth test to perform before each execution of fn.\n* fn(callback) - A function to call each time the test passes. The function is\n passed a callback(err) which must be called once it has completed with an \n optional error argument.\n* callback(err) - A callback which is called after the test fails and repeated\n execution of fn has stopped.\n\n__Example__\n\n```js\nvar count = 0;\n\nasync.whilst(\n function () { return count < 5; },\n function (callback) {\n count++;\n setTimeout(callback, 1000);\n },\n function (err) {\n // 5 seconds have passed\n }\n);\n```\n\n---------------------------------------\n\n<a name=\"doWhilst\" />\n### doWhilst(fn, test, callback)\n\nThe post check version of whilst. To reflect the difference in the order of operations `test` and `fn` arguments are switched. `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.\n\n---------------------------------------\n\n<a name=\"until\" />\n### until(test, fn, callback)\n\nRepeatedly call fn, until test returns true. Calls the callback when stopped,\nor an error occurs.\n\nThe inverse of async.whilst.\n\n---------------------------------------\n\n<a name=\"doUntil\" />\n### doUntil(fn, test, callback)\n\nLike doWhilst except the test is inverted. Note the argument ordering differs from `until`.\n\n---------------------------------------\n\n<a name=\"forever\" />\n### forever(fn, callback)\n\nCalls the asynchronous function 'fn' repeatedly, in series, indefinitely.\nIf an error is passed to fn's callback then 'callback' is called with the\nerror, otherwise it will never be called.\n\n---------------------------------------\n\n<a name=\"waterfall\" />\n### waterfall(tasks, [callback])\n\nRuns an array of functions in series, each passing their results to the next in\nthe array. However, if any of the functions pass an error to the callback, the\nnext function is not executed and the main callback is immediately called with\nthe error.\n\n__Arguments__\n\n* tasks - An array of functions to run, each function is passed a \n callback(err, result1, result2, ...) it must call on completion. The first\n argument is an error (which can be null) and any further arguments will be \n passed as arguments in order to the next task.\n* callback(err, [results]) - An optional callback to run once all the functions\n have completed. This will be passed the results of the last task's callback.\n\n\n\n__Example__\n\n```js\nasync.waterfall([\n function(callback){\n callback(null, 'one', 'two');\n },\n function(arg1, arg2, callback){\n callback(null, 'three');\n },\n function(arg1, callback){\n // arg1 now equals 'three'\n callback(null, 'done');\n }\n], function (err, result) {\n // result now equals 'done' \n});\n```\n\n---------------------------------------\n<a name=\"compose\" />\n### compose(fn1, fn2...)\n\nCreates a function which is a composition of the passed asynchronous\nfunctions. Each function consumes the return value of the function that\nfollows. Composing functions f(), g() and h() would produce the result of\nf(g(h())), only this version uses callbacks to obtain the return values.\n\nEach function is executed with the `this` binding of the composed function.\n\n__Arguments__\n\n* functions... - the asynchronous functions to compose\n\n\n__Example__\n\n```js\nfunction add1(n, callback) {\n setTimeout(function () {\n callback(null, n + 1);\n }, 10);\n}\n\nfunction mul3(n, callback) {\n setTimeout(function () {\n callback(null, n * 3);\n }, 10);\n}\n\nvar add1mul3 = async.compose(mul3, add1);\n\nadd1mul3(4, function (err, result) {\n // result now equals 15\n});\n```\n\n---------------------------------------\n<a name=\"applyEach\" />\n### applyEach(fns, args..., callback)\n\nApplies the provided arguments to each function in the array, calling the\ncallback after all functions have completed. If you only provide the first\nargument then it will return a function which lets you pass in the\narguments as if it were a single function call.\n\n__Arguments__\n\n* fns - the asynchronous functions to all call with the same arguments\n* args... - any number of separate arguments to pass to the function\n* callback - the final argument should be the callback, called when all\n functions have completed processing\n\n\n__Example__\n\n```js\nasync.applyEach([enableSearch, updateSchema], 'bucket', callback);\n\n// partial application example:\nasync.each(\n buckets,\n async.applyEach([enableSearch, updateSchema]),\n callback\n);\n```\n\n---------------------------------------\n\n<a name=\"applyEachSeries\" />\n### applyEachSeries(arr, iterator, callback)\n\nThe same as applyEach only the functions are applied in series.\n\n---------------------------------------\n\n<a name=\"queue\" />\n### queue(worker, concurrency)\n\nCreates a queue object with the specified concurrency. Tasks added to the\nqueue will be processed in parallel (up to the concurrency limit). If all\nworkers are in progress, the task is queued until one is available. Once\na worker has completed a task, the task's callback is called.\n\n__Arguments__\n\n* worker(task, callback) - An asynchronous function for processing a queued\n task, which must call its callback(err) argument when finished, with an \n optional error as an argument.\n* concurrency - An integer for determining how many worker functions should be\n run in parallel.\n\n__Queue objects__\n\nThe queue object returned by this function has the following properties and\nmethods:\n\n* length() - a function returning the number of items waiting to be processed.\n* concurrency - an integer for determining how many worker functions should be\n run in parallel. This property can be changed after a queue is created to\n alter the concurrency on-the-fly.\n* push(task, [callback]) - add a new task to the queue, the callback is called\n once the worker has finished processing the task.\n instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.\n* unshift(task, [callback]) - add a new task to the front of the queue.\n* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued\n* empty - a callback that is called when the last item from the queue is given to a worker\n* drain - a callback that is called when the last item from the queue has returned from the worker\n\n__Example__\n\n```js\n// create a queue object with concurrency 2\n\nvar q = async.queue(function (task, callback) {\n console.log('hello ' + task.name);\n callback();\n}, 2);\n\n\n// assign a callback\nq.drain = function() {\n console.log('all items have been processed');\n}\n\n// add some items to the queue\n\nq.push({name: 'foo'}, function (err) {\n console.log('finished processing foo');\n});\nq.push({name: 'bar'}, function (err) {\n console.log('finished processing bar');\n});\n\n// add some items to the queue (batch-wise)\n\nq.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) {\n console.log('finished processing bar');\n});\n\n// add some items to the front of the queue\n\nq.unshift({name: 'bar'}, function (err) {\n console.log('finished processing bar');\n});\n```\n\n---------------------------------------\n\n<a name=\"cargo\" />\n### cargo(worker, [payload])\n\nCreates a cargo object with the specified payload. Tasks added to the\ncargo will be processed altogether (up to the payload limit). If the\nworker is in progress, the task is queued until it is available. Once\nthe worker has completed some tasks, each callback of those tasks is called.\n\n__Arguments__\n\n* worker(tasks, callback) - An asynchronous function for processing an array of\n queued tasks, which must call its callback(err) argument when finished, with \n an optional error as an argument.\n* payload - An optional integer for determining how many tasks should be\n processed per round; if omitted, the default is unlimited.\n\n__Cargo objects__\n\nThe cargo object returned by this function has the following properties and\nmethods:\n\n* length() - a function returning the number of items waiting to be processed.\n* payload - an integer for determining how many tasks should be\n process per round. This property can be changed after a cargo is created to\n alter the payload on-the-fly.\n* push(task, [callback]) - add a new task to the queue, the callback is called\n once the worker has finished processing the task.\n instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.\n* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued\n* empty - a callback that is called when the last item from the queue is given to a worker\n* drain - a callback that is called when the last item from the queue has returned from the worker\n\n__Example__\n\n```js\n// create a cargo object with payload 2\n\nvar cargo = async.cargo(function (tasks, callback) {\n for(var i=0; i<tasks.length; i++){\n console.log('hello ' + tasks[i].name);\n }\n callback();\n}, 2);\n\n\n// add some items\n\ncargo.push({name: 'foo'}, function (err) {\n console.log('finished processing foo');\n});\ncargo.push({name: 'bar'}, function (err) {\n console.log('finished processing bar');\n});\ncargo.push({name: 'baz'}, function (err) {\n console.log('finished processing baz');\n});\n```\n\n---------------------------------------\n\n<a name=\"auto\" />\n### auto(tasks, [callback])\n\nDetermines the best order for running functions based on their requirements.\nEach function can optionally depend on other functions being completed first,\nand each function is run as soon as its requirements are satisfied. If any of\nthe functions pass an error to their callback, that function will not complete\n(so any other functions depending on it will not run) and the main callback\nwill be called immediately with the error. Functions also receive an object\ncontaining the results of functions which have completed so far.\n\nNote, all functions are called with a results object as a second argument, \nso it is unsafe to pass functions in the tasks object which cannot handle the\nextra argument. For example, this snippet of code:\n\n```js\nasync.auto({\n readData: async.apply(fs.readFile, 'data.txt', 'utf-8');\n}, callback);\n```\n\nwill have the effect of calling readFile with the results object as the last\nargument, which will fail:\n\n```js\nfs.readFile('data.txt', 'utf-8', cb, {});\n```\n\nInstead, wrap the call to readFile in a function which does not forward the \nresults object:\n\n```js\nasync.auto({\n readData: function(cb, results){\n fs.readFile('data.txt', 'utf-8', cb);\n }\n}, callback);\n```\n\n__Arguments__\n\n* tasks - An object literal containing named functions or an array of\n requirements, with the function itself the last item in the array. The key\n used for each function or array is used when specifying requirements. The \n function receives two arguments: (1) a callback(err, result) which must be \n called when finished, passing an error (which can be null) and the result of \n the function's execution, and (2) a results object, containing the results of\n the previously executed functions.\n* callback(err, results) - An optional callback which is called when all the\n tasks have been completed. The callback will receive an error as an argument\n if any tasks pass an error to their callback. Results will always be passed\n\tbut if an error occurred, no other tasks will be performed, and the results\n\tobject will only contain partial results.\n \n\n__Example__\n\n```js\nasync.auto({\n get_data: function(callback){\n // async code to get some data\n },\n make_folder: function(callback){\n // async code to create a directory to store a file in\n // this is run at the same time as getting the data\n },\n write_file: ['get_data', 'make_folder', function(callback){\n // once there is some data and the directory exists,\n // write the data to a file in the directory\n callback(null, filename);\n }],\n email_link: ['write_file', function(callback, results){\n // once the file is written let's email a link to it...\n // results.write_file contains the filename returned by write_file.\n }]\n});\n```\n\nThis is a fairly trivial example, but to do this using the basic parallel and\nseries functions would look like this:\n\n```js\nasync.parallel([\n function(callback){\n // async code to get some data\n },\n function(callback){\n // async code to create a directory to store a file in\n // this is run at the same time as getting the data\n }\n],\nfunction(err, results){\n async.series([\n function(callback){\n // once there is some data and the directory exists,\n // write the data to a file in the directory\n },\n function(callback){\n // once the file is written let's email a link to it...\n }\n ]);\n});\n```\n\nFor a complicated series of async tasks using the auto function makes adding\nnew tasks much easier and makes the code more readable.\n\n\n---------------------------------------\n\n<a name=\"iterator\" />\n### iterator(tasks)\n\nCreates an iterator function which calls the next function in the array,\nreturning a continuation to call the next one after that. It's also possible to\n'peek' the next iterator by doing iterator.next().\n\nThis function is used internally by the async module but can be useful when\nyou want to manually control the flow of functions in series.\n\n__Arguments__\n\n* tasks - An array of functions to run.\n\n__Example__\n\n```js\nvar iterator = async.iterator([\n function(){ sys.p('one'); },\n function(){ sys.p('two'); },\n function(){ sys.p('three'); }\n]);\n\nnode> var iterator2 = iterator();\n'one'\nnode> var iterator3 = iterator2();\n'two'\nnode> iterator3();\n'three'\nnode> var nextfn = iterator2.next();\nnode> nextfn();\n'three'\n```\n\n---------------------------------------\n\n<a name=\"apply\" />\n### apply(function, arguments..)\n\nCreates a continuation function with some arguments already applied, a useful\nshorthand when combined with other control flow functions. Any arguments\npassed to the returned function are added to the arguments originally passed\nto apply.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to automatically apply when the\n continuation is called.\n\n__Example__\n\n```js\n// using apply\n\nasync.parallel([\n async.apply(fs.writeFile, 'testfile1', 'test1'),\n async.apply(fs.writeFile, 'testfile2', 'test2'),\n]);\n\n\n// the same process without using apply\n\nasync.parallel([\n function(callback){\n fs.writeFile('testfile1', 'test1', callback);\n },\n function(callback){\n fs.writeFile('testfile2', 'test2', callback);\n }\n]);\n```\n\nIt's possible to pass any number of additional arguments when calling the\ncontinuation:\n\n```js\nnode> var fn = async.apply(sys.puts, 'one');\nnode> fn('two', 'three');\none\ntwo\nthree\n```\n\n---------------------------------------\n\n<a name=\"nextTick\" />\n### nextTick(callback)\n\nCalls the callback on a later loop around the event loop. In node.js this just\ncalls process.nextTick, in the browser it falls back to setImmediate(callback)\nif available, otherwise setTimeout(callback, 0), which means other higher priority\nevents may precede the execution of the callback.\n\nThis is used internally for browser-compatibility purposes.\n\n__Arguments__\n\n* callback - The function to call on a later loop around the event loop.\n\n__Example__\n\n```js\nvar call_order = [];\nasync.nextTick(function(){\n call_order.push('two');\n // call_order now equals ['one','two']\n});\ncall_order.push('one')\n```\n\n<a name=\"times\" />\n### times(n, callback)\n\nCalls the callback n times and accumulates results in the same manner\nyou would use with async.map.\n\n__Arguments__\n\n* n - The number of times to run the function.\n* callback - The function to call n times.\n\n__Example__\n\n```js\n// Pretend this is some complicated async factory\nvar createUser = function(id, callback) {\n callback(null, {\n id: 'user' + id\n })\n}\n// generate 5 users\nasync.times(5, function(n, next){\n createUser(n, function(err, user) {\n next(err, user)\n })\n}, function(err, users) {\n // we should now have 5 users\n});\n```\n\n<a name=\"timesSeries\" />\n### timesSeries(n, callback)\n\nThe same as times only the iterator is applied to each item in the array in\nseries. The next iterator is only called once the current one has completed\nprocessing. The results array will be in the same order as the original.\n\n\n## Utils\n\n<a name=\"memoize\" />\n### memoize(fn, [hasher])\n\nCaches the results of an async function. When creating a hash to store function\nresults against, the callback is omitted from the hash and an optional hash\nfunction can be used.\n\nThe cache of results is exposed as the `memo` property of the function returned\nby `memoize`.\n\n__Arguments__\n\n* fn - the function you to proxy and cache results from.\n* hasher - an optional function for generating a custom hash for storing\n results, it has all the arguments applied to it apart from the callback, and\n must be synchronous.\n\n__Example__\n\n```js\nvar slow_fn = function (name, callback) {\n // do something\n callback(null, result);\n};\nvar fn = async.memoize(slow_fn);\n\n// fn can now be used as if it were slow_fn\nfn('some name', function () {\n // callback\n});\n```\n\n<a name=\"unmemoize\" />\n### unmemoize(fn)\n\nUndoes a memoized function, reverting it to the original, unmemoized\nform. Comes handy in tests.\n\n__Arguments__\n\n* fn - the memoized function\n\n<a name=\"log\" />\n### log(function, arguments)\n\nLogs the result of an async function to the console. Only works in node.js or\nin browsers that support console.log and console.error (such as FF and Chrome).\nIf multiple arguments are returned from the async function, console.log is\ncalled on each argument in order.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to apply to the function.\n\n__Example__\n\n```js\nvar hello = function(name, callback){\n setTimeout(function(){\n callback(null, 'hello ' + name);\n }, 1000);\n};\n```\n```js\nnode> async.log(hello, 'world');\n'hello world'\n```\n\n---------------------------------------\n\n<a name=\"dir\" />\n### dir(function, arguments)\n\nLogs the result of an async function to the console using console.dir to\ndisplay the properties of the resulting object. Only works in node.js or\nin browsers that support console.dir and console.error (such as FF and Chrome).\nIf multiple arguments are returned from the async function, console.dir is\ncalled on each argument in order.\n\n__Arguments__\n\n* function - The function you want to eventually apply all arguments to.\n* arguments... - Any number of arguments to apply to the function.\n\n__Example__\n\n```js\nvar hello = function(name, callback){\n setTimeout(function(){\n callback(null, {hello: name});\n }, 1000);\n};\n```\n```js\nnode> async.dir(hello, 'world');\n{hello: 'world'}\n```\n\n---------------------------------------\n\n<a name=\"noConflict\" />\n### noConflict()\n\nChanges the value of async back to its original value, returning a reference to the\nasync object.\n",
- "readmeFilename": "README.md",
"homepage": "https://github.com/caolan/async",
- "_id": "async@0.2.9",
- "_from": "async@~0.2.9"
+ "_id": "async@0.9.0",
+ "dist": {
+ "shasum": "ac3613b1da9bed1b47510bb4651b8931e47146c7",
+ "tarball": "http://registry.npmjs.org/async/-/async-0.9.0.tgz"
+ },
+ "_from": "async@~0.9.0",
+ "_npmVersion": "1.4.3",
+ "_npmUser": {
+ "name": "caolan",
+ "email": "caolan.mcmahon@gmail.com"
+ },
+ "maintainers": [
+ {
+ "name": "caolan",
+ "email": "caolan@caolanmcmahon.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "ac3613b1da9bed1b47510bb4651b8931e47146c7",
+ "_resolved": "https://registry.npmjs.org/async/-/async-0.9.0.tgz",
+ "readme": "ERROR: No README data found!"
}
+++ /dev/null
-*.un~
-/node_modules
-/test/tmp
+++ /dev/null
-SHELL := /bin/bash
-
-test:
- @./test/run.js
-
-.PHONY: test
-
-# combined-stream
+# combined-stream [![Build Status](https://travis-ci.org/felixge/node-combined-stream.svg?branch=master)](https://travis-ci.org/felixge/node-combined-stream)
A stream that emits multiple other streams one after another.
The effect of those options is described below.
-### combinedStream.pauseStreams = true
+### combinedStream.pauseStreams = `true`
Whether to apply back pressure to the underlaying streams. If set to `false`,
the underlaying streams will never be paused. If set to `true`, the
underlaying streams will be paused right after being appended, as well as when
`delayedStream.pipe()` wants to throttle.
-### combinedStream.maxDataSize = 2 * 1024 * 1024
+### combinedStream.maxDataSize = `2 * 1024 * 1024`
The maximum amount of bytes (or characters) to buffer for all source streams.
If this value is exceeded, `combinedStream` emits an `'error'` event.
-### combinedStream.dataSize = 0
+### combinedStream.dataSize = `0`
The amount of bytes (or characters) currently buffered by `combinedStream`.
CombinedStream.prototype.pipe = function(dest, options) {
Stream.prototype.pipe.call(this, dest, options);
this.resume();
+ return dest;
};
CombinedStream.prototype._getNext = function() {
"fake": "0.2.0",
"far": "0.0.1"
},
- "readme": "# delayed-stream\n\nBuffers events from a stream until you are ready to handle them.\n\n## Installation\n\n``` bash\nnpm install delayed-stream\n```\n\n## Usage\n\nThe following example shows how to write a http echo server that delays its\nresponse by 1000 ms.\n\n``` javascript\nvar DelayedStream = require('delayed-stream');\nvar http = require('http');\n\nhttp.createServer(function(req, res) {\n var delayed = DelayedStream.create(req);\n\n setTimeout(function() {\n res.writeHead(200);\n delayed.pipe(res);\n }, 1000);\n});\n```\n\nIf you are not using `Stream#pipe`, you can also manually release the buffered\nevents by calling `delayedStream.resume()`:\n\n``` javascript\nvar delayed = DelayedStream.create(req);\n\nsetTimeout(function() {\n // Emit all buffered events and resume underlaying source\n delayed.resume();\n}, 1000);\n```\n\n## Implementation\n\nIn order to use this meta stream properly, here are a few things you should\nknow about the implementation.\n\n### Event Buffering / Proxying\n\nAll events of the `source` stream are hijacked by overwriting the `source.emit`\nmethod. Until node implements a catch-all event listener, this is the only way.\n\nHowever, delayed-stream still continues to emit all events it captures on the\n`source`, regardless of whether you have released the delayed stream yet or\nnot.\n\nUpon creation, delayed-stream captures all `source` events and stores them in\nan internal event buffer. Once `delayedStream.release()` is called, all\nbuffered events are emitted on the `delayedStream`, and the event buffer is\ncleared. After that, delayed-stream merely acts as a proxy for the underlaying\nsource.\n\n### Error handling\n\nError events on `source` are buffered / proxied just like any other events.\nHowever, `delayedStream.create` attaches a no-op `'error'` listener to the\n`source`. This way you only have to handle errors on the `delayedStream`\nobject, rather than in two places.\n\n### Buffer limits\n\ndelayed-stream provides a `maxDataSize` property that can be used to limit\nthe amount of data being buffered. In order to protect you from bad `source`\nstreams that don't react to `source.pause()`, this feature is enabled by\ndefault.\n\n## API\n\n### DelayedStream.create(source, [options])\n\nReturns a new `delayedStream`. Available options are:\n\n* `pauseStream`\n* `maxDataSize`\n\nThe description for those properties can be found below.\n\n### delayedStream.source\n\nThe `source` stream managed by this object. This is useful if you are\npassing your `delayedStream` around, and you still want to access properties\non the `source` object.\n\n### delayedStream.pauseStream = true\n\nWhether to pause the underlaying `source` when calling\n`DelayedStream.create()`. Modifying this property afterwards has no effect.\n\n### delayedStream.maxDataSize = 1024 * 1024\n\nThe amount of data to buffer before emitting an `error`.\n\nIf the underlaying source is emitting `Buffer` objects, the `maxDataSize`\nrefers to bytes.\n\nIf the underlaying source is emitting JavaScript strings, the size refers to\ncharacters.\n\nIf you know what you are doing, you can set this property to `Infinity` to\ndisable this feature. You can also modify this property during runtime.\n\n### delayedStream.maxDataSize = 1024 * 1024\n\nThe amount of data to buffer before emitting an `error`.\n\nIf the underlaying source is emitting `Buffer` objects, the `maxDataSize`\nrefers to bytes.\n\nIf the underlaying source is emitting JavaScript strings, the size refers to\ncharacters.\n\nIf you know what you are doing, you can set this property to `Infinity` to\ndisable this feature.\n\n### delayedStream.dataSize = 0\n\nThe amount of data buffered so far.\n\n### delayedStream.readable\n\nAn ECMA5 getter that returns the value of `source.readable`.\n\n### delayedStream.resume()\n\nIf the `delayedStream` has not been released so far, `delayedStream.release()`\nis called.\n\nIn either case, `source.resume()` is called.\n\n### delayedStream.pause()\n\nCalls `source.pause()`.\n\n### delayedStream.pipe(dest)\n\nCalls `delayedStream.resume()` and then proxies the arguments to `source.pipe`.\n\n### delayedStream.release()\n\nEmits and clears all events that have been buffered up so far. This does not\nresume the underlaying source, use `delayedStream.resume()` instead.\n\n## License\n\ndelayed-stream is licensed under the MIT license.\n",
- "readmeFilename": "Readme.md",
+ "_id": "delayed-stream@0.0.5",
+ "_engineSupported": true,
+ "_npmVersion": "1.0.3",
+ "_nodeVersion": "v0.4.9-pre",
+ "_defaultsLoaded": true,
+ "dist": {
+ "shasum": "d4b1f43a93e8296dfe02694f4680bc37a313c73f",
+ "tarball": "http://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz"
+ },
+ "scripts": {},
+ "directories": {},
+ "_shasum": "d4b1f43a93e8296dfe02694f4680bc37a313c73f",
+ "_from": "delayed-stream@0.0.5",
+ "_resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz",
"bugs": {
"url": "https://github.com/felixge/node-delayed-stream/issues"
},
- "_id": "delayed-stream@0.0.5",
- "_from": "delayed-stream@0.0.5"
+ "readme": "ERROR: No README data found!"
}
},
"name": "combined-stream",
"description": "A stream that emits multiple other streams one after another.",
- "version": "0.0.4",
+ "version": "0.0.5",
"homepage": "https://github.com/felixge/node-combined-stream",
"repository": {
"type": "git",
"url": "git://github.com/felixge/node-combined-stream.git"
},
"main": "./lib/combined_stream",
+ "scripts": {
+ "test": "node test/run.js"
+ },
"engines": {
- "node": "*"
+ "node": ">= 0.8"
},
"dependencies": {
"delayed-stream": "0.0.5"
},
"devDependencies": {
- "far": "0.0.1"
+ "far": "~0.0.7"
},
- "readme": "# combined-stream\n\nA stream that emits multiple other streams one after another.\n\n## Installation\n\n``` bash\nnpm install combined-stream\n```\n\n## Usage\n\nHere is a simple example that shows how you can use combined-stream to combine\ntwo files into one:\n\n``` javascript\nvar CombinedStream = require('combined-stream');\nvar fs = require('fs');\n\nvar combinedStream = CombinedStream.create();\ncombinedStream.append(fs.createReadStream('file1.txt'));\ncombinedStream.append(fs.createReadStream('file2.txt'));\n\ncombinedStream.pipe(fs.createWriteStream('combined.txt'));\n```\n\nWhile the example above works great, it will pause all source streams until\nthey are needed. If you don't want that to happen, you can set `pauseStreams`\nto `false`:\n\n``` javascript\nvar CombinedStream = require('combined-stream');\nvar fs = require('fs');\n\nvar combinedStream = CombinedStream.create({pauseStreams: false});\ncombinedStream.append(fs.createReadStream('file1.txt'));\ncombinedStream.append(fs.createReadStream('file2.txt'));\n\ncombinedStream.pipe(fs.createWriteStream('combined.txt'));\n```\n\nHowever, what if you don't have all the source streams yet, or you don't want\nto allocate the resources (file descriptors, memory, etc.) for them right away?\nWell, in that case you can simply provide a callback that supplies the stream\nby calling a `next()` function:\n\n``` javascript\nvar CombinedStream = require('combined-stream');\nvar fs = require('fs');\n\nvar combinedStream = CombinedStream.create();\ncombinedStream.append(function(next) {\n next(fs.createReadStream('file1.txt'));\n});\ncombinedStream.append(function(next) {\n next(fs.createReadStream('file2.txt'));\n});\n\ncombinedStream.pipe(fs.createWriteStream('combined.txt'));\n```\n\n## API\n\n### CombinedStream.create([options])\n\nReturns a new combined stream object. Available options are:\n\n* `maxDataSize`\n* `pauseStreams`\n\nThe effect of those options is described below.\n\n### combinedStream.pauseStreams = true\n\nWhether to apply back pressure to the underlaying streams. If set to `false`,\nthe underlaying streams will never be paused. If set to `true`, the\nunderlaying streams will be paused right after being appended, as well as when\n`delayedStream.pipe()` wants to throttle.\n\n### combinedStream.maxDataSize = 2 * 1024 * 1024\n\nThe maximum amount of bytes (or characters) to buffer for all source streams.\nIf this value is exceeded, `combinedStream` emits an `'error'` event.\n\n### combinedStream.dataSize = 0\n\nThe amount of bytes (or characters) currently buffered by `combinedStream`.\n\n### combinedStream.append(stream)\n\nAppends the given `stream` to the combinedStream object. If `pauseStreams` is\nset to `true, this stream will also be paused right away.\n\n`streams` can also be a function that takes one parameter called `next`. `next`\nis a function that must be invoked in order to provide the `next` stream, see\nexample above.\n\nRegardless of how the `stream` is appended, combined-stream always attaches an\n`'error'` listener to it, so you don't have to do that manually.\n\nSpecial case: `stream` can also be a String or Buffer.\n\n### combinedStream.write(data)\n\nYou should not call this, `combinedStream` takes care of piping the appended\nstreams into itself for you.\n\n### combinedStream.resume()\n\nCauses `combinedStream` to start drain the streams it manages. The function is\nidempotent, and also emits a `'resume'` event each time which usually goes to\nthe stream that is currently being drained.\n\n### combinedStream.pause();\n\nIf `combinedStream.pauseStreams` is set to `false`, this does nothing.\nOtherwise a `'pause'` event is emitted, this goes to the stream that is\ncurrently being drained, so you can use it to apply back pressure.\n\n### combinedStream.end();\n\nSets `combinedStream.writable` to false, emits an `'end'` event, and removes\nall streams from the queue.\n\n### combinedStream.destroy();\n\nSame as `combinedStream.end()`, except it emits a `'close'` event instead of\n`'end'`.\n\n## License\n\ncombined-stream is licensed under the MIT license.\n",
- "readmeFilename": "Readme.md",
+ "gitHead": "19d9bdd4c20f6806c2ae8adb00a53fb6fd154740",
"bugs": {
"url": "https://github.com/felixge/node-combined-stream/issues"
},
- "_id": "combined-stream@0.0.4",
- "_from": "combined-stream@~0.0.4"
+ "_id": "combined-stream@0.0.5",
+ "_shasum": "29ed76e5c9aad07c4acf9ca3d32601cce28697a2",
+ "_from": "combined-stream@~0.0.4",
+ "_npmVersion": "1.4.14",
+ "_npmUser": {
+ "name": "alexindigo",
+ "email": "iam@alexindigo.com"
+ },
+ "maintainers": [
+ {
+ "name": "felixge",
+ "email": "felix@debuggable.com"
+ },
+ {
+ "name": "celer",
+ "email": "celer@scrypt.net"
+ },
+ {
+ "name": "alexindigo",
+ "email": "iam@alexindigo.com"
+ }
+ ],
+ "dist": {
+ "shasum": "29ed76e5c9aad07c4acf9ca3d32601cce28697a2",
+ "tarball": "http://registry.npmjs.org/combined-stream/-/combined-stream-0.0.5.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.5.tgz",
+ "readme": "ERROR: No README data found!"
}
+++ /dev/null
-var common = module.exports;
-
-var path = require('path');
-var fs = require('fs');
-var root = path.join(__dirname, '..');
-
-common.dir = {
- fixture: root + '/test/fixture',
- tmp: root + '/test/tmp',
-};
-
-// Create tmp directory if it does not exist
-// Not using fs.exists so as to be node 0.6.x compatible
-try {
- fs.statSync(common.dir.tmp);
-}
-catch (e) {
- // Dir does not exist
- fs.mkdirSync(common.dir.tmp);
-}
-
-common.CombinedStream = require(root);
-common.assert = require('assert');
+++ /dev/null
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
-10101010101010101010101010101010101010101010101010101010101010101010101010101010
-01010101010101010101010101010101010101010101010101010101010101010101010101010101
+++ /dev/null
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
-20202020202020202020202020202020202020202020202020202020202020202020202020202020
-02020202020202020202020202020202020202020202020202020202020202020202020202020202
+++ /dev/null
-var common = require('../common');
-var assert = common.assert;
-var CombinedStream = common.CombinedStream;
-var fs = require('fs');
-
-var FILE1 = common.dir.fixture + '/file1.txt';
-var FILE2 = common.dir.fixture + '/file2.txt';
-var EXPECTED = fs.readFileSync(FILE1) + fs.readFileSync(FILE2);
-
-(function testDelayedStreams() {
- var combinedStream = CombinedStream.create();
- combinedStream.append(function(next) {
- next(fs.createReadStream(FILE1));
- });
- combinedStream.append(function(next) {
- next(fs.createReadStream(FILE2));
- });
-
- var tmpFile = common.dir.tmp + '/combined.txt';
- var dest = fs.createWriteStream(tmpFile);
- combinedStream.pipe(dest);
-
- dest.on('end', function() {
- var written = fs.readFileSync(tmpFile, 'utf8');
- assert.strictEqual(written, EXPECTED);
- });
-})();
+++ /dev/null
-var common = require('../common');
-var assert = common.assert;
-var CombinedStream = common.CombinedStream;
-
-(function testDataSizeGetter() {
- var combinedStream = CombinedStream.create();
-
- assert.strictEqual(combinedStream.dataSize, 0);
-
- // Test one stream
- combinedStream._streams.push({dataSize: 10});
- combinedStream._updateDataSize();
- assert.strictEqual(combinedStream.dataSize, 10);
-
- // Test two streams
- combinedStream._streams.push({dataSize: 23});
- combinedStream._updateDataSize();
- assert.strictEqual(combinedStream.dataSize, 33);
-
- // Test currentStream
- combinedStream._currentStream = {dataSize: 20};
- combinedStream._updateDataSize();
- assert.strictEqual(combinedStream.dataSize, 53);
-
- // Test currentStream without dataSize
- combinedStream._currentStream = {};
- combinedStream._updateDataSize();
- assert.strictEqual(combinedStream.dataSize, 33);
-
- // Test stream function
- combinedStream._streams.push(function() {});
- combinedStream._updateDataSize();
- assert.strictEqual(combinedStream.dataSize, 33);
-})();
+++ /dev/null
-var common = require('../common');
-var assert = common.assert;
-var CombinedStream = common.CombinedStream;
-var fs = require('fs');
-
-var FILE1 = common.dir.fixture + '/file1.txt';
-var BUFFER = new Buffer('Bacon is delicious');
-var FILE2 = common.dir.fixture + '/file2.txt';
-var STRING = 'The € kicks the $\'s ass!';
-
-var EXPECTED =
- fs.readFileSync(FILE1)
- + BUFFER
- + fs.readFileSync(FILE2)
- + STRING;
-var GOT;
-
-(function testDelayedStreams() {
- var combinedStream = CombinedStream.create();
- combinedStream.append(fs.createReadStream(FILE1));
- combinedStream.append(BUFFER);
- combinedStream.append(fs.createReadStream(FILE2));
- combinedStream.append(function(next) {
- next(STRING);
- });
-
- var tmpFile = common.dir.tmp + '/combined-file1-buffer-file2-string.txt';
- var dest = fs.createWriteStream(tmpFile);
- combinedStream.pipe(dest);
-
- dest.on('close', function() {
- GOT = fs.readFileSync(tmpFile, 'utf8');
- });
-})();
-
-process.on('exit', function() {
- assert.strictEqual(GOT, EXPECTED);
-});
+++ /dev/null
-var common = require('../common');
-var assert = common.assert;
-var CombinedStream = common.CombinedStream;
-var fs = require('fs');
-
-var FILE1 = common.dir.fixture + '/file1.txt';
-var FILE2 = common.dir.fixture + '/file2.txt';
-var EXPECTED = fs.readFileSync(FILE1) + fs.readFileSync(FILE2);
-var GOT;
-
-(function testDelayedStreams() {
- var combinedStream = CombinedStream.create();
- combinedStream.append(fs.createReadStream(FILE1));
- combinedStream.append(fs.createReadStream(FILE2));
-
- var stream1 = combinedStream._streams[0];
- var stream2 = combinedStream._streams[1];
-
- stream1.on('end', function() {
- assert.equal(stream2.dataSize, 0);
- });
-
- var tmpFile = common.dir.tmp + '/combined.txt';
- var dest = fs.createWriteStream(tmpFile);
- combinedStream.pipe(dest);
-
- dest.on('close', function() {
- GOT = fs.readFileSync(tmpFile, 'utf8');
- });
-})();
-
-process.on('exit', function() {
- console.error(GOT.length, EXPECTED.length);
- assert.strictEqual(GOT, EXPECTED);
-});
+++ /dev/null
-var common = require('../common');
-var assert = common.assert;
-var CombinedStream = common.CombinedStream;
-var util = require('util');
-var Stream = require('stream').Stream;
-
-var s = CombinedStream.create();
-
-
-function StringStream(){
- this.writable=true;
- this.str=""
-}
-util.inherits(StringStream,Stream);
-
-StringStream.prototype.write=function(chunk,encoding){
- this.str+=chunk.toString();
- this.emit('data',chunk);
-}
-
-StringStream.prototype.end=function(chunk,encoding){
- this.emit('end');
-}
-
-StringStream.prototype.toString=function(){
- return this.str;
-}
-
-
-s.append("foo.");
-s.append("");
-s.append("bar");
-
-var ss = new StringStream();
-
-s.pipe(ss);
-s.resume();
-
-assert.equal(ss.toString(),"foo.bar");
+++ /dev/null
-var fs = require('fs');
-var common = require('../common');
-var assert = common.assert;
-var CombinedStream = common.CombinedStream;
-var FILE1 = common.dir.fixture + '/file1.txt';
-var fileStream = fs.createReadStream(FILE1);
-
-var foo = function(){};
-
-(function testIsStreamLike() {
- assert(! CombinedStream.isStreamLike(true));
- assert(! CombinedStream.isStreamLike("I am a string"));
- assert(! CombinedStream.isStreamLike(7));
- assert(! CombinedStream.isStreamLike(foo));
-
- assert(CombinedStream.isStreamLike(fileStream));
-})();
\ No newline at end of file
+++ /dev/null
-var common = require('../common');
-var assert = common.assert;
-var CombinedStream = common.CombinedStream;
-var fs = require('fs');
-
-var FILE1 = common.dir.fixture + '/file1.txt';
-var FILE2 = common.dir.fixture + '/file2.txt';
-var EXPECTED = fs.readFileSync(FILE1) + fs.readFileSync(FILE2);
-
-(function testDelayedStreams() {
- var combinedStream = CombinedStream.create({pauseStreams: false, maxDataSize: 20736});
- combinedStream.append(fs.createReadStream(FILE1));
- combinedStream.append(fs.createReadStream(FILE2));
-
- var gotErr = null;
- combinedStream.on('error', function(err) {
- gotErr = err;
- });
-
- process.on('exit', function() {
- assert.ok(gotErr);
- assert.ok(gotErr.message.match(/bytes/));
- });
-})();
+++ /dev/null
-var common = require('../common');
-var assert = common.assert;
-var CombinedStream = common.CombinedStream;
-var fs = require('fs');
-
-var FILE1 = common.dir.fixture + '/file1.txt';
-var FILE2 = common.dir.fixture + '/file2.txt';
-var EXPECTED = fs.readFileSync(FILE1) + fs.readFileSync(FILE2);
-
-(function testDelayedStreams() {
- var combinedStream = CombinedStream.create({pauseStreams: false});
- combinedStream.append(fs.createReadStream(FILE1));
- combinedStream.append(fs.createReadStream(FILE2));
-
- var stream1 = combinedStream._streams[0];
- var stream2 = combinedStream._streams[1];
-
- stream1.on('end', function() {
- assert.ok(stream2.dataSize > 0);
- });
-
- var tmpFile = common.dir.tmp + '/combined.txt';
- var dest = fs.createWriteStream(tmpFile);
- combinedStream.pipe(dest);
-
- dest.on('end', function() {
- var written = fs.readFileSync(tmpFile, 'utf8');
- assert.strictEqual(written, EXPECTED);
- });
-})();
+++ /dev/null
-#!/usr/bin/env node
-var far = require('far').create();
-
-far.add(__dirname);
-far.include(/test-.*\.js$/);
-
-far.execute();
"bugs": {
"url": "https://github.com/broofa/node-mime/issues"
},
- "homepage": "https://github.com/broofa/node-mime",
"_id": "mime@1.2.11",
- "_from": "mime@~1.2.9"
+ "dist": {
+ "shasum": "58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10",
+ "tarball": "http://registry.npmjs.org/mime/-/mime-1.2.11.tgz"
+ },
+ "_from": "mime@~1.2.11",
+ "_npmVersion": "1.3.6",
+ "_npmUser": {
+ "name": "broofa",
+ "email": "robert@broofa.com"
+ },
+ "maintainers": [
+ {
+ "name": "broofa",
+ "email": "robert@broofa.com"
+ },
+ {
+ "name": "bentomas",
+ "email": "benjamin@benjaminthomas.org"
+ }
+ ],
+ "directories": {},
+ "_shasum": "58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10",
+ "_resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz",
+ "homepage": "https://github.com/broofa/node-mime"
}
},
"name": "form-data",
"description": "A module to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.",
- "version": "0.1.2",
+ "version": "0.1.4",
"repository": {
"type": "git",
"url": "git://github.com/felixge/node-form-data.git"
"test": "node test/run.js"
},
"engines": {
- "node": ">= 0.6"
+ "node": ">= 0.8"
},
"dependencies": {
"combined-stream": "~0.0.4",
"mime": "~1.2.11",
- "async": "~0.2.9"
+ "async": "~0.9.0"
},
"licenses": [
{
"fake": "~0.2.2",
"far": "~0.0.7",
"formidable": "~1.0.14",
- "request": "~2.27.0"
+ "request": "~2.36.0"
},
- "readme": "# Form-Data [![Build Status](https://travis-ci.org/felixge/node-form-data.png?branch=master)](https://travis-ci.org/felixge/node-form-data) [![Dependency Status](https://gemnasium.com/felixge/node-form-data.png)](https://gemnasium.com/felixge/node-form-data)\n\nA module to create readable ```\"multipart/form-data\"``` streams. Can be used to submit forms and file uploads to other web applications.\n\nThe API of this module is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd].\n\n[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface\n[streams2-thing]: http://nodejs.org/api/stream.html#stream_compatibility_with_older_node_versions\n\n## Install\n\n```\nnpm install form-data\n```\n\n## Usage\n\nIn this example we are constructing a form with 3 fields that contain a string,\na buffer and a file stream.\n\n``` javascript\nvar FormData = require('form-data');\nvar fs = require('fs');\n\nvar form = new FormData();\nform.append('my_field', 'my value');\nform.append('my_buffer', new Buffer(10));\nform.append('my_file', fs.createReadStream('/foo/bar.jpg'));\n```\n\nAlso you can use http-response stream:\n\n``` javascript\nvar FormData = require('form-data');\nvar http = require('http');\n\nvar form = new FormData();\n\nhttp.request('http://nodejs.org/images/logo.png', function(response) {\n form.append('my_field', 'my value');\n form.append('my_buffer', new Buffer(10));\n form.append('my_logo', response);\n});\n```\n\nOr @mikeal's request stream:\n\n``` javascript\nvar FormData = require('form-data');\nvar request = require('request');\n\nvar form = new FormData();\n\nform.append('my_field', 'my value');\nform.append('my_buffer', new Buffer(10));\nform.append('my_logo', request('http://nodejs.org/images/logo.png'));\n```\n\nIn order to submit this form to a web application, call ```submit(url, [callback])``` method:\n\n``` javascript\nform.submit('http://example.org/', function(err, res) {\n // res – response object (http.IncomingMessage) //\n res.resume(); // for node-0.10.x\n});\n\n```\n\nFor more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods.\n\n### Alternative submission methods\n\nYou can use node's http client interface:\n\n``` javascript\nvar http = require('http');\n\nvar request = http.request({\n method: 'post',\n host: 'example.org',\n path: '/upload',\n headers: form.getHeaders()\n});\n\nform.pipe(request);\n\nrequest.on('response', function(res) {\n console.log(res.statusCode);\n});\n```\n\nOr if you would prefer the `'Content-Length'` header to be set for you:\n\n``` javascript\nform.submit('example.org/upload', function(err, res) {\n console.log(res.statusCode);\n});\n```\n\nTo use custom headers and pre-known length in parts:\n\n``` javascript\nvar CRLF = '\\r\\n';\nvar form = new FormData();\n\nvar options = {\n header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF,\n knownLength: 1\n};\n\nform.append('my_buffer', buffer, options);\n\nform.submit('http://example.com/', function(err, res) {\n if (err) throw err;\n console.log('Done');\n});\n```\n\nForm-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide \"file\"-related information manually:\n\n``` javascript\nsomeModule.stream(function(err, stdout, stderr) {\n if (err) throw err;\n\n var form = new FormData();\n\n form.append('file', stdout, {\n filename: 'unicycle.jpg',\n contentType: 'image/jpg',\n knownLength: 19806\n });\n\n form.submit('http://example.com/', function(err, res) {\n if (err) throw err;\n console.log('Done');\n });\n});\n```\n\nFor edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter:\n\n``` javascript\nform.submit({\n host: 'example.com',\n path: '/probably.php?extra=params',\n auth: 'username:password'\n}, function(err, res) {\n console.log(res.statusCode);\n});\n```\n\n## Notes\n\n- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround.\n- If it feels like FormData hangs after submit and you're on ```node-0.10```, please check [Compatibility with Older Node Versions][streams2-thing]\n\n## TODO\n\n- Add new streams (0.10) support and try really hard not to break it for 0.8.x.\n\n## License\n\nForm-Data is licensed under the MIT license.\n",
- "readmeFilename": "Readme.md",
+ "gitHead": "5f5f4809ea685f32658809fa0f13d7eface0e45a",
"bugs": {
"url": "https://github.com/felixge/node-form-data/issues"
},
"homepage": "https://github.com/felixge/node-form-data",
- "_id": "form-data@0.1.2",
- "_from": "form-data@~0.1.0"
+ "_id": "form-data@0.1.4",
+ "_shasum": "91abd788aba9702b1aabfa8bc01031a2ac9e3b12",
+ "_from": "form-data@~0.1.0",
+ "_npmVersion": "1.4.14",
+ "_npmUser": {
+ "name": "alexindigo",
+ "email": "iam@alexindigo.com"
+ },
+ "maintainers": [
+ {
+ "name": "felixge",
+ "email": "felix@debuggable.com"
+ },
+ {
+ "name": "idralyuk",
+ "email": "igor@buran.us"
+ },
+ {
+ "name": "alexindigo",
+ "email": "iam@alexindigo.com"
+ },
+ {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ },
+ {
+ "name": "celer",
+ "email": "dtyree77@gmail.com"
+ }
+ ],
+ "dist": {
+ "shasum": "91abd788aba9702b1aabfa8bc01031a2ac9e3b12",
+ "tarball": "http://registry.npmjs.org/form-data/-/form-data-0.1.4.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/form-data/-/form-data-0.1.4.tgz",
+ "readme": "ERROR: No README data found!"
}
-.idea
-*.iml
-npm-debug.log
-dump.rdb
-node_modules
-results.tap
-results.xml
-npm-shrinkwrap.json
-config.json
-.DS_Store
-*/.DS_Store
-*/*/.DS_Store
-._*
-*/._*
-*/*/._*
-coverage.*
-lib-cov
-
+.idea\r
+*.iml\r
+npm-debug.log\r
+dump.rdb\r
+node_modules\r
+results.tap\r
+results.xml\r
+npm-shrinkwrap.json\r
+config.json\r
+.DS_Store\r
+*/.DS_Store\r
+*/*/.DS_Store\r
+._*\r
+*/._*\r
+*/*/._*\r
+coverage.*\r
+lib-cov\r
+\r
-language: node_js
-
-node_js:
- - 0.10
-
+language: node_js\r
+\r
+node_js:\r
+ - 0.10\r
+\r
### Where can I find **Hawk** implementations in other languages?
-**Hawk**'s only reference implementation is provided in JavaScript as a node.js module. However, others are actively porting it to other
-platforms. There is already a [PHP](https://github.com/alexbilbie/PHP-Hawk),
-[.NET](https://github.com/pcibraro/hawknet), and [JAVA](https://github.com/wealdtech/hawk) libraries available. The full list
-is maintained [here](https://github.com/hueniverse/hawk/issues?labels=port). Please add an issue if you are working on another
-port. A cross-platform test-suite is in the works.
+**Hawk**'s only reference implementation is provided in JavaScript as a node.js module. However, it has been ported to other languages.
+The full list is maintained [here](https://github.com/hueniverse/hawk/issues?labels=port&state=closed). Please add an issue if you are
+working on another port. A cross-platform test-suite is in the works.
### Why isn't the algorithm part of the challenge or dynamically negotiated?
uri: 'http://example.com/resource?a=b'
method: HTTP verb (e.g. 'GET', 'POST')
options: {
-
+
// Required
-
+
credentials: {
id: 'dh37fgj492je',
key: 'aoijedoaijsdlaksjdl',
algorithm: 'sha256' // 'sha1', 'sha256'
},
-
+
// Optional
-
+
ext: 'application-specific', // Application specific data sent via the ext attribute
timestamp: Date.now() / 1000, // A pre-calculated timestamp in seconds
nonce: '2334f34f', // A pre-generated nonce
!method || typeof method !== 'string' ||
!options || typeof options !== 'object') {
+ result.err = 'Invalid argument type';
return result;
}
!credentials.key ||
!credentials.algorithm) {
- // Invalid credential object
+ result.err = 'Invalid credential object';
return result;
}
if (hawk.crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+ result.err = 'Unknown algorithm';
return result;
}
};
return result;
+ },
+
+ authenticateTimestamp: function (message, credentials, updateClock) { // updateClock defaults to true
+
+ var tsm = hawk.crypto.calculateTsMac(message.ts, credentials);
+ if (tsm !== message.tsm) {
+ return false;
+ }
+
+ if (updateClock !== false) {
+ hawk.utils.setNtpOffset(message.ts - Math.floor(Date.now() / 1000)); // Keep offset at 1 second precision
+ }
+
+ return true;
}
};
setNtpOffset: function (offset) {
- hawk.utils.storage.setItem('hawk_ntp_offset', offset);
+ try {
+ hawk.utils.storage.setItem('hawk_ntp_offset', offset);
+ }
+ catch (err) {
+ console.error('[hawk] could not write to storage.');
+ console.error(err);
+ }
},
getNtpOffset: function () {
!method || typeof method !== 'string' ||
!options || typeof options !== 'object') {
+ result.err = 'Invalid argument type';
return result;
}
!credentials.key ||
!credentials.algorithm) {
- // Invalid credential object
+ result.err = 'Invalid credential object';
return result;
}
if (Crypto.algorithms.indexOf(credentials.algorithm) === -1) {
+ result.err = 'Unknown algorithm';
return result;
}
return false;
}
+ // Validate server timestamp (not used to update clock since it is done via the SNPT client)
+
if (attributes.ts) {
var tsm = Crypto.calculateTsMac(attributes.ts, credentials);
if (tsm !== attributes.tsm) {
return hmac.digest('base64');
};
+
+exports.timestampMessage = function (credentials, localtimeOffsetMsec) {
+
+ var now = Math.floor((Utils.now() + (localtimeOffsetMsec || 0)) / 1000);
+ var tsm = exports.calculateTsMac(now, credentials);
+ return { ts: now, tsm: tsm };
+};
exports.error = exports.Error = require('boom');
exports.sntp = require('sntp');
+
exports.server = require('./server');
exports.client = require('./client');
exports.crypto = require('./crypto');
getBewit: exports.client.getBewit
};
-
// Check timestamp staleness
if (Math.abs((attributes.ts * 1000) - now) > (options.timestampSkewSec * 1000)) {
- var fresh = Math.floor((Utils.now() + (options.localtimeOffsetMsec || 0)) / 1000); // Get fresh now
- var tsm = Crypto.calculateTsMac(fresh, credentials);
- return callback(Boom.unauthorized('Stale timestamp', 'Hawk', { ts: fresh, tsm: tsm }), credentials, artifacts);
+ var tsm = Crypto.timestampMessage(credentials, options.localtimeOffsetMsec);
+ return callback(Boom.unauthorized('Stale timestamp', 'Hawk', tsm), credentials, artifacts);
}
// Successful authentication
"url": "http://github.com/spumko/boom/raw/master/LICENSE"
}
],
- "readme": "<a href=\"https://github.com/spumko\"><img src=\"https://raw.github.com/spumko/spumko/master/images/from.png\" align=\"right\" /></a>\n![boom Logo](https://raw.github.com/spumko/boom/master/images/boom.png)\n\nHTTP-friendly error objects\n\n[![Build Status](https://secure.travis-ci.org/spumko/boom.png)](http://travis-ci.org/spumko/boom)\n",
- "readmeFilename": "README.md",
+ "_id": "boom@0.4.2",
+ "dist": {
+ "shasum": "7a636e9ded4efcefb19cef4947a3c67dfaee911b",
+ "tarball": "http://registry.npmjs.org/boom/-/boom-0.4.2.tgz"
+ },
+ "_from": "boom@0.4.x",
+ "_npmVersion": "1.2.18",
+ "_npmUser": {
+ "name": "hueniverse",
+ "email": "eran@hueniverse.com"
+ },
+ "maintainers": [
+ {
+ "name": "hueniverse",
+ "email": "eran@hueniverse.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "7a636e9ded4efcefb19cef4947a3c67dfaee911b",
+ "_resolved": "https://registry.npmjs.org/boom/-/boom-0.4.2.tgz",
"bugs": {
"url": "https://github.com/spumko/boom/issues"
},
- "homepage": "https://github.com/spumko/boom",
- "_id": "boom@0.4.2",
- "_from": "boom@0.4.x"
+ "readme": "ERROR: No README data found!",
+ "homepage": "https://github.com/spumko/boom"
}
"url": "http://github.com/hueniverse/cryptiles/raw/master/LICENSE"
}
],
- "readme": "cryptiles\n=========\n\nGeneral purpose crypto utilities\n\n[![Build Status](https://secure.travis-ci.org/hueniverse/cryptiles.png)](http://travis-ci.org/hueniverse/cryptiles)\n",
- "readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/hueniverse/cryptiles/issues"
},
- "homepage": "https://github.com/hueniverse/cryptiles",
"_id": "cryptiles@0.2.2",
- "_from": "cryptiles@0.2.x"
+ "dist": {
+ "shasum": "ed91ff1f17ad13d3748288594f8a48a0d26f325c",
+ "tarball": "http://registry.npmjs.org/cryptiles/-/cryptiles-0.2.2.tgz"
+ },
+ "_from": "cryptiles@0.2.x",
+ "_npmVersion": "1.2.24",
+ "_npmUser": {
+ "name": "hueniverse",
+ "email": "eran@hueniverse.com"
+ },
+ "maintainers": [
+ {
+ "name": "hueniverse",
+ "email": "eran@hueniverse.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "ed91ff1f17ad13d3748288594f8a48a0d26f325c",
+ "_resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-0.2.2.tgz",
+ "readme": "ERROR: No README data found!",
+ "homepage": "https://github.com/hueniverse/cryptiles"
}
"url": "http://github.com/spumko/hoek/raw/master/LICENSE"
}
],
- "readme": "<a href=\"https://github.com/spumko\"><img src=\"https://raw.github.com/spumko/spumko/master/images/from.png\" align=\"right\" /></a>\r\n![hoek Logo](https://raw.github.com/spumko/hoek/master/images/hoek.png)\r\n\r\nGeneral purpose node utilities\r\n\r\n[![Build Status](https://secure.travis-ci.org/spumko/hoek.png)](http://travis-ci.org/spumko/hoek)\r\n\r\n# Table of Contents\r\n\r\n* [Introduction](#introduction \"Introduction\")\r\n* [Object](#object \"Object\")\r\n * [clone](#cloneobj \"clone\")\r\n * [merge](#mergetarget-source-isnulloverride-ismergearrays \"merge\")\r\n * [applyToDefaults](#applytodefaultsdefaults-options \"applyToDefaults\")\r\n * [unique](#uniquearray-key \"unique\")\r\n * [mapToObject](#maptoobjectarray-key \"mapToObject\")\r\n * [intersect](#intersectarray1-array2 \"intersect\")\r\n * [matchKeys](#matchkeysobj-keys \"matchKeys\")\r\n * [flatten](#flattenarray-target \"flatten\")\r\n * [removeKeys](#removekeysobject-keys \"removeKeys\")\r\n * [reach](#reachobj-chain \"reach\")\r\n * [inheritAsync](#inheritasyncself-obj-keys \"inheritAsync\")\r\n * [rename](#renameobj-from-to \"rename\")\r\n* [Timer](#timer \"Timer\")\r\n* [Binary Encoding/Decoding](#binary \"Binary Encoding/Decoding\")\r\n * [base64urlEncode](#binary64urlEncodevalue \"binary64urlEncode\")\r\n * [base64urlDecode](#binary64urlDecodevalue \"binary64urlDecode\")\r\n* [Escaping Characters](#escaped \"Escaping Characters\")\r\n * [escapeHtml](#escapeHtmlstring \"escapeHtml\")\r\n * [escapeHeaderAttribute](#escapeHeaderAttributeattribute \"escapeHeaderAttribute\")\r\n * [escapeRegex](#escapeRegexstring \"escapeRegex\")\r\n* [Errors](#errors \"Errors\")\r\n * [assert](#assertmessage \"assert\")\r\n * [abort](#abortmessage \"abort\")\r\n * [displayStack](#displayStackslice \"displayStack\")\r\n * [callStack](#callStackslice \"callStack\")\r\n * [toss](#tosscondition \"toss\")\r\n* [Load files](#load-files \"Load Files\")\r\n * [loadPackage](#loadPackagedir \"loadpackage\")\r\n * [loadDirModules](#loadDirModulespath-excludefiles-target \"loaddirmodules\")\r\n\r\n\r\n\r\n# Introduction\r\n\r\nThe *Hoek* general purpose node utilities library is used to aid in a variety of manners. It comes with useful methods for Arrays (clone, merge, applyToDefaults), Objects (removeKeys, copy), Asserting and more. \r\n\r\nFor example, to use Hoek to set configuration with default options:\r\n```javascript\r\nvar Hoek = require('hoek');\r\n\r\nvar default = {url : \"www.github.com\", port : \"8000\", debug : true}\r\n\r\nvar config = Hoek.applyToDefaults(default, {port : \"3000\", admin : true});\r\n\r\n// In this case, config would be { url: 'www.github.com', port: '3000', debug: true, admin: true }\r\n```\r\n\r\nUnder each of the sections (such as Array), there are subsections which correspond to Hoek methods. Each subsection will explain how to use the corresponding method. In each js excerpt below, the var Hoek = require('hoek') is omitted for brevity.\r\n\r\n## Object\r\n\r\nHoek provides several helpful methods for objects and arrays.\r\n\r\n### clone(obj)\r\n\r\nThis method is used to clone an object or an array. A *deep copy* is made (duplicates everything, including values that are objects). \r\n\r\n```javascript\r\n\r\nvar nestedObj = {\r\n w: /^something$/ig,\r\n x: {\r\n a: [1, 2, 3],\r\n b: 123456,\r\n c: new Date()\r\n },\r\n y: 'y',\r\n z: new Date()\r\n };\r\n\r\nvar copy = Hoek.clone(nestedObj);\r\n\r\ncopy.x.b = 100;\r\n\r\nconsole.log(copy.y) // results in 'y'\r\nconsole.log(nestedObj.x.b) // results in 123456\r\nconsole.log(copy.x.b) // results in 100\r\n```\r\n\r\n### merge(target, source, isNullOverride, isMergeArrays)\r\nisNullOverride, isMergeArrays default to true\r\n\r\nMerge all the properties of source into target, source wins in conflic, and by default null and undefined from source are applied\r\n\r\n\r\n```javascript\r\n\r\nvar target = {a: 1, b : 2}\r\nvar source = {a: 0, c: 5}\r\nvar source2 = {a: null, c: 5}\r\n\r\nvar targetArray = [1, 2, 3];\r\nvar sourceArray = [4, 5];\r\n\r\nvar newTarget = Hoek.merge(target, source); // results in {a: 0, b: 2, c: 5}\r\nnewTarget = Hoek.merge(target, source2); // results in {a: null, b: 2, c: 5}\r\nnewTarget = Hoek.merge(target, source2, false); // results in {a: 1, b: 2, c: 5}\r\n\r\nnewTarget = Hoek.merge(targetArray, sourceArray) // results in [1, 2, 3, 4, 5]\r\nnewTarget = Hoek.merge(targetArray, sourceArray, true, false) // results in [4, 5]\r\n\r\n\r\n\r\n\r\n```\r\n\r\n### applyToDefaults(defaults, options)\r\n\r\nApply options to a copy of the defaults\r\n\r\n```javascript\r\n\r\nvar defaults = {host: \"localhost\", port: 8000};\r\nvar options = {port: 8080};\r\n\r\nvar config = Hoek.applyToDefaults(defaults, options); // results in {host: \"localhost\", port: 8080};\r\n\r\n\r\n```\r\n\r\n### unique(array, key)\r\n\r\nRemove duplicate items from Array\r\n\r\n```javascript\r\n\r\nvar array = [1, 2, 2, 3, 3, 4, 5, 6];\r\n\r\nvar newArray = Hoek.unique(array); // results in [1,2,3,4,5,6];\r\n\r\narray = [{id: 1}, {id: 1}, {id: 2}];\r\n\r\nnewArray = Hoek.unique(array, \"id\") // results in [{id: 1}, {id: 2}]\r\n\r\n```\r\n\r\n### mapToObject(array, key)\r\n\r\nConvert an Array into an Object\r\n\r\n```javascript\r\n\r\nvar array = [1,2,3];\r\nvar newObject = Hoek.mapToObject(array); // results in [{\"1\": true}, {\"2\": true}, {\"3\": true}]\r\n\r\narray = [{id: 1}, {id: 2}];\r\nnewObject = Hoek.mapToObject(array, \"id\") // results in [{\"id\": 1}, {\"id\": 2}]\r\n\r\n```\r\n### intersect(array1, array2)\r\n\r\nFind the common unique items in two arrays\r\n\r\n```javascript\r\n\r\nvar array1 = [1, 2, 3];\r\nvar array2 = [1, 4, 5];\r\n\r\nvar newArray = Hoek.intersect(array1, array2) // results in [1]\r\n\r\n```\r\n\r\n### matchKeys(obj, keys) \r\n\r\nFind which keys are present\r\n\r\n```javascript\r\n\r\nvar obj = {a: 1, b: 2, c: 3};\r\nvar keys = [\"a\", \"e\"];\r\n\r\nHoek.matchKeys(obj, keys) // returns [\"a\"]\r\n\r\n```\r\n\r\n### flatten(array, target)\r\n\r\nFlatten an array\r\n\r\n```javascript\r\n\r\nvar array = [1, 2, 3];\r\nvar target = [4, 5]; \r\n\r\nvar flattenedArray = Hoek.flatten(array, target) // results in [4, 5, 1, 2, 3];\r\n\r\n```\r\n\r\n### removeKeys(object, keys)\r\n\r\nRemove keys\r\n\r\n```javascript\r\n\r\nvar object = {a: 1, b: 2, c: 3, d: 4};\r\n\r\nvar keys = [\"a\", \"b\"];\r\n\r\nHoek.removeKeys(object, keys) // object is now {c: 3, d: 4}\r\n\r\n```\r\n\r\n### reach(obj, chain)\r\n\r\nConverts an object key chain string to reference\r\n\r\n```javascript\r\n\r\nvar chain = 'a.b.c';\r\nvar obj = {a : {b : { c : 1}}};\r\n\r\nHoek.reach(obj, chain) // returns 1\r\n\r\n```\r\n\r\n### inheritAsync(self, obj, keys) \r\n\r\nInherits a selected set of methods from an object, wrapping functions in asynchronous syntax and catching errors\r\n\r\n```javascript\r\n\r\nvar targetFunc = function () { };\r\n\r\nvar proto = {\r\n a: function () {\r\n return 'a!';\r\n },\r\n b: function () {\r\n return 'b!';\r\n },\r\n c: function () {\r\n throw new Error('c!');\r\n }\r\n };\r\n\r\nvar keys = ['a', 'c'];\r\n\r\nHoek.inheritAsync(targetFunc, proto, ['a', 'c']);\r\n\r\nvar target = new targetFunc();\r\n\r\ntarget.a(function(err, result){console.log(result)} // returns 'a!' \r\n\r\ntarget.c(function(err, result){console.log(result)} // returns undefined\r\n\r\ntarget.b(function(err, result){console.log(result)} // gives error: Object [object Object] has no method 'b'\r\n\r\n```\r\n\r\n### rename(obj, from, to)\r\n\r\nRename a key of an object\r\n\r\n```javascript\r\n\r\nvar obj = {a : 1, b : 2};\r\n\r\nHoek.rename(obj, \"a\", \"c\"); // obj is now {c : 1, b : 2}\r\n\r\n```\r\n\r\n\r\n# Timer\r\n\r\nA Timer object. Initializing a new timer object sets the ts to the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.\r\n\r\n```javascript\r\n\r\n\r\nexample : \r\n\r\n\r\nvar timerObj = new Hoek.Timer();\r\nconsole.log(\"Time is now: \" + timerObj.ts)\r\nconsole.log(\"Elapsed time from initialization: \" + timerObj.elapsed() + 'milliseconds')\r\n\r\n```\r\n\r\n# Binary Encoding/Decoding\r\n\r\n### base64urlEncode(value)\r\n\r\nEncodes value in Base64 or URL encoding\r\n\r\n### base64urlDecode(value)\r\n\r\nDecodes data in Base64 or URL encoding.\r\n# Escaping Characters\r\n\r\nHoek provides convenient methods for escaping html characters. The escaped characters are as followed:\r\n\r\n```javascript\r\n\r\ninternals.htmlEscaped = {\r\n '&': '&',\r\n '<': '<',\r\n '>': '>',\r\n '\"': '"',\r\n \"'\": ''',\r\n '`': '`'\r\n};\r\n\r\n```\r\n\r\n### escapeHtml(string)\r\n\r\n```javascript\r\n\r\nvar string = '<html> hey </html>';\r\nvar escapedString = Hoek.escapeHtml(string); // returns <html> hey </html>\r\n\r\n```\r\n\r\n### escapeHeaderAttribute(attribute)\r\n\r\nEscape attribute value for use in HTTP header\r\n\r\n```javascript\r\n\r\nvar a = Hoek.escapeHeaderAttribute('I said \"go w\\\\o me\"'); //returns I said \\\"go w\\\\o me\\\"\r\n\r\n\r\n```\r\n\r\n\r\n### escapeRegex(string)\r\n\r\nEscape string for Regex construction\r\n\r\n```javascript\r\n\r\nvar a = Hoek.escapeRegex('4^f$s.4*5+-_?%=#!:@|~\\\\/`\"(>)[<]d{}s,'); // returns 4\\^f\\$s\\.4\\*5\\+\\-_\\?%\\=#\\!\\:@\\|~\\\\\\/`\"\\(>\\)\\[<\\]d\\{\\}s\\,\r\n\r\n\r\n\r\n```\r\n\r\n# Errors\r\n\r\n### assert(message)\r\n\r\n```javascript\r\n\r\nvar a = 1, b =2;\r\n\r\nHoek.assert(a === b, 'a should equal b'); // ABORT: a should equal b\r\n\r\n```\r\n\r\n### abort(message)\r\n\r\nFirst checks if process.env.NODE_ENV === 'test', and if so, throws error message. Otherwise,\r\ndisplays most recent stack and then exits process.\r\n\r\n\r\n\r\n### displayStack(slice)\r\n\r\nDisplays the trace stack\r\n\r\n```javascript\r\n\r\nvar stack = Hoek.displayStack();\r\nconsole.log(stack) // returns something like:\r\n\r\n[ 'null (/Users/user/Desktop/hoek/test.js:4:18)',\r\n 'Module._compile (module.js:449:26)',\r\n 'Module._extensions..js (module.js:467:10)',\r\n 'Module.load (module.js:356:32)',\r\n 'Module._load (module.js:312:12)',\r\n 'Module.runMain (module.js:492:10)',\r\n 'startup.processNextTick.process._tickCallback (node.js:244:9)' ]\r\n\r\n```\r\n\r\n### callStack(slice)\r\n\r\nReturns a trace stack array.\r\n\r\n```javascript\r\n\r\nvar stack = Hoek.callStack();\r\nconsole.log(stack) // returns something like:\r\n\r\n[ [ '/Users/user/Desktop/hoek/test.js', 4, 18, null, false ],\r\n [ 'module.js', 449, 26, 'Module._compile', false ],\r\n [ 'module.js', 467, 10, 'Module._extensions..js', false ],\r\n [ 'module.js', 356, 32, 'Module.load', false ],\r\n [ 'module.js', 312, 12, 'Module._load', false ],\r\n [ 'module.js', 492, 10, 'Module.runMain', false ],\r\n [ 'node.js',\r\n 244,\r\n 9,\r\n 'startup.processNextTick.process._tickCallback',\r\n false ] ]\r\n\r\n\r\n```\r\n\r\n### toss(condition)\r\n\r\ntoss(condition /*, [message], callback */)\r\n\r\nReturn an error as first argument of a callback\r\n\r\n\r\n# Load Files\r\n\r\n### loadPackage(dir)\r\n\r\nLoad and parse package.json process root or given directory\r\n\r\n```javascript\r\n\r\nvar pack = Hoek.loadPackage(); // pack.name === 'hoek'\r\n\r\n```\r\n\r\n### loadDirModules(path, excludeFiles, target) \r\n\r\nLoads modules from a given path; option to exclude files (array).\r\n\r\n\r\n\r\n\r\n",
- "readmeFilename": "README.md",
+ "_id": "hoek@0.9.1",
+ "dist": {
+ "shasum": "3d322462badf07716ea7eb85baf88079cddce505",
+ "tarball": "http://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz"
+ },
+ "_from": "hoek@0.9.x",
+ "_npmVersion": "1.2.18",
+ "_npmUser": {
+ "name": "hueniverse",
+ "email": "eran@hueniverse.com"
+ },
+ "maintainers": [
+ {
+ "name": "hueniverse",
+ "email": "eran@hueniverse.com"
+ },
+ {
+ "name": "thegoleffect",
+ "email": "thegoleffect@gmail.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "3d322462badf07716ea7eb85baf88079cddce505",
+ "_resolved": "https://registry.npmjs.org/hoek/-/hoek-0.9.1.tgz",
"bugs": {
"url": "https://github.com/spumko/hoek/issues"
},
- "homepage": "https://github.com/spumko/hoek",
- "_id": "hoek@0.9.1",
- "_from": "hoek@0.9.x"
+ "readme": "ERROR: No README data found!",
+ "homepage": "https://github.com/spumko/hoek"
}
"url": "http://github.com/hueniverse/sntp/raw/master/LICENSE"
}
],
- "readme": "# sntp\n\nAn SNTP v4 client (RFC4330) for node. Simpy connects to the NTP or SNTP server requested and returns the server time\nalong with the roundtrip duration and clock offset. To adjust the local time to the NTP time, add the returned `t` offset\nto the local time.\n\n[![Build Status](https://secure.travis-ci.org/hueniverse/sntp.png)](http://travis-ci.org/hueniverse/sntp)\n\n# Usage\n\n```javascript\nvar Sntp = require('sntp');\n\n// All options are optional\n\nvar options = {\n host: 'nist1-sj.ustiming.org', // Defaults to pool.ntp.org\n port: 123, // Defaults to 123 (NTP)\n resolveReference: true, // Default to false (not resolving)\n timeout: 1000 // Defaults to zero (no timeout)\n};\n\n// Request server time\n\nSntp.time(options, function (err, time) {\n\n if (err) {\n console.log('Failed: ' + err.message);\n process.exit(1);\n }\n\n console.log('Local clock is off by: ' + time.t + ' milliseconds');\n process.exit(0);\n});\n```\n\nIf an application needs to maintain continuous time synchronization, the module provides a stateful method for\nquerying the current offset only when the last one is too old (defaults to daily).\n\n```javascript\n// Request offset once\n\nSntp.offset(function (err, offset) {\n\n console.log(offset); // New (served fresh)\n\n // Request offset again\n\n Sntp.offset(function (err, offset) {\n\n console.log(offset); // Identical (served from cache)\n });\n});\n```\n\nTo set a background offset refresh, start the interval and use the provided now() method. If for any reason the\nclient fails to obtain an up-to-date offset, the current system clock is used.\n\n```javascript\nvar before = Sntp.now(); // System time without offset\n\nSntp.start(function () {\n\n var now = Sntp.now(); // With offset\n Sntp.stop();\n});\n```\n\n",
- "readmeFilename": "README.md",
+ "_id": "sntp@0.2.4",
+ "dist": {
+ "shasum": "fb885f18b0f3aad189f824862536bceeec750900",
+ "tarball": "http://registry.npmjs.org/sntp/-/sntp-0.2.4.tgz"
+ },
+ "_from": "sntp@0.2.x",
+ "_npmVersion": "1.2.18",
+ "_npmUser": {
+ "name": "hueniverse",
+ "email": "eran@hueniverse.com"
+ },
+ "maintainers": [
+ {
+ "name": "hueniverse",
+ "email": "eran@hueniverse.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "fb885f18b0f3aad189f824862536bceeec750900",
+ "_resolved": "https://registry.npmjs.org/sntp/-/sntp-0.2.4.tgz",
"bugs": {
"url": "https://github.com/hueniverse/sntp/issues"
},
- "homepage": "https://github.com/hueniverse/sntp",
- "_id": "sntp@0.2.4",
- "_from": "sntp@0.2.x"
+ "readme": "ERROR: No README data found!",
+ "homepage": "https://github.com/hueniverse/sntp"
}
{
"name": "hawk",
"description": "HTTP Hawk Authentication Scheme",
- "version": "1.0.0",
+ "version": "1.1.1",
"author": {
"name": "Eran Hammer",
"email": "eran@hueniverse.com",
"url": "http://github.com/hueniverse/hawk/raw/master/LICENSE"
}
],
- "readme": "![hawk Logo](https://raw.github.com/hueniverse/hawk/master/images/hawk.png)\n\n<img align=\"right\" src=\"https://raw.github.com/hueniverse/hawk/master/images/logo.png\" /> **Hawk** is an HTTP authentication scheme using a message authentication code (MAC) algorithm to provide partial\nHTTP request cryptographic verification. For more complex use cases such as access delegation, see [Oz](https://github.com/hueniverse/oz).\n\nCurrent version: **1.0**\n\n[![Build Status](https://secure.travis-ci.org/hueniverse/hawk.png)](http://travis-ci.org/hueniverse/hawk)\n\n# Table of Content\n\n- [**Introduction**](#introduction)\n - [Replay Protection](#replay-protection)\n - [Usage Example](#usage-example)\n - [Protocol Example](#protocol-example)\n - [Payload Validation](#payload-validation)\n - [Response Payload Validation](#response-payload-validation)\n - [Browser Support and Considerations](#browser-support-and-considerations)\n<p></p>\n- [**Single URI Authorization**](#single-uri-authorization)\n - [Usage Example](#bewit-usage-example)\n<p></p>\n- [**Security Considerations**](#security-considerations)\n - [MAC Keys Transmission](#mac-keys-transmission)\n - [Confidentiality of Requests](#confidentiality-of-requests)\n - [Spoofing by Counterfeit Servers](#spoofing-by-counterfeit-servers)\n - [Plaintext Storage of Credentials](#plaintext-storage-of-credentials)\n - [Entropy of Keys](#entropy-of-keys)\n - [Coverage Limitations](#coverage-limitations)\n - [Future Time Manipulation](#future-time-manipulation)\n - [Client Clock Poisoning](#client-clock-poisoning)\n - [Bewit Limitations](#bewit-limitations)\n - [Host Header Forgery](#host-header-forgery)\n<p></p>\n- [**Frequently Asked Questions**](#frequently-asked-questions)\n<p></p>\n- [**Acknowledgements**](#acknowledgements)\n\n# Introduction\n\n**Hawk** is an HTTP authentication scheme providing mechanisms for making authenticated HTTP requests with\npartial cryptographic verification of the request and response, covering the HTTP method, request URI, host,\nand optionally the request payload.\n\nSimilar to the HTTP [Digest access authentication schemes](http://www.ietf.org/rfc/rfc2617.txt), **Hawk** uses a set of\nclient credentials which include an identifier (e.g. username) and key (e.g. password). Likewise, just as with the Digest scheme,\nthe key is never included in authenticated requests. Instead, it is used to calculate a request MAC value which is\nincluded in its place.\n\nHowever, **Hawk** has several differences from Digest. In particular, while both use a nonce to limit the possibility of\nreplay attacks, in **Hawk** the client generates the nonce and uses it in combination with a timestamp, leading to less\n\"chattiness\" (interaction with the server).\n\nAlso unlike Digest, this scheme is not intended to protect the key itself (the password in Digest) because\nthe client and server must both have access to the key material in the clear.\n\nThe primary design goals of this scheme are to:\n* simplify and improve HTTP authentication for services that are unwilling or unable to deploy TLS for all resources,\n* secure credentials against leakage (e.g., when the client uses some form of dynamic configuration to determine where\n to send an authenticated request), and\n* avoid the exposure of credentials sent to a malicious server over an unauthenticated secure channel due to client\n failure to validate the server's identity as part of its TLS handshake.\n\nIn addition, **Hawk** supports a method for granting third-parties temporary access to individual resources using\na query parameter called _bewit_ (in falconry, a leather strap used to attach a tracking device to the leg of a hawk).\n\nThe **Hawk** scheme requires the establishment of a shared symmetric key between the client and the server,\nwhich is beyond the scope of this module. Typically, the shared credentials are established via an initial\nTLS-protected phase or derived from some other shared confidential information available to both the client\nand the server.\n\n\n## Replay Protection\n\nWithout replay protection, an attacker can use a compromised (but otherwise valid and authenticated) request more \nthan once, gaining access to a protected resource. To mitigate this, clients include both a nonce and a timestamp when \nmaking requests. This gives the server enough information to prevent replay attacks.\n\nThe nonce is generated by the client, and is a string unique across all requests with the same timestamp and\nkey identifier combination. \n\nThe timestamp enables the server to restrict the validity period of the credentials where requests occuring afterwards\nare rejected. It also removes the need for the server to retain an unbounded number of nonce values for future checks.\nBy default, **Hawk** uses a time window of 1 minute to allow for time skew between the client and server (which in\npractice translates to a maximum of 2 minutes as the skew can be positive or negative).\n\nUsing a timestamp requires the client's clock to be in sync with the server's clock. **Hawk** requires both the client\nclock and the server clock to use NTP to ensure synchronization. However, given the limitations of some client types\n(e.g. browsers) to deploy NTP, the server provides the client with its current time (in seconds precision) in response\nto a bad timestamp.\n\nThere is no expectation that the client will adjust its system clock to match the server (in fact, this would be a\npotential attack vector). Instead, the client only uses the server's time to calculate an offset used only\nfor communications with that particular server. The protocol rewards clients with synchronized clocks by reducing\nthe number of round trips required to authenticate the first request.\n\n\n## Usage Example\n\nServer code:\n\n```javascript\nvar Http = require('http');\nvar Hawk = require('hawk');\n\n\n// Credentials lookup function\n\nvar credentialsFunc = function (id, callback) {\n\n var credentials = {\n key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',\n algorithm: 'sha256',\n user: 'Steve'\n };\n\n return callback(null, credentials);\n};\n\n// Create HTTP server\n\nvar handler = function (req, res) {\n\n // Authenticate incoming request\n\n Hawk.server.authenticate(req, credentialsFunc, {}, function (err, credentials, artifacts) {\n\n // Prepare response\n\n var payload = (!err ? 'Hello ' + credentials.user + ' ' + artifacts.ext : 'Shoosh!');\n var headers = { 'Content-Type': 'text/plain' };\n\n // Generate Server-Authorization response header\n\n var header = Hawk.server.header(credentials, artifacts, { payload: payload, contentType: headers['Content-Type'] });\n headers['Server-Authorization'] = header;\n\n // Send the response back\n\n res.writeHead(!err ? 200 : 401, headers);\n res.end(payload);\n });\n};\n\n// Start server\n\nHttp.createServer(handler).listen(8000, 'example.com');\n```\n\nClient code:\n\n```javascript\nvar Request = require('request');\nvar Hawk = require('hawk');\n\n\n// Client credentials\n\nvar credentials = {\n id: 'dh37fgj492je',\n key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',\n algorithm: 'sha256'\n}\n\n// Request options\n\nvar requestOptions = {\n uri: 'http://example.com:8000/resource/1?b=1&a=2',\n method: 'GET',\n headers: {}\n};\n\n// Generate Authorization request header\n\nvar header = Hawk.client.header('http://example.com:8000/resource/1?b=1&a=2', 'GET', { credentials: credentials, ext: 'some-app-data' });\nrequestOptions.headers.Authorization = header.field;\n\n// Send authenticated request\n\nRequest(requestOptions, function (error, response, body) {\n\n // Authenticate the server's response\n\n var isValid = Hawk.client.authenticate(response, credentials, header.artifacts, { payload: body });\n\n // Output results\n\n console.log(response.statusCode + ': ' + body + (isValid ? ' (valid)' : ' (invalid)'));\n});\n```\n\n**Hawk** utilized the [**SNTP**](https://github.com/hueniverse/sntp) module for time sync management. By default, the local\nmachine time is used. To automatically retrieve and synchronice the clock within the application, use the SNTP 'start()' method.\n\n```javascript\nHawk.sntp.start();\n```\n\n\n## Protocol Example\n\nThe client attempts to access a protected resource without authentication, sending the following HTTP request to\nthe resource server:\n\n```\nGET /resource/1?b=1&a=2 HTTP/1.1\nHost: example.com:8000\n```\n\nThe resource server returns an authentication challenge.\n\n```\nHTTP/1.1 401 Unauthorized\nWWW-Authenticate: Hawk\n```\n\nThe client has previously obtained a set of **Hawk** credentials for accessing resources on the \"http://example.com/\"\nserver. The **Hawk** credentials issued to the client include the following attributes:\n\n* Key identifier: dh37fgj492je\n* Key: werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn\n* Algorithm: sha256\n\nThe client generates the authentication header by calculating a timestamp (e.g. the number of seconds since January 1,\n1970 00:00:00 GMT), generating a nonce, and constructing the normalized request string (each value followed by a newline\ncharacter):\n\n```\nhawk.1.header\n1353832234\nj4h3g2\nGET\n/resource/1?b=1&a=2\nexample.com\n8000\n\nsome-app-ext-data\n\n```\n\nThe request MAC is calculated using HMAC with the specified hash algorithm \"sha256\" and the key over the normalized request string.\nThe result is base64-encoded to produce the request MAC:\n\n```\n6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE=\n```\n\nThe client includes the **Hawk** key identifier, timestamp, nonce, application specific data, and request MAC with the request using\nthe HTTP `Authorization` request header field:\n\n```\nGET /resource/1?b=1&a=2 HTTP/1.1\nHost: example.com:8000\nAuthorization: Hawk id=\"dh37fgj492je\", ts=\"1353832234\", nonce=\"j4h3g2\", ext=\"some-app-ext-data\", mac=\"6R4rV5iE+NPoym+WwjeHzjAGXUtLNIxmo1vpMofpLAE=\"\n```\n\nThe server validates the request by calculating the request MAC again based on the request received and verifies the validity\nand scope of the **Hawk** credentials. If valid, the server responds with the requested resource.\n\n\n### Payload Validation\n\n**Hawk** provides optional payload validation. When generating the authentication header, the client calculates a payload hash\nusing the specified hash algorithm. The hash is calculated over the concatenated value of (each followed by a newline character):\n* `hawk.1.payload`\n* the content-type in lowercase, without any parameters (e.g. `application/json`)\n* the request payload prior to any content encoding (the exact representation requirements should be specified by the server for payloads other than simple single-part ascii to ensure interoperability)\n\nFor example:\n\n* Payload: `Thank you for flying Hawk`\n* Content Type: `text/plain`\n* Hash (sha256): `Yi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=`\n\nResults in the following input to the payload hash function (newline terminated values):\n\n```\nhawk.1.payload\ntext/plain\nThank you for flying Hawk\n\n```\n\nWhich produces the following hash value:\n\n```\nYi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=\n```\n\nThe client constructs the normalized request string (newline terminated values):\n\n```\nhawk.1.header\n1353832234\nj4h3g2\nPOST\n/resource/1?a=1&b=2\nexample.com\n8000\nYi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=\nsome-app-ext-data\n\n```\n\nThen calculates the request MAC and includes the **Hawk** key identifier, timestamp, nonce, payload hash, application specific data,\nand request MAC, with the request using the HTTP `Authorization` request header field:\n\n```\nPOST /resource/1?a=1&b=2 HTTP/1.1\nHost: example.com:8000\nAuthorization: Hawk id=\"dh37fgj492je\", ts=\"1353832234\", nonce=\"j4h3g2\", hash=\"Yi9LfIIFRtBEPt74PVmbTF/xVAwPn7ub15ePICfgnuY=\", ext=\"some-app-ext-data\", mac=\"aSe1DERmZuRl3pI36/9BdZmnErTw3sNzOOAUlfeKjVw=\"\n```\n\nIt is up to the server if and when it validates the payload for any given request, based solely on it's security policy\nand the nature of the data included.\n\nIf the payload is available at the time of authentication, the server uses the hash value provided by the client to construct\nthe normalized string and validates the MAC. If the MAC is valid, the server calculates the payload hash and compares the value\nwith the provided payload hash in the header. In many cases, checking the MAC first is faster than calculating the payload hash.\n\nHowever, if the payload is not available at authentication time (e.g. too large to fit in memory, streamed elsewhere, or processed\nat a different stage in the application), the server may choose to defer payload validation for later by retaining the hash value\nprovided by the client after validating the MAC.\n\nIt is important to note that MAC validation does not mean the hash value provided by the client is valid, only that the value\nincluded in the header was not modified. Without calculating the payload hash on the server and comparing it to the value provided\nby the client, the payload may be modified by an attacker.\n\n\n## Response Payload Validation\n\n**Hawk** provides partial response payload validation. The server includes the `Server-Authorization` response header which enables the\nclient to authenticate the response and ensure it is talking to the right server. **Hawk** defines the HTTP `Server-Authorization` header\nas a response header using the exact same syntax as the `Authorization` request header field.\n\nThe header is contructed using the same process as the client's request header. The server uses the same credentials and other\nartifacts provided by the client to constructs the normalized request string. The `ext` and `hash` values are replaced with\nnew values based on the server response. The rest as identical to those used by the client.\n\nThe result MAC digest is included with the optional `hash` and `ext` values:\n\n```\nServer-Authorization: Hawk mac=\"XIJRsMl/4oL+nn+vKoeVZPdCHXB4yJkNnBbTbHFZUYE=\", hash=\"f9cDF/TDm7TkYRLnGwRMfeDzT6LixQVLvrIKhh0vgmM=\", ext=\"response-specific\"\n```\n\n\n## Browser Support and Considerations\n\nA browser script is provided for including using a `<script>` tag in [lib/browser.js](/lib/browser.js).\n\n**Hawk** relies on the _Server-Authorization_ and _WWW-Authenticate_ headers in its response to communicate with the client.\nTherefore, in case of CORS requests, it is important to consider sending _Access-Control-Expose-Headers_ with the value\n_\"WWW-Authenticate, Server-Authorization\"_ on each response from your server. As explained in the\n[specifications](http://www.w3.org/TR/cors/#access-control-expose-headers-response-header), it will indicate that these headers\ncan safely be accessed by the client (using getResponseHeader() on the XmlHttpRequest object). Otherwise you will be met with a\n[\"simple response header\"](http://www.w3.org/TR/cors/#simple-response-header) which excludes these fields and would prevent the\nHawk client from authenticating the requests.You can read more about the why and how in this\n[article](http://www.html5rocks.com/en/tutorials/cors/#toc-adding-cors-support-to-the-server)\n\n\n# Single URI Authorization\n\nThere are cases in which limited and short-term access to a protected resource is granted to a third party which does not\nhave access to the shared credentials. For example, displaying a protected image on a web page accessed by anyone. **Hawk**\nprovides limited support for such URIs in the form of a _bewit_ - a URI query parameter appended to the request URI which contains\nthe necessary credentials to authenticate the request.\n\nBecause of the significant security risks involved in issuing such access, bewit usage is purposely limited only to GET requests\nand for a finite period of time. Both the client and server can issue bewit credentials, however, the server should not use the same\ncredentials as the client to maintain clear traceability as to who issued which credentials.\n\nIn order to simplify implementation, bewit credentials do not support single-use policy and can be replayed multiple times within\nthe granted access timeframe. \n\n\n## Bewit Usage Example\n\nServer code:\n\n```javascript\nvar Http = require('http');\nvar Hawk = require('hawk');\n\n\n// Credentials lookup function\n\nvar credentialsFunc = function (id, callback) {\n\n var credentials = {\n key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',\n algorithm: 'sha256'\n };\n\n return callback(null, credentials);\n};\n\n// Create HTTP server\n\nvar handler = function (req, res) {\n\n Hawk.uri.authenticate(req, credentialsFunc, {}, function (err, credentials, attributes) {\n\n res.writeHead(!err ? 200 : 401, { 'Content-Type': 'text/plain' });\n res.end(!err ? 'Access granted' : 'Shoosh!');\n });\n};\n\nHttp.createServer(handler).listen(8000, 'example.com');\n```\n\nBewit code generation:\n\n```javascript\nvar Request = require('request');\nvar Hawk = require('hawk');\n\n\n// Client credentials\n\nvar credentials = {\n id: 'dh37fgj492je',\n key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',\n algorithm: 'sha256'\n}\n\n// Generate bewit\n\nvar duration = 60 * 5; // 5 Minutes\nvar bewit = Hawk.uri.getBewit('http://example.com:8080/resource/1?b=1&a=2', { credentials: credentials, ttlSec: duration, ext: 'some-app-data' });\nvar uri = 'http://example.com:8000/resource/1?b=1&a=2' + '&bewit=' + bewit;\n```\n\n\n# Security Considerations\n\nThe greatest sources of security risks are usually found not in **Hawk** but in the policies and procedures surrounding its use.\nImplementers are strongly encouraged to assess how this module addresses their security requirements. This section includes\nan incomplete list of security considerations that must be reviewed and understood before deploying **Hawk** on the server.\nMany of the protections provided in **Hawk** depends on whether and how they are used.\n\n### MAC Keys Transmission\n\n**Hawk** does not provide any mechanism for obtaining or transmitting the set of shared credentials required. Any mechanism used\nto obtain **Hawk** credentials must ensure that these transmissions are protected using transport-layer mechanisms such as TLS.\n\n### Confidentiality of Requests\n\nWhile **Hawk** provides a mechanism for verifying the integrity of HTTP requests, it provides no guarantee of request\nconfidentiality. Unless other precautions are taken, eavesdroppers will have full access to the request content. Servers should\ncarefully consider the types of data likely to be sent as part of such requests, and employ transport-layer security mechanisms\nto protect sensitive resources.\n\n### Spoofing by Counterfeit Servers\n\n**Hawk** provides limited verification of the server authenticity. When receiving a response back from the server, the server\nmay choose to include a response `Server-Authorization` header which the client can use to verify the response. However, it is up to\nthe server to determine when such measure is included, to up to the client to enforce that policy.\n\nA hostile party could take advantage of this by intercepting the client's requests and returning misleading or otherwise\nincorrect responses. Service providers should consider such attacks when developing services using this protocol, and should\nrequire transport-layer security for any requests where the authenticity of the resource server or of server responses is an issue.\n\n### Plaintext Storage of Credentials\n\nThe **Hawk** key functions the same way passwords do in traditional authentication systems. In order to compute the request MAC,\nthe server must have access to the key in plaintext form. This is in contrast, for example, to modern operating systems, which\nstore only a one-way hash of user credentials.\n\nIf an attacker were to gain access to these keys - or worse, to the server's database of all such keys - he or she would be able\nto perform any action on behalf of any resource owner. Accordingly, it is critical that servers protect these keys from unauthorized\naccess.\n\n### Entropy of Keys\n\nUnless a transport-layer security protocol is used, eavesdroppers will have full access to authenticated requests and request\nMAC values, and will thus be able to mount offline brute-force attacks to recover the key used. Servers should be careful to\nassign keys which are long enough, and random enough, to resist such attacks for at least the length of time that the **Hawk**\ncredentials are valid.\n\nFor example, if the credentials are valid for two weeks, servers should ensure that it is not possible to mount a brute force\nattack that recovers the key in less than two weeks. Of course, servers are urged to err on the side of caution, and use the\nlongest key reasonable.\n\nIt is equally important that the pseudo-random number generator (PRNG) used to generate these keys be of sufficiently high\nquality. Many PRNG implementations generate number sequences that may appear to be random, but which nevertheless exhibit\npatterns or other weaknesses which make cryptanalysis or brute force attacks easier. Implementers should be careful to use\ncryptographically secure PRNGs to avoid these problems.\n\n### Coverage Limitations\n\nThe request MAC only covers the HTTP `Host` header and optionally the `Content-Type` header. It does not cover any other headers\nwhich can often affect how the request body is interpreted by the server. If the server behavior is influenced by the presence\nor value of such headers, an attacker can manipulate the request headers without being detected. Implementers should use the\n`ext` feature to pass application-specific information via the `Authorization` header which is protected by the request MAC.\n\nThe response authentication, when performed, only covers the response payload, content-type, and the request information \nprovided by the client in it's request (method, resource, timestamp, nonce, etc.). It does not cover the HTTP status code or\nany other response header field (e.g. Location) which can affect the client's behaviour.\n\n### Future Time Manipulation\n\nThe protocol relies on a clock sync between the client and server. To accomplish this, the server informs the client of its\ncurrent time when an invalid timestamp is received.\n\nIf an attacker is able to manipulate this information and cause the client to use an incorrect time, it would be able to cause\nthe client to generate authenticated requests using time in the future. Such requests will fail when sent by the client, and will\nnot likely leave a trace on the server (given the common implementation of nonce, if at all enforced). The attacker will then\nbe able to replay the request at the correct time without detection.\n\nThe client must only use the time information provided by the server if:\n* it was delivered over a TLS connection and the server identity has been verified, or\n* the `tsm` MAC digest calculated using the same client credentials over the timestamp has been verified.\n\n### Client Clock Poisoning\n\nWhen receiving a request with a bad timestamp, the server provides the client with its current time. The client must never use\nthe time received from the server to adjust its own clock, and must only use it to calculate an offset for communicating with\nthat particular server.\n\n### Bewit Limitations\n\nSpecial care must be taken when issuing bewit credentials to third parties. Bewit credentials are valid until expiration and cannot\nbe revoked or limited without using other means. Whatever resource they grant access to will be completely exposed to anyone with\naccess to the bewit credentials which act as bearer credentials for that particular resource. While bewit usage is limited to GET\nrequests only and therefore cannot be used to perform transactions or change server state, it can still be used to expose private\nand sensitive information.\n\n### Host Header Forgery\n\nHawk validates the incoming request MAC against the incoming HTTP Host header. However, unless the optional `host` and `port`\noptions are used with `server.authenticate()`, a malicous client can mint new host names pointing to the server's IP address and\nuse that to craft an attack by sending a valid request that's meant for another hostname than the one used by the server. Server\nimplementors must manually verify that the host header received matches their expectation (or use the options mentioned above).\n\n# Frequently Asked Questions\n\n### Where is the protocol specification?\n\nIf you are looking for some prose explaining how all this works, **this is it**. **Hawk** is being developed as an open source\nproject instead of a standard. In other words, the [code](/hueniverse/hawk/tree/master/lib) is the specification. Not sure about\nsomething? Open an issue!\n\n### Is it done?\n\nAt if version 0.10.0, **Hawk** is feature-complete. However, until this module reaches version 1.0.0 it is considered experimental\nand is likely to change. This also means your feedback and contribution are very welcome. Feel free to open issues with questions\nand suggestions.\n\n### Where can I find **Hawk** implementations in other languages?\n\n**Hawk**'s only reference implementation is provided in JavaScript as a node.js module. However, others are actively porting it to other\nplatforms. There is already a [PHP](https://github.com/alexbilbie/PHP-Hawk),\n[.NET](https://github.com/pcibraro/hawknet), and [JAVA](https://github.com/wealdtech/hawk) libraries available. The full list\nis maintained [here](https://github.com/hueniverse/hawk/issues?labels=port). Please add an issue if you are working on another\nport. A cross-platform test-suite is in the works.\n\n### Why isn't the algorithm part of the challenge or dynamically negotiated?\n\nThe algorithm used is closely related to the key issued as different algorithms require different key sizes (and other\nrequirements). While some keys can be used for multiple algorithm, the protocol is designed to closely bind the key and algorithm\ntogether as part of the issued credentials.\n\n### Why is Host and Content-Type the only headers covered by the request MAC?\n\nIt is really hard to include other headers. Headers can be changed by proxies and other intermediaries and there is no\nwell-established way to normalize them. Many platforms change the case of header field names and values. The only\nstraight-forward solution is to include the headers in some blob (say, base64 encoded JSON) and include that with the request,\nan approach taken by JWT and other such formats. However, that design violates the HTTP header boundaries, repeats information,\nand introduces other security issues because firewalls will not be aware of these \"hidden\" headers. In addition, any information\nrepeated must be compared to the duplicated information in the header and therefore only moves the problem elsewhere.\n\n### Why not just use HTTP Digest?\n\nDigest requires pre-negotiation to establish a nonce. This means you can't just make a request - you must first send\na protocol handshake to the server. This pattern has become unacceptable for most web services, especially mobile\nwhere extra round-trip are costly.\n\n### Why bother with all this nonce and timestamp business?\n\n**Hawk** is an attempt to find a reasonable, practical compromise between security and usability. OAuth 1.0 got timestamp\nand nonces halfway right but failed when it came to scalability and consistent developer experience. **Hawk** addresses\nit by requiring the client to sync its clock, but provides it with tools to accomplish it.\n\nIn general, replay protection is a matter of application-specific threat model. It is less of an issue on a TLS-protected\nsystem where the clients are implemented using best practices and are under the control of the server. Instead of dropping\nreplay protection, **Hawk** offers a required time window and an optional nonce verification. Together, it provides developers\nwith the ability to decide how to enforce their security policy without impacting the client's implementation.\n\n### What are `app` and `dlg` in the authorization header and normalized mac string?\n\nThe original motivation for **Hawk** was to replace the OAuth 1.0 use cases. This included both a simple client-server mode which\nthis module is specifically designed for, and a delegated access mode which is being developed separately in\n[Oz](https://github.com/hueniverse/oz). In addition to the **Hawk** use cases, Oz requires another attribute: the application id `app`.\nThis provides binding between the credentials and the application in a way that prevents an attacker from tricking an application\nto use credentials issued to someone else. It also has an optional 'delegated-by' attribute `dlg` which is the application id of the\napplication the credentials were directly issued to. The goal of these two additions is to allow Oz to utilize **Hawk** directly,\nbut with the additional security of delegated credentials.\n\n### What is the purpose of the static strings used in each normalized MAC input?\n\nWhen calculating a hash or MAC, a static prefix (tag) is added. The prefix is used to prevent MAC values from being\nused or reused for a purpose other than what they were created for (i.e. prevents switching MAC values between a request,\nresponse, and a bewit use cases). It also protects against expliots created after a potential change in how the protocol\ncreates the normalized string. For example, if a future version would switch the order of nonce and timestamp, it\ncan create an exploit opportunity for cases where the nonce is similar in format to a timestamp.\n\n### Does **Hawk** have anything to do with OAuth?\n\nShort answer: no.\n\n**Hawk** was originally proposed as the OAuth MAC Token specification. However, the OAuth working group in its consistent\nincompetence failed to produce a final, usable solution to address one of the most popular use cases of OAuth 1.0 - using it\nto authenticate simple client-server transactions (i.e. two-legged). As you can guess, the OAuth working group is still hard\nat work to produce more garbage.\n\n**Hawk** provides a simple HTTP authentication scheme for making client-server requests. It does not address the OAuth use case\nof delegating access to a third party. If you are looking for an OAuth alternative, check out [Oz](https://github.com/hueniverse/oz).\n\n\n# Acknowledgements\n\n**Hawk** is a derivative work of the [HTTP MAC Authentication Scheme](http://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token-05) proposal\nco-authored by Ben Adida, Adam Barth, and Eran Hammer, which in turn was based on the OAuth 1.0 community specification.\n\nSpecial thanks to Ben Laurie for his always insightful feedback and advice.\n\nThe **Hawk** logo was created by [Chris Carrasco](http://chriscarrasco.com).\n",
- "readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/hueniverse/hawk/issues"
},
- "homepage": "https://github.com/hueniverse/hawk",
- "_id": "hawk@1.0.0",
- "_from": "hawk@~1.0.0"
+ "_id": "hawk@1.1.1",
+ "dist": {
+ "shasum": "87cd491f9b46e4e2aeaca335416766885d2d1ed9",
+ "tarball": "http://registry.npmjs.org/hawk/-/hawk-1.1.1.tgz"
+ },
+ "_from": "hawk@1.1.1",
+ "_npmVersion": "1.3.8",
+ "_npmUser": {
+ "name": "hueniverse",
+ "email": "eran@hueniverse.com"
+ },
+ "maintainers": [
+ {
+ "name": "hueniverse",
+ "email": "eran@hueniverse.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "87cd491f9b46e4e2aeaca335416766885d2d1ed9",
+ "_resolved": "https://registry.npmjs.org/hawk/-/hawk-1.1.1.tgz",
+ "readme": "ERROR: No README data found!",
+ "homepage": "https://github.com/hueniverse/hawk"
}
});
});
});
+
+ describe('#authenticateTimestamp', function (done) {
+
+ it('should validate a timestamp', function (done) {
+
+ credentialsFunc('123456', function (err, credentials) {
+
+ var tsm = Hawk.crypto.timestampMessage(credentials);
+ expect(Browser.client.authenticateTimestamp(tsm, credentials)).to.equal(true);
+ done();
+ });
+ });
+
+ it('should detect a bad timestamp', function (done) {
+
+ credentialsFunc('123456', function (err, credentials) {
+
+ var tsm = Hawk.crypto.timestampMessage(credentials);
+ tsm.ts = 4;
+ expect(Browser.client.authenticateTimestamp(tsm, credentials)).to.equal(false);
+ done();
+ });
+ });
+ });
});
describe('#parseAuthorizationHeader', function (done) {
done();
});
});
+
+ describe('#setNtpOffset', function (done) {
+
+ it('catches localStorage errors', function (done) {
+
+ var orig = Browser.utils.storage.setItem;
+ var error = console.error;
+ var count = 0;
+ console.error = function () { if (count++ === 2) { console.error.error; } };
+ Browser.utils.storage.setItem = function () {
+
+ Browser.utils.storage.setItem = orig;
+ throw new Error()
+ };
+
+ expect(function () {
+ Browser.utils.setNtpOffset(100);
+ }).not.to.throw();
+
+ done();
+ });
+ });
});
},
"scripts": {
"pretest": "which gjslint; if [[ \"$?\" = 0 ]] ; then gjslint --nojsdoc -r lib -r tst; else echo \"Missing gjslint. Skipping lint\"; fi",
- "test": "./node_modules/.bin/tap ./tst"
+ "test": "tap ./tst"
},
- "readme": "node-asn1 is a library for encoding and decoding ASN.1 datatypes in pure JS.\nCurrently BER encoding is supported; at some point I'll likely have to do DER.\n\n## Usage\n\nMostly, if you're *actually* needing to read and write ASN.1, you probably don't\nneed this readme to explain what and why. If you have no idea what ASN.1 is,\nsee this: ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc\n\nThe source is pretty much self-explanatory, and has read/write methods for the\ncommon types out there.\n\n### Decoding\n\nThe following reads an ASN.1 sequence with a boolean.\n\n var Ber = require('asn1').Ber;\n\n var reader = new Ber.Reader(new Buffer([0x30, 0x03, 0x01, 0x01, 0xff]));\n\n reader.readSequence();\n console.log('Sequence len: ' + reader.length);\n if (reader.peek() === Ber.Boolean)\n console.log(reader.readBoolean());\n\n### Encoding\n\nThe following generates the same payload as above.\n\n var Ber = require('asn1').Ber;\n\n var writer = new Ber.Writer();\n\n writer.startSequence();\n writer.writeBoolean(true);\n writer.endSequence();\n\n console.log(writer.buffer);\n\n## Installation\n\n npm install asn1\n\n## License\n\nMIT.\n\n## Bugs\n\nSee <https://github.com/mcavage/node-asn1/issues>.\n",
- "readmeFilename": "README.md",
+ "_npmUser": {
+ "name": "mcavage",
+ "email": "mcavage@gmail.com"
+ },
+ "_id": "asn1@0.1.11",
+ "_engineSupported": true,
+ "_npmVersion": "1.1.0-beta-4",
+ "_nodeVersion": "v0.6.6",
+ "_defaultsLoaded": true,
+ "dist": {
+ "shasum": "559be18376d08a4ec4dbe80877d27818639b2df7",
+ "tarball": "http://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz"
+ },
+ "maintainers": [
+ {
+ "name": "mcavage",
+ "email": "mcavage@gmail.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "559be18376d08a4ec4dbe80877d27818639b2df7",
+ "_from": "asn1@0.1.11",
+ "_resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz",
"bugs": {
"url": "https://github.com/mcavage/node-asn1/issues"
},
- "homepage": "https://github.com/mcavage/node-asn1",
- "_id": "asn1@0.1.11",
- "_from": "asn1@0.1.11"
+ "readme": "ERROR: No README data found!",
+ "homepage": "https://github.com/mcavage/node-asn1"
}
"node": ">=0.6"
},
"readme": "# node-assert-plus\n\nThis library is a super small wrapper over node's assert module that has two\nthings: (1) the ability to disable assertions with the environment variable\nNODE_NDEBUG, and (2) some API wrappers for argument testing. Like\n`assert.string(myArg, 'myArg')`. As a simple example, most of my code looks\nlike this:\n\n var assert = require('assert-plus');\n\n function fooAccount(options, callback) {\n\t assert.object(options, 'options');\n\t\tassert.number(options.id, 'options.id);\n\t\tassert.bool(options.isManager, 'options.isManager');\n\t\tassert.string(options.name, 'options.name');\n\t\tassert.arrayOfString(options.email, 'options.email');\n\t\tassert.func(callback, 'callback');\n\n // Do stuff\n\t\tcallback(null, {});\n }\n\n# API\n\nAll methods that *aren't* part of node's core assert API are simply assumed to\ntake an argument, and then a string 'name' that's not a message; `AssertionError`\nwill be thrown if the assertion fails with a message like:\n\n AssertionError: foo (string) is required\n\tat test (/home/mark/work/foo/foo.js:3:9)\n\tat Object.<anonymous> (/home/mark/work/foo/foo.js:15:1)\n\tat Module._compile (module.js:446:26)\n\tat Object..js (module.js:464:10)\n\tat Module.load (module.js:353:31)\n\tat Function._load (module.js:311:12)\n\tat Array.0 (module.js:484:10)\n\tat EventEmitter._tickCallback (node.js:190:38)\n\nfrom:\n\n function test(foo) {\n\t assert.string(foo, 'foo');\n }\n\nThere you go. You can check that arrays are of a homogenous type with `Arrayof$Type`:\n\n function test(foo) {\n\t assert.arrayOfString(foo, 'foo');\n }\n\nYou can assert IFF an argument is not `undefined` (i.e., an optional arg):\n\n assert.optionalString(foo, 'foo');\n\nLastly, you can opt-out of assertion checking altogether by setting the\nenvironment variable `NODE_NDEBUG=1`. This is pseudo-useful if you have\nlots of assertions, and don't want to pay `typeof ()` taxes to v8 in\nproduction.\n\nThe complete list of APIs is:\n\n* assert.bool\n* assert.buffer\n* assert.func\n* assert.number\n* assert.object\n* assert.string\n* assert.arrayOfBool\n* assert.arrayOfFunc\n* assert.arrayOfNumber\n* assert.arrayOfObject\n* assert.arrayOfString\n* assert.optionalBool\n* assert.optionalBuffer\n* assert.optionalFunc\n* assert.optionalNumber\n* assert.optionalObject\n* assert.optionalString\n* assert.optionalArrayOfBool\n* assert.optionalArrayOfFunc\n* assert.optionalArrayOfNumber\n* assert.optionalArrayOfObject\n* assert.optionalArrayOfString\n* assert.AssertionError\n* assert.fail\n* assert.ok\n* assert.equal\n* assert.notEqual\n* assert.deepEqual\n* assert.notDeepEqual\n* assert.strictEqual\n* assert.notStrictEqual\n* assert.throws\n* assert.doesNotThrow\n* assert.ifError\n\n# Installation\n\n npm install assert-plus\n\n## License\n\nThe MIT License (MIT)\nCopyright (c) 2012 Mark Cavage\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n## Bugs\n\nSee <https://github.com/mcavage/node-assert-plus/issues>.\n",
- "readmeFilename": "README.md",
"_id": "assert-plus@0.1.2",
- "_from": "assert-plus@0.1.2"
+ "dist": {
+ "shasum": "d93ffdbb67ac5507779be316a7d65146417beef8",
+ "tarball": "http://registry.npmjs.org/assert-plus/-/assert-plus-0.1.2.tgz"
+ },
+ "_npmVersion": "1.1.59",
+ "_npmUser": {
+ "name": "mcavage",
+ "email": "mcavage@gmail.com"
+ },
+ "maintainers": [
+ {
+ "name": "mcavage",
+ "email": "mcavage@gmail.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "d93ffdbb67ac5507779be316a7d65146417beef8",
+ "_from": "assert-plus@0.1.2",
+ "_resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.2.tgz"
}
"node": ">= 0.4"
},
"main": "ctype.js",
- "readme": "Node-CType is a way to read and write binary data in structured and easy to use\nformat. Its name comes from the C header file.\n\nTo get started, simply clone the repository or use npm to install it. Once it is\nthere, simply require it.\n\ngit clone git://github.com/rmustacc/node-ctype\nnpm install ctype\nvar mod_ctype = require('ctype')\n\n\nThere are two APIs that you can use, depending on what abstraction you'd like.\nThe low level API let's you read and write individual integers and floats from\nbuffers. The higher level API let's you read and write structures of these. To\nillustrate this, let's looks look at how we would read and write a binary\nencoded x,y point.\n\nIn C we would define this structure as follows:\n\ntypedef struct point {\n\tuint16_t\tp_x;\n\tuint16_t\tp_y;\n} point_t;\n\nTo read a binary encoded point from a Buffer, we first need to create a CType\nparser (where we specify the endian and other options) and add the typedef.\n\nvar parser = new mod_ctype.Parser({ endian: 'big' });\nparser.typedef('point_t', [\n\t{ x: { type: 'uint16_t' } },\n\t{ y: { type: 'uint16_t' } }\n]);\n\nFrom here, given a buffer buf and an offset into it, we can read a point.\n\nvar out = parser.readData([ { point: { type: 'point_t' } } ], buffer, 0);\nconsole.log(out);\n{ point: { x: 23, y: 42 } }\n\nAnother way to get the same information would be to use the low level methods.\nNote that these require you to manually deal with the offset. Here's how we'd\nget the same values of x and y from the buffer.\n\nvar x = mod_ctype.ruint16(buf, 'big', 0);\nvar y = mod_ctype.ruint16(buf, 'big', 2);\nconsole.log(x + ', ' + y);\n23, 42\n\nThe true power of this API comes from the ability to define and nest typedefs,\njust as you would in C. By default, the following types are defined by default.\nNote that they return a Number, unless indicated otherwise.\n\n * int8_t\n * int16_t\n * int32_t\n * int64_t (returns an array where val[0] << 32 + val[1] would be the value)\n * uint8_t\n * uint16_t\n * uint32_t\n * uint64_t (returns an array where val[0] << 32 + val[1] would be the value)\n * float\n * double\n * char (either returns a buffer with that character or a uint8_t)\n * char[] (returns an object with the buffer and the number of characters read which is either the total amount requested or until the first 0)\n\n\nctf2json integration:\n\nNode-CType supports consuming the output of ctf2json. Once you read in a JSON file,\nall you have to do to add all the definitions it contains is:\n\nvar data, parser;\ndata = JSON.parse(parsedJSONData);\nparser = mod_ctype.parseCTF(data, { endian: 'big' });\n\nFor more documentation, see the file README.old. Full documentation is in the\nprocess of being rewritten as a series of manual pages which will be available\nin the repository and online for viewing.\n\nTo read the ctio manual page simple run, from the root of the workspace:\n\nman -Mman -s 3ctype ctio\n",
- "readmeFilename": "README",
"_id": "ctype@0.5.2",
- "_from": "ctype@0.5.2"
+ "dist": {
+ "shasum": "fe8091d468a373a0b0c9ff8bbfb3425c00973a1d",
+ "tarball": "http://registry.npmjs.org/ctype/-/ctype-0.5.2.tgz"
+ },
+ "_npmVersion": "1.1.59",
+ "_npmUser": {
+ "name": "rm",
+ "email": "rm@fingolfin.org"
+ },
+ "maintainers": [
+ {
+ "name": "rm",
+ "email": "rm@fingolfin.org"
+ }
+ ],
+ "directories": {},
+ "_shasum": "fe8091d468a373a0b0c9ff8bbfb3425c00973a1d",
+ "_from": "ctype@0.5.2",
+ "_resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.2.tgz",
+ "readme": "ERROR: No README data found!"
}
},
"main": "lib/index.js",
"scripts": {
- "test": "./node_modules/.bin/tap tst/*.js"
+ "test": "tap tst/*.js"
},
"dependencies": {
"assert-plus": "0.1.2",
},
"readme": "# node-http-signature\n\nnode-http-signature is a node.js library that has client and server components\nfor Joyent's [HTTP Signature Scheme](http_signing.md).\n\n## Usage\n\nNote the example below signs a request with the same key/cert used to start an\nHTTP server. This is almost certainly not what you actaully want, but is just\nused to illustrate the API calls; you will need to provide your own key\nmanagement in addition to this library.\n\n### Client\n\n var fs = require('fs');\n var https = require('https');\n var httpSignature = require('http-signature');\n\n var key = fs.readFileSync('./key.pem', 'ascii');\n\n var options = {\n host: 'localhost',\n port: 8443,\n path: '/',\n method: 'GET',\n headers: {}\n };\n\n // Adds a 'Date' header in, signs it, and adds the\n // 'Authorization' header in.\n var req = https.request(options, function(res) {\n console.log(res.statusCode);\n });\n\n\n httpSignature.sign(req, {\n key: key,\n keyId: './cert.pem'\n });\n\n req.end();\n\n### Server\n\n var fs = require('fs');\n var https = require('https');\n var httpSignature = require('http-signature');\n\n var options = {\n key: fs.readFileSync('./key.pem'),\n cert: fs.readFileSync('./cert.pem')\n };\n\n https.createServer(options, function (req, res) {\n var rc = 200;\n var parsed = httpSignature.parseRequest(req);\n var pub = fs.readFileSync(parsed.keyId, 'ascii');\n if (!httpSignature.verifySignature(parsed, pub))\n rc = 401;\n\n res.writeHead(rc);\n res.end();\n }).listen(8443);\n\n## Installation\n\n npm install http-signature\n\n## License\n\nMIT.\n\n## Bugs\n\nSee <https://github.com/joyent/node-http-signature/issues>.\n",
"readmeFilename": "README.md",
+ "_id": "http-signature@0.10.0",
+ "dist": {
+ "shasum": "1494e4f5000a83c0f11bcc12d6007c530cb99582",
+ "tarball": "http://registry.npmjs.org/http-signature/-/http-signature-0.10.0.tgz"
+ },
+ "_from": "http-signature@~0.10.0",
+ "_npmVersion": "1.2.18",
+ "_npmUser": {
+ "name": "mcavage",
+ "email": "mcavage@gmail.com"
+ },
+ "maintainers": [
+ {
+ "name": "mcavage",
+ "email": "mcavage@gmail.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "1494e4f5000a83c0f11bcc12d6007c530cb99582",
+ "_resolved": "https://registry.npmjs.org/http-signature/-/http-signature-0.10.0.tgz",
"bugs": {
"url": "https://github.com/joyent/node-http-signature/issues"
},
- "homepage": "https://github.com/joyent/node-http-signature",
- "_id": "http-signature@0.10.0",
- "_from": "http-signature@~0.10.0"
+ "homepage": "https://github.com/joyent/node-http-signature"
}
"bugs": {
"url": "https://github.com/isaacs/json-stringify-safe/issues"
},
- "homepage": "https://github.com/isaacs/json-stringify-safe",
"_id": "json-stringify-safe@5.0.0",
- "_from": "json-stringify-safe@~5.0.0"
+ "dist": {
+ "shasum": "4c1f228b5050837eba9d21f50c2e6e320624566e",
+ "tarball": "http://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.0.tgz"
+ },
+ "_from": "json-stringify-safe@~5.0.0",
+ "_npmVersion": "1.3.6",
+ "_npmUser": {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ "maintainers": [
+ {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ }
+ ],
+ "directories": {},
+ "_shasum": "4c1f228b5050837eba9d21f50c2e6e320624566e",
+ "_resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.0.tgz",
+ "homepage": "https://github.com/isaacs/json-stringify-safe"
}
--- /dev/null
+test
+build.js
+
+# OS generated files #
+######################
+.DS_Store*
+# Icon?
+ehthumbs.db
+Thumbs.db
+
+# Node.js #
+###########
+node_modules
+npm-debug.log
--- /dev/null
+language: node_js
+node_js:
+ - "0.8"
+ - "0.10"
+ - "0.11"
+matrix:
+ allow_failures:
+ - node_js: "0.11"
+ fast_finish: true
+before_install:
+ # remove build script deps before install
+ - node -pe 'f="./package.json";p=require(f);d=p.devDependencies;for(k in d){if("co"===k.substr(0,2))delete d[k]}require("fs").writeFileSync(f,JSON.stringify(p,null,2))'
--- /dev/null
+
+The MIT License (MIT)
+
+Copyright (c) 2014 Jonathan Ong me@jongleberry.com
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
--- /dev/null
+
+build:
+ node --harmony-generators build.js
+
+test:
+ node test/mime.js
+ mocha --require should --reporter spec test/test.js
+
+.PHONY: build test
--- /dev/null
+# mime-types
+[![NPM version](https://badge.fury.io/js/mime-types.svg)](https://badge.fury.io/js/mime-types) [![Build Status](https://travis-ci.org/expressjs/mime-types.svg?branch=master)](https://travis-ci.org/expressjs/mime-types)
+
+The ultimate javascript content-type utility.
+
+### Install
+
+```sh
+$ npm install mime-types
+```
+
+#### Similar to [node-mime](https://github.com/broofa/node-mime), except:
+
+- __No fallbacks.__ Instead of naively returning the first available type, `mime-types` simply returns `false`, so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.
+- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`.
+- Additional mime types are added such as jade and stylus. Feel free to add more!
+- Browser support via Browserify and Component by converting lists to JSON files.
+
+Otherwise, the API is compatible.
+
+### Adding Types
+
+If you'd like to add additional types,
+simply create a PR adding the type to `custom.json` and
+a reference link to the [sources](SOURCES.md).
+
+Do __NOT__ edit `mime.json` or `node.json`.
+Those are pulled using `build.js`.
+You should only touch `custom.json`.
+
+## API
+
+```js
+var mime = require('mime-types')
+```
+
+All functions return `false` if input is invalid or not found.
+
+### mime.lookup(path)
+
+Lookup the content-type associated with a file.
+
+```js
+mime.lookup('json') // 'application/json'
+mime.lookup('.md') // 'text/x-markdown'
+mime.lookup('file.html') // 'text/html'
+mime.lookup('folder/file.js') // 'application/javascript'
+
+mime.lookup('cats') // false
+```
+
+### mime.contentType(type)
+
+Create a full content-type header given a content-type or extension.
+
+```js
+mime.contentType('markdown') // 'text/x-markdown; charset=utf-8'
+mime.contentType('file.json') // 'application/json; charset=utf-8'
+```
+
+### mime.extension(type)
+
+Get the default extension for a content-type.
+
+```js
+mime.extension('application/octet-stream') // 'bin'
+```
+
+### mime.charset(type)
+
+Lookup the implied default charset of a content-type.
+
+```js
+mime.charset('text/x-markdown') // 'UTF-8'
+```
+
+### mime.types[extension] = type
+
+A map of content-types by extension.
+
+### mime.extensions[type] = [extensions]
+
+A map of extensions by content-type.
+
+### mime.define(types)
+
+Globally add definitions.
+`types` must be an object of the form:
+
+```js
+{
+ "<content-type>": [extensions...],
+ "<content-type>": [extensions...]
+}
+```
+
+See the `.json` files in `lib/` for examples.
+
+## License
+
+[MIT](LICENSE)
--- /dev/null
+
+### Sources for custom types
+
+This is a list of sources for any custom mime types.
+When adding custom mime types, please link to where you found the mime type,
+even if it's from an unofficial source.
+
+- `text/coffeescript` - http://coffeescript.org/#scripts
+- `text/x-handlebars-template` - https://handlebarsjs.com/#getting-started
+- `text/x-sass` & `text/x-scss` - https://github.com/janlelis/rubybuntu-mime/blob/master/sass.xml
+- `text.jsx` - http://facebook.github.io/react/docs/getting-started.html [[2]](https://github.com/facebook/react/blob/f230e0a03154e6f8a616e0da1fb3d97ffa1a6472/vendor/browser-transforms.js#L210)
+
+[Sources for node.json types](https://github.com/broofa/node-mime/blob/master/types/node.types)
+
+### Notes on weird types
+
+- `font/opentype` - This type is technically invalid according to the spec. No valid types begin with `font/`. No-one uses the official type of `application/vnd.ms-opentype` as the community standardized `application/x-font-otf`. However, chrome logs nonsense warnings unless opentype fonts are served with `font/opentype`. [[1]](http://stackoverflow.com/questions/2871655/proper-mime-type-for-fonts)
--- /dev/null
+{
+ "name": "mime-types",
+ "description": "The ultimate javascript content-type utility.",
+ "version": "0.1.0",
+ "author": {
+ "name": "Jonathan Ong",
+ "email": "me@jongleberry.com",
+ "url": "http://jongleberry.com",
+ "twitter": "https://twitter.com/jongleberry"
+ },
+ "repository": "expressjs/mime-types",
+ "license": "MIT",
+ "main": "lib/index.js",
+ "scripts": ["lib/index.js"],
+ "json": ["mime.json", "node.json", "custom.json"]
+}
--- /dev/null
+{
+ "text/jade": [
+ "jade"
+ ],
+ "text/stylus": [
+ "stylus",
+ "styl"
+ ],
+ "text/less": [
+ "less"
+ ],
+ "text/x-sass": [
+ "sass"
+ ],
+ "text/x-scss": [
+ "scss"
+ ],
+ "text/coffeescript": [
+ "coffee"
+ ],
+ "text/x-handlebars-template": [
+ "hbs"
+ ],
+ "text/jsx": [
+ "jsx"
+ ]
+}
--- /dev/null
+
+// types[extension] = type
+exports.types = Object.create(null)
+// extensions[type] = [extensions]
+exports.extensions = Object.create(null)
+// define more mime types
+exports.define = define
+
+// store the json files
+exports.json = {
+ mime: require('./mime.json'),
+ node: require('./node.json'),
+ custom: require('./custom.json'),
+}
+
+exports.lookup = function (string) {
+ if (!string || typeof string !== "string") return false
+ string = string.replace(/.*[\.\/\\]/, '').toLowerCase()
+ if (!string) return false
+ return exports.types[string] || false
+}
+
+exports.extension = function (type) {
+ if (!type || typeof type !== "string") return false
+ type = type.match(/^\s*([^;\s]*)(?:;|\s|$)/)
+ if (!type) return false
+ var exts = exports.extensions[type[1].toLowerCase()]
+ if (!exts || !exts.length) return false
+ return exts[0]
+}
+
+// type has to be an exact mime type
+exports.charset = function (type) {
+ // special cases
+ switch (type) {
+ case 'application/json': return 'UTF-8'
+ case 'application/javascript': return 'UTF-8'
+ }
+
+ // default text/* to utf-8
+ if (/^text\//.test(type)) return 'UTF-8'
+
+ return false
+}
+
+// backwards compatibility
+exports.charsets = {
+ lookup: exports.charset
+}
+
+exports.contentType = function (type) {
+ if (!type || typeof type !== "string") return false
+ if (!~type.indexOf('/')) type = exports.lookup(type)
+ if (!type) return false
+ if (!~type.indexOf('charset')) {
+ var charset = exports.charset(type)
+ if (charset) type += '; charset=' + charset.toLowerCase()
+ }
+ return type
+}
+
+define(exports.json.mime)
+define(exports.json.node)
+define(exports.json.custom)
+
+function define(json) {
+ Object.keys(json).forEach(function (type) {
+ var exts = json[type] || []
+ exports.extensions[type] = exports.extensions[type] || []
+ exts.forEach(function (ext) {
+ if (!~exports.extensions[type].indexOf(ext)) exports.extensions[type].push(ext)
+ exports.types[ext] = type
+ })
+ })
+}
--- /dev/null
+{
+ "application/1d-interleaved-parityfec": [],
+ "application/3gpp-ims+xml": [],
+ "application/activemessage": [],
+ "application/andrew-inset": [
+ "ez"
+ ],
+ "application/applefile": [],
+ "application/applixware": [
+ "aw"
+ ],
+ "application/atom+xml": [
+ "atom"
+ ],
+ "application/atomcat+xml": [
+ "atomcat"
+ ],
+ "application/atomicmail": [],
+ "application/atomsvc+xml": [
+ "atomsvc"
+ ],
+ "application/auth-policy+xml": [],
+ "application/batch-smtp": [],
+ "application/beep+xml": [],
+ "application/calendar+xml": [],
+ "application/cals-1840": [],
+ "application/ccmp+xml": [],
+ "application/ccxml+xml": [
+ "ccxml"
+ ],
+ "application/cdmi-capability": [
+ "cdmia"
+ ],
+ "application/cdmi-container": [
+ "cdmic"
+ ],
+ "application/cdmi-domain": [
+ "cdmid"
+ ],
+ "application/cdmi-object": [
+ "cdmio"
+ ],
+ "application/cdmi-queue": [
+ "cdmiq"
+ ],
+ "application/cea-2018+xml": [],
+ "application/cellml+xml": [],
+ "application/cfw": [],
+ "application/cnrp+xml": [],
+ "application/commonground": [],
+ "application/conference-info+xml": [],
+ "application/cpl+xml": [],
+ "application/csta+xml": [],
+ "application/cstadata+xml": [],
+ "application/cu-seeme": [
+ "cu"
+ ],
+ "application/cybercash": [],
+ "application/davmount+xml": [
+ "davmount"
+ ],
+ "application/dca-rft": [],
+ "application/dec-dx": [],
+ "application/dialog-info+xml": [],
+ "application/dicom": [],
+ "application/dns": [],
+ "application/docbook+xml": [
+ "dbk"
+ ],
+ "application/dskpp+xml": [],
+ "application/dssc+der": [
+ "dssc"
+ ],
+ "application/dssc+xml": [
+ "xdssc"
+ ],
+ "application/dvcs": [],
+ "application/ecmascript": [
+ "ecma"
+ ],
+ "application/edi-consent": [],
+ "application/edi-x12": [],
+ "application/edifact": [],
+ "application/emma+xml": [
+ "emma"
+ ],
+ "application/epp+xml": [],
+ "application/epub+zip": [
+ "epub"
+ ],
+ "application/eshop": [],
+ "application/example": [],
+ "application/exi": [
+ "exi"
+ ],
+ "application/fastinfoset": [],
+ "application/fastsoap": [],
+ "application/fits": [],
+ "application/font-tdpfr": [
+ "pfr"
+ ],
+ "application/framework-attributes+xml": [],
+ "application/gml+xml": [
+ "gml"
+ ],
+ "application/gpx+xml": [
+ "gpx"
+ ],
+ "application/gxf": [
+ "gxf"
+ ],
+ "application/h224": [],
+ "application/held+xml": [],
+ "application/http": [],
+ "application/hyperstudio": [
+ "stk"
+ ],
+ "application/ibe-key-request+xml": [],
+ "application/ibe-pkg-reply+xml": [],
+ "application/ibe-pp-data": [],
+ "application/iges": [],
+ "application/im-iscomposing+xml": [],
+ "application/index": [],
+ "application/index.cmd": [],
+ "application/index.obj": [],
+ "application/index.response": [],
+ "application/index.vnd": [],
+ "application/inkml+xml": [
+ "ink",
+ "inkml"
+ ],
+ "application/iotp": [],
+ "application/ipfix": [
+ "ipfix"
+ ],
+ "application/ipp": [],
+ "application/isup": [],
+ "application/java-archive": [
+ "jar"
+ ],
+ "application/java-serialized-object": [
+ "ser"
+ ],
+ "application/java-vm": [
+ "class"
+ ],
+ "application/javascript": [
+ "js"
+ ],
+ "application/json": [
+ "json"
+ ],
+ "application/jsonml+json": [
+ "jsonml"
+ ],
+ "application/kpml-request+xml": [],
+ "application/kpml-response+xml": [],
+ "application/lost+xml": [
+ "lostxml"
+ ],
+ "application/mac-binhex40": [
+ "hqx"
+ ],
+ "application/mac-compactpro": [
+ "cpt"
+ ],
+ "application/macwriteii": [],
+ "application/mads+xml": [
+ "mads"
+ ],
+ "application/marc": [
+ "mrc"
+ ],
+ "application/marcxml+xml": [
+ "mrcx"
+ ],
+ "application/mathematica": [
+ "ma",
+ "nb",
+ "mb"
+ ],
+ "application/mathml-content+xml": [],
+ "application/mathml-presentation+xml": [],
+ "application/mathml+xml": [
+ "mathml"
+ ],
+ "application/mbms-associated-procedure-description+xml": [],
+ "application/mbms-deregister+xml": [],
+ "application/mbms-envelope+xml": [],
+ "application/mbms-msk+xml": [],
+ "application/mbms-msk-response+xml": [],
+ "application/mbms-protection-description+xml": [],
+ "application/mbms-reception-report+xml": [],
+ "application/mbms-register+xml": [],
+ "application/mbms-register-response+xml": [],
+ "application/mbms-user-service-description+xml": [],
+ "application/mbox": [
+ "mbox"
+ ],
+ "application/media_control+xml": [],
+ "application/mediaservercontrol+xml": [
+ "mscml"
+ ],
+ "application/metalink+xml": [
+ "metalink"
+ ],
+ "application/metalink4+xml": [
+ "meta4"
+ ],
+ "application/mets+xml": [
+ "mets"
+ ],
+ "application/mikey": [],
+ "application/mods+xml": [
+ "mods"
+ ],
+ "application/moss-keys": [],
+ "application/moss-signature": [],
+ "application/mosskey-data": [],
+ "application/mosskey-request": [],
+ "application/mp21": [
+ "m21",
+ "mp21"
+ ],
+ "application/mp4": [
+ "mp4s"
+ ],
+ "application/mpeg4-generic": [],
+ "application/mpeg4-iod": [],
+ "application/mpeg4-iod-xmt": [],
+ "application/msc-ivr+xml": [],
+ "application/msc-mixer+xml": [],
+ "application/msword": [
+ "doc",
+ "dot"
+ ],
+ "application/mxf": [
+ "mxf"
+ ],
+ "application/nasdata": [],
+ "application/news-checkgroups": [],
+ "application/news-groupinfo": [],
+ "application/news-transmission": [],
+ "application/nss": [],
+ "application/ocsp-request": [],
+ "application/ocsp-response": [],
+ "application/octet-stream": [
+ "bin",
+ "dms",
+ "lrf",
+ "mar",
+ "so",
+ "dist",
+ "distz",
+ "pkg",
+ "bpk",
+ "dump",
+ "elc",
+ "deploy"
+ ],
+ "application/oda": [
+ "oda"
+ ],
+ "application/oebps-package+xml": [
+ "opf"
+ ],
+ "application/ogg": [
+ "ogx"
+ ],
+ "application/omdoc+xml": [
+ "omdoc"
+ ],
+ "application/onenote": [
+ "onetoc",
+ "onetoc2",
+ "onetmp",
+ "onepkg"
+ ],
+ "application/oxps": [
+ "oxps"
+ ],
+ "application/parityfec": [],
+ "application/patch-ops-error+xml": [
+ "xer"
+ ],
+ "application/pdf": [
+ "pdf"
+ ],
+ "application/pgp-encrypted": [
+ "pgp"
+ ],
+ "application/pgp-keys": [],
+ "application/pgp-signature": [
+ "asc",
+ "sig"
+ ],
+ "application/pics-rules": [
+ "prf"
+ ],
+ "application/pidf+xml": [],
+ "application/pidf-diff+xml": [],
+ "application/pkcs10": [
+ "p10"
+ ],
+ "application/pkcs7-mime": [
+ "p7m",
+ "p7c"
+ ],
+ "application/pkcs7-signature": [
+ "p7s"
+ ],
+ "application/pkcs8": [
+ "p8"
+ ],
+ "application/pkix-attr-cert": [
+ "ac"
+ ],
+ "application/pkix-cert": [
+ "cer"
+ ],
+ "application/pkix-crl": [
+ "crl"
+ ],
+ "application/pkix-pkipath": [
+ "pkipath"
+ ],
+ "application/pkixcmp": [
+ "pki"
+ ],
+ "application/pls+xml": [
+ "pls"
+ ],
+ "application/poc-settings+xml": [],
+ "application/postscript": [
+ "ai",
+ "eps",
+ "ps"
+ ],
+ "application/prs.alvestrand.titrax-sheet": [],
+ "application/prs.cww": [
+ "cww"
+ ],
+ "application/prs.nprend": [],
+ "application/prs.plucker": [],
+ "application/prs.rdf-xml-crypt": [],
+ "application/prs.xsf+xml": [],
+ "application/pskc+xml": [
+ "pskcxml"
+ ],
+ "application/qsig": [],
+ "application/rdf+xml": [
+ "rdf"
+ ],
+ "application/reginfo+xml": [
+ "rif"
+ ],
+ "application/relax-ng-compact-syntax": [
+ "rnc"
+ ],
+ "application/remote-printing": [],
+ "application/resource-lists+xml": [
+ "rl"
+ ],
+ "application/resource-lists-diff+xml": [
+ "rld"
+ ],
+ "application/riscos": [],
+ "application/rlmi+xml": [],
+ "application/rls-services+xml": [
+ "rs"
+ ],
+ "application/rpki-ghostbusters": [
+ "gbr"
+ ],
+ "application/rpki-manifest": [
+ "mft"
+ ],
+ "application/rpki-roa": [
+ "roa"
+ ],
+ "application/rpki-updown": [],
+ "application/rsd+xml": [
+ "rsd"
+ ],
+ "application/rss+xml": [
+ "rss"
+ ],
+ "application/rtf": [
+ "rtf"
+ ],
+ "application/rtx": [],
+ "application/samlassertion+xml": [],
+ "application/samlmetadata+xml": [],
+ "application/sbml+xml": [
+ "sbml"
+ ],
+ "application/scvp-cv-request": [
+ "scq"
+ ],
+ "application/scvp-cv-response": [
+ "scs"
+ ],
+ "application/scvp-vp-request": [
+ "spq"
+ ],
+ "application/scvp-vp-response": [
+ "spp"
+ ],
+ "application/sdp": [
+ "sdp"
+ ],
+ "application/set-payment": [],
+ "application/set-payment-initiation": [
+ "setpay"
+ ],
+ "application/set-registration": [],
+ "application/set-registration-initiation": [
+ "setreg"
+ ],
+ "application/sgml": [],
+ "application/sgml-open-catalog": [],
+ "application/shf+xml": [
+ "shf"
+ ],
+ "application/sieve": [],
+ "application/simple-filter+xml": [],
+ "application/simple-message-summary": [],
+ "application/simplesymbolcontainer": [],
+ "application/slate": [],
+ "application/smil": [],
+ "application/smil+xml": [
+ "smi",
+ "smil"
+ ],
+ "application/soap+fastinfoset": [],
+ "application/soap+xml": [],
+ "application/sparql-query": [
+ "rq"
+ ],
+ "application/sparql-results+xml": [
+ "srx"
+ ],
+ "application/spirits-event+xml": [],
+ "application/srgs": [
+ "gram"
+ ],
+ "application/srgs+xml": [
+ "grxml"
+ ],
+ "application/sru+xml": [
+ "sru"
+ ],
+ "application/ssdl+xml": [
+ "ssdl"
+ ],
+ "application/ssml+xml": [
+ "ssml"
+ ],
+ "application/tamp-apex-update": [],
+ "application/tamp-apex-update-confirm": [],
+ "application/tamp-community-update": [],
+ "application/tamp-community-update-confirm": [],
+ "application/tamp-error": [],
+ "application/tamp-sequence-adjust": [],
+ "application/tamp-sequence-adjust-confirm": [],
+ "application/tamp-status-query": [],
+ "application/tamp-status-response": [],
+ "application/tamp-update": [],
+ "application/tamp-update-confirm": [],
+ "application/tei+xml": [
+ "tei",
+ "teicorpus"
+ ],
+ "application/thraud+xml": [
+ "tfi"
+ ],
+ "application/timestamp-query": [],
+ "application/timestamp-reply": [],
+ "application/timestamped-data": [
+ "tsd"
+ ],
+ "application/tve-trigger": [],
+ "application/ulpfec": [],
+ "application/vcard+xml": [],
+ "application/vemmi": [],
+ "application/vividence.scriptfile": [],
+ "application/vnd.3gpp.bsf+xml": [],
+ "application/vnd.3gpp.pic-bw-large": [
+ "plb"
+ ],
+ "application/vnd.3gpp.pic-bw-small": [
+ "psb"
+ ],
+ "application/vnd.3gpp.pic-bw-var": [
+ "pvb"
+ ],
+ "application/vnd.3gpp.sms": [],
+ "application/vnd.3gpp2.bcmcsinfo+xml": [],
+ "application/vnd.3gpp2.sms": [],
+ "application/vnd.3gpp2.tcap": [
+ "tcap"
+ ],
+ "application/vnd.3m.post-it-notes": [
+ "pwn"
+ ],
+ "application/vnd.accpac.simply.aso": [
+ "aso"
+ ],
+ "application/vnd.accpac.simply.imp": [
+ "imp"
+ ],
+ "application/vnd.acucobol": [
+ "acu"
+ ],
+ "application/vnd.acucorp": [
+ "atc",
+ "acutc"
+ ],
+ "application/vnd.adobe.air-application-installer-package+zip": [
+ "air"
+ ],
+ "application/vnd.adobe.formscentral.fcdt": [
+ "fcdt"
+ ],
+ "application/vnd.adobe.fxp": [
+ "fxp",
+ "fxpl"
+ ],
+ "application/vnd.adobe.partial-upload": [],
+ "application/vnd.adobe.xdp+xml": [
+ "xdp"
+ ],
+ "application/vnd.adobe.xfdf": [
+ "xfdf"
+ ],
+ "application/vnd.aether.imp": [],
+ "application/vnd.ah-barcode": [],
+ "application/vnd.ahead.space": [
+ "ahead"
+ ],
+ "application/vnd.airzip.filesecure.azf": [
+ "azf"
+ ],
+ "application/vnd.airzip.filesecure.azs": [
+ "azs"
+ ],
+ "application/vnd.amazon.ebook": [
+ "azw"
+ ],
+ "application/vnd.americandynamics.acc": [
+ "acc"
+ ],
+ "application/vnd.amiga.ami": [
+ "ami"
+ ],
+ "application/vnd.amundsen.maze+xml": [],
+ "application/vnd.android.package-archive": [
+ "apk"
+ ],
+ "application/vnd.anser-web-certificate-issue-initiation": [
+ "cii"
+ ],
+ "application/vnd.anser-web-funds-transfer-initiation": [
+ "fti"
+ ],
+ "application/vnd.antix.game-component": [
+ "atx"
+ ],
+ "application/vnd.apple.installer+xml": [
+ "mpkg"
+ ],
+ "application/vnd.apple.mpegurl": [
+ "m3u8"
+ ],
+ "application/vnd.arastra.swi": [],
+ "application/vnd.aristanetworks.swi": [
+ "swi"
+ ],
+ "application/vnd.astraea-software.iota": [
+ "iota"
+ ],
+ "application/vnd.audiograph": [
+ "aep"
+ ],
+ "application/vnd.autopackage": [],
+ "application/vnd.avistar+xml": [],
+ "application/vnd.blueice.multipass": [
+ "mpm"
+ ],
+ "application/vnd.bluetooth.ep.oob": [],
+ "application/vnd.bmi": [
+ "bmi"
+ ],
+ "application/vnd.businessobjects": [
+ "rep"
+ ],
+ "application/vnd.cab-jscript": [],
+ "application/vnd.canon-cpdl": [],
+ "application/vnd.canon-lips": [],
+ "application/vnd.cendio.thinlinc.clientconf": [],
+ "application/vnd.chemdraw+xml": [
+ "cdxml"
+ ],
+ "application/vnd.chipnuts.karaoke-mmd": [
+ "mmd"
+ ],
+ "application/vnd.cinderella": [
+ "cdy"
+ ],
+ "application/vnd.cirpack.isdn-ext": [],
+ "application/vnd.claymore": [
+ "cla"
+ ],
+ "application/vnd.cloanto.rp9": [
+ "rp9"
+ ],
+ "application/vnd.clonk.c4group": [
+ "c4g",
+ "c4d",
+ "c4f",
+ "c4p",
+ "c4u"
+ ],
+ "application/vnd.cluetrust.cartomobile-config": [
+ "c11amc"
+ ],
+ "application/vnd.cluetrust.cartomobile-config-pkg": [
+ "c11amz"
+ ],
+ "application/vnd.collection+json": [],
+ "application/vnd.commerce-battelle": [],
+ "application/vnd.commonspace": [
+ "csp"
+ ],
+ "application/vnd.contact.cmsg": [
+ "cdbcmsg"
+ ],
+ "application/vnd.cosmocaller": [
+ "cmc"
+ ],
+ "application/vnd.crick.clicker": [
+ "clkx"
+ ],
+ "application/vnd.crick.clicker.keyboard": [
+ "clkk"
+ ],
+ "application/vnd.crick.clicker.palette": [
+ "clkp"
+ ],
+ "application/vnd.crick.clicker.template": [
+ "clkt"
+ ],
+ "application/vnd.crick.clicker.wordbank": [
+ "clkw"
+ ],
+ "application/vnd.criticaltools.wbs+xml": [
+ "wbs"
+ ],
+ "application/vnd.ctc-posml": [
+ "pml"
+ ],
+ "application/vnd.ctct.ws+xml": [],
+ "application/vnd.cups-pdf": [],
+ "application/vnd.cups-postscript": [],
+ "application/vnd.cups-ppd": [
+ "ppd"
+ ],
+ "application/vnd.cups-raster": [],
+ "application/vnd.cups-raw": [],
+ "application/vnd.curl": [],
+ "application/vnd.curl.car": [
+ "car"
+ ],
+ "application/vnd.curl.pcurl": [
+ "pcurl"
+ ],
+ "application/vnd.cybank": [],
+ "application/vnd.dart": [
+ "dart"
+ ],
+ "application/vnd.data-vision.rdz": [
+ "rdz"
+ ],
+ "application/vnd.dece.data": [
+ "uvf",
+ "uvvf",
+ "uvd",
+ "uvvd"
+ ],
+ "application/vnd.dece.ttml+xml": [
+ "uvt",
+ "uvvt"
+ ],
+ "application/vnd.dece.unspecified": [
+ "uvx",
+ "uvvx"
+ ],
+ "application/vnd.dece.zip": [
+ "uvz",
+ "uvvz"
+ ],
+ "application/vnd.denovo.fcselayout-link": [
+ "fe_launch"
+ ],
+ "application/vnd.dir-bi.plate-dl-nosuffix": [],
+ "application/vnd.dna": [
+ "dna"
+ ],
+ "application/vnd.dolby.mlp": [
+ "mlp"
+ ],
+ "application/vnd.dolby.mobile.1": [],
+ "application/vnd.dolby.mobile.2": [],
+ "application/vnd.dpgraph": [
+ "dpg"
+ ],
+ "application/vnd.dreamfactory": [
+ "dfac"
+ ],
+ "application/vnd.ds-keypoint": [
+ "kpxx"
+ ],
+ "application/vnd.dvb.ait": [
+ "ait"
+ ],
+ "application/vnd.dvb.dvbj": [],
+ "application/vnd.dvb.esgcontainer": [],
+ "application/vnd.dvb.ipdcdftnotifaccess": [],
+ "application/vnd.dvb.ipdcesgaccess": [],
+ "application/vnd.dvb.ipdcesgaccess2": [],
+ "application/vnd.dvb.ipdcesgpdd": [],
+ "application/vnd.dvb.ipdcroaming": [],
+ "application/vnd.dvb.iptv.alfec-base": [],
+ "application/vnd.dvb.iptv.alfec-enhancement": [],
+ "application/vnd.dvb.notif-aggregate-root+xml": [],
+ "application/vnd.dvb.notif-container+xml": [],
+ "application/vnd.dvb.notif-generic+xml": [],
+ "application/vnd.dvb.notif-ia-msglist+xml": [],
+ "application/vnd.dvb.notif-ia-registration-request+xml": [],
+ "application/vnd.dvb.notif-ia-registration-response+xml": [],
+ "application/vnd.dvb.notif-init+xml": [],
+ "application/vnd.dvb.pfr": [],
+ "application/vnd.dvb.service": [
+ "svc"
+ ],
+ "application/vnd.dxr": [],
+ "application/vnd.dynageo": [
+ "geo"
+ ],
+ "application/vnd.easykaraoke.cdgdownload": [],
+ "application/vnd.ecdis-update": [],
+ "application/vnd.ecowin.chart": [
+ "mag"
+ ],
+ "application/vnd.ecowin.filerequest": [],
+ "application/vnd.ecowin.fileupdate": [],
+ "application/vnd.ecowin.series": [],
+ "application/vnd.ecowin.seriesrequest": [],
+ "application/vnd.ecowin.seriesupdate": [],
+ "application/vnd.emclient.accessrequest+xml": [],
+ "application/vnd.enliven": [
+ "nml"
+ ],
+ "application/vnd.eprints.data+xml": [],
+ "application/vnd.epson.esf": [
+ "esf"
+ ],
+ "application/vnd.epson.msf": [
+ "msf"
+ ],
+ "application/vnd.epson.quickanime": [
+ "qam"
+ ],
+ "application/vnd.epson.salt": [
+ "slt"
+ ],
+ "application/vnd.epson.ssf": [
+ "ssf"
+ ],
+ "application/vnd.ericsson.quickcall": [],
+ "application/vnd.eszigno3+xml": [
+ "es3",
+ "et3"
+ ],
+ "application/vnd.etsi.aoc+xml": [],
+ "application/vnd.etsi.cug+xml": [],
+ "application/vnd.etsi.iptvcommand+xml": [],
+ "application/vnd.etsi.iptvdiscovery+xml": [],
+ "application/vnd.etsi.iptvprofile+xml": [],
+ "application/vnd.etsi.iptvsad-bc+xml": [],
+ "application/vnd.etsi.iptvsad-cod+xml": [],
+ "application/vnd.etsi.iptvsad-npvr+xml": [],
+ "application/vnd.etsi.iptvservice+xml": [],
+ "application/vnd.etsi.iptvsync+xml": [],
+ "application/vnd.etsi.iptvueprofile+xml": [],
+ "application/vnd.etsi.mcid+xml": [],
+ "application/vnd.etsi.overload-control-policy-dataset+xml": [],
+ "application/vnd.etsi.sci+xml": [],
+ "application/vnd.etsi.simservs+xml": [],
+ "application/vnd.etsi.tsl+xml": [],
+ "application/vnd.etsi.tsl.der": [],
+ "application/vnd.eudora.data": [],
+ "application/vnd.ezpix-album": [
+ "ez2"
+ ],
+ "application/vnd.ezpix-package": [
+ "ez3"
+ ],
+ "application/vnd.f-secure.mobile": [],
+ "application/vnd.fdf": [
+ "fdf"
+ ],
+ "application/vnd.fdsn.mseed": [
+ "mseed"
+ ],
+ "application/vnd.fdsn.seed": [
+ "seed",
+ "dataless"
+ ],
+ "application/vnd.ffsns": [],
+ "application/vnd.fints": [],
+ "application/vnd.flographit": [
+ "gph"
+ ],
+ "application/vnd.fluxtime.clip": [
+ "ftc"
+ ],
+ "application/vnd.font-fontforge-sfd": [],
+ "application/vnd.framemaker": [
+ "fm",
+ "frame",
+ "maker",
+ "book"
+ ],
+ "application/vnd.frogans.fnc": [
+ "fnc"
+ ],
+ "application/vnd.frogans.ltf": [
+ "ltf"
+ ],
+ "application/vnd.fsc.weblaunch": [
+ "fsc"
+ ],
+ "application/vnd.fujitsu.oasys": [
+ "oas"
+ ],
+ "application/vnd.fujitsu.oasys2": [
+ "oa2"
+ ],
+ "application/vnd.fujitsu.oasys3": [
+ "oa3"
+ ],
+ "application/vnd.fujitsu.oasysgp": [
+ "fg5"
+ ],
+ "application/vnd.fujitsu.oasysprs": [
+ "bh2"
+ ],
+ "application/vnd.fujixerox.art-ex": [],
+ "application/vnd.fujixerox.art4": [],
+ "application/vnd.fujixerox.hbpl": [],
+ "application/vnd.fujixerox.ddd": [
+ "ddd"
+ ],
+ "application/vnd.fujixerox.docuworks": [
+ "xdw"
+ ],
+ "application/vnd.fujixerox.docuworks.binder": [
+ "xbd"
+ ],
+ "application/vnd.fut-misnet": [],
+ "application/vnd.fuzzysheet": [
+ "fzs"
+ ],
+ "application/vnd.genomatix.tuxedo": [
+ "txd"
+ ],
+ "application/vnd.geocube+xml": [],
+ "application/vnd.geogebra.file": [
+ "ggb"
+ ],
+ "application/vnd.geogebra.tool": [
+ "ggt"
+ ],
+ "application/vnd.geometry-explorer": [
+ "gex",
+ "gre"
+ ],
+ "application/vnd.geonext": [
+ "gxt"
+ ],
+ "application/vnd.geoplan": [
+ "g2w"
+ ],
+ "application/vnd.geospace": [
+ "g3w"
+ ],
+ "application/vnd.globalplatform.card-content-mgt": [],
+ "application/vnd.globalplatform.card-content-mgt-response": [],
+ "application/vnd.gmx": [
+ "gmx"
+ ],
+ "application/vnd.google-earth.kml+xml": [
+ "kml"
+ ],
+ "application/vnd.google-earth.kmz": [
+ "kmz"
+ ],
+ "application/vnd.grafeq": [
+ "gqf",
+ "gqs"
+ ],
+ "application/vnd.gridmp": [],
+ "application/vnd.groove-account": [
+ "gac"
+ ],
+ "application/vnd.groove-help": [
+ "ghf"
+ ],
+ "application/vnd.groove-identity-message": [
+ "gim"
+ ],
+ "application/vnd.groove-injector": [
+ "grv"
+ ],
+ "application/vnd.groove-tool-message": [
+ "gtm"
+ ],
+ "application/vnd.groove-tool-template": [
+ "tpl"
+ ],
+ "application/vnd.groove-vcard": [
+ "vcg"
+ ],
+ "application/vnd.hal+json": [],
+ "application/vnd.hal+xml": [
+ "hal"
+ ],
+ "application/vnd.handheld-entertainment+xml": [
+ "zmm"
+ ],
+ "application/vnd.hbci": [
+ "hbci"
+ ],
+ "application/vnd.hcl-bireports": [],
+ "application/vnd.hhe.lesson-player": [
+ "les"
+ ],
+ "application/vnd.hp-hpgl": [
+ "hpgl"
+ ],
+ "application/vnd.hp-hpid": [
+ "hpid"
+ ],
+ "application/vnd.hp-hps": [
+ "hps"
+ ],
+ "application/vnd.hp-jlyt": [
+ "jlt"
+ ],
+ "application/vnd.hp-pcl": [
+ "pcl"
+ ],
+ "application/vnd.hp-pclxl": [
+ "pclxl"
+ ],
+ "application/vnd.httphone": [],
+ "application/vnd.hzn-3d-crossword": [],
+ "application/vnd.ibm.afplinedata": [],
+ "application/vnd.ibm.electronic-media": [],
+ "application/vnd.ibm.minipay": [
+ "mpy"
+ ],
+ "application/vnd.ibm.modcap": [
+ "afp",
+ "listafp",
+ "list3820"
+ ],
+ "application/vnd.ibm.rights-management": [
+ "irm"
+ ],
+ "application/vnd.ibm.secure-container": [
+ "sc"
+ ],
+ "application/vnd.iccprofile": [
+ "icc",
+ "icm"
+ ],
+ "application/vnd.igloader": [
+ "igl"
+ ],
+ "application/vnd.immervision-ivp": [
+ "ivp"
+ ],
+ "application/vnd.immervision-ivu": [
+ "ivu"
+ ],
+ "application/vnd.informedcontrol.rms+xml": [],
+ "application/vnd.informix-visionary": [],
+ "application/vnd.infotech.project": [],
+ "application/vnd.infotech.project+xml": [],
+ "application/vnd.innopath.wamp.notification": [],
+ "application/vnd.insors.igm": [
+ "igm"
+ ],
+ "application/vnd.intercon.formnet": [
+ "xpw",
+ "xpx"
+ ],
+ "application/vnd.intergeo": [
+ "i2g"
+ ],
+ "application/vnd.intertrust.digibox": [],
+ "application/vnd.intertrust.nncp": [],
+ "application/vnd.intu.qbo": [
+ "qbo"
+ ],
+ "application/vnd.intu.qfx": [
+ "qfx"
+ ],
+ "application/vnd.iptc.g2.conceptitem+xml": [],
+ "application/vnd.iptc.g2.knowledgeitem+xml": [],
+ "application/vnd.iptc.g2.newsitem+xml": [],
+ "application/vnd.iptc.g2.newsmessage+xml": [],
+ "application/vnd.iptc.g2.packageitem+xml": [],
+ "application/vnd.iptc.g2.planningitem+xml": [],
+ "application/vnd.ipunplugged.rcprofile": [
+ "rcprofile"
+ ],
+ "application/vnd.irepository.package+xml": [
+ "irp"
+ ],
+ "application/vnd.is-xpr": [
+ "xpr"
+ ],
+ "application/vnd.isac.fcs": [
+ "fcs"
+ ],
+ "application/vnd.jam": [
+ "jam"
+ ],
+ "application/vnd.japannet-directory-service": [],
+ "application/vnd.japannet-jpnstore-wakeup": [],
+ "application/vnd.japannet-payment-wakeup": [],
+ "application/vnd.japannet-registration": [],
+ "application/vnd.japannet-registration-wakeup": [],
+ "application/vnd.japannet-setstore-wakeup": [],
+ "application/vnd.japannet-verification": [],
+ "application/vnd.japannet-verification-wakeup": [],
+ "application/vnd.jcp.javame.midlet-rms": [
+ "rms"
+ ],
+ "application/vnd.jisp": [
+ "jisp"
+ ],
+ "application/vnd.joost.joda-archive": [
+ "joda"
+ ],
+ "application/vnd.kahootz": [
+ "ktz",
+ "ktr"
+ ],
+ "application/vnd.kde.karbon": [
+ "karbon"
+ ],
+ "application/vnd.kde.kchart": [
+ "chrt"
+ ],
+ "application/vnd.kde.kformula": [
+ "kfo"
+ ],
+ "application/vnd.kde.kivio": [
+ "flw"
+ ],
+ "application/vnd.kde.kontour": [
+ "kon"
+ ],
+ "application/vnd.kde.kpresenter": [
+ "kpr",
+ "kpt"
+ ],
+ "application/vnd.kde.kspread": [
+ "ksp"
+ ],
+ "application/vnd.kde.kword": [
+ "kwd",
+ "kwt"
+ ],
+ "application/vnd.kenameaapp": [
+ "htke"
+ ],
+ "application/vnd.kidspiration": [
+ "kia"
+ ],
+ "application/vnd.kinar": [
+ "kne",
+ "knp"
+ ],
+ "application/vnd.koan": [
+ "skp",
+ "skd",
+ "skt",
+ "skm"
+ ],
+ "application/vnd.kodak-descriptor": [
+ "sse"
+ ],
+ "application/vnd.las.las+xml": [
+ "lasxml"
+ ],
+ "application/vnd.liberty-request+xml": [],
+ "application/vnd.llamagraphics.life-balance.desktop": [
+ "lbd"
+ ],
+ "application/vnd.llamagraphics.life-balance.exchange+xml": [
+ "lbe"
+ ],
+ "application/vnd.lotus-1-2-3": [
+ "123"
+ ],
+ "application/vnd.lotus-approach": [
+ "apr"
+ ],
+ "application/vnd.lotus-freelance": [
+ "pre"
+ ],
+ "application/vnd.lotus-notes": [
+ "nsf"
+ ],
+ "application/vnd.lotus-organizer": [
+ "org"
+ ],
+ "application/vnd.lotus-screencam": [
+ "scm"
+ ],
+ "application/vnd.lotus-wordpro": [
+ "lwp"
+ ],
+ "application/vnd.macports.portpkg": [
+ "portpkg"
+ ],
+ "application/vnd.marlin.drm.actiontoken+xml": [],
+ "application/vnd.marlin.drm.conftoken+xml": [],
+ "application/vnd.marlin.drm.license+xml": [],
+ "application/vnd.marlin.drm.mdcf": [],
+ "application/vnd.mcd": [
+ "mcd"
+ ],
+ "application/vnd.medcalcdata": [
+ "mc1"
+ ],
+ "application/vnd.mediastation.cdkey": [
+ "cdkey"
+ ],
+ "application/vnd.meridian-slingshot": [],
+ "application/vnd.mfer": [
+ "mwf"
+ ],
+ "application/vnd.mfmp": [
+ "mfm"
+ ],
+ "application/vnd.micrografx.flo": [
+ "flo"
+ ],
+ "application/vnd.micrografx.igx": [
+ "igx"
+ ],
+ "application/vnd.mif": [
+ "mif"
+ ],
+ "application/vnd.minisoft-hp3000-save": [],
+ "application/vnd.mitsubishi.misty-guard.trustweb": [],
+ "application/vnd.mobius.daf": [
+ "daf"
+ ],
+ "application/vnd.mobius.dis": [
+ "dis"
+ ],
+ "application/vnd.mobius.mbk": [
+ "mbk"
+ ],
+ "application/vnd.mobius.mqy": [
+ "mqy"
+ ],
+ "application/vnd.mobius.msl": [
+ "msl"
+ ],
+ "application/vnd.mobius.plc": [
+ "plc"
+ ],
+ "application/vnd.mobius.txf": [
+ "txf"
+ ],
+ "application/vnd.mophun.application": [
+ "mpn"
+ ],
+ "application/vnd.mophun.certificate": [
+ "mpc"
+ ],
+ "application/vnd.motorola.flexsuite": [],
+ "application/vnd.motorola.flexsuite.adsi": [],
+ "application/vnd.motorola.flexsuite.fis": [],
+ "application/vnd.motorola.flexsuite.gotap": [],
+ "application/vnd.motorola.flexsuite.kmr": [],
+ "application/vnd.motorola.flexsuite.ttc": [],
+ "application/vnd.motorola.flexsuite.wem": [],
+ "application/vnd.motorola.iprm": [],
+ "application/vnd.mozilla.xul+xml": [
+ "xul"
+ ],
+ "application/vnd.ms-artgalry": [
+ "cil"
+ ],
+ "application/vnd.ms-asf": [],
+ "application/vnd.ms-cab-compressed": [
+ "cab"
+ ],
+ "application/vnd.ms-color.iccprofile": [],
+ "application/vnd.ms-excel": [
+ "xls",
+ "xlm",
+ "xla",
+ "xlc",
+ "xlt",
+ "xlw"
+ ],
+ "application/vnd.ms-excel.addin.macroenabled.12": [
+ "xlam"
+ ],
+ "application/vnd.ms-excel.sheet.binary.macroenabled.12": [
+ "xlsb"
+ ],
+ "application/vnd.ms-excel.sheet.macroenabled.12": [
+ "xlsm"
+ ],
+ "application/vnd.ms-excel.template.macroenabled.12": [
+ "xltm"
+ ],
+ "application/vnd.ms-fontobject": [
+ "eot"
+ ],
+ "application/vnd.ms-htmlhelp": [
+ "chm"
+ ],
+ "application/vnd.ms-ims": [
+ "ims"
+ ],
+ "application/vnd.ms-lrm": [
+ "lrm"
+ ],
+ "application/vnd.ms-office.activex+xml": [],
+ "application/vnd.ms-officetheme": [
+ "thmx"
+ ],
+ "application/vnd.ms-opentype": [],
+ "application/vnd.ms-package.obfuscated-opentype": [],
+ "application/vnd.ms-pki.seccat": [
+ "cat"
+ ],
+ "application/vnd.ms-pki.stl": [
+ "stl"
+ ],
+ "application/vnd.ms-playready.initiator+xml": [],
+ "application/vnd.ms-powerpoint": [
+ "ppt",
+ "pps",
+ "pot"
+ ],
+ "application/vnd.ms-powerpoint.addin.macroenabled.12": [
+ "ppam"
+ ],
+ "application/vnd.ms-powerpoint.presentation.macroenabled.12": [
+ "pptm"
+ ],
+ "application/vnd.ms-powerpoint.slide.macroenabled.12": [
+ "sldm"
+ ],
+ "application/vnd.ms-powerpoint.slideshow.macroenabled.12": [
+ "ppsm"
+ ],
+ "application/vnd.ms-powerpoint.template.macroenabled.12": [
+ "potm"
+ ],
+ "application/vnd.ms-printing.printticket+xml": [],
+ "application/vnd.ms-project": [
+ "mpp",
+ "mpt"
+ ],
+ "application/vnd.ms-tnef": [],
+ "application/vnd.ms-wmdrm.lic-chlg-req": [],
+ "application/vnd.ms-wmdrm.lic-resp": [],
+ "application/vnd.ms-wmdrm.meter-chlg-req": [],
+ "application/vnd.ms-wmdrm.meter-resp": [],
+ "application/vnd.ms-word.document.macroenabled.12": [
+ "docm"
+ ],
+ "application/vnd.ms-word.template.macroenabled.12": [
+ "dotm"
+ ],
+ "application/vnd.ms-works": [
+ "wps",
+ "wks",
+ "wcm",
+ "wdb"
+ ],
+ "application/vnd.ms-wpl": [
+ "wpl"
+ ],
+ "application/vnd.ms-xpsdocument": [
+ "xps"
+ ],
+ "application/vnd.mseq": [
+ "mseq"
+ ],
+ "application/vnd.msign": [],
+ "application/vnd.multiad.creator": [],
+ "application/vnd.multiad.creator.cif": [],
+ "application/vnd.music-niff": [],
+ "application/vnd.musician": [
+ "mus"
+ ],
+ "application/vnd.muvee.style": [
+ "msty"
+ ],
+ "application/vnd.mynfc": [
+ "taglet"
+ ],
+ "application/vnd.ncd.control": [],
+ "application/vnd.ncd.reference": [],
+ "application/vnd.nervana": [],
+ "application/vnd.netfpx": [],
+ "application/vnd.neurolanguage.nlu": [
+ "nlu"
+ ],
+ "application/vnd.nitf": [
+ "ntf",
+ "nitf"
+ ],
+ "application/vnd.noblenet-directory": [
+ "nnd"
+ ],
+ "application/vnd.noblenet-sealer": [
+ "nns"
+ ],
+ "application/vnd.noblenet-web": [
+ "nnw"
+ ],
+ "application/vnd.nokia.catalogs": [],
+ "application/vnd.nokia.conml+wbxml": [],
+ "application/vnd.nokia.conml+xml": [],
+ "application/vnd.nokia.isds-radio-presets": [],
+ "application/vnd.nokia.iptv.config+xml": [],
+ "application/vnd.nokia.landmark+wbxml": [],
+ "application/vnd.nokia.landmark+xml": [],
+ "application/vnd.nokia.landmarkcollection+xml": [],
+ "application/vnd.nokia.n-gage.ac+xml": [],
+ "application/vnd.nokia.n-gage.data": [
+ "ngdat"
+ ],
+ "application/vnd.nokia.ncd": [],
+ "application/vnd.nokia.pcd+wbxml": [],
+ "application/vnd.nokia.pcd+xml": [],
+ "application/vnd.nokia.radio-preset": [
+ "rpst"
+ ],
+ "application/vnd.nokia.radio-presets": [
+ "rpss"
+ ],
+ "application/vnd.novadigm.edm": [
+ "edm"
+ ],
+ "application/vnd.novadigm.edx": [
+ "edx"
+ ],
+ "application/vnd.novadigm.ext": [
+ "ext"
+ ],
+ "application/vnd.ntt-local.file-transfer": [],
+ "application/vnd.ntt-local.sip-ta_remote": [],
+ "application/vnd.ntt-local.sip-ta_tcp_stream": [],
+ "application/vnd.oasis.opendocument.chart": [
+ "odc"
+ ],
+ "application/vnd.oasis.opendocument.chart-template": [
+ "otc"
+ ],
+ "application/vnd.oasis.opendocument.database": [
+ "odb"
+ ],
+ "application/vnd.oasis.opendocument.formula": [
+ "odf"
+ ],
+ "application/vnd.oasis.opendocument.formula-template": [
+ "odft"
+ ],
+ "application/vnd.oasis.opendocument.graphics": [
+ "odg"
+ ],
+ "application/vnd.oasis.opendocument.graphics-template": [
+ "otg"
+ ],
+ "application/vnd.oasis.opendocument.image": [
+ "odi"
+ ],
+ "application/vnd.oasis.opendocument.image-template": [
+ "oti"
+ ],
+ "application/vnd.oasis.opendocument.presentation": [
+ "odp"
+ ],
+ "application/vnd.oasis.opendocument.presentation-template": [
+ "otp"
+ ],
+ "application/vnd.oasis.opendocument.spreadsheet": [
+ "ods"
+ ],
+ "application/vnd.oasis.opendocument.spreadsheet-template": [
+ "ots"
+ ],
+ "application/vnd.oasis.opendocument.text": [
+ "odt"
+ ],
+ "application/vnd.oasis.opendocument.text-master": [
+ "odm"
+ ],
+ "application/vnd.oasis.opendocument.text-template": [
+ "ott"
+ ],
+ "application/vnd.oasis.opendocument.text-web": [
+ "oth"
+ ],
+ "application/vnd.obn": [],
+ "application/vnd.oftn.l10n+json": [],
+ "application/vnd.oipf.contentaccessdownload+xml": [],
+ "application/vnd.oipf.contentaccessstreaming+xml": [],
+ "application/vnd.oipf.cspg-hexbinary": [],
+ "application/vnd.oipf.dae.svg+xml": [],
+ "application/vnd.oipf.dae.xhtml+xml": [],
+ "application/vnd.oipf.mippvcontrolmessage+xml": [],
+ "application/vnd.oipf.pae.gem": [],
+ "application/vnd.oipf.spdiscovery+xml": [],
+ "application/vnd.oipf.spdlist+xml": [],
+ "application/vnd.oipf.ueprofile+xml": [],
+ "application/vnd.oipf.userprofile+xml": [],
+ "application/vnd.olpc-sugar": [
+ "xo"
+ ],
+ "application/vnd.oma-scws-config": [],
+ "application/vnd.oma-scws-http-request": [],
+ "application/vnd.oma-scws-http-response": [],
+ "application/vnd.oma.bcast.associated-procedure-parameter+xml": [],
+ "application/vnd.oma.bcast.drm-trigger+xml": [],
+ "application/vnd.oma.bcast.imd+xml": [],
+ "application/vnd.oma.bcast.ltkm": [],
+ "application/vnd.oma.bcast.notification+xml": [],
+ "application/vnd.oma.bcast.provisioningtrigger": [],
+ "application/vnd.oma.bcast.sgboot": [],
+ "application/vnd.oma.bcast.sgdd+xml": [],
+ "application/vnd.oma.bcast.sgdu": [],
+ "application/vnd.oma.bcast.simple-symbol-container": [],
+ "application/vnd.oma.bcast.smartcard-trigger+xml": [],
+ "application/vnd.oma.bcast.sprov+xml": [],
+ "application/vnd.oma.bcast.stkm": [],
+ "application/vnd.oma.cab-address-book+xml": [],
+ "application/vnd.oma.cab-feature-handler+xml": [],
+ "application/vnd.oma.cab-pcc+xml": [],
+ "application/vnd.oma.cab-user-prefs+xml": [],
+ "application/vnd.oma.dcd": [],
+ "application/vnd.oma.dcdc": [],
+ "application/vnd.oma.dd2+xml": [
+ "dd2"
+ ],
+ "application/vnd.oma.drm.risd+xml": [],
+ "application/vnd.oma.group-usage-list+xml": [],
+ "application/vnd.oma.pal+xml": [],
+ "application/vnd.oma.poc.detailed-progress-report+xml": [],
+ "application/vnd.oma.poc.final-report+xml": [],
+ "application/vnd.oma.poc.groups+xml": [],
+ "application/vnd.oma.poc.invocation-descriptor+xml": [],
+ "application/vnd.oma.poc.optimized-progress-report+xml": [],
+ "application/vnd.oma.push": [],
+ "application/vnd.oma.scidm.messages+xml": [],
+ "application/vnd.oma.xcap-directory+xml": [],
+ "application/vnd.omads-email+xml": [],
+ "application/vnd.omads-file+xml": [],
+ "application/vnd.omads-folder+xml": [],
+ "application/vnd.omaloc-supl-init": [],
+ "application/vnd.openofficeorg.extension": [
+ "oxt"
+ ],
+ "application/vnd.openxmlformats-officedocument.custom-properties+xml": [],
+ "application/vnd.openxmlformats-officedocument.customxmlproperties+xml": [],
+ "application/vnd.openxmlformats-officedocument.drawing+xml": [],
+ "application/vnd.openxmlformats-officedocument.drawingml.chart+xml": [],
+ "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml": [],
+ "application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml": [],
+ "application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml": [],
+ "application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml": [],
+ "application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml": [],
+ "application/vnd.openxmlformats-officedocument.extended-properties+xml": [],
+ "application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml": [],
+ "application/vnd.openxmlformats-officedocument.presentationml.comments+xml": [],
+ "application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml": [],
+ "application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml": [],
+ "application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml": [],
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation": [
+ "pptx"
+ ],
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml": [],
+ "application/vnd.openxmlformats-officedocument.presentationml.presprops+xml": [],
+ "application/vnd.openxmlformats-officedocument.presentationml.slide": [
+ "sldx"
+ ],
+ "application/vnd.openxmlformats-officedocument.presentationml.slide+xml": [],
+ "application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml": [],
+ "application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml": [],
+ "application/vnd.openxmlformats-officedocument.presentationml.slideshow": [
+ "ppsx"
+ ],
+ "application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml": [],
+ "application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml": [],
+ "application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml": [],
+ "application/vnd.openxmlformats-officedocument.presentationml.tags+xml": [],
+ "application/vnd.openxmlformats-officedocument.presentationml.template": [
+ "potx"
+ ],
+ "application/vnd.openxmlformats-officedocument.presentationml.template.main+xml": [],
+ "application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [
+ "xlsx"
+ ],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.template": [
+ "xltx"
+ ],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml": [],
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": [],
+ "application/vnd.openxmlformats-officedocument.theme+xml": [],
+ "application/vnd.openxmlformats-officedocument.themeoverride+xml": [],
+ "application/vnd.openxmlformats-officedocument.vmldrawing": [],
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml": [],
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document": [
+ "docx"
+ ],
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml": [],
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml": [],
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml": [],
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml": [],
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml": [],
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml": [],
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml": [],
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml": [],
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml": [],
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.template": [
+ "dotx"
+ ],
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml": [],
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml": [],
+ "application/vnd.openxmlformats-package.core-properties+xml": [],
+ "application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml": [],
+ "application/vnd.openxmlformats-package.relationships+xml": [],
+ "application/vnd.quobject-quoxdocument": [],
+ "application/vnd.osa.netdeploy": [],
+ "application/vnd.osgeo.mapguide.package": [
+ "mgp"
+ ],
+ "application/vnd.osgi.bundle": [],
+ "application/vnd.osgi.dp": [
+ "dp"
+ ],
+ "application/vnd.osgi.subsystem": [
+ "esa"
+ ],
+ "application/vnd.otps.ct-kip+xml": [],
+ "application/vnd.palm": [
+ "pdb",
+ "pqa",
+ "oprc"
+ ],
+ "application/vnd.paos.xml": [],
+ "application/vnd.pawaafile": [
+ "paw"
+ ],
+ "application/vnd.pg.format": [
+ "str"
+ ],
+ "application/vnd.pg.osasli": [
+ "ei6"
+ ],
+ "application/vnd.piaccess.application-licence": [],
+ "application/vnd.picsel": [
+ "efif"
+ ],
+ "application/vnd.pmi.widget": [
+ "wg"
+ ],
+ "application/vnd.poc.group-advertisement+xml": [],
+ "application/vnd.pocketlearn": [
+ "plf"
+ ],
+ "application/vnd.powerbuilder6": [
+ "pbd"
+ ],
+ "application/vnd.powerbuilder6-s": [],
+ "application/vnd.powerbuilder7": [],
+ "application/vnd.powerbuilder7-s": [],
+ "application/vnd.powerbuilder75": [],
+ "application/vnd.powerbuilder75-s": [],
+ "application/vnd.preminet": [],
+ "application/vnd.previewsystems.box": [
+ "box"
+ ],
+ "application/vnd.proteus.magazine": [
+ "mgz"
+ ],
+ "application/vnd.publishare-delta-tree": [
+ "qps"
+ ],
+ "application/vnd.pvi.ptid1": [
+ "ptid"
+ ],
+ "application/vnd.pwg-multiplexed": [],
+ "application/vnd.pwg-xhtml-print+xml": [],
+ "application/vnd.qualcomm.brew-app-res": [],
+ "application/vnd.quark.quarkxpress": [
+ "qxd",
+ "qxt",
+ "qwd",
+ "qwt",
+ "qxl",
+ "qxb"
+ ],
+ "application/vnd.radisys.moml+xml": [],
+ "application/vnd.radisys.msml+xml": [],
+ "application/vnd.radisys.msml-audit+xml": [],
+ "application/vnd.radisys.msml-audit-conf+xml": [],
+ "application/vnd.radisys.msml-audit-conn+xml": [],
+ "application/vnd.radisys.msml-audit-dialog+xml": [],
+ "application/vnd.radisys.msml-audit-stream+xml": [],
+ "application/vnd.radisys.msml-conf+xml": [],
+ "application/vnd.radisys.msml-dialog+xml": [],
+ "application/vnd.radisys.msml-dialog-base+xml": [],
+ "application/vnd.radisys.msml-dialog-fax-detect+xml": [],
+ "application/vnd.radisys.msml-dialog-fax-sendrecv+xml": [],
+ "application/vnd.radisys.msml-dialog-group+xml": [],
+ "application/vnd.radisys.msml-dialog-speech+xml": [],
+ "application/vnd.radisys.msml-dialog-transform+xml": [],
+ "application/vnd.rainstor.data": [],
+ "application/vnd.rapid": [],
+ "application/vnd.realvnc.bed": [
+ "bed"
+ ],
+ "application/vnd.recordare.musicxml": [
+ "mxl"
+ ],
+ "application/vnd.recordare.musicxml+xml": [
+ "musicxml"
+ ],
+ "application/vnd.renlearn.rlprint": [],
+ "application/vnd.rig.cryptonote": [
+ "cryptonote"
+ ],
+ "application/vnd.rim.cod": [
+ "cod"
+ ],
+ "application/vnd.rn-realmedia": [
+ "rm"
+ ],
+ "application/vnd.rn-realmedia-vbr": [
+ "rmvb"
+ ],
+ "application/vnd.route66.link66+xml": [
+ "link66"
+ ],
+ "application/vnd.rs-274x": [],
+ "application/vnd.ruckus.download": [],
+ "application/vnd.s3sms": [],
+ "application/vnd.sailingtracker.track": [
+ "st"
+ ],
+ "application/vnd.sbm.cid": [],
+ "application/vnd.sbm.mid2": [],
+ "application/vnd.scribus": [],
+ "application/vnd.sealed.3df": [],
+ "application/vnd.sealed.csf": [],
+ "application/vnd.sealed.doc": [],
+ "application/vnd.sealed.eml": [],
+ "application/vnd.sealed.mht": [],
+ "application/vnd.sealed.net": [],
+ "application/vnd.sealed.ppt": [],
+ "application/vnd.sealed.tiff": [],
+ "application/vnd.sealed.xls": [],
+ "application/vnd.sealedmedia.softseal.html": [],
+ "application/vnd.sealedmedia.softseal.pdf": [],
+ "application/vnd.seemail": [
+ "see"
+ ],
+ "application/vnd.sema": [
+ "sema"
+ ],
+ "application/vnd.semd": [
+ "semd"
+ ],
+ "application/vnd.semf": [
+ "semf"
+ ],
+ "application/vnd.shana.informed.formdata": [
+ "ifm"
+ ],
+ "application/vnd.shana.informed.formtemplate": [
+ "itp"
+ ],
+ "application/vnd.shana.informed.interchange": [
+ "iif"
+ ],
+ "application/vnd.shana.informed.package": [
+ "ipk"
+ ],
+ "application/vnd.simtech-mindmapper": [
+ "twd",
+ "twds"
+ ],
+ "application/vnd.smaf": [
+ "mmf"
+ ],
+ "application/vnd.smart.notebook": [],
+ "application/vnd.smart.teacher": [
+ "teacher"
+ ],
+ "application/vnd.software602.filler.form+xml": [],
+ "application/vnd.software602.filler.form-xml-zip": [],
+ "application/vnd.solent.sdkm+xml": [
+ "sdkm",
+ "sdkd"
+ ],
+ "application/vnd.spotfire.dxp": [
+ "dxp"
+ ],
+ "application/vnd.spotfire.sfs": [
+ "sfs"
+ ],
+ "application/vnd.sss-cod": [],
+ "application/vnd.sss-dtf": [],
+ "application/vnd.sss-ntf": [],
+ "application/vnd.stardivision.calc": [
+ "sdc"
+ ],
+ "application/vnd.stardivision.draw": [
+ "sda"
+ ],
+ "application/vnd.stardivision.impress": [
+ "sdd"
+ ],
+ "application/vnd.stardivision.math": [
+ "smf"
+ ],
+ "application/vnd.stardivision.writer": [
+ "sdw",
+ "vor"
+ ],
+ "application/vnd.stardivision.writer-global": [
+ "sgl"
+ ],
+ "application/vnd.stepmania.package": [
+ "smzip"
+ ],
+ "application/vnd.stepmania.stepchart": [
+ "sm"
+ ],
+ "application/vnd.street-stream": [],
+ "application/vnd.sun.xml.calc": [
+ "sxc"
+ ],
+ "application/vnd.sun.xml.calc.template": [
+ "stc"
+ ],
+ "application/vnd.sun.xml.draw": [
+ "sxd"
+ ],
+ "application/vnd.sun.xml.draw.template": [
+ "std"
+ ],
+ "application/vnd.sun.xml.impress": [
+ "sxi"
+ ],
+ "application/vnd.sun.xml.impress.template": [
+ "sti"
+ ],
+ "application/vnd.sun.xml.math": [
+ "sxm"
+ ],
+ "application/vnd.sun.xml.writer": [
+ "sxw"
+ ],
+ "application/vnd.sun.xml.writer.global": [
+ "sxg"
+ ],
+ "application/vnd.sun.xml.writer.template": [
+ "stw"
+ ],
+ "application/vnd.sun.wadl+xml": [],
+ "application/vnd.sus-calendar": [
+ "sus",
+ "susp"
+ ],
+ "application/vnd.svd": [
+ "svd"
+ ],
+ "application/vnd.swiftview-ics": [],
+ "application/vnd.symbian.install": [
+ "sis",
+ "sisx"
+ ],
+ "application/vnd.syncml+xml": [
+ "xsm"
+ ],
+ "application/vnd.syncml.dm+wbxml": [
+ "bdm"
+ ],
+ "application/vnd.syncml.dm+xml": [
+ "xdm"
+ ],
+ "application/vnd.syncml.dm.notification": [],
+ "application/vnd.syncml.ds.notification": [],
+ "application/vnd.tao.intent-module-archive": [
+ "tao"
+ ],
+ "application/vnd.tcpdump.pcap": [
+ "pcap",
+ "cap",
+ "dmp"
+ ],
+ "application/vnd.tmobile-livetv": [
+ "tmo"
+ ],
+ "application/vnd.trid.tpt": [
+ "tpt"
+ ],
+ "application/vnd.triscape.mxs": [
+ "mxs"
+ ],
+ "application/vnd.trueapp": [
+ "tra"
+ ],
+ "application/vnd.truedoc": [],
+ "application/vnd.ubisoft.webplayer": [],
+ "application/vnd.ufdl": [
+ "ufd",
+ "ufdl"
+ ],
+ "application/vnd.uiq.theme": [
+ "utz"
+ ],
+ "application/vnd.umajin": [
+ "umj"
+ ],
+ "application/vnd.unity": [
+ "unityweb"
+ ],
+ "application/vnd.uoml+xml": [
+ "uoml"
+ ],
+ "application/vnd.uplanet.alert": [],
+ "application/vnd.uplanet.alert-wbxml": [],
+ "application/vnd.uplanet.bearer-choice": [],
+ "application/vnd.uplanet.bearer-choice-wbxml": [],
+ "application/vnd.uplanet.cacheop": [],
+ "application/vnd.uplanet.cacheop-wbxml": [],
+ "application/vnd.uplanet.channel": [],
+ "application/vnd.uplanet.channel-wbxml": [],
+ "application/vnd.uplanet.list": [],
+ "application/vnd.uplanet.list-wbxml": [],
+ "application/vnd.uplanet.listcmd": [],
+ "application/vnd.uplanet.listcmd-wbxml": [],
+ "application/vnd.uplanet.signal": [],
+ "application/vnd.vcx": [
+ "vcx"
+ ],
+ "application/vnd.vd-study": [],
+ "application/vnd.vectorworks": [],
+ "application/vnd.verimatrix.vcas": [],
+ "application/vnd.vidsoft.vidconference": [],
+ "application/vnd.visio": [
+ "vsd",
+ "vst",
+ "vss",
+ "vsw"
+ ],
+ "application/vnd.visionary": [
+ "vis"
+ ],
+ "application/vnd.vividence.scriptfile": [],
+ "application/vnd.vsf": [
+ "vsf"
+ ],
+ "application/vnd.wap.sic": [],
+ "application/vnd.wap.slc": [],
+ "application/vnd.wap.wbxml": [
+ "wbxml"
+ ],
+ "application/vnd.wap.wmlc": [
+ "wmlc"
+ ],
+ "application/vnd.wap.wmlscriptc": [
+ "wmlsc"
+ ],
+ "application/vnd.webturbo": [
+ "wtb"
+ ],
+ "application/vnd.wfa.wsc": [],
+ "application/vnd.wmc": [],
+ "application/vnd.wmf.bootstrap": [],
+ "application/vnd.wolfram.mathematica": [],
+ "application/vnd.wolfram.mathematica.package": [],
+ "application/vnd.wolfram.player": [
+ "nbp"
+ ],
+ "application/vnd.wordperfect": [
+ "wpd"
+ ],
+ "application/vnd.wqd": [
+ "wqd"
+ ],
+ "application/vnd.wrq-hp3000-labelled": [],
+ "application/vnd.wt.stf": [
+ "stf"
+ ],
+ "application/vnd.wv.csp+wbxml": [],
+ "application/vnd.wv.csp+xml": [],
+ "application/vnd.wv.ssp+xml": [],
+ "application/vnd.xara": [
+ "xar"
+ ],
+ "application/vnd.xfdl": [
+ "xfdl"
+ ],
+ "application/vnd.xfdl.webform": [],
+ "application/vnd.xmi+xml": [],
+ "application/vnd.xmpie.cpkg": [],
+ "application/vnd.xmpie.dpkg": [],
+ "application/vnd.xmpie.plan": [],
+ "application/vnd.xmpie.ppkg": [],
+ "application/vnd.xmpie.xlim": [],
+ "application/vnd.yamaha.hv-dic": [
+ "hvd"
+ ],
+ "application/vnd.yamaha.hv-script": [
+ "hvs"
+ ],
+ "application/vnd.yamaha.hv-voice": [
+ "hvp"
+ ],
+ "application/vnd.yamaha.openscoreformat": [
+ "osf"
+ ],
+ "application/vnd.yamaha.openscoreformat.osfpvg+xml": [
+ "osfpvg"
+ ],
+ "application/vnd.yamaha.remote-setup": [],
+ "application/vnd.yamaha.smaf-audio": [
+ "saf"
+ ],
+ "application/vnd.yamaha.smaf-phrase": [
+ "spf"
+ ],
+ "application/vnd.yamaha.through-ngn": [],
+ "application/vnd.yamaha.tunnel-udpencap": [],
+ "application/vnd.yellowriver-custom-menu": [
+ "cmp"
+ ],
+ "application/vnd.zul": [
+ "zir",
+ "zirz"
+ ],
+ "application/vnd.zzazz.deck+xml": [
+ "zaz"
+ ],
+ "application/voicexml+xml": [
+ "vxml"
+ ],
+ "application/vq-rtcpxr": [],
+ "application/watcherinfo+xml": [],
+ "application/whoispp-query": [],
+ "application/whoispp-response": [],
+ "application/widget": [
+ "wgt"
+ ],
+ "application/winhlp": [
+ "hlp"
+ ],
+ "application/wita": [],
+ "application/wordperfect5.1": [],
+ "application/wsdl+xml": [
+ "wsdl"
+ ],
+ "application/wspolicy+xml": [
+ "wspolicy"
+ ],
+ "application/x-7z-compressed": [
+ "7z"
+ ],
+ "application/x-abiword": [
+ "abw"
+ ],
+ "application/x-ace-compressed": [
+ "ace"
+ ],
+ "application/x-amf": [],
+ "application/x-apple-diskimage": [
+ "dmg"
+ ],
+ "application/x-authorware-bin": [
+ "aab",
+ "x32",
+ "u32",
+ "vox"
+ ],
+ "application/x-authorware-map": [
+ "aam"
+ ],
+ "application/x-authorware-seg": [
+ "aas"
+ ],
+ "application/x-bcpio": [
+ "bcpio"
+ ],
+ "application/x-bittorrent": [
+ "torrent"
+ ],
+ "application/x-blorb": [
+ "blb",
+ "blorb"
+ ],
+ "application/x-bzip": [
+ "bz"
+ ],
+ "application/x-bzip2": [
+ "bz2",
+ "boz"
+ ],
+ "application/x-cbr": [
+ "cbr",
+ "cba",
+ "cbt",
+ "cbz",
+ "cb7"
+ ],
+ "application/x-cdlink": [
+ "vcd"
+ ],
+ "application/x-cfs-compressed": [
+ "cfs"
+ ],
+ "application/x-chat": [
+ "chat"
+ ],
+ "application/x-chess-pgn": [
+ "pgn"
+ ],
+ "application/x-conference": [
+ "nsc"
+ ],
+ "application/x-compress": [],
+ "application/x-cpio": [
+ "cpio"
+ ],
+ "application/x-csh": [
+ "csh"
+ ],
+ "application/x-debian-package": [
+ "deb",
+ "udeb"
+ ],
+ "application/x-dgc-compressed": [
+ "dgc"
+ ],
+ "application/x-director": [
+ "dir",
+ "dcr",
+ "dxr",
+ "cst",
+ "cct",
+ "cxt",
+ "w3d",
+ "fgd",
+ "swa"
+ ],
+ "application/x-doom": [
+ "wad"
+ ],
+ "application/x-dtbncx+xml": [
+ "ncx"
+ ],
+ "application/x-dtbook+xml": [
+ "dtb"
+ ],
+ "application/x-dtbresource+xml": [
+ "res"
+ ],
+ "application/x-dvi": [
+ "dvi"
+ ],
+ "application/x-envoy": [
+ "evy"
+ ],
+ "application/x-eva": [
+ "eva"
+ ],
+ "application/x-font-bdf": [
+ "bdf"
+ ],
+ "application/x-font-dos": [],
+ "application/x-font-framemaker": [],
+ "application/x-font-ghostscript": [
+ "gsf"
+ ],
+ "application/x-font-libgrx": [],
+ "application/x-font-linux-psf": [
+ "psf"
+ ],
+ "application/x-font-otf": [
+ "otf"
+ ],
+ "application/x-font-pcf": [
+ "pcf"
+ ],
+ "application/x-font-snf": [
+ "snf"
+ ],
+ "application/x-font-speedo": [],
+ "application/x-font-sunos-news": [],
+ "application/x-font-ttf": [
+ "ttf",
+ "ttc"
+ ],
+ "application/x-font-type1": [
+ "pfa",
+ "pfb",
+ "pfm",
+ "afm"
+ ],
+ "application/font-woff": [
+ "woff"
+ ],
+ "application/x-font-vfont": [],
+ "application/x-freearc": [
+ "arc"
+ ],
+ "application/x-futuresplash": [
+ "spl"
+ ],
+ "application/x-gca-compressed": [
+ "gca"
+ ],
+ "application/x-glulx": [
+ "ulx"
+ ],
+ "application/x-gnumeric": [
+ "gnumeric"
+ ],
+ "application/x-gramps-xml": [
+ "gramps"
+ ],
+ "application/x-gtar": [
+ "gtar"
+ ],
+ "application/x-gzip": [],
+ "application/x-hdf": [
+ "hdf"
+ ],
+ "application/x-install-instructions": [
+ "install"
+ ],
+ "application/x-iso9660-image": [
+ "iso"
+ ],
+ "application/x-java-jnlp-file": [
+ "jnlp"
+ ],
+ "application/x-latex": [
+ "latex"
+ ],
+ "application/x-lzh-compressed": [
+ "lzh",
+ "lha"
+ ],
+ "application/x-mie": [
+ "mie"
+ ],
+ "application/x-mobipocket-ebook": [
+ "prc",
+ "mobi"
+ ],
+ "application/x-ms-application": [
+ "application"
+ ],
+ "application/x-ms-shortcut": [
+ "lnk"
+ ],
+ "application/x-ms-wmd": [
+ "wmd"
+ ],
+ "application/x-ms-wmz": [
+ "wmz"
+ ],
+ "application/x-ms-xbap": [
+ "xbap"
+ ],
+ "application/x-msaccess": [
+ "mdb"
+ ],
+ "application/x-msbinder": [
+ "obd"
+ ],
+ "application/x-mscardfile": [
+ "crd"
+ ],
+ "application/x-msclip": [
+ "clp"
+ ],
+ "application/x-msdownload": [
+ "exe",
+ "dll",
+ "com",
+ "bat",
+ "msi"
+ ],
+ "application/x-msmediaview": [
+ "mvb",
+ "m13",
+ "m14"
+ ],
+ "application/x-msmetafile": [
+ "wmf",
+ "wmz",
+ "emf",
+ "emz"
+ ],
+ "application/x-msmoney": [
+ "mny"
+ ],
+ "application/x-mspublisher": [
+ "pub"
+ ],
+ "application/x-msschedule": [
+ "scd"
+ ],
+ "application/x-msterminal": [
+ "trm"
+ ],
+ "application/x-mswrite": [
+ "wri"
+ ],
+ "application/x-netcdf": [
+ "nc",
+ "cdf"
+ ],
+ "application/x-nzb": [
+ "nzb"
+ ],
+ "application/x-pkcs12": [
+ "p12",
+ "pfx"
+ ],
+ "application/x-pkcs7-certificates": [
+ "p7b",
+ "spc"
+ ],
+ "application/x-pkcs7-certreqresp": [
+ "p7r"
+ ],
+ "application/x-rar-compressed": [
+ "rar"
+ ],
+ "application/x-research-info-systems": [
+ "ris"
+ ],
+ "application/x-sh": [
+ "sh"
+ ],
+ "application/x-shar": [
+ "shar"
+ ],
+ "application/x-shockwave-flash": [
+ "swf"
+ ],
+ "application/x-silverlight-app": [
+ "xap"
+ ],
+ "application/x-sql": [
+ "sql"
+ ],
+ "application/x-stuffit": [
+ "sit"
+ ],
+ "application/x-stuffitx": [
+ "sitx"
+ ],
+ "application/x-subrip": [
+ "srt"
+ ],
+ "application/x-sv4cpio": [
+ "sv4cpio"
+ ],
+ "application/x-sv4crc": [
+ "sv4crc"
+ ],
+ "application/x-t3vm-image": [
+ "t3"
+ ],
+ "application/x-tads": [
+ "gam"
+ ],
+ "application/x-tar": [
+ "tar"
+ ],
+ "application/x-tcl": [
+ "tcl"
+ ],
+ "application/x-tex": [
+ "tex"
+ ],
+ "application/x-tex-tfm": [
+ "tfm"
+ ],
+ "application/x-texinfo": [
+ "texinfo",
+ "texi"
+ ],
+ "application/x-tgif": [
+ "obj"
+ ],
+ "application/x-ustar": [
+ "ustar"
+ ],
+ "application/x-wais-source": [
+ "src"
+ ],
+ "application/x-x509-ca-cert": [
+ "der",
+ "crt"
+ ],
+ "application/x-xfig": [
+ "fig"
+ ],
+ "application/x-xliff+xml": [
+ "xlf"
+ ],
+ "application/x-xpinstall": [
+ "xpi"
+ ],
+ "application/x-xz": [
+ "xz"
+ ],
+ "application/x-zmachine": [
+ "z1",
+ "z2",
+ "z3",
+ "z4",
+ "z5",
+ "z6",
+ "z7",
+ "z8"
+ ],
+ "application/x400-bp": [],
+ "application/xaml+xml": [
+ "xaml"
+ ],
+ "application/xcap-att+xml": [],
+ "application/xcap-caps+xml": [],
+ "application/xcap-diff+xml": [
+ "xdf"
+ ],
+ "application/xcap-el+xml": [],
+ "application/xcap-error+xml": [],
+ "application/xcap-ns+xml": [],
+ "application/xcon-conference-info-diff+xml": [],
+ "application/xcon-conference-info+xml": [],
+ "application/xenc+xml": [
+ "xenc"
+ ],
+ "application/xhtml+xml": [
+ "xhtml",
+ "xht"
+ ],
+ "application/xhtml-voice+xml": [],
+ "application/xml": [
+ "xml",
+ "xsl"
+ ],
+ "application/xml-dtd": [
+ "dtd"
+ ],
+ "application/xml-external-parsed-entity": [],
+ "application/xmpp+xml": [],
+ "application/xop+xml": [
+ "xop"
+ ],
+ "application/xproc+xml": [
+ "xpl"
+ ],
+ "application/xslt+xml": [
+ "xslt"
+ ],
+ "application/xspf+xml": [
+ "xspf"
+ ],
+ "application/xv+xml": [
+ "mxml",
+ "xhvml",
+ "xvml",
+ "xvm"
+ ],
+ "application/yang": [
+ "yang"
+ ],
+ "application/yin+xml": [
+ "yin"
+ ],
+ "application/zip": [
+ "zip"
+ ],
+ "audio/1d-interleaved-parityfec": [],
+ "audio/32kadpcm": [],
+ "audio/3gpp": [],
+ "audio/3gpp2": [],
+ "audio/ac3": [],
+ "audio/adpcm": [
+ "adp"
+ ],
+ "audio/amr": [],
+ "audio/amr-wb": [],
+ "audio/amr-wb+": [],
+ "audio/asc": [],
+ "audio/atrac-advanced-lossless": [],
+ "audio/atrac-x": [],
+ "audio/atrac3": [],
+ "audio/basic": [
+ "au",
+ "snd"
+ ],
+ "audio/bv16": [],
+ "audio/bv32": [],
+ "audio/clearmode": [],
+ "audio/cn": [],
+ "audio/dat12": [],
+ "audio/dls": [],
+ "audio/dsr-es201108": [],
+ "audio/dsr-es202050": [],
+ "audio/dsr-es202211": [],
+ "audio/dsr-es202212": [],
+ "audio/dv": [],
+ "audio/dvi4": [],
+ "audio/eac3": [],
+ "audio/evrc": [],
+ "audio/evrc-qcp": [],
+ "audio/evrc0": [],
+ "audio/evrc1": [],
+ "audio/evrcb": [],
+ "audio/evrcb0": [],
+ "audio/evrcb1": [],
+ "audio/evrcwb": [],
+ "audio/evrcwb0": [],
+ "audio/evrcwb1": [],
+ "audio/example": [],
+ "audio/fwdred": [],
+ "audio/g719": [],
+ "audio/g722": [],
+ "audio/g7221": [],
+ "audio/g723": [],
+ "audio/g726-16": [],
+ "audio/g726-24": [],
+ "audio/g726-32": [],
+ "audio/g726-40": [],
+ "audio/g728": [],
+ "audio/g729": [],
+ "audio/g7291": [],
+ "audio/g729d": [],
+ "audio/g729e": [],
+ "audio/gsm": [],
+ "audio/gsm-efr": [],
+ "audio/gsm-hr-08": [],
+ "audio/ilbc": [],
+ "audio/ip-mr_v2.5": [],
+ "audio/isac": [],
+ "audio/l16": [],
+ "audio/l20": [],
+ "audio/l24": [],
+ "audio/l8": [],
+ "audio/lpc": [],
+ "audio/midi": [
+ "mid",
+ "midi",
+ "kar",
+ "rmi"
+ ],
+ "audio/mobile-xmf": [],
+ "audio/mp4": [
+ "mp4a"
+ ],
+ "audio/mp4a-latm": [],
+ "audio/mpa": [],
+ "audio/mpa-robust": [],
+ "audio/mpeg": [
+ "mpga",
+ "mp2",
+ "mp2a",
+ "mp3",
+ "m2a",
+ "m3a"
+ ],
+ "audio/mpeg4-generic": [],
+ "audio/musepack": [],
+ "audio/ogg": [
+ "oga",
+ "ogg",
+ "spx"
+ ],
+ "audio/opus": [],
+ "audio/parityfec": [],
+ "audio/pcma": [],
+ "audio/pcma-wb": [],
+ "audio/pcmu-wb": [],
+ "audio/pcmu": [],
+ "audio/prs.sid": [],
+ "audio/qcelp": [],
+ "audio/red": [],
+ "audio/rtp-enc-aescm128": [],
+ "audio/rtp-midi": [],
+ "audio/rtx": [],
+ "audio/s3m": [
+ "s3m"
+ ],
+ "audio/silk": [
+ "sil"
+ ],
+ "audio/smv": [],
+ "audio/smv0": [],
+ "audio/smv-qcp": [],
+ "audio/sp-midi": [],
+ "audio/speex": [],
+ "audio/t140c": [],
+ "audio/t38": [],
+ "audio/telephone-event": [],
+ "audio/tone": [],
+ "audio/uemclip": [],
+ "audio/ulpfec": [],
+ "audio/vdvi": [],
+ "audio/vmr-wb": [],
+ "audio/vnd.3gpp.iufp": [],
+ "audio/vnd.4sb": [],
+ "audio/vnd.audiokoz": [],
+ "audio/vnd.celp": [],
+ "audio/vnd.cisco.nse": [],
+ "audio/vnd.cmles.radio-events": [],
+ "audio/vnd.cns.anp1": [],
+ "audio/vnd.cns.inf1": [],
+ "audio/vnd.dece.audio": [
+ "uva",
+ "uvva"
+ ],
+ "audio/vnd.digital-winds": [
+ "eol"
+ ],
+ "audio/vnd.dlna.adts": [],
+ "audio/vnd.dolby.heaac.1": [],
+ "audio/vnd.dolby.heaac.2": [],
+ "audio/vnd.dolby.mlp": [],
+ "audio/vnd.dolby.mps": [],
+ "audio/vnd.dolby.pl2": [],
+ "audio/vnd.dolby.pl2x": [],
+ "audio/vnd.dolby.pl2z": [],
+ "audio/vnd.dolby.pulse.1": [],
+ "audio/vnd.dra": [
+ "dra"
+ ],
+ "audio/vnd.dts": [
+ "dts"
+ ],
+ "audio/vnd.dts.hd": [
+ "dtshd"
+ ],
+ "audio/vnd.dvb.file": [],
+ "audio/vnd.everad.plj": [],
+ "audio/vnd.hns.audio": [],
+ "audio/vnd.lucent.voice": [
+ "lvp"
+ ],
+ "audio/vnd.ms-playready.media.pya": [
+ "pya"
+ ],
+ "audio/vnd.nokia.mobile-xmf": [],
+ "audio/vnd.nortel.vbk": [],
+ "audio/vnd.nuera.ecelp4800": [
+ "ecelp4800"
+ ],
+ "audio/vnd.nuera.ecelp7470": [
+ "ecelp7470"
+ ],
+ "audio/vnd.nuera.ecelp9600": [
+ "ecelp9600"
+ ],
+ "audio/vnd.octel.sbc": [],
+ "audio/vnd.qcelp": [],
+ "audio/vnd.rhetorex.32kadpcm": [],
+ "audio/vnd.rip": [
+ "rip"
+ ],
+ "audio/vnd.sealedmedia.softseal.mpeg": [],
+ "audio/vnd.vmx.cvsd": [],
+ "audio/vorbis": [],
+ "audio/vorbis-config": [],
+ "audio/webm": [
+ "weba"
+ ],
+ "audio/x-aac": [
+ "aac"
+ ],
+ "audio/x-aiff": [
+ "aif",
+ "aiff",
+ "aifc"
+ ],
+ "audio/x-caf": [
+ "caf"
+ ],
+ "audio/x-flac": [
+ "flac"
+ ],
+ "audio/x-matroska": [
+ "mka"
+ ],
+ "audio/x-mpegurl": [
+ "m3u"
+ ],
+ "audio/x-ms-wax": [
+ "wax"
+ ],
+ "audio/x-ms-wma": [
+ "wma"
+ ],
+ "audio/x-pn-realaudio": [
+ "ram",
+ "ra"
+ ],
+ "audio/x-pn-realaudio-plugin": [
+ "rmp"
+ ],
+ "audio/x-tta": [],
+ "audio/x-wav": [
+ "wav"
+ ],
+ "audio/xm": [
+ "xm"
+ ],
+ "chemical/x-cdx": [
+ "cdx"
+ ],
+ "chemical/x-cif": [
+ "cif"
+ ],
+ "chemical/x-cmdf": [
+ "cmdf"
+ ],
+ "chemical/x-cml": [
+ "cml"
+ ],
+ "chemical/x-csml": [
+ "csml"
+ ],
+ "chemical/x-pdb": [],
+ "chemical/x-xyz": [
+ "xyz"
+ ],
+ "image/bmp": [
+ "bmp"
+ ],
+ "image/cgm": [
+ "cgm"
+ ],
+ "image/example": [],
+ "image/fits": [],
+ "image/g3fax": [
+ "g3"
+ ],
+ "image/gif": [
+ "gif"
+ ],
+ "image/ief": [
+ "ief"
+ ],
+ "image/jp2": [],
+ "image/jpeg": [
+ "jpeg",
+ "jpg",
+ "jpe"
+ ],
+ "image/jpm": [],
+ "image/jpx": [],
+ "image/ktx": [
+ "ktx"
+ ],
+ "image/naplps": [],
+ "image/png": [
+ "png"
+ ],
+ "image/prs.btif": [
+ "btif"
+ ],
+ "image/prs.pti": [],
+ "image/sgi": [
+ "sgi"
+ ],
+ "image/svg+xml": [
+ "svg",
+ "svgz"
+ ],
+ "image/t38": [],
+ "image/tiff": [
+ "tiff",
+ "tif"
+ ],
+ "image/tiff-fx": [],
+ "image/vnd.adobe.photoshop": [
+ "psd"
+ ],
+ "image/vnd.cns.inf2": [],
+ "image/vnd.dece.graphic": [
+ "uvi",
+ "uvvi",
+ "uvg",
+ "uvvg"
+ ],
+ "image/vnd.dvb.subtitle": [
+ "sub"
+ ],
+ "image/vnd.djvu": [
+ "djvu",
+ "djv"
+ ],
+ "image/vnd.dwg": [
+ "dwg"
+ ],
+ "image/vnd.dxf": [
+ "dxf"
+ ],
+ "image/vnd.fastbidsheet": [
+ "fbs"
+ ],
+ "image/vnd.fpx": [
+ "fpx"
+ ],
+ "image/vnd.fst": [
+ "fst"
+ ],
+ "image/vnd.fujixerox.edmics-mmr": [
+ "mmr"
+ ],
+ "image/vnd.fujixerox.edmics-rlc": [
+ "rlc"
+ ],
+ "image/vnd.globalgraphics.pgb": [],
+ "image/vnd.microsoft.icon": [],
+ "image/vnd.mix": [],
+ "image/vnd.ms-modi": [
+ "mdi"
+ ],
+ "image/vnd.ms-photo": [
+ "wdp"
+ ],
+ "image/vnd.net-fpx": [
+ "npx"
+ ],
+ "image/vnd.radiance": [],
+ "image/vnd.sealed.png": [],
+ "image/vnd.sealedmedia.softseal.gif": [],
+ "image/vnd.sealedmedia.softseal.jpg": [],
+ "image/vnd.svf": [],
+ "image/vnd.wap.wbmp": [
+ "wbmp"
+ ],
+ "image/vnd.xiff": [
+ "xif"
+ ],
+ "image/webp": [
+ "webp"
+ ],
+ "image/x-3ds": [
+ "3ds"
+ ],
+ "image/x-cmu-raster": [
+ "ras"
+ ],
+ "image/x-cmx": [
+ "cmx"
+ ],
+ "image/x-freehand": [
+ "fh",
+ "fhc",
+ "fh4",
+ "fh5",
+ "fh7"
+ ],
+ "image/x-icon": [
+ "ico"
+ ],
+ "image/x-mrsid-image": [
+ "sid"
+ ],
+ "image/x-pcx": [
+ "pcx"
+ ],
+ "image/x-pict": [
+ "pic",
+ "pct"
+ ],
+ "image/x-portable-anymap": [
+ "pnm"
+ ],
+ "image/x-portable-bitmap": [
+ "pbm"
+ ],
+ "image/x-portable-graymap": [
+ "pgm"
+ ],
+ "image/x-portable-pixmap": [
+ "ppm"
+ ],
+ "image/x-rgb": [
+ "rgb"
+ ],
+ "image/x-tga": [
+ "tga"
+ ],
+ "image/x-xbitmap": [
+ "xbm"
+ ],
+ "image/x-xpixmap": [
+ "xpm"
+ ],
+ "image/x-xwindowdump": [
+ "xwd"
+ ],
+ "message/cpim": [],
+ "message/delivery-status": [],
+ "message/disposition-notification": [],
+ "message/example": [],
+ "message/external-body": [],
+ "message/feedback-report": [],
+ "message/global": [],
+ "message/global-delivery-status": [],
+ "message/global-disposition-notification": [],
+ "message/global-headers": [],
+ "message/http": [],
+ "message/imdn+xml": [],
+ "message/news": [],
+ "message/partial": [],
+ "message/rfc822": [
+ "eml",
+ "mime"
+ ],
+ "message/s-http": [],
+ "message/sip": [],
+ "message/sipfrag": [],
+ "message/tracking-status": [],
+ "message/vnd.si.simp": [],
+ "model/example": [],
+ "model/iges": [
+ "igs",
+ "iges"
+ ],
+ "model/mesh": [
+ "msh",
+ "mesh",
+ "silo"
+ ],
+ "model/vnd.collada+xml": [
+ "dae"
+ ],
+ "model/vnd.dwf": [
+ "dwf"
+ ],
+ "model/vnd.flatland.3dml": [],
+ "model/vnd.gdl": [
+ "gdl"
+ ],
+ "model/vnd.gs-gdl": [],
+ "model/vnd.gs.gdl": [],
+ "model/vnd.gtw": [
+ "gtw"
+ ],
+ "model/vnd.moml+xml": [],
+ "model/vnd.mts": [
+ "mts"
+ ],
+ "model/vnd.parasolid.transmit.binary": [],
+ "model/vnd.parasolid.transmit.text": [],
+ "model/vnd.vtu": [
+ "vtu"
+ ],
+ "model/vrml": [
+ "wrl",
+ "vrml"
+ ],
+ "model/x3d+binary": [
+ "x3db",
+ "x3dbz"
+ ],
+ "model/x3d+vrml": [
+ "x3dv",
+ "x3dvz"
+ ],
+ "model/x3d+xml": [
+ "x3d",
+ "x3dz"
+ ],
+ "multipart/alternative": [],
+ "multipart/appledouble": [],
+ "multipart/byteranges": [],
+ "multipart/digest": [],
+ "multipart/encrypted": [],
+ "multipart/example": [],
+ "multipart/form-data": [],
+ "multipart/header-set": [],
+ "multipart/mixed": [],
+ "multipart/parallel": [],
+ "multipart/related": [],
+ "multipart/report": [],
+ "multipart/signed": [],
+ "multipart/voice-message": [],
+ "text/1d-interleaved-parityfec": [],
+ "text/cache-manifest": [
+ "appcache"
+ ],
+ "text/calendar": [
+ "ics",
+ "ifb"
+ ],
+ "text/css": [
+ "css"
+ ],
+ "text/csv": [
+ "csv"
+ ],
+ "text/directory": [],
+ "text/dns": [],
+ "text/ecmascript": [],
+ "text/enriched": [],
+ "text/example": [],
+ "text/fwdred": [],
+ "text/html": [
+ "html",
+ "htm"
+ ],
+ "text/javascript": [],
+ "text/n3": [
+ "n3"
+ ],
+ "text/parityfec": [],
+ "text/plain": [
+ "txt",
+ "text",
+ "conf",
+ "def",
+ "list",
+ "log",
+ "in"
+ ],
+ "text/prs.fallenstein.rst": [],
+ "text/prs.lines.tag": [
+ "dsc"
+ ],
+ "text/vnd.radisys.msml-basic-layout": [],
+ "text/red": [],
+ "text/rfc822-headers": [],
+ "text/richtext": [
+ "rtx"
+ ],
+ "text/rtf": [],
+ "text/rtp-enc-aescm128": [],
+ "text/rtx": [],
+ "text/sgml": [
+ "sgml",
+ "sgm"
+ ],
+ "text/t140": [],
+ "text/tab-separated-values": [
+ "tsv"
+ ],
+ "text/troff": [
+ "t",
+ "tr",
+ "roff",
+ "man",
+ "me",
+ "ms"
+ ],
+ "text/turtle": [
+ "ttl"
+ ],
+ "text/ulpfec": [],
+ "text/uri-list": [
+ "uri",
+ "uris",
+ "urls"
+ ],
+ "text/vcard": [
+ "vcard"
+ ],
+ "text/vnd.abc": [],
+ "text/vnd.curl": [
+ "curl"
+ ],
+ "text/vnd.curl.dcurl": [
+ "dcurl"
+ ],
+ "text/vnd.curl.scurl": [
+ "scurl"
+ ],
+ "text/vnd.curl.mcurl": [
+ "mcurl"
+ ],
+ "text/vnd.dmclientscript": [],
+ "text/vnd.dvb.subtitle": [
+ "sub"
+ ],
+ "text/vnd.esmertec.theme-descriptor": [],
+ "text/vnd.fly": [
+ "fly"
+ ],
+ "text/vnd.fmi.flexstor": [
+ "flx"
+ ],
+ "text/vnd.graphviz": [
+ "gv"
+ ],
+ "text/vnd.in3d.3dml": [
+ "3dml"
+ ],
+ "text/vnd.in3d.spot": [
+ "spot"
+ ],
+ "text/vnd.iptc.newsml": [],
+ "text/vnd.iptc.nitf": [],
+ "text/vnd.latex-z": [],
+ "text/vnd.motorola.reflex": [],
+ "text/vnd.ms-mediapackage": [],
+ "text/vnd.net2phone.commcenter.command": [],
+ "text/vnd.si.uricatalogue": [],
+ "text/vnd.sun.j2me.app-descriptor": [
+ "jad"
+ ],
+ "text/vnd.trolltech.linguist": [],
+ "text/vnd.wap.si": [],
+ "text/vnd.wap.sl": [],
+ "text/vnd.wap.wml": [
+ "wml"
+ ],
+ "text/vnd.wap.wmlscript": [
+ "wmls"
+ ],
+ "text/x-asm": [
+ "s",
+ "asm"
+ ],
+ "text/x-c": [
+ "c",
+ "cc",
+ "cxx",
+ "cpp",
+ "h",
+ "hh",
+ "dic"
+ ],
+ "text/x-fortran": [
+ "f",
+ "for",
+ "f77",
+ "f90"
+ ],
+ "text/x-java-source": [
+ "java"
+ ],
+ "text/x-opml": [
+ "opml"
+ ],
+ "text/x-pascal": [
+ "p",
+ "pas"
+ ],
+ "text/x-nfo": [
+ "nfo"
+ ],
+ "text/x-setext": [
+ "etx"
+ ],
+ "text/x-sfv": [
+ "sfv"
+ ],
+ "text/x-uuencode": [
+ "uu"
+ ],
+ "text/x-vcalendar": [
+ "vcs"
+ ],
+ "text/x-vcard": [
+ "vcf"
+ ],
+ "text/xml": [],
+ "text/xml-external-parsed-entity": [],
+ "video/1d-interleaved-parityfec": [],
+ "video/3gpp": [
+ "3gp"
+ ],
+ "video/3gpp-tt": [],
+ "video/3gpp2": [
+ "3g2"
+ ],
+ "video/bmpeg": [],
+ "video/bt656": [],
+ "video/celb": [],
+ "video/dv": [],
+ "video/example": [],
+ "video/h261": [
+ "h261"
+ ],
+ "video/h263": [
+ "h263"
+ ],
+ "video/h263-1998": [],
+ "video/h263-2000": [],
+ "video/h264": [
+ "h264"
+ ],
+ "video/h264-rcdo": [],
+ "video/h264-svc": [],
+ "video/jpeg": [
+ "jpgv"
+ ],
+ "video/jpeg2000": [],
+ "video/jpm": [
+ "jpm",
+ "jpgm"
+ ],
+ "video/mj2": [
+ "mj2",
+ "mjp2"
+ ],
+ "video/mp1s": [],
+ "video/mp2p": [],
+ "video/mp2t": [],
+ "video/mp4": [
+ "mp4",
+ "mp4v",
+ "mpg4"
+ ],
+ "video/mp4v-es": [],
+ "video/mpeg": [
+ "mpeg",
+ "mpg",
+ "mpe",
+ "m1v",
+ "m2v"
+ ],
+ "video/mpeg4-generic": [],
+ "video/mpv": [],
+ "video/nv": [],
+ "video/ogg": [
+ "ogv"
+ ],
+ "video/parityfec": [],
+ "video/pointer": [],
+ "video/quicktime": [
+ "qt",
+ "mov"
+ ],
+ "video/raw": [],
+ "video/rtp-enc-aescm128": [],
+ "video/rtx": [],
+ "video/smpte292m": [],
+ "video/ulpfec": [],
+ "video/vc1": [],
+ "video/vnd.cctv": [],
+ "video/vnd.dece.hd": [
+ "uvh",
+ "uvvh"
+ ],
+ "video/vnd.dece.mobile": [
+ "uvm",
+ "uvvm"
+ ],
+ "video/vnd.dece.mp4": [],
+ "video/vnd.dece.pd": [
+ "uvp",
+ "uvvp"
+ ],
+ "video/vnd.dece.sd": [
+ "uvs",
+ "uvvs"
+ ],
+ "video/vnd.dece.video": [
+ "uvv",
+ "uvvv"
+ ],
+ "video/vnd.directv.mpeg": [],
+ "video/vnd.directv.mpeg-tts": [],
+ "video/vnd.dlna.mpeg-tts": [],
+ "video/vnd.dvb.file": [
+ "dvb"
+ ],
+ "video/vnd.fvt": [
+ "fvt"
+ ],
+ "video/vnd.hns.video": [],
+ "video/vnd.iptvforum.1dparityfec-1010": [],
+ "video/vnd.iptvforum.1dparityfec-2005": [],
+ "video/vnd.iptvforum.2dparityfec-1010": [],
+ "video/vnd.iptvforum.2dparityfec-2005": [],
+ "video/vnd.iptvforum.ttsavc": [],
+ "video/vnd.iptvforum.ttsmpeg2": [],
+ "video/vnd.motorola.video": [],
+ "video/vnd.motorola.videop": [],
+ "video/vnd.mpegurl": [
+ "mxu",
+ "m4u"
+ ],
+ "video/vnd.ms-playready.media.pyv": [
+ "pyv"
+ ],
+ "video/vnd.nokia.interleaved-multimedia": [],
+ "video/vnd.nokia.videovoip": [],
+ "video/vnd.objectvideo": [],
+ "video/vnd.sealed.mpeg1": [],
+ "video/vnd.sealed.mpeg4": [],
+ "video/vnd.sealed.swf": [],
+ "video/vnd.sealedmedia.softseal.mov": [],
+ "video/vnd.uvvu.mp4": [
+ "uvu",
+ "uvvu"
+ ],
+ "video/vnd.vivo": [
+ "viv"
+ ],
+ "video/webm": [
+ "webm"
+ ],
+ "video/x-f4v": [
+ "f4v"
+ ],
+ "video/x-fli": [
+ "fli"
+ ],
+ "video/x-flv": [
+ "flv"
+ ],
+ "video/x-m4v": [
+ "m4v"
+ ],
+ "video/x-matroska": [
+ "mkv",
+ "mk3d",
+ "mks"
+ ],
+ "video/x-mng": [
+ "mng"
+ ],
+ "video/x-ms-asf": [
+ "asf",
+ "asx"
+ ],
+ "video/x-ms-vob": [
+ "vob"
+ ],
+ "video/x-ms-wm": [
+ "wm"
+ ],
+ "video/x-ms-wmv": [
+ "wmv"
+ ],
+ "video/x-ms-wmx": [
+ "wmx"
+ ],
+ "video/x-ms-wvx": [
+ "wvx"
+ ],
+ "video/x-msvideo": [
+ "avi"
+ ],
+ "video/x-sgi-movie": [
+ "movie"
+ ],
+ "video/x-smv": [
+ "smv"
+ ],
+ "x-conference/x-cooltalk": [
+ "ice"
+ ]
+}
--- /dev/null
+{
+ "text/vtt": [
+ "vtt"
+ ],
+ "application/x-chrome-extension": [
+ "crx"
+ ],
+ "text/x-component": [
+ "htc"
+ ],
+ "text/cache-manifest": [
+ "manifest"
+ ],
+ "application/octet-stream": [
+ "buffer"
+ ],
+ "application/mp4": [
+ "m4p"
+ ],
+ "audio/mp4": [
+ "m4a"
+ ],
+ "video/MP2T": [
+ "ts"
+ ],
+ "application/x-web-app-manifest+json": [
+ "webapp"
+ ],
+ "text/x-lua": [
+ "lua"
+ ],
+ "application/x-lua-bytecode": [
+ "luac"
+ ],
+ "text/x-markdown": [
+ "markdown",
+ "md",
+ "mkd"
+ ],
+ "text/plain": [
+ "ini"
+ ],
+ "application/dash+xml": [
+ "mdp"
+ ],
+ "font/opentype": [
+ "otf"
+ ],
+ "application/json": [
+ "map"
+ ],
+ "application/xml": [
+ "xsd"
+ ]
+}
--- /dev/null
+{
+ "name": "mime-types",
+ "description": "The ultimate javascript content-type utility.",
+ "version": "1.0.2",
+ "author": {
+ "name": "Jonathan Ong",
+ "email": "me@jongleberry.com",
+ "url": "http://jongleberry.com"
+ },
+ "contributors": [
+ {
+ "name": "Jeremiah Senkpiel",
+ "email": "fishrock123@rocketmail.com",
+ "url": "https://searchbeam.jit.su"
+ }
+ ],
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/expressjs/mime-types"
+ },
+ "license": "MIT",
+ "main": "lib",
+ "devDependencies": {
+ "co": "3",
+ "cogent": "0",
+ "mocha": "1",
+ "should": "3"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ },
+ "scripts": {
+ "test": "make test"
+ },
+ "gitHead": "e82b23836eb42003b8346fb31769da2fb7eb54e8",
+ "bugs": {
+ "url": "https://github.com/expressjs/mime-types/issues"
+ },
+ "homepage": "https://github.com/expressjs/mime-types",
+ "_id": "mime-types@1.0.2",
+ "_shasum": "995ae1392ab8affcbfcb2641dd054e943c0d5dce",
+ "_from": "mime-types@~1.0.1",
+ "_npmVersion": "1.4.21",
+ "_npmUser": {
+ "name": "dougwilson",
+ "email": "doug@somethingdoug.com"
+ },
+ "maintainers": [
+ {
+ "name": "jongleberry",
+ "email": "jonathanrichardong@gmail.com"
+ },
+ {
+ "name": "fishrock123",
+ "email": "fishrock123@rocketmail.com"
+ },
+ {
+ "name": "dougwilson",
+ "email": "doug@somethingdoug.com"
+ }
+ ],
+ "dist": {
+ "shasum": "995ae1392ab8affcbfcb2641dd054e943c0d5dce",
+ "tarball": "http://registry.npmjs.org/mime-types/-/mime-types-1.0.2.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/mime-types/-/mime-types-1.0.2.tgz",
+ "readme": "ERROR: No README data found!"
+}
"bugs": {
"url": "https://github.com/broofa/node-uuid/issues"
},
- "homepage": "https://github.com/broofa/node-uuid",
"_id": "node-uuid@1.4.1",
- "_from": "node-uuid@~1.4.0"
+ "dist": {
+ "shasum": "39aef510e5889a3dca9c895b506c73aae1bac048",
+ "tarball": "http://registry.npmjs.org/node-uuid/-/node-uuid-1.4.1.tgz"
+ },
+ "_from": "node-uuid@~1.4.0",
+ "_npmVersion": "1.3.6",
+ "_npmUser": {
+ "name": "broofa",
+ "email": "robert@broofa.com"
+ },
+ "maintainers": [
+ {
+ "name": "broofa",
+ "email": "robert@broofa.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "39aef510e5889a3dca9c895b506c73aae1bac048",
+ "_resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.1.tgz",
+ "homepage": "https://github.com/broofa/node-uuid"
}
;
}
+// Maps object to bi-dimensional array
+// Converts { foo: 'A', bar: [ 'b', 'B' ]} to
+// [ ['foo', 'A'], ['bar', 'b'], ['bar', 'B'] ]
+function map (obj) {
+ var key, val, arr = []
+ for (key in obj) {
+ val = obj[key]
+ if (Array.isArray(val))
+ for (var i = 0; i < val.length; i++)
+ arr.push([key, val[i]])
+ else
+ arr.push([key, val])
+ }
+ return arr
+}
+
+// Compare function for sort
+function compare (a, b) {
+ return a > b ? 1 : a < b ? -1 : 0
+}
+
function hmacsign (httpMethod, base_uri, params, consumer_secret, token_secret) {
// adapted from https://dev.twitter.com/docs/auth/oauth and
// https://dev.twitter.com/docs/auth/creating-signature
- var querystring = Object.keys(params).sort().map(function(key){
- // big WTF here with the escape + encoding but it's what twitter wants
- return escape(rfc3986(key)) + "%3D" + escape(rfc3986(params[key]))
- }).join('%26')
+ // Parameter normalization
+ // http://tools.ietf.org/html/rfc5849#section-3.4.1.3.2
+ var normalized = map(params)
+ // 1. First, the name and value of each parameter are encoded
+ .map(function (p) {
+ return [ rfc3986(p[0]), rfc3986(p[1] || '') ]
+ })
+ // 2. The parameters are sorted by name, using ascending byte value
+ // ordering. If two or more parameters share the same name, they
+ // are sorted by their value.
+ .sort(function (a, b) {
+ return compare(a[0], b[0]) || compare(a[1], b[1])
+ })
+ // 3. The name of each parameter is concatenated to its corresponding
+ // value using an "=" character (ASCII code 61) as a separator, even
+ // if the value is empty.
+ .map(function (p) { return p.join('=') })
+ // 4. The sorted name/value pairs are concatenated together into a
+ // single string by using an "&" character (ASCII code 38) as
+ // separator.
+ .join('&')
var base = [
- httpMethod ? httpMethod.toUpperCase() : 'GET',
+ rfc3986(httpMethod ? httpMethod.toUpperCase() : 'GET'),
rfc3986(base_uri),
- querystring
+ rfc3986(normalized)
].join('&')
var key = [
- consumer_secret,
+ consumer_secret || '',
token_secret || ''
].map(rfc3986).join('&')
},
"name": "oauth-sign",
"description": "OAuth 1 signing. Formerly a vendor lib in mikeal/request, now a standalone module.",
- "version": "0.3.0",
+ "version": "0.4.0",
"repository": {
"url": "https://github.com/mikeal/oauth-sign"
},
"bugs": {
"url": "https://github.com/mikeal/oauth-sign/issues"
},
- "homepage": "https://github.com/mikeal/oauth-sign",
- "_id": "oauth-sign@0.3.0",
- "_from": "oauth-sign@~0.3.0"
+ "_id": "oauth-sign@0.4.0",
+ "dist": {
+ "shasum": "f22956f31ea7151a821e5f2fb32c113cad8b9f69",
+ "tarball": "http://registry.npmjs.org/oauth-sign/-/oauth-sign-0.4.0.tgz"
+ },
+ "_from": "oauth-sign@~0.4.0",
+ "_npmVersion": "1.3.2",
+ "_npmUser": {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ },
+ "maintainers": [
+ {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "f22956f31ea7151a821e5f2fb32c113cad8b9f69",
+ "_resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.4.0.tgz",
+ "homepage": "https://github.com/mikeal/oauth-sign"
}
console.log('yOahq5m0YjDDjfjxHaXEsW9D+X0=')
assert.equal(upsign, 'yOahq5m0YjDDjfjxHaXEsW9D+X0=')
+// example in rfc5849
+var params = qs.parse('b5=%3D%253D&a3=a&c%40=&a2=r%20b' + '&' + 'c2&a3=2+q')
+params.oauth_consumer_key = '9djdj82h48djs9d2'
+params.oauth_token = 'kkk9d7dh3k39sjv7'
+params.oauth_nonce = '7d8f3e4a'
+params.oauth_signature_method = 'HMAC-SHA1'
+params.oauth_timestamp = '137131201'
+
+var rfc5849sign = hmacsign('POST', 'http://example.com/request',
+ params, "j49sk3j29djd", "dh893hdasih9")
+
+console.log(rfc5849sign)
+console.log('r6/TJjbCOr97/+UU0NsvSne7s5g=')
+assert.equal(rfc5849sign, 'r6/TJjbCOr97/+UU0NsvSne7s5g=')
+++ /dev/null
-[submodule "support/expresso"]
- path = support/expresso
- url = git://github.com/visionmedia/expresso.git
-[submodule "support/should"]
- path = support/should
- url = git://github.com/visionmedia/should.js.git
--- /dev/null
+node_modules
--- /dev/null
+{
+ "node": true,
+
+ "curly": true,
+ "latedef": true,
+ "quotmark": true,
+ "undef": true,
+ "unused": true,
+ "trailing": true
+}
-test
-.travis.yml
-benchmark.js
-component.json
-examples.js
-History.md
-Makefile
+.idea
+*.iml
+npm-debug.log
+dump.rdb
+node_modules
+results.tap
+results.xml
+npm-shrinkwrap.json
+config.json
+.DS_Store
+*/.DS_Store
+*/*/.DS_Store
+._*
+*/._*
+*/*/._*
+coverage.*
+lib-cov
+complexity.md
--- /dev/null
+language: node_js
+
+node_js:
+ - 0.10
\ No newline at end of file
--- /dev/null
+Please view our [hapijs contributing guide](https://github.com/hapijs/hapi/blob/master/CONTRIBUTING.md).
--- /dev/null
+Copyright (c) 2014 Nathan LaFreniere and other contributors.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * The names of any contributors may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ * * *
+
+The complete list of contributors can be found at: https://github.com/hapijs/qs/graphs/contributors
--- /dev/null
+test:
+ @node node_modules/lab/bin/lab
+test-cov:
+ @node node_modules/lab/bin/lab -t 100
+test-cov-html:
+ @node node_modules/lab/bin/lab -r html -o coverage.html
+
+.PHONY: test test-cov test-cov-html
\ No newline at end of file
-# node-querystring
+# qs
- query string parser for node and the browser supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others.
+A querystring parsing and stringifying library with some added security.
-## Installation
+[![Build Status](https://secure.travis-ci.org/hapijs/qs.svg)](http://travis-ci.org/hapijs/qs)
- $ npm install qs
+Lead Maintainer: [Nathan LaFreniere](https://github.com/nlf)
-## Examples
+The **qs** module was originally created and maintained by [TJ Holowaychuk](https://github.com/visionmedia/node-querystring).
-```js
-var qs = require('qs');
+## Usage
-qs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com');
-// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } }
+```javascript
+var Qs = require('qs');
-qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }})
-// => user[name]=Tobi&user[email]=tobi%40learnboost.com
+var obj = Qs.parse('a=c'); // { a: 'c' }
+var str = Qs.stringify(obj); // 'a=c'
```
-## Testing
+### Parsing Objects
-Install dev dependencies:
+```javascript
+Qs.parse(string, [depth], [delimiter]);
+```
- $ npm install -d
+**qs** allows you to create nested objects within your query strings, by surrounding the name of sub-keys with square brackets `[]`.
+For example, the string `'foo[bar]=baz'` converts to:
-and execute:
+```javascript
+{
+ foo: {
+ bar: 'baz'
+ }
+}
+```
- $ make test
+URI encoded strings work too:
-browser:
+```javascript
+Qs.parse('a%5Bb%5D=c');
+// { a: { b: 'c' } }
+```
- $ open test/browser/index.html
+You can also nest your objects, like `'foo[bar][baz]=foobarbaz'`:
-## License
+```javascript
+{
+ foo: {
+ bar: {
+ baz: 'foobarbaz'
+ }
+ }
+}
+```
-(The MIT License)
+By default, when nesting objects **qs** will only parse up to 5 children deep. This means if you attempt to parse a string like
+`'a[b][c][d][e][f][g][h][i]=j'` your resulting object will be:
+
+```javascript
+{
+ a: {
+ b: {
+ c: {
+ d: {
+ e: {
+ f: {
+ '[g][h][i]': 'j'
+ }
+ }
+ }
+ }
+ }
+ }
+}
+```
+
+This depth can be overridden by passing a `depth` option to `Qs.parse(string, depth)`:
-Copyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca>
+```javascript
+Qs.parse('a[b][c][d][e][f][g][h][i]=j', 1);
+// { a: { b: { '[c][d][e][f][g][h][i]': 'j' } } }
+```
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
+The depth limit mitigate abuse when **qs** is used to parse user input, and it is recommended to keep it a reasonably small number.
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
+An optional delimiter can also be passed:
+
+```javascript
+Qs.parse('a=b;c=d', ';');
+// { a: 'b', c: 'd' }
+```
+
+### Parsing Arrays
+
+**qs** can also parse arrays using a similar `[]` notation:
+
+```javascript
+Qs.parse('a[]=b&a[]=c');
+// { a: ['b', 'c'] }
+```
+
+You may specify an index as well:
+
+```javascript
+Qs.parse('a[1]=c&a[0]=b');
+// { a: ['b', 'c'] }
+```
+
+Note that the only difference between an index in an array and a key in an object is that the value between the brackets must be a number
+to create an array. When creating arrays with specific indices, **qs** will compact a sparse array to only the existing values preserving
+their order:
+
+```javascript
+Qs.parse('a[1]=b&a[15]=c');
+// { a: ['b', 'c'] }
+```
+
+Note that an empty string is also a value, and will be preserved:
+
+```javascript
+Qs.parse('a[]=&a[]=b');
+// { a: ['', 'b'] }
+Qs.parse('a[0]=b&a[1]=&a[2]=c');
+// { a: ['b', '', 'c'] }
+```
+
+**qs** will also limit specifying indices in an array to a maximum index of `20`. Any array members with an index of greater than `20` will
+instead be converted to an object with the index as the key:
+
+```javascript
+Qs.parse('a[100]=b');
+// { a: { '100': 'b' } }
+```
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
+If you mix notations, **qs** will merge the two items into an object:
+
+```javascript
+Qs.parse('a[0]=b&a[b]=c');
+// { a: { '0': 'b', b: 'c' } }
+```
+
+You can also create arrays of objects:
+
+```javascript
+Qs.parse('a[][b]=c');
+// { a: [{ b: 'c' }] }
+```
+
+### Stringifying
+
+```javascript
+Qs.stringify(object, [delimiter]);
+```
+
+When stringifying, **qs** always URI encodes output. Objects are stringified as you would expect:
+
+```javascript
+Qs.stringify({ a: 'b' });
+// 'a=b'
+Qs.stringify({ a: { b: 'c' } });
+// 'a%5Bb%5D=c'
+```
+
+Examples beyond this point will be shown as though the output is not URI encoded for clarity. Please note that the return values in these cases *will* be URI encoded during real usage.
+
+When arrays are stringified, they are always given explicit indices:
+
+```javascript
+Qs.stringify({ a: ['b', 'c', 'd'] });
+// 'a[0]=b&a[1]=c&a[2]=d'
+```
+
+Empty strings and null values will omit the value, but the equals sign (=) remains in place:
+
+```javascript
+Qs.stringify({ a: '' });
+// 'a='
+```
+
+Properties that are set to `undefined` will be omitted entirely:
+
+```javascript
+Qs.stringify({ a: null, b: undefined });
+// 'a='
+```
+
+The delimiter may be overridden with stringify as well:
+
+```javascript
+Qs.stringify({ a: 'b', c: 'd' }, ';');
+// 'a=b;c=d'
+```
-/**
- * Object#toString() ref for stringify().
- */
-
-var toString = Object.prototype.toString;
-
-/**
- * Object#hasOwnProperty ref
- */
-
-var hasOwnProperty = Object.prototype.hasOwnProperty;
-
-/**
- * Array#indexOf shim.
- */
-
-var indexOf = typeof Array.prototype.indexOf === 'function'
- ? function(arr, el) { return arr.indexOf(el); }
- : function(arr, el) {
- for (var i = 0; i < arr.length; i++) {
- if (arr[i] === el) return i;
- }
- return -1;
- };
-
-/**
- * Array.isArray shim.
- */
-
-var isArray = Array.isArray || function(arr) {
- return toString.call(arr) == '[object Array]';
-};
-
-/**
- * Object.keys shim.
- */
-
-var objectKeys = Object.keys || function(obj) {
- var ret = [];
- for (var key in obj) {
- if (obj.hasOwnProperty(key)) {
- ret.push(key);
- }
- }
- return ret;
-};
-
-/**
- * Array#forEach shim.
- */
-
-var forEach = typeof Array.prototype.forEach === 'function'
- ? function(arr, fn) { return arr.forEach(fn); }
- : function(arr, fn) {
- for (var i = 0; i < arr.length; i++) fn(arr[i]);
- };
-
-/**
- * Array#reduce shim.
- */
-
-var reduce = function(arr, fn, initial) {
- if (typeof arr.reduce === 'function') return arr.reduce(fn, initial);
- var res = initial;
- for (var i = 0; i < arr.length; i++) res = fn(res, arr[i]);
- return res;
-};
-
-/**
- * Cache non-integer test regexp.
- */
-
-var isint = /^[0-9]+$/;
-
-function promote(parent, key) {
- if (parent[key].length == 0) return parent[key] = {}
- var t = {};
- for (var i in parent[key]) {
- if (hasOwnProperty.call(parent[key], i)) {
- t[i] = parent[key][i];
- }
- }
- parent[key] = t;
- return t;
-}
-
-function parse(parts, parent, key, val) {
- var part = parts.shift();
-
- // illegal
- if (Object.getOwnPropertyDescriptor(Object.prototype, key)) return;
-
- // end
- if (!part) {
- if (isArray(parent[key])) {
- parent[key].push(val);
- } else if ('object' == typeof parent[key]) {
- parent[key] = val;
- } else if ('undefined' == typeof parent[key]) {
- parent[key] = val;
- } else {
- parent[key] = [parent[key], val];
- }
- // array
- } else {
- var obj = parent[key] = parent[key] || [];
- if (']' == part) {
- if (isArray(obj)) {
- if ('' != val) obj.push(val);
- } else if ('object' == typeof obj) {
- obj[objectKeys(obj).length] = val;
- } else {
- obj = parent[key] = [parent[key], val];
- }
- // prop
- } else if (~indexOf(part, ']')) {
- part = part.substr(0, part.length - 1);
- if (!isint.test(part) && isArray(obj)) obj = promote(parent, key);
- parse(parts, obj, part, val);
- // key
- } else {
- if (!isint.test(part) && isArray(obj)) obj = promote(parent, key);
- parse(parts, obj, part, val);
- }
- }
-}
-
-/**
- * Merge parent key/val pair.
- */
-
-function merge(parent, key, val){
- if (~indexOf(key, ']')) {
- var parts = key.split('[')
- , len = parts.length
- , last = len - 1;
- parse(parts, parent, 'base', val);
- // optimize
- } else {
- if (!isint.test(key) && isArray(parent.base)) {
- var t = {};
- for (var k in parent.base) t[k] = parent.base[k];
- parent.base = t;
- }
- set(parent.base, key, val);
- }
-
- return parent;
-}
-
-/**
- * Compact sparse arrays.
- */
-
-function compact(obj) {
- if ('object' != typeof obj) return obj;
-
- if (isArray(obj)) {
- var ret = [];
-
- for (var i in obj) {
- if (hasOwnProperty.call(obj, i)) {
- ret.push(obj[i]);
- }
- }
-
- return ret;
- }
-
- for (var key in obj) {
- obj[key] = compact(obj[key]);
- }
-
- return obj;
-}
-
-/**
- * Parse the given obj.
- */
-
-function parseObject(obj){
- var ret = { base: {} };
-
- forEach(objectKeys(obj), function(name){
- merge(ret, name, obj[name]);
- });
-
- return compact(ret.base);
-}
-
-/**
- * Parse the given str.
- */
-
-function parseString(str){
- var ret = reduce(String(str).split('&'), function(ret, pair){
- var eql = indexOf(pair, '=')
- , brace = lastBraceInKey(pair)
- , key = pair.substr(0, brace || eql)
- , val = pair.substr(brace || eql, pair.length)
- , val = val.substr(indexOf(val, '=') + 1, val.length);
-
- // ?foo
- if ('' == key) key = pair, val = '';
- if ('' == key) return ret;
-
- return merge(ret, decode(key), decode(val));
- }, { base: {} }).base;
-
- return compact(ret);
-}
-
-/**
- * Parse the given query `str` or `obj`, returning an object.
- *
- * @param {String} str | {Object} obj
- * @return {Object}
- * @api public
- */
-
-exports.parse = function(str){
- if (null == str || '' == str) return {};
- return 'object' == typeof str
- ? parseObject(str)
- : parseString(str);
-};
-
-/**
- * Turn the given `obj` into a query string
- *
- * @param {Object} obj
- * @return {String}
- * @api public
- */
-
-var stringify = exports.stringify = function(obj, prefix) {
- if (isArray(obj)) {
- return stringifyArray(obj, prefix);
- } else if ('[object Object]' == toString.call(obj)) {
- return stringifyObject(obj, prefix);
- } else if ('string' == typeof obj) {
- return stringifyString(obj, prefix);
- } else {
- return prefix + '=' + encodeURIComponent(String(obj));
- }
-};
-
-/**
- * Stringify the given `str`.
- *
- * @param {String} str
- * @param {String} prefix
- * @return {String}
- * @api private
- */
-
-function stringifyString(str, prefix) {
- if (!prefix) throw new TypeError('stringify expects an object');
- return prefix + '=' + encodeURIComponent(str);
-}
-
-/**
- * Stringify the given `arr`.
- *
- * @param {Array} arr
- * @param {String} prefix
- * @return {String}
- * @api private
- */
-
-function stringifyArray(arr, prefix) {
- var ret = [];
- if (!prefix) throw new TypeError('stringify expects an object');
- for (var i = 0; i < arr.length; i++) {
- ret.push(stringify(arr[i], prefix + '[' + i + ']'));
- }
- return ret.join('&');
-}
-
-/**
- * Stringify the given `obj`.
- *
- * @param {Object} obj
- * @param {String} prefix
- * @return {String}
- * @api private
- */
-
-function stringifyObject(obj, prefix) {
- var ret = []
- , keys = objectKeys(obj)
- , key;
-
- for (var i = 0, len = keys.length; i < len; ++i) {
- key = keys[i];
- if ('' == key) continue;
- if (null == obj[key]) {
- ret.push(encodeURIComponent(key) + '=');
- } else {
- ret.push(stringify(obj[key], prefix
- ? prefix + '[' + encodeURIComponent(key) + ']'
- : encodeURIComponent(key)));
- }
- }
-
- return ret.join('&');
-}
-
-/**
- * Set `obj`'s `key` to `val` respecting
- * the weird and wonderful syntax of a qs,
- * where "foo=bar&foo=baz" becomes an array.
- *
- * @param {Object} obj
- * @param {String} key
- * @param {String} val
- * @api private
- */
-
-function set(obj, key, val) {
- var v = obj[key];
- if (Object.getOwnPropertyDescriptor(Object.prototype, key)) return;
- if (undefined === v) {
- obj[key] = val;
- } else if (isArray(v)) {
- v.push(val);
- } else {
- obj[key] = [v, val];
- }
-}
-
-/**
- * Locate last brace in `str` within the key.
- *
- * @param {String} str
- * @return {Number}
- * @api private
- */
-
-function lastBraceInKey(str) {
- var len = str.length
- , brace
- , c;
- for (var i = 0; i < len; ++i) {
- c = str[i];
- if (']' == c) brace = false;
- if ('[' == c) brace = true;
- if ('=' == c && !brace) return i;
- }
-}
-
-/**
- * Decode `str`.
- *
- * @param {String} str
- * @return {String}
- * @api private
- */
-
-function decode(str) {
- try {
- return decodeURIComponent(str.replace(/\+/g, ' '));
- } catch (err) {
- return str;
- }
-}
+module.exports = require('./lib');
--- /dev/null
+// Load modules
+
+var Stringify = require('./stringify');
+var Parse = require('./parse');
+
+
+// Declare internals
+
+var internals = {};
+
+
+module.exports = {
+ stringify: Stringify,
+ parse: Parse
+};
--- /dev/null
+// Load modules
+
+var Utils = require('./utils');
+
+
+// Declare internals
+
+var internals = {
+ delimiter: '&',
+ depth: 5,
+ arrayLimit: 20,
+ parametersLimit: 1000
+};
+
+
+internals.parseValues = function (str, delimiter) {
+
+ delimiter = typeof delimiter === 'string' ? delimiter : internals.delimiter;
+
+ var obj = {};
+ var parts = str.split(delimiter, internals.parametersLimit);
+
+ for (var i = 0, il = parts.length; i < il; ++i) {
+ var part = parts[i];
+ var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1;
+
+ if (pos === -1) {
+ obj[Utils.decode(part)] = '';
+ }
+ else {
+ var key = Utils.decode(part.slice(0, pos));
+ var val = Utils.decode(part.slice(pos + 1));
+
+ if (!obj[key]) {
+ obj[key] = val;
+ }
+ else {
+ obj[key] = [].concat(obj[key]).concat(val);
+ }
+ }
+ }
+
+ return obj;
+};
+
+
+internals.parseObject = function (chain, val) {
+
+ if (!chain.length) {
+ return val;
+ }
+
+ var root = chain.shift();
+
+ var obj = {};
+ if (root === '[]') {
+ obj = [];
+ obj = obj.concat(internals.parseObject(chain, val));
+ }
+ else {
+ var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root;
+ var index = parseInt(cleanRoot, 10);
+ if (!isNaN(index) &&
+ root !== cleanRoot &&
+ index <= internals.arrayLimit) {
+
+ obj = [];
+ obj[index] = internals.parseObject(chain, val);
+ }
+ else {
+ obj[cleanRoot] = internals.parseObject(chain, val);
+ }
+ }
+
+ return obj;
+};
+
+
+internals.parseKeys = function (key, val, depth) {
+
+ if (!key) {
+ return;
+ }
+
+ // The regex chunks
+
+ var parent = /^([^\[\]]*)/;
+ var child = /(\[[^\[\]]*\])/g;
+
+ // Get the parent
+
+ var segment = parent.exec(key);
+
+ // Don't allow them to overwrite object prototype properties
+
+ if (Object.prototype.hasOwnProperty(segment[1])) {
+ return;
+ }
+
+ // Stash the parent if it exists
+
+ var keys = [];
+ if (segment[1]) {
+ keys.push(segment[1]);
+ }
+
+ // Loop through children appending to the array until we hit depth
+
+ var i = 0;
+ while ((segment = child.exec(key)) !== null && i < depth) {
+
+ ++i;
+ if (!Object.prototype.hasOwnProperty(segment[1].replace(/\[|\]/g, ''))) {
+ keys.push(segment[1]);
+ }
+ }
+
+ // If there's a remainder, just add whatever is left
+
+ if (segment) {
+ keys.push('[' + key.slice(segment.index) + ']');
+ }
+
+ return internals.parseObject(keys, val);
+};
+
+
+module.exports = function (str, depth, delimiter) {
+
+ if (str === '' ||
+ str === null ||
+ typeof str === 'undefined') {
+
+ return {};
+ }
+
+ if (typeof depth !== 'number') {
+ delimiter = depth;
+ depth = internals.depth;
+ }
+
+ var tempObj = typeof str === 'string' ? internals.parseValues(str, delimiter) : Utils.clone(str);
+ var obj = {};
+
+ // Iterate over the keys and setup the new object
+ //
+ for (var key in tempObj) {
+ if (tempObj.hasOwnProperty(key)) {
+ var newObj = internals.parseKeys(key, tempObj[key], depth);
+ obj = Utils.merge(obj, newObj);
+ }
+ }
+
+ return Utils.compact(obj);
+};
--- /dev/null
+// Load modules
+
+
+// Declare internals
+
+var internals = {
+ delimiter: '&'
+};
+
+
+internals.stringify = function (obj, prefix) {
+
+ if (Buffer.isBuffer(obj)) {
+ obj = obj.toString();
+ }
+ else if (obj instanceof Date) {
+ obj = obj.toISOString();
+ }
+ else if (obj === null) {
+ obj = '';
+ }
+
+ if (typeof obj === 'string' ||
+ typeof obj === 'number' ||
+ typeof obj === 'boolean') {
+
+ return [encodeURIComponent(prefix) + '=' + encodeURIComponent(obj)];
+ }
+
+ var values = [];
+
+ for (var key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ values = values.concat(internals.stringify(obj[key], prefix + '[' + key + ']'));
+ }
+ }
+
+ return values;
+};
+
+
+module.exports = function (obj, delimiter) {
+
+ delimiter = typeof delimiter === 'undefined' ? internals.delimiter : delimiter;
+
+ var keys = [];
+
+ for (var key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ keys = keys.concat(internals.stringify(obj[key], key));
+ }
+ }
+
+ return keys.join(delimiter);
+};
--- /dev/null
+// Load modules
+
+
+// Declare internals
+
+var internals = {};
+
+
+exports.arrayToObject = function (source) {
+
+ var obj = {};
+ for (var i = 0, il = source.length; i < il; ++i) {
+ if (typeof source[i] !== 'undefined') {
+
+ obj[i] = source[i];
+ }
+ }
+
+ return obj;
+};
+
+
+exports.clone = function (source) {
+
+ if (typeof source !== 'object' ||
+ source === null) {
+
+ return source;
+ }
+
+ if (Buffer.isBuffer(source)) {
+ return source.toString();
+ }
+
+ var obj = Array.isArray(source) ? [] : {};
+ for (var i in source) {
+ if (source.hasOwnProperty(i)) {
+ obj[i] = exports.clone(source[i]);
+ }
+ }
+
+ return obj;
+};
+
+
+exports.merge = function (target, source) {
+
+ if (!source) {
+ return target;
+ }
+
+ var obj = exports.clone(target);
+
+ if (Array.isArray(source)) {
+ for (var i = 0, il = source.length; i < il; ++i) {
+ if (typeof source[i] !== 'undefined') {
+ if (typeof obj[i] === 'object') {
+ obj[i] = exports.merge(obj[i], source[i]);
+ }
+ else {
+ obj[i] = source[i];
+ }
+ }
+ }
+
+ return obj;
+ }
+
+ if (Array.isArray(obj)) {
+ obj = exports.arrayToObject(obj);
+ }
+
+ var keys = Object.keys(source);
+ for (var k = 0, kl = keys.length; k < kl; ++k) {
+ var key = keys[k];
+ var value = source[key];
+
+ if (value &&
+ typeof value === 'object') {
+
+ if (!obj[key]) {
+ obj[key] = exports.clone(value);
+ }
+ else {
+ obj[key] = exports.merge(obj[key], value);
+ }
+ }
+ else {
+ obj[key] = value;
+ }
+ }
+
+ return obj;
+};
+
+
+exports.decode = function (str) {
+
+ try {
+ return decodeURIComponent(str.replace(/\+/g, ' '));
+ } catch (e) {
+ return str;
+ }
+};
+
+
+exports.compact = function (obj) {
+
+ if (typeof obj !== 'object' || obj === null) {
+ return obj;
+ }
+
+ var compacted = {};
+
+ for (var key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ if (Array.isArray(obj[key])) {
+ compacted[key] = [];
+
+ for (var i = 0, l = obj[key].length; i < l; i++) {
+ if (typeof obj[key][i] !== 'undefined') {
+ compacted[key].push(obj[key][i]);
+ }
+ }
+ }
+ else {
+ compacted[key] = exports.compact(obj[key]);
+ }
+ }
+ }
+
+ return compacted;
+};
{
"name": "qs",
- "description": "querystring parser",
- "version": "0.6.6",
- "keywords": [
- "query string",
- "parser",
- "component"
- ],
- "repository": {
- "type": "git",
- "url": "git://github.com/visionmedia/node-querystring.git"
- },
+ "version": "1.2.2",
+ "description": "A querystring parser that supports nesting and arrays, with a depth limit",
+ "homepage": "https://github.com/hapijs/qs",
+ "main": "index.js",
+ "dependencies": {},
"devDependencies": {
- "mocha": "*",
- "expect.js": "*"
+ "lab": "3.x.x"
},
"scripts": {
- "test": "make test"
+ "test": "make test-cov"
},
- "author": {
- "name": "TJ Holowaychuk",
- "email": "tj@vision-media.ca",
- "url": "http://tjholowaychuk.com"
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/hapijs/qs.git"
},
- "main": "index",
- "engines": {
- "node": "*"
+ "keywords": [
+ "querystring",
+ "qs"
+ ],
+ "author": {
+ "name": "Nathan LaFreniere",
+ "email": "quitlahok@gmail.com"
},
- "readme": "# node-querystring\n\n query string parser for node and the browser supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others.\n\n## Installation\n\n $ npm install qs\n\n## Examples\n\n```js\nvar qs = require('qs');\n\nqs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com');\n// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } }\n\nqs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }})\n// => user[name]=Tobi&user[email]=tobi%40learnboost.com\n```\n\n## Testing\n\nInstall dev dependencies:\n\n $ npm install -d\n\nand execute:\n\n $ make test\n\nbrowser:\n\n $ open test/browser/index.html\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
- "readmeFilename": "Readme.md",
+ "licenses": [
+ {
+ "type": "BSD",
+ "url": "http://github.com/hapijs/qs/raw/master/LICENSE"
+ }
+ ],
+ "gitHead": "bd9455fea88d1c51a80dbf57ef0f99b4e553177d",
"bugs": {
- "url": "https://github.com/visionmedia/node-querystring/issues"
+ "url": "https://github.com/hapijs/qs/issues"
+ },
+ "_id": "qs@1.2.2",
+ "_shasum": "19b57ff24dc2a99ce1f8bdf6afcda59f8ef61f88",
+ "_from": "qs@~1.2.0",
+ "_npmVersion": "1.4.21",
+ "_npmUser": {
+ "name": "hueniverse",
+ "email": "eran@hueniverse.com"
+ },
+ "maintainers": [
+ {
+ "name": "nlf",
+ "email": "quitlahok@gmail.com"
+ },
+ {
+ "name": "hueniverse",
+ "email": "eran@hueniverse.com"
+ }
+ ],
+ "dist": {
+ "shasum": "19b57ff24dc2a99ce1f8bdf6afcda59f8ef61f88",
+ "tarball": "http://registry.npmjs.org/qs/-/qs-1.2.2.tgz"
},
- "homepage": "https://github.com/visionmedia/node-querystring",
- "_id": "qs@0.6.6",
- "_from": "qs@~0.6.0"
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/qs/-/qs-1.2.2.tgz",
+ "readme": "ERROR: No README data found!"
}
--- /dev/null
+// Load modules
+
+var Lab = require('lab');
+var Qs = require('../');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('#parse', function () {
+
+ it('parses a simple string', function (done) {
+
+ expect(Qs.parse('0=foo')).to.deep.equal({ '0': 'foo' });
+ expect(Qs.parse('foo=c++')).to.deep.equal({ foo: 'c ' });
+ expect(Qs.parse('a[>=]=23')).to.deep.equal({ a: { '>=': '23' } });
+ expect(Qs.parse('a[<=>]==23')).to.deep.equal({ a: { '<=>': '=23' } });
+ expect(Qs.parse('a[==]=23')).to.deep.equal({ a: { '==': '23' } });
+ expect(Qs.parse('foo')).to.deep.equal({ foo: '' });
+ expect(Qs.parse('foo=bar')).to.deep.equal({ foo: 'bar' });
+ expect(Qs.parse(' foo = bar = baz ')).to.deep.equal({ ' foo ': ' bar = baz ' });
+ expect(Qs.parse('foo=bar=baz')).to.deep.equal({ foo: 'bar=baz' });
+ expect(Qs.parse('foo=bar&bar=baz')).to.deep.equal({ foo: 'bar', bar: 'baz' });
+ expect(Qs.parse('foo=bar&baz')).to.deep.equal({ foo: 'bar', baz: '' });
+ expect(Qs.parse('cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World')).to.deep.equal({
+ cht: 'p3',
+ chd: 't:60,40',
+ chs: '250x100',
+ chl: 'Hello|World'
+ });
+ done();
+ });
+
+ it('parses a single nested string', function (done) {
+
+ expect(Qs.parse('a[b]=c')).to.deep.equal({ a: { b: 'c' } });
+ done();
+ });
+
+ it('parses a double nested string', function (done) {
+
+ expect(Qs.parse('a[b][c]=d')).to.deep.equal({ a: { b: { c: 'd' } } });
+ done();
+ });
+
+ it('defaults to a depth of 5', function (done) {
+
+ expect(Qs.parse('a[b][c][d][e][f][g][h]=i')).to.deep.equal({ a: { b: { c: { d: { e: { f: { '[g][h]': 'i' } } } } } } });
+ done();
+ });
+
+ it('only parses one level when depth = 1', function (done) {
+
+ expect(Qs.parse('a[b][c]=d', 1)).to.deep.equal({ a: { b: { '[c]': 'd' } } });
+ expect(Qs.parse('a[b][c][d]=e', 1)).to.deep.equal({ a: { b: { '[c][d]': 'e' } } });
+ done();
+ });
+
+ it('parses a simple array', function (done) {
+
+ expect(Qs.parse('a=b&a=c')).to.deep.equal({ a: ['b', 'c'] });
+ done();
+ });
+
+ it('parses an explicit array', function (done) {
+
+ expect(Qs.parse('a[]=b')).to.deep.equal({ a: ['b'] });
+ expect(Qs.parse('a[]=b&a[]=c')).to.deep.equal({ a: ['b', 'c'] });
+ expect(Qs.parse('a[]=b&a[]=c&a[]=d')).to.deep.equal({ a: ['b', 'c', 'd'] });
+ done();
+ });
+
+ it('parses a nested array', function (done) {
+
+ expect(Qs.parse('a[b][]=c&a[b][]=d')).to.deep.equal({ a: { b: ['c', 'd'] } });
+ expect(Qs.parse('a[>=]=25')).to.deep.equal({ a: { '>=': '25' } });
+ done();
+ });
+
+ it('allows to specify array indices', function (done) {
+
+ expect(Qs.parse('a[1]=c&a[0]=b&a[2]=d')).to.deep.equal({ a: ['b', 'c', 'd'] });
+ expect(Qs.parse('a[1]=c&a[0]=b')).to.deep.equal({ a: ['b', 'c'] });
+ expect(Qs.parse('a[1]=c')).to.deep.equal({ a: ['c'] });
+ done();
+ });
+
+ it('limits specific array indices to 20', function (done) {
+
+ expect(Qs.parse('a[20]=a')).to.deep.equal({ a: ['a'] });
+ expect(Qs.parse('a[21]=a')).to.deep.equal({ a: { '21': 'a' } });
+ done();
+ });
+
+ it('supports encoded = signs', function (done) {
+
+ expect(Qs.parse('he%3Dllo=th%3Dere')).to.deep.equal({ 'he=llo': 'th=ere' });
+ done();
+ });
+
+ it('is ok with url encoded strings', function (done) {
+
+ expect(Qs.parse('a[b%20c]=d')).to.deep.equal({ a: { 'b c': 'd' } });
+ expect(Qs.parse('a[b]=c%20d')).to.deep.equal({ a: { b: 'c d' } });
+ done();
+ });
+
+ it('allows brackets in the value', function (done) {
+
+ expect(Qs.parse('pets=["tobi"]')).to.deep.equal({ pets: '["tobi"]' });
+ expect(Qs.parse('operators=[">=", "<="]')).to.deep.equal({ operators: '[">=", "<="]' });
+ done();
+ });
+
+ it('allows empty values', function (done) {
+
+ expect(Qs.parse('')).to.deep.equal({});
+ expect(Qs.parse(null)).to.deep.equal({});
+ expect(Qs.parse(undefined)).to.deep.equal({});
+ done();
+ });
+
+ it('transforms arrays to objects', function (done) {
+
+ expect(Qs.parse('foo[0]=bar&foo[bad]=baz')).to.deep.equal({ foo: { '0': 'bar', bad: 'baz' } });
+ expect(Qs.parse('foo[bad]=baz&foo[0]=bar')).to.deep.equal({ foo: { bad: 'baz', '0': 'bar' } });
+ expect(Qs.parse('foo[bad]=baz&foo[]=bar')).to.deep.equal({ foo: { bad: 'baz', '0': 'bar' } });
+ expect(Qs.parse('foo[]=bar&foo[bad]=baz')).to.deep.equal({ foo: { '0': 'bar', bad: 'baz' } });
+ expect(Qs.parse('foo[bad]=baz&foo[]=bar&foo[]=foo')).to.deep.equal({ foo: { bad: 'baz', '0': 'bar', '1': 'foo' } });
+ expect(Qs.parse('foo[0][a]=a&foo[0][b]=b&foo[1][a]=aa&foo[1][b]=bb')).to.deep.equal({foo: [ {a: 'a', b: 'b'}, {a: 'aa', b: 'bb'} ]});
+ done();
+ });
+
+ it('correctly prunes undefined values when converting an array to an object', function (done) {
+
+ expect(Qs.parse('a[2]=b&a[99999999]=c')).to.deep.equal({ a: { '2': 'b', '99999999': 'c' } });
+ done();
+ });
+
+ it('supports malformed uri characters', function (done) {
+
+ expect(Qs.parse('{%:%}')).to.deep.equal({ '{%:%}': '' });
+ expect(Qs.parse('foo=%:%}')).to.deep.equal({ foo: '%:%}' });
+ done();
+ });
+
+ it('doesn\'t produce empty keys', function (done) {
+
+ expect(Qs.parse('_r=1&')).to.deep.equal({ '_r': '1' });
+ done();
+ });
+
+ it('cannot override prototypes', function (done) {
+
+ var obj = Qs.parse('toString=bad&bad[toString]=bad&constructor=bad');
+ expect(typeof obj.toString).to.equal('function');
+ expect(typeof obj.bad.toString).to.equal('function');
+ expect(typeof obj.constructor).to.equal('function');
+ done();
+ });
+
+ it('cannot access Object prototype', function (done) {
+
+ Qs.parse('constructor[prototype][bad]=bad');
+ Qs.parse('bad[constructor][prototype][bad]=bad');
+ expect(typeof Object.prototype.bad).to.equal('undefined');
+ done();
+ });
+
+ it('parses arrays of objects', function (done) {
+
+ expect(Qs.parse('a[][b]=c')).to.deep.equal({ a: [{ b: 'c' }] });
+ expect(Qs.parse('a[0][b]=c')).to.deep.equal({ a: [{ b: 'c' }] });
+ done();
+ });
+
+ it('allows for empty strings in arrays', function (done) {
+
+ expect(Qs.parse('a[]=b&a[]=&a[]=c')).to.deep.equal({ a: ['b', '', 'c'] });
+ expect(Qs.parse('a[0]=b&a[1]=&a[2]=c&a[19]=')).to.deep.equal({ a: ['b', '', 'c', ''] });
+ done();
+ });
+
+ it('compacts sparse arrays', function (done) {
+
+ expect(Qs.parse('a[10]=1&a[2]=2')).to.deep.equal({ a: ['2', '1'] });
+ done();
+ });
+
+ it('parses semi-parsed strings', function (done) {
+
+ expect(Qs.parse({ 'a[b]': 'c' })).to.deep.equal({ a: { b: 'c' } });
+ expect(Qs.parse({ 'a[b]': 'c', 'a[d]': 'e' })).to.deep.equal({ a: { b: 'c', d: 'e' } });
+ done();
+ });
+
+ it('parses buffers to strings', function (done) {
+
+ var b = new Buffer('test');
+ expect(Qs.parse({ a: b })).to.deep.equal({ a: b.toString() });
+ done();
+ });
+
+ it('continues parsing when no parent is found', function (done) {
+
+ expect(Qs.parse('[]&a=b')).to.deep.equal({ '0': '', a: 'b' });
+ expect(Qs.parse('[foo]=bar')).to.deep.equal({ foo: 'bar' });
+ done();
+ });
+
+ it('does not error when parsing a very long array', function (done) {
+
+ var str = 'a[]=a';
+ while (Buffer.byteLength(str) < 128 * 1024) {
+ str += '&' + str;
+ }
+
+ expect(function () {
+
+ Qs.parse(str);
+ }).to.not.throw();
+
+ done();
+ });
+
+ it('should not throw when a native prototype has an enumerable property', { parallel: false }, function (done) {
+
+ Object.prototype.crash = '';
+ Array.prototype.crash = '';
+ expect(Qs.parse.bind(null, 'a=b')).to.not.throw();
+ expect(Qs.parse('a=b')).to.deep.equal({ a: 'b' });
+ expect(Qs.parse.bind(null, 'a[][b]=c')).to.not.throw();
+ expect(Qs.parse('a[][b]=c')).to.deep.equal({ a: [{ b: 'c' }] });
+ delete Object.prototype.crash;
+ delete Array.prototype.crash;
+ done();
+ });
+
+ it('parses a string with an alternative delimiter', function (done) {
+
+ expect(Qs.parse('a=b;c=d', ';')).to.deep.equal({ a: 'b', c: 'd' });
+ done();
+ });
+
+ it('does not use non-string objects as delimiters', function (done) {
+
+ expect(Qs.parse('a=b&c=d', {})).to.deep.equal({ a: 'b', c: 'd' });
+ done();
+ });
+
+ it('parses an object', function (done) {
+
+ var input = {
+ "user[name]": {"pop[bob]": 3},
+ "user[email]": null
+ };
+
+ var expected = {
+ "user": {
+ "name": {"pop[bob]": 3},
+ "email": null
+ }
+ };
+
+ var result = Qs.parse(input);
+
+ expect(result).to.deep.equal(expected);
+ done();
+ });
+
+ it('parses an object and not child values', function (done) {
+
+ var input = {
+ "user[name]": {"pop[bob]": { "test": 3 }},
+ "user[email]": null
+ };
+
+ var expected = {
+ "user": {
+ "name": {"pop[bob]": { "test": 3 }},
+ "email": null
+ }
+ };
+
+ var result = Qs.parse(input);
+
+ expect(result).to.deep.equal(expected);
+ done();
+ });
+});
--- /dev/null
+// Load modules
+
+var Lab = require('lab');
+var Qs = require('../');
+
+
+// Declare internals
+
+var internals = {};
+
+
+// Test shortcuts
+
+var expect = Lab.expect;
+var before = Lab.before;
+var after = Lab.after;
+var describe = Lab.experiment;
+var it = Lab.test;
+
+
+describe('#stringify', function () {
+
+ it('stringifies a querystring object', function (done) {
+
+ expect(Qs.stringify({ a: 'b' })).to.equal('a=b');
+ expect(Qs.stringify({ a: 1 })).to.equal('a=1');
+ expect(Qs.stringify({ a: 1, b: 2 })).to.equal('a=1&b=2');
+ done();
+ });
+
+ it('stringifies a nested object', function (done) {
+
+ expect(Qs.stringify({ a: { b: 'c' } })).to.equal('a%5Bb%5D=c');
+ expect(Qs.stringify({ a: { b: { c: { d: 'e' } } } })).to.equal('a%5Bb%5D%5Bc%5D%5Bd%5D=e');
+ done();
+ });
+
+ it('stringifies an array value', function (done) {
+
+ expect(Qs.stringify({ a: ['b', 'c', 'd'] })).to.equal('a%5B0%5D=b&a%5B1%5D=c&a%5B2%5D=d');
+ done();
+ });
+
+ it('stringifies a nested array value', function (done) {
+
+ expect(Qs.stringify({ a: { b: ['c', 'd'] } })).to.equal('a%5Bb%5D%5B0%5D=c&a%5Bb%5D%5B1%5D=d');
+ done();
+ });
+
+ it('stringifies an object inside an array', function (done) {
+
+ expect(Qs.stringify({ a: [{ b: 'c' }] })).to.equal('a%5B0%5D%5Bb%5D=c');
+ expect(Qs.stringify({ a: [{ b: { c: [1] } }] })).to.equal('a%5B0%5D%5Bb%5D%5Bc%5D%5B0%5D=1');
+ done();
+ });
+
+ it('stringifies a complicated object', function (done) {
+
+ expect(Qs.stringify({ a: { b: 'c', d: 'e' } })).to.equal('a%5Bb%5D=c&a%5Bd%5D=e');
+ done();
+ });
+
+ it('stringifies an empty value', function (done) {
+
+ expect(Qs.stringify({ a: '' })).to.equal('a=');
+ expect(Qs.stringify({ a: '', b: '' })).to.equal('a=&b=');
+ expect(Qs.stringify({ a: null })).to.equal('a=');
+ expect(Qs.stringify({ a: { b: null } })).to.equal('a%5Bb%5D=');
+ done();
+ });
+
+ it('drops keys with a value of undefined', function (done) {
+
+ expect(Qs.stringify({ a: undefined })).to.equal('');
+ expect(Qs.stringify({ a: { b: undefined, c: null } })).to.equal('a%5Bc%5D=');
+ done();
+ });
+
+ it('url encodes values', function (done) {
+
+ expect(Qs.stringify({ a: 'b c' })).to.equal('a=b%20c');
+ done();
+ });
+
+ it('stringifies a date', function (done) {
+
+ var now = new Date();
+ var str = 'a=' + encodeURIComponent(now.toISOString());
+ expect(Qs.stringify({ a: now })).to.equal(str);
+ done();
+ });
+
+ it('stringifies the weird object from qs', function (done) {
+
+ expect(Qs.stringify({ 'my weird field': 'q1!2"\'w$5&7/z8)?' })).to.equal('my%20weird%20field=q1!2%22\'w%245%267%2Fz8)%3F');
+ done();
+ });
+
+ it('skips properties that are part of the object prototype', function (done) {
+
+ Object.prototype.crash = 'test';
+ expect(Qs.stringify({ a: 'b'})).to.equal('a=b');
+ expect(Qs.stringify({ a: { b: 'c' } })).to.equal('a%5Bb%5D=c');
+ delete Object.prototype.crash;
+ done();
+ });
+
+ it('stringifies boolean values', function (done) {
+
+ expect(Qs.stringify({ a: true })).to.equal('a=true');
+ expect(Qs.stringify({ a: { b: true } })).to.equal('a%5Bb%5D=true');
+ expect(Qs.stringify({ b: false })).to.equal('b=false');
+ expect(Qs.stringify({ b: { c: false } })).to.equal('b%5Bc%5D=false');
+ done();
+ });
+
+ it('stringifies buffer values', function (done) {
+
+ expect(Qs.stringify({ a: new Buffer('test') })).to.equal('a=test');
+ expect(Qs.stringify({ a: { b: new Buffer('test') } })).to.equal('a%5Bb%5D=test');
+ done();
+ });
+
+ it('stringifies an object using an alternative delimiter', function (done) {
+
+ expect(Qs.stringify({ a: 'b', c: 'd' }, ';')).to.equal('a=b;c=d');
+ done();
+ });
+});
--- /dev/null
+lib-cov
+*.seed
+*.log
+*.csv
+*.dat
+*.out
+*.pid
+*.gz
+
+pids
+logs
+results
+
+node_modules
+npm-debug.log
\ No newline at end of file
--- /dev/null
+language: node_js
+node_js:
+ - 0.4
+ - 0.6
--- /dev/null
+Copyright 2012 Michael Hart (michael.hart.au@gmail.com)
+
+This project is free software released under the MIT license:
+http://www.opensource.org/licenses/mit-license.php
--- /dev/null
+# Decode streams into strings The Right Way(tm)
+
+```javascript
+var fs = require('fs')
+var zlib = require('zlib')
+var strs = require('stringstream')
+
+var utf8Stream = fs.createReadStream('massiveLogFile.gz')
+ .pipe(zlib.createGunzip())
+ .pipe(strs('utf8'))
+```
+
+No need to deal with `setEncoding()` weirdness, just compose streams
+like they were supposed to be!
+
+Handles input and output encoding:
+
+```javascript
+// Stream from utf8 to hex to base64... Why not, ay.
+var hex64Stream = fs.createReadStream('myFile')
+ .pipe(strs('utf8', 'hex'))
+ .pipe(strs('hex', 'base64'))
+```
+
+Also deals with `base64` output correctly by aligning each emitted data
+chunk so that there are no dangling `=` characters:
+
+```javascript
+var stream = fs.createReadStream('myFile').pipe(strs('base64'))
+
+var base64Str = ''
+
+stream.on('data', function(data) { base64Str += data })
+stream.on('end', function() {
+ console.log('My base64 encoded file is: ' + base64Str) // Wouldn't work with setEncoding()
+ console.log('Original file is: ' + new Buffer(base64Str, 'base64'))
+})
+```
--- /dev/null
+var fs = require('fs')
+var zlib = require('zlib')
+var strs = require('stringstream')
+
+var utf8Stream = fs.createReadStream('massiveLogFile.gz')
+ .pipe(zlib.createGunzip())
+ .pipe(strs('utf8'))
+
+utf8Stream.pipe(process.stdout)
+
+// Stream from utf8 to hex to base64... Why not, ay.
+var hex64Stream = fs.createReadStream('myFile')
+ .pipe(strs('utf8', 'hex'))
+ .pipe(strs('hex', 'base64'))
+
+hex64Stream.pipe(process.stdout)
+
+// Deals with base64 correctly by aligning chunks
+var stream = fs.createReadStream('myFile').pipe(strs('base64'))
+
+var base64Str = ''
+
+stream.on('data', function(data) { base64Str += data })
+stream.on('end', function() {
+ console.log('My base64 encoded file is: ' + base64Str) // Wouldn't work with setEncoding()
+ console.log('Original file is: ' + new Buffer(base64Str, 'base64'))
+})
--- /dev/null
+{
+ "name": "stringstream",
+ "version": "0.0.4",
+ "description": "Encode and decode streams into string streams",
+ "author": {
+ "name": "Michael Hart",
+ "email": "michael.hart.au@gmail.com",
+ "url": "http://github.com/mhart"
+ },
+ "main": "stringstream.js",
+ "keywords": [
+ "string",
+ "stream",
+ "base64",
+ "gzip"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/mhart/StringStream.git"
+ },
+ "license": "MIT",
+ "readme": "# Decode streams into strings The Right Way(tm)\n\n```javascript\nvar fs = require('fs')\nvar zlib = require('zlib')\nvar strs = require('stringstream')\n\nvar utf8Stream = fs.createReadStream('massiveLogFile.gz')\n .pipe(zlib.createGunzip())\n .pipe(strs('utf8'))\n```\n\nNo need to deal with `setEncoding()` weirdness, just compose streams\nlike they were supposed to be!\n\nHandles input and output encoding:\n\n```javascript\n// Stream from utf8 to hex to base64... Why not, ay.\nvar hex64Stream = fs.createReadStream('myFile')\n .pipe(strs('utf8', 'hex'))\n .pipe(strs('hex', 'base64'))\n```\n\nAlso deals with `base64` output correctly by aligning each emitted data\nchunk so that there are no dangling `=` characters:\n\n```javascript\nvar stream = fs.createReadStream('myFile').pipe(strs('base64'))\n\nvar base64Str = ''\n\nstream.on('data', function(data) { base64Str += data })\nstream.on('end', function() {\n console.log('My base64 encoded file is: ' + base64Str) // Wouldn't work with setEncoding()\n console.log('Original file is: ' + new Buffer(base64Str, 'base64'))\n})\n```\n",
+ "readmeFilename": "README.md",
+ "_id": "stringstream@0.0.4",
+ "dist": {
+ "shasum": "0f0e3423f942960b5692ac324a57dd093bc41a92",
+ "tarball": "http://registry.npmjs.org/stringstream/-/stringstream-0.0.4.tgz"
+ },
+ "_npmVersion": "1.2.0",
+ "_npmUser": {
+ "name": "hichaelmart",
+ "email": "michael.hart.au@gmail.com"
+ },
+ "maintainers": [
+ {
+ "name": "hichaelmart",
+ "email": "michael.hart.au@gmail.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "0f0e3423f942960b5692ac324a57dd093bc41a92",
+ "_from": "stringstream@~0.0.4",
+ "_resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.4.tgz",
+ "bugs": {
+ "url": "https://github.com/mhart/StringStream/issues"
+ },
+ "homepage": "https://github.com/mhart/StringStream"
+}
--- /dev/null
+var util = require('util')
+var Stream = require('stream')
+var StringDecoder = require('string_decoder').StringDecoder
+
+module.exports = StringStream
+module.exports.AlignedStringDecoder = AlignedStringDecoder
+
+function StringStream(from, to) {
+ if (!(this instanceof StringStream)) return new StringStream(from, to)
+
+ Stream.call(this)
+
+ if (from == null) from = 'utf8'
+
+ this.readable = this.writable = true
+ this.paused = false
+ this.toEncoding = (to == null ? from : to)
+ this.fromEncoding = (to == null ? '' : from)
+ this.decoder = new AlignedStringDecoder(this.toEncoding)
+}
+util.inherits(StringStream, Stream)
+
+StringStream.prototype.write = function(data) {
+ if (!this.writable) {
+ var err = new Error('stream not writable')
+ err.code = 'EPIPE'
+ this.emit('error', err)
+ return false
+ }
+ if (this.fromEncoding) {
+ if (Buffer.isBuffer(data)) data = data.toString()
+ data = new Buffer(data, this.fromEncoding)
+ }
+ var string = this.decoder.write(data)
+ if (string.length) this.emit('data', string)
+ return !this.paused
+}
+
+StringStream.prototype.flush = function() {
+ if (this.decoder.flush) {
+ var string = this.decoder.flush()
+ if (string.length) this.emit('data', string)
+ }
+}
+
+StringStream.prototype.end = function() {
+ if (!this.writable && !this.readable) return
+ this.flush()
+ this.emit('end')
+ this.writable = this.readable = false
+ this.destroy()
+}
+
+StringStream.prototype.destroy = function() {
+ this.decoder = null
+ this.writable = this.readable = false
+ this.emit('close')
+}
+
+StringStream.prototype.pause = function() {
+ this.paused = true
+}
+
+StringStream.prototype.resume = function () {
+ if (this.paused) this.emit('drain')
+ this.paused = false
+}
+
+function AlignedStringDecoder(encoding) {
+ StringDecoder.call(this, encoding)
+
+ switch (this.encoding) {
+ case 'base64':
+ this.write = alignedWrite
+ this.alignedBuffer = new Buffer(3)
+ this.alignedBytes = 0
+ break
+ }
+}
+util.inherits(AlignedStringDecoder, StringDecoder)
+
+AlignedStringDecoder.prototype.flush = function() {
+ if (!this.alignedBuffer || !this.alignedBytes) return ''
+ var leftover = this.alignedBuffer.toString(this.encoding, 0, this.alignedBytes)
+ this.alignedBytes = 0
+ return leftover
+}
+
+function alignedWrite(buffer) {
+ var rem = (this.alignedBytes + buffer.length) % this.alignedBuffer.length
+ if (!rem && !this.alignedBytes) return buffer.toString(this.encoding)
+
+ var returnBuffer = new Buffer(this.alignedBytes + buffer.length - rem)
+
+ this.alignedBuffer.copy(returnBuffer, 0, 0, this.alignedBytes)
+ buffer.copy(returnBuffer, this.alignedBytes, 0, buffer.length - rem)
+
+ buffer.copy(this.alignedBuffer, 0, buffer.length - rem, buffer.length)
+ this.alignedBytes = rem
+
+ return returnBuffer.toString(this.encoding)
+}
{
- // Settings
- "passfail" : false, // Stop on first error.
- "maxerr" : 100, // Maximum error before stopping.
+ "passfail" : false,
+ "maxerr" : 100,
-
- // Predefined globals whom JSHint will ignore.
- "browser" : false, // Standard browser globals e.g. `window`, `document`.
+ "browser" : false,
"node" : true,
"rhino" : false,
"couch" : false,
- "wsh" : false, // Windows Scripting Host.
+ "wsh" : false,
"jquery" : false,
"prototypejs" : false,
"mootools" : false,
"dojo" : false,
- "predef" : [ // Custom globals.
- "escape", "unescape" // aren't picked up by node flag above :/
- ],
-
-
- // Development.
- "debug" : false, // Allow debugger statements e.g. browser breakpoints.
- "devel" : false, // Allow developments statements e.g. `console.log();`.
+ "debug" : false,
+ "devel" : false,
+ "esnext" : true,
+ "strict" : true,
+ "globalstrict" : true,
- // EcmaScript 5.
- "es5" : true, // Allow EcmaScript 5 syntax.
- "esnext" : true, // Allow ES "next" syntax, specifically 'const' (V8 has this)
- "strict" : false, // Require `use strict` pragma in every file.
- "globalstrict" : false, // Allow global "use strict" (also enables 'strict').
+ "asi" : false,
+ "laxbreak" : false,
+ "bitwise" : true,
+ "boss" : false,
+ "curly" : true,
+ "eqeqeq" : false,
+ "eqnull" : true,
+ "evil" : false,
+ "expr" : false,
+ "forin" : false,
+ "immed" : true,
+ "lastsemic" : true,
+ "latedef" : false,
+ "loopfunc" : false,
+ "noarg" : true,
+ "regexp" : false,
+ "regexdash" : false,
+ "scripturl" : false,
+ "shadow" : false,
+ "supernew" : false,
+ "undef" : true,
+ "unused" : true,
+ "newcap" : true,
+ "noempty" : true,
+ "nonew" : true,
+ "nomen" : false,
+ "onevar" : false,
+ "onecase" : true,
+ "plusplus" : false,
+ "proto" : false,
+ "sub" : true,
+ "trailing" : true,
+ "white" : false,
- // The Good Parts.
- "asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons).
- "laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
- "bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.).
- "boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
- "curly" : false, // Require {} for every new block or scope.
- "eqeqeq" : false, // Require triple equals i.e. `===`.
- "eqnull" : true, // Tolerate use of `== null`.
- "evil" : false, // Tolerate use of `eval`.
- "expr" : true, // Tolerate `ExpressionStatement` as Programs.
- "forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
- "immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
- "latedef" : false, // Prohibit variable use before definition.
- "loopfunc" : false, // Allow functions to be defined within loops.
- "noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
- "regexp" : true, // Prohibit `.` and `[^...]` in regular expressions.
- "regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`.
- "scripturl" : true, // Tolerate script-targeted URLs.
- "shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
- "supernew" : false, // Tolerate `new function () { ... };` and `new Object;`.
- "undef" : true, // Require all non-global variables be declared before they are used.
-
-
- // Personal styling prefrences.
- "lastsemic" : true, // Prohibit missing semicolon for the last statement in a one-line block
- "newcap" : false, // Require capitalization of all constructor functions e.g. `new F()`.
- "noempty" : true, // Prohipit use of empty blocks.
- "nonew" : true, // Prohibit use of constructors for side-effects.
- "nomen" : false, // Prohibit use of initial or trailing underbars in names.
- "onevar" : false, // Allow only one `var` statement per function.
- "onecase" : false, // Allow switches with one case statement
- "plusplus" : false, // Prohibit use of `++` & `--`.
- "proto" : false, // Allow use of __proto__
- "sub" : true, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
- "trailing" : true, // Prohibit trailing whitespaces.
- "white" : false // Check against strict whitespace and indentation rules.
+ "predef": [
+ "describe",
+ "it",
+ "before",
+ "beforeEach",
+ "after",
+ "afterEach",
+ "expect",
+ "setTimeout",
+ "clearTimeout"
+ ],
+ "maxlen": 0
}
--- /dev/null
+language: node_js
+node_js:
+- "0.10"
+- "0.11"
+matrix:
+ fast_finish: true
+ allow_failures:
+ - node_js: 0.11
![Tough Cookie](http://www.goinstant.com.s3.amazonaws.com/tough-cookie.jpg)
+[![Build Status](https://travis-ci.org/goinstant/node-cookie.png?branch=master)](https://travis-ci.org/goinstant/node-cookie)
+
+[![NPM Stats](https://nodei.co/npm/tough-cookie.png?downloads=true&stars=true)](https://npmjs.org/package/tough-cookie)
+![NPM Downloads](https://nodei.co/npm-dl/tough-cookie.png?months=9)
+
# Synopsis
``` javascript
-var cookies = require('tough-cookie'); // note: not 'cookie', 'cookies' or 'node-cookie'
-var Cookie = cookies.Cookie;
+var tough = require('tough-cookie'); // note: not 'cookie', 'cookies' or 'node-cookie'
+var Cookie = tough.Cookie;
var cookie = Cookie.parse(header);
cookie.value = 'somethingdifferent';
header = cookie.toString();
-var cookiejar = new cookies.CookieJar();
+var cookiejar = new tough.CookieJar();
cookiejar.setCookie(cookie, 'http://currentdomain.example.com/path', cb);
// ...
cookiejar.getCookies('http://example.com/otherpath',function(err,cookies) {
# API
-cookies
-=======
+tough
+=====
Functions on the module you get from `require('tough-cookie')`. All can be used as pure functions and don't need to be "bound".
``` javascript
if (res.headers['set-cookie'] instanceof Array)
- cookies = res.headers['set-cookie'].map(Cookie.parse);
+ cookies = res.headers['set-cookie'].map(function (c) { return (Cookie.parse(c)); });
else
cookies = [Cookie.parse(res.headers['set-cookie'])];
```
* _secure_ - boolean - the `Secure` cookie flag
* _httpOnly_ - boolean - the `HttpOnly` cookie flag
* _extensions_ - `Array` - any unrecognized cookie attributes as strings (even if equal-signs inside)
-
+
After a cookie has been passed through `CookieJar.setCookie()` it will have the following additional attributes:
* _hostOnly_ - boolean - is this a host-only cookie (i.e. no Domain field was set, but was instead implied)
----------
* _rejectPublicSuffixes_ - boolean - reject cookies with domains like "com" and "co.uk" (default: `true`)
-
+
Since eventually this module would like to support database/remote/etc. CookieJars, continuation passing style is used for CookieJar methods.
.setCookie(cookieOrString, currentUrl, [{options},] cb(err,cookie))
As per the RFC, the `.hostOnly` property is set if there was no "Domain=" parameter in the cookie string (or `.domain` was null on the Cookie object). The `.domain` property is set to the fully-qualified hostname of `currentUrl` in this case. Matching this cookie requires an exact hostname match (not a `domainMatch` as per usual).
+.setCookieSync(cookieOrString, currentUrl, [{options}])
+-------------------------------------------------------
+
+Synchronous version of `setCookie`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).
+
.storeCookie(cookie, [{options},] cb(err,cookie))
-------------------------------------------------
__REMOVED__ removed in lieu of the CookieStore API below
-
+
.getCookies(currentUrl, [{options},] cb(err,cookies))
-----------------------------------------------------
The `.lastAccessed` property of the returned cookies will have been updated.
+.getCookiesSync(currentUrl, [{options}])
+----------------------------------------
+
+Synchronous version of `getCookies`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).
+
.getCookieString(...)
---------------------
Accepts the same options as `.getCookies()` but passes a string suitable for a Cookie header rather than an array to the callback. Simply maps the `Cookie` array via `.cookieString()`.
+.getCookieStringSync(...)
+-------------------------
+
+Synchronous version of `getCookieString`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).
+
.getSetCookieStrings(...)
-------------------------
-Accepts the same options as `.getCookies()` but passes an array of strings suitable for Set-Cookie headers (rather than an array of `Cookie`s) to the callback. Simply maps the cookie array via `.toString()`.
+Returns an array of strings suitable for **Set-Cookie** headers. Accepts the same options as `.getCookies()`. Simply maps the cookie array via `.toString()`.
+
+.getSetCookieStringsSync(...)
+-----------------------------
+
+Synchronous version of `getSetCookieStrings`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).
+
+Store
+=====
+
+Base class for CookieJar stores.
# CookieStore API
The storage model for each `CookieJar` instance can be replaced with a custom implementation. The default is `MemoryCookieStore` which can be found in the `lib/memstore.js` file. The API uses continuation-passing-style to allow for asynchronous stores.
+Stores should inherit from the base `Store` class, which is available as `require('tough-cookie').Store`. Stores are asynchronous by default, but if `store.synchronous` is set, then the `*Sync` methods on the CookieJar can be used.
+
All `domain` parameters will have been normalized before calling.
The Cookie store must have all of the following methods.
(tl;dr: MIT with some MPL/1.1)
-Copyright GoInstant, Inc. and other contributors. All rights reserved.
+Copyright 2012- GoInstant, Inc. and other contributors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
-
+'use strict';
var fs = require('fs');
var assert = require('assert');
var punycode = require('punycode');
fs.readFile('./public-suffix.txt', 'utf8', function(err,string) {
- if (err) throw err;
+ if (err) {
+ throw err;
+ }
var lines = string.split("\n");
process.nextTick(function() {
processList(lines);
while (lines.length) {
var line = lines.shift();
line = line.replace(COMMENT,'').trim();
- if (!line) continue;
+ if (!line) {
+ continue;
+ }
addToIndex(index,line);
}
var w = fs.createWriteStream('./lib/pubsuffix.js',{
flags: 'w',
encoding: 'utf8',
- mode: 0644,
+ mode: parseInt('644',8)
});
w.on('end', process.exit);
w.write("/****************************************************\n");
line = line.slice(prefix.length);
}
line = prefix + punycode.toASCII(line);
-
- if (line.substr(0,1) == '!')
+
+ if (line.substr(0,1) == '!') {
index[line.substr(1)] = false;
- else
+ } else {
index[line] = true;
+ }
}
// include the licence in the function since it gets written to pubsuffix.js
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
- if (!domain) return null;
- if (domain.match(/^\./)) return null;
+ if (!domain) {
+ return null;
+ }
+ if (domain.match(/^\./)) {
+ return null;
+ }
domain = domain.toLowerCase();
var parts = domain.split('.').reverse();
* IN THE SOFTWARE.
*/
-/*jshint regexp:false */
+'use strict';
var net = require('net');
var urlParse = require('url').parse;
var pubsuffix = require('./pubsuffix');
+var Store = require('./store').Store;
var punycode;
try {
// From RFC6265 S4.1.1
// note that it excludes \x3B ";"
var COOKIE_OCTET = /[\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]/;
-var COOKIE_OCTETS = /^[\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]+$/;
+var COOKIE_OCTETS = new RegExp('^'+COOKIE_OCTET.source+'$');
// The name/key cannot be empty but the value can (S5.2):
-var COOKIE_PAIR_STRICT = new RegExp('^('+TOKEN.source+'+)=("?)('+COOKIE_OCTET.source+'*)\\2');
-var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2/;
+var COOKIE_PAIR_STRICT = new RegExp('^('+TOKEN.source+'+)=("?)('+COOKIE_OCTET.source+'*)\\2$');
+var COOKIE_PAIR = /^([^=\s]+)\s*=\s*("?)\s*(.*)\s*\2\s*$/;
// RFC6265 S4.1.1 defines extension-av as 'any CHAR except CTLs or ";"'
// Note ';' is \x3B
var MONTH = /^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)$/i;
var MONTH_TO_NUM = {
- jan:0, feb:1, mar:2, apr:3, may:4, jun:5, jul:6, aug:7, sep:8, oct:9, nov:10, dec:11
+ jan:0, feb:1, mar:2, apr:3, may:4, jun:5,
+ jul:6, aug:7, sep:8, oct:9, nov:10, dec:11
};
var NUM_TO_MONTH = [
'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'
'Sun','Mon','Tue','Wed','Thu','Fri','Sat'
];
-var YEAR = /^([1-9][0-9]{1,3})$/; // 2 to 4 digits (will check range when parsing)
+var YEAR = /^([1-9][0-9]{1,3})$/; // 2 to 4 digits
var MAX_TIME = 2147483647000; // 31-bit max
-var MAX_DATE = new Date(CookieJar.MAX_TIME); // 31-bit max
var MIN_TIME = 0; // 31-bit min
-var MIN_DATE = new Date(CookieJar.MIN_TIME); // 31-bit min
// RFC6265 S5.1.1 date parser:
function parseDate(str,strict) {
- if (!str) return;
+ if (!str) {
+ return;
+ }
var found_time, found_dom, found_month, found_year;
/* RFC6265 S5.1.1:
* appear in the cookie-date
*/
var tokens = str.split(DATE_DELIM);
- if (!tokens) return;
+ if (!tokens) {
+ return;
+ }
var date = new Date();
date.setMilliseconds(0);
for (var i=0; i<tokens.length; i++) {
var token = tokens[i].trim();
- if (!token.length) continue;
+ if (!token.length) {
+ continue;
+ }
var result;
* 4. If the year-value is greater than or equal to 0 and less
* than or equal to 69, increment the year-value by 2000.
*/
- if (70 <= year && year <= 99)
+ if (70 <= year && year <= 99) {
year += 1900;
- else if (0 <= year && year <= 69)
+ } else if (0 <= year && year <= 69) {
year += 2000;
+ }
- if (year < 1601)
+ if (year < 1601) {
return; // 5. ... the year-value is less than 1601
+ }
found_year = true;
date.setUTCFullYear(year);
// S5.1.2 Canonicalized Host Names
function canonicalDomain(str) {
- if (str == null) return null;
+ if (str == null) {
+ return null;
+ }
str = str.trim().replace(/^\./,''); // S4.1.2.3 & S5.2.3: ignore leading .
// convert to IDN if any non-ASCII characters
- if (punycode && /[^\u0001-\u007f]/.test(str))
+ if (punycode && /[^\u0001-\u007f]/.test(str)) {
str = punycode.toASCII(str);
+ }
return str.toLowerCase();
}
// S5.1.3 Domain Matching
function domainMatch(str, domStr, canonicalize) {
- if (str == null || domStr == null) return null;
+ if (str == null || domStr == null) {
+ return null;
+ }
if (canonicalize !== false) {
str = canonicalDomain(str);
domStr = canonicalDomain(domStr);
* domain string and the string will have been canonicalized to lower case at
* this point)"
*/
- if (str == domStr) return true;
+ if (str == domStr) {
+ return true;
+ }
/* "All of the following [three] conditions hold:" (order adjusted from the RFC) */
/* "* The string is a host name (i.e., not an IP address)." */
- if (net.isIP(str)) return false;
+ if (net.isIP(str)) {
+ return false;
+ }
/* "* The domain string is a suffix of the string" */
var idx = str.indexOf(domStr);
- if (idx <= 0) return false; // it's a non-match (-1) or prefix (0)
+ if (idx <= 0) {
+ return false; // it's a non-match (-1) or prefix (0)
+ }
// e.g "a.b.c".indexOf("b.c") === 2
// 5 === 3+2
- if (str.length !== domStr.length + idx) // it's not a suffix
+ if (str.length !== domStr.length + idx) { // it's not a suffix
return false;
+ }
/* "* The last character of the string that is not included in the domain
* string is a %x2E (".") character." */
- if (str.substr(idx-1,1) !== '.') return false;
+ if (str.substr(idx-1,1) !== '.') {
+ return false;
+ }
+
return true;
}
function defaultPath(path) {
// "2. If the uri-path is empty or if the first character of the uri-path is not
// a %x2F ("/") character, output %x2F ("/") and skip the remaining steps.
- if (!path || path.substr(0,1) !== "/") return "/";
+ if (!path || path.substr(0,1) !== "/") {
+ return "/";
+ }
// "3. If the uri-path contains no more than one %x2F ("/") character, output
// %x2F ("/") and skip the remaining step."
- if (path === "/") return path;
+ if (path === "/") {
+ return path;
+ }
var rightSlash = path.lastIndexOf("/");
- if (rightSlash === 0) return "/";
+ if (rightSlash === 0) {
+ return "/";
+ }
// "4. Output the characters of the uri-path from the first character up to,
// but not including, the right-most %x2F ("/")."
*/
function pathMatch(reqPath,cookiePath) {
// "o The cookie-path and the request-path are identical."
- if (cookiePath === reqPath)
+ if (cookiePath === reqPath) {
return true;
+ }
var idx = reqPath.indexOf(cookiePath);
if (idx === 0) {
// "o The cookie-path is a prefix of the request-path, and the last
// character of the cookie-path is %x2F ("/")."
- if (cookiePath.substr(-1) === "/")
+ if (cookiePath.substr(-1) === "/") {
return true;
+ }
// " o The cookie-path is a prefix of the request-path, and the first
// character of the request-path that is not included in the cookie- path
// is a %x2F ("/") character."
- if (reqPath.substr(cookiePath.length,1) === "/")
+ if (reqPath.substr(cookiePath.length,1) === "/") {
return true;
+ }
}
return false;
// If we are not in strict mode we remove the trailing semi-colons.
var semiColonCheck = TRAILING_SEMICOLON.exec(str);
if (semiColonCheck) {
- if (strict) return;
+ if (strict) {
+ return;
+ }
str = str.slice(0, semiColonCheck.index);
}
// Rx satisfies the "the name string is empty" and "lacks a %x3D ("=")"
// constraints as well as trimming any whitespace.
- if (!result) return;
+ if (!result) {
+ return;
+ }
var c = new Cookie();
c.key = result[1]; // the regexp should trim() already
c.value = result[3]; // [2] is quotes or empty-string
- if (firstSemi === -1) return c;
+ if (firstSemi === -1) {
+ return c;
+ }
// S5.2.3 "unparsed-attributes consist of the remainder of the set-cookie-string
// (including the %x3B (";") in question)." plus later on in the same section
// "If the unparsed-attributes string is empty, skip the rest of these
// steps."
- if (unparsed.length === 0) return c;
+ if (unparsed.length === 0) {
+ return c;
+ }
/*
* S5.2 says that when looping over the items "[p]rocess the attribute-name
while (cookie_avs.length) {
var av = cookie_avs.shift();
- if (strict && !EXTENSION_AV.test(av)) return;
+ if (strict && !EXTENSION_AV.test(av)) {
+ return;
+ }
var av_sep = av.indexOf('=');
var av_key, av_value;
}
av_key = av_key.trim().toLowerCase();
- if (av_value) av_value = av_value.trim();
+ if (av_value) {
+ av_value = av_value.trim();
+ }
switch(av_key) {
case 'expires': // S5.2.1
- if (!av_value) { if(strict){return}else{break;} }
+ if (!av_value) {if(strict){return;}else{break;} }
var exp = parseDate(av_value,strict);
// "If the attribute-value failed to parse as a cookie date, ignore the
// cookie-av."
- if (exp == null) { if(strict){return}else{break;} }
+ if (exp == null) { if(strict){return;}else{break;} }
c.expires = exp;
// over and underflow not realistically a concern: V8's getTime() seems to
// store something larger than a 32-bit time_t (even with 32-bit node)
break;
case 'max-age': // S5.2.2
- if (!av_value) { if(strict){return}else{break;} }
+ if (!av_value) { if(strict){return;}else{break;} }
// "If the first character of the attribute-value is not a DIGIT or a "-"
// character ...[or]... If the remainder of attribute-value contains a
// non-DIGIT character, ignore the cookie-av."
- if (!/^-?[0-9]+$/.test(av_value)) { if(strict){return}else{break;} }
+ if (!/^-?[0-9]+$/.test(av_value)) { if(strict){return;}else{break;} }
var delta = parseInt(av_value,10);
- if (strict && delta <= 0) return; // S4.1.1
+ if (strict && delta <= 0) {
+ return; // S4.1.1
+ }
// "If delta-seconds is less than or equal to zero (0), let expiry-time
// be the earliest representable date and time."
c.setMaxAge(delta);
case 'domain': // S5.2.3
// "If the attribute-value is empty, the behavior is undefined. However,
// the user agent SHOULD ignore the cookie-av entirely."
- if (!av_value) { if(strict){return}else{break;} }
+ if (!av_value) { if(strict){return;}else{break;} }
// S5.2.3 "Let cookie-domain be the attribute-value without the leading %x2E
// (".") character."
var domain = av_value.trim().replace(/^\./,'');
- if (!domain) { if(strict){return}else{break;} } // see "is empty" above
+ if (!domain) { if(strict){return;}else{break;} } // see "is empty" above
// "Convert the cookie-domain to lower case."
c.domain = domain.toLowerCase();
break;
* We'll represent the default-path as null since it depends on the
* context of the parsing.
*/
- if (!av_value || av_value.substr(0,1) != "/") { if(strict){return}else{break;} }
+ if (!av_value || av_value.substr(0,1) != "/") {
+ if(strict){return;}else{break;}
+ }
c.path = av_value;
break;
* the user agent MUST append an attribute to the cookie-attribute-list
* with an attribute-name of Secure and an empty attribute-value."
*/
- if (av_value != null) { if(strict){return} }
+ if (av_value != null) { if(strict){return;} }
c.secure = true;
break;
case 'httponly': // S5.2.6 -- effectively the same as 'secure'
- if (av_value != null) { if(strict){return} }
+ if (av_value != null) { if(strict){return;} }
c.httpOnly = true;
break;
}
function fromJSON(str) {
- if (!str) return null;
+ if (!str) {
+ return null;
+ }
var obj;
try {
var c = new Cookie();
for (var i=0; i<numCookieProperties; i++) {
var prop = cookieProperties[i];
- if (obj[prop] == null) continue;
+ if (obj[prop] == null) {
+ continue;
+ }
if (prop === 'expires' ||
prop === 'creation' ||
prop === 'lastAccessed')
function cookieCompare(a,b) {
// descending for length: b CMP a
var deltaLen = (b.path ? b.path.length : 0) - (a.path ? a.path.length : 0);
- if (deltaLen !== 0) return deltaLen;
+ if (deltaLen !== 0) {
+ return deltaLen;
+ }
// ascending for time: a CMP b
return (a.creation ? a.creation.getTime() : MAX_TIME) -
(b.creation ? b.creation.getTime() : MAX_TIME);
// array is in shortest-to-longest order. Handy for indexing.
function permuteDomain(domain) {
var pubSuf = pubsuffix.getPublicSuffix(domain);
- if (!pubSuf) return null;
- if (pubSuf == domain) return [domain];
+ if (!pubSuf) {
+ return null;
+ }
+ if (pubSuf == domain) {
+ return [domain];
+ }
var prefix = domain.slice(0,-(pubSuf.length+1)); // ".example.com"
var parts = prefix.split('.').reverse();
// Gives the permutation of all possible pathMatch()es of a given path. The
// array is in longest-to-shortest order. Handy for indexing.
function permutePath(path) {
- var origPath = path;
- if (path === '/') return ['/'];
- if (path.lastIndexOf('/') === path.length-1)
+ if (path === '/') {
+ return ['/'];
+ }
+ if (path.lastIndexOf('/') === path.length-1) {
path = path.substr(0,path.length-1);
+ }
var permutations = [path];
while (path.length > 1) {
var lindex = path.lastIndexOf('/');
- if (lindex === 0) break;
+ if (lindex === 0) {
+ break;
+ }
path = path.substr(0,lindex);
permutations.push(path);
}
function Cookie (opts) {
- if (typeof opts !== "object") return;
+ if (typeof opts !== "object") {
+ return;
+ }
Object.keys(opts).forEach(function (key) {
if (Cookie.prototype.hasOwnProperty(key)) {
this[key] = opts[key] || Cookie.prototype[key];
Cookie.prototype.lastAccessed = null; // Date when set
var cookieProperties = Object.freeze(Object.keys(Cookie.prototype).map(function(p) {
- if (p instanceof Function) return;
+ if (p instanceof Function) {
+ return;
+ }
return p;
}));
var numCookieProperties = cookieProperties.length;
};
Cookie.prototype.validate = function validate() {
- if (!COOKIE_OCTETS.test(this.value))
+ if (!COOKIE_OCTETS.test(this.value)) {
return false;
- if (this.expires != Infinity && !(this.expires instanceof Date) && !parseDate(this.expires,true))
+ }
+ if (this.expires != Infinity && !(this.expires instanceof Date) && !parseDate(this.expires,true)) {
return false;
- if (this.maxAge != null && this.maxAge <= 0)
+ }
+ if (this.maxAge != null && this.maxAge <= 0) {
return false; // "Max-Age=" non-zero-digit *DIGIT
- if (this.path != null && !PATH_VALUE.test(this.path))
+ }
+ if (this.path != null && !PATH_VALUE.test(this.path)) {
return false;
+ }
var cdomain = this.cdomain();
if (cdomain) {
- if (cdomain.match(/\.$/))
+ if (cdomain.match(/\.$/)) {
return false; // S4.1.2.3 suggests that this is bad. domainMatch() tests confirm this
+ }
var suffix = pubsuffix.getPublicSuffix(cdomain);
- if (suffix == null) // it's a public suffix
+ if (suffix == null) { // it's a public suffix
return false;
+ }
}
return true;
};
Cookie.prototype.setExpires = function setExpires(exp) {
- if (exp instanceof Date) this.expires = exp;
- else this.expires = parseDate(exp) || "Infinity";
+ if (exp instanceof Date) {
+ this.expires = exp;
+ } else {
+ this.expires = parseDate(exp) || "Infinity";
+ }
};
Cookie.prototype.setMaxAge = function setMaxAge(age) {
- if (age === Infinity || age === -Infinity)
+ if (age === Infinity || age === -Infinity) {
this.maxAge = age.toString(); // so JSON.stringify() works
- else
+ } else {
this.maxAge = age;
+ }
};
// gives Cookie header format
Cookie.prototype.cookieString = function cookieString() {
var val = this.value;
- if (val == null) val = '';
- if (!val.length || COOKIE_OCTETS.test(val))
- return this.key+'='+val;
- else
- return this.key+'="'+val+'"';
+ if (val == null) {
+ val = '';
+ }
+ return this.key+'='+val;
};
// gives Set-Cookie header format
var str = this.cookieString();
if (this.expires != Infinity) {
- if (this.expires instanceof Date)
+ if (this.expires instanceof Date) {
str += '; Expires='+formatDate(this.expires);
- else
+ } else {
str += '; Expires='+this.expires;
+ }
}
- if (this.maxAge != null && this.maxAge != Infinity)
+ if (this.maxAge != null && this.maxAge != Infinity) {
str += '; Max-Age='+this.maxAge;
+ }
- if (this.domain && !this.hostOnly)
+ if (this.domain && !this.hostOnly) {
str += '; Domain='+this.domain;
- if (this.path)
+ }
+ if (this.path) {
str += '; Path='+this.path;
+ }
- if (this.secure) str += '; Secure';
- if (this.httpOnly) str += '; HttpOnly';
+ if (this.secure) {
+ str += '; Secure';
+ }
+ if (this.httpOnly) {
+ str += '; HttpOnly';
+ }
if (this.extensions) {
this.extensions.forEach(function(ext) {
str += '; '+ext;
expires = parseDate(expires) || Infinity;
}
- if (expires == Infinity)
+ if (expires == Infinity) {
return Infinity;
+ }
return expires.getTime() - (now || Date.now());
}
return relativeTo.getTime() + age;
}
- if (this.expires == Infinity) return Infinity;
+ if (this.expires == Infinity) {
+ return Infinity;
+ }
return this.expires.getTime();
};
// elsewhere), except it returns a Date
Cookie.prototype.expiryDate = function expiryDate(now) {
var millisec = this.expiryTime(now);
- if (millisec == Infinity) return new Date(MAX_TIME);
- else if (millisec == -Infinity) return new Date(MIN_TIME);
- else return new Date(millisec);
+ if (millisec == Infinity) {
+ return new Date(MAX_TIME);
+ } else if (millisec == -Infinity) {
+ return new Date(MIN_TIME);
+ } else {
+ return new Date(millisec);
+ }
};
// This replaces the "persistent-flag" parts of S5.3 step 3
// Mostly S5.1.2 and S5.2.3:
Cookie.prototype.cdomain =
Cookie.prototype.canonicalizedDomain = function canonicalizedDomain() {
- if (this.domain == null) return null;
+ if (this.domain == null) {
+ return null;
+ }
return canonicalDomain(this.domain);
};
var memstore;
function CookieJar(store, rejectPublicSuffixes) {
- if (rejectPublicSuffixes != null) this.rejectPublicSuffixes = rejectPublicSuffixes;
+ if (rejectPublicSuffixes != null) {
+ this.rejectPublicSuffixes = rejectPublicSuffixes;
+ }
+
if (!store) {
memstore = memstore || require('./memstore');
store = new memstore.MemoryCookieStore();
}
CookieJar.prototype.store = null;
CookieJar.prototype.rejectPublicSuffixes = true;
+var CAN_BE_SYNC = [];
-CookieJar.prototype.setCookie = function setCookie(cookie, url, options, cb) {
+CAN_BE_SYNC.push('setCookie');
+CookieJar.prototype.setCookie = function(cookie, url, options, cb) {
var err;
var context = (url instanceof Object) ? url : urlParse(url);
if (options instanceof Function) {
var host = canonicalDomain(context.hostname);
// S5.3 step 1
- if (!(cookie instanceof Cookie))
+ if (!(cookie instanceof Cookie)) {
cookie = Cookie.parse(cookie, options.strict === true);
+ }
if (!cookie) {
err = new Error("Cookie failed to parse");
return cb(options.ignoreError ? null : err);
return cb(options.ignoreError ? null : err);
}
- if (cookie.hostOnly == null) // don't reset if already set
+ if (cookie.hostOnly == null) { // don't reset if already set
cookie.hostOnly = false;
+ }
} else {
cookie.hostOnly = true;
cookie.path = defaultPath(context.pathname);
cookie.pathIsDefault = true;
} else {
- if (cookie.path.length > 1 && cookie.path.substr(-1) == '/')
+ if (cookie.path.length > 1 && cookie.path.substr(-1) == '/') {
cookie.path = cookie.path.slice(0,-1);
+ }
}
// S5.3 step 8: NOOP; secure attribute
var store = this.store;
if (!store.updateCookie) {
- store.updateCookie = function stubUpdateCookie(oldCookie, newCookie, cb) {
+ store.updateCookie = function(oldCookie, newCookie, cb) {
this.putCookie(newCookie, cb);
};
}
- store.findCookie(cookie.domain, cookie.path, cookie.key, function(err,oldCookie) {
- if (err) return cb(err);
+ function withCookie(err, oldCookie) {
+ if (err) {
+ return cb(err);
+ }
var next = function(err) {
- if (err) return cb(err);
- else cb(null, cookie);
+ if (err) {
+ return cb(err);
+ } else {
+ cb(null, cookie);
+ }
};
if (oldCookie) {
cookie.creation = cookie.lastAccessed = now;
store.putCookie(cookie, next); // step 12
}
- });
+ }
+
+ store.findCookie(cookie.domain, cookie.path, cookie.key, withCookie);
};
// RFC6365 S5.4
-CookieJar.prototype.getCookies = function getCookies(url, options, cb) {
+CAN_BE_SYNC.push('getCookies');
+CookieJar.prototype.getCookies = function(url, options, cb) {
var context = (url instanceof Object) ? url : urlParse(url);
if (options instanceof Function) {
cb = options;
}
var http = options.http;
- if (http == null) http = true;
+ if (http == null) {
+ http = true;
+ }
var now = options.now || Date.now();
var expireCheck = options.expire !== false;
// The cookie's host-only-flag is false and the canonicalized
// request-host domain-matches the cookie's domain."
if (c.hostOnly) {
- if (c.domain != host) return false;
+ if (c.domain != host) {
+ return false;
+ }
} else {
- if (!domainMatch(host, c.domain, false)) return false;
+ if (!domainMatch(host, c.domain, false)) {
+ return false;
+ }
}
// "The request-uri's path path-matches the cookie's path."
- if (!allPaths && !pathMatch(path, c.path))
+ if (!allPaths && !pathMatch(path, c.path)) {
return false;
+ }
// "If the cookie's secure-only-flag is true, then the request-uri's
// scheme must denote a "secure" protocol"
- if (c.secure && !secure)
+ if (c.secure && !secure) {
return false;
+ }
// "If the cookie's http-only-flag is true, then exclude the cookie if the
// cookie-string is being generated for a "non-HTTP" API"
- if (c.httpOnly && !http)
+ if (c.httpOnly && !http) {
return false;
+ }
// deferred from S5.3
// non-RFC: allow retention of expired cookies by choice
}
store.findCookies(host, allPaths ? null : path, function(err,cookies) {
- if (err) return cb(err);
+ if (err) {
+ return cb(err);
+ }
cookies = cookies.filter(matchingCookie);
// sorting of S5.4 part 2
- if (options.sort !== false)
+ if (options.sort !== false) {
cookies = cookies.sort(cookieCompare);
+ }
// S5.4 part 3
var now = new Date();
- cookies.forEach(function(c) { c.lastAccessed = now });
+ cookies.forEach(function(c) {
+ c.lastAccessed = now;
+ });
// TODO persist lastAccessed
cb(null,cookies);
});
};
+CAN_BE_SYNC.push('getCookieString');
CookieJar.prototype.getCookieString = function(/*..., cb*/) {
var args = Array.prototype.slice.call(arguments,0);
var cb = args.pop();
var next = function(err,cookies) {
- if (err) cb(err);
- else cb(null, cookies.map(function(c){return c.cookieString()}).join('; '));
+ if (err) {
+ cb(err);
+ } else {
+ cb(null, cookies.map(function(c){
+ return c.cookieString();
+ }).join('; '));
+ }
};
args.push(next);
this.getCookies.apply(this,args);
};
+CAN_BE_SYNC.push('getSetCookieStrings');
CookieJar.prototype.getSetCookieStrings = function(/*..., cb*/) {
var args = Array.prototype.slice.call(arguments,0);
var cb = args.pop();
var next = function(err,cookies) {
- if (err) cb(err);
- else cb(null, cookies.map(function(c){return c.toString()}));
+ if (err) {
+ cb(err);
+ } else {
+ cb(null, cookies.map(function(c){
+ return c.toString();
+ }));
+ }
};
args.push(next);
this.getCookies.apply(this,args);
};
+// Use a closure to provide a true imperative API for synchronous stores.
+function syncWrap(method) {
+ return function() {
+ if (!this.store.synchronous) {
+ throw new Error('CookieJar store is not synchronous; use async API instead.');
+ }
+
+ var args = Array.prototype.slice.call(arguments);
+ var syncErr, syncResult;
+ args.push(function syncCb(err, result) {
+ syncErr = err;
+ syncResult = result;
+ });
+ this[method].apply(this, args);
+
+ if (syncErr) {
+ throw syncErr;
+ }
+ return syncResult;
+ };
+}
+// wrap all declared CAN_BE_SYNC methods in the sync wrapper
+CAN_BE_SYNC.forEach(function(method) {
+ CookieJar.prototype[method+'Sync'] = syncWrap(method);
+});
module.exports = {
CookieJar: CookieJar,
Cookie: Cookie,
+ Store: Store,
parseDate: parseDate,
formatDate: formatDate,
parse: parse,
+'use strict';
var tough = require('./cookie');
+var Store = require('./store').Store;
var permuteDomain = tough.permuteDomain;
var permutePath = tough.permutePath;
var util = require('util');
function MemoryCookieStore() {
+ Store.call(this);
this.idx = {};
}
-module.exports.MemoryCookieStore = MemoryCookieStore;
+util.inherits(MemoryCookieStore, Store);
+exports.MemoryCookieStore = MemoryCookieStore;
MemoryCookieStore.prototype.idx = null;
+MemoryCookieStore.prototype.synchronous = true;
// force a default depth:
-MemoryCookieStore.prototype.inspect = function inspect() {
+MemoryCookieStore.prototype.inspect = function() {
return "{ idx: "+util.inspect(this.idx, false, 2)+' }';
};
-MemoryCookieStore.prototype.findCookie = function findCookie(domain, path, key, cb) {
- if (!this.idx[domain]) return cb(null,undefined);
- if (!this.idx[domain][path]) return cb(null,undefined);
+MemoryCookieStore.prototype.findCookie = function(domain, path, key, cb) {
+ if (!this.idx[domain]) {
+ return cb(null,undefined);
+ }
+ if (!this.idx[domain][path]) {
+ return cb(null,undefined);
+ }
return cb(null,this.idx[domain][path][key]||null);
};
-MemoryCookieStore.prototype.findCookies = function findCookies(domain, path, cb) {
+MemoryCookieStore.prototype.findCookies = function(domain, path, cb) {
var results = [];
- if (!domain) return cb(null,[]);
+ if (!domain) {
+ return cb(null,[]);
+ }
var pathMatcher;
if (!path) {
} else if (path === '/') {
pathMatcher = function matchSlash(domainIndex) {
var pathIndex = domainIndex['/'];
- if (!pathIndex) return;
+ if (!pathIndex) {
+ return;
+ }
for (var key in pathIndex) {
results.push(pathIndex[key]);
}
pathMatcher = function matchRFC(domainIndex) {
paths.forEach(function(curPath) {
var pathIndex = domainIndex[curPath];
- if (!pathIndex) return;
+ if (!pathIndex) {
+ return;
+ }
for (var key in pathIndex) {
results.push(pathIndex[key]);
}
var idx = this.idx;
domains.forEach(function(curDomain) {
var domainIndex = idx[curDomain];
- if (!domainIndex) return;
+ if (!domainIndex) {
+ return;
+ }
pathMatcher(domainIndex);
});
cb(null,results);
};
-MemoryCookieStore.prototype.putCookie = function putCookie(cookie, cb) {
- if (!this.idx[cookie.domain]) this.idx[cookie.domain] = {};
- if (!this.idx[cookie.domain][cookie.path]) this.idx[cookie.domain][cookie.path] = {};
+MemoryCookieStore.prototype.putCookie = function(cookie, cb) {
+ if (!this.idx[cookie.domain]) {
+ this.idx[cookie.domain] = {};
+ }
+ if (!this.idx[cookie.domain][cookie.path]) {
+ this.idx[cookie.domain][cookie.path] = {};
+ }
this.idx[cookie.domain][cookie.path][cookie.key] = cookie;
cb(null);
};
};
MemoryCookieStore.prototype.removeCookies = function removeCookies(domain, path, cb) {
- if (!this.idx[domain]) {
+ if (this.idx[domain]) {
if (path) {
delete this.idx[domain][path];
} else {
--- /dev/null
+'use strict';
+/*jshint unused:false */
+
+function Store() {
+}
+exports.Store = Store;
+
+// Stores may be synchronous, but are still required to use a
+// Continuation-Passing Style API. The CookieJar itself will expose a "*Sync"
+// API that converts from synchronous-callbacks to imperative style.
+Store.prototype.synchronous = false;
+
+Store.prototype.findCookie = function(domain, path, key, cb) {
+ throw new Error('findCookie is not implemented');
+};
+
+Store.prototype.findCookies = function(domain, path, cb) {
+ throw new Error('findCookies is not implemented');
+};
+
+Store.prototype.putCookie = function(cookie, cb) {
+ throw new Error('putCookie is not implemented');
+};
+
+Store.prototype.updateCookie = function(oldCookie, newCookie, cb) {
+ // recommended default implementation:
+ // return this.putCookie(newCookie, cb);
+ throw new Error('updateCookie is not implemented');
+};
+
+Store.prototype.removeCookie = function(domain, path, key, cb) {
+ throw new Error('removeCookie is not implemented');
+};
+
+Store.prototype.removeCookies = function removeCookies(domain, path, cb) {
+ throw new Error('removeCookies is not implemented');
+};
+++ /dev/null
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
--- /dev/null
+# Punycode.js [![Build status](https://travis-ci.org/bestiejs/punycode.js.svg?branch=master)](https://travis-ci.org/bestiejs/punycode.js) [![Code coverage status](http://img.shields.io/coveralls/bestiejs/punycode.js/master.svg)](https://coveralls.io/r/bestiejs/punycode.js) [![Dependency status](https://gemnasium.com/bestiejs/punycode.js.svg)](https://gemnasium.com/bestiejs/punycode.js)
+
+A robust Punycode converter that fully complies to [RFC 3492](http://tools.ietf.org/html/rfc3492) and [RFC 5891](http://tools.ietf.org/html/rfc5891), and works on nearly all JavaScript platforms.
+
+This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:
+
+* [The C example code from RFC 3492](http://tools.ietf.org/html/rfc3492#appendix-C)
+* [`punycode.c` by _Markus W. Scherer_ (IBM)](http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c)
+* [`punycode.c` by _Ben Noordhuis_](https://github.com/bnoordhuis/punycode/blob/master/punycode.c)
+* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)
+* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072))
+
+This project is [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with [Node.js v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc).
+
+## Installation
+
+Via [npm](http://npmjs.org/) (only required for Node.js releases older than v0.6.2):
+
+```bash
+npm install punycode
+```
+
+Via [Bower](http://bower.io/):
+
+```bash
+bower install punycode
+```
+
+Via [Component](https://github.com/component/component):
+
+```bash
+component install bestiejs/punycode.js
+```
+
+In a browser:
+
+```html
+<script src="punycode.js"></script>
+```
+
+In [Narwhal](http://narwhaljs.org/), [Node.js](http://nodejs.org/), and [RingoJS](http://ringojs.org/):
+
+```js
+var punycode = require('punycode');
+```
+
+In [Rhino](http://www.mozilla.org/rhino/):
+
+```js
+load('punycode.js');
+```
+
+Using an AMD loader like [RequireJS](http://requirejs.org/):
+
+```js
+require(
+ {
+ 'paths': {
+ 'punycode': 'path/to/punycode'
+ }
+ },
+ ['punycode'],
+ function(punycode) {
+ console.log(punycode);
+ }
+);
+```
+
+## API
+
+### `punycode.decode(string)`
+
+Converts a Punycode string of ASCII symbols to a string of Unicode symbols.
+
+```js
+// decode domain name parts
+punycode.decode('maana-pta'); // 'mañana'
+punycode.decode('--dqo34k'); // '☃-⌘'
+```
+
+### `punycode.encode(string)`
+
+Converts a string of Unicode symbols to a Punycode string of ASCII symbols.
+
+```js
+// encode domain name parts
+punycode.encode('mañana'); // 'maana-pta'
+punycode.encode('☃-⌘'); // '--dqo34k'
+```
+
+### `punycode.toUnicode(input)`
+
+Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode.
+
+```js
+// decode domain names
+punycode.toUnicode('xn--maana-pta.com');
+// → 'mañana.com'
+punycode.toUnicode('xn----dqo34k.com');
+// → '☃-⌘.com'
+
+// decode email addresses
+punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq');
+// → 'джумла@джpумлатест.bрфa'
+```
+
+### `punycode.toASCII(input)`
+
+Converts a Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that's already in ASCII.
+
+```js
+// encode domain names
+punycode.toASCII('mañana.com');
+// → 'xn--maana-pta.com'
+punycode.toASCII('☃-⌘.com');
+// → 'xn----dqo34k.com'
+
+// encode email addresses
+punycode.toASCII('джумла@джpумлатест.bрфa');
+// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'
+```
+
+### `punycode.ucs2`
+
+#### `punycode.ucs2.decode(string)`
+
+Creates an array containing the numeric code point values of each Unicode symbol in the string. While [JavaScript uses UCS-2 internally](http://mathiasbynens.be/notes/javascript-encoding), this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16.
+
+```js
+punycode.ucs2.decode('abc');
+// → [0x61, 0x62, 0x63]
+// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE:
+punycode.ucs2.decode('\uD834\uDF06');
+// → [0x1D306]
+```
+
+#### `punycode.ucs2.encode(codePoints)`
+
+Creates a string based on an array of numeric code point values.
+
+```js
+punycode.ucs2.encode([0x61, 0x62, 0x63]);
+// → 'abc'
+punycode.ucs2.encode([0x1D306]);
+// → '\uD834\uDF06'
+```
+
+### `punycode.version`
+
+A string representing the current Punycode.js version number.
+
+## Unit tests & code coverage
+
+After cloning this repository, run `npm install --dev` to install the dependencies needed for Punycode.js development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`.
+
+Once that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, PhantomJS, and web browsers as well, use `grunt test`.
+
+To generate the code coverage report, use `grunt cover`.
+
+Feel free to fork if you see possible improvements!
+
+## Author
+
+| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
+|---|
+| [Mathias Bynens](http://mathiasbynens.be/) |
+
+## Contributors
+
+| [![twitter/jdalton](https://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter") |
+|---|
+| [John-David Dalton](http://allyoucanleet.com/) |
+
+## License
+
+Punycode.js is available under the [MIT](http://mths.be/mit) license.
{
"name": "punycode",
- "version": "1.2.3",
+ "version": "1.3.1",
"description": "A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.",
"homepage": "http://mths.be/punycode",
"main": "punycode.js",
{
"type": "MIT",
"url": "http://mths.be/mit"
- },
- {
- "type": "GPL",
- "url": "http://mths.be/gpl"
}
],
"author": {
"name": "Mathias Bynens",
- "email": "mathias@qiwi.be",
"url": "http://mathiasbynens.be/"
},
"contributors": [
{
"name": "Mathias Bynens",
- "email": "mathias@qiwi.be",
"url": "http://mathiasbynens.be/"
},
{
"name": "John-David Dalton",
- "email": "john.david.dalton@gmail.com",
"url": "http://allyoucanleet.com/"
}
],
- "bugs": {
- "url": "https://github.com/bestiejs/punycode.js/issues"
- },
"repository": {
"type": "git",
"url": "https://github.com/bestiejs/punycode.js.git"
},
- "engines": [
- "node",
- "rhino"
+ "bugs": {
+ "url": "https://github.com/bestiejs/punycode.js/issues"
+ },
+ "files": [
+ "LICENSE-MIT.txt",
+ "punycode.js"
],
"directories": {
- "doc": "docs",
"test": "tests"
},
"scripts": {
"test": "node tests/tests.js"
},
"devDependencies": {
- "grunt": "~0.4.1",
- "grunt-contrib-uglify": "~0.2.2",
- "grunt-shell": "~0.2.2",
- "istanbul": "~0.1.37",
- "qunit-clib": "~1.3.0",
+ "coveralls": "^2.10.1",
+ "grunt": "^0.4.5",
+ "grunt-contrib-uglify": "^0.5.0",
+ "grunt-shell": "^0.7.0",
+ "istanbul": "^0.2.13",
+ "qunit-extras": "^1.2.0",
"qunitjs": "~1.11.0",
- "requirejs": "~2.1.6"
+ "requirejs": "^2.1.14"
+ },
+ "_id": "punycode@1.3.1",
+ "_shasum": "710afe5123c20a1530b712e3e682b9118fe8058e",
+ "_from": "punycode@>=0.2.0",
+ "_npmVersion": "1.4.9",
+ "_npmUser": {
+ "name": "mathias",
+ "email": "mathias@qiwi.be"
+ },
+ "maintainers": [
+ {
+ "name": "mathias",
+ "email": "mathias@qiwi.be"
+ },
+ {
+ "name": "reconbot",
+ "email": "wizard@roborooter.com"
+ }
+ ],
+ "dist": {
+ "shasum": "710afe5123c20a1530b712e3e682b9118fe8058e",
+ "tarball": "http://registry.npmjs.org/punycode/-/punycode-1.3.1.tgz"
},
- "readme": "ERROR: No README data found!",
- "_id": "punycode@1.2.3",
- "_from": "punycode@>=0.2.0"
+ "_resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.1.tgz",
+ "readme": "ERROR: No README data found!"
}
-/*! http://mths.be/punycode v1.2.3 by @mathias */
+/*! http://mths.be/punycode v1.3.1 by @mathias */
;(function(root) {
/** Detect free variables */
- var freeExports = typeof exports == 'object' && exports;
+ var freeExports = typeof exports == 'object' && exports &&
+ !exports.nodeType && exports;
var freeModule = typeof module == 'object' && module &&
- module.exports == freeExports && module;
+ !module.nodeType && module;
var freeGlobal = typeof global == 'object' && global;
- if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
+ if (
+ freeGlobal.global === freeGlobal ||
+ freeGlobal.window === freeGlobal ||
+ freeGlobal.self === freeGlobal
+ ) {
root = freeGlobal;
}
/** Regular expressions */
regexPunycode = /^xn--/,
- regexNonASCII = /[^ -~]/, // unprintable ASCII chars + non-ASCII chars
- regexSeparators = /\x2E|\u3002|\uFF0E|\uFF61/g, // RFC 3490 separators
+ regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
+ regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
/** Error messages */
errors = {
*/
function map(array, fn) {
var length = array.length;
+ var result = [];
while (length--) {
- array[length] = fn(array[length]);
+ result[length] = fn(array[length]);
}
- return array;
+ return result;
}
/**
- * A simple `Array#map`-like wrapper to work with domain name strings.
+ * A simple `Array#map`-like wrapper to work with domain name strings or email
+ * addresses.
* @private
- * @param {String} domain The domain name.
+ * @param {String} domain The domain name or email address.
* @param {Function} callback The function that gets called for every
* character.
* @returns {Array} A new string of characters returned by the callback
* function.
*/
function mapDomain(string, fn) {
- return map(string.split(regexSeparators), fn).join('.');
+ var parts = string.split('@');
+ var result = '';
+ if (parts.length > 1) {
+ // In email addresses, only the domain name should be punycoded. Leave
+ // the local part (i.e. everything up to `@`) intact.
+ result = parts[0] + '@';
+ string = parts[1];
+ }
+ var labels = string.split(regexSeparators);
+ var encoded = map(labels, fn).join('.');
+ return result + encoded;
}
/**
k,
digit,
t,
- length,
/** Cached calculation results */
baseMinusT;
}
/**
- * Converts a string of Unicode symbols to a Punycode string of ASCII-only
- * symbols.
+ * Converts a string of Unicode symbols (e.g. a domain name label) to a
+ * Punycode string of ASCII-only symbols.
* @memberOf punycode
* @param {String} input The string of Unicode symbols.
* @returns {String} The resulting Punycode string of ASCII-only symbols.
}
/**
- * Converts a Punycode string representing a domain name to Unicode. Only the
- * Punycoded parts of the domain name will be converted, i.e. it doesn't
- * matter if you call it on a string that has already been converted to
- * Unicode.
+ * Converts a Punycode string representing a domain name or an email address
+ * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
+ * it doesn't matter if you call it on a string that has already been
+ * converted to Unicode.
* @memberOf punycode
- * @param {String} domain The Punycode domain name to convert to Unicode.
+ * @param {String} input The Punycoded domain name or email address to
+ * convert to Unicode.
* @returns {String} The Unicode representation of the given Punycode
* string.
*/
- function toUnicode(domain) {
- return mapDomain(domain, function(string) {
+ function toUnicode(input) {
+ return mapDomain(input, function(string) {
return regexPunycode.test(string)
? decode(string.slice(4).toLowerCase())
: string;
}
/**
- * Converts a Unicode string representing a domain name to Punycode. Only the
- * non-ASCII parts of the domain name will be converted, i.e. it doesn't
- * matter if you call it with a domain that's already in ASCII.
+ * Converts a Unicode string representing a domain name or an email address to
+ * Punycode. Only the non-ASCII parts of the domain name will be converted,
+ * i.e. it doesn't matter if you call it with a domain that's already in
+ * ASCII.
* @memberOf punycode
- * @param {String} domain The domain name to convert, as a Unicode string.
- * @returns {String} The Punycode representation of the given domain name.
+ * @param {String} input The domain name or email address to convert, as a
+ * Unicode string.
+ * @returns {String} The Punycode representation of the given domain name or
+ * email address.
*/
- function toASCII(domain) {
- return mapDomain(domain, function(string) {
+ function toASCII(input) {
+ return mapDomain(input, function(string) {
return regexNonASCII.test(string)
? 'xn--' + encode(string)
: string;
* @memberOf punycode
* @type String
*/
- 'version': '1.2.3',
+ 'version': '1.3.1',
/**
* An object of methods to convert from JavaScript's internal character
* representation (UCS-2) to Unicode code points, and back.
typeof define.amd == 'object' &&
define.amd
) {
- define(function() {
+ define('punycode', function() {
return punycode;
});
- } else if (freeExports && !freeExports.nodeType) {
- if (freeModule) { // in Node.js or RingoJS v0.8.0+
+ } else if (freeExports && freeModule) {
+ if (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+
freeModule.exports = punycode;
} else { // in Narwhal or RingoJS v0.7.0-
for (key in punycode) {
+++ /dev/null
-/*! http://mths.be/punycode v1.2.3 by @mathias */
-(function(o){function e(o){throw RangeError(L[o])}function n(o,e){for(var n=o.length;n--;)o[n]=e(o[n]);return o}function t(o,e){return n(o.split(S),e).join(".")}function r(o){for(var e,n,t=[],r=0,u=o.length;u>r;)e=o.charCodeAt(r++),e>=55296&&56319>=e&&u>r?(n=o.charCodeAt(r++),56320==(64512&n)?t.push(((1023&e)<<10)+(1023&n)+65536):(t.push(e),r--)):t.push(e);return t}function u(o){return n(o,function(o){var e="";return o>65535&&(o-=65536,e+=R(55296|1023&o>>>10),o=56320|1023&o),e+=R(o)}).join("")}function i(o){return 10>o-48?o-22:26>o-65?o-65:26>o-97?o-97:x}function f(o,e){return o+22+75*(26>o)-((0!=e)<<5)}function c(o,e,n){var t=0;for(o=n?P(o/m):o>>1,o+=P(o/e);o>M*y>>1;t+=x)o=P(o/M);return P(t+(M+1)*o/(o+j))}function l(o){var n,t,r,f,l,d,s,a,p,h,v=[],g=o.length,w=0,j=I,m=A;for(t=o.lastIndexOf(F),0>t&&(t=0),r=0;t>r;++r)o.charCodeAt(r)>=128&&e("not-basic"),v.push(o.charCodeAt(r));for(f=t>0?t+1:0;g>f;){for(l=w,d=1,s=x;f>=g&&e("invalid-input"),a=i(o.charCodeAt(f++)),(a>=x||a>P((b-w)/d))&&e("overflow"),w+=a*d,p=m>=s?C:s>=m+y?y:s-m,!(p>a);s+=x)h=x-p,d>P(b/h)&&e("overflow"),d*=h;n=v.length+1,m=c(w-l,n,0==l),P(w/n)>b-j&&e("overflow"),j+=P(w/n),w%=n,v.splice(w++,0,j)}return u(v)}function d(o){var n,t,u,i,l,d,s,a,p,h,v,g,w,j,m,E=[];for(o=r(o),g=o.length,n=I,t=0,l=A,d=0;g>d;++d)v=o[d],128>v&&E.push(R(v));for(u=i=E.length,i&&E.push(F);g>u;){for(s=b,d=0;g>d;++d)v=o[d],v>=n&&s>v&&(s=v);for(w=u+1,s-n>P((b-t)/w)&&e("overflow"),t+=(s-n)*w,n=s,d=0;g>d;++d)if(v=o[d],n>v&&++t>b&&e("overflow"),v==n){for(a=t,p=x;h=l>=p?C:p>=l+y?y:p-l,!(h>a);p+=x)m=a-h,j=x-h,E.push(R(f(h+m%j,0))),a=P(m/j);E.push(R(f(a,0))),l=c(t,w,u==i),t=0,++u}++t,++n}return E.join("")}function s(o){return t(o,function(o){return E.test(o)?l(o.slice(4).toLowerCase()):o})}function a(o){return t(o,function(o){return O.test(o)?"xn--"+d(o):o})}var p="object"==typeof exports&&exports,h="object"==typeof module&&module&&module.exports==p&&module,v="object"==typeof global&&global;(v.global===v||v.window===v)&&(o=v);var g,w,b=2147483647,x=36,C=1,y=26,j=38,m=700,A=72,I=128,F="-",E=/^xn--/,O=/[^ -~]/,S=/\x2E|\u3002|\uFF0E|\uFF61/g,L={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},M=x-C,P=Math.floor,R=String.fromCharCode;if(g={version:"1.2.3",ucs2:{decode:r,encode:u},decode:l,encode:d,toASCII:a,toUnicode:s},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define(function(){return g});else if(p&&!p.nodeType)if(h)h.exports=g;else for(w in g)g.hasOwnProperty(w)&&(p[w]=g[w]);else o.punycode=g})(this);
\ No newline at end of file
+++ /dev/null
-Copyright 2011-2013 John-David Dalton <http://allyoucanleet.com/>
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
+++ /dev/null
-# Docdown <sup>v1.0.0</sup>
-
-A simple JSDoc to Markdown documentation generator.
-
-## Documentation
-
-The documentation for Docdown can be viewed here: [/doc/README.md](https://github.com/jdalton/docdown/blob/master/doc/README.md#readme)
-
-For a list of upcoming features, check out our [roadmap](https://github.com/jdalton/docdown/wiki/Roadmap).
-
-## Installation and usage
-
-Usage example:
-
-```php
-require("docdown.php");
-
-// generate Markdown
-$markdown = docdown(array(
- "path" => $filepath,
- "url" => "https://github.com/username/project/blob/master/my.js"
-));
-```
-
-## Author
-
-| [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](http://twitter.com/jdalton "Follow @jdalton on Twitter") |
-|---|
-| [John-David Dalton](http://allyoucanleet.com/) |
-
-## Contributors
-
-| [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias "Follow @mathias on Twitter") |
-|---|
-| [Mathias Bynens](http://mathiasbynens.be/) |
+++ /dev/null
-# Docdown <sup>v1.0.0</sup>
-
-<!-- div -->
-
-
-<!-- div -->
-
-## <a id="docdown"></a>`docdown`
-* [`docdown`](#docdown$optionsarray)
-
-<!-- /div -->
-
-
-<!-- /div -->
-
-
-<!-- div -->
-
-
-<!-- div -->
-
-## `docdown`
-
-<!-- div -->
-
-### <a id="docdown$optionsarray"></a>`docdown([$options=array()])`
-<a href="#docdown$optionsarray">#</a> [Ⓢ](https://github.com/jdalton/docdown/blob/master/docdown.php#L34 "View in source") [Ⓣ][1]
-
-Generates Markdown from JSDoc entries in a given file.
-
-#### Arguments
-1. `[$options=array()]` *(Array)*: The options array.
-
-#### Returns
-*(String)*: The generated Markdown.
-
-#### Example
-```php
-// specify a file path
-$markdown = docdown(array(
- // path to js file
- 'path' => $filepath,
- // url used to reference line numbers in code
- 'url' => 'https://github.com/username/project/blob/master/my.js'
-));
-
-// or pass raw js
-$markdown = docdown(array(
- // raw JavaScript source
- 'source' => $rawJS,
- // documentation title
- 'title' => 'My API Documentation',
- // url used to reference line numbers in code
- 'url' => 'https://github.com/username/project/blob/master/my.js'
-));
-```
-
-* * *
-
-<!-- /div -->
-
-
-<!-- /div -->
-
-
-<!-- /div -->
-
-
- [1]: #docdown "Jump back to the TOC."
\ No newline at end of file
+++ /dev/null
-<?php
-
- // cleanup requested filepath
- $file = isset($_GET['f']) ? $_GET['f'] : 'docdown';
- $file = preg_replace('#(\.*[\/])+#', '', $file);
- $file .= preg_match('/\.[a-z]+$/', $file) ? '' : '.php';
-
- // output filename
- if (isset($_GET['o'])) {
- $output = $_GET['o'];
- } else if (isset($_SERVER['argv'][1])) {
- $output = $_SERVER['argv'][1];
- } else {
- $output = basename($file);
- }
-
- /*--------------------------------------------------------------------------*/
-
- require('../docdown.php');
-
- // generate Markdown
- $markdown = docdown(array(
- 'path' => '../' . $file,
- 'title' => 'Docdown <sup>v1.0.0</sup>',
- 'url' => 'https://github.com/jdalton/docdown/blob/master/docdown.php'
- ));
-
- // save to a .md file
- file_put_contents($output . '.md', $markdown);
-
- // print
- header('Content-Type: text/plain;charset=utf-8');
- echo $markdown . PHP_EOL;
-
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-/*!
- * Docdown v1.0.0-pre
- * Copyright 2011-2013 John-David Dalton <http://allyoucanleet.com/>
- * Available under MIT license <http://mths.be/mit>
- */
-require(dirname(__FILE__) . '/src/DocDown/Generator.php');
-
-/**
- * Generates Markdown from JSDoc entries in a given file.
- *
- * @param {Array} [$options=array()] The options array.
- * @returns {String} The generated Markdown.
- * @example
- *
- * // specify a file path
- * $markdown = docdown(array(
- * // path to js file
- * 'path' => $filepath,
- * // url used to reference line numbers in code
- * 'url' => 'https://github.com/username/project/blob/master/my.js'
- * ));
- *
- * // or pass raw js
- * $markdown = docdown(array(
- * // raw JavaScript source
- * 'source' => $rawJS,
- * // documentation title
- * 'title' => 'My API Documentation',
- * // url used to reference line numbers in code
- * 'url' => 'https://github.com/username/project/blob/master/my.js'
- * ));
- */
-function docdown( $options = array() ) {
- $gen = new Generator($options);
- return $gen->generate();
-}
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-
-/**
- * A class to represent a JSDoc entry alias.
- */
-class Alias {
-
- /**
- * The alias owner.
- *
- * @memberOf Alias
- * @type Object
- */
- public $owner;
-
- /*--------------------------------------------------------------------------*/
-
- /**
- * The Alias constructor.
- *
- * @constructor
- * @param {String} $name The alias name.
- * @param {Object} $owner The alias owner.
- */
- public function __construct( $name, $owner ) {
- $this->owner = $owner;
- $this->_name = $name;
- $this->_call = $owner->getCall();
- $this->_category = $owner->getCategory();
- $this->_desc = $owner->getDesc();
- $this->_example = $owner->getExample();
- $this->_isCtor = $owner->isCtor();
- $this->_isLicense = $owner->isLicense();
- $this->_isPlugin = $owner->isPlugin();
- $this->_isPrivate = $owner->isPrivate();
- $this->_isStatic = $owner->isStatic();
- $this->_lineNumber = $owner->getLineNumber();
- $this->_members = $owner->getMembers();
- $this->_params = $owner->getParams();
- $this->_returns = $owner->getReturns();
- $this->_type = $owner->getType();
- }
-
- /*--------------------------------------------------------------------------*/
-
- /**
- * Extracts the entry's `alias` objects.
- *
- * @memberOf Alias
- * @param {Number} $index The index of the array value to return.
- * @returns {Array|String} The entry's `alias` objects.
- */
- public function getAliases( $index = null ) {
- $result = array();
- return $index !== null
- ? @$result[$index]
- : $result;
- }
-
- /**
- * Extracts the function call from the owner entry.
- *
- * @memberOf Alias
- * @returns {String} The function call.
- */
- public function getCall() {
- return $this->_call;
- }
-
- /**
- * Extracts the owner entry's `category` data.
- *
- * @memberOf Alias
- * @returns {String} The owner entry's `category` data.
- */
- public function getCategory() {
- return $this->_category;
- }
-
- /**
- * Extracts the owner entry's description.
- *
- * @memberOf Alias
- * @returns {String} The owner entry's description.
- */
- public function getDesc() {
- return $this->_desc;
- }
-
- /**
- * Extracts the owner entry's `example` data.
- *
- * @memberOf Alias
- * @returns {String} The owner entry's `example` data.
- */
- public function getExample() {
- return $this->_example;
- }
-
- /**
- * Checks if the entry is an alias.
- *
- * @memberOf Alias
- * @returns {Boolean} Returns `true`.
- */
- public function isAlias() {
- return true;
- }
-
- /**
- * Checks if the owner entry is a constructor.
- *
- * @memberOf Alias
- * @returns {Boolean} Returns `true` if a constructor, else `false`.
- */
- public function isCtor() {
- return $this->_isCtor;
- }
-
- /**
- * Checks if the owner entry is a license.
- *
- * @memberOf Alias
- * @returns {Boolean} Returns `true` if a license, else `false`.
- */
- public function isLicense() {
- return $this->_isLicense;
- }
-
- /**
- * Checks if the owner entry *is* assigned to a prototype.
- *
- * @memberOf Alias
- * @returns {Boolean} Returns `true` if assigned to a prototype, else `false`.
- */
- public function isPlugin() {
- return $this->_isPlugin;
- }
-
- /**
- * Checks if the owner entry is private.
- *
- * @memberOf Alias
- * @returns {Boolean} Returns `true` if private, else `false`.
- */
- public function isPrivate() {
- return $this->_isPrivate;
- }
-
- /**
- * Checks if the owner entry is *not* assigned to a prototype.
- *
- * @memberOf Alias
- * @returns {Boolean} Returns `true` if not assigned to a prototype, else `false`.
- */
- public function isStatic() {
- return $this->_isStatic;
- }
-
- /**
- * Resolves the owner entry's line number.
- *
- * @memberOf Alias
- * @returns {Number} The owner entry's line number.
- */
- public function getLineNumber() {
- return $this->_lineNumber;
- }
-
- /**
- * Extracts the owner entry's `member` data.
- *
- * @memberOf Alias
- * @param {Number} $index The index of the array value to return.
- * @returns {Array|String} The owner entry's `member` data.
- */
- public function getMembers( $index = null ) {
- return $index !== null
- ? @$this->_members[$index]
- : $this->_members;
- }
-
- /**
- * Extracts the owner entry's `name` data.
- *
- * @memberOf Alias
- * @returns {String} The owner entry's `name` data.
- */
- public function getName() {
- return $this->_name;
- }
-
- /**
- * Extracts the owner entry's `param` data.
- *
- * @memberOf Alias
- * @param {Number} $index The index of the array value to return.
- * @returns {Array} The owner entry's `param` data.
- */
- public function getParams( $index = null ) {
- return $index !== null
- ? @$this->_params[$index]
- : $this->_params;
- }
-
- /**
- * Extracts the owner entry's `returns` data.
- *
- * @memberOf Alias
- * @returns {String} The owner entry's `returns` data.
- */
- public function getReturns() {
- return $this->_returns;
- }
-
- /**
- * Extracts the owner entry's `type` data.
- *
- * @memberOf Alias
- * @returns {String} The owner entry's `type` data.
- */
- public function getType() {
- return $this->_type;
- }
-}
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-
-require(dirname(__FILE__) . "/Alias.php");
-
-/**
- * A class to simplify parsing a single JSDoc entry.
- */
-class Entry {
-
- /**
- * The documentation entry.
- *
- * @memberOf Entry
- * @type String
- */
- public $entry = '';
-
- /**
- * The language highlighter used for code examples.
- *
- * @memberOf Entry
- * @type String
- */
- public $lang = '';
-
- /**
- * The source code.
- *
- * @memberOf Entry
- * @type String
- */
- public $source = '';
-
- /*--------------------------------------------------------------------------*/
-
- /**
- * The Entry constructor.
- *
- * @constructor
- * @param {String} $entry The documentation entry to analyse.
- * @param {String} $source The source code.
- * @param {String} [$lang ='js'] The language highlighter used for code examples.
- */
- public function __construct( $entry, $source, $lang = 'js' ) {
- $this->entry = $entry;
- $this->lang = $lang;
- $this->source = str_replace(PHP_EOL, "\n", $source);
- }
-
- /*--------------------------------------------------------------------------*/
-
- /**
- * Extracts the documentation entries from source code.
- *
- * @static
- * @memberOf Entry
- * @param {String} $source The source code.
- * @returns {Array} The array of entries.
- */
- public static function getEntries( $source ) {
- preg_match_all('#/\*\*(?![-!])[\s\S]*?\*/\s*.+#', $source, $result);
- return array_pop($result);
- }
-
- /*--------------------------------------------------------------------------*/
-
- /**
- * Checks if the entry is a function reference.
- *
- * @private
- * @memberOf Entry
- * @returns {Boolean} Returns `true` if the entry is a function reference, else `false`.
- */
- private function isFunction() {
- if (!isset($this->_isFunction)) {
- $this->_isFunction = !!(
- $this->isCtor() ||
- count($this->getParams()) ||
- count($this->getReturns()) ||
- preg_match('/\*[\t ]*@function\b/', $this->entry)
- );
- }
- return $this->_isFunction;
- }
-
- /*--------------------------------------------------------------------------*/
-
- /**
- * Extracts the entry's `alias` objects.
- *
- * @memberOf Entry
- * @param {Number} $index The index of the array value to return.
- * @returns {Array|String} The entry's `alias` objects.
- */
- public function getAliases( $index = null ) {
- if (!isset($this->_aliases)) {
- preg_match('#\*[\t ]*@alias\s+(.+)#', $this->entry, $result);
-
- if (count($result)) {
- $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]));
- $result = preg_split('/,\s*/', $result);
- natsort($result);
-
- foreach ($result as $resultIndex => $value) {
- $result[$resultIndex] = new Alias($value, $this);
- }
- }
- $this->_aliases = $result;
- }
- return $index !== null
- ? @$this->_aliases[$index]
- : $this->_aliases;
- }
-
- /**
- * Extracts the function call from the entry.
- *
- * @memberOf Entry
- * @returns {String} The function call.
- */
- public function getCall() {
- if (isset($this->_call)) {
- return $this->_call;
- }
-
- preg_match('#\*/\s*(?:function ([^(]*)|(.*?)(?=[:=,]|return\b))#', $this->entry, $result);
- if ($result = array_pop($result)) {
- $result = array_pop(explode('var ', trim(trim(array_pop(explode('.', $result))), "'")));
- }
- // resolve name
- // avoid $this->getName() because it calls $this->getCall()
- preg_match('#\*[\t ]*@name\s+(.+)#', $this->entry, $name);
- if (count($name)) {
- $name = trim($name[1]);
- } else {
- $name = $result;
- }
- // compile function call syntax
- if ($this->isFunction()) {
- // compose parts
- $result = array($result);
- $params = $this->getParams();
- foreach ($params as $param) {
- $result[] = $param[1];
- }
- // format
- $result = $name .'('. implode(array_slice($result, 1), ', ') .')';
- $result = str_replace(', [', ' [, ', str_replace('], [', ', ', $result));
- }
-
- $this->_call = $result ? $result : $name;
- return $this->_call;
- }
-
- /**
- * Extracts the entry's `category` data.
- *
- * @memberOf Entry
- * @returns {String} The entry's `category` data.
- */
- public function getCategory() {
- if (isset($this->_category)) {
- return $this->_category;
- }
-
- preg_match('#\*[\t ]*@category\s+(.+)#', $this->entry, $result);
- if (count($result)) {
- $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]));
- } else {
- $result = $this->getType() == 'Function' ? 'Methods' : 'Properties';
- }
- $this->_category = $result;
- return $result;
- }
-
- /**
- * Extracts the entry's description.
- *
- * @memberOf Entry
- * @returns {String} The entry's description.
- */
- public function getDesc() {
- if (isset($this->_desc)) {
- return $this->_desc;
- }
-
- preg_match('#/\*\*(?:\s*\*)?([\s\S]*?)(?=\*\s\@[a-z]|\*/)#', $this->entry, $result);
- if (count($result)) {
- $type = $this->getType();
- $result = preg_replace('/:\n[\t ]*\*[\t ]*/', ":<br>\n", $result[1]);
- $result = preg_replace('/(?:^|\n)[\t ]*\*\n[\t ]*\*[\t ]*/', "\n\n", $result);
- $result = preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result);
- $result = trim($result);
- $result = ($type == 'Function' ? '' : '(' . str_replace('|', ', ', trim($type, '{}')) . '): ') . $result;
- }
- $this->_desc = $result;
- return $result;
- }
-
- /**
- * Extracts the entry's `example` data.
- *
- * @memberOf Entry
- * @returns {String} The entry's `example` data.
- */
- public function getExample() {
- if (isset($this->_example)) {
- return $this->_example;
- }
-
- preg_match('#\*[\t ]*@example\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#', $this->entry, $result);
- if (count($result)) {
- $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', "\n", $result[1]));
- $result = '```' . $this->lang . "\n" . $result . "\n```";
- }
- $this->_example = $result;
- return $result;
- }
-
- /**
- * Checks if the entry is an alias.
- *
- * @memberOf Entry
- * @returns {Boolean} Returns `false`.
- */
- public function isAlias() {
- return false;
- }
-
- /**
- * Checks if the entry is a constructor.
- *
- * @memberOf Entry
- * @returns {Boolean} Returns `true` if a constructor, else `false`.
- */
- public function isCtor() {
- if (!isset($this->_isCtor)) {
- $this->_isCtor = !!preg_match('/\*[\t ]*@constructor\b/', $this->entry);
- }
- return $this->_isCtor;
- }
-
- /**
- * Checks if the entry is a license.
- *
- * @memberOf Entry
- * @returns {Boolean} Returns `true` if a license, else `false`.
- */
- public function isLicense() {
- if (!isset($this->_isLicense)) {
- $this->_isLicense = !!preg_match('/\*[\t ]*@license\b/', $this->entry);
- }
- return $this->_isLicense;
- }
-
- /**
- * Checks if the entry *is* assigned to a prototype.
- *
- * @memberOf Entry
- * @returns {Boolean} Returns `true` if assigned to a prototype, else `false`.
- */
- public function isPlugin() {
- if (!isset($this->_isPlugin)) {
- $this->_isPlugin = !$this->isCtor() && !$this->isPrivate() && !$this->isStatic();
- }
- return $this->_isPlugin;
- }
-
- /**
- * Checks if the entry is private.
- *
- * @memberOf Entry
- * @returns {Boolean} Returns `true` if private, else `false`.
- */
- public function isPrivate() {
- if (!isset($this->_isPrivate)) {
- $this->_isPrivate = $this->isLicense() || !!preg_match('/\*[\t ]*@private\b/', $this->entry) || !preg_match('/\*[\t ]*@[a-z]+\b/', $this->entry);
- }
- return $this->_isPrivate;
- }
-
- /**
- * Checks if the entry is *not* assigned to a prototype.
- *
- * @memberOf Entry
- * @returns {Boolean} Returns `true` if not assigned to a prototype, else `false`.
- */
- public function isStatic() {
- if (isset($this->_isStatic)) {
- return $this->_isStatic;
- }
-
- $public = !$this->isPrivate();
- $result = $public && !!preg_match('/\*[\t ]*@static\b/', $this->entry);
-
- // set in cases where it isn't explicitly stated
- if ($public && !$result) {
- if ($parent = array_pop(preg_split('/[#.]/', $this->getMembers(0)))) {
- foreach (Entry::getEntries($this->source) as $entry) {
- $entry = new Entry($entry, $this->source);
- if ($entry->getName() == $parent) {
- $result = !$entry->isCtor();
- break;
- }
- }
- } else {
- $result = true;
- }
- }
- $this->_isStatic = $result;
- return $result;
- }
-
- /**
- * Resolves the entry's line number.
- *
- * @memberOf Entry
- * @returns {Number} The entry's line number.
- */
- public function getLineNumber() {
- if (!isset($this->_lineNumber)) {
- preg_match_all('/\n/', substr($this->source, 0, strrpos($this->source, $this->entry) + strlen($this->entry)), $lines);
- $this->_lineNumber = count(array_pop($lines)) + 1;
- }
- return $this->_lineNumber;
- }
-
- /**
- * Extracts the entry's `member` data.
- *
- * @memberOf Entry
- * @param {Number} $index The index of the array value to return.
- * @returns {Array|String} The entry's `member` data.
- */
- public function getMembers( $index = null ) {
- if (!isset($this->_members)) {
- preg_match('#\*[\t ]*@member(?:Of)?\s+(.+)#', $this->entry, $result);
- if (count($result)) {
- $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]));
- $result = preg_split('/,\s*/', $result);
- natsort($result);
- }
- $this->_members = $result;
- }
- return $index !== null
- ? @$this->_members[$index]
- : $this->_members;
- }
-
- /**
- * Extracts the entry's `name` data.
- *
- * @memberOf Entry
- * @returns {String} The entry's `name` data.
- */
- public function getName() {
- if (isset($this->_name)) {
- return $this->_name;
- }
-
- preg_match('#\*[\t ]*@name\s+(.+)#', $this->entry, $result);
- if (count($result)) {
- $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]));
- } else {
- $result = array_shift(explode('(', $this->getCall()));
- }
- $this->_name = $result;
- return $result;
- }
-
- /**
- * Extracts the entry's `param` data.
- *
- * @memberOf Entry
- * @param {Number} $index The index of the array value to return.
- * @returns {Array} The entry's `param` data.
- */
- public function getParams( $index = null ) {
- if (!isset($this->_params)) {
- preg_match_all('#\*[\t ]*@param\s+\{([^}]+)\}\s+(\[.+\]|[$\w|]+(?:\[.+\])?)\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#i', $this->entry, $result);
- if (count($result = array_filter(array_slice($result, 1)))) {
- // repurpose array
- foreach ($result as $param) {
- foreach ($param as $key => $value) {
- if (!is_array($result[0][$key])) {
- $result[0][$key] = array();
- }
- $result[0][$key][] = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]*/', ' ', $value));
- }
- }
- $result = $result[0];
- }
- $this->_params = $result;
- }
- return $index !== null
- ? @$this->_params[$index]
- : $this->_params;
- }
-
- /**
- * Extracts the entry's `returns` data.
- *
- * @memberOf Entry
- * @returns {String} The entry's `returns` data.
- */
- public function getReturns() {
- if (isset($this->_returns)) {
- return $this->_returns;
- }
-
- preg_match('#\*[\t ]*@returns\s+\{([^}]+)\}\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#', $this->entry, $result);
- if (count($result)) {
- $result = array_map('trim', array_slice($result, 1));
- $result[0] = str_replace('|', ', ', $result[0]);
- $result[1] = preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]);
- }
- $this->_returns = $result;
- return $result;
- }
-
- /**
- * Extracts the entry's `type` data.
- *
- * @memberOf Entry
- * @returns {String} The entry's `type` data.
- */
- public function getType() {
- if (isset($this->_type)) {
- return $this->_type;
- }
-
- preg_match('#\*[\t ]*@type\s+(.+)#', $this->entry, $result);
- if (count($result)) {
- $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]));
- } else {
- $result = $this->isFunction() ? 'Function' : 'Unknown';
- }
- $this->_type = $result;
- return $result;
- }
-}
-?>
\ No newline at end of file
+++ /dev/null
-<?php
-
-require(dirname(__FILE__) . "/Entry.php");
-
-/**
- * Generates Markdown from JSDoc entries.
- */
-class Generator {
-
- /**
- * The HTML for the close tag.
- *
- * @static
- * @memberOf Generator
- * @type String
- */
- public $closeTag = "\n<!-- /div -->\n";
-
- /**
- * An array of JSDoc entries.
- *
- * @memberOf Generator
- * @type Array
- */
- public $entries = array();
-
- /**
- * The HTML for the open tag.
- *
- * @static
- * @memberOf Generator
- * @type String
- */
- public $openTag = "\n<!-- div -->\n";
-
- /**
- * An options array used to configure the generator.
- *
- * @memberOf Generator
- * @type Array
- */
- public $options = array();
-
- /**
- * The file's source code.
- *
- * @memberOf Generator
- * @type String
- */
- public $source = '';
-
- /*--------------------------------------------------------------------------*/
-
- /**
- * The Generator constructor.
- *
- * @constructor
- * @param {String} $source The source code to parse.
- * @param {Array} $options The options array.
- */
- public function __construct( $source, $options = array() ) {
- // juggle arguments
- if (is_array($source)) {
- $options = $source;
- } else {
- $options['source'] = $source;
- }
- if (isset($options['source']) && realpath($options['source'])) {
- $options['path'] = $options['source'];
- }
- if (isset($options['path'])) {
- preg_match('/(?<=\.)[a-z]+$/', $options['path'], $ext);
- $options['source'] = file_get_contents($options['path']);
- $ext = array_pop($ext);
-
- if (!isset($options['lang']) && $ext) {
- $options['lang'] = $ext;
- }
- if (!isset($options['title'])) {
- $options['title'] = ucfirst(basename($options['path'])) . ' API documentation';
- }
- }
- if (!isset($options['lang'])) {
- $options['lang'] = 'js';
- }
- if (!isset($options['toc'])) {
- $options['toc'] = 'properties';
- }
-
- $this->options = $options;
- $this->source = str_replace(PHP_EOL, "\n", $options['source']);
- $this->entries = Entry::getEntries($this->source);
-
- foreach ($this->entries as $index => $value) {
- $this->entries[$index] = new Entry($value, $this->source, $options['lang']);
- }
- }
-
- /*--------------------------------------------------------------------------*/
-
- /**
- * Performs common string formatting operations.
- *
- * @private
- * @static
- * @memberOf Generator
- * @param {String} $string The string to format.
- * @returns {String} The formatted string.
- */
- private static function format( $string ) {
- $counter = 0;
-
- // tokenize inline code snippets
- preg_match_all('/`[^`]+`/', $string, $tokenized);
- $tokenized = $tokenized[0];
- foreach ($tokenized as $snippet) {
- $string = str_replace($snippet, '__token' . ($counter++) .'__', $string);
- }
-
- // italicize parentheses
- $string = preg_replace('/(^|\s)(\([^)]+\))/', '$1*$2*', $string);
-
- // mark numbers as inline code
- $string = preg_replace('/[\t ](-?\d+(?:.\d+)?)(?!\.[^\n])/', ' `$1`', $string);
-
- // detokenize inline code snippets
- $counter = 0;
- foreach ($tokenized as $snippet) {
- $string = str_replace('__token' . ($counter++) . '__', $snippet, $string);
- }
-
- return trim($string);
- }
-
- /**
- * Modify a string by replacing named tokens with matching assoc. array values.
- *
- * @private
- * @static
- * @memberOf Generator
- * @param {String} $string The string to modify.
- * @param {Array|Object} $object The template object.
- * @returns {String} The modified string.
- */
- private static function interpolate( $string, $object ) {
- preg_match_all('/#\{([^}]+)\}/', $string, $tokens);
- $tokens = array_unique(array_pop($tokens));
-
- foreach ($tokens as $token) {
- $pattern = '/#\{' . $token . '\}/';
- $replacement = '';
-
- if (is_object($object)) {
- preg_match('/\(([^)]+?)\)$/', $token, $args);
- $args = preg_split('/,\s*/', array_pop($args));
- $method = 'get' . ucfirst(str_replace('/\([^)]+?\)$/', '', $token));
-
- if (method_exists($object, $method)) {
- $replacement = (string) call_user_func_array(array($object, $method), $args);
- } else if (isset($object->{$token})) {
- $replacement = (string) $object->{$token};
- }
- } else if (isset($object[$token])) {
- $replacement = (string) $object[$token];
- }
- $string = preg_replace($pattern, trim($replacement), $string);
- }
- return Generator::format($string);
- }
-
- /*--------------------------------------------------------------------------*/
-
- /**
- * Adds the given `$entries` to the `$result` array.
- *
- * @private
- * @memberOf Generator
- * @param {Array} $result The result array to modify.
- * @param {Array} $entries The entries to add to the `$result`.
- */
- private function addEntries( &$result, $entries ) {
- foreach ($entries as $entry) {
- // skip aliases
- if ($entry->isAlias()) {
- continue;
- }
- // name and description
- array_push(
- $result,
- $this->openTag,
- Generator::interpolate("### <a id=\"#{hash}\"></a>`#{member}#{separator}#{call}`\n<a href=\"##{hash}\">#</a> [Ⓢ](#{href} \"View in source\") [Ⓣ][1]\n\n#{desc}", $entry)
- );
-
- // @alias
- if (count($aliases = $entry->getAliases())) {
- array_push($result, '', '#### Aliases');
- foreach ($aliases as $index => $alias) {
- $aliases[$index] = $alias->getName();
- }
- $result[] = '*' . implode(', ', $aliases) . '*';
- }
- // @param
- if (count($params = $entry->getParams())) {
- array_push($result, '', '#### Arguments');
- foreach ($params as $index => $param) {
- $result[] = Generator::interpolate('#{num}. `#{name}` (#{type}): #{desc}', array(
- 'desc' => $param[2],
- 'name' => $param[1],
- 'num' => $index + 1,
- 'type' => $param[0]
- ));
- }
- }
- // @returns
- if (count($returns = $entry->getReturns())) {
- array_push(
- $result, '',
- '#### Returns',
- Generator::interpolate('(#{type}): #{desc}', array('desc' => $returns[1], 'type' => $returns[0]))
- );
- }
- // @example
- if ($example = $entry->getExample()) {
- array_push($result, '', '#### Example', $example);
- }
- array_push($result, "\n* * *", $this->closeTag);
- }
- }
-
- /**
- * Resolves the entry's hash used to navigate the documentation.
- *
- * @private
- * @memberOf Generator
- * @param {Number|Object} $entry The entry object.
- * @param {String} $member The name of the member.
- * @returns {String} The url hash.
- */
- private function getHash( $entry, $member = '' ) {
- $entry = is_numeric($entry) ? $this->entries[$entry] : $entry;
- $member = !$member ? $entry->getMembers(0) : $member;
- $result = ($member ? $member . ($entry->isPlugin() ? 'prototype' : '') : '') . $entry->getCall();
- $result = preg_replace('/\(\[|\[\]/', '', $result);
- $result = preg_replace('/[ =|\'"{}.()\]]/', '', $result);
- $result = preg_replace('/[[#,]/', '-', $result);
- return strtolower($result);
- }
-
- /**
- * Resolves the entry's url for the specific line number.
- *
- * @private
- * @memberOf Generator
- * @param {Number|Object} $entry The entry object.
- * @returns {String} The url.
- */
- private function getLineUrl( $entry ) {
- $entry = is_numeric($entry) ? $this->entries($entry) : $entry;
- return $this->options['url'] . '#L' . $entry->getLineNumber();
- }
-
- /**
- * Extracts the character used to separate the entry's name from its member.
- *
- * @private
- * @memberOf Generator
- * @param {Number|Object} $entry The entry object.
- * @returns {String} The separator.
- */
- private function getSeparator( $entry ) {
- $entry = is_numeric($entry) ? $this->entries($entry) : $entry;
- return $entry->isPlugin() ? '.prototype.' : '.';
- }
-
- /*--------------------------------------------------------------------------*/
-
- /**
- * Generates Markdown from JSDoc entries.
- *
- * @memberOf Generator
- * @returns {String} The rendered Markdown.
- */
- public function generate() {
- $api = array();
- $byCategory = $this->options['toc'] == 'categories';
- $categories = array();
- $closeTag = $this->closeTag;
- $compiling = false;
- $openTag = $this->openTag;
- $result = array('# ' . $this->options['title']);
- $toc = 'toc';
-
- // initialize $api array
- foreach ($this->entries as $entry) {
- // skip invalid or private entries
- $name = $entry->getName();
- if (!$name || $entry->isPrivate()) {
- continue;
- }
-
- $members = $entry->getMembers();
- $members = count($members) ? $members : array('');
-
- foreach ($members as $member) {
- // create api category arrays
- if ($member && !isset($api[$member])) {
- // create temporary entry to be replaced later
- $api[$member] = new stdClass;
- $api[$member]->static = array();
- $api[$member]->plugin = array();
- }
-
- // append entry to api member
- if (!$member || $entry->isCtor() || ($entry->getType() == 'Object' &&
- !preg_match('/[=:]\s*(?:null|undefined)\s*[,;]?$/', $entry->entry))) {
-
- // assign the real entry, replacing the temporary entry if it exist
- $member = ($member ? $member . ($entry->isPlugin() ? '#' : '.') : '') . $name;
- $entry->static = @$api[$member] ? $api[$member]->static : array();
- $entry->plugin = @$api[$member] ? $api[$member]->plugin : array();
-
- $api[$member] = $entry;
- foreach ($entry->getAliases() as $alias) {
- $api[$member]->static[] = $alias;
- }
- }
- else if ($entry->isStatic()) {
- $api[$member]->static[] = $entry;
- foreach ($entry->getAliases() as $alias) {
- $api[$member]->static[] = $alias;
- }
- }
- else if (!$entry->isCtor()) {
- $api[$member]->plugin[] = $entry;
- foreach ($entry->getAliases() as $alias) {
- $api[$member]->plugin[] = $alias;
- }
- }
- }
- }
-
- // add properties to each entry
- foreach ($api as $entry) {
- $entry->hash = $this->getHash($entry);
- $entry->href = $this->getLineUrl($entry);
-
- $member = $entry->getMembers(0);
- $member = ($member ? $member . ($entry->isPlugin() ? '.prototype.' : '.') : '') . $entry->getName();
- $entry->member = preg_replace('/' . $entry->getName() . '$/', '', $member);
-
- // add properties to static and plugin sub-entries
- foreach (array('static', 'plugin') as $kind) {
- foreach ($entry->{$kind} as $subentry) {
- $subentry->hash = $this->getHash($subentry);
- $subentry->href = $this->getLineUrl($subentry);
- $subentry->member = $member;
- $subentry->separator = $this->getSeparator($subentry);
- }
- }
- }
-
- /*------------------------------------------------------------------------*/
-
- // custom sort for root level entries
- // TODO: see how well it handles deeper namespace traversal
- function sortCompare($a, $b) {
- $score = array( 'a' => 0, 'b' => 0);
- foreach (array( 'a' => $a, 'b' => $b) as $key => $value) {
- // capitalized properties are last
- if (preg_match('/[#.][A-Z]/', $value)) {
- $score[$key] = 0;
- }
- // lowercase prototype properties are next to last
- else if (preg_match('/#[a-z]/', $value)) {
- $score[$key] = 1;
- }
- // lowercase static properties next to first
- else if (preg_match('/\.[a-z]/', $value)) {
- $score[$key] = 2;
- }
- // root properties are first
- else if (preg_match('/^[^#.]+$/', $value)) {
- $score[$key] = 3;
- }
- }
- $score = $score['b'] - $score['a'];
- return $score ? $score : strcasecmp($a, $b);
- }
-
- uksort($api, 'sortCompare');
-
- // sort static and plugin sub-entries
- foreach ($api as $entry) {
- foreach (array('static', 'plugin') as $kind) {
- $sortBy = array( 'a' => array(), 'b' => array(), 'c' => array() );
- foreach ($entry->{$kind} as $subentry) {
- $name = $subentry->getName();
- // functions w/o ALL-CAPs names are last
- $sortBy['a'][] = $subentry->getType() == 'Function' && !preg_match('/^[A-Z_]+$/', $name);
- // ALL-CAPs properties first
- $sortBy['b'][] = preg_match('/^[A-Z_]+$/', $name);
- // lowercase alphanumeric sort
- $sortBy['c'][] = strtolower($name);
- }
- array_multisort($sortBy['a'], SORT_ASC, $sortBy['b'], SORT_DESC, $sortBy['c'], SORT_ASC, $entry->{$kind});
- }
- }
-
- /*------------------------------------------------------------------------*/
-
- // add categories
- foreach ($api as $entry) {
- $categories[$entry->getCategory()][] = $entry;
- foreach (array('static', 'plugin') as $kind) {
- foreach ($entry->{$kind} as $subentry) {
- $categories[$subentry->getCategory()][] = $subentry;
- }
- }
- }
-
- // sort categories
- ksort($categories);
-
- foreach(array('Methods', 'Properties') as $category) {
- if (isset($categories[$category])) {
- $entries = $categories[$category];
- unset($categories[$category]);
- $categories[$category] = $entries;
- }
- }
-
- /*------------------------------------------------------------------------*/
-
- // compile TOC
- $result[] = $openTag;
-
- // compile TOC by categories
- if ($byCategory) {
- foreach ($categories as $category => $entries) {
- if ($compiling) {
- $result[] = $closeTag;
- } else {
- $compiling = true;
- }
- // assign TOC hash
- if (count($result) == 2) {
- $toc = $category;
- }
- // add category
- array_push(
- $result,
- $openTag, '## ' . (count($result) == 2 ? '<a id="' . $toc . '"></a>' : '') . '`' . $category . '`'
- );
- // add entries
- foreach ($entries as $entry) {
- $result[] = Generator::interpolate('* [`#{member}#{separator}#{name}`](##{hash})', $entry);
- }
- }
- }
- // compile TOC by namespace
- else {
- foreach ($api as $entry) {
- if ($compiling) {
- $result[] = $closeTag;
- } else {
- $compiling = true;
- }
- $member = $entry->member . $entry->getName();
-
- // assign TOC hash
- if (count($result) == 2) {
- $toc = $member;
- }
- // add root entry
- array_push(
- $result,
- $openTag, '## ' . (count($result) == 2 ? '<a id="' . $toc . '"></a>' : '') . '`' . $member . '`',
- Generator::interpolate('* [`' . $member . '`](##{hash})', $entry)
- );
-
- // add static and plugin sub-entries
- foreach (array('static', 'plugin') as $kind) {
- if ($kind == 'plugin' && count($entry->plugin)) {
- array_push(
- $result,
- $closeTag,
- $openTag,
- '## `' . $member . ($entry->isCtor() ? '.prototype`' : '`')
- );
- }
- foreach ($entry->{$kind} as $subentry) {
- $subentry->member = $member;
- $result[] = Generator::interpolate('* [`#{member}#{separator}#{name}`](##{hash})', $subentry);
- }
- }
- }
- }
-
- array_push($result, $closeTag, $closeTag);
-
- /*------------------------------------------------------------------------*/
-
- // compile content
- $compiling = false;
- $result[] = $openTag;
-
- if ($byCategory) {
- foreach ($categories as $category => $entries) {
- if ($compiling) {
- $result[] = $closeTag;
- } else {
- $compiling = true;
- }
- if ($category != 'Methods' && $category != 'Properties') {
- $category = '“' . $category . '” Methods';
- }
- array_push($result, $openTag, '## `' . $category . '`');
- $this->addEntries($result, $entries);
- }
- }
- else {
- foreach ($api as $entry) {
- // skip aliases
- if ($entry->isAlias()) {
- continue;
- }
- if ($compiling) {
- $result[] = $closeTag;
- } else {
- $compiling = true;
- }
- // add root entry name
- $member = $entry->member . $entry->getName();
- array_push($result, $openTag, '## `' . $member . '`');
-
- foreach (array($entry, 'static', 'plugin') as $kind) {
- $subentries = is_string($kind) ? $entry->{$kind} : array($kind);
-
- // add sub-entry name
- if ($kind != 'static' && $entry->getType() != 'Object' &&
- count($subentries) && $subentries[0] != $kind) {
- if ($kind == 'plugin') {
- $result[] = $closeTag;
- }
- array_push(
- $result,
- $openTag,
- '## `' . $member . ($kind == 'plugin' ? '.prototype`' : '`')
- );
- }
- $this->addEntries($result, $subentries);
- }
- }
- }
-
- // close tags add TOC link reference
- array_push($result, $closeTag, $closeTag, '', ' [1]: #' . $toc . ' "Jump back to the TOC."');
-
- // cleanup whitespace
- return trim(preg_replace('/[\t ]+\n/', "\n", join($result, "\n")));
- }
-}
-?>
{
"author": {
- "name": "Jeremy Stashewsky",
- "email": "jeremy@goinstant.com",
- "url": "https://github.com/stash"
+ "name": "GoInstant Inc., a salesforce.com company"
},
+ "license": "MIT",
"name": "tough-cookie",
"description": "RFC6265 Cookies and Cookie Jar for node.js",
"keywords": [
"RFC6265",
"RFC2965"
],
- "version": "0.9.15",
- "homepage": "https://github.com/goinstant/node-cookie",
+ "version": "0.12.1",
+ "homepage": "https://github.com/goinstant/tough-cookie",
"repository": {
"type": "git",
- "url": "git://github.com/goinstant/node-cookie.git"
+ "url": "git://github.com/goinstant/tough-cookie.git"
},
"bugs": {
- "url": "https://github.com/goinstant/node-cookie/issues"
+ "url": "https://github.com/goinstant/tough-cookie/issues"
},
"main": "./lib/cookie",
"scripts": {
"punycode": ">=0.2.0"
},
"devDependencies": {
- "vows": ">=0.6.0",
+ "vows": "0.7.0",
"async": ">=0.1.12"
},
- "readme": "[RFC6265](http://tools.ietf.org/html/rfc6265) Cookies and CookieJar for Node.js\n\n![Tough Cookie](http://www.goinstant.com.s3.amazonaws.com/tough-cookie.jpg)\n\n# Synopsis\n\n``` javascript\nvar cookies = require('tough-cookie'); // note: not 'cookie', 'cookies' or 'node-cookie'\nvar Cookie = cookies.Cookie;\nvar cookie = Cookie.parse(header);\ncookie.value = 'somethingdifferent';\nheader = cookie.toString();\n\nvar cookiejar = new cookies.CookieJar();\ncookiejar.setCookie(cookie, 'http://currentdomain.example.com/path', cb);\n// ...\ncookiejar.getCookies('http://example.com/otherpath',function(err,cookies) {\n res.headers['cookie'] = cookies.join('; ');\n});\n```\n\n# Installation\n\nIt's _so_ easy!\n\n`npm install tough-cookie`\n\nRequires `punycode`, which should get installed automatically for you. Note that node.js v0.6.2+ bundles punycode by default.\n\nWhy the name? NPM modules `cookie`, `cookies` and `cookiejar` were already taken.\n\n# API\n\ncookies\n=======\n\nFunctions on the module you get from `require('tough-cookie')`. All can be used as pure functions and don't need to be \"bound\".\n\nparseDate(string[,strict])\n-----------------\n\nParse a cookie date string into a `Date`. Parses according to RFC6265 Section 5.1.1, not `Date.parse()`. If strict is set to true then leading/trailing non-seperator characters around the time part will cause the parsing to fail (e.g. \"Thu, 01 Jan 1970 00:00:010 GMT\" has an extra trailing zero but Chrome, an assumedly RFC-compliant browser, treats this as valid).\n\nformatDate(date)\n----------------\n\nFormat a Date into a RFC1123 string (the RFC6265-recommended format).\n\ncanonicalDomain(str)\n--------------------\n\nTransforms a domain-name into a canonical domain-name. The canonical domain-name is a trimmed, lowercased, stripped-of-leading-dot and optionally punycode-encoded domain-name (Section 5.1.2 of RFC6265). For the most part, this function is idempotent (can be run again on its output without ill effects).\n\ndomainMatch(str,domStr[,canonicalize=true])\n-------------------------------------------\n\nAnswers \"does this real domain match the domain in a cookie?\". The `str` is the \"current\" domain-name and the `domStr` is the \"cookie\" domain-name. Matches according to RFC6265 Section 5.1.3, but it helps to think of it as a \"suffix match\".\n\nThe `canonicalize` parameter will run the other two paramters through `canonicalDomain` or not.\n\ndefaultPath(path)\n-----------------\n\nGiven a current request/response path, gives the Path apropriate for storing in a cookie. This is basically the \"directory\" of a \"file\" in the path, but is specified by Section 5.1.4 of the RFC.\n\nThe `path` parameter MUST be _only_ the pathname part of a URI (i.e. excludes the hostname, query, fragment, etc.). This is the `.pathname` property of node's `uri.parse()` output.\n\npathMatch(reqPath,cookiePath)\n-----------------------------\n\nAnswers \"does the request-path path-match a given cookie-path?\" as per RFC6265 Section 5.1.4. Returns a boolean.\n\nThis is essentially a prefix-match where `cookiePath` is a prefix of `reqPath`.\n\nparse(header[,strict=false])\n----------------------------\n\nalias for `Cookie.parse(header[,strict])`\n\nfromJSON(string)\n----------------\n\nalias for `Cookie.fromJSON(string)`\n\ngetPublicSuffix(hostname)\n-------------------------\n\nReturns the public suffix of this hostname. The public suffix is the shortest domain-name upon which a cookie can be set. Returns `null` if the hostname cannot have cookies set for it.\n\nFor example: `www.example.com` and `www.subdomain.example.com` both have public suffix `example.com`.\n\nFor further information, see http://publicsuffix.org/. This module derives its list from that site.\n\ncookieCompare(a,b)\n------------------\n\nFor use with `.sort()`, sorts a list of cookies into the recommended order given in the RFC (Section 5.4 step 2). Longest `.path`s go first, then sorted oldest to youngest.\n\n``` javascript\nvar cookies = [ /* unsorted array of Cookie objects */ ];\ncookies = cookies.sort(cookieCompare);\n```\n\npermuteDomain(domain)\n---------------------\n\nGenerates a list of all possible domains that `domainMatch()` the parameter. May be handy for implementing cookie stores.\n\n\npermutePath(path)\n-----------------\n\nGenerates a list of all possible paths that `pathMatch()` the parameter. May be handy for implementing cookie stores.\n\nCookie\n======\n\nCookie.parse(header[,strict=false])\n-----------------------------------\n\nParses a single Cookie or Set-Cookie HTTP header into a `Cookie` object. Returns `undefined` if the string can't be parsed. If in strict mode, returns `undefined` if the cookie doesn't follow the guidelines in section 4 of RFC6265. Generally speaking, strict mode can be used to validate your own generated Set-Cookie headers, but acting as a client you want to be lenient and leave strict mode off.\n\nHere's how to process the Set-Cookie header(s) on a node HTTP/HTTPS response:\n\n``` javascript\nif (res.headers['set-cookie'] instanceof Array)\n cookies = res.headers['set-cookie'].map(Cookie.parse);\nelse\n cookies = [Cookie.parse(res.headers['set-cookie'])];\n```\n\nCookie.fromJSON(string)\n-----------------------\n\nConvert a JSON string to a `Cookie` object. Does a `JSON.parse()` and converts the `.created`, `.lastAccessed` and `.expires` properties into `Date` objects.\n\nProperties\n==========\n\n * _key_ - string - the name or key of the cookie (default \"\")\n * _value_ - string - the value of the cookie (default \"\")\n * _expires_ - `Date` - if set, the `Expires=` attribute of the cookie (defaults to the string `\"Infinity\"`). See `setExpires()`\n * _maxAge_ - seconds - if set, the `Max-Age=` attribute _in seconds_ of the cookie. May also be set to strings `\"Infinity\"` and `\"-Infinity\"` for non-expiry and immediate-expiry, respectively. See `setMaxAge()`\n * _domain_ - string - the `Domain=` attribute of the cookie\n * _path_ - string - the `Path=` of the cookie\n * _secure_ - boolean - the `Secure` cookie flag\n * _httpOnly_ - boolean - the `HttpOnly` cookie flag\n * _extensions_ - `Array` - any unrecognized cookie attributes as strings (even if equal-signs inside)\n \nAfter a cookie has been passed through `CookieJar.setCookie()` it will have the following additional attributes:\n\n * _hostOnly_ - boolean - is this a host-only cookie (i.e. no Domain field was set, but was instead implied)\n * _pathIsDefault_ - boolean - if true, there was no Path field on the cookie and `defaultPath()` was used to derive one.\n * _created_ - `Date` - when this cookie was added to the jar\n * _lastAccessed_ - `Date` - last time the cookie got accessed. Will affect cookie cleaning once implemented. Using `cookiejar.getCookies(...)` will update this attribute.\n\nConstruction([{options}])\n------------\n\nReceives an options object that can contain any Cookie properties, uses the default for unspecified properties.\n\n.toString()\n-----------\n\nencode to a Set-Cookie header value. The Expires cookie field is set using `formatDate()`, but is omitted entirely if `.expires` is `Infinity`.\n\n.cookieString()\n---------------\n\nencode to a Cookie header value (i.e. the `.key` and `.value` properties joined with '=').\n\n.setExpires(String)\n-------------------\n\nsets the expiry based on a date-string passed through `parseDate()`. If parseDate returns `null` (i.e. can't parse this date string), `.expires` is set to `\"Infinity\"` (a string) is set.\n\n.setMaxAge(number)\n-------------------\n\nsets the maxAge in seconds. Coerces `-Infinity` to `\"-Infinity\"` and `Infinity` to `\"Infinity\"` so it JSON serializes correctly.\n\n.expiryTime([now=Date.now()])\n-----------------------------\n\n.expiryDate([now=Date.now()])\n-----------------------------\n\nexpiryTime() Computes the absolute unix-epoch milliseconds that this cookie expires. expiryDate() works similarly, except it returns a `Date` object. Note that in both cases the `now` parameter should be milliseconds.\n\nMax-Age takes precedence over Expires (as per the RFC). The `.created` attribute -- or, by default, the `now` paramter -- is used to offset the `.maxAge` attribute.\n\nIf Expires (`.expires`) is set, that's returned.\n\nOtherwise, `expiryTime()` returns `Infinity` and `expiryDate()` returns a `Date` object for \"Tue, 19 Jan 2038 03:14:07 GMT\" (latest date that can be expressed by a 32-bit `time_t`; the common limit for most user-agents).\n\n.TTL([now=Date.now()])\n---------\n\ncompute the TTL relative to `now` (milliseconds). The same precedence rules as for `expiryTime`/`expiryDate` apply.\n\nThe \"number\" `Infinity` is returned for cookies without an explicit expiry and `0` is returned if the cookie is expired. Otherwise a time-to-live in milliseconds is returned.\n\n.canonicalizedDoman()\n---------------------\n\n.cdomain()\n----------\n\nreturn the canonicalized `.domain` field. This is lower-cased and punycode (RFC3490) encoded if the domain has any non-ASCII characters.\n\n.validate()\n-----------\n\nStatus: *IN PROGRESS*. Works for a few things, but is by no means comprehensive.\n\nvalidates cookie attributes for semantic correctness. Useful for \"lint\" checking any Set-Cookie headers you generate. For now, it returns a boolean, but eventually could return a reason string -- you can future-proof with this construct:\n\n``` javascript\nif (cookie.validate() === true) {\n // it's tasty\n} else {\n // yuck!\n}\n```\n\nCookieJar\n=========\n\nConstruction([store = new MemoryCookieStore()][, rejectPublicSuffixes])\n------------\n\nSimply use `new CookieJar()`. If you'd like to use a custom store, pass that to the constructor otherwise a `MemoryCookieStore` will be created and used.\n\n\nAttributes\n----------\n\n * _rejectPublicSuffixes_ - boolean - reject cookies with domains like \"com\" and \"co.uk\" (default: `true`)\n \nSince eventually this module would like to support database/remote/etc. CookieJars, continuation passing style is used for CookieJar methods.\n\n.setCookie(cookieOrString, currentUrl, [{options},] cb(err,cookie))\n-------------------------------------------------------------------\n\nAttempt to set the cookie in the cookie jar. If the operation fails, an error will be given to the callback `cb`, otherwise the cookie is passed through. The cookie will have updated `.created`, `.lastAccessed` and `.hostOnly` properties.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.\n * _secure_ - boolean - autodetect from url - indicates if this is a \"Secure\" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.\n * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies\n * _strict_ - boolean - default `false` - perform extra checks\n * _ignoreError_ - boolean - default `false` - silently ignore things like parse errors and invalid domains. CookieStore errors aren't ignored by this option.\n\nAs per the RFC, the `.hostOnly` property is set if there was no \"Domain=\" parameter in the cookie string (or `.domain` was null on the Cookie object). The `.domain` property is set to the fully-qualified hostname of `currentUrl` in this case. Matching this cookie requires an exact hostname match (not a `domainMatch` as per usual).\n\n.storeCookie(cookie, [{options},] cb(err,cookie))\n-------------------------------------------------\n\n__REMOVED__ removed in lieu of the CookieStore API below\n \n.getCookies(currentUrl, [{options},] cb(err,cookies))\n-----------------------------------------------------\n\nRetrieve the list of cookies that can be sent in a Cookie header for the current url.\n\nIf an error is encountered, that's passed as `err` to the callback, otherwise an `Array` of `Cookie` objects is passed. The array is sorted with `cookieCompare()` unless the `{sort:false}` option is given.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.\n * _secure_ - boolean - autodetect from url - indicates if this is a \"Secure\" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.\n * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies\n * _expire_ - boolean - default `true` - perform expiry-time checking of cookies and asynchronously remove expired cookies from the store. Using `false` will return expired cookies and **not** remove them from the store (which is useful for replaying Set-Cookie headers, potentially).\n * _allPaths_ - boolean - default `false` - if `true`, do not scope cookies by path. The default uses RFC-compliant path scoping. **Note**: may not be supported by the CookieStore `fetchCookies` function (the default MemoryCookieStore supports it).\n\nThe `.lastAccessed` property of the returned cookies will have been updated.\n\n.getCookieString(...)\n---------------------\n\nAccepts the same options as `.getCookies()` but passes a string suitable for a Cookie header rather than an array to the callback. Simply maps the `Cookie` array via `.cookieString()`.\n\n.getSetCookieStrings(...)\n-------------------------\n\nAccepts the same options as `.getCookies()` but passes an array of strings suitable for Set-Cookie headers (rather than an array of `Cookie`s) to the callback. Simply maps the cookie array via `.toString()`.\n\n# CookieStore API\n\nThe storage model for each `CookieJar` instance can be replaced with a custom implementation. The default is `MemoryCookieStore` which can be found in the `lib/memstore.js` file. The API uses continuation-passing-style to allow for asynchronous stores.\n\nAll `domain` parameters will have been normalized before calling.\n\nThe Cookie store must have all of the following methods.\n\nstore.findCookie(domain, path, key, cb(err,cookie))\n---------------------------------------------------\n\nRetrieve a cookie with the given domain, path and key (a.k.a. name). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest/newest such cookie should be returned.\n\nCallback takes an error and the resulting `Cookie` object. If no cookie is found then `null` MUST be passed instead (i.e. not an error).\n\nstore.findCookies(domain, path, cb(err,cookies))\n------------------------------------------------\n\nLocates cookies matching the given domain and path. This is most often called in the context of `cookiejar.getCookies()` above.\n\nIf no cookies are found, the callback MUST be passed an empty array.\n\nThe resulting list will be checked for applicability to the current request according to the RFC (domain-match, path-match, http-only-flag, secure-flag, expiry, etc.), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that `domainMatch()` the domain and `pathMatch()` the path in order to limit the amount of checking that needs to be done.\n\nAs of version 0.9.12, the `allPaths` option to `cookiejar.getCookies()` above will cause the path here to be `null`. If the path is `null`, path-matching MUST NOT be performed (i.e. domain-matching only).\n\nstore.putCookie(cookie, cb(err))\n--------------------------------\n\nAdds a new cookie to the store. The implementation SHOULD replace any existing cookie with the same `.domain`, `.path`, and `.key` properties -- depending on the nature of the implementation, it's possible that between the call to `fetchCookie` and `putCookie` that a duplicate `putCookie` can occur.\n\nThe `cookie` object MUST NOT be modified; the caller will have already updated the `.creation` and `.lastAccessed` properties.\n\nPass an error if the cookie cannot be stored.\n\nstore.updateCookie(oldCookie, newCookie, cb(err))\n-------------------------------------------------\n\nUpdate an existing cookie. The implementation MUST update the `.value` for a cookie with the same `domain`, `.path` and `.key`. The implementation SHOULD check that the old value in the store is equivalent to `oldCookie` - how the conflict is resolved is up to the store.\n\nThe `.lastAccessed` property will always be different between the two objects and `.created` will always be the same. Stores MAY ignore or defer the `.lastAccessed` change at the cost of affecting how cookies are sorted (or selected for deletion).\n\nStores may wish to optimize changing the `.value` of the cookie in the store versus storing a new cookie. If the implementation doesn't define this method a stub that calls `putCookie(newCookie,cb)` will be added to the store object.\n\nThe `newCookie` and `oldCookie` objects MUST NOT be modified.\n\nPass an error if the newCookie cannot be stored.\n\nstore.removeCookie(domain, path, key, cb(err))\n----------------------------------------------\n\nRemove a cookie from the store (see notes on `findCookie` about the uniqueness constraint).\n\nThe implementation MUST NOT pass an error if the cookie doesn't exist; only pass an error due to the failure to remove an existing cookie.\n\nstore.removeCookies(domain, path, cb(err))\n------------------------------------------\n\nRemoves matching cookies from the store. The `path` paramter is optional, and if missing means all paths in a domain should be removed.\n\nPass an error ONLY if removing any existing cookies failed.\n\n# TODO\n\n * _full_ RFC5890/RFC5891 canonicalization for domains in `cdomain()`\n * the optional `punycode` requirement implements RFC3492, but RFC6265 requires RFC5891\n * better tests for `validate()`?\n\n# Copyright and License\n\n(tl;dr: MIT with some MPL/1.1)\n\nCopyright GoInstant, Inc. and other contributors. All rights reserved.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n\nPortions may be licensed under different licenses (in particular public-suffix.txt is MPL/1.1); please read the LICENSE file for full details.\n",
+ "readme": "[RFC6265](http://tools.ietf.org/html/rfc6265) Cookies and CookieJar for Node.js\n\n![Tough Cookie](http://www.goinstant.com.s3.amazonaws.com/tough-cookie.jpg)\n\n[![Build Status](https://travis-ci.org/goinstant/node-cookie.png?branch=master)](https://travis-ci.org/goinstant/node-cookie)\n\n[![NPM Stats](https://nodei.co/npm/tough-cookie.png?downloads=true&stars=true)](https://npmjs.org/package/tough-cookie)\n![NPM Downloads](https://nodei.co/npm-dl/tough-cookie.png?months=9)\n\n# Synopsis\n\n``` javascript\nvar tough = require('tough-cookie'); // note: not 'cookie', 'cookies' or 'node-cookie'\nvar Cookie = tough.Cookie;\nvar cookie = Cookie.parse(header);\ncookie.value = 'somethingdifferent';\nheader = cookie.toString();\n\nvar cookiejar = new tough.CookieJar();\ncookiejar.setCookie(cookie, 'http://currentdomain.example.com/path', cb);\n// ...\ncookiejar.getCookies('http://example.com/otherpath',function(err,cookies) {\n res.headers['cookie'] = cookies.join('; ');\n});\n```\n\n# Installation\n\nIt's _so_ easy!\n\n`npm install tough-cookie`\n\nRequires `punycode`, which should get installed automatically for you. Note that node.js v0.6.2+ bundles punycode by default.\n\nWhy the name? NPM modules `cookie`, `cookies` and `cookiejar` were already taken.\n\n# API\n\ntough\n=====\n\nFunctions on the module you get from `require('tough-cookie')`. All can be used as pure functions and don't need to be \"bound\".\n\nparseDate(string[,strict])\n-----------------\n\nParse a cookie date string into a `Date`. Parses according to RFC6265 Section 5.1.1, not `Date.parse()`. If strict is set to true then leading/trailing non-seperator characters around the time part will cause the parsing to fail (e.g. \"Thu, 01 Jan 1970 00:00:010 GMT\" has an extra trailing zero but Chrome, an assumedly RFC-compliant browser, treats this as valid).\n\nformatDate(date)\n----------------\n\nFormat a Date into a RFC1123 string (the RFC6265-recommended format).\n\ncanonicalDomain(str)\n--------------------\n\nTransforms a domain-name into a canonical domain-name. The canonical domain-name is a trimmed, lowercased, stripped-of-leading-dot and optionally punycode-encoded domain-name (Section 5.1.2 of RFC6265). For the most part, this function is idempotent (can be run again on its output without ill effects).\n\ndomainMatch(str,domStr[,canonicalize=true])\n-------------------------------------------\n\nAnswers \"does this real domain match the domain in a cookie?\". The `str` is the \"current\" domain-name and the `domStr` is the \"cookie\" domain-name. Matches according to RFC6265 Section 5.1.3, but it helps to think of it as a \"suffix match\".\n\nThe `canonicalize` parameter will run the other two paramters through `canonicalDomain` or not.\n\ndefaultPath(path)\n-----------------\n\nGiven a current request/response path, gives the Path apropriate for storing in a cookie. This is basically the \"directory\" of a \"file\" in the path, but is specified by Section 5.1.4 of the RFC.\n\nThe `path` parameter MUST be _only_ the pathname part of a URI (i.e. excludes the hostname, query, fragment, etc.). This is the `.pathname` property of node's `uri.parse()` output.\n\npathMatch(reqPath,cookiePath)\n-----------------------------\n\nAnswers \"does the request-path path-match a given cookie-path?\" as per RFC6265 Section 5.1.4. Returns a boolean.\n\nThis is essentially a prefix-match where `cookiePath` is a prefix of `reqPath`.\n\nparse(header[,strict=false])\n----------------------------\n\nalias for `Cookie.parse(header[,strict])`\n\nfromJSON(string)\n----------------\n\nalias for `Cookie.fromJSON(string)`\n\ngetPublicSuffix(hostname)\n-------------------------\n\nReturns the public suffix of this hostname. The public suffix is the shortest domain-name upon which a cookie can be set. Returns `null` if the hostname cannot have cookies set for it.\n\nFor example: `www.example.com` and `www.subdomain.example.com` both have public suffix `example.com`.\n\nFor further information, see http://publicsuffix.org/. This module derives its list from that site.\n\ncookieCompare(a,b)\n------------------\n\nFor use with `.sort()`, sorts a list of cookies into the recommended order given in the RFC (Section 5.4 step 2). Longest `.path`s go first, then sorted oldest to youngest.\n\n``` javascript\nvar cookies = [ /* unsorted array of Cookie objects */ ];\ncookies = cookies.sort(cookieCompare);\n```\n\npermuteDomain(domain)\n---------------------\n\nGenerates a list of all possible domains that `domainMatch()` the parameter. May be handy for implementing cookie stores.\n\n\npermutePath(path)\n-----------------\n\nGenerates a list of all possible paths that `pathMatch()` the parameter. May be handy for implementing cookie stores.\n\nCookie\n======\n\nCookie.parse(header[,strict=false])\n-----------------------------------\n\nParses a single Cookie or Set-Cookie HTTP header into a `Cookie` object. Returns `undefined` if the string can't be parsed. If in strict mode, returns `undefined` if the cookie doesn't follow the guidelines in section 4 of RFC6265. Generally speaking, strict mode can be used to validate your own generated Set-Cookie headers, but acting as a client you want to be lenient and leave strict mode off.\n\nHere's how to process the Set-Cookie header(s) on a node HTTP/HTTPS response:\n\n``` javascript\nif (res.headers['set-cookie'] instanceof Array)\n cookies = res.headers['set-cookie'].map(function (c) { return (Cookie.parse(c)); });\nelse\n cookies = [Cookie.parse(res.headers['set-cookie'])];\n```\n\nCookie.fromJSON(string)\n-----------------------\n\nConvert a JSON string to a `Cookie` object. Does a `JSON.parse()` and converts the `.created`, `.lastAccessed` and `.expires` properties into `Date` objects.\n\nProperties\n==========\n\n * _key_ - string - the name or key of the cookie (default \"\")\n * _value_ - string - the value of the cookie (default \"\")\n * _expires_ - `Date` - if set, the `Expires=` attribute of the cookie (defaults to the string `\"Infinity\"`). See `setExpires()`\n * _maxAge_ - seconds - if set, the `Max-Age=` attribute _in seconds_ of the cookie. May also be set to strings `\"Infinity\"` and `\"-Infinity\"` for non-expiry and immediate-expiry, respectively. See `setMaxAge()`\n * _domain_ - string - the `Domain=` attribute of the cookie\n * _path_ - string - the `Path=` of the cookie\n * _secure_ - boolean - the `Secure` cookie flag\n * _httpOnly_ - boolean - the `HttpOnly` cookie flag\n * _extensions_ - `Array` - any unrecognized cookie attributes as strings (even if equal-signs inside)\n\nAfter a cookie has been passed through `CookieJar.setCookie()` it will have the following additional attributes:\n\n * _hostOnly_ - boolean - is this a host-only cookie (i.e. no Domain field was set, but was instead implied)\n * _pathIsDefault_ - boolean - if true, there was no Path field on the cookie and `defaultPath()` was used to derive one.\n * _created_ - `Date` - when this cookie was added to the jar\n * _lastAccessed_ - `Date` - last time the cookie got accessed. Will affect cookie cleaning once implemented. Using `cookiejar.getCookies(...)` will update this attribute.\n\nConstruction([{options}])\n------------\n\nReceives an options object that can contain any Cookie properties, uses the default for unspecified properties.\n\n.toString()\n-----------\n\nencode to a Set-Cookie header value. The Expires cookie field is set using `formatDate()`, but is omitted entirely if `.expires` is `Infinity`.\n\n.cookieString()\n---------------\n\nencode to a Cookie header value (i.e. the `.key` and `.value` properties joined with '=').\n\n.setExpires(String)\n-------------------\n\nsets the expiry based on a date-string passed through `parseDate()`. If parseDate returns `null` (i.e. can't parse this date string), `.expires` is set to `\"Infinity\"` (a string) is set.\n\n.setMaxAge(number)\n-------------------\n\nsets the maxAge in seconds. Coerces `-Infinity` to `\"-Infinity\"` and `Infinity` to `\"Infinity\"` so it JSON serializes correctly.\n\n.expiryTime([now=Date.now()])\n-----------------------------\n\n.expiryDate([now=Date.now()])\n-----------------------------\n\nexpiryTime() Computes the absolute unix-epoch milliseconds that this cookie expires. expiryDate() works similarly, except it returns a `Date` object. Note that in both cases the `now` parameter should be milliseconds.\n\nMax-Age takes precedence over Expires (as per the RFC). The `.created` attribute -- or, by default, the `now` paramter -- is used to offset the `.maxAge` attribute.\n\nIf Expires (`.expires`) is set, that's returned.\n\nOtherwise, `expiryTime()` returns `Infinity` and `expiryDate()` returns a `Date` object for \"Tue, 19 Jan 2038 03:14:07 GMT\" (latest date that can be expressed by a 32-bit `time_t`; the common limit for most user-agents).\n\n.TTL([now=Date.now()])\n---------\n\ncompute the TTL relative to `now` (milliseconds). The same precedence rules as for `expiryTime`/`expiryDate` apply.\n\nThe \"number\" `Infinity` is returned for cookies without an explicit expiry and `0` is returned if the cookie is expired. Otherwise a time-to-live in milliseconds is returned.\n\n.canonicalizedDoman()\n---------------------\n\n.cdomain()\n----------\n\nreturn the canonicalized `.domain` field. This is lower-cased and punycode (RFC3490) encoded if the domain has any non-ASCII characters.\n\n.validate()\n-----------\n\nStatus: *IN PROGRESS*. Works for a few things, but is by no means comprehensive.\n\nvalidates cookie attributes for semantic correctness. Useful for \"lint\" checking any Set-Cookie headers you generate. For now, it returns a boolean, but eventually could return a reason string -- you can future-proof with this construct:\n\n``` javascript\nif (cookie.validate() === true) {\n // it's tasty\n} else {\n // yuck!\n}\n```\n\nCookieJar\n=========\n\nConstruction([store = new MemoryCookieStore()][, rejectPublicSuffixes])\n------------\n\nSimply use `new CookieJar()`. If you'd like to use a custom store, pass that to the constructor otherwise a `MemoryCookieStore` will be created and used.\n\n\nAttributes\n----------\n\n * _rejectPublicSuffixes_ - boolean - reject cookies with domains like \"com\" and \"co.uk\" (default: `true`)\n\nSince eventually this module would like to support database/remote/etc. CookieJars, continuation passing style is used for CookieJar methods.\n\n.setCookie(cookieOrString, currentUrl, [{options},] cb(err,cookie))\n-------------------------------------------------------------------\n\nAttempt to set the cookie in the cookie jar. If the operation fails, an error will be given to the callback `cb`, otherwise the cookie is passed through. The cookie will have updated `.created`, `.lastAccessed` and `.hostOnly` properties.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.\n * _secure_ - boolean - autodetect from url - indicates if this is a \"Secure\" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.\n * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies\n * _strict_ - boolean - default `false` - perform extra checks\n * _ignoreError_ - boolean - default `false` - silently ignore things like parse errors and invalid domains. CookieStore errors aren't ignored by this option.\n\nAs per the RFC, the `.hostOnly` property is set if there was no \"Domain=\" parameter in the cookie string (or `.domain` was null on the Cookie object). The `.domain` property is set to the fully-qualified hostname of `currentUrl` in this case. Matching this cookie requires an exact hostname match (not a `domainMatch` as per usual).\n\n.setCookieSync(cookieOrString, currentUrl, [{options}])\n-------------------------------------------------------\n\nSynchronous version of `setCookie`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n.storeCookie(cookie, [{options},] cb(err,cookie))\n-------------------------------------------------\n\n__REMOVED__ removed in lieu of the CookieStore API below\n\n.getCookies(currentUrl, [{options},] cb(err,cookies))\n-----------------------------------------------------\n\nRetrieve the list of cookies that can be sent in a Cookie header for the current url.\n\nIf an error is encountered, that's passed as `err` to the callback, otherwise an `Array` of `Cookie` objects is passed. The array is sorted with `cookieCompare()` unless the `{sort:false}` option is given.\n\nThe `options` object can be omitted and can have the following properties:\n\n * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.\n * _secure_ - boolean - autodetect from url - indicates if this is a \"Secure\" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.\n * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies\n * _expire_ - boolean - default `true` - perform expiry-time checking of cookies and asynchronously remove expired cookies from the store. Using `false` will return expired cookies and **not** remove them from the store (which is useful for replaying Set-Cookie headers, potentially).\n * _allPaths_ - boolean - default `false` - if `true`, do not scope cookies by path. The default uses RFC-compliant path scoping. **Note**: may not be supported by the CookieStore `fetchCookies` function (the default MemoryCookieStore supports it).\n\nThe `.lastAccessed` property of the returned cookies will have been updated.\n\n.getCookiesSync(currentUrl, [{options}])\n----------------------------------------\n\nSynchronous version of `getCookies`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n.getCookieString(...)\n---------------------\n\nAccepts the same options as `.getCookies()` but passes a string suitable for a Cookie header rather than an array to the callback. Simply maps the `Cookie` array via `.cookieString()`.\n\n.getCookieStringSync(...)\n-------------------------\n\nSynchronous version of `getCookieString`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\n.getSetCookieStrings(...)\n-------------------------\n\nReturns an array of strings suitable for **Set-Cookie** headers. Accepts the same options as `.getCookies()`. Simply maps the cookie array via `.toString()`.\n\n.getSetCookieStringsSync(...)\n-----------------------------\n\nSynchronous version of `getSetCookieStrings`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).\n\nStore\n=====\n\nBase class for CookieJar stores.\n\n# CookieStore API\n\nThe storage model for each `CookieJar` instance can be replaced with a custom implementation. The default is `MemoryCookieStore` which can be found in the `lib/memstore.js` file. The API uses continuation-passing-style to allow for asynchronous stores.\n\nStores should inherit from the base `Store` class, which is available as `require('tough-cookie').Store`. Stores are asynchronous by default, but if `store.synchronous` is set, then the `*Sync` methods on the CookieJar can be used.\n\nAll `domain` parameters will have been normalized before calling.\n\nThe Cookie store must have all of the following methods.\n\nstore.findCookie(domain, path, key, cb(err,cookie))\n---------------------------------------------------\n\nRetrieve a cookie with the given domain, path and key (a.k.a. name). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest/newest such cookie should be returned.\n\nCallback takes an error and the resulting `Cookie` object. If no cookie is found then `null` MUST be passed instead (i.e. not an error).\n\nstore.findCookies(domain, path, cb(err,cookies))\n------------------------------------------------\n\nLocates cookies matching the given domain and path. This is most often called in the context of `cookiejar.getCookies()` above.\n\nIf no cookies are found, the callback MUST be passed an empty array.\n\nThe resulting list will be checked for applicability to the current request according to the RFC (domain-match, path-match, http-only-flag, secure-flag, expiry, etc.), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that `domainMatch()` the domain and `pathMatch()` the path in order to limit the amount of checking that needs to be done.\n\nAs of version 0.9.12, the `allPaths` option to `cookiejar.getCookies()` above will cause the path here to be `null`. If the path is `null`, path-matching MUST NOT be performed (i.e. domain-matching only).\n\nstore.putCookie(cookie, cb(err))\n--------------------------------\n\nAdds a new cookie to the store. The implementation SHOULD replace any existing cookie with the same `.domain`, `.path`, and `.key` properties -- depending on the nature of the implementation, it's possible that between the call to `fetchCookie` and `putCookie` that a duplicate `putCookie` can occur.\n\nThe `cookie` object MUST NOT be modified; the caller will have already updated the `.creation` and `.lastAccessed` properties.\n\nPass an error if the cookie cannot be stored.\n\nstore.updateCookie(oldCookie, newCookie, cb(err))\n-------------------------------------------------\n\nUpdate an existing cookie. The implementation MUST update the `.value` for a cookie with the same `domain`, `.path` and `.key`. The implementation SHOULD check that the old value in the store is equivalent to `oldCookie` - how the conflict is resolved is up to the store.\n\nThe `.lastAccessed` property will always be different between the two objects and `.created` will always be the same. Stores MAY ignore or defer the `.lastAccessed` change at the cost of affecting how cookies are sorted (or selected for deletion).\n\nStores may wish to optimize changing the `.value` of the cookie in the store versus storing a new cookie. If the implementation doesn't define this method a stub that calls `putCookie(newCookie,cb)` will be added to the store object.\n\nThe `newCookie` and `oldCookie` objects MUST NOT be modified.\n\nPass an error if the newCookie cannot be stored.\n\nstore.removeCookie(domain, path, key, cb(err))\n----------------------------------------------\n\nRemove a cookie from the store (see notes on `findCookie` about the uniqueness constraint).\n\nThe implementation MUST NOT pass an error if the cookie doesn't exist; only pass an error due to the failure to remove an existing cookie.\n\nstore.removeCookies(domain, path, cb(err))\n------------------------------------------\n\nRemoves matching cookies from the store. The `path` paramter is optional, and if missing means all paths in a domain should be removed.\n\nPass an error ONLY if removing any existing cookies failed.\n\n# TODO\n\n * _full_ RFC5890/RFC5891 canonicalization for domains in `cdomain()`\n * the optional `punycode` requirement implements RFC3492, but RFC6265 requires RFC5891\n * better tests for `validate()`?\n\n# Copyright and License\n\n(tl;dr: MIT with some MPL/1.1)\n\nCopyright 2012- GoInstant, Inc. and other contributors. All rights reserved.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n\nPortions may be licensed under different licenses (in particular public-suffix.txt is MPL/1.1); please read the LICENSE file for full details.\n",
"readmeFilename": "README.md",
- "_id": "tough-cookie@0.9.15",
- "_from": "tough-cookie@~0.9.15"
+ "_id": "tough-cookie@0.12.1",
+ "dist": {
+ "shasum": "8220c7e21abd5b13d96804254bd5a81ebf2c7d62",
+ "tarball": "http://registry.npmjs.org/tough-cookie/-/tough-cookie-0.12.1.tgz"
+ },
+ "_from": "tough-cookie@>=0.12.0",
+ "_npmVersion": "1.3.11",
+ "_npmUser": {
+ "name": "goinstant",
+ "email": "support@goinstant.com"
+ },
+ "maintainers": [
+ {
+ "name": "jstash",
+ "email": "jeremy@goinstant.com"
+ },
+ {
+ "name": "goinstant",
+ "email": "services@goinstant.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "8220c7e21abd5b13d96804254bd5a81ebf2c7d62",
+ "_resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-0.12.1.tgz"
}
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
-
+'use strict';
var vows = require('vows');
var assert = require('assert');
var async = require('async');
function dateVows(table) {
var theVows = { };
- var keys = Object.keys(table).forEach(function(date) {
+ Object.keys(table).forEach(function(date) {
var expect = table[date];
theVows[date] = function() {
var got = tough.parseDate(date) ? 'valid' : 'invalid';
}
var atNow = Date.now();
-function at(offset) { return {now: new Date(atNow+offset)} }
+function at(offset) { return {now: new Date(atNow+offset)}; }
vows.describe('Cookie Jar')
.addBatch({
"doesn't validate": function(c) {
assert.ok(!c.validate());
},
- "to string": function(c) {
- assert.equal(c.toString(), 'a="beta gamma"');
+ "'garbage in, garbage out'": function(c) {
+ assert.equal(c.toString(), 'a=beta gamma');
},
},
"with an empty value and HttpOnly": {
assert.ok(c.isPersistent());
},
"default TTL": {
- topic: function() { return new Cookie() },
+ topic: function() { return new Cookie(); },
"is Infinite-future": function(c) { assert.equal(c.TTL(), Infinity) },
"is a 'session' cookie": function(c) { assert.ok(!c.isPersistent()) },
},
assert.equal(c.expires.getTime(), 1397700749000);
},
"httponly": function(c) { assert.ok(c.httpOnly) },
- }
+ },
+ "spaces in value": {
+ "strict": {
+ topic: function() {
+ return Cookie.parse('a=one two three',true) || null;
+ },
+ "did not parse": function(c) { assert.isNull(c) },
+ },
+ "non-strict": {
+ topic: function() {
+ return Cookie.parse('a=one two three',false) || null;
+ },
+ "parsed": function(c) { assert.ok(c) },
+ "key": function(c) { assert.equal(c.key, 'a') },
+ "value": function(c) { assert.equal(c.value, 'one two three') },
+ "no path": function(c) { assert.equal(c.path, null) },
+ "no domain": function(c) { assert.equal(c.domain, null) },
+ "no extensions": function(c) { assert.ok(!c.extensions) },
+ },
+ },
+ "quoted spaces in value": {
+ "strict": {
+ topic: function() {
+ return Cookie.parse('a="one two three"',true) || null;
+ },
+ "did not parse": function(c) { assert.isNull(c) },
+ },
+ "non-strict": {
+ topic: function() {
+ return Cookie.parse('a="one two three"',false) || null;
+ },
+ "parsed": function(c) { assert.ok(c) },
+ "key": function(c) { assert.equal(c.key, 'a') },
+ "value": function(c) { assert.equal(c.value, 'one two three') },
+ "no path": function(c) { assert.equal(c.path, null) },
+ "no domain": function(c) { assert.equal(c.domain, null) },
+ "no extensions": function(c) { assert.ok(!c.extensions) },
+ }
+ },
+ "non-ASCII in value": {
+ "strict": {
+ topic: function() {
+ return Cookie.parse('farbe=weiß',true) || null;
+ },
+ "did not parse": function(c) { assert.isNull(c) },
+ },
+ "non-strict": {
+ topic: function() {
+ return Cookie.parse('farbe=weiß',false) || null;
+ },
+ "parsed": function(c) { assert.ok(c) },
+ "key": function(c) { assert.equal(c.key, 'farbe') },
+ "value": function(c) { assert.equal(c.value, 'weiß') },
+ "no path": function(c) { assert.equal(c.path, null) },
+ "no domain": function(c) { assert.equal(c.domain, null) },
+ "no extensions": function(c) { assert.ok(!c.extensions) },
+ },
+ },
}
})
.addBatch({
assert.equal(c.domain, 'example.com');
},
},
+ "Setting a sub-path cookie on a super-domain": {
+ topic: function() {
+ var cj = new CookieJar();
+ var c = Cookie.parse("a=b; Domain=example.com; Path=/subpath");
+ assert.strictEqual(c.hostOnly, null);
+ assert.instanceOf(c.creation, Date);
+ assert.strictEqual(c.lastAccessed, null);
+ c.creation = new Date(Date.now()-10000);
+ cj.setCookie(c, 'http://www.example.com/index.html', this.callback);
+ },
+ "domain is super-domain": function(c) { assert.equal(c.domain, 'example.com') },
+ "path is /subpath": function(c) { assert.equal(c.path, '/subpath') },
+ "path was NOT derived": function(c) { assert.strictEqual(c.pathIsDefault, null) },
+ },
"Setting HttpOnly cookie over non-HTTP API": {
topic: function() {
var cj = new CookieJar();
});
},
"setup ok": function(err,cj,results) {
- assert.ok(1);
+ assert.ok(!err);
+ assert.ok(cj);
+ assert.ok(results);
},
"then retrieving for http://nodejs.org": {
- topic: function(cj,results) {
+ topic: function(cj,oldResults) {
+ assert.ok(oldResults);
cj.getCookies('http://nodejs.org',this.callback);
},
"get a nodejs cookie": function(cookies) {
},
},
"then retrieving for https://example.com": {
- topic: function(cj,results) {
+ topic: function(cj,oldResults) {
+ assert.ok(oldResults);
cj.getCookies('https://example.com',{secure:true},this.callback);
},
"get a secure example cookie with others": function(cookies) {
},
},
"then retrieving for https://example.com (missing options)": {
- topic: function(cj,results) {
+ topic: function(cj,oldResults) {
+ assert.ok(oldResults);
cj.getCookies('https://example.com',this.callback);
},
"get a secure example cookie with others": function(cookies) {
},
},
"then retrieving for http://example.com": {
- topic: function(cj,results) {
+ topic: function(cj,oldResults) {
+ assert.ok(oldResults);
cj.getCookies('http://example.com',this.callback);
},
"get a bunch of cookies": function(cookies) {
},
},
"then retrieving for http://EXAMPlE.com": {
- topic: function(cj,results) {
+ topic: function(cj,oldResults) {
+ assert.ok(oldResults);
cj.getCookies('http://EXAMPlE.com',this.callback);
},
"get a bunch of cookies": function(cookies) {
},
},
"then retrieving for http://example.com, non-HTTP": {
- topic: function(cj,results) {
+ topic: function(cj,oldResults) {
+ assert.ok(oldResults);
cj.getCookies('http://example.com',{http:false},this.callback);
},
"get a bunch of cookies": function(cookies) {
},
},
"then retrieving for http://example.com/foo/bar": {
- topic: function(cj,results) {
+ topic: function(cj,oldResults) {
+ assert.ok(oldResults);
cj.getCookies('http://example.com/foo/bar',this.callback);
},
"get a bunch of cookies": function(cookies) {
},
},
"then retrieving for http://example.com as a string": {
- topic: function(cj,results) {
+ topic: function(cj,oldResults) {
+ assert.ok(oldResults);
cj.getCookieString('http://example.com',this.callback);
},
"get a single string": function(cookieHeader) {
},
},
"then retrieving for http://example.com as a set-cookie header": {
- topic: function(cj,results) {
+ topic: function(cj,oldResults) {
+ assert.ok(oldResults);
cj.getSetCookieStrings('http://example.com',this.callback);
},
"get a single string": function(cookieHeaders) {
},
},
"then retrieving for http://www.example.com/": {
- topic: function(cj,results) {
+ topic: function(cj,oldResults) {
+ assert.ok(oldResults);
cj.getCookies('http://www.example.com/foo/bar',this.callback);
},
"get a bunch of cookies": function(cookies) {
topic: function() {
var cb = this.callback;
var next = function (err,c) {
+ c = null;
return cb(err,cj);
};
var cj = new CookieJar();
},
"initial cookie is set": function(err,cj) {
assert.ok(!err);
+ assert.ok(cj);
},
"but when trying to overwrite": {
topic: function(cj) {
var cb = this.callback;
- cj.setCookie('k=12; Domain=example.ca; Path=/','http://example.ca',{http:false},function(err,c) {cb(null,err)});
+ var next = function(err,c) {
+ c = null;
+ cb(null,err);
+ };
+ cj.setCookie('k=12; Domain=example.ca; Path=/','http://example.ca',{http:false},next);
},
"it's an error": function(err) {
assert.ok(err);
},
}
})
+.addBatch({
+ "remove cookies": {
+ topic: function() {
+ var jar = new CookieJar();
+ var cookie = Cookie.parse("a=b; Domain=example.com; Path=/");
+ var cookie2 = Cookie.parse("a=b; Domain=foo.com; Path=/");
+ var cookie3 = Cookie.parse("foo=bar; Domain=foo.com; Path=/");
+ jar.setCookie(cookie, 'http://example.com/index.html', function(){});
+ jar.setCookie(cookie2, 'http://foo.com/index.html', function(){});
+ jar.setCookie(cookie3, 'http://foo.com/index.html', function(){});
+ return jar;
+ },
+ "all from matching domain": function(jar){
+ jar.store.removeCookies('example.com',null, function(err) {
+ assert(err == null);
+
+ jar.store.findCookies('example.com', null, function(err, cookies){
+ assert(err == null);
+ assert(cookies != null);
+ assert(cookies.length === 0, 'cookie was not removed');
+ });
+
+ jar.store.findCookies('foo.com', null, function(err, cookies){
+ assert(err == null);
+ assert(cookies != null);
+ assert(cookies.length === 2, 'cookies should not have been removed');
+ });
+ });
+ },
+ "from cookie store matching domain and key": function(jar){
+ jar.store.removeCookie('foo.com', '/', 'foo', function(err) {
+ assert(err == null);
+
+ jar.store.findCookies('foo.com', null, function(err, cookies){
+ assert(err == null);
+ assert(cookies != null);
+ assert(cookies.length === 1, 'cookie was not removed correctly');
+ assert(cookies[0].key === 'a', 'wrong cookie was removed');
+ });
+ });
+ }
+ }
+})
+.addBatch({
+ "Synchronous CookieJar": {
+ "setCookieSync": {
+ topic: function() {
+ var jar = new CookieJar();
+ var cookie = Cookie.parse("a=b; Domain=example.com; Path=/");
+ cookie = jar.setCookieSync(cookie, 'http://example.com/index.html');
+ return cookie;
+ },
+ "returns a copy of the cookie": function(cookie) {
+ assert.instanceOf(cookie, Cookie);
+ }
+ },
+
+ "setCookieSync strict parse error": {
+ topic: function() {
+ var jar = new CookieJar();
+ var opts = { strict: true };
+ try {
+ jar.setCookieSync("farbe=weiß", 'http://example.com/index.html', opts);
+ return false;
+ } catch (e) {
+ return e;
+ }
+ },
+ "throws the error": function(err) {
+ assert.instanceOf(err, Error);
+ assert.equal(err.message, "Cookie failed to parse");
+ }
+ },
+
+ "getCookiesSync": {
+ topic: function() {
+ var jar = new CookieJar();
+ var url = 'http://example.com/index.html';
+ jar.setCookieSync("a=b; Domain=example.com; Path=/", url);
+ jar.setCookieSync("c=d; Domain=example.com; Path=/", url);
+ return jar.getCookiesSync(url);
+ },
+ "returns the cookie array": function(err, cookies) {
+ assert.ok(!err);
+ assert.ok(Array.isArray(cookies));
+ assert.lengthOf(cookies, 2);
+ cookies.forEach(function(cookie) {
+ assert.instanceOf(cookie, Cookie);
+ });
+ }
+ },
+
+ "getCookieStringSync": {
+ topic: function() {
+ var jar = new CookieJar();
+ var url = 'http://example.com/index.html';
+ jar.setCookieSync("a=b; Domain=example.com; Path=/", url);
+ jar.setCookieSync("c=d; Domain=example.com; Path=/", url);
+ return jar.getCookieStringSync(url);
+ },
+ "returns the cookie header string": function(err, str) {
+ assert.ok(!err);
+ assert.typeOf(str, 'string');
+ }
+ },
+
+ "getSetCookieStringsSync": {
+ topic: function() {
+ var jar = new CookieJar();
+ var url = 'http://example.com/index.html';
+ jar.setCookieSync("a=b; Domain=example.com; Path=/", url);
+ jar.setCookieSync("c=d; Domain=example.com; Path=/", url);
+ return jar.getSetCookieStringsSync(url);
+ },
+ "returns the cookie header string": function(err, headers) {
+ assert.ok(!err);
+ assert.ok(Array.isArray(headers));
+ assert.lengthOf(headers, 2);
+ headers.forEach(function(header) {
+ assert.typeOf(header, 'string');
+ });
+ }
+ },
+ }
+})
+.addBatch({
+ "Synchronous API on async CookieJar": {
+ topic: function() {
+ return new tough.Store();
+ },
+ "setCookieSync": {
+ topic: function(store) {
+ var jar = new CookieJar(store);
+ try {
+ jar.setCookieSync("a=b", 'http://example.com/index.html');
+ return false;
+ } catch(e) {
+ return e;
+ }
+ },
+ "fails": function(err) {
+ assert.instanceOf(err, Error);
+ assert.equal(err.message,
+ 'CookieJar store is not synchronous; use async API instead.');
+ }
+ },
+ "getCookiesSync": {
+ topic: function(store) {
+ var jar = new CookieJar(store);
+ try {
+ jar.getCookiesSync('http://example.com/index.html');
+ return false;
+ } catch(e) {
+ return e;
+ }
+ },
+ "fails": function(err) {
+ assert.instanceOf(err, Error);
+ assert.equal(err.message,
+ 'CookieJar store is not synchronous; use async API instead.');
+ }
+ },
+ "getCookieStringSync": {
+ topic: function(store) {
+ var jar = new CookieJar(store);
+ try {
+ jar.getCookieStringSync('http://example.com/index.html');
+ return false;
+ } catch(e) {
+ return e;
+ }
+ },
+ "fails": function(err) {
+ assert.instanceOf(err, Error);
+ assert.equal(err.message,
+ 'CookieJar store is not synchronous; use async API instead.');
+ }
+ },
+ "getSetCookieStringsSync": {
+ topic: function(store) {
+ var jar = new CookieJar(store);
+ try {
+ jar.getSetCookieStringsSync('http://example.com/index.html');
+ return false;
+ } catch(e) {
+ return e;
+ }
+ },
+ "fails": function(err) {
+ assert.instanceOf(err, Error);
+ assert.equal(err.message,
+ 'CookieJar store is not synchronous; use async API instead.');
+ }
+ },
+ }
+})
.export(module);
--- /dev/null
+{
+ "node": true,
+ "asi": true,
+ "laxcomma": true
+}
}
util.inherits(TunnelingAgent, events.EventEmitter)
-TunnelingAgent.prototype.addRequest = function addRequest(req, host, port) {
+TunnelingAgent.prototype.addRequest = function addRequest(req, options) {
var self = this
+ // Legacy API: addRequest(req, host, port, path)
+ if (typeof options === 'string') {
+ options = {
+ host: options,
+ port: arguments[2],
+ path: arguments[3]
+ };
+ }
+
if (self.sockets.length >= this.maxSockets) {
// We are over limit so we'll add it to the queue.
self.requests.push({host: host, port: port, request: req})
}
// If we are under maxSockets create a new one.
- self.createSocket({host: host, port: port, request: req}, function(socket) {
+ self.createSocket({host: options.host, port: options.port, request: req}, function(socket) {
socket.on('free', onFree)
socket.on('close', onCloseOrRemove)
socket.on('agentRemove', onCloseOrRemove)
req.onSocket(socket)
function onFree() {
- self.emit('free', socket, host, port)
+ self.emit('free', socket, options.host, options.port)
}
function onCloseOrRemove(err) {
},
"name": "tunnel-agent",
"description": "HTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module.",
- "version": "0.3.0",
+ "version": "0.4.0",
"repository": {
"url": "https://github.com/mikeal/tunnel-agent"
},
"engines": {
"node": "*"
},
- "readme": "tunnel-agent\n============\n\nHTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module.\n",
- "readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/mikeal/tunnel-agent/issues"
},
"homepage": "https://github.com/mikeal/tunnel-agent",
- "_id": "tunnel-agent@0.3.0",
- "_from": "tunnel-agent@~0.3.0"
+ "_id": "tunnel-agent@0.4.0",
+ "dist": {
+ "shasum": "b1184e312ffbcf70b3b4c78e8c219de7ebb1c550",
+ "tarball": "http://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.0.tgz"
+ },
+ "_from": "tunnel-agent@~0.4.0",
+ "_npmVersion": "1.3.21",
+ "_npmUser": {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ },
+ "maintainers": [
+ {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ }
+ ],
+ "directories": {},
+ "_shasum": "b1184e312ffbcf70b3b4c78e8c219de7ebb1c550",
+ "_resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.0.tgz",
+ "readme": "ERROR: No README data found!"
}
"util",
"utility"
],
- "version": "2.30.0",
+ "version": "2.42.0",
"author": {
"name": "Mikeal Rogers",
"email": "mikeal.rogers@gmail.com"
},
"repository": {
"type": "git",
- "url": "http://github.com/mikeal/request.git"
+ "url": "https://github.com/mikeal/request.git"
},
"bugs": {
"url": "http://github.com/mikeal/request/issues"
},
+ "license": "Apache-2.0",
"engines": [
"node >= 0.8.0"
],
"main": "index.js",
"dependencies": {
- "qs": "~0.6.0",
- "json-stringify-safe": "~5.0.0",
+ "bl": "~0.9.0",
+ "caseless": "~0.6.0",
"forever-agent": "~0.5.0",
+ "qs": "~1.2.0",
+ "json-stringify-safe": "~5.0.0",
+ "mime-types": "~1.0.1",
"node-uuid": "~1.4.0",
- "mime": "~1.2.9",
- "tough-cookie": "~0.9.15",
+ "tunnel-agent": "~0.4.0",
+ "tough-cookie": ">=0.12.0",
"form-data": "~0.1.0",
- "tunnel-agent": "~0.3.0",
"http-signature": "~0.10.0",
- "oauth-sign": "~0.3.0",
- "hawk": "~1.0.0",
- "aws-sign2": "~0.5.0"
+ "oauth-sign": "~0.4.0",
+ "hawk": "1.1.1",
+ "aws-sign2": "~0.5.0",
+ "stringstream": "~0.0.4"
},
"optionalDependencies": {
- "tough-cookie": "~0.9.15",
+ "tough-cookie": ">=0.12.0",
"form-data": "~0.1.0",
- "tunnel-agent": "~0.3.0",
"http-signature": "~0.10.0",
- "oauth-sign": "~0.3.0",
- "hawk": "~1.0.0",
- "aws-sign2": "~0.5.0"
+ "oauth-sign": "~0.4.0",
+ "hawk": "1.1.1",
+ "aws-sign2": "~0.5.0",
+ "stringstream": "~0.0.4"
},
"scripts": {
"test": "node tests/run.js"
},
- "readme": "# Request -- Simplified HTTP client\n\n[![NPM](https://nodei.co/npm/request.png)](https://nodei.co/npm/request/)\n\n## Super simple to use\n\nRequest is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default.\n\n```javascript\nvar request = require('request');\nrequest('http://www.google.com', function (error, response, body) {\n if (!error && response.statusCode == 200) {\n console.log(body) // Print the google web page.\n }\n})\n```\n\n## Streaming\n\nYou can stream any response to a file stream.\n\n```javascript\nrequest('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png'))\n```\n\nYou can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types (in this case `application/json`) and use the proper `content-type` in the PUT request (if the headers don’t already provide one).\n\n```javascript\nfs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json'))\n```\n\nRequest can also `pipe` to itself. When doing so, `content-type` and `content-length` are preserved in the PUT headers.\n\n```javascript\nrequest.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png'))\n```\n\nNow let’s get fancy.\n\n```javascript\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n if (req.method === 'PUT') {\n req.pipe(request.put('http://mysite.com/doodle.png'))\n } else if (req.method === 'GET' || req.method === 'HEAD') {\n request.get('http://mysite.com/doodle.png').pipe(resp)\n }\n }\n})\n```\n\nYou can also `pipe()` from `http.ServerRequest` instances, as well as to `http.ServerResponse` instances. The HTTP method, headers, and entity-body data will be sent. Which means that, if you don't really care about security, you can do:\n\n```javascript\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n var x = request('http://mysite.com/doodle.png')\n req.pipe(x)\n x.pipe(resp)\n }\n})\n```\n\nAnd since `pipe()` returns the destination stream in ≥ Node 0.5.x you can do one line proxying. :)\n\n```javascript\nreq.pipe(request('http://mysite.com/doodle.png')).pipe(resp)\n```\n\nAlso, none of this new functionality conflicts with requests previous features, it just expands them.\n\n```javascript\nvar r = request.defaults({'proxy':'http://localproxy.com'})\n\nhttp.createServer(function (req, resp) {\n if (req.url === '/doodle.png') {\n r.get('http://google.com/doodle.png').pipe(resp)\n }\n})\n```\n\nYou can still use intermediate proxies, the requests will still follow HTTP forwards, etc.\n\n## Forms\n\n`request` supports `application/x-www-form-urlencoded` and `multipart/form-data` form uploads. For `multipart/related` refer to the `multipart` API.\n\nURL-encoded forms are simple.\n\n```javascript\nrequest.post('http://service.com/upload', {form:{key:'value'}})\n// or\nrequest.post('http://service.com/upload').form({key:'value'})\n```\n\nFor `multipart/form-data` we use the [form-data](https://github.com/felixge/node-form-data) library by [@felixge](https://github.com/felixge). You don’t need to worry about piping the form object or setting the headers, `request` will handle that for you.\n\n```javascript\nvar r = request.post('http://service.com/upload')\nvar form = r.form()\nform.append('my_field', 'my_value')\nform.append('my_buffer', new Buffer([1, 2, 3]))\nform.append('my_file', fs.createReadStream(path.join(__dirname, 'doodle.png'))\nform.append('remote_file', request('http://google.com/doodle.png'))\n```\n\n## HTTP Authentication\n\n```javascript\nrequest.get('http://some.server.com/').auth('username', 'password', false);\n// or\nrequest.get('http://some.server.com/', {\n 'auth': {\n 'user': 'username',\n 'pass': 'password',\n 'sendImmediately': false\n }\n});\n```\n\nIf passed as an option, `auth` should be a hash containing values `user` || `username`, `password` || `pass`, and `sendImmediately` (optional). The method form takes parameters `auth(username, password, sendImmediately)`.\n\n`sendImmediately` defaults to `true`, which causes a basic authentication header to be sent. If `sendImmediately` is `false`, then `request` will retry with a proper authentication header after receiving a `401` response from the server (which must contain a `WWW-Authenticate` header indicating the required authentication method).\n\nDigest authentication is supported, but it only works with `sendImmediately` set to `false`; otherwise `request` will send basic authentication on the initial request, which will probably cause the request to fail.\n\n## OAuth Signing\n\n```javascript\n// Twitter OAuth\nvar qs = require('querystring')\n , oauth =\n { callback: 'http://mysite.com/callback/'\n , consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n }\n , url = 'https://api.twitter.com/oauth/request_token'\n ;\nrequest.post({url:url, oauth:oauth}, function (e, r, body) {\n // Ideally, you would take the body in the response\n // and construct a URL that a user clicks on (like a sign in button).\n // The verifier is only available in the response after a user has\n // verified with twitter that they are authorizing your app.\n var access_token = qs.parse(body)\n , oauth =\n { consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n , token: access_token.oauth_token\n , verifier: access_token.oauth_verifier\n }\n , url = 'https://api.twitter.com/oauth/access_token'\n ;\n request.post({url:url, oauth:oauth}, function (e, r, body) {\n var perm_token = qs.parse(body)\n , oauth =\n { consumer_key: CONSUMER_KEY\n , consumer_secret: CONSUMER_SECRET\n , token: perm_token.oauth_token\n , token_secret: perm_token.oauth_token_secret\n }\n , url = 'https://api.twitter.com/1/users/show.json?'\n , params =\n { screen_name: perm_token.screen_name\n , user_id: perm_token.user_id\n }\n ;\n url += qs.stringify(params)\n request.get({url:url, oauth:oauth, json:true}, function (e, r, user) {\n console.log(user)\n })\n })\n})\n```\n\n### Custom HTTP Headers\n\nHTTP Headers, such as `User-Agent`, can be set in the `options` object.\nIn the example below, we call the github API to find out the number\nof stars and forks for the request repository. This requires a\ncustom `User-Agent` header as well as https.\n\n```\nvar request = require('request');\n\nvar options = {\n\turl: 'https://api.github.com/repos/mikeal/request',\n\theaders: {\n\t\t'User-Agent': 'request'\n\t}\n};\n\nfunction callback(error, response, body) {\n\tif (!error && response.statusCode == 200) {\n\t\tvar info = JSON.parse(body);\n\t\tconsole.log(info.stargazers_count + \" Stars\");\n\t\tconsole.log(info.forks_count + \" Forks\");\n\t}\n}\n\nrequest(options, callback);\n```\n\n### request(options, callback)\n\nThe first argument can be either a `url` or an `options` object. The only required option is `uri`; all others are optional.\n\n* `uri` || `url` - fully qualified uri or a parsed url object from `url.parse()`\n* `qs` - object containing querystring values to be appended to the `uri`\n* `method` - http method (default: `\"GET\"`)\n* `headers` - http headers (default: `{}`)\n* `body` - entity body for PATCH, POST and PUT requests. Must be a `Buffer` or `String`.\n* `form` - when passed an object, this sets `body` to a querystring representation of value, and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. When passed no options, a `FormData` instance is returned (and is piped to request).\n* `auth` - A hash containing values `user` || `username`, `password` || `pass`, and `sendImmediately` (optional). See documentation above.\n* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as JSON.\n* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below.\n* `followRedirect` - follow HTTP 3xx responses as redirects (default: `true`)\n* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects (default: `false`)\n* `maxRedirects` - the maximum number of redirects to follow (default: `10`)\n* `encoding` - Encoding to be used on `setEncoding` of response data. If `null`, the `body` is returned as a `Buffer`.\n* `pool` - A hash object containing the agents for these requests. If omitted, the request will use the global pool (which is set to node's default `maxSockets`)\n* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool.\n* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request\n* `proxy` - An HTTP proxy to be used. Supports proxy Auth with Basic Auth, identical to support for the `url` parameter (by embedding the auth info in the `uri`)\n* `oauth` - Options for OAuth HMAC-SHA1 signing. See documentation above.\n* `hawk` - Options for [Hawk signing](https://github.com/hueniverse/hawk). The `credentials` key must contain the necessary signing info, [see hawk docs for details](https://github.com/hueniverse/hawk#usage-example).\n* `strictSSL` - If `true`, requires SSL certificates be valid. **Note:** to use your own certificate authority, you need to specify an agent that was created with that CA as an option.\n* `jar` - If `true`, remember cookies for future use (or define your custom cookie jar; see examples section)\n* `aws` - `object` containing AWS signing information. Should have the properties `key`, `secret`. Also requires the property `bucket`, unless you’re specifying your `bucket` as part of the path, or the request doesn’t use a bucket (i.e. GET Services)\n* `httpSignature` - Options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options.\n* `localAddress` - Local interface to bind for network connections.\n\n\nThe callback argument gets 3 arguments: \n\n1. An `error` when applicable (usually from the `http.Client` option, not the `http.ClientRequest` object)\n2. An `http.ClientResponse` object\n3. The third is the `response` body (`String` or `Buffer`)\n\n## Convenience methods\n\nThere are also shorthand methods for different HTTP METHODs and some other conveniences.\n\n### request.defaults(options)\n\nThis method returns a wrapper around the normal request API that defaults to whatever options you pass in to it.\n\n### request.put\n\nSame as `request()`, but defaults to `method: \"PUT\"`.\n\n```javascript\nrequest.put(url)\n```\n\n### request.patch\n\nSame as `request()`, but defaults to `method: \"PATCH\"`.\n\n```javascript\nrequest.patch(url)\n```\n\n### request.post\n\nSame as `request()`, but defaults to `method: \"POST\"`.\n\n```javascript\nrequest.post(url)\n```\n\n### request.head\n\nSame as request() but defaults to `method: \"HEAD\"`.\n\n```javascript\nrequest.head(url)\n```\n\n### request.del\n\nSame as `request()`, but defaults to `method: \"DELETE\"`.\n\n```javascript\nrequest.del(url)\n```\n\n### request.get\n\nSame as `request()` (for uniformity).\n\n```javascript\nrequest.get(url)\n```\n### request.cookie\n\nFunction that creates a new cookie.\n\n```javascript\nrequest.cookie('cookie_string_here')\n```\n### request.jar\n\nFunction that creates a new cookie jar.\n\n```javascript\nrequest.jar()\n```\n\n\n## Examples:\n\n```javascript\n var request = require('request')\n , rand = Math.floor(Math.random()*100000000).toString()\n ;\n request(\n { method: 'PUT'\n , uri: 'http://mikeal.iriscouch.com/testjs/' + rand\n , multipart:\n [ { 'content-type': 'application/json'\n , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}})\n }\n , { body: 'I am an attachment' }\n ]\n }\n , function (error, response, body) {\n if(response.statusCode == 201){\n console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand)\n } else {\n console.log('error: '+ response.statusCode)\n console.log(body)\n }\n }\n )\n```\n\nCookies are disabled by default (else, they would be used in subsequent requests). To enable cookies, set `jar` to `true` (either in `defaults` or `options`).\n\n```javascript\nvar request = request.defaults({jar: true})\nrequest('http://www.google.com', function () {\n request('http://images.google.com')\n})\n```\n\nTo use a custom cookie jar (instead `request`’s global cookie jar), set `jar` to an instance of `request.jar()` (either in `defaults` or `options`)\n\n```javascript\nvar j = request.jar()\nvar request = request.defaults({jar:j})\nrequest('http://www.google.com', function () {\n request('http://images.google.com')\n})\n```\nOR\n\n```javascript\nvar j = request.jar()\nvar cookie = request.cookie('your_cookie_here')\nj.add(cookie)\nrequest({url: 'http://www.google.com', jar: j}, function () {\n request('http://images.google.com')\n})\n```\n",
- "readmeFilename": "README.md",
+ "devDependencies": {
+ "rimraf": "~2.2.8"
+ },
"homepage": "https://github.com/mikeal/request",
- "_id": "request@2.30.0",
- "_from": "request@latest"
+ "_id": "request@2.42.0",
+ "_shasum": "572bd0148938564040ac7ab148b96423a063304a",
+ "_from": "request@^2.42.0",
+ "_npmVersion": "1.4.9",
+ "_npmUser": {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ },
+ "maintainers": [
+ {
+ "name": "mikeal",
+ "email": "mikeal.rogers@gmail.com"
+ }
+ ],
+ "dist": {
+ "shasum": "572bd0148938564040ac7ab148b96423a063304a",
+ "tarball": "http://registry.npmjs.org/request/-/request-2.42.0.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/request/-/request-2.42.0.tgz",
+ "readme": "ERROR: No README data found!"
}
, qs = require('qs')
, querystring = require('querystring')
, crypto = require('crypto')
+ , zlib = require('zlib')
+ , bl = require('bl')
, oauth = optional('oauth-sign')
, hawk = optional('hawk')
- , aws = optional('aws-sign')
+ , aws = optional('aws-sign2')
, httpSignature = optional('http-signature')
, uuid = require('node-uuid')
- , mime = require('mime')
- , tunnel = optional('tunnel-agent')
+ , mime = require('mime-types')
+ , tunnel = require('tunnel-agent')
, _safeStringify = require('json-stringify-safe')
+ , stringstream = optional('stringstream')
+ , caseless = require('caseless')
, ForeverAgent = require('forever-agent')
, FormData = optional('form-data')
- , Cookie = optional('tough-cookie')
- , CookieJar = Cookie && Cookie.CookieJar
- , cookieJar = CookieJar && new CookieJar
+ , cookies = require('./lib/cookies')
+ , globalCookieJar = cookies.jar()
, copy = require('./lib/copy')
, debug = require('./lib/debug')
- , getSafe = require('./lib/getSafe')
+ , net = require('net')
;
function safeStringify (obj) {
}
var globalPool = {}
-var isUrl = /^https?:/i
-
-
-// Hacky fix for pre-0.4.4 https
-if (https && !https.Agent) {
- https.Agent = function (options) {
- http.Agent.call(this, options)
- }
- util.inherits(https.Agent, http.Agent)
- https.Agent.prototype._getConnection = function (host, port, cb) {
- var s = tls.connect(port, host, this.options, function () {
- // do other checks here?
- if (cb) cb()
- })
- return s
- }
-}
+var isUrl = /^https?:|^unix:/
+
+var defaultProxyHeaderWhiteList = [
+ 'accept',
+ 'accept-charset',
+ 'accept-encoding',
+ 'accept-language',
+ 'accept-ranges',
+ 'cache-control',
+ 'content-encoding',
+ 'content-language',
+ 'content-length',
+ 'content-location',
+ 'content-md5',
+ 'content-range',
+ 'content-type',
+ 'connection',
+ 'date',
+ 'expect',
+ 'max-forwards',
+ 'pragma',
+ 'proxy-authorization',
+ 'referer',
+ 'te',
+ 'transfer-encoding',
+ 'user-agent',
+ 'via'
+]
function isReadStream (rs) {
- if (rs.readable && rs.path && rs.mode) {
- return true
- }
+ return rs.readable && rs.path && rs.mode;
}
function toBase64 (str) {
return crypto.createHash('md5').update(str).digest('hex')
}
+// Return a simpler request object to allow serialization
+function requestToJSON() {
+ return {
+ uri: this.uri,
+ method: this.method,
+ headers: this.headers
+ }
+}
+
+// Return a simpler response object to allow serialization
+function responseToJSON() {
+ return {
+ statusCode: this.statusCode,
+ body: this.body,
+ headers: this.headers,
+ request: requestToJSON.call(this.request)
+ }
+}
+
function Request (options) {
stream.Stream.call(this)
this.readable = true
this.explicitMethod = true
}
- this.canTunnel = options.tunnel !== false && tunnel;
+ // Assume that we're not going to tunnel unless we need to
+ if (typeof options.tunnel === 'undefined') options.tunnel = false
this.init(options)
}
util.inherits(Request, stream.Stream)
+
+
+// Set up the tunneling agent if necessary
+Request.prototype.setupTunnel = function () {
+ var self = this
+ if (typeof self.proxy == 'string') self.proxy = url.parse(self.proxy)
+
+ if (!self.proxy) return false
+
+ // Don't need to use a tunneling proxy
+ if (!self.tunnel && self.uri.protocol !== 'https:')
+ return
+
+ // do the HTTP CONNECT dance using koichik/node-tunnel
+
+ // The host to tell the proxy to CONNECT to
+ var proxyHost = self.uri.hostname + ':'
+ if (self.uri.port)
+ proxyHost += self.uri.port
+ else if (self.uri.protocol === 'https:')
+ proxyHost += '443'
+ else
+ proxyHost += '80'
+
+ if (!self.proxyHeaderWhiteList)
+ self.proxyHeaderWhiteList = defaultProxyHeaderWhiteList
+
+ // Only send the proxy the whitelisted header names.
+ var proxyHeaders = Object.keys(self.headers).filter(function (h) {
+ return self.proxyHeaderWhiteList.indexOf(h.toLowerCase()) !== -1
+ }).reduce(function (set, h) {
+ set[h] = self.headers[h]
+ return set
+ }, {})
+
+ proxyHeaders.host = proxyHost
+
+ var tunnelFnName =
+ (self.uri.protocol === 'https:' ? 'https' : 'http') +
+ 'Over' +
+ (self.proxy.protocol === 'https:' ? 'Https' : 'Http')
+
+ var tunnelFn = tunnel[tunnelFnName]
+
+ var proxyAuth
+ if (self.proxy.auth)
+ proxyAuth = self.proxy.auth
+ else if (self.proxyAuthorization)
+ proxyHeaders['Proxy-Authorization'] = self.proxyAuthorization
+
+ var tunnelOptions = { proxy: { host: self.proxy.hostname
+ , port: +self.proxy.port
+ , proxyAuth: proxyAuth
+ , headers: proxyHeaders }
+ , rejectUnauthorized: self.rejectUnauthorized
+ , headers: self.headers
+ , ca: self.ca
+ , cert: self.cert
+ , key: self.key}
+
+ self.agent = tunnelFn(tunnelOptions)
+
+ // At this point, we know that the proxy will support tunneling
+ // (or fail miserably), so we're going to tunnel all proxied requests
+ // from here on out.
+ self.tunnel = true
+
+ return true
+}
+
+
+
+
Request.prototype.init = function (options) {
// init() contains all the code to setup the request object.
// the actual outgoing request is not started until start() is called
var self = this
if (!options) options = {}
+ caseless.httpify(self, self.headers || {})
+
+ // Never send proxy-auth to the endpoint!
+ if (self.hasHeader('proxy-authorization')) {
+ self.proxyAuthorization = self.getHeader('proxy-authorization')
+ self.removeHeader('proxy-authorization')
+ }
+
if (!self.method) self.method = options.method || 'GET'
self.localAddress = options.localAddress
self.rejectUnauthorized = false
}
- if (self.proxy) {
- if (typeof self.proxy == 'string') self.proxy = url.parse(self.proxy)
-
- // do the HTTP CONNECT dance using koichik/node-tunnel
- if (http.globalAgent && self.uri.protocol === "https:" && self.canTunnel) {
- var tunnelFn = self.proxy.protocol === "http:"
- ? tunnel.httpsOverHttp : tunnel.httpsOverHttps
-
- var tunnelOptions = { proxy: { host: self.proxy.hostname
- , port: +self.proxy.port
- , proxyAuth: self.proxy.auth
- , headers: { Host: self.uri.hostname + ':' +
- (self.uri.port || self.uri.protocol === 'https:' ? 443 : 80) }}
- , rejectUnauthorized: self.rejectUnauthorized
- , ca: this.ca }
-
- self.agent = tunnelFn(tunnelOptions)
- self.tunnel = true
+ if(!self.hasOwnProperty('proxy')) {
+ // check for HTTP(S)_PROXY environment variables
+ if(self.uri.protocol == "http:") {
+ self.proxy = process.env.HTTP_PROXY || process.env.http_proxy || null;
+ } else if(self.uri.protocol == "https:") {
+ self.proxy = process.env.HTTPS_PROXY || process.env.https_proxy ||
+ process.env.HTTP_PROXY || process.env.http_proxy || null;
}
}
+ // Pass in `tunnel:true` to *always* tunnel through proxies
+ self.tunnel = !!options.tunnel
+ if (self.proxy) {
+ self.setupTunnel()
+ }
+
if (!self.uri.pathname) {self.uri.pathname = '/'}
- if (!self.uri.host) {
+ if (!self.uri.host && !self.protocol=='unix:') {
// Invalid URI: it may generate lot of bad errors, like "TypeError: Cannot call method 'indexOf' of undefined" in CookieJar
// Detect and reject it as soon as possible
var faultyUri = url.format(self.uri)
self._redirectsFollowed = self._redirectsFollowed || 0
self.maxRedirects = (self.maxRedirects !== undefined) ? self.maxRedirects : 10
- self.followRedirect = (self.followRedirect !== undefined) ? self.followRedirect : true
+ self.allowRedirect = (typeof self.followRedirect === 'function') ? self.followRedirect : function(response) {
+ return true;
+ };
+ self.followRedirect = (self.followRedirect !== undefined) ? !!self.followRedirect : true
self.followAllRedirects = (self.followAllRedirects !== undefined) ? self.followAllRedirects : false
if (self.followRedirect || self.followAllRedirects)
self.redirects = self.redirects || []
- self.headers = self.headers ? copy(self.headers) : {}
-
self.setHost = false
if (!self.hasHeader('host')) {
self.setHeader('host', self.uri.hostname)
}
}
- if (options.form) {
- self.form(options.form)
- }
+ self._buildRequest = function(){
+ var self = this;
- if (options.qs) self.qs(options.qs)
+ if (options.form) {
+ self.form(options.form)
+ }
- if (self.uri.path) {
- self.path = self.uri.path
- } else {
- self.path = self.uri.pathname + (self.uri.search || "")
- }
+ if (options.qs) self.qs(options.qs)
- if (self.path.length === 0) self.path = '/'
+ if (self.uri.path) {
+ self.path = self.uri.path
+ } else {
+ self.path = self.uri.pathname + (self.uri.search || "")
+ }
+ if (self.path.length === 0) self.path = '/'
- // Auth must happen last in case signing is dependent on other headers
- if (options.oauth) {
- self.oauth(options.oauth)
- }
- if (options.aws) {
- self.aws(options.aws)
- }
+ // Auth must happen last in case signing is dependent on other headers
+ if (options.oauth) {
+ self.oauth(options.oauth)
+ }
- if (options.hawk) {
- self.hawk(options.hawk)
- }
+ if (options.aws) {
+ self.aws(options.aws)
+ }
- if (options.httpSignature) {
- self.httpSignature(options.httpSignature)
- }
+ if (options.hawk) {
+ self.hawk(options.hawk)
+ }
- if (options.auth) {
- if (Object.prototype.hasOwnProperty.call(options.auth, 'username')) options.auth.user = options.auth.username
- if (Object.prototype.hasOwnProperty.call(options.auth, 'password')) options.auth.pass = options.auth.password
-
- self.auth(
- options.auth.user,
- options.auth.pass,
- options.auth.sendImmediately
- )
- }
+ if (options.httpSignature) {
+ self.httpSignature(options.httpSignature)
+ }
- if (self.uri.auth && !self.hasHeader('authorization')) {
- var authPieces = self.uri.auth.split(':').map(function(item){ return querystring.unescape(item) })
- self.auth(authPieces[0], authPieces.slice(1).join(':'), true)
- }
- if (self.proxy && self.proxy.auth && !self.hasHeader('proxy-authorization') && !self.tunnel) {
- self.setHeader('proxy-authorization', "Basic " + toBase64(self.proxy.auth.split(':').map(function(item){ return querystring.unescape(item)}).join(':')))
- }
+ if (options.auth) {
+ if (Object.prototype.hasOwnProperty.call(options.auth, 'username')) options.auth.user = options.auth.username
+ if (Object.prototype.hasOwnProperty.call(options.auth, 'password')) options.auth.pass = options.auth.password
+ self.auth(
+ options.auth.user,
+ options.auth.pass,
+ options.auth.sendImmediately,
+ options.auth.bearer
+ )
+ }
- if (self.proxy && !self.tunnel) self.path = (self.uri.protocol + '//' + self.uri.host + self.path)
+ if (self.gzip && !self.hasHeader('accept-encoding')) {
+ self.setHeader('accept-encoding', 'gzip')
+ }
- if (options.json) {
- self.json(options.json)
- } else if (options.multipart) {
- self.boundary = uuid()
- self.multipart(options.multipart)
- }
+ if (self.uri.auth && !self.hasHeader('authorization')) {
+ var authPieces = self.uri.auth.split(':').map(function(item){ return querystring.unescape(item) })
+ self.auth(authPieces[0], authPieces.slice(1).join(':'), true)
+ }
- if (self.body) {
- var length = 0
- if (!Buffer.isBuffer(self.body)) {
- if (Array.isArray(self.body)) {
- for (var i = 0; i < self.body.length; i++) {
- length += self.body[i].length
+ if (self.proxy && !self.tunnel) {
+ if (self.proxy.auth && !self.proxyAuthorization) {
+ var authPieces = self.proxy.auth.split(':').map(function(item){
+ return querystring.unescape(item)
+ })
+ var authHeader = 'Basic ' + toBase64(authPieces.join(':'))
+ self.proxyAuthorization = authHeader
+ }
+ if (self.proxyAuthorization)
+ self.setHeader('proxy-authorization', self.proxyAuthorization)
+ }
+
+ if (self.proxy && !self.tunnel) self.path = (self.uri.protocol + '//' + self.uri.host + self.path)
+
+ if (options.json) {
+ self.json(options.json)
+ } else if (options.multipart) {
+ self.boundary = uuid()
+ self.multipart(options.multipart)
+ }
+
+ if (self.body) {
+ var length = 0
+ if (!Buffer.isBuffer(self.body)) {
+ if (Array.isArray(self.body)) {
+ for (var i = 0; i < self.body.length; i++) {
+ length += self.body[i].length
+ }
+ } else {
+ self.body = new Buffer(self.body)
+ length = self.body.length
}
} else {
- self.body = new Buffer(self.body)
length = self.body.length
}
- } else {
- length = self.body.length
- }
- if (length) {
- if (!self.hasHeader('content-length')) self.setHeader('content-length', length)
- } else {
- throw new Error('Argument error, options.body.')
+ if (length) {
+ if (!self.hasHeader('content-length')) self.setHeader('content-length', length)
+ } else {
+ throw new Error('Argument error, options.body.')
+ }
}
- }
- var protocol = self.proxy && !self.tunnel ? self.proxy.protocol : self.uri.protocol
- , defaultModules = {'http:':http, 'https:':https}
- , httpModules = self.httpModules || {}
- ;
- self.httpModule = httpModules[protocol] || defaultModules[protocol]
+ var protocol = self.proxy && !self.tunnel ? self.proxy.protocol : self.uri.protocol
+ , defaultModules = {'http:':http, 'https:':https, 'unix:':http}
+ , httpModules = self.httpModules || {}
+ ;
+ self.httpModule = httpModules[protocol] || defaultModules[protocol]
- if (!self.httpModule) return this.emit('error', new Error("Invalid protocol"))
+ if (!self.httpModule) return this.emit('error', new Error("Invalid protocol: " + protocol))
- if (options.ca) self.ca = options.ca
+ if (options.ca) self.ca = options.ca
- if (!self.agent) {
- if (options.agentOptions) self.agentOptions = options.agentOptions
+ if (!self.agent) {
+ if (options.agentOptions) self.agentOptions = options.agentOptions
- if (options.agentClass) {
- self.agentClass = options.agentClass
- } else if (options.forever) {
- self.agentClass = protocol === 'http:' ? ForeverAgent : ForeverAgent.SSL
- } else {
- self.agentClass = self.httpModule.Agent
+ if (options.agentClass) {
+ self.agentClass = options.agentClass
+ } else if (options.forever) {
+ self.agentClass = protocol === 'http:' ? ForeverAgent : ForeverAgent.SSL
+ } else {
+ self.agentClass = self.httpModule.Agent
+ }
}
- }
- if (self.pool === false) {
- self.agent = false
- } else {
- self.agent = self.agent || self.getAgent()
- if (self.maxSockets) {
- // Don't use our pooling if node has the refactored client
- self.agent.maxSockets = self.maxSockets
- }
- if (self.pool.maxSockets) {
- // Don't use our pooling if node has the refactored client
- self.agent.maxSockets = self.pool.maxSockets
+ if (self.pool === false) {
+ self.agent = false
+ } else {
+ self.agent = self.agent || self.getAgent()
+ if (self.maxSockets) {
+ // Don't use our pooling if node has the refactored client
+ self.agent.maxSockets = self.maxSockets
+ }
+ if (self.pool.maxSockets) {
+ // Don't use our pooling if node has the refactored client
+ self.agent.maxSockets = self.pool.maxSockets
+ }
}
- }
- self.on('pipe', function (src) {
- if (self.ntick && self._started) throw new Error("You cannot pipe to this stream after the outbound request has started.")
- self.src = src
- if (isReadStream(src)) {
- if (!self.hasHeader('content-type')) self.setHeader('content-type', mime.lookup(src.path))
- } else {
- if (src.headers) {
- for (var i in src.headers) {
- if (!self.hasHeader(i)) {
- self.setHeader(i, src.headers[i])
+ self.on('pipe', function (src) {
+ if (self.ntick && self._started) throw new Error("You cannot pipe to this stream after the outbound request has started.")
+ self.src = src
+ if (isReadStream(src)) {
+ if (!self.hasHeader('content-type')) self.setHeader('content-type', mime.lookup(src.path))
+ } else {
+ if (src.headers) {
+ for (var i in src.headers) {
+ if (!self.hasHeader(i)) {
+ self.setHeader(i, src.headers[i])
+ }
}
}
+ if (self._json && !self.hasHeader('content-type'))
+ self.setHeader('content-type', 'application/json')
+ if (src.method && !self.explicitMethod) {
+ self.method = src.method
+ }
}
- if (self._json && !self.hasHeader('content-type'))
- self.setHeader('content-type', 'application/json')
- if (src.method && !self.explicitMethod) {
- self.method = src.method
- }
- }
- // self.on('pipe', function () {
- // console.error("You have already piped to this stream. Pipeing twice is likely to break the request.")
- // })
- })
+ // self.on('pipe', function () {
+ // console.error("You have already piped to this stream. Pipeing twice is likely to break the request.")
+ // })
+ })
- process.nextTick(function () {
- if (self._aborted) return
+ process.nextTick(function () {
+ if (self._aborted) return
- if (self._form) {
- self.setHeaders(self._form.getHeaders())
- self._form.pipe(self)
- }
- if (self.body) {
- if (Array.isArray(self.body)) {
- self.body.forEach(function (part) {
- self.write(part)
+ var end = function () {
+ if (self._form) {
+ self._form.pipe(self)
+ }
+ if (self.body) {
+ if (Array.isArray(self.body)) {
+ self.body.forEach(function (part) {
+ self.write(part)
+ })
+ } else {
+ self.write(self.body)
+ }
+ self.end()
+ } else if (self.requestBodyStream) {
+ console.warn("options.requestBodyStream is deprecated, please pass the request object to stream.pipe.")
+ self.requestBodyStream.pipe(self)
+ } else if (!self.src) {
+ if (self.method !== 'GET' && typeof self.method !== 'undefined') {
+ self.setHeader('content-length', 0)
+ }
+ self.end()
+ }
+ }
+
+ if (self._form && !self.hasHeader('content-length')) {
+ // Before ending the request, we had to compute the length of the whole form, asyncly
+ self.setHeader(self._form.getHeaders())
+ self._form.getLength(function (err, length) {
+ if (!err) {
+ self.setHeader('content-length', length)
+ }
+ end()
})
} else {
- self.write(self.body)
+ end()
+ }
+
+ self.ntick = true
+ })
+
+ } // End _buildRequest
+
+ self._handleUnixSocketURI = function(self){
+ // Parse URI and extract a socket path (tested as a valid socket using net.connect), and a http style path suffix
+ // Thus http requests can be made to a socket using the uri unix://tmp/my.socket/urlpath
+ // and a request for '/urlpath' will be sent to the unix socket at /tmp/my.socket
+
+ self.unixsocket = true;
+
+ var full_path = self.uri.href.replace(self.uri.protocol+'/', '');
+
+ var lookup = full_path.split('/');
+ var error_connecting = true;
+
+ var lookup_table = {};
+ do { lookup_table[lookup.join('/')]={} } while(lookup.pop())
+ for (r in lookup_table){
+ try_next(r);
+ }
+
+ function try_next(table_row){
+ var client = net.connect( table_row );
+ client.path = table_row
+ client.on('error', function(){ lookup_table[this.path].error_connecting=true; this.end(); });
+ client.on('connect', function(){ lookup_table[this.path].error_connecting=false; this.end(); });
+ table_row.client = client;
+ }
+
+ wait_for_socket_response();
+
+ response_counter = 0;
+
+ function wait_for_socket_response(){
+ var detach;
+ if('undefined' == typeof setImmediate ) detach = process.nextTick
+ else detach = setImmediate;
+ detach(function(){
+ // counter to prevent infinite blocking waiting for an open socket to be found.
+ response_counter++;
+ var trying = false;
+ for (r in lookup_table){
+ if('undefined' == typeof lookup_table[r].error_connecting)
+ trying = true;
+ }
+ if(trying && response_counter<1000)
+ wait_for_socket_response()
+ else
+ set_socket_properties();
+ })
+ }
+
+ function set_socket_properties(){
+ var host;
+ for (r in lookup_table){
+ if(lookup_table[r].error_connecting === false){
+ host = r
+ }
}
- self.end()
- } else if (self.requestBodyStream) {
- console.warn("options.requestBodyStream is deprecated, please pass the request object to stream.pipe.")
- self.requestBodyStream.pipe(self)
- } else if (!self.src) {
- if (self.method !== 'GET' && typeof self.method !== 'undefined') {
- self.setHeader('content-length', 0)
+ if(!host){
+ self.emit('error', new Error("Failed to connect to any socket in "+full_path))
}
- self.end()
+ var path = full_path.replace(host, '')
+
+ self.socketPath = host
+ self.uri.pathname = path
+ self.uri.href = path
+ self.uri.path = path
+ self.host = ''
+ self.hostname = ''
+ delete self.host
+ delete self.hostname
+ self._buildRequest();
}
- self.ntick = true
- })
+ }
+
+ // Intercept UNIX protocol requests to change properties to match socket
+ if(/^unix:/.test(self.uri.protocol)){
+ self._handleUnixSocketURI(self);
+ } else {
+ self._buildRequest();
+ }
+
}
// Must call this when following a redirect from https to http or vice versa
var self = this
var protocol = self.uri.protocol
- if (protocol === 'https:') {
+ if (protocol === 'https:' || self.tunnel) {
// previously was doing http, now doing https
// if it's https, then we might need to tunnel now.
- if (self.proxy && self.canTunnel) {
- self.tunnel = true
- var tunnelFn = self.proxy.protocol === 'http:'
- ? tunnel.httpsOverHttp : tunnel.httpsOverHttps
- var tunnelOptions = { proxy: { host: self.proxy.hostname
- , port: +self.proxy.port
- , proxyAuth: self.proxy.auth }
- , rejectUnauthorized: self.rejectUnauthorized
- , ca: self.ca }
- self.agent = tunnelFn(tunnelOptions)
- return
+ if (self.proxy) {
+ if (self.setupTunnel()) return
}
self.httpModule = https
} else {
// previously was doing https, now doing http
- // stop any tunneling.
- if (self.tunnel) self.tunnel = false
self.httpModule = http
switch (self.agentClass) {
case ForeverAgent.SSL:
if (this.ca) options.ca = this.ca
if (this.ciphers) options.ciphers = this.ciphers
if (this.secureProtocol) options.secureProtocol = this.secureProtocol
+ if (this.secureOptions) options.secureOptions = this.secureOptions
if (typeof this.rejectUnauthorized !== 'undefined') options.rejectUnauthorized = this.rejectUnauthorized
if (this.cert && this.key) {
if (poolKey) poolKey += ':'
poolKey += options.secureProtocol
}
+
+ if (options.secureOptions) {
+ if (poolKey) poolKey += ':'
+ poolKey += options.secureOptions
+ }
}
if (this.pool === globalPool && !poolKey && Object.keys(options).length === 0 && this.httpModule.globalAgent) {
debug('response end', self.uri.href, response.statusCode, response.headers)
});
- if (response.connection.listeners('error').indexOf(self._parserErrorHandler) === -1) {
+ // The check on response.connection is a workaround for browserify.
+ if (response.connection && response.connection.listeners('error').indexOf(self._parserErrorHandler) === -1) {
+ response.connection.setMaxListeners(0)
response.connection.once('error', self._parserErrorHandler)
}
if (self._aborted) {
return
}
if (self._paused) response.pause()
- else response.resume()
+ // Check that response.resume is defined. Workaround for browserify.
+ else response.resume && response.resume()
self.response = response
response.request = self
- response.toJSON = toJSON
+ response.toJSON = responseToJSON
// XXX This is different on 0.10, because SSL is strict by default
if (self.httpModule === https &&
- self.strictSSL &&
- !response.client.authorized) {
+ self.strictSSL && (!response.hasOwnProperty('client') ||
+ !response.client.authorized)) {
debug('strict ssl error', self.uri.href)
- var sslErr = response.client.authorizationError
+ var sslErr = response.hasOwnProperty('client') ? response.client.authorizationError : self.uri.href + " does not support SSL";
self.emit('error', new Error('SSL Error: '+ sslErr))
return
}
- if (self.setHost && self.hasHeader('host')) delete self.headers[self.hasHeader('host')]
+ if (self.setHost) self.removeHeader('host')
if (self.timeout && self.timeoutTimer) {
clearTimeout(self.timeoutTimer)
self.timeoutTimer = null
}
+ var targetCookieJar = (self._jar && self._jar.setCookie)?self._jar:globalCookieJar;
var addCookie = function (cookie) {
- if (self._jar){
- var targetCookieJar = self._jar.setCookie?self._jar:cookieJar;
-
- //set the cookie if it's domain in the href's domain.
- targetCookieJar.setCookie(cookie, self.uri.href, function(err){
- if (err){
- console.warn('set cookie failed,'+ err)
- }
- })
+ //set the cookie if it's domain in the href's domain.
+ try {
+ targetCookieJar.setCookie(cookie, self.uri.href, {ignoreError: true});
+ } catch (e) {
+ self.emit('error', e);
}
-
}
- if (hasHeader('set-cookie', response.headers) && (!self._disableCookies)) {
- var headerName = hasHeader('set-cookie', response.headers)
+ response.caseless = caseless(response.headers)
+
+ if (response.caseless.has('set-cookie') && (!self._disableCookies)) {
+ var headerName = response.caseless.has('set-cookie')
if (Array.isArray(response.headers[headerName])) response.headers[headerName].forEach(addCookie)
else addCookie(response.headers[headerName])
}
var redirectTo = null
- if (response.statusCode >= 300 && response.statusCode < 400 && hasHeader('location', response.headers)) {
- var location = response.headers[hasHeader('location', response.headers)]
+ if (response.statusCode >= 300 && response.statusCode < 400 && response.caseless.has('location')) {
+ var location = response.caseless.get('location')
debug('redirect', location)
if (self.followAllRedirects) {
}
}
} else if (response.statusCode == 401 && self._hasAuth && !self._sentAuth) {
- var authHeader = response.headers[hasHeader('www-authenticate', response.headers)]
- var authVerb = authHeader && authHeader.split(' ')[0]
+ var authHeader = response.caseless.get('www-authenticate')
+ var authVerb = authHeader && authHeader.split(' ')[0].toLowerCase()
debug('reauth', authVerb)
switch (authVerb) {
- case 'Basic':
+ case 'basic':
self.auth(self._user, self._pass, true)
redirectTo = self.uri
break
- case 'Digest':
+ case 'bearer':
+ self.auth(null, null, true, self._bearer)
+ redirectTo = self.uri
+ break
+
+ case 'digest':
// TODO: More complete implementation of RFC 2617.
// - check challenge.algorithm
// - support algorithm="MD5-sess"
}
}
- if (redirectTo) {
+ if (redirectTo && self.allowRedirect.call(self, response)) {
debug('redirect to', redirectTo)
// ignore any potential response body. it cannot possibly be useful
, redirectUri: redirectTo
}
)
- if (self.followAllRedirects && response.statusCode != 401) self.method = 'GET'
+ if (self.followAllRedirects && response.statusCode != 401 && response.statusCode != 307) self.method = 'GET'
// self.method = 'GET' // Force all redirects to use GET || commented out fixes #215
delete self.src
delete self.req
delete self.agent
delete self._started
- if (response.statusCode != 401) {
+ if (response.statusCode != 401 && response.statusCode != 307) {
// Remove parameters from the previous response, unless this is the second request
// for a server that requires digest authentication.
delete self.body
delete self._form
if (self.headers) {
- if (self.hasHeader('host')) delete self.headers[self.hasHeader('host')]
- if (self.hasHeader('content-type')) delete self.headers[self.hasHeader('content-type')]
- if (self.hasHeader('content-length')) delete self.headers[self.hasHeader('content-length')]
+ self.removeHeader('host')
+ self.removeHeader('content-type')
+ self.removeHeader('content-length')
}
}
if (!self._ended) self.response.emit('end')
})
+ response.on('end', function () {
+ self._ended = true
+ })
+
+ var dataStream
+ if (self.gzip) {
+ var contentEncoding = response.headers["content-encoding"] || "identity"
+ contentEncoding = contentEncoding.trim().toLowerCase()
+
+ if (contentEncoding === "gzip") {
+ dataStream = zlib.createGunzip()
+ response.pipe(dataStream)
+ } else {
+ // Since previous versions didn't check for Content-Encoding header,
+ // ignore any invalid values to preserve backwards-compatibility
+ if (contentEncoding !== "identity") {
+ debug("ignoring unrecognized Content-Encoding " + contentEncoding)
+ }
+ dataStream = response
+ }
+ } else {
+ dataStream = response
+ }
+
if (self.encoding) {
if (self.dests.length !== 0) {
console.error("Ignoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.")
+ } else if (dataStream.setEncoding) {
+ dataStream.setEncoding(self.encoding)
} else {
- response.setEncoding(self.encoding)
+ // Should only occur on node pre-v0.9.4 (joyent/node@9b5abe5) with
+ // zlib streams.
+ // If/When support for 0.9.4 is dropped, this should be unnecessary.
+ dataStream = dataStream.pipe(stringstream(self.encoding))
}
}
self.pipeDest(dest)
})
- response.on("data", function (chunk) {
+ dataStream.on("data", function (chunk) {
self._destdata = true
self.emit("data", chunk)
})
- response.on("end", function (chunk) {
- self._ended = true
+ dataStream.on("end", function (chunk) {
self.emit("end", chunk)
})
- response.on("close", function () {self.emit("close")})
+ dataStream.on("close", function () {self.emit("close")})
if (self.callback) {
- var buffer = []
- var bodyLen = 0
+ var buffer = bl()
+ , strings = []
+ ;
self.on("data", function (chunk) {
- buffer.push(chunk)
- bodyLen += chunk.length
+ if (Buffer.isBuffer(chunk)) buffer.append(chunk)
+ else strings.push(chunk)
})
self.on("end", function () {
debug('end event', self.uri.href)
return
}
- if (buffer.length && Buffer.isBuffer(buffer[0])) {
- debug('has body', self.uri.href, bodyLen)
- var body = new Buffer(bodyLen)
- var i = 0
- buffer.forEach(function (chunk) {
- chunk.copy(body, i, 0, chunk.length)
- i += chunk.length
- })
+ if (buffer.length) {
+ debug('has body', self.uri.href, buffer.length)
if (self.encoding === null) {
- response.body = body
+ // response.body = buffer
+ // can't move to this until https://github.com/rvagg/bl/issues/13
+ response.body = buffer.slice()
} else {
- response.body = body.toString(self.encoding)
+ response.body = buffer.toString(self.encoding)
}
- } else if (buffer.length) {
+ } else if (strings.length) {
// The UTF8 BOM [0xEF,0xBB,0xBF] is converted to [0xFE,0xFF] in the JS UTC16/UCS2 representation.
// Strip this value out when the encoding is set to 'utf8', as upstream consumers won't expect it and it breaks JSON.parse().
- if (self.encoding === 'utf8' && buffer[0].length > 0 && buffer[0][0] === "\uFEFF") {
- buffer[0] = buffer[0].substring(1)
+ if (self.encoding === 'utf8' && strings[0].length > 0 && strings[0][0] === "\uFEFF") {
+ strings[0] = strings[0].substring(1)
}
- response.body = buffer.join('')
+ response.body = strings.join('')
}
if (self._json) {
var response = this.response
// Called after the response is received
if (dest.headers && !dest.headersSent) {
- if (hasHeader('content-type', response.headers)) {
- var ctname = hasHeader('content-type', response.headers)
+ if (response.caseless.has('content-type')) {
+ var ctname = response.caseless.has('content-type')
if (dest.setHeader) dest.setHeader(ctname, response.headers[ctname])
else dest.headers[ctname] = response.headers[ctname]
}
- if (hasHeader('content-length', response.headers)) {
- var clname = hasHeader('content-length', response.headers)
+ if (response.caseless.has('content-length')) {
+ var clname = response.caseless.has('content-length')
if (dest.setHeader) dest.setHeader(clname, response.headers[clname])
else dest.headers[clname] = response.headers[clname]
}
}
if (dest.setHeader && !dest.headersSent) {
for (var i in response.headers) {
- dest.setHeader(i, response.headers[i])
+ // If the response content is being decoded, the Content-Encoding header
+ // of the response doesn't represent the piped content, so don't pass it.
+ if (!this.gzip || i !== 'content-encoding') {
+ dest.setHeader(i, response.headers[i])
+ }
}
dest.statusCode = response.statusCode
}
if (this.pipefilter) this.pipefilter(response, dest)
}
-// Composable API
-Request.prototype.setHeader = function (name, value, clobber) {
- if (clobber === undefined) clobber = true
- if (clobber || !this.hasHeader(name)) this.headers[name] = value
- else this.headers[this.hasHeader(name)] += ',' + value
- return this
-}
-Request.prototype.setHeaders = function (headers) {
- for (var i in headers) {this.setHeader(i, headers[i])}
- return this
-}
-Request.prototype.hasHeader = function (header, headers) {
- var headers = Object.keys(headers || this.headers)
- , lheaders = headers.map(function (h) {return h.toLowerCase()})
- ;
- header = header.toLowerCase()
- for (var i=0;i<lheaders.length;i++) {
- if (lheaders[i] === header) return headers[i]
- }
- return false
-}
-
-var hasHeader = Request.prototype.hasHeader
-
Request.prototype.qs = function (q, clobber) {
var base
if (!clobber && this.uri.query) base = qs.parse(this.uri.query)
Request.prototype.form = function (form) {
if (form) {
this.setHeader('content-type', 'application/x-www-form-urlencoded; charset=utf-8')
- this.body = qs.stringify(form).toString('utf8')
+ this.body = (typeof form === 'string') ? form.toString('utf8') : qs.stringify(form).toString('utf8')
return this
}
// create form-data object
if (typeof val === 'boolean') {
if (typeof this.body === 'object') {
this.body = safeStringify(this.body)
- self.setHeader('content-type', 'application/json')
+ if (!self.hasHeader('content-type'))
+ self.setHeader('content-type', 'application/json')
}
} else {
this.body = safeStringify(val)
- self.setHeader('content-type', 'application/json')
+ if (!self.hasHeader('content-type'))
+ self.setHeader('content-type', 'application/json')
}
+
return this
}
Request.prototype.getHeader = function (name, headers) {
var result, re, match
if (!headers) headers = this.headers
Object.keys(headers).forEach(function (key) {
+ if (key.length !== name.length) return
re = new RegExp(name, 'i')
match = key.match(re)
if (match) result = headers[key]
}
var getHeader = Request.prototype.getHeader
-Request.prototype.auth = function (user, pass, sendImmediately) {
+Request.prototype.auth = function (user, pass, sendImmediately, bearer) {
+ if (bearer !== undefined) {
+ this._bearer = bearer
+ this._hasAuth = true
+ if (sendImmediately || typeof sendImmediately == 'undefined') {
+ if (typeof bearer === 'function') {
+ bearer = bearer()
+ }
+ this.setHeader('authorization', 'Bearer ' + bearer)
+ this._sentAuth = true
+ }
+ return this
+ }
if (typeof user !== 'string' || (pass !== undefined && typeof pass !== 'string')) {
throw new Error('auth() received invalid user or password')
}
}
return this
}
+
Request.prototype.aws = function (opts, now) {
if (!now) {
this._aws = opts
, md5: this.getHeader('content-md5') || ''
, amazonHeaders: aws.canonicalizeHeaders(this.headers)
}
- if (opts.bucket && this.path) {
- auth.resource = '/' + opts.bucket + this.path
- } else if (opts.bucket && !this.path) {
+ var path = this.uri.path;
+ if (opts.bucket && path) {
+ auth.resource = '/' + opts.bucket + path
+ } else if (opts.bucket && !path) {
auth.resource = '/' + opts.bucket
- } else if (!opts.bucket && this.path) {
- auth.resource = this.path
- } else if (!opts.bucket && !this.path) {
+ } else if (!opts.bucket && path) {
+ auth.resource = path
+ } else if (!opts.bucket && !path) {
auth.resource = '/'
}
auth.resource = aws.canonicalizeResource(auth.resource)
}
Request.prototype.oauth = function (_oauth) {
- var form
+ var form, query
if (this.hasHeader('content-type') &&
this.getHeader('content-type').slice(0, 'application/x-www-form-urlencoded'.length) ===
'application/x-www-form-urlencoded'
) {
- form = qs.parse(this.body)
+ form = this.body
}
if (this.uri.query) {
- form = qs.parse(this.uri.query)
+ query = this.uri.query
}
- if (!form) form = {}
+
var oa = {}
- for (var i in form) oa[i] = form[i]
for (var i in _oauth) oa['oauth_'+i] = _oauth[i]
+ if ('oauth_realm' in oa) delete oa.oauth_realm
+
if (!oa.oauth_version) oa.oauth_version = '1.0'
if (!oa.oauth_timestamp) oa.oauth_timestamp = Math.floor( Date.now() / 1000 ).toString()
if (!oa.oauth_nonce) oa.oauth_nonce = uuid().replace(/-/g, '')
delete oa.oauth_consumer_secret
var token_secret = oa.oauth_token_secret
delete oa.oauth_token_secret
- var timestamp = oa.oauth_timestamp
var baseurl = this.uri.protocol + '//' + this.uri.host + this.uri.pathname
- var signature = oauth.hmacsign(this.method, baseurl, oa, consumer_secret, token_secret)
+ var params = qs.parse([].concat(query, form, qs.stringify(oa)).join('&'))
+ var signature = oauth.hmacsign(this.method, baseurl, params, consumer_secret, token_secret)
- // oa.oauth_signature = signature
- for (var i in form) {
- if ( i.slice(0, 'oauth_') in _oauth) {
- // skip
- } else {
- delete oa['oauth_'+i]
- if (i !== 'x_auth_mode') delete oa[i]
- }
- }
- oa.oauth_timestamp = timestamp
- var authHeader = 'OAuth '+Object.keys(oa).sort().map(function (i) {return i+'="'+oauth.rfc3986(oa[i])+'"'}).join(',')
+ var realm = _oauth.realm ? 'realm="' + _oauth.realm + '",' : '';
+ var authHeader = 'OAuth ' + realm +
+ Object.keys(oa).sort().map(function (i) {return i+'="'+oauth.rfc3986(oa[i])+'"'}).join(',')
authHeader += ',oauth_signature="' + oauth.rfc3986(signature) + '"'
this.setHeader('Authorization', authHeader)
return this
cookies = false
this._disableCookies = true
} else {
- var targetCookieJar = (jar && jar.getCookieString)?jar:cookieJar;
+ var targetCookieJar = (jar && jar.getCookieString)?jar:globalCookieJar;
var urihref = this.uri.href
-
//fetch cookie in the Specified host
- targetCookieJar.getCookieString(urihref, function(err, hrefCookie){
- if (err){
- console.warn('get cookieString failed,' +err)
- } else {
- cookies = hrefCookie
- }
- })
-
+ if (targetCookieJar) {
+ cookies = targetCookieJar.getCookieString(urihref);
+ }
}
//if need cookie and cookie is not empty
else if (this.response) this.response.destroy()
}
-function toJSON () {
- return getSafe(this, '__' + (((1+Math.random())*0x10000)|0).toString(16))
-}
+Request.prototype.toJSON = requestToJSON
-Request.prototype.toJSON = toJSON
+Request.defaultProxyHeaderWhiteList =
+ defaultProxyHeaderWhiteList.slice()
module.exports = Request
, a = l * n
if (!a) return cb_(null, [])
function cb (er) {
- if (errState) return
+ if (er && !errState) errState = er
+
var argLen = arguments.length
for (var i = 1; i < argLen; i ++) if (arguments[i] !== undefined) {
data[i - 1] = (data[i - 1] || []).concat(arguments[i])
})
}
- if (er || --a === 0) {
- errState = er
- cb_.apply(null, [errState].concat(data))
- }
+ if (--a === 0) cb_.apply(null, [errState].concat(data))
}
// expect the supplied cb function to be called
// "n" times for each thing in the array.
{
"name": "slide",
- "version": "1.1.5",
+ "version": "1.1.6",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "git://github.com/isaacs/slide-flow-control.git"
},
"license": "ISC",
- "readme": "# Controlling Flow: callbacks are easy\n\n## What's actually hard?\n\n- Doing a bunch of things in a specific order.\n- Knowing when stuff is done.\n- Handling failures.\n- Breaking up functionality into parts (avoid nested inline callbacks)\n\n\n## Common Mistakes\n\n- Abandoning convention and consistency.\n- Putting all callbacks inline.\n- Using libraries without grokking them.\n- Trying to make async code look sync.\n\n## Define Conventions\n\n- Two kinds of functions: *actors* take action, *callbacks* get results.\n- Essentially the continuation pattern. Resulting code *looks* similar\n to fibers, but is *much* simpler to implement.\n- Node works this way in the lowlevel APIs already, and it's very flexible.\n\n## Callbacks\n\n- Simple responders\n- Must always be prepared to handle errors, that's why it's the first argument.\n- Often inline anonymous, but not always.\n- Can trap and call other callbacks with modified data, or pass errors upwards.\n\n## Actors\n\n- Last argument is a callback.\n- If any error occurs, and can't be handled, pass it to the callback and return.\n- Must not throw. Return value ignored.\n- return x ==> return cb(null, x)\n- throw er ==> return cb(er)\n\n```javascript\n// return true if a path is either\n// a symlink or a directory.\nfunction isLinkOrDir (path, cb) {\n fs.lstat(path, function (er, s) {\n if (er) return cb(er)\n return cb(null, s.isDirectory() || s.isSymbolicLink())\n })\n}\n```\n\n# asyncMap\n\n## Usecases\n\n- I have a list of 10 files, and need to read all of them, and then continue when they're all done.\n- I have a dozen URLs, and need to fetch them all, and then continue when they're all done.\n- I have 4 connected users, and need to send a message to all of them, and then continue when that's done.\n- I have a list of n things, and I need to dosomething with all of them, in parallel, and get the results once they're all complete.\n\n\n## Solution\n\n```javascript\nvar asyncMap = require(\"slide\").asyncMap\nfunction writeFiles (files, what, cb) {\n asyncMap(files, function (f, cb) {\n fs.writeFile(f, what, cb)\n }, cb)\n}\nwriteFiles([my, file, list], \"foo\", cb)\n```\n\n# chain\n\n## Usecases\n\n- I have to do a bunch of things, in order. Get db credentials out of a file,\n read the data from the db, write that data to another file.\n- If anything fails, do not continue.\n- I still have to provide an array of functions, which is a lot of boilerplate,\n and a pita if your functions take args like\n\n```javascript\nfunction (cb) {\n blah(a, b, c, cb)\n}\n```\n\n- Results are discarded, which is a bit lame.\n- No way to branch.\n\n## Solution\n\n- reduces boilerplate by converting an array of [fn, args] to an actor\n that takes no arguments (except cb)\n- A bit like Function#bind, but tailored for our use-case.\n- bindActor(obj, \"method\", a, b, c)\n- bindActor(fn, a, b, c)\n- bindActor(obj, fn, a, b, c)\n- branching, skipping over falsey arguments\n\n```javascript\nchain([\n doThing && [thing, a, b, c]\n, isFoo && [doFoo, \"foo\"]\n, subChain && [chain, [one, two]]\n], cb)\n```\n\n- tracking results: results are stored in an optional array passed as argument,\n last result is always in results[results.length - 1].\n- treat chain.first and chain.last as placeholders for the first/last\n result up until that point.\n\n\n## Non-trivial example\n\n- Read number files in a directory\n- Add the results together\n- Ping a web service with the result\n- Write the response to a file\n- Delete the number files\n\n```javascript\nvar chain = require(\"slide\").chain\nfunction myProgram (cb) {\n var res = [], last = chain.last, first = chain.first\n chain([\n [fs, \"readdir\", \"the-directory\"]\n , [readFiles, \"the-directory\", last]\n , [sum, last]\n , [ping, \"POST\", \"example.com\", 80, \"/foo\", last]\n , [fs, \"writeFile\", \"result.txt\", last]\n , [rmFiles, \"./the-directory\", first]\n ], res, cb)\n}\n```\n\n# Conclusion: Convention Profits\n\n- Consistent API from top to bottom.\n- Sneak in at any point to inject functionality. Testable, reusable, ...\n- When ruby and python users whine, you can smile condescendingly.\n",
- "readmeFilename": "README.md",
+ "gitHead": "8345e51ee41e35825abc1a40750ea11462f57028",
"bugs": {
"url": "https://github.com/isaacs/slide-flow-control/issues"
},
- "_id": "slide@1.1.5",
- "_from": "slide@latest"
+ "homepage": "https://github.com/isaacs/slide-flow-control",
+ "_id": "slide@1.1.6",
+ "scripts": {},
+ "_shasum": "56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707",
+ "_from": "slide@~1.1.6",
+ "_npmVersion": "2.0.0-beta.3",
+ "_npmUser": {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ "maintainers": [
+ {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ }
+ ],
+ "dist": {
+ "shasum": "56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707",
+ "tarball": "http://registry.npmjs.org/slide/-/slide-1.1.6.tgz"
+ },
+ "directories": {},
+ "_resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz",
+ "readme": "ERROR: No README data found!"
}
},
"name": "tar",
"description": "tar for node",
- "version": "1.0.0",
+ "version": "1.0.1",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-tar.git"
},
"dependencies": {
"block-stream": "*",
- "fstream": "^1.0.0",
+ "fstream": "^1.0.2",
"inherits": "2"
},
"devDependencies": {
- "tap": "0.x",
- "rimraf": "1.x"
+ "graceful-fs": "^3.0.2",
+ "rimraf": "1.x",
+ "tap": "0.x"
},
"license": "BSD",
"readme": "# node-tar\n\nTar for Node.js.\n\n[![NPM](https://nodei.co/npm/tar.png)](https://nodei.co/npm/tar/)\n\n## API\n\nSee `examples/` for usage examples.\n\n### var tar = require('tar')\n\nReturns an object with `.Pack`, `.Extract` and `.Parse` methods.\n\n### tar.Pack([properties])\n\nReturns a through stream. Use\n[fstream](https://npmjs.org/package/fstream) to write files into the\npack stream and you will receive tar archive data from the pack\nstream.\n\nThis only works with directories, it does not work with individual files.\n\nThe optional `properties` object are used to set properties in the tar\n'Global Extended Header'.\n\n### tar.Extract([options])\n\nReturns a through stream. Write tar data to the stream and the files\nin the tarball will be extracted onto the filesystem.\n\n`options` can be:\n\n```js\n{\n path: '/path/to/extract/tar/into',\n strip: 0, // how many path segments to strip from the root when extracting\n}\n```\n\n`options` also get passed to the `fstream.Writer` instance that `tar`\nuses internally.\n\n### tar.Parse()\n\nReturns a writable stream. Write tar data to it and it will emit\n`entry` events for each entry parsed from the tarball. This is used by\n`tar.Extract`.\n",
"readmeFilename": "README.md",
- "gitHead": "49979621a55c73c3f668d8e01830eba1ea9df862",
+ "gitHead": "476bf6f5882b9c33d1cbf66f175d0f25e3981044",
"bugs": {
"url": "https://github.com/isaacs/node-tar/issues"
},
"homepage": "https://github.com/isaacs/node-tar",
- "_id": "tar@1.0.0",
- "_shasum": "36636d76e8ae12b4bc11a940ac606b5ca8a5fe1f",
+ "_id": "tar@1.0.1",
+ "_shasum": "6075b5a1f236defe0c7e3756d3d9b3ebdad0f19a",
"_from": "tar@latest"
}
--- /dev/null
+// Set the umask, so that it works the same everywhere.
+process.umask(parseInt('22', 8))
+
+var tap = require("tap")
+ , tar = require("../tar.js")
+ , fs = require("fs")
+ , gfs = require("graceful-fs")
+ , path = require("path")
+ , file = path.resolve(__dirname, "fixtures/dir.tar")
+ , target = path.resolve(__dirname, "tmp/extract-test")
+ , index = 0
+ , fstream = require("fstream")
+ , rimraf = require("rimraf")
+ , mkdirp = require("mkdirp")
+
+ , ee = 0
+ , expectEntries = [
+ {
+ "path" : "dir/",
+ "mode" : "750",
+ "type" : "5",
+ "depth" : undefined,
+ "size" : 0,
+ "linkpath" : "",
+ "nlink" : undefined,
+ "dev" : undefined,
+ "ino" : undefined
+ },
+ {
+ "path" : "dir/sub/",
+ "mode" : "750",
+ "type" : "5",
+ "depth" : undefined,
+ "size" : 0,
+ "linkpath" : "",
+ "nlink" : undefined,
+ "dev" : undefined,
+ "ino" : undefined
+ } ]
+
+function slow (fs, method, t1, t2) {
+ var orig = fs[method]
+ if (!orig) return null
+ fs[method] = function () {
+ var args = [].slice.call(arguments)
+ console.error("slow", method, args[0])
+ var cb = args.pop()
+
+ setTimeout(function () {
+ orig.apply(fs, args.concat(function(er, data) {
+ setTimeout(function() {
+ cb(er, data)
+ }, t2)
+ }))
+ }, t1)
+ }
+}
+
+// Make sure we get the graceful-fs that fstream is using.
+var gfs2
+try {
+ gfs2 = require("fstream/node_modules/graceful-fs")
+} catch (er) {}
+
+var slowMethods = ["chown", "chmod", "utimes", "lutimes"]
+slowMethods.forEach(function (method) {
+ var t1 = 500
+ var t2 = 0
+ slow(fs, method, t1, t2)
+ slow(gfs, method, t1, t2)
+ if (gfs2) {
+ slow(gfs2, method, t1, t2)
+ }
+})
+
+
+
+// The extract class basically just pipes the input
+// to a Reader, and then to a fstream.DirWriter
+
+// So, this is as much a test of fstream.Reader and fstream.Writer
+// as it is of tar.Extract, but it sort of makes sense.
+
+tap.test("preclean", function (t) {
+ rimraf.sync(target)
+ /mkdirp.sync(target)
+ t.pass("cleaned!")
+ t.end()
+})
+
+tap.test("extract test", function (t) {
+ var extract = tar.Extract(target)
+ var inp = fs.createReadStream(file)
+
+ // give it a weird buffer size to try to break in odd places
+ inp.bufferSize = 1234
+
+ inp.pipe(extract)
+
+ extract.on("end", function () {
+ rimraf.sync(target)
+
+ t.equal(ee, expectEntries.length, "should see "+ee+" entries")
+
+ // should get no more entries after end
+ extract.removeAllListeners("entry")
+ extract.on("entry", function (e) {
+ t.fail("Should not get entries after end!")
+ })
+
+ t.end()
+ })
+
+
+ extract.on("entry", function (entry) {
+ var found =
+ { path: entry.path
+ , mode: entry.props.mode.toString(8)
+ , type: entry.props.type
+ , depth: entry.props.depth
+ , size: entry.props.size
+ , linkpath: entry.props.linkpath
+ , nlink: entry.props.nlink
+ , dev: entry.props.dev
+ , ino: entry.props.ino
+ }
+
+ var wanted = expectEntries[ee ++]
+
+ t.equivalent(found, wanted, "tar entry " + ee + " " + wanted.path)
+ })
+})
fill: '' } ]
, [ 'entry',
+ { path: 'fixtures/dir/',
+ mode: 488,
+ uid: uid,
+ gid: gid,
+ size: 0,
+ type: '5',
+ linkpath: '',
+ ustar: 'ustar\u0000',
+ ustarver: '00',
+ uname: '',
+ gname: '',
+ devmaj: 0,
+ devmin: 0,
+ fill: '' } ]
+
+ , [ 'entry',
+ { path: 'fixtures/dir/sub/',
+ mode: 488,
+ uid: uid,
+ gid: gid,
+ size: 0,
+ type: '5',
+ linkpath: '',
+ ustar: 'ustar\u0000',
+ ustarver: '00',
+ uname: '',
+ gname: '',
+ devmaj: 0,
+ devmin: 0,
+ fill: '' } ]
+
+ , [ 'entry',
{ path: 'fixtures/foo.js',
mode: 420,
uid: uid,
t.equal(ev, wanted[0], "event type should be "+wanted[0])
if (ev !== wanted[0] || e.path !== wanted[1].path) {
- console.error(wanted)
+ console.error("wanted", wanted)
console.error([ev, e.props])
e.on("end", function () {
console.error(e.fields)
fill: '' } ]
, [ 'entry',
+ { path: 'fixtures/dir/',
+ mode: 488,
+ uid: uid,
+ gid: gid,
+ size: 0,
+ type: '5',
+ linkpath: '',
+ ustar: 'ustar\u0000',
+ ustarver: '00',
+ uname: '',
+ gname: '',
+ devmaj: 0,
+ devmin: 0,
+ fill: '' } ]
+
+ , [ 'entry',
+ { path: 'fixtures/dir/sub/',
+ mode: 488,
+ uid: uid,
+ gid: gid,
+ size: 0,
+ type: '5',
+ linkpath: '',
+ ustar: 'ustar\u0000',
+ ustarver: '00',
+ uname: '',
+ gname: '',
+ devmaj: 0,
+ devmin: 0,
+ fill: '' } ]
+
+
+ , [ 'entry',
{ path: 'fixtures/foo.js',
mode: 420,
uid: uid,
}
t.equal(ev, wanted[0], "event type should be "+wanted[0])
- // if (ev !== wanted[0] || e.path !== wanted[1].path) {
- // console.error(wanted)
- // console.error([ev, e.props])
- // throw "break"
- // }
+ if (ev !== wanted[0] || e.path !== wanted[1].path) {
+ console.error("wanted", wanted)
+ console.error([ev, e.props])
+ e.on("end", function () {
+ console.error(e.fields)
+ throw "break"
+ })
+ }
+
t.has(e.props, wanted[1], "properties "+wanted[1].path)
if (wanted[2]) {
{
- "version": "1.4.23",
+ "version": "1.4.28",
"name": "npm",
"description": "A package manager for node",
"keywords": [
"child-process-close": "~0.1.1",
"chmodr": "~0.1.0",
"chownr": "0",
- "cmd-shim": "~1.1.2",
- "columnify": "~1.1.0",
+ "cmd-shim": "2.0.0",
+ "columnify": "~1.2.1",
"editor": "~0.1.0",
- "fstream": "~1.0.0",
+ "fstream": "~1.0.2",
"fstream-npm": "~1.0.0",
- "github-url-from-git": "~1.3.0",
- "github-url-from-username-repo": "~0.2.0",
+ "github-url-from-git": "~1.4.0",
+ "github-url-from-username-repo": "~1.0.0",
"glob": "~4.0.5",
"graceful-fs": "~3.0.0",
"inflight": "~1.0.1",
"ini": "~1.2.0",
"init-package-json": "~1.0.0",
- "lockfile": "~0.4.0",
+ "lockfile": "~1.0.0",
"lru-cache": "~2.5.0",
"minimatch": "~1.0.0",
"mkdirp": "~0.5.0",
"nopt": "~3.0.1",
"npm-cache-filename": "~1.0.1",
"npm-install-checks": "~1.0.2",
- "npm-registry-client": "~2.0.4",
+ "npm-registry-client": "~2.0.7",
"npm-user-validate": "~0.1.0",
- "npmconf": "~1.1.4",
+ "npmconf": "~1.1.8",
"npmlog": "~0.1.1",
"once": "~1.3.0",
"opener": "~1.3.0",
"path-is-inside": "~1.0.0",
"read": "~1.0.4",
"read-installed": "~2.0.5",
- "read-package-json": "~1.2.6",
- "request": "~2.30.0",
+ "read-package-json": "~1.2.7",
+ "request": "~2.42.0",
"retry": "~0.6.0",
"rimraf": "~2.2.8",
"semver": "~2.3.0",
"sha": "~1.2.1",
- "slide": "~1.1.5",
+ "slide": "~1.1.6",
"sorted-object": "~1.0.0",
- "tar": "~1.0.0",
+ "tar": "~1.0.1",
"text-table": "~0.2.0",
"uid-number": "0.0.5",
"which": "1"
*.[1357])
./node_modules/.bin/ronn --roff $src \
| sed "s|@VERSION@|$version|g" \
- | perl -pi -e 's/(npm\\-)?([^\(]*)\(1\)/npm help \2/g' \
- | perl -pi -e 's/(npm\\-)?([^\(]*)\([57]\)/npm help \3 \2/g' \
- | perl -pi -e 's/(npm\\-)?([^\(]*)\(3\)/npm apihelp \2/g' \
+ | perl -pi -e 's/(npm\\-)?([a-zA-Z\\\.\-]*)\(1\)/npm help \2/g' \
+ | perl -pi -e 's/(npm\\-)?([a-zA-Z\\\.\-]*)\(([57])\)/npm help \3 \2/g' \
+ | perl -pi -e 's/(npm\\-)?([a-zA-Z\\\.\-]*)\(3\)/npm apihelp \2/g' \
| perl -pi -e 's/npm\(1\)/npm help npm/g' \
| perl -pi -e 's/npm\(3\)/npm apihelp npm/g' \
> $dest
"==============================================\n")
writeLines(files, 0)
- writeLines(files, 1, "Command Line Documentation")
- writeLines(files, 3, "API Documentation")
- writeLines(files, 5, "Files")
- writeLines(files, 7, "Misc")
+ writeLines(files, 1, "Command Line Documentation", "Using npm on the command line")
+ writeLines(files, 3, "API Documentation", "Using npm in your Node programs")
+ writeLines(files, 5, "Files", "File system structures npm uses")
+ writeLines(files, 7, "Misc", "Various other bits and bobs")
}
-function writeLines (files, sxn, heading) {
- if (heading)
- console.log("# %s\n", heading)
+function writeLines (files, sxn, heading, desc) {
+ if (heading) {
+ console.log("## %s\n\n%s\n", heading, desc)
+ }
files.filter(function (f) {
return f[0] === sxn
}).forEach(writeLine)
var content = fs.readFileSync(doc, "utf8").split("\n")[0].split("-- ")[1]
- console.log("## %s(%d)\n", d, sxn)
+ console.log("### %s(%d)\n", d, sxn)
console.log(content + "\n")
}
--- /dev/null
+var semver = require("semver")
+var version = semver.parse(require("../package.json").version)
+console.log('v%s.%s-next', version.major, version.minor)
-var common = require('../common-tap.js')
-var test = require('tap').test
-var osenv = require('osenv')
+if (process.platform === "win32") {
+ console.log("ok - symlinks are weird on windows, skip this test")
+ return
+}
+var common = require("../common-tap.js")
+var test = require("tap").test
var npm = require.resolve("../../bin/npm-cli.js")
var node = process.execPath
-var path = require('path')
-var fs = require('fs')
-var rimraf = require('rimraf')
-var mkdirp = require('mkdirp')
-var pkg = path.resolve(__dirname, 'ignore-install-link')
-var spawn = require('child_process').spawn
-var linkDir = path.resolve(osenv.tmpdir(), 'npm-link-issue')
-
-test('ignore-install-link: ignore install if a package is linked', function(t) {
- setup(function(err) {
- if (err) {
- t.ifError(err)
- t.end()
- return
- }
-
- var p = path.resolve(pkg, 'node_modules', 'npm-link-issue')
- fs.lstat(p, function(err, s) {
- t.ifError(err)
+var path = require("path")
+var fs = require("fs")
+var rimraf = require("rimraf")
+var mkdirp = require("mkdirp")
+var spawn = require("child_process").spawn
+
+var root = path.resolve(__dirname, "ignore-install-link")
+var pkg = path.resolve(root, "pkg")
+var dep = path.resolve(root, "dep")
+var target = path.resolve(pkg, "node_modules", "dep")
+var cache = path.resolve(root, "cache")
+var global = path.resolve(root, "global")
+
+var pkgj = { "name":"pkg", "version": "1.2.3"
+ , "dependencies": { "dep": "1.2.3" } }
+var depj = { "name": "dep", "version": "1.2.3" }
+
+var myreg = require("http").createServer(function (q, s) {
+ s.statusCode = 403
+ s.end(JSON.stringify({"error":"forbidden"}) + "\n")
+}).listen(common.port)
+
+test("setup", function (t) {
+ rimraf.sync(root)
+ mkdirp.sync(root)
+ mkdirp.sync(path.resolve(pkg, "node_modules"))
+ mkdirp.sync(dep)
+ mkdirp.sync(cache)
+ mkdirp.sync(global)
+ fs.writeFileSync(path.resolve(pkg, "package.json"), JSON.stringify(pkgj))
+ fs.writeFileSync(path.resolve(dep, "package.json"), JSON.stringify(depj))
+ fs.symlinkSync(dep, target, "dir")
+ t.end()
+})
- t.ok(true === s.isSymbolicLink(), 'child is a symlink')
- t.end()
- })
+test("ignore install if package is linked", function (t) {
+ common.npm(["install"], {
+ cwd: pkg,
+ env: {
+ PATH: process.env.PATH || process.env.Path,
+ HOME: process.env.HOME,
+ npm_config_prefix: global,
+ npm_config_cache: cache,
+ npm_config_registry: common.registry,
+ npm_config_loglevel: "silent"
+ },
+ stdio: "inherit"
+ }, function (er, code, stdout, stderr) {
+ if (er) throw er
+ t.equal(code, 0)
+ t.end()
})
})
-test('cleanup', function(t) {
- process.chdir(osenv.tmpdir())
- rimraf.sync(pkg)
- rimraf.sync(linkDir)
+test("still a symlink", function (t) {
+ t.equal(true, fs.lstatSync(target).isSymbolicLink())
t.end()
})
-
-function setup(cb) {
- rimraf.sync(linkDir)
- mkdirp.sync(pkg)
- mkdirp.sync(path.resolve(pkg, 'cache'))
- mkdirp.sync(path.resolve(pkg, 'node_modules'))
- mkdirp.sync(linkDir)
- fs.writeFileSync(path.resolve(pkg, 'package.json'), JSON.stringify({
- author: 'Evan Lucas',
- name: 'ignore-install-link',
- version: '0.0.0',
- description: 'Test for ignoring install when a package has been linked',
- dependencies: {
- 'npm-link-issue': 'git+https://github.com/lancefisher/npm-link-issue.git#0.0.1'
- }
- }), 'utf8')
- fs.writeFileSync(path.resolve(linkDir, 'package.json'), JSON.stringify({
- author: 'lancefisher',
- name: 'npm-link-issue',
- version: '0.0.1',
- description: 'Sample Dependency'
- }), 'utf8')
-
- clone(cb)
-}
-
-function clone (cb) {
- var child = createChild(process.cwd(), 'git', ['--git-dir', linkDir, 'init'])
- child.on('close', function(c) {
- if (c !== 0)
- return cb(new Error('Failed to init the git repository'))
-
- process.chdir(linkDir)
- performLink(cb)
- })
-}
-
-function performLink (cb) {
- var child = createChild(linkDir, node, [npm, 'link', '.'])
- child.on('close', function(c) {
- if (c !== 0)
- return cb(new Error('Failed to link ' + linkDir + ' globally'))
-
- performLink2(cb)
- })
-}
-
-function performLink2 (cb) {
- var child = createChild(pkg, node, [npm, 'link', 'npm-link-issue'])
- child.on('close', function(c) {
- if (c !== 0)
- return cb(new Error('Failed to link ' + linkDir + ' to local node_modules'))
-
- performInstall(cb)
- })
-}
-
-function performInstall (cb) {
- var child = createChild(pkg, node, [npm, 'install'])
- child.on('close', function(c) {
- if (c !== 0)
- return cb(new Error('Failed to install'))
-
- cb()
- })
-}
-
-function createChild (cwd, cmd, args) {
- var env = {
- HOME: process.env.HOME,
- Path: process.env.PATH,
- PATH: process.env.PATH,
- npm_config_loglevel: "silent"
- }
-
- if (process.platform === "win32")
- env.npm_config_cache = "%APPDATA%\\npm-cache"
-
- return spawn(cmd, args, {
- cwd: cwd,
- stdio: "pipe",
- env: env
- })
-}
+test("cleanup", function (t) {
+ rimraf.sync(root)
+ myreg.close()
+ t.end()
+})
--- /dev/null
+var path = require("path")
+var test = require("tap").test
+var fs = require("fs")
+var rimraf = require("rimraf")
+var mkdirp = require("mkdirp")
+var common = require("../common-tap.js")
+
+var pkg = path.resolve(__dirname, "spawn-enoent")
+var pj = JSON.stringify({
+ name:"x",
+ version: "1.2.3",
+ scripts: { start: "wharble-garble-blorst" }
+}, null, 2) + "\n"
+
+
+test("setup", function (t) {
+ rimraf.sync(pkg)
+ mkdirp.sync(pkg)
+ fs.writeFileSync(pkg + "/package.json", pj)
+ t.end()
+})
+
+test("enoent script", function (t) {
+ common.npm(["start"], {
+ cwd: pkg,
+ env: {
+ PATH: process.env.PATH,
+ Path: process.env.Path,
+ npm_config_loglevel: "warn"
+ }
+ }, function (er, code, sout, serr) {
+ t.similar(serr, /npm ERR! Failed at the x@1\.2\.3 start script\./)
+ t.end()
+ })
+})
+
+test("clean", function (t) {
+ rimraf.sync(pkg)
+ t.end()
+})
if (stderr)
throw new Error('npm ' + command + ' stderr: ' + stderr.toString())
- stdout = stdout.trim().split('\n')
+ stdout = stdout.trim().split(/\n|\r/)
stdout = stdout[stdout.length - 1]
t.equal(stdout, command)
t.end()
{"name":"startstop"
,"version":"1.2.3"
,"scripts":{
- "start":"node -e 'console.log(\"start\")'",
- "stop":"node -e 'console.log(\"stop\")'"
+ "start":"node -e \"console.log('start')\"",
+ "stop":"node -e \"console.log('stop')\""
}
}
--- /dev/null
+var test = require("tap").test
+var rimraf = require("rimraf")
+var mkdirp = require("mkdirp")
+var common = require("../common-tap.js")
+var path = require("path")
+var fs = require("fs")
+var dir = path.resolve(__dirname, "unpack-foreign-tarball")
+var root = path.resolve(dir, "root")
+var nm = path.resolve(root, "node_modules")
+var cache = path.resolve(dir, "cache")
+var tmp = path.resolve(dir, "tmp")
+var pkg = path.resolve(nm, "npm-test-gitignore")
+
+var env = {
+ npm_config_cache: cache,
+ npm_config_tmp: tmp
+}
+
+var conf = {
+ env: env,
+ cwd: root,
+ stdio: [ "pipe", "pipe", 2 ]
+}
+
+test("npmignore only", function (t) {
+ setup()
+ var file = path.resolve(dir, "npmignore.tgz")
+ common.npm(["install", file], conf, function (code, stdout, stderr) {
+ verify(t, code, ["foo"])
+ })
+})
+
+test("gitignore only", function (t) {
+ setup()
+ var file = path.resolve(dir, "gitignore.tgz")
+ common.npm(["install", file], conf, function (code, stdout, stderr) {
+ verify(t, code, ["foo"])
+ })
+})
+
+test("gitignore and npmignore", function (t) {
+ setup()
+ var file = path.resolve(dir, "gitignore-and-npmignore.tgz")
+ common.npm(["install", file], conf, function (code, stdout, stderr) {
+ verify(t, code, ["foo", "bar"])
+ })
+})
+
+test("gitignore and npmignore, not gzipped", function (t) {
+ setup()
+ var file = path.resolve(dir, "gitignore-and-npmignore.tar")
+ common.npm(["install", file], conf, function (code, stdout, stderr) {
+ verify(t, code, ["foo", "bar"])
+ })
+})
+
+test("clean", function (t) {
+ clean()
+ t.end()
+})
+
+function verify (t, code, files) {
+ if (code) {
+ t.fail("exited with failure: " + code)
+ return t.end()
+ }
+ var actual = fs.readdirSync(pkg).sort()
+ var expect = files.concat([".npmignore", "package.json"]).sort()
+ t.same(actual, expect)
+ t.end()
+}
+
+function setup () {
+ clean()
+ mkdirp.sync(nm)
+ mkdirp.sync(cache)
+ mkdirp.sync(tmp)
+}
+
+function clean () {
+ rimraf.sync(root)
+ rimraf.sync(cache)
+ rimraf.sync(tmp)
+}