dragonfly_chrome_headless 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.travis.yml +12 -0
  4. data/Gemfile +4 -0
  5. data/README.md +53 -0
  6. data/Rakefile +10 -0
  7. data/bin/console +14 -0
  8. data/bin/setup +8 -0
  9. data/dragonfly_chrome_headless.gemspec +27 -0
  10. data/lib/dragonfly_chrome_headless.rb +9 -0
  11. data/lib/dragonfly_chrome_headless/plugin.rb +17 -0
  12. data/lib/dragonfly_chrome_headless/processors/rasterize.rb +33 -0
  13. data/lib/dragonfly_chrome_headless/version.rb +3 -0
  14. data/node_modules/.bin/chrome-remote-interface +1 -0
  15. data/node_modules/.bin/mkdirp +1 -0
  16. data/node_modules/.bin/rimraf +1 -0
  17. data/node_modules/@types/core-js/LICENSE +21 -0
  18. data/node_modules/@types/core-js/README.md +16 -0
  19. data/node_modules/@types/core-js/index.d.ts +2452 -0
  20. data/node_modules/@types/core-js/package.json +85 -0
  21. data/node_modules/@types/mkdirp/README.md +18 -0
  22. data/node_modules/@types/mkdirp/index.d.ts +14 -0
  23. data/node_modules/@types/mkdirp/package.json +77 -0
  24. data/node_modules/@types/mkdirp/types-metadata.json +25 -0
  25. data/node_modules/@types/node/README.md +16 -0
  26. data/node_modules/@types/node/index.d.ts +4132 -0
  27. data/node_modules/@types/node/package.json +84 -0
  28. data/node_modules/balanced-match/.npmignore +5 -0
  29. data/node_modules/balanced-match/LICENSE.md +21 -0
  30. data/node_modules/balanced-match/README.md +91 -0
  31. data/node_modules/balanced-match/index.js +59 -0
  32. data/node_modules/balanced-match/package.json +112 -0
  33. data/node_modules/brace-expansion/README.md +123 -0
  34. data/node_modules/brace-expansion/index.js +201 -0
  35. data/node_modules/brace-expansion/package.json +114 -0
  36. data/node_modules/chrome-launcher/.clang-format +6 -0
  37. data/node_modules/chrome-launcher/.npmignore +11 -0
  38. data/node_modules/chrome-launcher/README.md +123 -0
  39. data/node_modules/chrome-launcher/ask.js +32 -0
  40. data/node_modules/chrome-launcher/ask.ts +35 -0
  41. data/node_modules/chrome-launcher/chrome-finder.js +157 -0
  42. data/node_modules/chrome-launcher/chrome-finder.ts +186 -0
  43. data/node_modules/chrome-launcher/chrome-launcher.js +245 -0
  44. data/node_modules/chrome-launcher/chrome-launcher.ts +312 -0
  45. data/node_modules/chrome-launcher/compiled-check.js +14 -0
  46. data/node_modules/chrome-launcher/flags.js +27 -0
  47. data/node_modules/chrome-launcher/flags.ts +26 -0
  48. data/node_modules/chrome-launcher/index.js +7 -0
  49. data/node_modules/chrome-launcher/index.ts +1 -0
  50. data/node_modules/chrome-launcher/manual-chrome-launcher.js +30 -0
  51. data/node_modules/chrome-launcher/package.json +116 -0
  52. data/node_modules/chrome-launcher/random-port.js +24 -0
  53. data/node_modules/chrome-launcher/random-port.ts +23 -0
  54. data/node_modules/chrome-launcher/tsconfig.json +19 -0
  55. data/node_modules/chrome-launcher/utils.js +52 -0
  56. data/node_modules/chrome-launcher/utils.ts +44 -0
  57. data/node_modules/chrome-launcher/yarn.lock +1486 -0
  58. data/node_modules/chrome-remote-interface/LICENSE +18 -0
  59. data/node_modules/chrome-remote-interface/README.md +849 -0
  60. data/node_modules/chrome-remote-interface/bin/client.js +337 -0
  61. data/node_modules/chrome-remote-interface/chrome-remote-interface.js +11 -0
  62. data/node_modules/chrome-remote-interface/index.js +39 -0
  63. data/node_modules/chrome-remote-interface/lib/api.js +84 -0
  64. data/node_modules/chrome-remote-interface/lib/chrome.js +307 -0
  65. data/node_modules/chrome-remote-interface/lib/defaults.js +4 -0
  66. data/node_modules/chrome-remote-interface/lib/devtools.js +245 -0
  67. data/node_modules/chrome-remote-interface/lib/external-request.js +28 -0
  68. data/node_modules/chrome-remote-interface/lib/protocol.json +13780 -0
  69. data/node_modules/chrome-remote-interface/lib/websocket-wrapper.js +32 -0
  70. data/node_modules/chrome-remote-interface/package.json +128 -0
  71. data/node_modules/chrome-remote-interface/webpack.config.js +55 -0
  72. data/node_modules/commander/Readme.md +195 -0
  73. data/node_modules/commander/index.js +851 -0
  74. data/node_modules/commander/package.json +92 -0
  75. data/node_modules/concat-map/.travis.yml +4 -0
  76. data/node_modules/concat-map/LICENSE +18 -0
  77. data/node_modules/concat-map/README.markdown +62 -0
  78. data/node_modules/concat-map/example/map.js +6 -0
  79. data/node_modules/concat-map/index.js +13 -0
  80. data/node_modules/concat-map/package.json +117 -0
  81. data/node_modules/concat-map/test/map.js +39 -0
  82. data/node_modules/debug/.coveralls.yml +1 -0
  83. data/node_modules/debug/.eslintrc +11 -0
  84. data/node_modules/debug/.npmignore +9 -0
  85. data/node_modules/debug/.travis.yml +14 -0
  86. data/node_modules/debug/CHANGELOG.md +357 -0
  87. data/node_modules/debug/LICENSE +19 -0
  88. data/node_modules/debug/Makefile +50 -0
  89. data/node_modules/debug/Readme.md +312 -0
  90. data/node_modules/debug/component.json +19 -0
  91. data/node_modules/debug/karma.conf.js +70 -0
  92. data/node_modules/debug/node.js +1 -0
  93. data/node_modules/debug/package.json +124 -0
  94. data/node_modules/debug/src/browser.js +185 -0
  95. data/node_modules/debug/src/debug.js +202 -0
  96. data/node_modules/debug/src/index.js +10 -0
  97. data/node_modules/debug/src/node.js +246 -0
  98. data/node_modules/fs.realpath/LICENSE +43 -0
  99. data/node_modules/fs.realpath/README.md +33 -0
  100. data/node_modules/fs.realpath/index.js +66 -0
  101. data/node_modules/fs.realpath/old.js +303 -0
  102. data/node_modules/fs.realpath/package.json +94 -0
  103. data/node_modules/glob/LICENSE +15 -0
  104. data/node_modules/glob/README.md +368 -0
  105. data/node_modules/glob/changelog.md +67 -0
  106. data/node_modules/glob/common.js +240 -0
  107. data/node_modules/glob/glob.js +790 -0
  108. data/node_modules/glob/package.json +112 -0
  109. data/node_modules/glob/sync.js +486 -0
  110. data/node_modules/html-pdf-chrome/.npmignore +9 -0
  111. data/node_modules/html-pdf-chrome/LICENSE +21 -0
  112. data/node_modules/html-pdf-chrome/README.md +165 -0
  113. data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.d.ts +87 -0
  114. data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.js +4 -0
  115. data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.js.map +1 -0
  116. data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.d.ts +120 -0
  117. data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.js +206 -0
  118. data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.js.map +1 -0
  119. data/node_modules/html-pdf-chrome/lib/src/CreateResult.d.ts +70 -0
  120. data/node_modules/html-pdf-chrome/lib/src/CreateResult.js +98 -0
  121. data/node_modules/html-pdf-chrome/lib/src/CreateResult.js.map +1 -0
  122. data/node_modules/html-pdf-chrome/lib/src/index.d.ts +72 -0
  123. data/node_modules/html-pdf-chrome/lib/src/index.js +123 -0
  124. data/node_modules/html-pdf-chrome/lib/src/index.js.map +1 -0
  125. data/node_modules/html-pdf-chrome/package.json +133 -0
  126. data/node_modules/html-pdf-chrome/src/ChromePrintOptions.ts +99 -0
  127. data/node_modules/html-pdf-chrome/src/CompletionTrigger.ts +201 -0
  128. data/node_modules/html-pdf-chrome/src/CreateResult.ts +100 -0
  129. data/node_modules/html-pdf-chrome/src/index.ts +179 -0
  130. data/node_modules/inflight/LICENSE +15 -0
  131. data/node_modules/inflight/README.md +37 -0
  132. data/node_modules/inflight/inflight.js +54 -0
  133. data/node_modules/inflight/package.json +105 -0
  134. data/node_modules/inherits/LICENSE +16 -0
  135. data/node_modules/inherits/README.md +42 -0
  136. data/node_modules/inherits/inherits.js +7 -0
  137. data/node_modules/inherits/inherits_browser.js +23 -0
  138. data/node_modules/inherits/package.json +97 -0
  139. data/node_modules/lighthouse-logger/README.md +4 -0
  140. data/node_modules/lighthouse-logger/index.js +212 -0
  141. data/node_modules/lighthouse-logger/package.json +69 -0
  142. data/node_modules/lighthouse-logger/yarn.lock +13 -0
  143. data/node_modules/minimatch/LICENSE +15 -0
  144. data/node_modules/minimatch/README.md +209 -0
  145. data/node_modules/minimatch/minimatch.js +923 -0
  146. data/node_modules/minimatch/package.json +99 -0
  147. data/node_modules/minimist/.travis.yml +4 -0
  148. data/node_modules/minimist/LICENSE +18 -0
  149. data/node_modules/minimist/example/parse.js +2 -0
  150. data/node_modules/minimist/index.js +187 -0
  151. data/node_modules/minimist/package.json +101 -0
  152. data/node_modules/minimist/readme.markdown +73 -0
  153. data/node_modules/minimist/test/dash.js +24 -0
  154. data/node_modules/minimist/test/default_bool.js +20 -0
  155. data/node_modules/minimist/test/dotted.js +16 -0
  156. data/node_modules/minimist/test/long.js +31 -0
  157. data/node_modules/minimist/test/parse.js +318 -0
  158. data/node_modules/minimist/test/parse_modified.js +9 -0
  159. data/node_modules/minimist/test/short.js +67 -0
  160. data/node_modules/minimist/test/whitespace.js +8 -0
  161. data/node_modules/mkdirp/.travis.yml +8 -0
  162. data/node_modules/mkdirp/LICENSE +21 -0
  163. data/node_modules/mkdirp/bin/cmd.js +33 -0
  164. data/node_modules/mkdirp/bin/usage.txt +12 -0
  165. data/node_modules/mkdirp/examples/pow.js +6 -0
  166. data/node_modules/mkdirp/index.js +98 -0
  167. data/node_modules/mkdirp/package.json +93 -0
  168. data/node_modules/mkdirp/readme.markdown +100 -0
  169. data/node_modules/mkdirp/test/chmod.js +41 -0
  170. data/node_modules/mkdirp/test/clobber.js +38 -0
  171. data/node_modules/mkdirp/test/mkdirp.js +28 -0
  172. data/node_modules/mkdirp/test/opts_fs.js +29 -0
  173. data/node_modules/mkdirp/test/opts_fs_sync.js +27 -0
  174. data/node_modules/mkdirp/test/perm.js +32 -0
  175. data/node_modules/mkdirp/test/perm_sync.js +36 -0
  176. data/node_modules/mkdirp/test/race.js +37 -0
  177. data/node_modules/mkdirp/test/rel.js +32 -0
  178. data/node_modules/mkdirp/test/return.js +25 -0
  179. data/node_modules/mkdirp/test/return_sync.js +24 -0
  180. data/node_modules/mkdirp/test/root.js +19 -0
  181. data/node_modules/mkdirp/test/sync.js +32 -0
  182. data/node_modules/mkdirp/test/umask.js +28 -0
  183. data/node_modules/mkdirp/test/umask_sync.js +32 -0
  184. data/node_modules/ms/README.md +51 -0
  185. data/node_modules/ms/index.js +152 -0
  186. data/node_modules/ms/license.md +21 -0
  187. data/node_modules/ms/package.json +109 -0
  188. data/node_modules/once/LICENSE +15 -0
  189. data/node_modules/once/README.md +79 -0
  190. data/node_modules/once/once.js +42 -0
  191. data/node_modules/once/package.json +101 -0
  192. data/node_modules/path-is-absolute/index.js +20 -0
  193. data/node_modules/path-is-absolute/license +21 -0
  194. data/node_modules/path-is-absolute/package.json +111 -0
  195. data/node_modules/path-is-absolute/readme.md +59 -0
  196. data/node_modules/rimraf/LICENSE +15 -0
  197. data/node_modules/rimraf/README.md +101 -0
  198. data/node_modules/rimraf/bin.js +50 -0
  199. data/node_modules/rimraf/package.json +99 -0
  200. data/node_modules/rimraf/rimraf.js +363 -0
  201. data/node_modules/ultron/LICENSE +22 -0
  202. data/node_modules/ultron/index.js +138 -0
  203. data/node_modules/ultron/package.json +112 -0
  204. data/node_modules/wrappy/LICENSE +15 -0
  205. data/node_modules/wrappy/README.md +36 -0
  206. data/node_modules/wrappy/package.json +97 -0
  207. data/node_modules/wrappy/wrappy.js +33 -0
  208. data/node_modules/ws/LICENSE +21 -0
  209. data/node_modules/ws/README.md +259 -0
  210. data/node_modules/ws/SECURITY.md +33 -0
  211. data/node_modules/ws/index.js +15 -0
  212. data/node_modules/ws/lib/BufferUtil.fallback.js +56 -0
  213. data/node_modules/ws/lib/BufferUtil.js +15 -0
  214. data/node_modules/ws/lib/ErrorCodes.js +28 -0
  215. data/node_modules/ws/lib/EventTarget.js +158 -0
  216. data/node_modules/ws/lib/Extensions.js +69 -0
  217. data/node_modules/ws/lib/PerMessageDeflate.js +339 -0
  218. data/node_modules/ws/lib/Receiver.js +520 -0
  219. data/node_modules/ws/lib/Sender.js +438 -0
  220. data/node_modules/ws/lib/Validation.fallback.js +9 -0
  221. data/node_modules/ws/lib/Validation.js +17 -0
  222. data/node_modules/ws/lib/WebSocket.js +705 -0
  223. data/node_modules/ws/lib/WebSocketServer.js +336 -0
  224. data/node_modules/ws/package.json +122 -0
  225. data/package.json +26 -0
  226. data/samples/sample.html +13 -0
  227. data/script/rasterize.js +18 -0
  228. metadata +325 -0
