New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fs-thumbnail

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-thumbnail - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

test/generator-test.js

44

lib/ThumbnailGenerator.js

@@ -13,2 +13,4 @@ /**

const Prefix = '[fs-thumbnail]';
// Load peer dependencies if they are available

@@ -89,5 +91,5 @@ const LibNames = {

if (!LibLoaded[libName]) return resolve(null);
if (LibTries[libName] && !LibTries[libName].has(data.path, true)) resolve(null);
console.log(LibTries[libName].has(data.path, true));
console.log(LibTries[libName] && !LibTries[libName].has(data.path, true));
if (LibTries[libName] && !LibTries[libName].hasWithCheckpoints(p, '.', true)) {
return resolve(null);
}

@@ -98,6 +100,5 @@ const input = Libs[LibNames.sharp](p, {failOnError: false});

.jpeg({quality: q})
.toFile(o, err => {
if (err) return reject(err);
resolve(o);
});
.toFile(o)
.then(() => resolve(o))
.catch(reject);
} catch (error) {

@@ -143,15 +144,2 @@ reject(error);

_resolveWithFallback(promise, fallback, name, data) {
if (!promise) promise = Promise.resolve();
return promise
.then(result => {
if (result) return result;
return fallback(data).catch(error => {
if (this.verbose) console.error(`[fs-thumbnail] "${name}" failed. Reason: ${error.message}`);
return fallback(data);
});
});
}
/**

@@ -181,6 +169,18 @@ * @param {object} data

let currPromise = null;
let currPromise = Promise.resolve();
for (let i = 0; i < this.functionsToTry.length; ++i) {
const func = this.functionsToTry[i];
currPromise = this._resolveWithFallback(currPromise, func, func.name, fullData);
const name = func.name;
currPromise = currPromise
.then(result => {
if (result) return result;
return func(data)
.then(result => {
if (result) return result;
console.warn(`${Prefix} "${name}" could not generate a thumbnail.`);
})
.catch(err => console.error(`${Prefix} "${name}" failed. Reason: ${err.message}`));
});
}

@@ -187,0 +187,0 @@

{
"name": "fs-thumbnail",
"version": "1.0.2",
"version": "1.0.3",
"description": "Library for generation of thumbnails based on file system paths.",
"main": "index.js",
"scripts": {
"test": "mocha --recursive ./lib/"
"test": "node ./test/generator-test.js"
},

@@ -37,3 +37,3 @@ "repository": {

"bluebird": "^3.5.5",
"exact-trie": "^1.0.0",
"exact-trie": "^1.0.2",
"fluent-ffmpeg": "^2.1.2",

@@ -40,0 +40,0 @@ "fs-extra": "^8.0.1"

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