zoukankan      html  css  js  c++  java
  • js前端常用的方法

    // 获取本地文件URL
    function getObjectURL(file) {
    var url = null;
    if (window.createObjcectURL != undefined) {
    url = window.createOjcectURL(file);
    } else if (window.URL != undefined) {
    url = window.URL.createObjectURL(file);
    } else if (window.webkitURL != undefined) {
    url = window.webkitURL.createObjectURL(file);
    }
    return url;
    }


    // 将base64转换为文件
    function dataURLtoFile(dataurl, filename) {
    var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
    bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
    while(n--){
    u8arr[n] = bstr.charCodeAt(n);
    }
    return new File([u8arr], filename, {type:mime});
    }

  • 相关阅读:
    day69test
    day70test
    day71test
    ymfx
    day71
    day69
    day70
    day70test
    day65——day69
    c语言解决函数变参数问题 va_list
  • 原文地址:https://www.cnblogs.com/xiaobai-y/p/10005767.html
Copyright © 2011-2022 走看看