Blob from javascript binary string(来自 javascript 二进制字符串的 Blob)
问题描述
我有一个用 FileReader.readAsBinaryString(blob) 创建的二进制字符串.
我想用这个二进制字符串中表示的二进制数据创建一个 Blob.
I want to create a Blob with the binary data represented in this binary string.
推荐答案
您使用的 blob 是否不再可用?
你必须使用 readAsBinaryString
吗?您可以改用 readAsArrayBuffer
吗?使用数组缓冲区,重新创建 blob 会容易得多.
Is the blob that you used not available for use anymore?
Do you have to use readAsBinaryString
? Can you use readAsArrayBuffer
instead. With an array buffer it would be much easier to recreate the blob.
如果不是,您可以通过循环遍历字符串并构建一个字节数组然后从中创建一个 blob 来重建 blob.
If not you could build back the blob by cycling through the string and building a byte array then creating a blob from it.
这篇关于来自 javascript 二进制字符串的 Blob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!