]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/helpers/image-utils.ts
Add RSS feed to subscribe button
[github/Chocobozzz/PeerTube.git] / server / helpers / image-utils.ts
CommitLineData
ac81d1a0
C
1import 'multer'
2import * as sharp from 'sharp'
62689b94 3import { remove } from 'fs-extra'
ac81d1a0
C
4
5async function processImage (
02988fdc 6 physicalFile: { path: string },
ac81d1a0
C
7 destination: string,
8 newSize: { width: number, height: number }
9) {
10 await sharp(physicalFile.path)
11 .resize(newSize.width, newSize.height)
12 .toFile(destination)
13
62689b94 14 await remove(physicalFile.path)
ac81d1a0
C
15}
16
17// ---------------------------------------------------------------------------
18
19export {
20 processImage
21}