Comparing version 1.0.1 to 1.1.0
@@ -28,2 +28,4 @@ #!/usr/bin/env node | ||
return (0, _saveImages.saveImages)(response, path); | ||
}).then(function (response) { | ||
return console.log('Images saved to ' + response); | ||
}); | ||
@@ -30,0 +32,0 @@ } else if (help) { |
@@ -18,4 +18,12 @@ 'use strict'; | ||
var checkPathExists = function checkPathExists(path) { | ||
if (!_fs2.default.existsSync(path)) { | ||
_fs2.default.mkdirSync(path); | ||
} | ||
}; | ||
var saveImages = exports.saveImages = function saveImages(images, path) { | ||
var defaultPath = __dirname + '\\..\\images\\'; | ||
var iterations = 0; | ||
path ? checkPathExists(path) : checkPathExists(defaultPath); | ||
images.map(function (i) { | ||
@@ -34,8 +42,11 @@ var imageData = void 0; | ||
} | ||
iterations++; | ||
}); | ||
if (path) { | ||
console.log('Images saved to ' + path); | ||
} else { | ||
console.log('Images saved to ' + defaultPath.replace('\\dist\\..\\', '\\')); | ||
if (iterations === images.length) { | ||
if (path) { | ||
return path; | ||
} else { | ||
return defaultPath.replace('\\dist\\..\\', '\\'); | ||
} | ||
} | ||
}; |
{ | ||
"name": "pullgur", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Javascript CLI tool to save images from the imgur API to your local system", | ||
"main": "./dist/index.js", | ||
"repository": "empty", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/dharvey0310/pullgur.git" | ||
}, | ||
"author": "David Harvey", | ||
@@ -28,3 +31,10 @@ "license": "MIT", | ||
"pullgur": "./dist/index.js" | ||
} | ||
}, | ||
"keywords": [ | ||
"cli", | ||
"imgur", | ||
"images", | ||
"hard drive", | ||
"api" | ||
] | ||
} |
@@ -5,2 +5,4 @@ # pullgur | ||
**1.1.0** Checks if output directory exists and creates the directory if required | ||
--- | ||
@@ -7,0 +9,0 @@ Install |
@@ -24,2 +24,3 @@ #!/usr/bin/env node | ||
.then(response => saveImages(response, path)) | ||
.then(response => console.log('Images saved to ' + response)) | ||
} else if (help) { | ||
@@ -26,0 +27,0 @@ displayHelp() |
@@ -6,4 +6,12 @@ 'use strict' | ||
const checkPathExists = (path) => { | ||
if (!fs.existsSync(path)) { | ||
fs.mkdirSync(path) | ||
} | ||
} | ||
export const saveImages = (images, path) => { | ||
let defaultPath = __dirname + '\\..\\images\\' | ||
let iterations = 0 | ||
path ? checkPathExists(path) : checkPathExists(defaultPath) | ||
images.map(i => { | ||
@@ -22,8 +30,11 @@ let imageData | ||
} | ||
iterations ++ | ||
}) | ||
if (path) { | ||
console.log('Images saved to ' + path) | ||
} else { | ||
console.log('Images saved to ' + defaultPath.replace('\\dist\\..\\', '\\')) | ||
if (iterations === images.length) { | ||
if (path) { | ||
return path | ||
} else { | ||
return defaultPath.replace('\\dist\\..\\', '\\') | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
90304
226
28
2