For my current project, I have zip files being sent to an API server via a base64 encoded string. I am looking to convert that string into a Buffer (or some sort of other object) and explode the ZIP file into an object structured in the same way as the files in the ZIP so I can push them to the cloud using file objects. I've read about ADM-ZIP and other similar tools but all of them seem to require a file on disk, unless I am just misunderstanding the documentation. I am looking to avoid saving files on a disk since this API runs in the cloud with a variable storage space.
Thank you for all of your help in advance!
The best way to do manipulation with data without saving files in your case is Streams
API in node.js. Look for the libs b64
- stream decoding of base64 unzip-stream
- unziping files in stream
So your flow would be Accept a request, create ReadStream
from its data (base64) pipe
it to b64
, pipe
it to unzip-stream
and so on.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.