mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
Merge pull request #359 from Hitjack007/flag-offset
This commit is contained in:
1 file changed
+6
-2
@@ -1,3 +1,4 @@
|
||||
import sharp from "sharp";
|
||||
import type { APIContext, GetStaticPathsItem } from "astro";
|
||||
import { mixStaticPaths } from "../../../../core/blitzkit/mixStaticPaths";
|
||||
import { vfs } from "../../../../core/blitzkit/vfs";
|
||||
@@ -29,7 +30,10 @@ export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
|
||||
});
|
||||
|
||||
export async function GET({ props }: APIContext<{ path: string }>) {
|
||||
const bytes = new Uint8Array(await vfs.file(props.path));
|
||||
const bytes = await sharp(new Uint8Array(await vfs.file(props.path)))
|
||||
.trim({ background: { r: 0, g: 0, b: 0, alpha: 0 }, threshold: 1 })
|
||||
.webp()
|
||||
.toBuffer();
|
||||
|
||||
return new Response(bytes);
|
||||
return new Response(new Uint8Array(bytes));
|
||||
}
|
||||
Reference in new issue
Block a user