standardised the api response, updated contribute

This commit is contained in:
Saud Fatayerji
2023-10-27 01:33:11 +03:00
parent 99ca6b6a26
commit 29a8107ae0
3 changed files with 18 additions and 15 deletions

View File

@@ -0,0 +1,9 @@
export function respondWithBinaryPdf(res, buffer, filename) {
res.writeHead(200, {
'Content-Type': "application/pdf",
'Content-disposition': 'attachment;filename=' + filename,
'Content-Length': buffer.length
});
res.end(Buffer.from(buffer, 'binary'))
}