问题描述
这行代码可以吗
someString.match(/^data:([A-Za-z-+\/]+);base64,(.+)$/);
导致此问题:RangeError:超出最大调用堆栈大小 通过任何方式?
这是在一个方法中调用的,该方法位于处理n no的循环内。图片
function imageUpload(images) {
for (index = 0; index < images.length; index++) {
base64Data = images[index];
imageBuffer = decodeBase64Image(base64Data);
}
}
function decodeBase64Image(dataString) {
matches = dataString.match(/^data:([A-Za-z-+\/]+);base64,(.+)$/);
response = {};
if (matches.length !== 3) {
return new Error('Invalid input string');
}
response.type = matches[1];
response.data = new Buffer(matches[2],'base64');
return response;
}
这是全局变量吗?
注意:我无法重现此问题。在生产环境中,我们只是被哨兵抓住了。
谢谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)