package
Fastify plugin for content serving
npm install @kakang/fastify-staticGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 14 packages.
572.1 kB
Includes dependencies.
3 direct · 1 outdated
This plugin provide serving file through different engine.
You can checkout @fastify/static if you prefer offcial plugin.
npm install @kakang/fastify-static --save
yarn add @kakang/fastify-staticimport FastifyStatic, {
FileSystemEngine
} from '@kakang/fastify-static'
fastify.register(FastifyStatic, {
serve: "/",
root: "/",
engine: new FileSystemEngine()
})
fastify.get("/download.txt", (_, reply) => {
// download file
return reply.download('download.txt', 'newname.txt')
})
fastify.get("/download.html", (_, reply) => {
// send file
return reply.sendFile('download.html')