| 412 | `// WARNING: DO NOT EDIT THIS FILE. It is autogenerated by Fresh.`; |
| 413 | |
| 414 | export async function hashContent( |
| 415 | // This error poppued up since TS 5.9.2 but not sure why |
| 416 | // deno-lint-ignore no-explicit-any |
| 417 | content: Uint8Array<any> | ReadableStream<Uint8Array>, |
| 418 | ): Promise<string> { |
| 419 | const buffer = await new Response(content).arrayBuffer(); |
| 420 | |
| 421 | const hashBuf = await crypto.subtle.digest( |
| 422 | "SHA-256", |
| 423 | buffer, |
| 424 | ); |
| 425 | return encodeHex(hashBuf); |
| 426 | } |
| 427 | |
| 428 | export function getContentType(filePath: string): string { |
| 429 | const ext = path.extname(filePath); |