4 Star 48 Fork 22

爱动手的三角喵 / lutils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
toDataURL.js 444 Bytes
一键复制 编辑 原始数据 按行查看 历史
爱动手的三角喵 提交于 2021-04-17 12:44 . refactor:项目重构
/**
*
* @desc 文件转DataURL
* @param {File} 文件
* @param {Function} 回调函数
* @param {String} 是否Base64
* @callback {String} DataURL
*/
function toDataURL(file, c, isBase) {
var reader = new FileReader();
reader.onload = function () {
if (typeof c == "function") c(isBase ? this.result.split(',')[1] : this.result);
}
reader.readAsDataURL(file);
}
export default toDataURL;
JavaScript
1
https://gitee.com/baojuhua/lutils.git
git@gitee.com:baojuhua/lutils.git
baojuhua
lutils
lutils
master

搜索帮助