简体   繁体   English

将 base64 字符串转换为 zip 并提取内容的云函数

[英]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.我目前正在尝试将 base64 字符串转换为 zip 文件,然后将其解压缩。

  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.您能否只解码一个 base64 字符串,然后将其“保存”为您想要的任何格式,它会采用或您是否需要以不同的方式进行。

for example would decoding a base64 string to pdf and zip file be completly different process.例如,将 base64 字符串解码为 pdf 和 zip 文件是完全不同的过程。

  1. Are there any node libraries that help with these?是否有任何节点库可以帮助解决这些问题?

base64 is just a data encoding format. base64只是一种数据编码格式。 Whatever input data you encoded as base64, will come out on the other side when you decode it.无论您编码为 base64 的输入数据是什么,都会在解码时从另一侧输出。 So the process for encoding/decoding the file contents as base64 is the same, no matter what the file type is.因此,无论文件类型是什么,将文件内容编码/解码为 base64 的过程都是相同的。

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?在 Stack Overflow 上要求推荐一个 node.js 模块来帮助编码/解码是题外话,但是如果你快速谷歌搜索我很确定会出现多个好的选项,比如这个高度赞成的答案: 如何在node.js中进行Base64编码?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM