Replies: 0 comments 1 reply
-
One way of doing it would be to use const fs = require('fs');
exports.handler = async (event) => {
const result = await fs.promises.readFile('sourcepdf.pdf');
return result;
}; That can even be a one-liner: const fs = require('fs/promises');
exports.handler = () => fs.readFile('sourcepdf.pdf'); Is there a reason for not using
My guess would be it's because you convert the result to a string in your function, raw data is usually easier to deal with as |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have this function reference below. The issue is Whenever it returns data it seems to be double the size of the actual file. If I open the file in a file editor the contents look the same however when running fc /b and comparing the files nearly everything is different. How can I return the raw binary data?
Beta Was this translation helpful? Give feedback.
All reactions