You could use messagepack to pack the data and then unpack the data when it gets to the client side . there are packing and unpacking libraries for both nodejs and javascript .
On Wed, Oct 5, 2016 at 3:25 AM, <[email protected]> wrote: > [email protected] > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/nodejs/topics> > Google > Groups > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!overview> > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email/#!overview> > Topic digest > View all topics > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/nodejs/topics> > > - Returning binary data <#m_7929592598772990244_group_thread_0> - 1 > Update > - how to link to installed node packages / modules from another dir > <#m_7929592598772990244_group_thread_1> - 1 Update > - Question is this possible <#m_7929592598772990244_group_thread_2> - 1 > Update > > Returning binary data > <http://groups.google.com/group/nodejs/t/7c9a5a677551db24?utm_source=digest&utm_medium=email> > Mitchell Hockley <[email protected]>: 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. > Back to top <#m_7929592598772990244_digest_top> > how to link to installed node packages / modules from another dir > <http://groups.google.com/group/nodejs/t/4721682de17633?utm_source=digest&utm_medium=email> > Ryan Graham <[email protected]>: 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 > Back to top <#m_7929592598772990244_digest_top> > Question is this possible > <http://groups.google.com/group/nodejs/t/4cf20fba1d5389e1?utm_source=digest&utm_medium=email> > thebluearchernc <[email protected]>: 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 > Back to top <#m_7929592598772990244_digest_top> > You received this digest because you're subscribed to updates for this > group. You can change your settings on the group membership page > <https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum/nodejs/join> > . > To unsubscribe from this group and stop receiving emails from it send an > email to [email protected]. > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: 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 unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAOo93%3D_Sz5gcqSR-NKfQZ6aBeSB4bxpHo0GhB8_KSG1ZWmfnNg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
