asked    Jonas     2018-10-22       json       113 view        1 Answer

[SOLVED] Parse large binary data to JSON format

The problem that I'm facing currently is the server continuously is pushing binary data through TCP port, I'm able to read these data but the problem is when the data is too large my app is crashing because can't close properly the object. The application is built in node JS and I tried to use json-stream but without success.

EXAMPLE:

var client = new net.Socket();
client.connect(PORT, HOST, function() {
 console.log('CONNECTED TO: ' + HOST + ':' + PORT); 
}
client.on('data', function(data) {
  var readyToExplore = JSON.parse(data.toString());
  console.log(readyToExplore);
}

The app will crash if try to parse to JSON but if left as a data.toString() then it's not a problem.

  1 Answer  

        answered    Jo     2018-10-22      

Give node more memory.

node --max-old-space-size=8192 server.js  

See how to increase nodejs default memory?





Your Answer





 2018-10-22         Selena

Datatables colReorder saving WITHOUT statesave

I am using datatables and am using colReorder and need to save the state of the columns without using statesave(I am not allowed to use localcache). I do however have a preference table in my database for storing this kind of information in JSON format.I have looked at colReorder.order() which looks like what I need to get the order.What I'm thinking so far is on a column change, call colReorder.order() and place that returned array in my preferences table and then on re-initialization use that to re-order the table.So my question/what I need help on is this: On a change of...
 javascript                     2 answers                     48 view
 2018-10-22         Hugo

Get data from another HTML page

I am making an on-line shop for selling magazines, and I need to show the image of the magazine. For that, I would like to show the same image that is shown in the website of the company that distributes the magazines.For that, it would be easy with an absolute path, like this:<img src="http://www.remotewebsite.com/image.jpg" />But, it is not possible in my case, because the name of the image changes everytime there is a new magazine.In Javascript, it is possible to get the path of an image with this code:var strImage = document.getElementById('Image').src;But, is it...
 javascript                     3 answers                     47 view
 2018-10-22         Jack

CSS/ cut an img's width when reducing the screen/window width

I wanted to have an Image on 100% width, with a max-height. When scaling the window and you're reaching the max-height, the width should still be at a 100% but "cropping" the image bigger (provided image size is fitting). This means you can see more of the image sides (left and right) when its on a big scale window, and you can see less on a small sized window. I'll post my css try down, but i don'thave a clue how to do that at this point. Hope you're getting my issue, i'll attach a visualisation.My Code, don't get confused, I wanted to do a slider but lets focus on only on...
 javascript                     3 answers                     49 view