Files
SnowLuma/.pnpm-store/v11/files/54/ee4c7ec8abc11c5b58ce2937e07ce136c1294ad3553c86f1c075845d2794ecd936c6f86c4eecc0b56a23a95ab5eab1022bd95ba5d00911ab7048a6f03dc294
TanTan 2a69b23b47
Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Skipped
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

31 lines
788 B
Plaintext

import { serveStatic as serveStatic$1 } from "../../middleware/serve-static/index.js";
import { stat } from "node:fs/promises";
import { join } from "node:path";
//#region src/adapter/bun/serve-static.ts
/**
* @deprecated `hono/bun` will be removed in v5. Install `@hono/bun` and import from there instead.
*/
const serveStatic = (options = {}) => {
return async function serveStatic(c, next) {
const getContent = async (path) => {
const file = Bun.file(path);
return await file.exists() ? file : null;
};
const isDir = async (path) => {
let isDir;
try {
isDir = (await stat(path)).isDirectory();
} catch {}
return isDir;
};
return serveStatic$1({
...options,
getContent,
join,
isDir
})(c, next);
};
};
//#endregion
export { serveStatic };