如何从base64字符串中创建斑点; JavaScript

发布于 2025-02-04 11:24:16 字数 150 浏览 4 评论 0原文

基本上,标题所说的;我有一个编码图像的base64字符串,我想将其转换为斑点,以便可以将其传递到file构造函数中。我意识到已经提出了许多类似的问题,但是许多其他答案都利用了已弃用的atob函数。因此,我正在尝试寻找替代方案。

Basically what the title says; I have a base64 string that encodes an image and I want to convert it into a blob so I can pass it into my File constructor. I realise many similar questions have been asked however many of the other answers make use of the atob function which has been deprecated; So im trying to look for alternatives.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月打碎记忆 2025-02-11 11:24:16

尝试一下

var base64String = "dGVzdAo=";
var blob = new Blob([base64String], {type: 'text/plain'});

Try this

var base64String = "dGVzdAo=";
var blob = new Blob([base64String], {type: 'text/plain'});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文