fsevents 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fsevents might be problematic. Click here for more details.

Files changed (216) hide show
  1. package/node_modules/are-we-there-yet/LICENSE +5 -0
  2. package/node_modules/are-we-there-yet/README.md +2 -1
  3. package/node_modules/are-we-there-yet/README.md~ +183 -0
  4. package/node_modules/are-we-there-yet/package.json +10 -9
  5. package/node_modules/async/README.md +14 -10
  6. package/node_modules/async/dist/async.js +22 -18
  7. package/node_modules/async/dist/async.min.js +1 -1
  8. package/node_modules/async/lib/async.js +22 -18
  9. package/node_modules/async/package.json +11 -10
  10. package/node_modules/core-util-is/package.json +2 -1
  11. package/node_modules/dashdash/README.md +6 -3
  12. package/node_modules/dashdash/lib/dashdash.js +10 -1
  13. package/node_modules/dashdash/package.json +9 -8
  14. package/node_modules/escape-string-regexp/index.js +1 -1
  15. package/node_modules/escape-string-regexp/package.json +17 -15
  16. package/node_modules/escape-string-regexp/readme.md +4 -4
  17. package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +9 -0
  18. package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +42 -30
  19. package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +9 -9
  20. package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +28 -0
  21. package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/package.json +11 -11
  22. package/node_modules/graceful-fs/package.json +2 -3
  23. package/node_modules/isarray/package.json +2 -1
  24. package/node_modules/mime-db/HISTORY.md +32 -0
  25. package/node_modules/mime-db/README.md +1 -1
  26. package/node_modules/mime-db/db.json +78 -0
  27. package/node_modules/mime-db/package.json +15 -14
  28. package/node_modules/mime-types/HISTORY.md +12 -0
  29. package/node_modules/mime-types/package.json +11 -10
  30. package/node_modules/node-pre-gyp/CHANGELOG.md +8 -0
  31. package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +32 -0
  32. package/node_modules/node-pre-gyp/package.json +8 -8
  33. package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/.travis.yml +6 -1
  34. package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/index.js +8 -1
  35. package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/package.json +13 -12
  36. package/node_modules/rc/lib/utils.js +1 -1
  37. package/node_modules/rc/package.json +11 -10
  38. package/node_modules/readable-stream/README.md +27 -6
  39. package/node_modules/{bl/node_modules/readable-stream → readable-stream}/doc/stream.markdown +608 -574
  40. package/node_modules/readable-stream/lib/_stream_duplex.js +18 -25
  41. package/node_modules/readable-stream/lib/_stream_passthrough.js +2 -21
  42. package/node_modules/readable-stream/lib/_stream_readable.js +117 -93
  43. package/node_modules/readable-stream/lib/_stream_transform.js +15 -27
  44. package/node_modules/readable-stream/lib/_stream_writable.js +140 -88
  45. package/node_modules/readable-stream/package.json +33 -25
  46. package/node_modules/readable-stream/readable.js +6 -1
  47. package/node_modules/rimraf/README.md +58 -0
  48. package/node_modules/rimraf/node_modules/glob/README.md +27 -45
  49. package/node_modules/rimraf/node_modules/glob/common.js +7 -26
  50. package/node_modules/rimraf/node_modules/glob/node_modules/inherits/package.json +1 -1
  51. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +9 -0
  52. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +42 -30
  53. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +9 -9
  54. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +28 -0
  55. package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +11 -11
  56. package/node_modules/rimraf/node_modules/glob/package.json +11 -10
  57. package/node_modules/rimraf/package.json +12 -11
  58. package/node_modules/rimraf/rimraf.js +7 -5
  59. package/node_modules/sshpk/bin/sshpk-conv +1 -1
  60. package/node_modules/sshpk/lib/dhe.js +1 -2
  61. package/node_modules/sshpk/lib/ssh-buffer.js +2 -1
  62. package/node_modules/sshpk/package.json +13 -11
  63. package/node_modules/string_decoder/package.json +2 -1
  64. package/node_modules/tar-pack/index.js +1 -2
  65. package/node_modules/tar-pack/node_modules/rimraf/LICENSE +12 -20
  66. package/node_modules/tar-pack/node_modules/rimraf/README.md +17 -4
  67. package/node_modules/tar-pack/node_modules/rimraf/bin.js +11 -4
  68. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/README.md +359 -0
  69. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/common.js +226 -0
  70. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/glob.js +752 -0
  71. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/.eslintrc +17 -0
  72. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/LICENSE +15 -0
  73. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/README.md +37 -0
  74. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/inflight.js +44 -0
  75. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE +15 -0
  76. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md +36 -0
  77. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +58 -0
  78. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js +51 -0
  79. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js +33 -0
  80. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/package.json +67 -0
  81. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/inflight/test.js +97 -0
  82. package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/package.json +3 -3
  83. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/README.md +216 -0
  84. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/minimatch.js +912 -0
  85. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +3 -0
  86. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +122 -0
  87. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +8 -0
  88. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +191 -0
  89. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +2 -0
  90. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml +3 -0
  91. package/node_modules/tar-pack/node_modules/{readable-stream/node_modules/isarray/README.md → rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/LICENSE.md} +0 -33
  92. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +6 -0
  93. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +89 -0
  94. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +5 -0
  95. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +50 -0
  96. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +79 -0
  97. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +84 -0
  98. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml +4 -0
  99. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +18 -0
  100. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +62 -0
  101. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +6 -0
  102. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +13 -0
  103. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +90 -0
  104. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +39 -0
  105. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +81 -0
  106. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/minimatch/package.json +66 -0
  107. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/README.md +51 -0
  108. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE +15 -0
  109. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +36 -0
  110. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +58 -0
  111. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +51 -0
  112. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +33 -0
  113. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/once.js +21 -0
  114. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/once/package.json +70 -0
  115. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/path-is-absolute/index.js +20 -0
  116. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/path-is-absolute/package.json +78 -0
  117. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/node_modules/path-is-absolute/readme.md +51 -0
  118. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/package.json +79 -0
  119. package/node_modules/tar-pack/node_modules/rimraf/node_modules/glob/sync.js +460 -0
  120. package/node_modules/tar-pack/node_modules/rimraf/package.json +28 -40
  121. package/node_modules/tar-pack/node_modules/rimraf/rimraf.js +138 -53
  122. package/node_modules/tar-pack/package.json +21 -11
  123. package/node_modules/tunnel-agent/index.js +2 -0
  124. package/node_modules/tunnel-agent/package.json +10 -9
  125. package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/package.json +3 -2
  126. package/node_modules/verror/package.json +3 -2
  127. package/package.json +2 -2
  128. package/CHANGELOG.md +0 -16
  129. package/node_modules/bl/node_modules/readable-stream/.npmignore +0 -5
  130. package/node_modules/bl/node_modules/readable-stream/LICENSE +0 -18
  131. package/node_modules/bl/node_modules/readable-stream/README.md +0 -36
  132. package/node_modules/bl/node_modules/readable-stream/duplex.js +0 -1
  133. package/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js +0 -82
  134. package/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js +0 -27
  135. package/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js +0 -973
  136. package/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js +0 -197
  137. package/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js +0 -527
  138. package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/LICENSE +0 -19
  139. package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/README.md +0 -3
  140. package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/float.patch +0 -604
  141. package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/lib/util.js +0 -107
  142. package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/package.json +0 -67
  143. package/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/test.js +0 -68
  144. package/node_modules/bl/node_modules/readable-stream/node_modules/isarray/README.md +0 -54
  145. package/node_modules/bl/node_modules/readable-stream/node_modules/isarray/build/build.js +0 -209
  146. package/node_modules/bl/node_modules/readable-stream/node_modules/isarray/component.json +0 -19
  147. package/node_modules/bl/node_modules/readable-stream/node_modules/isarray/index.js +0 -3
  148. package/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json +0 -59
  149. package/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/.npmignore +0 -2
  150. package/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/LICENSE +0 -20
  151. package/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/README.md +0 -7
  152. package/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/index.js +0 -221
  153. package/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json +0 -60
  154. package/node_modules/bl/node_modules/readable-stream/package.json +0 -82
  155. package/node_modules/bl/node_modules/readable-stream/passthrough.js +0 -1
  156. package/node_modules/bl/node_modules/readable-stream/readable.js +0 -12
  157. package/node_modules/bl/node_modules/readable-stream/transform.js +0 -1
  158. package/node_modules/bl/node_modules/readable-stream/writable.js +0 -1
  159. package/node_modules/node-pre-gyp/LICENSE +0 -27
  160. package/node_modules/readable-stream/float.patch +0 -923
  161. package/node_modules/tar-pack/node_modules/readable-stream/.npmignore +0 -5
  162. package/node_modules/tar-pack/node_modules/readable-stream/LICENSE +0 -18
  163. package/node_modules/tar-pack/node_modules/readable-stream/README.md +0 -15
  164. package/node_modules/tar-pack/node_modules/readable-stream/duplex.js +0 -1
  165. package/node_modules/tar-pack/node_modules/readable-stream/lib/_stream_duplex.js +0 -89
  166. package/node_modules/tar-pack/node_modules/readable-stream/lib/_stream_passthrough.js +0 -46
  167. package/node_modules/tar-pack/node_modules/readable-stream/lib/_stream_readable.js +0 -982
  168. package/node_modules/tar-pack/node_modules/readable-stream/lib/_stream_transform.js +0 -210
  169. package/node_modules/tar-pack/node_modules/readable-stream/lib/_stream_writable.js +0 -386
  170. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/LICENSE +0 -19
  171. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/README.md +0 -3
  172. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/float.patch +0 -604
  173. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/lib/util.js +0 -107
  174. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/package.json +0 -67
  175. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/core-util-is/test.js +0 -68
  176. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/LICENSE +0 -16
  177. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/README.md +0 -42
  178. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/inherits.js +0 -1
  179. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/inherits_browser.js +0 -23
  180. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/package.json +0 -58
  181. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/inherits/test.js +0 -25
  182. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/isarray/build/build.js +0 -209
  183. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/isarray/component.json +0 -19
  184. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/isarray/index.js +0 -3
  185. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/isarray/package.json +0 -59
  186. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/string_decoder/.npmignore +0 -2
  187. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/string_decoder/LICENSE +0 -20
  188. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/string_decoder/README.md +0 -7
  189. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/string_decoder/index.js +0 -221
  190. package/node_modules/tar-pack/node_modules/readable-stream/node_modules/string_decoder/package.json +0 -60
  191. package/node_modules/tar-pack/node_modules/readable-stream/package.json +0 -76
  192. package/node_modules/tar-pack/node_modules/readable-stream/passthrough.js +0 -1
  193. package/node_modules/tar-pack/node_modules/readable-stream/readable.js +0 -8
  194. package/node_modules/tar-pack/node_modules/readable-stream/transform.js +0 -1
  195. package/node_modules/tar-pack/node_modules/readable-stream/writable.js +0 -1
  196. package/node_modules/tar-pack/node_modules/rimraf/AUTHORS +0 -6
  197. package/node_modules/tar-pack/node_modules/rimraf/test/run.sh +0 -16
  198. package/node_modules/tar-pack/node_modules/rimraf/test/setup.sh +0 -47
  199. package/node_modules/tar-pack/node_modules/rimraf/test/test-async.js +0 -5
  200. package/node_modules/tar-pack/node_modules/rimraf/test/test-sync.js +0 -3
  201. /package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/license.md +0 -0
  202. /package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/readme.md +0 -0
  203. /package/node_modules/{bl/node_modules/readable-stream/node_modules/process-nextick-args → process-nextick-args}/test.js +0 -0
  204. /package/node_modules/{bl/node_modules/readable-stream → readable-stream}/.travis.yml +0 -0
  205. /package/node_modules/{bl/node_modules/readable-stream → readable-stream}/.zuul.yml +0 -0
  206. /package/node_modules/{bl/node_modules/readable-stream → readable-stream}/doc/wg-meetings/2015-01-30.md +0 -0
  207. /package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/LICENSE +0 -0
  208. /package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/README.md +0 -0
  209. /package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/inherits.js +0 -0
  210. /package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/inherits_browser.js +0 -0
  211. /package/node_modules/{bl/node_modules/readable-stream → tar-pack/node_modules/rimraf/node_modules/glob}/node_modules/inherits/test.js +0 -0
  212. /package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/History.md +0 -0
  213. /package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/LICENSE +0 -0
  214. /package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/README.md +0 -0
  215. /package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/browser.js +0 -0
  216. /package/node_modules/{bl/node_modules/readable-stream/node_modules/util-deprecate → util-deprecate}/node.js +0 -0
