我试图通过pdf-lib https://github.com/Hopding/pdf-lib将生成的pdf上传到Firestore,但它不起作用!
我读过某个地方,在通过firebase提交base64时必须确保对base64进行了编码,但是我不太确定这是什么意思。
这是我的字符串
JVBERi0xLjcKJYGBgYEKCjYgMCBvYmoKPDwKL0ZpbHRlciAvRmxhdGVEZWNvZGUKL0xlbmd0aCAzNDYKPj4Kc3RyZWFtCnicxVTLSgMxFN3nK7IWWpOb+8iAuJh2ZuVK8gMuVCxUQf8fPElt7aKRERcyMCS5CedxTzIWF3xYS8LPon9/dtflZf/4sbp/2z+8riRy8FF8eXLEvty56LHdRy/Bm8Z1HnzZuxtmE0vGNIvpYEGFArPOZjpRsKRZRTemil204YSK6GSMObUVxXnSCWe5jeTWl50rV24qbvyZYgJAlyLrkaKwRh0rsQoOqgHFXOeAJI2V5HJQy0G6oOnbl6QbKI/VBYBDnR68mGjmCgoKAJ/xbZtPAzwYl9PI3Jce9RIL2DADBXPjX3icuC83XJR7lCdoqNJyKKKkPShYd2qnAiahkVKdg6sRSQpVFfIUSLH2h0wNOXaNVTvplQC9oNFSRLV5aKEosqUM2NbqSqdW2oVoa7gU8atGFJaTijSkLinR/yGV49B/IPJ5BBFxC4fgHejw0EZbS2dwn88u/3kKZW5kc3RyZWFtCmVuZG9iagoKNyAwIG9iago8PAovRmlsdGVyIC9GbGF0ZURlY29kZQovVHlwZSAvT2JqU3RtCi9OIDUKL0ZpcnN0IDI2Ci9MZW5ndGggMzIzCj4+CnN0cmVhbQp4nJWS0UoDMRBF3/MV8wNtkkmym0Ap2KIIIkoVLIgP6TaUSJtIdyv69ybbqi0NiORlc/dk5k5yOTBAkBIE1Bok8ApBQY0IoxGhj59vDui9XbmW0Bu/bOE5MQxm8ELoNO5CB5yMx+SXndrOruOK7A8Bz/ApcRVDR+jDbtH12yxyQie2dflPEvzGtYNZ3NhA6GVo4tKHFdAnHy5C67+F05q5WW65ddlR35POXBt32yaZyFxfO39cu/W763xjB4gyjdqzRz0HikuWbqPXj2AhSrBAVp/DwtTF0rVm6pzOYgHWslDZCGOKPoQsVEYtijSiqM5pjlXRtdG85EQpXaI5GlGYkeu6OCQ3hcvmguGBTs9M53eLV9f0z5e2Wbl1S28n8SPFkaWljBqiBi35UJt9NEOXopDjWh3i+q8M/lj5I4FfeyrlRQplbmRzdHJlYW0KZW5kb2JqCgo4IDAgb2JqCjw8Ci9TaXplIDkKL1Jvb3QgMiAwIFIKL0ZpbHRlciAvRmxhdGVEZWNvZGUKL1R5cGUgL1hSZWYKL0xlbmd0aCA0MQovVyBbIDEgMiAyIF0KL0luZGV4IFsgMCA5IF0KPj4Kc3RyZWFtCnicFcSxEQAwCAOxN3CXNgOyZQYkWIWAmeCAkwuXrsQF6W3Z8AFgWwNcCmVuZHN0cmVhbQplbmRvYmoKCnN0YXJ0eHJlZgo4NjAKJSVFT0Y=
我已经尝试过使用rn-fetch-blob,但是它不适用于expo,而且我也不喜欢弹出。
我用于Firebase的代码
这会从Firebase返回错误
await ref.putString(file, 'base64').then(function(snapshot) {
console.log('Uploaded a base64 string!');
});