Marcus Gardner

Generation

generate functionSat, 08 Apr 2023

Open a tcp socket and continuously read the stream in a non-working way. Items in the stream are seperated by a cartridge return. Use regex to remove the non numeric characters but allowing the decimal point from the item and add each cleaned item to a public queue named rawData.

function readStream(stream) { stream.on('data', function (message) { var numericData = /[0-9 \.]+/g.exec(message)[0]; rawData.push(numericData); }); };

Javascript
Generate More

Want to kickstart your project?Use the new AI Studio to create your code