Znote (recipes)
  Get Znote  

DanfoJS read file

Read datasets and load them into DanfoJS

 

DanfoJS read local file

The browser version of DanfoJS is loaded by default.

Save a remote file locally

// Get Url
const r = await fetch('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')
const content = await r.text();
// Write ti file
_fs.writeFileSync(__dirname+'/finance-charts-apple.csv', content);
print("Done!")

Read local file

The browser version only support http:// urls. To read local file, use Node FS API like below:

const data = _fs.readFileSync(__dirname+'/finance-charts-apple.csv', 'utf8');
//print(data)
const blob = new Blob([data], {
  type: "application/text",
});

const df = await dfd.readCSV(blob);
print(df);

Related recipes