我想在我的应用程序中使用ferros buffer。 但我在尝试将缓冲区保存到文件时收到错误。这是我的代码: 请帮助检查...
var fs = require('fs');
var B = require('buffer/').Buffer;
var buffin = fs.readFileSync('calibri.ttf');
var b64 = buffin.toString('base64');
var bf = new B(b64,'base64');
fs.writeFile('calibro.ttf', bf, function (err) {
if (err) throw err;
console.log('It\'s saved!');
});
这是我的错误消息:
D:\Project\testbuffer\node_modules\buffer\index.js:703
return String.fromCharCode.apply(String, res)
^
RangeError: Maximum call stack size exceeded
at utf8Slice (D:\Project\testbuffer\node_modules\buffer\index.js:703:30)
at Buffer.toString (D:\Project\testbuffer\node_modules\buffer\index.js:412:3
8)
at fs.js:1079:63
at FSReqWrap.oncomplete (fs.js:95:15)
请帮忙,