@@ -0,0 +1,8 @@
1
+ var parse = require('../');
2
+ var test = require('tape');
3
+
4
+ test('whitespace should be whitespace' , function (t) {
5
+ t.plan(1);
6
+ var x = parse([ '-x', '\t' ]).x;
7
+ t.equal(x, '\t');
8
+ });
@@ -0,0 +1,8 @@
1
+ language: node_js
2
+ node_js:
3
+ - "0.8"
4
+ - "0.10"
5
+ - "0.12"
6
+ - "iojs"
7
+ before_install:
8
+ - npm install -g npm@~1.4.6
@@ -0,0 +1,21 @@
1
+ Copyright 2010 James Halliday (mail@substack.net)
2
+
3
+ This project is free software released under the MIT/X11 license:
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+
3
+ var mkdirp = require('../');
4
+ var minimist = require('minimist');
5
+ var fs = require('fs');
6
+
7
+ var argv = minimist(process.argv.slice(2), {
8
+ alias: { m: 'mode', h: 'help' },
9
+ string: [ 'mode' ]
10
+ });
11
+ if (argv.help) {
12
+ fs.createReadStream(__dirname + '/usage.txt').pipe(process.stdout);
13
+ return;
14
+ }
15
+
16
+ var paths = argv._.slice();
17
+ var mode = argv.mode ? parseInt(argv.mode, 8) : undefined;
18
+
19
+ (function next () {
20
+ if (paths.length === 0) return;
21
+ var p = paths.shift();
22
+
23
+ if (mode === undefined) mkdirp(p, cb)
24
+ else mkdirp(p, mode, cb)
25
+
26
+ function cb (err) {
27
+ if (err) {
28
+ console.error(err.message);
29
+ process.exit(1);
30
+ }
31
+ else next();
32
+ }
33
+ })();
@@ -0,0 +1,12 @@
1
+ usage: mkdirp [DIR1,DIR2..] {OPTIONS}
2
+
3
+ Create each supplied directory including any necessary parent directories that
4
+ don't yet exist.
5
+
6
+ If the directory already exists, do nothing.
7
+
8
+ OPTIONS are:
9
+
10
+ -m, --mode If a directory needs to be created, set the mode as an octal
11
+ permission string.
12
+
@@ -0,0 +1,6 @@
1
+ var mkdirp = require('mkdirp');
2
+
3
+ mkdirp('/tmp/foo/bar/baz', function (err) {
4
+ if (err) console.error(err)
5
+ else console.log('pow!')
6
+ });
@@ -0,0 +1,98 @@
1
+ var path = require('path');
2
+ var fs = require('fs');
3
+ var _0777 = parseInt('0777', 8);
4
+
5
+ module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
6
+
7
+ function mkdirP (p, opts, f, made) {
8
+ if (typeof opts === 'function') {
9
+ f = opts;
10
+ opts = {};
11
+ }
12
+ else if (!opts || typeof opts !== 'object') {
13
+ opts = { mode: opts };
14
+ }
15
+
16
+ var mode = opts.mode;
17
+ var xfs = opts.fs || fs;
18
+
19
+ if (mode === undefined) {
20
+ mode = _0777 & (~process.umask());
21
+ }
22
+ if (!made) made = null;
23
+
24
+ var cb = f || function () {};
25
+ p = path.resolve(p);
26
+
27
+ xfs.mkdir(p, mode, function (er) {
28
+ if (!er) {
29
+ made = made || p;
30
+ return cb(null, made);
31
+ }
32
+ switch (er.code) {
33
+ case 'ENOENT':
34
+ mkdirP(path.dirname(p), opts, function (er, made) {
35
+ if (er) cb(er, made);
36
+ else mkdirP(p, opts, cb, made);
37
+ });
38
+ break;
39
+
40
+ // In the case of any other error, just see if there's a dir
41
+ // there already. If so, then hooray! If not, then something
42
+ // is borked.
43
+ default:
44
+ xfs.stat(p, function (er2, stat) {
45
+ // if the stat fails, then that's super weird.
46
+ // let the original error be the failure reason.
47
+ if (er2 || !stat.isDirectory()) cb(er, made)
48
+ else cb(null, made);
49
+ });
50
+ break;
51
+ }
52
+ });
53
+ }
54
+
55
+ mkdirP.sync = function sync (p, opts, made) {
56
+ if (!opts || typeof opts !== 'object') {
57
+ opts = { mode: opts };
58
+ }
59
+
60
+ var mode = opts.mode;
61
+ var xfs = opts.fs || fs;
62
+
63
+ if (mode === undefined) {
64
+ mode = _0777 & (~process.umask());
65
+ }
66
+ if (!made) made = null;
67
+
68
+ p = path.resolve(p);
69
+
70
+ try {
71
+ xfs.mkdirSync(p, mode);
72
+ made = made || p;
73
+ }
74
+ catch (err0) {
75
+ switch (err0.code) {
76
+ case 'ENOENT' :
77
+ made = sync(path.dirname(p), opts, made);
78
+ sync(p, opts, made);
79
+ break;
80
+
81
+ // In the case of any other error, just see if there's a dir
82
+ // there already. If so, then hooray! If not, then something
83
+ // is borked.
84
+ default:
85
+ var stat;
86
+ try {
87
+ stat = xfs.statSync(p);
88
+ }
89
+ catch (err1) {
90
+ throw err0;
91
+ }
92
+ if (!stat.isDirectory()) throw err0;
93
+ break;
94
+ }
95
+ }
96
+
97
+ return made;
98
+ };
@@ -0,0 +1,93 @@
1
+ {
2
+ "_args": [
3
+ [
4
+ {
5
+ "raw": "mkdirp",
6
+ "scope": null,
7
+ "escapedName": "mkdirp",
8
+ "name": "mkdirp",
9
+ "rawSpec": "",
10
+ "spec": "latest",
11
+ "type": "tag"
12
+ },
13
+ "/Users/tomascelizna/Devel/dragonfly_chrome_headless"
14
+ ]
15
+ ],
16
+ "_from": "mkdirp@latest",
17
+ "_id": "mkdirp@0.5.1",
18
+ "_inCache": true,
19
+ "_location": "/mkdirp",
20
+ "_nodeVersion": "2.0.0",
21
+ "_npmUser": {
22
+ "name": "substack",
23
+ "email": "substack@gmail.com"
24
+ },
25
+ "_npmVersion": "2.9.0",
26
+ "_phantomChildren": {},
27
+ "_requested": {
28
+ "raw": "mkdirp",
29
+ "scope": null,
30
+ "escapedName": "mkdirp",
31
+ "name": "mkdirp",
32
+ "rawSpec": "",
33
+ "spec": "latest",
34
+ "type": "tag"
35
+ },
36
+ "_requiredBy": [
37
+ "#USER"
38
+ ],
39
+ "_resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
40
+ "_shasum": "30057438eac6cf7f8c4767f38648d6697d75c903",
41
+ "_shrinkwrap": null,
42
+ "_spec": "mkdirp",
43
+ "_where": "/Users/tomascelizna/Devel/dragonfly_chrome_headless",
44
+ "author": {
45
+ "name": "James Halliday",
46
+ "email": "mail@substack.net",
47
+ "url": "http://substack.net"
48
+ },
49
+ "bin": {
50
+ "mkdirp": "bin/cmd.js"
51
+ },
52
+ "bugs": {
53
+ "url": "https://github.com/substack/node-mkdirp/issues"
54
+ },
55
+ "dependencies": {
56
+ "minimist": "0.0.8"
57
+ },
58
+ "description": "Recursively mkdir, like `mkdir -p`",
59
+ "devDependencies": {
60
+ "mock-fs": "2 >=2.7.0",
61
+ "tap": "1"
62
+ },
63
+ "directories": {},
64
+ "dist": {
65
+ "shasum": "30057438eac6cf7f8c4767f38648d6697d75c903",
66
+ "tarball": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz"
67
+ },
68
+ "gitHead": "d4eff0f06093aed4f387e88e9fc301cb76beedc7",
69
+ "homepage": "https://github.com/substack/node-mkdirp#readme",
70
+ "keywords": [
71
+ "mkdir",
72
+ "directory"
73
+ ],
74
+ "license": "MIT",
75
+ "main": "index.js",
76
+ "maintainers": [
77
+ {
78
+ "name": "substack",
79
+ "email": "mail@substack.net"
80
+ }
81
+ ],
82
+ "name": "mkdirp",
83
+ "optionalDependencies": {},
84
+ "readme": "ERROR: No README data found!",
85
+ "repository": {
86
+ "type": "git",
87
+ "url": "git+https://github.com/substack/node-mkdirp.git"
88
+ },
89
+ "scripts": {
90
+ "test": "tap test/*.js"
91
+ },
92
+ "version": "0.5.1"
93
+ }
@@ -0,0 +1,100 @@
1
+ # mkdirp
2
+
3
+ Like `mkdir -p`, but in node.js!
4
+
5
+ [![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp)
6
+
7
+ # example
8
+
9
+ ## pow.js
10
+
11
+ ```js
12
+ var mkdirp = require('mkdirp');
13
+
14
+ mkdirp('/tmp/foo/bar/baz', function (err) {
15
+ if (err) console.error(err)
16
+ else console.log('pow!')
17
+ });
18
+ ```
19
+
20
+ Output
21
+
22
+ ```
23
+ pow!
24
+ ```
25
+
26
+ And now /tmp/foo/bar/baz exists, huzzah!
27
+
28
+ # methods
29
+
30
+ ```js
31
+ var mkdirp = require('mkdirp');
32
+ ```
33
+
34
+ ## mkdirp(dir, opts, cb)
35
+
36
+ Create a new directory and any necessary subdirectories at `dir` with octal
37
+ permission string `opts.mode`. If `opts` is a non-object, it will be treated as
38
+ the `opts.mode`.
39
+
40
+ If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.
41
+
42
+ `cb(err, made)` fires with the error or the first directory `made`
43
+ that had to be created, if any.
44
+
45
+ You can optionally pass in an alternate `fs` implementation by passing in
46
+ `opts.fs`. Your implementation should have `opts.fs.mkdir(path, mode, cb)` and
47
+ `opts.fs.stat(path, cb)`.
48
+
49
+ ## mkdirp.sync(dir, opts)
50
+
51
+ Synchronously create a new directory and any necessary subdirectories at `dir`
52
+ with octal permission string `opts.mode`. If `opts` is a non-object, it will be
53
+ treated as the `opts.mode`.
54
+
55
+ If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.
56
+
57
+ Returns the first directory that had to be created, if any.
58
+
59
+ You can optionally pass in an alternate `fs` implementation by passing in
60
+ `opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)` and
61
+ `opts.fs.statSync(path)`.
62
+
63
+ # usage
64
+
65
+ This package also ships with a `mkdirp` command.
66
+
67
+ ```
68
+ usage: mkdirp [DIR1,DIR2..] {OPTIONS}
69
+
70
+ Create each supplied directory including any necessary parent directories that
71
+ don't yet exist.
72
+
73
+ If the directory already exists, do nothing.
74
+
75
+ OPTIONS are:
76
+
77
+ -m, --mode If a directory needs to be created, set the mode as an octal
78
+ permission string.
79
+
80
+ ```
81
+
82
+ # install
83
+
84
+ With [npm](http://npmjs.org) do:
85
+
86
+ ```
87
+ npm install mkdirp
88
+ ```
89
+
90
+ to get the library, or
91
+
92
+ ```
93
+ npm install -g mkdirp
94
+ ```
95
+
96
+ to get the command.
97
+
98
+ # license
99
+
100
+ MIT
@@ -0,0 +1,41 @@
1
+ var mkdirp = require('../').mkdirp;
2
+ var path = require('path');
3
+ var fs = require('fs');
4
+ var test = require('tap').test;
5
+ var _0777 = parseInt('0777', 8);
6
+ var _0755 = parseInt('0755', 8);
7
+ var _0744 = parseInt('0744', 8);
8
+
9
+ var ps = [ '', 'tmp' ];
10
+
11
+ for (var i = 0; i < 25; i++) {
12
+ var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
13
+ ps.push(dir);
14
+ }
15
+
16
+ var file = ps.join('/');
17
+
18
+ test('chmod-pre', function (t) {
19
+ var mode = _0744
20
+ mkdirp(file, mode, function (er) {
21
+ t.ifError(er, 'should not error');
22
+ fs.stat(file, function (er, stat) {
23
+ t.ifError(er, 'should exist');
24
+ t.ok(stat && stat.isDirectory(), 'should be directory');
25
+ t.equal(stat && stat.mode & _0777, mode, 'should be 0744');
26
+ t.end();
27
+ });
28
+ });
29
+ });
30
+
31
+ test('chmod', function (t) {
32
+ var mode = _0755
33
+ mkdirp(file, mode, function (er) {
34
+ t.ifError(er, 'should not error');
35
+ fs.stat(file, function (er, stat) {
36
+ t.ifError(er, 'should exist');
37
+ t.ok(stat && stat.isDirectory(), 'should be directory');
38
+ t.end();
39
+ });
40
+ });
41
+ });
@@ -0,0 +1,38 @@
1
+ var mkdirp = require('../').mkdirp;
2
+ var path = require('path');
3
+ var fs = require('fs');
4
+ var test = require('tap').test;
5
+ var _0755 = parseInt('0755', 8);
6
+
7
+ var ps = [ '', 'tmp' ];
8
+
9
+ for (var i = 0; i < 25; i++) {
10
+ var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
11
+ ps.push(dir);
12
+ }
13
+
14
+ var file = ps.join('/');
15
+
16
+ // a file in the way
17
+ var itw = ps.slice(0, 3).join('/');
18
+
19
+
20
+ test('clobber-pre', function (t) {
21
+ console.error("about to write to "+itw)
22
+ fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.');
23
+
24
+ fs.stat(itw, function (er, stat) {
25
+ t.ifError(er)
26
+ t.ok(stat && stat.isFile(), 'should be file')
27
+ t.end()
28
+ })
29
+ })
30
+
31
+ test('clobber', function (t) {
32
+ t.plan(2);
33
+ mkdirp(file, _0755, function (err) {
34
+ t.ok(err);
35
+ t.equal(err.code, 'ENOTDIR');
36
+ t.end();
37
+ });
38
+ });