Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pullgur

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pullgur - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

2

dist/index.js

@@ -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) {

19

dist/saveImages.js

@@ -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\\..\\', '\\')
}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc