Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update npm to 1.1.0-alpha-2

  • Loading branch information...
commit 3ab15cde2516564a2bc4fe6246fe447f07752ed4 1 parent 0ba78d5
@isaacs isaacs authored
Showing with 1,630 additions and 6,819 deletions.
  1. +3 −0  deps/npm/.gitmodules
  2. +4 −4 deps/npm/doc/cli/coding-style.md
  3. +1 −1  deps/npm/lib/completion.js
  4. +4 −8 deps/npm/lib/utils/tar.js
  5. +23 −0 deps/npm/node_modules/abbrev/LICENSE
  6. +3 −0  deps/npm/node_modules/abbrev/package.json
  7. +0 −68 deps/npm/node_modules/block-stream/bench/block-stream.js
  8. +0 −70 deps/npm/node_modules/block-stream/bench/dropper-pause.js
  9. +0 −68 deps/npm/node_modules/block-stream/bench/dropper.js
  10. +0 −27 deps/npm/node_modules/block-stream/test/basic.js
  11. +0 −68 deps/npm/node_modules/block-stream/test/nopad-thorough.js
  12. +0 −57 deps/npm/node_modules/block-stream/test/nopad.js
  13. +0 −73 deps/npm/node_modules/block-stream/test/pause-resume.js
  14. +0 −68 deps/npm/node_modules/block-stream/test/thorough.js
  15. +111 −0 deps/npm/node_modules/fast-list/README.md
  16. +55 −0 deps/npm/node_modules/fast-list/bench.js
  17. +90 −0 deps/npm/node_modules/fast-list/fast-list.js
  18. +20 −0 deps/npm/node_modules/fast-list/package.json
  19. +0 −113 deps/npm/node_modules/fstream/examples/pipe.js
  20. +0 −29 deps/npm/node_modules/fstream/examples/reader.js
  21. +0 −9 deps/npm/node_modules/fstream/examples/symlink-write.js
  22. +1 −11 deps/npm/node_modules/fstream/lib/writer.js
  23. +3 −3 deps/npm/node_modules/fstream/package.json
  24. +184 −34 deps/npm/node_modules/graceful-fs/graceful-fs.js
  25. +5 −3 deps/npm/node_modules/graceful-fs/package.json
  26. +0 −18 deps/npm/node_modules/ini/test/fixtures/foo.ini
  27. +0 −40 deps/npm/node_modules/ini/test/foo.js
  28. +0 −141 deps/npm/node_modules/minimatch/test/basic.js
  29. +0 −6 deps/npm/node_modules/mkdirp/examples/pow.js
  30. +0 −39 deps/npm/node_modules/mkdirp/test/chmod.js
  31. +0 −37 deps/npm/node_modules/mkdirp/test/clobber.js
  32. +0 −28 deps/npm/node_modules/mkdirp/test/mkdirp.js
  33. +0 −41 deps/npm/node_modules/mkdirp/test/race.js
  34. +0 −32 deps/npm/node_modules/mkdirp/test/rel.js
  35. +2 −0  deps/npm/node_modules/node-uuid/.gitignore
  36. +162 −67 deps/npm/node_modules/node-uuid/README.md
  37. +53 −0 deps/npm/node_modules/node-uuid/benchmark/README.md
  38. +175 −0 deps/npm/node_modules/node-uuid/benchmark/bench.gnu
  39. +34 −0 deps/npm/node_modules/node-uuid/benchmark/bench.sh
  40. 0  deps/npm/node_modules/node-uuid/{test → benchmark}/benchmark-native.c
  41. +52 −0 deps/npm/node_modules/node-uuid/benchmark/benchmark.js
  42. +5 −3 deps/npm/node_modules/node-uuid/package.json
  43. +0 −27 deps/npm/node_modules/node-uuid/test/benchmark.js
  44. +0 −14 deps/npm/node_modules/node-uuid/test/test.html
  45. +0 −83 deps/npm/node_modules/node-uuid/test/test.js
  46. +231 −56 deps/npm/node_modules/node-uuid/uuid.js
  47. +3 −1 deps/npm/node_modules/nopt/README.md
  48. +0 −30 deps/npm/node_modules/nopt/examples/my-program.js
  49. +92 −0 deps/npm/node_modules/request/README.md
  50. +113 −9 deps/npm/node_modules/request/main.js
  51. +23 −0 deps/npm/node_modules/request/oauth.js
  52. +1 −1  deps/npm/node_modules/request/package.json
  53. BIN  deps/npm/node_modules/request/tests/googledoodle.png
  54. +0 −6 deps/npm/node_modules/request/tests/run.sh
  55. +0 −57 deps/npm/node_modules/request/tests/server.js
  56. +0 −90 deps/npm/node_modules/request/tests/test-body.js
  57. +0 −30 deps/npm/node_modules/request/tests/test-errors.js
  58. +0 −167 deps/npm/node_modules/request/tests/test-pipes.js
  59. +0 −87 deps/npm/node_modules/request/tests/test-timeout.js
  60. +19 −0 deps/npm/node_modules/request/uuid.js
  61. +57 −0 deps/npm/node_modules/request/vendor/cookie/index.js
  62. +72 −0 deps/npm/node_modules/request/vendor/cookie/jar.js
  63. +0 −10 deps/npm/node_modules/rimraf/test/run.sh
  64. +0 −47 deps/npm/node_modules/rimraf/test/setup.sh
  65. +0 −5 deps/npm/node_modules/rimraf/test/test-async.js
  66. +0 −15 deps/npm/node_modules/rimraf/test/test-fiber.js
  67. +0 −3  deps/npm/node_modules/rimraf/test/test-sync.js
  68. +0 −397 deps/npm/node_modules/semver/test.js
  69. +0 −11 deps/npm/node_modules/tar/examples/extracter.js
  70. +0 −36 deps/npm/node_modules/tar/examples/reader.js
  71. +3 −0  deps/npm/node_modules/tar/lib/entry-writer.js
  72. +17 −3 deps/npm/node_modules/tar/lib/extended-header-writer.js
  73. +0 −1  deps/npm/node_modules/tar/old/README.md
  74. +0 −24 deps/npm/node_modules/tar/old/doc/example.js
  75. +0 −387 deps/npm/node_modules/tar/old/generator.js
  76. +0 −344 deps/npm/node_modules/tar/old/parser.js
  77. +0 −74 deps/npm/node_modules/tar/old/tar.js
  78. +0 −13 deps/npm/node_modules/tar/old/test/test-generator.js
  79. BIN  deps/npm/node_modules/tar/old/test/test-generator.tar
  80. BIN  deps/npm/node_modules/tar/old/test/test-generator.txt
  81. +0 −28 deps/npm/node_modules/tar/old/test/test-parser.js
  82. BIN  deps/npm/node_modules/tar/old/test/test-tar.tar
  83. BIN  deps/npm/node_modules/tar/old/test/test-tar.txt
  84. +2 −2 deps/npm/node_modules/tar/package.json
  85. +0 −406 deps/npm/node_modules/tar/test/extract.js
  86. BIN  deps/npm/node_modules/tar/test/fixtures/200.tar
  87. +0 −50 deps/npm/node_modules/tar/test/fixtures/200L.hex
  88. +0 −1  ...ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  89. BIN  deps/npm/node_modules/tar/test/fixtures/200longlink.tar
  90. BIN  deps/npm/node_modules/tar/test/fixtures/200longname.tar
  91. +0 −14 deps/npm/node_modules/tar/test/fixtures/a.hex
  92. BIN  deps/npm/node_modules/tar/test/fixtures/a.tar
  93. +0 −1  deps/npm/node_modules/tar/test/fixtures/a.txt
  94. +0 −14 deps/npm/node_modules/tar/test/fixtures/b.hex
  95. BIN  deps/npm/node_modules/tar/test/fixtures/b.tar
  96. +0 −1  deps/npm/node_modules/tar/test/fixtures/b.txt
  97. +0 −74 deps/npm/node_modules/tar/test/fixtures/c.hex
  98. BIN  deps/npm/node_modules/tar/test/fixtures/c.tar
  99. +0 −1  deps/npm/node_modules/tar/test/fixtures/c.txt
  100. +0 −1  deps/npm/node_modules/tar/test/fixtures/cc.txt
  101. +0 −14 deps/npm/node_modules/tar/test/fixtures/foo.hex
  102. +0 −1  deps/npm/node_modules/tar/test/fixtures/foo.js
  103. BIN  deps/npm/node_modules/tar/test/fixtures/foo.tar
  104. +0 −1  deps/npm/node_modules/tar/test/fixtures/hardlink-1
  105. +0 −1  deps/npm/node_modules/tar/test/fixtures/hardlink-2
  106. +0 −22 deps/npm/node_modules/tar/test/fixtures/omega.hex
  107. BIN  deps/npm/node_modules/tar/test/fixtures/omega.tar
  108. +0 −1  deps/npm/node_modules/tar/test/fixtures/omega.txt
  109. BIN  deps/npm/node_modules/tar/test/fixtures/omegapax.tar
  110. +0 −1  deps/npm/node_modules/tar/test/fixtures/packtest/omega.txt
  111. +0 −1,184 deps/npm/node_modules/tar/test/fixtures/packtest/star.4.html
  112. +0 −1  deps/npm/node_modules/tar/test/fixtures/packtest/Ω.txt
  113. +0 −1  .../a/t/h/cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
  114. +0 −1  deps/npm/node_modules/tar/test/fixtures/symlink
  115. +0 −1  deps/npm/node_modules/tar/test/fixtures/Ω.txt
  116. +0 −183 deps/npm/node_modules/tar/test/header.js
  117. +0 −953 deps/npm/node_modules/tar/test/pack.js
  118. +0 −359 deps/npm/node_modules/tar/test/parse.js
  119. +7 −5 deps/npm/package.json
  120. +0 −7 deps/npm/test/common.js
  121. +0 −4 deps/npm/test/disabled/bundlerecurs/package.json
  122. +0 −5 deps/npm/test/disabled/failer/package.json
  123. +0 −9 deps/npm/test/disabled/fast/package.json
  124. +0 −4 deps/npm/test/disabled/package-config/package.json
  125. +0 −17 deps/npm/test/disabled/package-config/test.js
  126. +0 −9 deps/npm/test/disabled/slow/package.json
  127. +0 −3  deps/npm/test/disabled/startstop/package.json
  128. +0 −4 deps/npm/test/packages/npm-test-blerg/package.json
  129. +0 −5 deps/npm/test/packages/npm-test-blerg/test.js
  130. +0 −14 deps/npm/test/packages/npm-test-env-reader/package.json
  131. +0 −3  deps/npm/test/packages/npm-test-env-reader/test.sh
  132. +0 −4 deps/npm/test/packages/npm-test-missing-bindir/package.json
  133. +0 −5 deps/npm/test/packages/npm-test-missing-bindir/test.js
  134. +0 −4 deps/npm/test/packages/npm-test-private/package.json
  135. +0 −5 deps/npm/test/packages/npm-test-test-package/package.json
  136. +0 −4 deps/npm/test/packages/npm-test-url-dep/package.json
  137. +0 −138 deps/npm/test/run
  138. +0 −59 deps/npm/test/update-test.sh
