views:

73

answers:

0

I am using the following "pack" function provided by the excellent php.js project.

http://github.com/kvz/phpjs/blob/master/functions/misc/pack.js

Running this in Mozilla's JavaScript shell it works fine, but running it in Node produces incorrect strings.

example, packing the number 2 as a Double with: pack('d',2);

JS Shell produces: 00 00 00 00 00 00 00 40 (This is correct, PHP produces the same, and it is reversible)

NodeJS produces: 00 00 00 00 00 00 10 00 (This is incorrect)

Note all tests run on the same machine (CentOS 5 32 bit) Have I built NodeJS wrongly?