Convert bun calls to node calls

This commit is contained in:
split / May 2024-07-12 01:55:11 -07:00
parent a5fe1e33e7
commit 5564b7b356
Signed by: split
GPG key ID: C325C61F0BF517C0

View file

@ -1,4 +1,4 @@
import { mkdir, readdir, rm, writeFile } from "node:fs/promises"
import { mkdir, readdir, readFile, rm, writeFile } from "node:fs/promises"
import { existsSync } from "node:fs"
import { join } from "node:path"
import { prisma } from "./clientsingleton"
@ -44,7 +44,7 @@ export function generateMissingAvatar(path: string, size: number, fmt?: keyof Sh
[0][1]
)
const buf = await Bun.file(pathToBestQualityImg).arrayBuffer()
const buf = await readFile(pathToBestQualityImg)
res(writeAvatar(path, await renderAvatar(buf, size, fmt)))
missingAvatarQueue.delete(qid)
})
@ -152,7 +152,7 @@ export async function writeAvatar(avatarDir: string, renderedAvatar: Awaited<Ret
`${renderedAvatar.squareSize}.${renderedAvatar.extension}`
)
await Bun.write(
await writeFile(
targetPath,
renderedAvatar.buf
)