Add raw files to the api
This commit is contained in:
parent
511e487516
commit
4bc2fc4f67
14
src/pages/api/files/[fileId].js
Normal file
14
src/pages/api/files/[fileId].js
Normal 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);
|
||||||
|
}
|
Reference in New Issue
Block a user