Copy link to clipboard
Copied
I was attempting to read the zip file directly to the code memory due to working in a read-only serverless environment instead of saving and then reading and the writeToStream method does not work. This works with other functions where a pdf files are returned by the sdk (like split PDF), but not zip files returned from extracting text. The documentation clearly states this meethod should be an option but is it not in this case.
Exception encountered while executing operation TypeError: result.saveToStream is not a function
Oh, you are using saveAsStream: "result.saveToStream is not a function" Shouldn't it be writeToStream?
Copy link to clipboard
Copied
Could you share a bit more of your code?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
If you logout result, is it a FileRef? What object does it appear to be.
Also, if I were doing serverless stuff with our APIs, I'd skip the SDK and just hit the *super* simple REST API direct. Much more control that way.
Copy link to clipboard
Copied
Oh, you are using saveAsStream: "result.saveToStream is not a function" Shouldn't it be writeToStream?
Copy link to clipboard
Copied
You are correct, I dont know how i missed that reading it 100 times over
Copy link to clipboard
Copied
No worries, glad you got it.
Copy link to clipboard
Copied
Hi Raymond,
Appreciated if you could write a code for writeToStream, as I could not find any sample code for doing so.
As I want to convert the result (which should be FileRef) to writableStream directly, without needing to saveAsFile, because I could not have access right on the file system of the cloud's production environment.
Copy link to clipboard
Copied
Eh.... I don't do a lot with streams. I have, but just barely. Have you checked the docs on streams? https://nodejs.org/api/stream.html
Copy link to clipboard
Copied
Yes, after checked the docs on streams as you suggested, I solved the issue and it works now. Thanks Raymond 👍
Copy link to clipboard
Copied
How did you fix it? Having the same issue?
Copy link to clipboard
Copied
For my application, I have a form on client-side to upload a single PDF file and post it to the server-side endpoint,
then on server-side, return back to the client-side the unzipped CSV files only.
Here below is the server-server code for your reference :