Search code examples
pdfnpmbase64zip

Cloud function to convert a base64 string to zip and extract the contents


I am currently trying to convert a base64 string to a zip file and then extract it.

  1. Can you just decode a base64 string and then "save it" to whatever format you want and it will take or do you need to do it in different ways.

for example would decoding a base64 string to pdf and zip file be completly different process.

  1. Are there any node libraries that help with these?

Solution

  • base64 is just a data encoding format. Whatever input data you encoded as base64, will come out on the other side when you decode it. So the process for encoding/decoding the file contents as base64 is the same, no matter what the file type is.

    Asking for a recommendation of a node.js module to help with encoding/decoding is off-topic on Stack Overflow, but if you do a quick google search I'm quite sure multiple good options will show up, such as this highly upvoted answer: How to do Base64 encoding in node.js?