Buffer error



  • Anyone knows why Buffer function is not working?

    Simple code:
    // main.js
    var buf = Buffer.from('abc');
    console.log(buf);

    Returns on console:
    TypeError: undefined not callable (property 'from' of [object Function])
    at [anon] (duktape.c:65024) internal
    at [anon] (root/porva2/main.js:2)
    at require (init.js:131)
    at [anon] (init.js:139) preventsyield
    at runInit () native strict preventsyield
    at handlePacket (pipe_communication.js:48)
    at readCallback (pipe_communication.js:93) preventsyield


  • FlicTeam

    Please add the following line at the top of your file:

    Buffer.from = function(v) {return new Buffer(v)};

    I think that should work.


Log in to reply