function toBase64Big(u8) {
var res = '';
var chunk = 8192 // 8 1024;
var i = 0;
for (i = 0; i < u8.length / chunk; i++) {
res += String.fromCharCode.apply(null, u8.slice(i chunk, (i + 1) chunk));
}
res += String.fromCharCode.apply(null, u8.slice(i chunk));
return btoa(res);
}
- 发布:2020-08-04 22:30
- 更新:2020-08-04 22:30
- 阅读:1725
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win10
HBuilderX类型: 正式
HBuilderX版本号: 2.8.3
手机系统: Android
手机系统版本号: Android 10
手机厂商: 华为
手机机型: 华为v10
页面类型: vue
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
function toBase64Big(u8) {
var res = '';
var chunk = 8192 // 8 1024;
var i = 0;
for (i = 0; i < u8.length / chunk; i++) {
res += String.fromCharCode.apply(null, u8.slice(i chunk, (i + 1) chunk));
}
res += String.fromCharCode.apply(null, u8.slice(i chunk));
return btoa(res);
}
function toBase64Big(u8) {
var res = '';
var chunk = 8192 // 8 1024;
var i = 0;
for (i = 0; i < u8.length / chunk; i++) {
res += String.fromCharCode.apply(null, u8.slice(i chunk, (i + 1) chunk));
}
res += String.fromCharCode.apply(null, u8.slice(i chunk));
return btoa(res);
}
实际结果:
function toBase64Big(u8) {
var res = '';
var chunk = 8192 // 8 1024;
var i = 0;
for (i = 0; i < u8.length / chunk; i++) {
res += String.fromCharCode.apply(null, u8.slice(i chunk, (i + 1) chunk));
}
res += String.fromCharCode.apply(null, u8.slice(i chunk));
return btoa(res);
}
function toBase64Big(u8) {
var res = '';
var chunk = 8192 // 8 1024;
var i = 0;
for (i = 0; i < u8.length / chunk; i++) {
res += String.fromCharCode.apply(null, u8.slice(i chunk, (i + 1) chunk));
}
res += String.fromCharCode.apply(null, u8.slice(i chunk));
return btoa(res);
}
bug描述:
uni.arrayBufferToBase64(arrayBuffer)以前不能用,现在可以用了
但是这个方法不能用了 现在,以前可以用? 这是为什么
function toBase64Big(u8) {
var res = '';
var chunk = 8192 // 8 1024;
var i = 0;
for (i = 0; i < u8.length / chunk; i++) {
res += String.fromCharCode.apply(null, u8.slice(i chunk, (i + 1) chunk));
}
res += String.fromCharCode.apply(null, u8.slice(i chunk));
return btoa(res);
}
0 个回复