diff options
| author | Adam Soltys <[email protected]> | 2023-04-06 15:25:07 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-04-06 15:25:07 -0700 |
| commit | 99b72e143866d5cc62ba04847885070dc9a5c645 (patch) | |
| tree | abda08ae881b6e9bfff2ebbcf58d1409d7395fcf /lib/upload.js | |
| parent | 5083648dc113547c1c604e0c93ed0ee961f01ea3 (diff) | |
| download | coinos-server-99b72e143866d5cc62ba04847885070dc9a5c645.tar.gz coinos-server-99b72e143866d5cc62ba04847885070dc9a5c645.zip | |
prettier
Diffstat (limited to 'lib/upload.js')
| -rw-r--r-- | lib/upload.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/upload.js b/lib/upload.js index cb14f459..d46c116c 100644 --- a/lib/upload.js +++ b/lib/upload.js @@ -10,7 +10,7 @@ import { g, s, db } from "$lib/db"; export default async (req, res) => { let { params: { type }, - user, + user } = req; if (!["banner", "profile"].includes(type)) throw new Error("invalid upload"); @@ -28,9 +28,12 @@ export default async (req, res) => { let path = `/app/data/uploads/${name}`; let size = type === "banner" ? 1920 : 240; - let t = sharp().rotate().resize(size).webp(); + let t = sharp() + .rotate() + .resize(size) + .webp(); - await new Promise((r) => pipeline(s2, t, fs.createWriteStream(path), r)); + await new Promise(r => pipeline(s2, t, fs.createWriteStream(path), r)); user[type] = true; await s(`user:${user.id}`, user); |
