Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.

Commit

Permalink
Added auto creating directory if it does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Kudelin committed Sep 6, 2016
1 parent f4dc2ff commit 5249436
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/documentScreenshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@

var async = require('async'),
fs = require('fs'),
rimraf = require('rimraf'),
rimraf = require('rimraf')
mkdirp = require("mkdirp"),
generateUUID = require('./generateUUID.js'),
path = require('path'),
q = require('q');
Expand Down Expand Up @@ -223,6 +224,7 @@ module.exports = function documentScreenshot(fileName) {
var col = gm(x.shift());
col.append.apply(col, x);

mkdirp.sync(path.dirname(fileName));
if (!screenshot) {
screenshot = col;
col.write(fileName, cb);
Expand All @@ -238,6 +240,7 @@ module.exports = function documentScreenshot(fileName) {
* crop screenshot regarding page size
*/
function() {
mkdirp.sync(path.dirname(fileName));
gm(fileName).crop(response.execute[0].value.documentWidth, response.execute[0].value.documentHeight, 0, 0).write(fileName, arguments[arguments.length - 1]);
},

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"q": "^1.4.1",
"request": "^2.55.0",
"rimraf": "^2.3.2",
"mkdirp": "0.5.1",
"tar": "^2.1.0",
"fs-extra": "^0.18.2",
"tar.gz": "^1.0.1"
Expand Down

0 comments on commit 5249436

Please sign in to comment.