The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

384686 (11) [Avatar] Offline
#1
As far as I can see, 3 of the functions in the listing(readFileStream, parseNumbers & writeFileStream) don't exist:

const dataForge = require('data-forge');
const inputFilePath = './data/weather-stations.csv';
const outputFilePath = './output/transformed.csv';
// … transformRow function omitted – it is the same as in listing 5
dataForge.readFileStream(inputFilePath) //#A
.parseCSV()
.parseNumbers(["MinTemp", "MaxTemp"])
.select(transformRow) //#B
.asCSV()
.writeFileStream(outputFilePath) //#C
.then(() => {
console.log(“Done”);
})
.catch(err => {
console.error(err);
});


I got it to write to the output file OK by substituting in readFileSync, parseInts & writeFileSync - but it throws an error when it reaches the then().
437073 (4) [Avatar] Offline
#2
This code listing was using a beta feature of Data-Forge. I've since removed the feature (I couldn't get it stable in time for the book) and I've removed the code listing.