Add raw files to the api

This commit is contained in:
Liam 2022-11-14 00:09:04 +00:00
parent 511e487516
commit 4bc2fc4f67

View File

@ -0,0 +1,14 @@
import { getFileRaw } from "src/utils/helpers/fileHelpers";
/**
* @param {NextRequest} req
* @param {NextResponse} res
*/
export default async function handler(req, res) {
const fileId = req.query.fileId;
const { file, buffer } = await getFileRaw(fileId);
res.setHeader("Content-Type", file.contentType);
res.send(buffer);
}