]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/image-utils.ts
Remove unused timeout option
[github/Chocobozzz/PeerTube.git] / server / helpers / image-utils.ts
index 122fb009d1950b10f644e26d0e42463d255668eb..033be2c50970df39a70463720682cd3604da063b 100644 (file)
@@ -1,12 +1,12 @@
 import { copy, readFile, remove, rename } from 'fs-extra'
-import * as Jimp from 'jimp'
-import { v4 as uuidv4 } from 'uuid'
+import Jimp, { read } from 'jimp'
 import { getLowercaseExtension } from './core-utils'
 import { convertWebPToJPG, processGIF } from './ffmpeg-utils'
 import { logger } from './logger'
+import { buildUUID } from './uuid'
 
 function generateImageFilename (extension = '.jpg') {
-  return uuidv4() + extension
+  return buildUUID() + extension
 }
 
 async function processImage (
@@ -47,7 +47,7 @@ async function jimpProcessor (path: string, destination: string, newSize: { widt
   const inputBuffer = await readFile(path)
 
   try {
-    jimpInstance = await Jimp.read(inputBuffer)
+    jimpInstance = await read(inputBuffer)
   } catch (err) {
     logger.debug('Cannot read %s with jimp. Try to convert the image using ffmpeg first.', path, { err })
 
@@ -55,7 +55,7 @@ async function jimpProcessor (path: string, destination: string, newSize: { widt
     await convertWebPToJPG(path, newName)
     await rename(newName, path)
 
-    jimpInstance = await Jimp.read(path)
+    jimpInstance = await read(path)
   }
 
   await remove(destination)