17 lines
416 B
TypeScript
17 lines
416 B
TypeScript
export type CdnResponseRecord = {
|
|
data: Buffer;
|
|
type: string;
|
|
size: number;
|
|
};
|
|
|
|
export function cdnImageResponse(record: CdnResponseRecord) {
|
|
return new Response(new Uint8Array(record.data), {
|
|
headers: {
|
|
"Content-Type": record.type,
|
|
"Content-Length": String(record.size),
|
|
"Cache-Control": "public, max-age=31536000, immutable",
|
|
"X-Content-Type-Options": "nosniff",
|
|
},
|
|
});
|
|
}
|