• How do I do this?

    I am currently doing this:

    				res.writeHead(200,head);
    				res.write("{\"Temp\":");
    				res.write(JSON.stringify(HISTORY.Temp));­
    				res.write(",\r\"RH\":");
    				res.write(JSON.stringify(HISTORY.RH));
    				res.write(",\"Pressure\":");
    				res.write(JSON.stringify(HISTORY.Pressur­e));
    				res.write(",\"AirQual\":");
    				res.write(JSON.stringify(HISTORY.AirQual­));
    				res.write(",\"Clear\":");
    				res.write(JSON.stringify(HISTORY.Clear))­;
    				res.write(",\"Red\":");
    				res.write(JSON.stringify(HISTORY.Red));
    				res.write(",\"Green\":");
    				res.write(JSON.stringify(HISTORY.Green))­;
    				res.write(",\"Blue\":");
    				res.write(JSON.stringify(HISTORY.Blue));­
    				res.write("}");
    

    It doesn't seem any better than just doing res.write(JSON.stringify(HISTORY));

    either way, it runs out of memory halfway through (the main reason being that some of the arrays being stringified are floats, so they get printed with a billion decimal places). I see that there's the .drain callback, but I can't find any example about how to use this. How do I keep track of where in the process I am so I know what to stringify next?

    Thanks!

About

Avatar for DrAzzy @DrAzzy started