Keep in mind that you'll lose precision when converting it to a native javascript number. JS numbers are defined to be double floats. (though I head long type is coming in future JS)
On Thu, Jun 21, 2012 at 2:48 PM, Ben Short <[email protected]> wrote: > After searching this group I got it to work using the long class [1] > > code snipit: > > var Long = require('./long.js').Long; > > var high = buffer.readUInt32BE(0); > var low = buffer.readUInt32BE(4); > > var l = Long.fromBits(low, high); > > var timestamp = l.toNumber(); > > > [1] https://github.com/mongodb/js-bson/blob/master/lib/bson/long.js > > > On Thursday, June 21, 2012 8:15:05 PM UTC+1, Ben Short wrote: >> >> Hi, >> >> I'm trying out nodejs as a TCP server. The client server protocol is >> binary and the first value is a unsigned 64bit integer. The actual value in >> this 8 byte's is a unix epoch such as 1340304234643. The bytes are in >> network byte order/big endian. >> >> Is there anyway that I'm going to be able to read this value in nodejs? >> >> Thanks >> >> Ben >> > -- > 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 [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > -- 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
