fs-thumbnail
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -69,3 +69,7 @@ /** | ||
this.functionsToTry = [this._trySharp, this._tryFluentFfmpeg]; | ||
this.functionsToTry = [ | ||
['sharp', (data) => this._trySharp(data)], | ||
['ffmpeg 5%', (data) => this._tryFluentFfmpeg(data, '5%')], | ||
['ffmpeg raw', (data) => this._tryFluentFfmpeg(data)], | ||
]; | ||
} | ||
@@ -114,5 +118,6 @@ | ||
* @param {number} data.quality | ||
* @param {string} [timestamp] | ||
* @private | ||
*/ | ||
_tryFluentFfmpeg(data) { | ||
_tryFluentFfmpeg(data, timestamp = null) { | ||
const p = data.path; | ||
@@ -128,11 +133,13 @@ const o = data.output; | ||
const screenshotOpts = { | ||
filename: outData.base, | ||
folder: outData.dir, | ||
size: size, | ||
}; | ||
if (timestamp) screenshotOpts.timestamps = [timestamp], | ||
ffmpeg(p) | ||
.on('error', error => reject(error)) | ||
.on('end', () => resolve(o)) | ||
.screenshots({ | ||
timestamps: ['6%'], | ||
filename: outData.base, | ||
folder: outData.dir, | ||
size: size, | ||
}); | ||
.screenshots(screenshotOpts); | ||
} catch (error) { | ||
@@ -170,4 +177,4 @@ reject(error); | ||
for (let i = 0; i < this.functionsToTry.length; ++i) { | ||
const func = this.functionsToTry[i]; | ||
const name = func.name; | ||
const name = this.functionsToTry[i][0]; | ||
const func = this.functionsToTry[i][1]; | ||
@@ -174,0 +181,0 @@ currPromise = currPromise |
{ | ||
"name": "fs-thumbnail", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "Library for generation of thumbnails based on file system paths.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
17457
183