0

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?
Antonio Ramirez
  • 943
  • 6
  • 15
  • base64 doesn't care about the content. It just encodes bytes. When you know it's a zip, then save it as a zip file, when you know it's a pdf, save it as a pdf. – jps Jan 22 '20 at 16:11

1 Answers1

0

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?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • Thank you for the explanation. I have not used base64 strings in detail before. And I have been trying a few libraries for this over the past weeks with no results. I will try be more specific in future. again thank you for helping – Chad Blanchard Jan 22 '20 at 17:07