- Returning binary data - 1 Update
- how to link to installed node packages / modules from another dir - 1 Update
- Question is this possible - 1 Update
Mitchell Hockley <mitchell...@ge.com>: Oct 03 08:10AM -0700
Could anyone help me with the following please?
How can I return a stream of bits which represents an array of double
precision numbers?
For example, if I wanted to return two values each equal to 0.3333333333333
I could do the following in nodejs:
app.get('/GetBinaryData', function(req, res)
{
var buf = new Buffer(16);
buf[0] = 0x55;
buf[1] = 0x55;
buf[2] = 0x55;
buf[3] = 0x55;
buf[4] = 0x55;
buf[5] = 0x55;
buf[6] = 0xd5;
buf[7] = 0x3f;
buf[8] = 0x55;
buf[9] = 0x55;
buf[10] = 0x55;
buf[11] = 0x55;
buf[12] = 0x55;
buf[13] = 0x55;
buf[14] = 0xd5;
buf[15] = 0x3f;
res.send(buf);
}
);
At the client side I receive the stream and read 8 bits at a time to get
the two values.
I understand there may be endian issues, but ignoring them the questions
simplifies to:
If I want to send the content of this array:
var array = [7.1,5.2,13.3,300.4];
to a client from nodejs as binary data how can I do it?
(can be floats if necessary. Maybe there's a entirely better way I am
unaware of, that would be great).
Thanks fro any help,
Mitch.
Ryan Graham <r.m.g...@gmail.com>: Oct 04 12:41AM
Dependencies are loaded relative to the location of the code, not your
current working directory. If you have code in foo/dir1/proc1.js and code
in foo/dir2/proc2.js, they will both see modules in foo/node_modules
regardless of which directory you run them from (eg. `cd /bar/dir3; node
/foo/dir1/proc1.js`). Does that help?
~Ryan
--
~Ryan
thebluearchernc <jrwe...@gmail.com>: Oct 03 08:41AM -0700
say i have 5 android devices i want each to connect to a different web
port and i want the webserver to update each devices page .
basically i want to take a single page split it in to say 5 sections and
each section is update at the same time making a matrix display of sorts.
the idea is to create a digital dash board for an automobile
thanks Ross
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to nodejs+unsubscribe@googlegroups.com.