dragonfly_chrome_headless 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +12 -0
- data/Gemfile +4 -0
- data/README.md +53 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/dragonfly_chrome_headless.gemspec +27 -0
- data/lib/dragonfly_chrome_headless.rb +9 -0
- data/lib/dragonfly_chrome_headless/plugin.rb +17 -0
- data/lib/dragonfly_chrome_headless/processors/rasterize.rb +33 -0
- data/lib/dragonfly_chrome_headless/version.rb +3 -0
- data/node_modules/.bin/chrome-remote-interface +1 -0
- data/node_modules/.bin/mkdirp +1 -0
- data/node_modules/.bin/rimraf +1 -0
- data/node_modules/@types/core-js/LICENSE +21 -0
- data/node_modules/@types/core-js/README.md +16 -0
- data/node_modules/@types/core-js/index.d.ts +2452 -0
- data/node_modules/@types/core-js/package.json +85 -0
- data/node_modules/@types/mkdirp/README.md +18 -0
- data/node_modules/@types/mkdirp/index.d.ts +14 -0
- data/node_modules/@types/mkdirp/package.json +77 -0
- data/node_modules/@types/mkdirp/types-metadata.json +25 -0
- data/node_modules/@types/node/README.md +16 -0
- data/node_modules/@types/node/index.d.ts +4132 -0
- data/node_modules/@types/node/package.json +84 -0
- data/node_modules/balanced-match/.npmignore +5 -0
- data/node_modules/balanced-match/LICENSE.md +21 -0
- data/node_modules/balanced-match/README.md +91 -0
- data/node_modules/balanced-match/index.js +59 -0
- data/node_modules/balanced-match/package.json +112 -0
- data/node_modules/brace-expansion/README.md +123 -0
- data/node_modules/brace-expansion/index.js +201 -0
- data/node_modules/brace-expansion/package.json +114 -0
- data/node_modules/chrome-launcher/.clang-format +6 -0
- data/node_modules/chrome-launcher/.npmignore +11 -0
- data/node_modules/chrome-launcher/README.md +123 -0
- data/node_modules/chrome-launcher/ask.js +32 -0
- data/node_modules/chrome-launcher/ask.ts +35 -0
- data/node_modules/chrome-launcher/chrome-finder.js +157 -0
- data/node_modules/chrome-launcher/chrome-finder.ts +186 -0
- data/node_modules/chrome-launcher/chrome-launcher.js +245 -0
- data/node_modules/chrome-launcher/chrome-launcher.ts +312 -0
- data/node_modules/chrome-launcher/compiled-check.js +14 -0
- data/node_modules/chrome-launcher/flags.js +27 -0
- data/node_modules/chrome-launcher/flags.ts +26 -0
- data/node_modules/chrome-launcher/index.js +7 -0
- data/node_modules/chrome-launcher/index.ts +1 -0
- data/node_modules/chrome-launcher/manual-chrome-launcher.js +30 -0
- data/node_modules/chrome-launcher/package.json +116 -0
- data/node_modules/chrome-launcher/random-port.js +24 -0
- data/node_modules/chrome-launcher/random-port.ts +23 -0
- data/node_modules/chrome-launcher/tsconfig.json +19 -0
- data/node_modules/chrome-launcher/utils.js +52 -0
- data/node_modules/chrome-launcher/utils.ts +44 -0
- data/node_modules/chrome-launcher/yarn.lock +1486 -0
- data/node_modules/chrome-remote-interface/LICENSE +18 -0
- data/node_modules/chrome-remote-interface/README.md +849 -0
- data/node_modules/chrome-remote-interface/bin/client.js +337 -0
- data/node_modules/chrome-remote-interface/chrome-remote-interface.js +11 -0
- data/node_modules/chrome-remote-interface/index.js +39 -0
- data/node_modules/chrome-remote-interface/lib/api.js +84 -0
- data/node_modules/chrome-remote-interface/lib/chrome.js +307 -0
- data/node_modules/chrome-remote-interface/lib/defaults.js +4 -0
- data/node_modules/chrome-remote-interface/lib/devtools.js +245 -0
- data/node_modules/chrome-remote-interface/lib/external-request.js +28 -0
- data/node_modules/chrome-remote-interface/lib/protocol.json +13780 -0
- data/node_modules/chrome-remote-interface/lib/websocket-wrapper.js +32 -0
- data/node_modules/chrome-remote-interface/package.json +128 -0
- data/node_modules/chrome-remote-interface/webpack.config.js +55 -0
- data/node_modules/commander/Readme.md +195 -0
- data/node_modules/commander/index.js +851 -0
- data/node_modules/commander/package.json +92 -0
- data/node_modules/concat-map/.travis.yml +4 -0
- data/node_modules/concat-map/LICENSE +18 -0
- data/node_modules/concat-map/README.markdown +62 -0
- data/node_modules/concat-map/example/map.js +6 -0
- data/node_modules/concat-map/index.js +13 -0
- data/node_modules/concat-map/package.json +117 -0
- data/node_modules/concat-map/test/map.js +39 -0
- data/node_modules/debug/.coveralls.yml +1 -0
- data/node_modules/debug/.eslintrc +11 -0
- data/node_modules/debug/.npmignore +9 -0
- data/node_modules/debug/.travis.yml +14 -0
- data/node_modules/debug/CHANGELOG.md +357 -0
- data/node_modules/debug/LICENSE +19 -0
- data/node_modules/debug/Makefile +50 -0
- data/node_modules/debug/Readme.md +312 -0
- data/node_modules/debug/component.json +19 -0
- data/node_modules/debug/karma.conf.js +70 -0
- data/node_modules/debug/node.js +1 -0
- data/node_modules/debug/package.json +124 -0
- data/node_modules/debug/src/browser.js +185 -0
- data/node_modules/debug/src/debug.js +202 -0
- data/node_modules/debug/src/index.js +10 -0
- data/node_modules/debug/src/node.js +246 -0
- data/node_modules/fs.realpath/LICENSE +43 -0
- data/node_modules/fs.realpath/README.md +33 -0
- data/node_modules/fs.realpath/index.js +66 -0
- data/node_modules/fs.realpath/old.js +303 -0
- data/node_modules/fs.realpath/package.json +94 -0
- data/node_modules/glob/LICENSE +15 -0
- data/node_modules/glob/README.md +368 -0
- data/node_modules/glob/changelog.md +67 -0
- data/node_modules/glob/common.js +240 -0
- data/node_modules/glob/glob.js +790 -0
- data/node_modules/glob/package.json +112 -0
- data/node_modules/glob/sync.js +486 -0
- data/node_modules/html-pdf-chrome/.npmignore +9 -0
- data/node_modules/html-pdf-chrome/LICENSE +21 -0
- data/node_modules/html-pdf-chrome/README.md +165 -0
- data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.d.ts +87 -0
- data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.js +4 -0
- data/node_modules/html-pdf-chrome/lib/src/ChromePrintOptions.js.map +1 -0
- data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.d.ts +120 -0
- data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.js +206 -0
- data/node_modules/html-pdf-chrome/lib/src/CompletionTrigger.js.map +1 -0
- data/node_modules/html-pdf-chrome/lib/src/CreateResult.d.ts +70 -0
- data/node_modules/html-pdf-chrome/lib/src/CreateResult.js +98 -0
- data/node_modules/html-pdf-chrome/lib/src/CreateResult.js.map +1 -0
- data/node_modules/html-pdf-chrome/lib/src/index.d.ts +72 -0
- data/node_modules/html-pdf-chrome/lib/src/index.js +123 -0
- data/node_modules/html-pdf-chrome/lib/src/index.js.map +1 -0
- data/node_modules/html-pdf-chrome/package.json +133 -0
- data/node_modules/html-pdf-chrome/src/ChromePrintOptions.ts +99 -0
- data/node_modules/html-pdf-chrome/src/CompletionTrigger.ts +201 -0
- data/node_modules/html-pdf-chrome/src/CreateResult.ts +100 -0
- data/node_modules/html-pdf-chrome/src/index.ts +179 -0
- data/node_modules/inflight/LICENSE +15 -0
- data/node_modules/inflight/README.md +37 -0
- data/node_modules/inflight/inflight.js +54 -0
- data/node_modules/inflight/package.json +105 -0
- data/node_modules/inherits/LICENSE +16 -0
- data/node_modules/inherits/README.md +42 -0
- data/node_modules/inherits/inherits.js +7 -0
- data/node_modules/inherits/inherits_browser.js +23 -0
- data/node_modules/inherits/package.json +97 -0
- data/node_modules/lighthouse-logger/README.md +4 -0
- data/node_modules/lighthouse-logger/index.js +212 -0
- data/node_modules/lighthouse-logger/package.json +69 -0
- data/node_modules/lighthouse-logger/yarn.lock +13 -0
- data/node_modules/minimatch/LICENSE +15 -0
- data/node_modules/minimatch/README.md +209 -0
- data/node_modules/minimatch/minimatch.js +923 -0
- data/node_modules/minimatch/package.json +99 -0
- data/node_modules/minimist/.travis.yml +4 -0
- data/node_modules/minimist/LICENSE +18 -0
- data/node_modules/minimist/example/parse.js +2 -0
- data/node_modules/minimist/index.js +187 -0
- data/node_modules/minimist/package.json +101 -0
- data/node_modules/minimist/readme.markdown +73 -0
- data/node_modules/minimist/test/dash.js +24 -0
- data/node_modules/minimist/test/default_bool.js +20 -0
- data/node_modules/minimist/test/dotted.js +16 -0
- data/node_modules/minimist/test/long.js +31 -0
- data/node_modules/minimist/test/parse.js +318 -0
- data/node_modules/minimist/test/parse_modified.js +9 -0
- data/node_modules/minimist/test/short.js +67 -0
- data/node_modules/minimist/test/whitespace.js +8 -0
- data/node_modules/mkdirp/.travis.yml +8 -0
- data/node_modules/mkdirp/LICENSE +21 -0
- data/node_modules/mkdirp/bin/cmd.js +33 -0
- data/node_modules/mkdirp/bin/usage.txt +12 -0
- data/node_modules/mkdirp/examples/pow.js +6 -0
- data/node_modules/mkdirp/index.js +98 -0
- data/node_modules/mkdirp/package.json +93 -0
- data/node_modules/mkdirp/readme.markdown +100 -0
- data/node_modules/mkdirp/test/chmod.js +41 -0
- data/node_modules/mkdirp/test/clobber.js +38 -0
- data/node_modules/mkdirp/test/mkdirp.js +28 -0
- data/node_modules/mkdirp/test/opts_fs.js +29 -0
- data/node_modules/mkdirp/test/opts_fs_sync.js +27 -0
- data/node_modules/mkdirp/test/perm.js +32 -0
- data/node_modules/mkdirp/test/perm_sync.js +36 -0
- data/node_modules/mkdirp/test/race.js +37 -0
- data/node_modules/mkdirp/test/rel.js +32 -0
- data/node_modules/mkdirp/test/return.js +25 -0
- data/node_modules/mkdirp/test/return_sync.js +24 -0
- data/node_modules/mkdirp/test/root.js +19 -0
- data/node_modules/mkdirp/test/sync.js +32 -0
- data/node_modules/mkdirp/test/umask.js +28 -0
- data/node_modules/mkdirp/test/umask_sync.js +32 -0
- data/node_modules/ms/README.md +51 -0
- data/node_modules/ms/index.js +152 -0
- data/node_modules/ms/license.md +21 -0
- data/node_modules/ms/package.json +109 -0
- data/node_modules/once/LICENSE +15 -0
- data/node_modules/once/README.md +79 -0
- data/node_modules/once/once.js +42 -0
- data/node_modules/once/package.json +101 -0
- data/node_modules/path-is-absolute/index.js +20 -0
- data/node_modules/path-is-absolute/license +21 -0
- data/node_modules/path-is-absolute/package.json +111 -0
- data/node_modules/path-is-absolute/readme.md +59 -0
- data/node_modules/rimraf/LICENSE +15 -0
- data/node_modules/rimraf/README.md +101 -0
- data/node_modules/rimraf/bin.js +50 -0
- data/node_modules/rimraf/package.json +99 -0
- data/node_modules/rimraf/rimraf.js +363 -0
- data/node_modules/ultron/LICENSE +22 -0
- data/node_modules/ultron/index.js +138 -0
- data/node_modules/ultron/package.json +112 -0
- data/node_modules/wrappy/LICENSE +15 -0
- data/node_modules/wrappy/README.md +36 -0
- data/node_modules/wrappy/package.json +97 -0
- data/node_modules/wrappy/wrappy.js +33 -0
- data/node_modules/ws/LICENSE +21 -0
- data/node_modules/ws/README.md +259 -0
- data/node_modules/ws/SECURITY.md +33 -0
- data/node_modules/ws/index.js +15 -0
- data/node_modules/ws/lib/BufferUtil.fallback.js +56 -0
- data/node_modules/ws/lib/BufferUtil.js +15 -0
- data/node_modules/ws/lib/ErrorCodes.js +28 -0
- data/node_modules/ws/lib/EventTarget.js +158 -0
- data/node_modules/ws/lib/Extensions.js +69 -0
- data/node_modules/ws/lib/PerMessageDeflate.js +339 -0
- data/node_modules/ws/lib/Receiver.js +520 -0
- data/node_modules/ws/lib/Sender.js +438 -0
- data/node_modules/ws/lib/Validation.fallback.js +9 -0
- data/node_modules/ws/lib/Validation.js +17 -0
- data/node_modules/ws/lib/WebSocket.js +705 -0
- data/node_modules/ws/lib/WebSocketServer.js +336 -0
- data/node_modules/ws/package.json +122 -0
- data/package.json +26 -0
- data/samples/sample.html +13 -0
- data/script/rasterize.js +18 -0
- metadata +325 -0
@@ -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,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
|
+
});
|