JS 文件类型转换

JavaScript010

JS 文件类型转换,第1张

base64 转 blob

base64 转 file

file 转arrayBuffer

arrBuffer 转buffer

buffer 转 blob

blob 转 file

需要准备的材料分别有:电脑、浏览器、html编辑器。

1、首先,打开html编辑器,新建html文件,例如:index.html,编写问题基础代码。

2、新建index.js文件,将内嵌js内容添加到index.js文件中。

3、在index.html的head标签中新增引用代码:<script src="index.js"></script>。

4、浏览器运行index.html页面,此时成功引入index.js并调用其内容。