I need the entire byte array data fetched from a socket and after that I need to insert it into a database a BLOB. Do not ask me why I am not formatting the data from byte array, because I need to work with that structure.
I am storing the byte array data into a js array. I tried to store it within a buffer object but I get errors when I try to write the byte array data into the buffer because it can convert it.
My question is how is the easiest way to work with byte array in js. I have the following code:
var buff =[];
sock.on('data', function(data) {
buff.push(data);
})
sock.on('end', function() {
console.log(data) // [<Byte Array>,<Byte Array>, ...]
});
Basically I want to insert my data as [] not as [,, ...]. What is the best solution for my problem?
buff.push[data]) and your question is vague. Can you post the part of your code that attempts to store the data in the database and explain what you expect to happen and what happens instead?