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.5 to 1.0.6

test/files/google-example.webp

2

package.json
{
"name": "fs-thumbnail",
"version": "1.0.5",
"version": "1.0.6",
"description": "Library for generation of thumbnails based on file system paths.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -27,3 +27,4 @@ # fs-thumbnail

# On Debian/Ubuntu
# Make `ffmpeg` command available in your PATH.
# E.g. on Debian and Ubuntu you can run:
apt install ffmpeg

@@ -44,4 +45,4 @@ ```

output: '/thumbnail/folder/thumbnail.jpg',
size: 300,
quality: 70,
size: 300, // You can override the default size per thumbnail
quality: 70, // You can override the default quality per thumbnail
})

@@ -48,0 +49,0 @@ .then(thumbnailPath => {

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

const path = require('path');
const fs = require('fs-extra');
const Promise = require('bluebird');

@@ -13,14 +15,31 @@ const ThumbGenerator = require('../lib/ThumbnailGenerator');

const input = path.join(__dirname, 'images', 'google-example.webp');
const output = path.join(__dirname, 'thumbs', 'google-example.thumb.jpg');
const inputDir = path.join(__dirname, 'files');
const outputDir = path.join(__dirname, 'thumbs');
thumbGen.getThumbnail({
path: input,
output: output,
size: 300,
quality: 70,
})
.then(thumbnailPath => {
if (!thumbnailPath) console.log('Could not generate the thumbnail!');
else console.log(`Thumbnail generated! Find it here: ${thumbnailPath}`);
});
const files = fs.readdirSync(inputDir);
let i = 0;
const createThumbPromise = (index) => {
if (index >= files.length) return Promise.resolve();
const file = files[index];
const parsed = path.parse(file);
const inPath = path.join(inputDir, file);
const outPath = path.join(outputDir, `${parsed.name}.thumb.jpg`);
return thumbGen.getThumbnail({
path: inPath,
output: outPath,
size: 300,
quality: 70,
})
.then(thumbnailPath => {
if (!thumbnailPath) console.log(`${file}: Could not generate the thumbnail!`);
else console.log(`${file}: Thumbnail generated! Find it here: ${outPath}`);
})
.then(() => createThumbPromise(index + 1));
};
createThumbPromise(0)
.catch(error => console.error(`Unexpected error occurred: ${error}`));
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