Compare commits
3 Commits
50e0d80448
...
e6b499f72b
Author | SHA1 | Date |
---|---|---|
Maksim Karasev | e6b499f72b | |
Maksim Karasev | e99da6e3d6 | |
Maksim Karasev | 6a086453c6 |
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"name": "personal-gallery",
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.1",
|
||||
"description": "",
|
||||
"scripts": {
|
||||
"server-dev": "yarn workspace server dev",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "server",
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.1",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
import sharp from 'sharp';
|
||||
import ffmpeg from 'fluent-ffmpeg';
|
||||
import tmp from 'tmp';
|
||||
import fs from 'fs';
|
||||
import util from 'util';
|
||||
import { promises as fs } from "fs";
|
||||
import path from 'path';
|
||||
import { FFMPEG_EXISTS, IMAGE_DIR } from '../utils/config';
|
||||
import { getImage } from './imageService';
|
||||
|
@ -54,8 +53,6 @@ export const getThumbnail = async (
|
|||
height: number = 160,
|
||||
): Promise<Buffer> => {
|
||||
const image = await getImage(filename);
|
||||
const readFilePromise = util.promisify(fs.readFile);
|
||||
const unlinkFilePromise = util.promisify(fs.unlink);
|
||||
let { imagebuffer } = image;
|
||||
logger.verbose('Thumbnail cache miss.');
|
||||
// Take a screenshot from videos
|
||||
|
@ -71,8 +68,8 @@ export const getThumbnail = async (
|
|||
path.join(IMAGE_DIR, filename),
|
||||
tmpDir.name,
|
||||
);
|
||||
imagebuffer = await readFilePromise(`${tmpDir.name}/temp.png`);
|
||||
await unlinkFilePromise(`${tmpDir.name}/temp.png`);
|
||||
imagebuffer = await fs.readFile(`${tmpDir.name}/temp.png`);
|
||||
await fs.unlink(`${tmpDir.name}/temp.png`);
|
||||
} catch (e: any) {
|
||||
logger.error(`${e.name}:${e.message}`);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ if (typeof REDIS_HOST !== 'undefined') {
|
|||
port: REDIS_PORT,
|
||||
password: REDIS_PASSWORD,
|
||||
db: 0,
|
||||
ttl: 600,
|
||||
ttl: 60 * 60 * 24 * 365,
|
||||
});
|
||||
} else if (typeof CACHE_DIR !== 'undefined') {
|
||||
thumbnailCache = cacheManager.caching({
|
||||
|
@ -25,7 +25,7 @@ if (typeof REDIS_HOST !== 'undefined') {
|
|||
options: {
|
||||
path: CACHE_DIR, // path for cached files
|
||||
subdirs: true, // create subdirectories to reduce the files in a single dir (default: false)
|
||||
zip: true, // zip files to save diskspace (default: false)
|
||||
zip: false, // zip files to save diskspace (default: false)
|
||||
},
|
||||
});
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "web",
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.1",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.10.5",
|
||||
|
|
Loading…
Reference in New Issue