Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

将 Base64 格式的图片转换为 Blob #217

Closed
Dream4ever opened this issue Jun 28, 2022 · 0 comments
Closed

将 Base64 格式的图片转换为 Blob #217

Dream4ever opened this issue Jun 28, 2022 · 0 comments
Labels
Browser All about browsers

Comments

@Dream4ever
Copy link
Owner

实现过程

Google:base64toblob

参考链接:Creating a BLOB from a Base64 string in JavaScript

核心代码:

var url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="

fetch(url)
.then(res => res.blob())
.then(console.log)
@Dream4ever Dream4ever added the Browser All about browsers label Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Browser All about browsers
Projects
None yet
Development

No branches or pull requests

1 participant