错误:toString失败的Node.js缓冲区 [英] Error: toString failed Node.js buffer
问题描述
有时我对api的get请求失败,并显示此错误消息,(顺便说一句,我使用请求模块触发了我的请求)
Sometimes my get request to an api fails with this error message, (btw im using the request module to trigger my requests)
Error: toString failed
buffer.js:378
throw new Error('toString failed');
^
Error: toString failed
at Buffer.toString (buffer.js:378:11)
at BufferList.toString (/home/vardha/www/abp/node_modules/bl/bl.js:155:33)
at Request.<anonymous> (/home/vardha/www/abp/node_modules/request/request.js:1013:32)
at emitOne (events.js:82:20)
at Request.emit (events.js:169:7)
at IncomingMessage.<anonymous> (/home/vardha/www/abp/node_modules/request/request.js:962:12)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:921:12)
at nextTickCallbackWith2Args (node.js:442:9)
这让我感到很困惑,因为我不知道是什么原因导致的,并且无法在github页面上找到任何明确的解决方案。
This has been buggin me a lot since I have no idea as to whats causing this and was not able to find any clear solution in the github page. ANy help would be appreciated.
推荐答案
此错误通常发生在您请求文件大小相对较大(或)的文件时缓冲区长度超过/达到256 MB,V8引擎将抛出该错误。
This error usually occurs when you request for file which is relatively bigger in size (or) the bufferlength exceeds / reaches 256 MB which the V8 engine will throw as an error.
NodeJS社区仍在解决此问题。阅读这篇综合文章,其中包含所有您正在寻找的进度/答案。
This issue is still being addressed by the NodeJS community Read out this comprehensive post which has all the progress/answers that you are looking for.
https://github.com/ nodejs / node / pull / 4394
希望这会有所帮助!
这篇关于错误:toString失败的Node.js缓冲区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!