Note that there are some explanatory texts on larger screens.

plurals
  1. PObuffer.js:246 "Object 1 has no method 'toLowerCase'
    text
    copied!<p>I m trying to make a .smil (.xml) parser in javascript. But when I want to test it, node.js just say me that:</p> <pre><code>buffer.js:246 switch(encoding &amp;&amp; encoding.toLowerCase()){ ^ TypeError: Object 1 has no method 'toLowerCase' at Function.Buffer.isEncoding (buffer.js:246:32) at assertEncoding (fs.js:98:27) at Object.fsread (fs.js:422:5) at gets (/home/pi/SMIL_Parser.js:8:8) at read_until (/home/pi/SMIL_Parser.js:28:14) at home/pi/SMIL_Parser.js:64:14 at Object.oncomplete (fs.js:93.15) </code></pre> <p>gets () is indeed one of my function:</p> <pre><code>var io=require('fs'); ... function gets (file){ var chaine="", cache="", pkmn=0; io.read(file, cache, 0, 1, null, function(err, byte, buf){ if (err || byte===0){return -1;} while ((cache!=="\n")) { chaine=chaine+cache; cache=""; pkmn=io.readSync(file, cache, 0, 1, null); if (pkmn===0){return -1;} } }); } </code></pre> <p>I just don t have any idea of what go wrong, it seem to be read, but I ve made sure to get the right arguments, tried to update node.js, fs and npm. And the only similar error I found on google was a update problem.</p> <p>EDIT: Added the complete error message, here function read_until:</p> <pre><code>function read_until(smil, limit){ var line=""; do { line=gets(smil); if (line===-1){return -1} }while (!(line.search(limit))); return 0; } </code></pre> <p>.</p> <pre><code>function parse (pathname){ var smil=0, line="", pkmn=0; io.open(pathname, 'r', function (err, fd){ if (err){return -1;} smil=fd; pkmn=read_until(smil, "&lt;smil&gt;"); ... </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload