Skip to content

Commit

Permalink
simplify some code
Browse files Browse the repository at this point in the history
  • Loading branch information
Benaiah committed Jul 11, 2023
1 parent 0ba3869 commit 37c1ee4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/routes/api/v1/blurhash/[url]/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@ export const GET = async ({ locals: { getConnectedRedisClient }, params: { url:
);
}

let blurhash: string, width: number, height: number;
let blurhash: string;
try {
const buffer = await imageResponse.arrayBuffer();
let data: Uint8Array;
({ width, height, data } = jpeg.decode(buffer, { useTArray: true }));
const { width, height, data } = jpeg.decode(buffer, { useTArray: true });
blurhash = encode(new Uint8ClampedArray(data), width, height, 4, 4);
} catch (err) {
return new Response(
Expand Down

0 comments on commit 37c1ee4

Please sign in to comment.