Sorry, I didn't understand, what I need to do on the code?

*Att,*

*Felipe Silveira Mendes*Site <http://felipems.com.br> -
Twitter<https://twitter.com/felipesmendes>-
Blog <http://felipems.com.br/blog>
*Web Developer*
*(31) 8370-9090 (Claro)*
*(31) 9433-9310 (Tim)*
*cont...@felipems.com.br <cont...@felipems.com.br>*




2013/12/9 Fedor Indutny <fe...@indutny.com>

> Ok, so you create 0 length buffer here, and doing 0-size read :)
>
> That's totally not supported.
>
> On Mon, Dec 9, 2013 at 6:57 PM, Felipe Silveira <cont...@felipems.com.br>
> wrote:
> > Ooh Sorry yeah I forgot, here is:
> >
> > file changed from 101644 to 101650
> > file changed from 101644 to 101650
> > file changed from 101644 to 101650
> > 6
> > <Buffer 8c e0 0f 09 ac ad>
> > 11
> > 0
> > <Buffer >
> > 12
> >
> >
> > Att,
> > Felipe Silveira Mendes
> > Site - Twitter - Blog
> > Web Developer
> > (31) 8370-9090 (Claro)
> > (31) 9433-9310 (Tim)
> > cont...@felipems.com.br
> >
> >
> >
> >
> > 2013/12/9 Fedor Indutny <fe...@indutny.com>
> >>
> >> So, don't tell me it isn't printing anything else :) You have a lot of
> >> console.log()s there. Can you paste them here?
> >>
> >> On Mon, Dec 9, 2013 at 6:46 PM, Felipe Silveira <
> cont...@felipems.com.br>
> >> wrote:
> >> > I updated my node js to version v0.10.22 and installed nodejs-dbg for
> >> > debug
> >> > and getting the same error:
> >> >
> >> > fs.js:457
> >> >   binding.read(fd, buffer, offset, length, position, wrapper);
> >> >           ^
> >> > Error: Offset is out of bounds
> >> >     at Object.fs.read (fs.js:457:11)
> >> >     at /var/www/read/test.js:16:15
> >> >     at Object.oncomplete (fs.js:107:15)
> >> >
> >> >
> >> > The code of script:
> >> >
> >> > var fs = require('fs');
> >> > var fName = 'test.txt';
> >> > fNameStat = fs.statSync(fName);
> >> > fs.watch(fName, function (evento, arquivo) {
> >> > fNameStatChanged = fs.statSync(arquivo);
> >> > console.log('file changed from ' + fNameStat.size + ' to ' +
> >> > fNameStatChanged.size);
> >> > fs.open(fName, 'r', function(err, fd) {
> >> >        var newDataLength = fNameStatChanged.size - fNameStat.size;
> >> >    console.log(newDataLength);
> >> >          var buffer = new Buffer(newDataLength);
> >> >    console.log(buffer);
> >> >    console.log(fd);
> >> >    if(newDataLength < 0 ){
> >> >       newDataLength = 0;
> >> >    }
> >> >          fs.read(fd, buffer, 0, newDataLength, null, function (err,
> >> > bytesRead, newData) {
> >> > if (err) {
> >> >    console.log(err);
> >> > };
> >> > console.log(newData.toString());
> >> >
> >> >          });
> >> >             fNameStat = fs.statSync(fName);
> >> >          });
> >> >
> >> > });
> >> >
> >> >
> >> > Att,
> >> > Felipe Silveira Mendes
> >> > Site - Twitter - Blog
> >> > Web Developer
> >> > (31) 8370-9090 (Claro)
> >> > (31) 9433-9310 (Tim)
> >> > cont...@felipems.com.br
> >> >
> >> >
> >> >
> >> >
> >> > 2013/12/9 Fedor Indutny <fe...@indutny.com>
> >> >>
> >> >> Depends on what ppa are you using. I'd recommend trying:
> >> >> https://launchpad.net/~chris-lea/+archive/node.js/
> >> >>
> >> >> On Mon, Dec 9, 2013 at 2:37 PM, Felipe Silveira
> >> >> <cont...@felipems.com.br>
> >> >> wrote:
> >> >> > Ok, How can I upgrade my node?
> >> >> > I'm using ubuntu 10.10 and can I do it with apt-get or aptitude?
> >> >> > What comands I need to do?
> >> >> >
> >> >> > Att,
> >> >> > Felipe Silveira Mendes
> >> >> > Site - Twitter - Blog
> >> >> > Web Developer
> >> >> > (31) 8370-9090 (Claro)
> >> >> > (31) 9433-9310 (Tim)
> >> >> > cont...@felipems.com.br
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > 2013/12/9 Fedor Indutny <fe...@indutny.com>
> >> >> >>
> >> >> >> Hm... this version is really really old, may I ask you to try
> >> >> >> upgrading to at least v0.6.21 ? (Would be much better to give a
> try
> >> >> >> to
> >> >> >> latest 0.10, or 0.8).
> >> >> >>
> >> >> >> On Mon, Dec 9, 2013 at 2:29 PM, Felipe Silveira
> >> >> >> <cont...@felipems.com.br>
> >> >> >> wrote:
> >> >> >> > Yes yes, i'm loggin just what I got on the console...the node
> >> >> >> > version
> >> >> >> > is
> >> >> >> > v0.6.17
> >> >> >> >
> >> >> >> > Att,
> >> >> >> > Felipe Silveira Mendes
> >> >> >> > Site - Twitter - Blog
> >> >> >> > Web Developer
> >> >> >> > (31) 8370-9090 (Claro)
> >> >> >> > (31) 9433-9310 (Tim)
> >> >> >> > cont...@felipems.com.br
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > 2013/12/9 Fedor Indutny <fe...@indutny.com>
> >> >> >> >>
> >> >> >> >> You're logging much more data than this, are you sure it prints
> >> >> >> >> out
> >> >> >> >> only the error? And also you forgot to include version number
> of
> >> >> >> >> node.js that you're using.
> >> >> >> >>
> >> >> >> >> On Mon, Dec 9, 2013 at 2:23 PM, Felipe Silveira
> >> >> >> >> <cont...@felipems.com.br>
> >> >> >> >> wrote:
> >> >> >> >> > Console
> >> >> >> >> >
> >> >> >> >> > fs.js:267
> >> >> >> >> >   binding.read(fd, buffer, offset, length, position,
> wrapper);
> >> >> >> >> >           ^
> >> >> >> >> > Error: Offset is out of bounds
> >> >> >> >> >     at Object.read (fs.js:267:11)
> >> >> >> >> >     at Object.oncomplete (/var/www/leitor/teste.js:16:15)
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > Node Version v0.6.17
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > Att,
> >> >> >> >> > Felipe Silveira Mendes
> >> >> >> >> > Site - Twitter - Blog
> >> >> >> >> > Web Developer
> >> >> >> >> > (31) 8370-9090 (Claro)
> >> >> >> >> > (31) 9433-9310 (Tim)
> >> >> >> >> > cont...@felipems.com.br
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > 2013/12/9 Fedor Indutny <fe...@indutny.com>
> >> >> >> >> >>
> >> >> >> >> >> What does it log to console? What node.js version are you
> >> >> >> >> >> using?
> >> >> >> >> >>
> >> >> >> >> >> On Mon, Dec 9, 2013 at 2:17 PM, Felipe Silveira
> >> >> >> >> >> <cont...@felipems.com.br>
> >> >> >> >> >> wrote:
> >> >> >> >> >> > Thank bro to help,
> >> >> >> >> >> >
> >> >> >> >> >> > I change to this code and get the same error:
> >> >> >> >> >> >
> >> >> >> >> >> > var fs = require('fs');
> >> >> >> >> >> > var fName = 'text.txt';
> >> >> >> >> >> > fNameStat = fs.statSync(fName);
> >> >> >> >> >> > fs.watch(fName, function (evento, arquivo) {
> >> >> >> >> >> > fNameStatChanged = fs.statSync(arquivo);
> >> >> >> >> >> > console.log('file changed from ' + fNameStat.size + ' to
> ' +
> >> >> >> >> >> > fNameStatChanged.size);
> >> >> >> >> >> >  fs.open(fName, 'r', function(err, fd) {
> >> >> >> >> >> >          var newDataLength = fNameStatChanged.size -
> >> >> >> >> >> > fNameStat.size;
> >> >> >> >> >> >     console.log(newDataLength);
> >> >> >> >> >> >            var buffer = new Buffer(newDataLength);
> >> >> >> >> >> >     console.log(buffer);
> >> >> >> >> >> >     console.log(fd);
> >> >> >> >> >> >     if(newDataLength < 0 ){
> >> >> >> >> >> >        newDataLength = 0;
> >> >> >> >> >> >     }
> >> >> >> >> >> >            fs.read(fd, buffer, 0, newDataLength, null,
> >> >> >> >> >> > function
> >> >> >> >> >> > (err,
> >> >> >> >> >> > bytesRead, newData) {
> >> >> >> >> >> >  if (err) {
> >> >> >> >> >> >     console.log(err);
> >> >> >> >> >> >  };
> >> >> >> >> >> >  console.log(newData.toString());
> >> >> >> >> >> >
> >> >> >> >> >> >            });
> >> >> >> >> >> >             fNameStat = fs.statSync(fName);
> >> >> >> >> >> >          });
> >> >> >> >> >> >
> >> >> >> >> >> > });
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >> > On Monday, December 9, 2013 8:00:56 AM UTC-2, Fedor
> Indutny
> >> >> >> >> >> > wrote:
> >> >> >> >> >> >>
> >> >> >> >> >> >> Hello!
> >> >> >> >> >> >>
> >> >> >> >> >> >> Perhaps, you are trying to create a Buffer of negative
> >> >> >> >> >> >> length?
> >> >> >> >> >> >>
> >> >> >> >> >> >> Also, I believe, that you do not need to pass encoding
> >> >> >> >> >> >> argument
> >> >> >> >> >> >> to
> >> >> >> >> >> >> the
> >> >> >> >> >> >> Buffer's constructor if you're creating just a fixed-size
> >> >> >> >> >> >> buffer.
> >> >> >> >> >> >>
> >> >> >> >> >> >> On Mon, Dec 9, 2013 at 1:58 PM, Felipe Silveira
> >> >> >> >> >> >> <con...@felipems.com.br>
> >> >> >> >> >> >> wrote:
> >> >> >> >> >> >> > Hi There,
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > I'm trying to tail a file in nodejs, the code is this:
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > var fs = require('fs');
> >> >> >> >> >> >> > var fName = 'file.txt';
> >> >> >> >> >> >> > fNameStat = fs.statSync(fName);
> >> >> >> >> >> >> > fs.watch(fName, function (evento, arquivo) {
> >> >> >> >> >> >> > fNameStatChanged = fs.statSync(arquivo);
> >> >> >> >> >> >> > console.log('file changed from ' + fNameStat.size + '
> to
> >> >> >> >> >> >> > ' +
> >> >> >> >> >> >> > fNameStatChanged.size);
> >> >> >> >> >> >> > fs.open(fName, 'r', function(err, fd) {
> >> >> >> >> >> >> >        var newDataLength = fNameStatChanged.size -
> >> >> >> >> >> >> > fNameStat.size;
> >> >> >> >> >> >> >    console.log(newDataLength);
> >> >> >> >> >> >> >          var buffer = new Buffer(newDataLength,
> 'utf-8');
> >> >> >> >> >> >> >    console.log(buffer);
> >> >> >> >> >> >> >    console.log(fd);
> >> >> >> >> >> >> >          fs.read(fd, buffer, 0, newDataLength, null,
> >> >> >> >> >> >> > function
> >> >> >> >> >> >> > (err,
> >> >> >> >> >> >> > bytesRead, newData) {
> >> >> >> >> >> >> > if (err) {
> >> >> >> >> >> >> >    console.log(err);
> >> >> >> >> >> >> > };
> >> >> >> >> >> >> > console.log(newData.toString());
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >          });
> >> >> >> >> >> >> >             fNameStat = fs.statSync(fName);
> >> >> >> >> >> >> >          });
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > });
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > I'm getting this error:
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > fs.js:267
> >> >> >> >> >> >> >   binding.read(fd, buffer, offset, length, position,
> >> >> >> >> >> >> > wrapper);
> >> >> >> >> >> >> >           ^
> >> >> >> >> >> >> > Error: Offset is out of bounds
> >> >> >> >> >> >> >     at Object.read (fs.js:267:11)
> >> >> >> >> >> >> >     at Object.oncomplete (/var/www/read/test.js:13:15)
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > Anyone know whats happened?
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > Regards,
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > Felipe Silveira Mendes
> >> >> >> >> >> >> > Site - Twitter - Blog
> >> >> >> >> >> >> > Web Developer
> >> >> >> >> >> >> > (31) 8370-9090 (Claro)
> >> >> >> >> >> >> > (31) 9433-9310 (Tim)
> >> >> >> >> >> >> > con...@felipems.com.br
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > --
> >> >> >> >> >> >> > --
> >> >> >> >> >> >> > Job Board: http://jobs.nodejs.org/
> >> >> >> >> >> >> > Posting guidelines:
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> >> >> >> >> >> >> > You received this message because you are subscribed to
> >> >> >> >> >> >> > the
> >> >> >> >> >> >> > Google
> >> >> >> >> >> >> > Groups "nodejs" group.
> >> >> >> >> >> >> > To post to this group, send email to
> >> >> >> >> >> >> > nod...@googlegroups.com
> >> >> >> >> >> >> > To unsubscribe from this group, send email to
> >> >> >> >> >> >> > nodejs+un...@googlegroups.com
> >> >> >> >> >> >> > For more options, visit this group at
> >> >> >> >> >> >> > http://groups.google.com/group/nodejs?hl=en?hl=en
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > ---
> >> >> >> >> >> >> > You received this message because you are subscribed to
> >> >> >> >> >> >> > the
> >> >> >> >> >> >> > Google
> >> >> >> >> >> >> > Groups
> >> >> >> >> >> >> > "nodejs" group.
> >> >> >> >> >> >> > To unsubscribe from this group and stop receiving
> emails
> >> >> >> >> >> >> > from
> >> >> >> >> >> >> > it,
> >> >> >> >> >> >> > send
> >> >> >> >> >> >> > an
> >> >> >> >> >> >> > email to nodejs+un...@googlegroups.com.
> >> >> >> >> >> >> > For more options, visit
> >> >> >> >> >> >> > https://groups.google.com/groups/opt_out.
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >
> >> >> >
> >> >
> >> >
> >
> >
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to