From 00e43ddc0bf3d6dd719fc9295d156567fa2fecfb Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 26 Aug 2024 16:28:30 -0700 Subject: switch to bun --- lib/upload.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'lib/upload.js') diff --git a/lib/upload.js b/lib/upload.js index 0b558acf..0fb31ea5 100644 --- a/lib/upload.js +++ b/lib/upload.js @@ -3,7 +3,6 @@ import pump from "pump"; import Clone from "readable-stream-clone"; import fs from "fs"; import path from "path"; -import sharp from "sharp"; import { pipeline } from "stream"; import { g, s, db } from "$lib/db"; import { bail, fail } from "$lib/utils"; @@ -45,15 +44,13 @@ export default async (req, res) => { if (format !== "image" && !["jpg", "jpeg", "png"].includes(ext)) fail("unsupported file type"); - let t = sharp({ failOnError: false }).rotate().resize(width).webp(); - let processedBuffer = await streamToBuffer(s2.pipe(t)); let hash = crypto .createHash("sha256") .update(processedBuffer) .digest("hex"); - let filePath = `/app/data/uploads/${hash}.webp`; + let filePath = `/home/bun/app/data/uploads/${hash}.webp`; fs.writeFileSync(filePath, processedBuffer); res.send({ hash }); -- cgit v1.2.3