View
3  deps/npm/.gitmodules
@@ -49,3 +49,6 @@
[submodule "node_modules/mkdirp"]
path = node_modules/mkdirp
url = git://github.com/isaacs/node-mkdirp.git
+[submodule "node_modules/fast-list"]
+ path = node_modules/fast-list
+ url = git://github.com/isaacs/fast-list.git
View
8 deps/npm/doc/cli/coding-style.md
@@ -155,16 +155,16 @@ Use appropriate log levels. The default log() function logs at the
## Case, naming, etc.
-Use lowerCamelCase for multiword identifiers when they refer to objects,
+Use `lowerCamelCase` for multiword identifiers when they refer to objects,
functions, methods, members, or anything not specified in this section.
-Use UpperCamelCase for class names (things that you'd pass to "new").
+Use `UpperCamelCase` for class names (things that you'd pass to "new").
-Use all-lower-hyphen-css-case for multiword filenames and config keys.
+Use `all-lower-hyphen-css-case` for multiword filenames and config keys.
Use named functions. They make stack traces easier to follow.
-Use CAPS_SNAKE_CASE for constants, things that should never change
+Use `CAPS_SNAKE_CASE` for constants, things that should never change
and are rarely used.
Use a single uppercase letter for function names where the function
View
2  deps/npm/lib/completion.js
@@ -20,7 +20,7 @@ var output = require("./utils/output.js")
completion.completion = function (opts, cb) {
if (opts.w > 3) return cb()
- var fs = require("fs")
+ var fs = require("graceful-fs")
, path = require("path")
, bashExists = null
, zshExists = null
View
12 deps/npm/lib/utils/tar.js
@@ -76,16 +76,10 @@ function packFiles (targetTarball, parent, files, pkg, cb) {
, path: parent
, filter: function () {
return -1 !== files.indexOf(this.path)
- // || (this.type === "Directory" &&
- // this.basename !== ".git")
-
}
})
.on("error", log.er(cb, "error reading "+parent))
- .on("entry", function E (entry) {
- entry.on("entry", E)
- })
- .pipe(tar.Pack({}))
+ .pipe(tar.Pack())
.on("error", log.er(cb, "tar creation error "+targetTarball))
.pipe(zlib.Gzip())
.on("error", log.er(cb, "gzip error "+targetTarball))
@@ -155,8 +149,9 @@ function gunzTarPerm (tarball, tmp, dMode, fMode, uid, gid, cb) {
log.silly([dMode.toString(8), fMode.toString(8)], "gunzTarPerm modes")
fs.createReadStream(tarball)
+ .on("error", log.er(cb, "error reading "+tarball))
.pipe(zlib.Unzip())
- .on("error", log.er(cb, "unzip error"))
+ .on("error", log.er(cb, "unzip error "+tarball))
.pipe(tar.Extract({ type: "Directory", path: tmp }))
.on("error", log.er(cb, "Failed unpacking "+tarball))
.on("close", afterUntar)
@@ -165,6 +160,7 @@ function gunzTarPerm (tarball, tmp, dMode, fMode, uid, gid, cb) {
// XXX Do all this in an Extract filter.
//
function afterUntar (er) {
+ log.silly(er, "afterUntar")
// if we're not doing ownership management,
// then we're done now.
if (er) return log.er(cb, "Failed unpacking "+tarball)(er)
View
23 deps/npm/node_modules/abbrev/LICENSE
@@ -0,0 +1,23 @@
+Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
+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 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.
View
3  deps/npm/node_modules/abbrev/package.json
@@ -5,4 +5,7 @@
, "main" : "./lib/abbrev.js"
, "scripts" : { "test" : "node lib/abbrev.js" }
, "repository" : "http://github.com/isaacs/abbrev-js"
+, "license" :
+ { "type" : "MIT"
+ , "url" : "https://github.com/isaacs/abbrev-js/raw/master/LICENSE" }
}
View
68 deps/npm/node_modules/block-stream/bench/block-stream.js
@@ -1,68 +0,0 @@
-var BlockStream = require("../block-stream.js")
-
-var blockSizes = [16, 25, 1024]
- , writeSizes = [4, 8, 15, 16, 17, 64, 100]
- , writeCounts = [1, 10, 100]
- , tap = require("tap")
-
-writeCounts.forEach(function (writeCount) {
-blockSizes.forEach(function (blockSize) {
-writeSizes.forEach(function (writeSize) {
- tap.test("writeSize=" + writeSize +
- " blockSize="+blockSize +
- " writeCount="+writeCount, function (t) {
- var f = new BlockStream(blockSize, {nopad: true })
-
- var actualChunks = 0
- var actualBytes = 0
- var timeouts = 0
-
- f.on("data", function (c) {
- timeouts ++
-
- actualChunks ++
- actualBytes += c.length
-
- // make sure that no data gets corrupted, and basic sanity
- var before = c.toString()
- // simulate a slow write operation
- setTimeout(function () {
- timeouts --
-
- var after = c.toString()
- t.equal(after, before, "should not change data")
-
- // now corrupt it, to find leaks.
- for (var i = 0; i < c.length; i ++) {
- c[i] = "x".charCodeAt(0)
- }
- }, 100)
- })
-
- f.on("end", function () {
- // round up to the nearest block size
- var expectChunks = Math.ceil(writeSize * writeCount * 2 / blockSize)
- var expectBytes = writeSize * writeCount * 2
- t.equal(actualBytes, expectBytes,
- "bytes=" + expectBytes + " writeSize=" + writeSize)
- t.equal(actualChunks, expectChunks,
- "chunks=" + expectChunks + " writeSize=" + writeSize)
-
- // wait for all the timeout checks to finish, then end the test
- setTimeout(function WAIT () {
- if (timeouts > 0) return setTimeout(WAIT)
- t.end()
- }, 100)
- })
-
- for (var i = 0; i < writeCount; i ++) {
- var a = new Buffer(writeSize);
- for (var j = 0; j < writeSize; j ++) a[j] = "a".charCodeAt(0)
- var b = new Buffer(writeSize);
- for (var j = 0; j < writeSize; j ++) b[j] = "b".charCodeAt(0)
- f.write(a)
- f.write(b)
- }
- f.end()
- })
-}) }) })
View
70 deps/npm/node_modules/block-stream/bench/dropper-pause.js
@@ -1,70 +0,0 @@
-var BlockStream = require("dropper")
-
-var blockSizes = [16, 25, 1024]
- , writeSizes = [4, 8, 15, 16, 17, 64, 100]
- , writeCounts = [1, 10, 100]
- , tap = require("tap")
-
-writeCounts.forEach(function (writeCount) {
-blockSizes.forEach(function (blockSize) {
-writeSizes.forEach(function (writeSize) {
- tap.test("writeSize=" + writeSize +
- " blockSize="+blockSize +
- " writeCount="+writeCount, function (t) {
- var f = new BlockStream(blockSize, {nopad: true })
-
- var actualChunks = 0
- var actualBytes = 0
- var timeouts = 0
-
- f.on("data", function (c) {
- timeouts ++
-
- actualChunks ++
- actualBytes += c.length
-
- // make sure that no data gets corrupted, and basic sanity
- var before = c.toString()
- // simulate a slow write operation
- f.pause()
- setTimeout(function () {
- timeouts --
-
- var after = c.toString()
- t.equal(after, before, "should not change data")
-
- // now corrupt it, to find leaks.
- for (var i = 0; i < c.length; i ++) {
- c[i] = "x".charCodeAt(0)
- }
- f.resume()
- }, 100)
- })
-
- f.on("end", function () {
- // round up to the nearest block size
- var expectChunks = Math.ceil(writeSize * writeCount * 2 / blockSize)
- var expectBytes = writeSize * writeCount * 2
- t.equal(actualBytes, expectBytes,
- "bytes=" + expectBytes + " writeSize=" + writeSize)
- t.equal(actualChunks, expectChunks,
- "chunks=" + expectChunks + " writeSize=" + writeSize)
-
- // wait for all the timeout checks to finish, then end the test
- setTimeout(function WAIT () {
- if (timeouts > 0) return setTimeout(WAIT)
- t.end()
- }, 100)
- })
-
- for (var i = 0; i < writeCount; i ++) {
- var a = new Buffer(writeSize);
- for (var j = 0; j < writeSize; j ++) a[j] = "a".charCodeAt(0)
- var b = new Buffer(writeSize);
- for (var j = 0; j < writeSize; j ++) b[j] = "b".charCodeAt(0)
- f.write(a)
- f.write(b)
- }
- f.end()
- })
-}) }) })
View
68 deps/npm/node_modules/block-stream/bench/dropper.js
@@ -1,68 +0,0 @@
-var BlockStream = require("dropper")
-
-var blockSizes = [16, 25, 1024]
- , writeSizes = [4, 8, 15, 16, 17, 64, 100]
- , writeCounts = [1, 10, 100]
- , tap = require("tap")
-
-writeCounts.forEach(function (writeCount) {
-blockSizes.forEach(function (blockSize) {
-writeSizes.forEach(function (writeSize) {
- tap.test("writeSize=" + writeSize +
- " blockSize="+blockSize +
- " writeCount="+writeCount, function (t) {
- var f = new BlockStream(blockSize, {nopad: true })
-
- var actualChunks = 0
- var actualBytes = 0
- var timeouts = 0
-
- f.on("data", function (c) {
- timeouts ++
-
- actualChunks ++
- actualBytes += c.length
-
- // make sure that no data gets corrupted, and basic sanity
- var before = c.toString()
- // simulate a slow write operation
- setTimeout(function () {
- timeouts --
-
- var after = c.toString()
- t.equal(after, before, "should not change data")
-
- // now corrupt it, to find leaks.
- for (var i = 0; i < c.length; i ++) {
- c[i] = "x".charCodeAt(0)
- }
- }, 100)
- })
-
- f.on("end", function () {
- // round up to the nearest block size
- var expectChunks = Math.ceil(writeSize * writeCount * 2 / blockSize)
- var expectBytes = writeSize * writeCount * 2
- t.equal(actualBytes, expectBytes,
- "bytes=" + expectBytes + " writeSize=" + writeSize)
- t.equal(actualChunks, expectChunks,
- "chunks=" + expectChunks + " writeSize=" + writeSize)
-
- // wait for all the timeout checks to finish, then end the test
- setTimeout(function WAIT () {
- if (timeouts > 0) return setTimeout(WAIT)
- t.end()
- }, 100)
- })
-
- for (var i = 0; i < writeCount; i ++) {
- var a = new Buffer(writeSize);
- for (var j = 0; j < writeSize; j ++) a[j] = "a".charCodeAt(0)
- var b = new Buffer(writeSize);
- for (var j = 0; j < writeSize; j ++) b[j] = "b".charCodeAt(0)
- f.write(a)
- f.write(b)
- }
- f.end()
- })
-}) }) })
View
27 deps/npm/node_modules/block-stream/test/basic.js
@@ -1,27 +0,0 @@
-var tap = require("tap")
- , BlockStream = require("../block-stream.js")
-
-tap.test("basic test", function (t) {
- var b = new BlockStream(16)
- var fs = require("fs")
- var fstr = fs.createReadStream(__filename, {encoding: "utf8"})
- fstr.pipe(b)
-
- var stat
- t.doesNotThrow(function () {
- stat = fs.statSync(__filename)
- }, "stat should not throw")
-
- var totalBytes = 0
- b.on("data", function (c) {
- t.equal(c.length, 16, "chunks should be 16 bytes long")
- t.type(c, Buffer, "chunks should be buffer objects")
- totalBytes += c.length
- })
- b.on("end", function () {
- var expectedBytes = stat.size + (16 - stat.size % 16)
- t.equal(totalBytes, expectedBytes, "Should be multiple of 16")
- t.end()
- })
-
-})
View
68 deps/npm/node_modules/block-stream/test/nopad-thorough.js
@@ -1,68 +0,0 @@
-var BlockStream = require("../block-stream.js")
-
-var blockSizes = [16, 25, 1024]
- , writeSizes = [4, 8, 15, 16, 17, 64, 100]
- , writeCounts = [1, 10, 100]
- , tap = require("tap")
-
-writeCounts.forEach(function (writeCount) {
-blockSizes.forEach(function (blockSize) {
-writeSizes.forEach(function (writeSize) {
- tap.test("writeSize=" + writeSize +
- " blockSize="+blockSize +
- " writeCount="+writeCount, function (t) {
- var f = new BlockStream(blockSize, {nopad: true })
-
- var actualChunks = 0
- var actualBytes = 0
- var timeouts = 0
-
- f.on("data", function (c) {
- timeouts ++
-
- actualChunks ++
- actualBytes += c.length
-
- // make sure that no data gets corrupted, and basic sanity
- var before = c.toString()
- // simulate a slow write operation
- setTimeout(function () {
- timeouts --
-
- var after = c.toString()
- t.equal(after, before, "should not change data")
-
- // now corrupt it, to find leaks.
- for (var i = 0; i < c.length; i ++) {
- c[i] = "x".charCodeAt(0)
- }
- }, 100)
- })
-
- f.on("end", function () {
- // round up to the nearest block size
- var expectChunks = Math.ceil(writeSize * writeCount * 2 / blockSize)
- var expectBytes = writeSize * writeCount * 2
- t.equal(actualBytes, expectBytes,
- "bytes=" + expectBytes + " writeSize=" + writeSize)
- t.equal(actualChunks, expectChunks,
- "chunks=" + expectChunks + " writeSize=" + writeSize)
-
- // wait for all the timeout checks to finish, then end the test
- setTimeout(function WAIT () {
- if (timeouts > 0) return setTimeout(WAIT)
- t.end()
- }, 100)
- })
-
- for (var i = 0; i < writeCount; i ++) {
- var a = new Buffer(writeSize);
- for (var j = 0; j < writeSize; j ++) a[j] = "a".charCodeAt(0)
- var b = new Buffer(writeSize);
- for (var j = 0; j < writeSize; j ++) b[j] = "b".charCodeAt(0)
- f.write(a)
- f.write(b)
- }
- f.end()
- })
-}) }) })
View
57 deps/npm/node_modules/block-stream/test/nopad.js
@@ -1,57 +0,0 @@
-var BlockStream = require("../")
-var tap = require("tap")
-
-
-tap.test("don't pad, small writes", function (t) {
- var f = new BlockStream(16, { nopad: true })
- t.plan(1)
-
- f.on("data", function (c) {
- t.equal(c.toString(), "abc", "should get 'abc'")
- })
-
- f.on("end", function () { t.end() })
-
- f.write(new Buffer("a"))
- f.write(new Buffer("b"))
- f.write(new Buffer("c"))
- f.end()
-})
-
-tap.test("don't pad, exact write", function (t) {
- var f = new BlockStream(16, { nopad: true })
- t.plan(1)
-
- var first = true
- f.on("data", function (c) {
- if (first) {
- first = false
- t.equal(c.toString(), "abcdefghijklmnop", "first chunk")
- } else {
- t.fail("should only get one")
- }
- })
-
- f.on("end", function () { t.end() })
-
- f.end(new Buffer("abcdefghijklmnop"))
-})
-
-tap.test("don't pad, big write", function (t) {
- var f = new BlockStream(16, { nopad: true })
- t.plan(2)
-
- var first = true
- f.on("data", function (c) {
- if (first) {
- first = false
- t.equal(c.toString(), "abcdefghijklmnop", "first chunk")
- } else {
- t.equal(c.toString(), "q")
- }
- })
-
- f.on("end", function () { t.end() })
-
- f.end(new Buffer("abcdefghijklmnopq"))
-})
View
73 deps/npm/node_modules/block-stream/test/pause-resume.js
@@ -1,73 +0,0 @@
-var BlockStream = require("../block-stream.js")
-
-var blockSizes = [16]
- , writeSizes = [15, 16, 17]
- , writeCounts = [1, 10, 100]
- , tap = require("tap")
-
-writeCounts.forEach(function (writeCount) {
-blockSizes.forEach(function (blockSize) {
-writeSizes.forEach(function (writeSize) {
- tap.test("writeSize=" + writeSize +
- " blockSize="+blockSize +
- " writeCount="+writeCount, function (t) {
- var f = new BlockStream(blockSize)
-
- var actualChunks = 0
- var actualBytes = 0
- var timeouts = 0
- var paused = false
-
- f.on("data", function (c) {
- timeouts ++
- t.notOk(paused, "should not be paused when emitting data")
-
- actualChunks ++
- actualBytes += c.length
-
- // make sure that no data gets corrupted, and basic sanity
- var before = c.toString()
- // simulate a slow write operation
- paused = true
- f.pause()
- process.nextTick(function () {
- var after = c.toString()
- t.equal(after, before, "should not change data")
-
- // now corrupt it, to find leaks.
- for (var i = 0; i < c.length; i ++) {
- c[i] = "x".charCodeAt(0)
- }
- paused = false
- f.resume()
- timeouts --
- })
- })
-
- f.on("end", function () {
- // round up to the nearest block size
- var expectChunks = Math.ceil(writeSize * writeCount * 2 / blockSize)
- var expectBytes = expectChunks * blockSize
- t.equal(actualBytes, expectBytes,
- "bytes=" + expectBytes + " writeSize=" + writeSize)
- t.equal(actualChunks, expectChunks,
- "chunks=" + expectChunks + " writeSize=" + writeSize)
-
- // wait for all the timeout checks to finish, then end the test
- setTimeout(function WAIT () {
- if (timeouts > 0) return setTimeout(WAIT)
- t.end()
- }, 200)
- })
-
- for (var i = 0; i < writeCount; i ++) {
- var a = new Buffer(writeSize);
- for (var j = 0; j < writeSize; j ++) a[j] = "a".charCodeAt(0)
- var b = new Buffer(writeSize);
- for (var j = 0; j < writeSize; j ++) b[j] = "b".charCodeAt(0)
- f.write(a)
- f.write(b)
- }
- f.end()
- })
-}) }) })
View
68 deps/npm/node_modules/block-stream/test/thorough.js
@@ -1,68 +0,0 @@
-var BlockStream = require("../block-stream.js")
-
-var blockSizes = [16, 25, 1024]
- , writeSizes = [4, 8, 15, 16, 17, 64, 100]
- , writeCounts = [1, 10, 100]
- , tap = require("tap")
-
-writeCounts.forEach(function (writeCount) {
-blockSizes.forEach(function (blockSize) {
-writeSizes.forEach(function (writeSize) {
- tap.test("writeSize=" + writeSize +
- " blockSize="+blockSize +
- " writeCount="+writeCount, function (t) {
- var f = new BlockStream(blockSize)
-
- var actualChunks = 0
- var actualBytes = 0
- var timeouts = 0
-
- f.on("data", function (c) {
- timeouts ++
-
- actualChunks ++
- actualBytes += c.length
-
- // make sure that no data gets corrupted, and basic sanity
- var before = c.toString()
- // simulate a slow write operation
- setTimeout(function () {
- timeouts --
-
- var after = c.toString()
- t.equal(after, before, "should not change data")
-
- // now corrupt it, to find leaks.
- for (var i = 0; i < c.length; i ++) {
- c[i] = "x".charCodeAt(0)
- }
- }, 100)
- })
-
- f.on("end", function () {
- // round up to the nearest block size
- var expectChunks = Math.ceil(writeSize * writeCount * 2 / blockSize)
- var expectBytes = expectChunks * blockSize
- t.equal(actualBytes, expectBytes,
- "bytes=" + expectBytes + " writeSize=" + writeSize)
- t.equal(actualChunks, expectChunks,
- "chunks=" + expectChunks + " writeSize=" + writeSize)
-
- // wait for all the timeout checks to finish, then end the test
- setTimeout(function WAIT () {
- if (timeouts > 0) return setTimeout(WAIT)
- t.end()
- }, 100)
- })
-
- for (var i = 0; i < writeCount; i ++) {
- var a = new Buffer(writeSize);
- for (var j = 0; j < writeSize; j ++) a[j] = "a".charCodeAt(0)
- var b = new Buffer(writeSize);
- for (var j = 0; j < writeSize; j ++) b[j] = "b".charCodeAt(0)
- f.write(a)
- f.write(b)
- }
- f.end()
- })
-}) }) })
View
111 deps/npm/node_modules/fast-list/README.md
@@ -0,0 +1,111 @@
+# The Problem
+
+You've got some thing where you need to push a bunch of stuff into a
+queue and then shift it out. Or, maybe it's a stack, and you're just
+pushing and popping it.
+
+Arrays work for this, but are a bit costly performance-wise.
+
+# The Solution
+
+A linked-list implementation that takes advantage of what v8 is good at:
+creating objects with a known shape.
+
+This is faster for this use case. How much faster? About 50%.
+
+ $ node bench.js
+ benchmarking /Users/isaacs/dev-src/js/fast-list/bench.js
+ Please be patient.
+ { node: '0.6.2-pre',
+ v8: '3.6.6.8',
+ ares: '1.7.5-DEV',
+ uv: '0.1',
+ openssl: '0.9.8l' }
+ Scores: (bigger is better)
+
+ new FastList()
+ Raw:
+ > 22556.39097744361
+ > 23054.755043227666
+ > 22770.398481973436
+ > 23414.634146341465
+ > 23099.133782483157
+ Average (mean) 22979.062486293868
+
+ []
+ Raw:
+ > 12195.121951219513
+ > 12184.508268059182
+ > 12173.91304347826
+ > 12216.404886561955
+ > 12184.508268059182
+ Average (mean) 12190.891283475617
+
+ new Array()
+ Raw:
+ > 12131.715771230503
+ > 12184.508268059182
+ > 12216.404886561955
+ > 12195.121951219513
+ > 11940.298507462687
+ Average (mean) 12133.609876906768
+
+ Winner: new FastList()
+ Compared with next highest ([]), it's:
+ 46.95% faster
+ 1.88 times as fast
+ 0.28 order(s) of magnitude faster
+
+ Compared with the slowest (new Array()), it's:
+ 47.2% faster
+ 1.89 times as fast
+ 0.28 order(s) of magnitude faster
+
+This lacks a lot of features that arrays have:
+
+1. You can't specify the size at the outset.
+2. It's not indexable.
+3. There's no join, concat, etc.
+
+If any of this matters for your use case, you're probably better off
+using an Array object.
+
+## Installing
+
+```
+npm install fast-list
+```
+
+## API
+
+```javascript
+var FastList = require("fast-list")
+var list = new FastList()
+list.push("foo")
+list.unshift("bar")
+list.push("baz")
+console.log(list.length) // 2
+console.log(list.pop()) // baz
+console.log(list.shift()) // bar
+console.log(list.shift()) // foo
+```
+
+### Methods
+
+* `push`: Just like Array.push, but only can take a single entry
+* `pop`: Just like Array.pop
+* `shift`: Just like Array.shift
+* `unshift`: Just like Array.unshift, but only can take a single entry
+* `drop`: Drop all entries
+* `item(n)`: Retrieve the nth item in the list. This involves a walk
+ every time. It's very slow. If you find yourself using this,
+ consider using a normal Array instead.
+* `slice(start, end)`: Retrieve an array of the items at this position.
+ This involves a walk every time. It's very slow. If you find
+ yourself using this, consider using a normal Array instead.
+
+### Members
+
+* `length`: The number of things in the list. Note that, unlike
+ Array.length, this is not a getter/setter, but rather a counter that
+ is internally managed. Setting it can only cause harm.
View
55 deps/npm/node_modules/fast-list/bench.js
@@ -0,0 +1,55 @@
+var bench = require("bench")
+
+var l = 1000
+ , FastList = require("./fast-list.js")
+
+exports.countPerLap = l * 2
+
+exports.compare =
+ { "[]": function () {
+ var list = []
+ for (var j = 0; j < l; j ++) {
+ if (j % 2) list.push(j)
+ else list.unshift(j)
+ }
+ for (var j = 0; j < l; j ++) {
+ if (j % 2) list.shift(j)
+ else list.pop(j)
+ }
+ }
+ , "new Array()": function () {
+ var list = new Array()
+ for (var j = 0; j < l; j ++) {
+ if (j % 2) list.push(j)
+ else list.unshift(j)
+ }
+ for (var j = 0; j < l; j ++) {
+ if (j % 2) list.shift(j)
+ else list.pop(j)
+ }
+ }
+ // , "FastList()": function () {
+ // var list = FastList()
+ // for (var j = 0; j < l; j ++) {
+ // if (j % 2) list.push(j)
+ // else list.unshift(j)
+ // }
+ // for (var j = 0; j < l; j ++) {
+ // if (j % 2) list.shift(j)
+ // else list.pop(j)
+ // }
+ // }
+ , "new FastList()": function () {
+ var list = new FastList()
+ for (var j = 0; j < l; j ++) {
+ if (j % 2) list.push(j)
+ else list.unshift(j)
+ }
+ for (var j = 0; j < l; j ++) {
+ if (j % 2) list.shift(j)
+ else list.pop(j)
+ }
+ }
+ }
+
+bench.runMain()
View
90 deps/npm/node_modules/fast-list/fast-list.js
@@ -0,0 +1,90 @@
+;(function() { // closure for web browsers
+
+function Item (data, prev, next) {
+ this.next = next
+ if (next) next.prev = this
+ this.prev = prev
+ if (prev) prev.next = this
+ this.data = data
+}
+
+function FastList () {
+ if (!(this instanceof FastList)) return new FastList
+ this._head = null
+ this._tail = null
+ this.length = 0
+}
+
+FastList.prototype =
+{ push: function (data) {
+ this._tail = new Item(data, this._tail, null)
+ if (!this._head) this._head = this._tail
+ this.length ++
+ }
+, pop: function () {
+ if (this.length === 0) return undefined
+ var t = this._tail
+ this._tail = t.prev
+ if (t.prev) {
+ t.prev = this._tail.next = null
+ }
+ this.length --
+ if (this.length === 1) this._head = this._tail
+ else if (this.length === 0) this._head = this._tail = null
+ return t.data
+ }
+, unshift: function (data) {
+ this._head = new Item(data, null, this._head)
+ if (!this._tail) this._tail = this._head
+ this.length ++
+ }
+, shift: function () {
+ if (this.length === 0) return undefined
+ var h = this._head
+ this._head = h.next
+ if (h.next) {
+ h.next = this._head.prev = null
+ }
+ this.length --
+ if (this.length === 1) this._tail = this._head
+ else if (this.length === 0) this._head = this._tail = null
+ return h.data
+ }
+, item: function (n) {
+ if (n < 0) n = this.length + n
+ var h = this._head
+ while (n-- > 0 && h) h = h.next
+ return h ? h.data : undefined
+ }
+, slice: function (n, m) {
+ if (!n) n = 0
+ if (!m) m = this.length
+ if (m < 0) m = this.length + m
+ if (n < 0) n = this.length + n
+
+ if (m <= n) {
+ throw new Error("invalid offset: "+n+","+m)
+ }
+
+ var len = m - n
+ , ret = new Array(len)
+ , i = 0
+ , h = this._head
+ while (n-- > 0 && h) h = h.next
+ while (i < len && h) {
+ ret[i++] = h.data
+ h = h.next
+ }
+ return ret
+ }
+, drop: function () {
+ FastList.call(this)
+ }
+}
+
+if ("undefined" !== typeof(exports)) module.exports = FastList
+else if ("function" === typeof(define) && define.amd) {
+ define("FastList", function() { return FastList })
+} else (function () { return this })().FastList = FastList
+
+})()
View
20 deps/npm/node_modules/fast-list/package.json
@@ -0,0 +1,20 @@
+{
+ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
+ "name": "fast-list",
+ "description": "A fast linked list (good for queues, stacks, etc.)",
+ "version": "1.0.1",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/isaacs/fast-list.git"
+ },
+ "main": "fast-list.js",
+ "dependencies": {},
+ "devDependencies": {
+ "bench": "~0.3.2",
+ "tap": "~0.1.0"
+ },
+ "scripts": {
+ "test": "node test.js",
+ "bench": "node bench.js"
+ }
+}
View
113 deps/npm/node_modules/fstream/examples/pipe.js
@@ -1,113 +0,0 @@
-var fstream = require("../fstream.js")
-var path = require("path")
-
-var r = fstream.Reader({ path: path.dirname(__dirname)
- , filter: function () {
- return !this.basename.match(/^\./) &&
- !this.basename.match(/^node_modules$/)
- !this.basename.match(/^deep-copy$/)
- }
- })
-
-var w = fstream.Writer({ path: path.resolve(__dirname, "deep-copy")
- , type: "Directory"
- })
-
-var indent = ""
-var escape = {}
-
-r.on("entry", appears)
-//r.on("ready", function () {
-// appears(r)
-//})
-
-function appears (entry) {
- console.error(indent + "a %s appears!", entry.type, entry.basename)
- if (foggy) {
- console.error("FOGGY!")
- var p = entry
- do {
- console.error(p.depth, p.path, p._paused)
- } while (p = p.parent)
-
- throw new Error("\033[mshould not have entries while foggy")
- }
- indent += "\t"
- entry.on("data", missile(entry))
- entry.on("end", runaway(entry))
- entry.on("entry", appears)
-}
-
-var foggy
-function missile (entry) {
- if (entry.type === "Directory") {
- var ended = false
- entry.once("end", function () { ended = true })
- return function (c) {
- // throw in some pathological pause()/resume() behavior
- // just for extra fun.
- process.nextTick(function () {
- if (!foggy && !ended) { // && Math.random() < 0.3) {
- console.error(indent +"%s casts a spell", entry.basename)
- console.error("\na slowing fog comes over the battlefield...\n\033[32m")
- entry.pause()
- entry.once("resume", liftFog)
- foggy = setTimeout(liftFog, 10)
-
- function liftFog (who) {
- if (!foggy) return
- if (who) {
- console.error("%s breaks the spell!", who && who.path)
- } else {
- console.error("the spell expires!")
- }
- console.error("\033[mthe fog lifts!\n")
- clearTimeout(foggy)
- foggy = null
- if (entry._paused) entry.resume()
- }
-
- }
- })
- }
- }
-
- return function (c) {
- var e = Math.random() < 0.5
- console.error(indent + "%s %s for %d damage!",
- entry.basename,
- e ? "is struck" : "fires a chunk",
- c.length)
- }
-}
-
-function runaway (entry) { return function () {
- var e = Math.random() < 0.5
- console.error(indent + "%s %s",
- entry.basename,
- e ? "turns to flee" : "is vanquished!")
- indent = indent.slice(0, -1)
-}}
-
-
-w.on("entry", attacks)
-//w.on("ready", function () { attacks(w) })
-function attacks (entry) {
- console.error(indent + "%s %s!", entry.basename,
- entry.type === "Directory" ? "calls for backup" : "attacks")
- entry.on("entry", attacks)
-}
-
-ended = false
-r.on("end", function () {
- if (foggy) clearTimeout(foggy)
- console.error("\033[mIT'S OVER!!")
- console.error("A WINNAR IS YOU!")
- ended = true
-})
-
-process.on("exit", function () {
- console.error("ended? "+ended)
-})
-r.pipe(w)
-
View
29 deps/npm/node_modules/fstream/examples/reader.js
@@ -1,29 +0,0 @@
-var fstream = require("../fstream.js")
-var path = require("path")
-
-var r = fstream.Reader({ path: path.dirname(__dirname)
- , filter: function () {
- return !this.basename.match(/^\./)
- }
- })
-
-console.error(r instanceof fstream.Reader)
-console.error(r instanceof require("stream").Stream)
-console.error(r instanceof require("events").EventEmitter)
-console.error(r.on)
-
-r.on("stat", function () {
- console.error("a %s !!!\t", r.type, r.path)
-})
-
-r.on("entries", function (entries) {
- console.error("\t" + entries.join("\n\t"))
-})
-
-r.on("entry", function (entry) {
- console.error("a %s !!!\t", entry.type, entry.path)
-})
-
-r.on("end", function () {
- console.error("IT'S OVER!!")
-})
View
9 deps/npm/node_modules/fstream/examples/symlink-write.js
@@ -1,9 +0,0 @@
-var fstream = require("../fstream.js")
-
-fstream
- .Writer({ path: "path/to/symlink"
- , linkpath: "./file"
- , isSymbolicLink: true
- , mode: "0755" // octal strings supported
- })
- .end()
View
12 deps/npm/node_modules/fstream/lib/writer.js
@@ -246,17 +246,7 @@ Writer.prototype._finish = function () {
? "utimes" : "lutimes"
if (utimes === "lutimes" && !fs[utimes]) {
- if (!fs.futimes) fs.ltimes = function (a, b, c, cb) { return cb() }
- else fs.lutimes = function (path, atime, mtime, cb) {
- var c = require("constants")
- fs.open(path, c.O_SYMLINK, function (er, fd) {
- if (er) return cb(er)
- fs.futimes(fd, atime, mtime, function (er) {
- if (er) return cb(er)
- fs.close(fd, cb)
- })
- })
- }
+ utimes = "utimes"
}
var curA = current.atime
View
6 deps/npm/node_modules/fstream/package.json
@@ -2,19 +2,19 @@
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
"name": "fstream",
"description": "Advanced file system stream things",
- "version": "0.0.1",
+ "version": "0.1.1",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/fstream.git"
},
"main": "fstream.js",
"engines": {
- "node": "0.5 || 0.6"
+ "node": "0.5 || 0.6 || 0.7"
},
"dependencies": {
"rimraf": "~1.0.8",
"mkdirp": "~0.1.0",
- "graceful-fs": "~1.0.1",
+ "graceful-fs": "1.1",
"inherits": "~1.0.0"
},
"devDependencies": {}
View
218 deps/npm/node_modules/graceful-fs/graceful-fs.js
@@ -1,39 +1,189 @@
-// wrapper around the non-sync fs functions to gracefully handle
-// having too many file descriptors open. Note that this is
-// *only* possible because async patterns let one interject timeouts
-// and other cleverness anywhere in the process without disrupting
-// anything else.
+// this keeps a queue of opened file descriptors, and will make
+// fs operations wait until some have closed before trying to open more.
var fs = require("fs")
- , timeout = 0
-
-Object.keys(fs)
- .forEach(function (i) {
- exports[i] = (typeof fs[i] !== "function") ? fs[i]
- : (i.match(/^[A-Z]|^create|Sync$/)) ? function () {
- return fs[i].apply(fs, arguments)
- }
- : graceful(fs[i])
+ , FastList = require("fast-list")
+ , queue = new FastList()
+ , curOpen = 0
+ , constants = require("constants")
+
+exports = module.exports = fs
+
+fs.MAX_OPEN = 256
+
+fs._open = fs.open
+fs._openSync = fs.openSync
+fs._close = fs.close
+fs._closeSync = fs.closeSync
+
+
+// lstat on windows, missing from early 0.5 versions
+if (process.platform === "win32" && !process.binding("fs").lstat) {
+ fs.lstat = fs.stat
+ fs.lstatSync = fs.statSync
+}
+
+// lutimes
+var constants = require("constants")
+if (!fs.lutimes) fs.lutimes = function (path, at, mt, cb) {
+ fs.open(path, constants.O_SYMLINK, function (er, fd) {
+ cb = cb || noop
+ if (er) return cb(er)
+ fs.futimes(fd, at, mt, function (er) {
+ if (er) {
+ fs.close(fd, function () {})
+ return cb(er)
+ }
+ fs.close(fd, cb)
+ })
+ })
+}
+
+if (!fs.lutimesSync) fs.lutimesSync = function (path, at, mt) {
+ var fd = fs.openSync(path, constants.O_SYMLINK)
+ fs.futimesSync(fd, at, mt)
+ fs.closeSync(fd)
+}
+
+
+// prevent EMFILE errors
+function OpenReq (path, flags, mode, cb) {
+ this.path = path
+ this.flags = flags
+ this.mode = mode
+ this.cb = cb
+}
+
+function noop () {}
+
+fs.open = function (path, flags, mode, cb) {
+ if (typeof mode === "function") cb = mode, mode = null
+ if (typeof cb !== "function") cb = noop
+
+ if (curOpen >= fs.MAX_OPEN) {
+ queue.push(new OpenReq(path, flags, mode, cb))
+ setTimeout(flush)
+ return
+ }
+ open(path, flags, mode, cb)
+}
+
+function open (path, flags, mode, cb) {
+ cb = cb || noop
+ curOpen ++
+ fs._open(path, flags, mode, function (er, fd) {
+ if (er) {
+ onclose()
+ }
+
+ cb(er, fd)
+ })
+}
+
+fs.openSync = function (path, flags, mode) {
+ curOpen ++
+ return fs._openSync(path, flags, mode)
+}
+
+function onclose () {
+ curOpen --
+ flush()
+}
+
+function flush () {
+ while (curOpen < fs.MAX_OPEN) {
+ var req = queue.shift()
+ if (!req) break
+ open(req.path, req.flags, req.mode, req.cb)
+ }
+ if (queue.length === 0) return
+}
+
+fs.close = function (fd, cb) {
+ cb = cb || noop
+ fs._close(fd, function (er) {
+ onclose()
+ cb(er)
})
+}
+
+fs.closeSync = function (fd) {
+ onclose()
+ return fs._closeSync(fd)
+}
-if (process.platform === "win32"
- && !process.binding("fs").lstat) {
- exports.lstat = exports.stat
- exports.lstatSync = exports.statSync
-}
-
-function graceful (fn) { return function GRACEFUL () {
- var args = Array.prototype.slice.call(arguments)
- , cb_ = args.pop()
- args.push(cb)
- function cb (er) {
- if (er && er.message.match(/^EMFILE, Too many open files/)) {
- setTimeout(function () {
- GRACEFUL.apply(fs, args)
- }, timeout ++)
- return
+// lchmod, broken prior to 0.6.2
+// back-port the fix here.
+if (constants.hasOwnProperty('O_SYMLINK') &&
+ process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
+ fs.lchmod = function(path, mode, callback) {
+ callback = callback || noop;
+ fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, function(err, fd) {
+ if (err) {
+ callback(err);
+ return;
+ }
+ // prefer to return the chmod error, if one occurs,
+ // but still try to close, and report closing errors if they occur.
+ fs.fchmod(fd, mode, function(err) {
+ fs.close(fd, function(err2) {
+ callback(err || err2);
+ });
+ });
+ });
+ };
+
+ fs.lchmodSync = function(path, mode) {
+ var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK);
+
+ // prefer to return the chmod error, if one occurs,
+ // but still try to close, and report closing errors if they occur.
+ var err, err2;
+ try {
+ var ret = fs.fchmodSync(fd, mode);
+ } catch (er) {
+ err = er;
+ }
+ try {
+ fs.closeSync(fd);
+ } catch (er) {
+ err2 = er;
}
- timeout = 0
- cb_.apply(null, arguments)
+ if (err || err2) throw (err || err2);
+ return ret;
+ };
+}
+
+// lutimes, not yet implemented in node
+if (constants.hasOwnProperty('O_SYMLINK') && !fs.lutimes) {
+ fs.lutimes = function (path, atime, mtime, cb) {
+ cb = cb || noop
+ fs.open(path, constants.O_SYMLINK | constants.O_WRONLY, function (er, fd) {
+ if (er) return cb(er)
+ fs.futimes(fd, atime, mtime, function (er) {
+ fs.close(fd, function (er2) {
+ cb(er || er2)
+ })
+ })
+ })
}
- fn.apply(fs, args)
-}}
+
+ fs.lutimesSync = function(path, atime, mtime) {
+ var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK)
+
+ // prefer to return the chmod error, if one occurs,
+ // but still try to close, and report closing errors if they occur.
+ var err, err2
+ try {
+ var ret = fs.futimesSync(fd, atime, mtime)
+ } catch (er) {
+ err = er
+ }
+ try {
+ fs.closeSync(fd)
+ } catch (er) {
+ err2 = er
+ }
+ if (err || err2) throw (err || err2)
+ return ret
+ }
+}
View
8 deps/npm/node_modules/graceful-fs/package.json
@@ -1,8 +1,8 @@
{
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
"name": "graceful-fs",
- "description": "fs with incremental backoff on EMFILE",
- "version": "1.0.1",
+ "description": "fs monkey-patching to avoid EMFILE and other problems",
+ "version": "1.1.0",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-graceful-fs.git"
@@ -11,6 +11,8 @@
"engines": {
"node": "0.4 || 0.5 || 0.6"
},
- "dependencies": {},
+ "dependencies": {
+ "fast-list": "1"
+ },
"devDependencies": {}
}
View
18 deps/npm/node_modules/ini/test/fixtures/foo.ini
@@ -1,18 +0,0 @@
-o = p
-
- a with spaces = b c
-
-; wrap in quotes to JSON-decode and preserve spaces
-" xa n p " = "\"\r\nyoyoyo\r\r\n"
-
-; a section
-[a]
-av = a val
-e = { o: p, a: { av: a val, b: { c: { e: "this value" } } } }
-j = "{ o: "p", a: { av: "a val", b: { c: { e: "this value" } } } }"
-
-; nested child without middle parent
-; should create otherwise-empty a.b
-[a.b.c]
-e = 1
-j = 2
View
40 deps/npm/node_modules/ini/test/foo.js
@@ -1,40 +0,0 @@
-var i = require("../")
- , tap = require("tap")
- , test = tap.test
- , fs = require("fs")
- , path = require("path")
- , fixture = path.resolve(__dirname, "./fixtures/foo.ini")
- , data = fs.readFileSync(fixture, "utf8")
- , d
- , expectE = 'o = p\n'
- + 'a with spaces = b c\n'
- + '" xa n p " = "\\"\\r\\nyoyoyo\\r\\r\\n"\n'
- + '[a]\n'
- + 'av = a val\n'
- + 'e = { o: p, a: '
- + '{ av: a val, b: { c: { e: "this value" '
- + '} } } }\nj = "\\"{ o: \\"p\\", a: { av:'
- + ' \\"a val\\", b: { c: { e: \\"this value'
- + '\\" } } } }\\""\n[a.b.c]\ne = 1\nj = 2\n'
- , expectD =
- { o: 'p',
- 'a with spaces': 'b c',
- " xa n p ":'"\r\nyoyoyo\r\r\n',
- a:
- { av: 'a val',
- e: '{ o: p, a: { av: a val, b: { c: { e: "this value" } } } }',
- j: '"{ o: "p", a: { av: "a val", b: { c: { e: "this value" } } } }"',
- b: { c: { e: '1', j: '2' } } }
- }
-
-test("decode from file", function (t) {
- d = i.decode(data)
- t.deepEqual(d, expectD)
- t.end()
-})
-
-test("encode from data", function (t) {
- e = i.encode(expectD)
- t.deepEqual(e, expectE)
- t.end()
-})
View
141 deps/npm/node_modules/minimatch/test/basic.js
@@ -1,141 +0,0 @@
-// http://www.bashcookbook.com/bashinfo/source/bash-1.14.7/tests/glob-test
-
-var tap = require("tap")
- , mm = require("../")
- , files = [ "a", "b", "c", "d", "abc"
- , "abd", "abe", "bb", "bcd"
- , "ca", "cb", "dd", "de"
- , "bdir/", "bdir/cfile"]
- , next = files.concat([ "a-b", "aXb"
- , ".x", ".y" ])
-
-tap.test("basic tests", function (t) {
- // [ pattern, [matches], MM opts, files, TAP opts]
- ; [ "http://www.bashcookbook.com/bashinfo" +
- "/source/bash-1.14.7/tests/glob-test"
- , ["a*", ["a", "abc", "abd", "abe"]]
- , ["X*", ["X*"]]
- // allow null glob expansion
- , ["X*", [], { null: true }]
-
- // isaacs: Slightly different than bash/sh/ksh
- // \\* is not un-escaped to literal "*" in a failed match,
- // but it does make it get treated as a literal star
- , ["\\*", ["\\*"]]
- , ["\\**", ["\\**"]]
-
- , ["b*/", ["bdir/"]]
- , ["c*", ["c", "ca", "cb"]]
- , ["**", files]
-
-
- , ["\\.\\./*/", ["\\.\\./*/"]]
- , ["s/\\..*//", ["s/\\..*//"]]
-
- // legendary larry crashes bashes
- , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"
- , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"]]
- , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"
- , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"]]
-
- // character classes
- , ["[a-c]b*", ["abc", "abd", "abe", "bb", "cb"]]
- , ["[a-y]*[^c]", ["abd", "abe", "bb", "bcd",
- "bdir/", "ca", "cb", "dd", "de"]]
- , ["a*[^c]", ["abd", "abe"]]
- , function () { files.push("a-b", "aXb") }
- , ["a[X-]b", ["a-b", "aXb"]]
- , function () { files.push(".x", ".y") }
- , ["[^a-c]*", ["d", "dd", "de"]]
- , function () { files.push("a*b/", "a*b/ooo") }
- , ["a\\*b/*", ["a*b/ooo"]]
- , ["a\\*?/*", ["a*b/ooo"]]
- , ["*\\\\!*", [], {null: true}, ["echo !7"]]
- , ["*\\!*", ["echo !7"], null, ["echo !7"]]
- , ["*.\\*", ["r.*"], null, ["r.*"]]
- , ["a[b]c", ["abc"]]
- , ["a[\\b]c", ["abc"]]
- , ["a?c", ["abc"]]
- , ["a\\*c", [], {null: true}, ["abc"]]
- , ["", [""], { null: true }, [""]]
-
- , "http://www.opensource.apple.com/source/bash/bash-23/" +
- "bash/tests/glob-test"
- , function () { files.push("man/", "man/man1/", "man/man1/bash.1") }
- , ["*/man*/bash.*", ["man/man1/bash.1"]]
- , ["man/man1/bash.1", ["man/man1/bash.1"]]
- , ["a***c", ["abc"], null, ["abc"]]
- , ["a*****?c", ["abc"], null, ["abc"]]
- , ["?*****??", ["abc"], null, ["abc"]]
- , ["*****??", ["abc"], null, ["abc"]]
- , ["?*****?c", ["abc"], null, ["abc"]]
- , ["?***?****c", ["abc"], null, ["abc"]]
- , ["?***?****?", ["abc"], null, ["abc"]]
- , ["?***?****", ["abc"], null, ["abc"]]
- , ["*******c", ["abc"], null, ["abc"]]
- , ["*******?", ["abc"], null, ["abc"]]
- , ["a*cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
- , ["a**?**cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
- , ["a**?**cd**?**??k***", ["abcdecdhjk"], null, ["abcdecdhjk"]]
- , ["a**?**cd**?**??***k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
- , ["a**?**cd**?**??***k**", ["abcdecdhjk"], null, ["abcdecdhjk"]]
- , ["a****c**?**??*****", ["abcdecdhjk"], null, ["abcdecdhjk"]]
- , ["[-abc]", ["-"], null, ["-"]]
- , ["[abc-]", ["-"], null, ["-"]]
- , ["\\", ["\\"], null, ["\\"]]
- , ["[\\\\]", ["\\"], null, ["\\"]]
- , ["[[]", ["["], null, ["["]]
- , ["[", ["["], null, ["["]]
- , ["[*", ["[abc"], null, ["[abc"]]
- , "a right bracket shall lose its special meaning and " +
- "represent itself in a bracket expression if it occurs " +
- "first in the list. -- POSIX.2 2.8.3.2"
- , ["[]]", ["]"], null, ["]"]]
- , ["[]-]", ["]"], null, ["]"]]
- , ["[a-\z]", ["p"], null, ["p"]]
- , ["[/\\\\]*", ["/tmp"], null, ["/tmp"]]
- , ["??**********?****?", [], { null: true }, ["abc"]]
- , ["??**********?****c", [], { null: true }, ["abc"]]
- , ["?************c****?****", [], { null: true }, ["abc"]]
- , ["*c*?**", [], { null: true }, ["abc"]]
- , ["a*****c*?**", [], { null: true }, ["abc"]]
- , ["a********???*******", [], { null: true }, ["abc"]]
- , ["[]", [], { null: true }, ["a"]]
- , ["[abc", [], { null: true }, ["["]]
-
- , "nocase tests"
- , ["XYZ", ["xYz"], { nocase: true, null: true }
- , ["xYz", "ABC", "IjK"]]
- , ["ab*", ["ABC"], { nocase: true, null: true }
- , ["xYz", "ABC", "IjK"]]
- , ["[ia]?[ck]", ["ABC", "IjK"], { nocase: true, null: true }
- , ["xYz", "ABC", "IjK"]]
-
- ].forEach(function (c) {
- if (typeof c === "function") return c()
- if (typeof c === "string") return t.comment(c)
-
- var pattern = c[0]
- , expect = c[1].sort(alpha)
- , options = c[2] || {}
- , f = c[3] || files
- , tapOpts = c[4] || {}
-
- // options.debug = true
- var r = mm.makeRe(pattern, options)
- tapOpts.re = String(r) || JSON.stringify(r)
- tapOpts.files = JSON.stringify(f)
- tapOpts.pattern = pattern
-
- var actual = mm.match(f, pattern, options)
-
- t.equivalent( actual, expect
- , JSON.stringify(pattern) + " " + JSON.stringify(expect)
- , c[4] )
- })
- t.end()
-})
-
-function alpha (a, b) {
- return a > b ? 1 : -1
-}
View
6 deps/npm/node_modules/mkdirp/examples/pow.js
@@ -1,6 +0,0 @@
-var mkdirp = require('mkdirp');
-
-mkdirp('/tmp/foo/bar/baz', 0755, function (err) {
- if (err) console.error(err)
- else console.log('pow!')
-});
View
39 deps/npm/node_modules/mkdirp/test/chmod.js
@@ -1,39 +0,0 @@
-var mkdirp = require('../').mkdirp;
-var path = require('path');
-var fs = require('fs');
-var test = require('tap').test;
-
-var ps = [ '', 'tmp' ];
-
-for (var i = 0; i < 25; i++) {
- var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
- ps.push(dir);
-}
-
-var file = ps.join('/');
-
-test('chmod-pre', function (t) {
- var mode = 0744
- mkdirp(file, mode, function (er) {
- t.ifError(er, 'should not error');
- fs.stat(file, function (er, stat) {
- t.ifError(er, 'should exist');
- t.ok(stat && stat.isDirectory(), 'should be directory');
- t.equal(stat && stat.mode & 0777, mode, 'should be 0744');
- t.end();
- });
- });
-});
-
-test('chmod', function (t) {
- var mode = 0755
- mkdirp(file, mode, function (er) {
- t.ifError(er, 'should not error');
- fs.stat(file, function (er, stat) {
- t.ifError(er, 'should exist');
- t.ok(stat && stat.isDirectory(), 'should be directory');
- t.equal(stat && stat.mode & 0777, mode, 'should be 0755');
- t.end();
- });
- });
-});
View
37 deps/npm/node_modules/mkdirp/test/clobber.js
@@ -1,37 +0,0 @@
-var mkdirp = require('../').mkdirp;
-var path = require('path');
-var fs = require('fs');
-var test = require('tap').test;
-
-var ps = [ '', 'tmp' ];
-
-for (var i = 0; i < 25; i++) {
- var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
- ps.push(dir);
-}
-
-var file = ps.join('/');
-
-// a file in the way
-var itw = ps.slice(0, 3).join('/');
-
-
-test('clobber-pre', function (t) {
- console.error("about to write to "+itw)
- fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.');
-
- fs.stat(itw, function (er, stat) {
- t.ifError(er)
- t.ok(stat && stat.isFile(), 'should be file')
- t.end()
- })
-})
-
-test('clobber', function (t) {
- t.plan(2);
- mkdirp(file, 0755, function (err) {
- t.ok(err);
- t.equal(err.code, 'ENOTDIR');
- t.end();
- });
-});
View
28 deps/npm/node_modules/mkdirp/test/mkdirp.js
@@ -1,28 +0,0 @@
-var mkdirp = require('../');
-var path = require('path');
-var fs = require('fs');
-var test = require('tap').test;
-
-test('woo', function (t) {
- t.plan(2);
- var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
- var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
- var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-
- var file = '/tmp/' + [x,y,z].join('/');
-
- mkdirp(file, 0755, function (err) {
- if (err) t.fail(err);
- else path.exists(file, function (ex) {
- if (!ex) t.fail('file not created')
- else fs.stat(file, function (err, stat) {
- if (err) t.fail(err)
- else {
- t.equal(stat.mode & 0777, 0755);
- t.ok(stat.isDirectory(), 'target not a directory');
- t.end();
- }
- })
- })
- });
-});
View
41 deps/npm/node_modules/mkdirp/test/race.js
@@ -1,41 +0,0 @@
-var mkdirp = require('../').mkdirp;
-var path = require('path');
-var fs = require('fs');
-var test = require('tap').test;
-
-test('race', function (t) {
- t.plan(4);
- var ps = [ '', 'tmp' ];
-
- for (var i = 0; i < 25; i++) {
- var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
- ps.push(dir);
- }
- var file = ps.join('/');
-
- var res = 2;
- mk(file, function () {
- if (--res === 0) t.end();
- });
-
- mk(file, function () {
- if (--res === 0) t.end();
- });
-
- function mk (file, cb) {
- mkdirp(file, 0755, function (err) {
- if (err) t.fail(err);
- else path.exists(file, function (ex) {
- if (!ex) t.fail('file not created')
- else fs.stat(file, function (err, stat) {
- if (err) t.fail(err)
- else {
- t.equal(stat.mode & 0777, 0755);
- t.ok(stat.isDirectory(), 'target not a directory');
- if (cb) cb();
- }
- })
- })
- });
- }
-});
View
32 deps/npm/node_modules/mkdirp/test/rel.js
@@ -1,32 +0,0 @@
-var mkdirp = require('../');
-var path = require('path');
-var fs = require('fs');
-var test = require('tap').test;
-
-test('rel', function (t) {
- t.plan(2);
- var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
- var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
- var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
-
- var cwd = process.cwd();
- process.chdir('/tmp');
-
- var file = [x,y,z].join('/');
-
- mkdirp(file, 0755, function (err) {
- if (err) t.fail(err);
- else path.exists(file, function (ex) {
- if (!ex) t.fail('file not created')
- else fs.stat(file, function (err, stat) {
- if (err) t.fail(err)
- else {
- process.chdir(cwd);
- t.equal(stat.mode & 0777, 0755);
- t.ok(stat.isDirectory(), 'target not a directory');
- t.end();
- }
- })
- })
- });
-});
View
2  deps/npm/node_modules/node-uuid/.gitignore
@@ -0,0 +1,2 @@
+node_modules
+.DS_Store
View
229 deps/npm/node_modules/node-uuid/README.md
@@ -1,100 +1,195 @@
# node-uuid
-Simple, fast generation of RFC4122[RFC4122(v4)](http://www.ietf.org/rfc/rfc4122.txt) UUIDS. It runs in node.js and all major browsers.
+Simple, fast generation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDS.
-## Installation
+Features:
- npm install node-uuid
+* Generate RFC4122 version 1 or version 4 UUIDs
+* Runs in node.js and all browsers.
+* Cryptographically strong random # generation on supporting platforms
+* 1.1K minified and gzip'ed
-### In browser
+## Getting Started
- <script src="uuid.js"></script>
+Install it in your browser:
-### In node.js
+```html
+<script src="uuid.js"></script>
+```
- var uuid = require('node-uuid');
+Or in node.js:
-## Usage
+```
+npm install node-uuid
+```
-### Generate a String UUID
+```javascript
+var uuid = require('node-uuid');
+```
- var id = uuid(); // -> '92329D39-6F5C-4520-ABFC-AAB64544E172'
+Then create some ids ...
-### Generate a Binary UUID
+```javascript
+// Generate a v1 (time-based) id
+uuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'
- // Simple form - allocates a Buffer/Array for you
- var buf = uuid('binary');
- // node.js -> <Buffer 08 50 05 c8 9c b2 4c 07 ac 07 d1 4f b9 f5 04 51>
- // browser -> [8, 80, 5, 200, 156, 178, 76, 7, 172, 7, 209, 79, 185, 245, 4, 81]
+// Generate a v4 (random) id
+uuid.v4(); // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1'
+```
- // Provide your own Buffer or Array
- var buf = new Array(16);
- uuid('binary', buf); // -> [8, 80, 5, 200, 156, 178, 76, 7, 172, 7, 209, 79, 185, 245, 4, 81]
- var buf = new Buffer(16);
- uuid('binary', buf); // -> <Buffer 08 50 05 c8 9c b2 4c 07 ac 07 d1 4f b9 f5 04 51>
+## API
- // Provide your own Buffer/Array, plus specify offset
- // (e.g. here we fill an array with 3 uuids)
- var buf = new Buffer(16 \* 3);
- uuid('binary', id, 0);
- uuid('binary', id, 16);
- uuid('binary', id, 32);
+### uuid.v1([`options` [, `buffer` [, `offset`]]])
-## Testing
+Generate and return a RFC4122 v1 (timestamp-based) UUID.
+
+* `options` - (Object) Optional uuid state to apply. Properties may include:
+
+ * `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomnly generated ID. See note 2.
+ * `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used.
+ * `msecs` - (Number | Date) Time in milliseconds since unix Epoch. Default: The current time is used. See note 3.
+ * `nsecs` - (Number between 0-9999) additional time, in 100-nanosecond. Ignored if `msecs` is unspecified. Default: internal uuid counter is used, as per 4.2.1.2.
+
+* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
+* `offset` - (Number) Starting index in `buffer` at which to begin writing.
+
+Returns `buffer`, if specified, otherwise the string form of the UUID
+
+Notes:
+
+1. The randomly generated node id is only guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.)
+1. Specifying the `msecs` option bypasses the internal logic for ensuring id uniqueness. In this case you may want to also provide `clockseq` and `nsecs` options as well.
+
+Example: Generate string UUID with fully-specified options
+
+```javascript
+uuid.v1({
+ node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
+ clockseq: 0x1234,
+ msecs: new Date('2011-11-01').getTime(),
+ nsecs: 5678
+}); // -> "710b962e-041c-11e1-9234-0123456789ab"
+```
+
+Example: In-place generation of two binary IDs
+
+```javascript
+// In browsers: 'new Array(32)'
+var buffer = new Buffer(32).fill(0); // -> <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>
+uuid.v1(null, buffer, 0); // -> <Buffer 02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>
+uuid.v1(null, buffer, 16); // -> <Buffer 02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15 02 a3 1c b0 14 32 11 e1 85 58 0b 48 8e 4f c1 15>
+
+// Optionally use uuid.unparse() to get stringify the ids
+uuid.unparse(buffer); // -> '02a2ce90-1432-11e1-8558-0b488e4fc115'
+uuid.unparse(buffer, 16) // -> '02a31cb0-1432-11e1-8558-0b488e4fc115'
+```
+
+### uuid.v4([`options` [, `buffer` [, `offset`]]])
+
+Generate and return a RFC4122 v4 UUID.
+
+* `options` - (Object) Optional uuid state to apply. Properties may include:
+
+ * `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values
+
+* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
+* `offset` - (Number) Starting index in `buffer` at which to begin writing.
+
+Returns `buffer`, if specified, otherwise the string form of the UUID
-test/test.js generates performance data (similar to test/benchmark.js). It also verifies the syntax of 100K string UUIDs, and logs the distribution of hex digits found therein. For example:
+Example: Generate string UUID with fully-specified options
- - - - Performance Data - - -
- uuid(): 1052631 uuids/second
- uuid('binary'): 680272 uuids/second
- uuid('binary', buffer): 2702702 uuids/second
+```javascript
+uuid.v4({
+ random: [
+ 0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea,
+ 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36
+ ]
+});
+// -> "109156be-c4fb-41ea-b1b4-efe1671c5836"
+```
- - - - Distribution of Hex Digits (% deviation from ideal) - - -
- 0 |================================| 187705 (0.11%)
- 1 |================================| 187880 (0.2%)
- 2 |================================| 186875 (-0.33%)
- 3 |================================| 186847 (-0.35%)
- 4 |==================================================| 287433 (-0.02%)
- 5 |================================| 187910 (0.22%)
- 6 |================================| 188172 (0.36%)
- 7 |================================| 187350 (-0.08%)
- 8 |====================================| 211994 (-0.24%)
- 9 |====================================| 212664 (0.08%)
- A |=====================================| 213185 (0.32%)
- B |=====================================| 212877 (0.18%)
- C |================================| 187445 (-0.03%)
- D |================================| 186737 (-0.41%)
- E |================================| 187155 (-0.18%)
- F |================================| 187771 (0.14%)
+Example: Generate two IDs in a single buffer
-Note that the increased values for 4 and 8-B are expected as part of the RFC4122 syntax (and are accounted for in the deviation calculation). BTW, if someone wants to do the calculation to determine what a statistically significant deviation would be, I'll gladly add that to the test.
+```javascript
+var buffer = new Array(32); // (or 'new Buffer' in node.js)
+uuid.v4(null, buffer, 0);
+uuid.v4(null, buffer, 16);
+```
-### In browser
+### uuid.parse(id[, buffer[, offset]])
+### uuid.unparse(buffer[, offset])
+
+Parse and unparse UUIDs
+
+ * `id` - (String) UUID(-like) string
+ * `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. Default: A new Array or Buffer is used
+ * `offset` - (Number) Starting index in `buffer` at which to begin writing. Default: 0
+
+Example parsing and unparsing a UUID string
+
+```javascript
+var bytes = uuid.parse('797ff043-11eb-11e1-80d6-510998755d10'); // -> <Buffer 79 7f f0 43 11 eb 11 e1 80 d6 51 09 98 75 5d 10>
+var string = uuid.unparse(bytes); // -> '797ff043-11eb-11e1-80d6-510998755d10'
+```
+
+### uuid.noConflict()
+
+(Browsers only) Set `uuid` property back to it's previous value.
+
+Returns the node-uuid object.
+
+Example:
+
+```javascript
+var myUuid = uuid.noConflict();
+myUuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'
+```
+