diff options
| author | Adam Soltys <[email protected]> | 2024-08-26 16:28:30 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-08-26 16:28:30 -0700 |
| commit | 00e43ddc0bf3d6dd719fc9295d156567fa2fecfb (patch) | |
| tree | 9719782a64056ff904c0053223d70547bb7f398c /lib/upload.js | |
| parent | 3c611a4e6fbb31fa7d8e32ed256037c45aca1d6d (diff) | |
| download | coinos-server-00e43ddc0bf3d6dd719fc9295d156567fa2fecfb.tar.gz coinos-server-00e43ddc0bf3d6dd719fc9295d156567fa2fecfb.zip | |
switch to bun
Diffstat (limited to 'lib/upload.js')
| -rw-r--r-- | lib/upload.js | 5 |
1 files changed, 1 insertions, 4 deletions
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 }); |
