Nodejs request iconv-lite decode reported buffer error

  node.js, question

In nodejs, request is used to get the code. when iconv parses gbk code, it always reports an error.

var newBuf = new Buffer(buf.length*2),

TypeError: Cannot read property ‘length’ of undefined

Source code:

var request = require('request');
 var iconv = require('iconv-lite');
 var options = {
 url : url,
 encoding: null
 request(options, function(error,response,body) {
 var buf = iconv.decode(body, 'gb2312');

Please be a great god ~ ~

If you look at the body information and see if there is any data, I also met the parameter undefined passed, so this error was reported.