@@ -1,197 +0,0 @@
1
- // a transform stream is a readable/writable stream where you do
2
- // something with the data. Sometimes it's called a "filter",
3
- // but that's not a great name for it, since that implies a thing where
4
- // some bits pass through, and others are simply ignored. (That would
5
- // be a valid example of a transform, of course.)
6
- //
7
- // While the output is causally related to the input, it's not a
8
- // necessarily symmetric or synchronous transformation. For example,
9
- // a zlib stream might take multiple plain-text writes(), and then
10
- // emit a single compressed chunk some time in the future.
11
- //
12
- // Here's how this works:
13
- //
14
- // The Transform stream has all the aspects of the readable and writable
15
- // stream classes. When you write(chunk), that calls _write(chunk,cb)
16
- // internally, and returns false if there's a lot of pending writes
17
- // buffered up. When you call read(), that calls _read(n) until
18
- // there's enough pending readable data buffered up.
19
- //
20
- // In a transform stream, the written data is placed in a buffer. When
21
- // _read(n) is called, it transforms the queued up data, calling the
22
- // buffered _write cb's as it consumes chunks. If consuming a single
23
- // written chunk would result in multiple output chunks, then the first
24
- // outputted bit calls the readcb, and subsequent chunks just go into
25
- // the read buffer, and will cause it to emit 'readable' if necessary.
26
- //
27
- // This way, back-pressure is actually determined by the reading side,
28
- // since _read has to be called to start processing a new chunk. However,
29
- // a pathological inflate type of transform can cause excessive buffering
30
- // here. For example, imagine a stream where every byte of input is
31
- // interpreted as an integer from 0-255, and then results in that many
32
- // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
33
- // 1kb of data being output. In this case, you could write a very small
34
- // amount of input, and end up with a very large amount of output. In
35
- // such a pathological inflating mechanism, there'd be no way to tell
36
- // the system to stop doing the transform. A single 4MB write could
37
- // cause the system to run out of memory.
38
- //
39
- // However, even in such a pathological case, only a single written chunk
40
- // would be consumed, and then the rest would wait (un-transformed) until
41
- // the results of the previous transformed chunk were consumed.
42
-
43
- 'use strict';
44
-
45
- module.exports = Transform;
46
-
47
- var Duplex = require('./_stream_duplex');
48
-
49
- /*<replacement>*/
50
- var util = require('core-util-is');
51
- util.inherits = require('inherits');
52
- /*</replacement>*/
53
-
54
- util.inherits(Transform, Duplex);
55
-
56
-
57
- function TransformState(stream) {
58
- this.afterTransform = function(er, data) {
59
- return afterTransform(stream, er, data);
60
- };
61
-
62
- this.needTransform = false;
63
- this.transforming = false;
64
- this.writecb = null;
65
- this.writechunk = null;
66
- }
67
-
68
- function afterTransform(stream, er, data) {
69
- var ts = stream._transformState;
70
- ts.transforming = false;
71
-
72
- var cb = ts.writecb;
73
-
74
- if (!cb)
75
- return stream.emit('error', new Error('no writecb in Transform class'));
76
-
77
- ts.writechunk = null;
78
- ts.writecb = null;
79
-
80
- if (data !== null && data !== undefined)
81
- stream.push(data);
82
-
83
- if (cb)
84
- cb(er);
85
-
86
- var rs = stream._readableState;
87
- rs.reading = false;
88
- if (rs.needReadable || rs.length < rs.highWaterMark) {
89
- stream._read(rs.highWaterMark);
90
- }
91
- }
92
-
93
-
94
- function Transform(options) {
95
- if (!(this instanceof Transform))
96
- return new Transform(options);
97
-
98
- Duplex.call(this, options);
99
-
100
- this._transformState = new TransformState(this);
101
-
102
- // when the writable side finishes, then flush out anything remaining.
103
- var stream = this;
104
-
105
- // start out asking for a readable event once data is transformed.
106
- this._readableState.needReadable = true;
107
-
108
- // we have implemented the _read method, and done the other things
109
- // that Readable wants before the first _read call, so unset the
110
- // sync guard flag.
111
- this._readableState.sync = false;
112
-
113
- if (options) {
114
- if (typeof options.transform === 'function')
115
- this._transform = options.transform;
116
-
117
- if (typeof options.flush === 'function')
118
- this._flush = options.flush;
119
- }
120
-
121
- this.once('prefinish', function() {
122
- if (typeof this._flush === 'function')
123
- this._flush(function(er) {
124
- done(stream, er);
125
- });
126
- else
127
- done(stream);
128
- });
129
- }
130
-
131
- Transform.prototype.push = function(chunk, encoding) {
132
- this._transformState.needTransform = false;
133
- return Duplex.prototype.push.call(this, chunk, encoding);
134
- };
135
-
136
- // This is the part where you do stuff!
137
- // override this function in implementation classes.
138
- // 'chunk' is an input chunk.
139
- //
140
- // Call `push(newChunk)` to pass along transformed output
141
- // to the readable side. You may call 'push' zero or more times.
142
- //
143
- // Call `cb(err)` when you are done with this chunk. If you pass
144
- // an error, then that'll put the hurt on the whole operation. If you
145
- // never call cb(), then you'll never get another chunk.
146
- Transform.prototype._transform = function(chunk, encoding, cb) {
147
- throw new Error('not implemented');
148
- };
149
-
150
- Transform.prototype._write = function(chunk, encoding, cb) {
151
- var ts = this._transformState;
152
- ts.writecb = cb;
153
- ts.writechunk = chunk;
154
- ts.writeencoding = encoding;
155
- if (!ts.transforming) {
156
- var rs = this._readableState;
157
- if (ts.needTransform ||
158
- rs.needReadable ||
159
- rs.length < rs.highWaterMark)
160
- this._read(rs.highWaterMark);
161
- }
162
- };
163
-
164
- // Doesn't matter what the args are here.
165
- // _transform does all the work.
166
- // That we got here means that the readable side wants more data.
167
- Transform.prototype._read = function(n) {
168
- var ts = this._transformState;
169
-
170
- if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
171
- ts.transforming = true;
172
- this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
173
- } else {
174
- // mark that we need a transform, so that any data that comes in
175
- // will get processed, now that we've asked for it.
176
- ts.needTransform = true;
177
- }
178
- };
179
-
180
-
181
- function done(stream, er) {
182
- if (er)
183
- return stream.emit('error', er);
184
-
185
- // if there's nothing in the write buffer, then that means
186
- // that nothing more will ever be provided
187
- var ws = stream._writableState;
188
- var ts = stream._transformState;
189
-
190
- if (ws.length)
191
- throw new Error('calling transform done when ws.length != 0');
192
-
193
- if (ts.transforming)
194
- throw new Error('calling transform done when still transforming');
195
-
196
- return stream.push(null);
197
- }