fix(shell): use shell provided mime

This commit is contained in:
Il Harper 2024-09-07 14:11:24 +08:00
parent 784966e4cc
commit 6556b8b601
No known key found for this signature in database
GPG Key ID: 4B71FCA698E7E8EC

View File

@ -1,4 +1,3 @@
import { getType } from 'mime/lite'
import { createReadStream } from 'node:fs' import { createReadStream } from 'node:fs'
import type { RouteContext } from './types' import type { RouteContext } from './types'
@ -30,7 +29,7 @@ export const assets = async ({
} }
res.statusCode = 200 res.statusCode = 200
res.setHeader('Content-Type', getType(path)!) res.setHeader('Content-Type', cctx.chronocat.mime.getType(path)!)
const readStream = createReadStream(path) const readStream = createReadStream(path)
await new Promise((resolve, reject) => await new Promise((resolve, reject) =>