@financial-times/load-data

1.0.12 • Public • Published

loadData

A general-purpose multi-data loader by Ændrew in 2017

Installation:

$ npm install @financial-times/load-data --save

Usage:

TypeScript/ES6:

import loadData from '@financial-times/load-data';

// Single file
loadData('data1.csv').then(data1 => {
  // do something with data1
});

// Yes, you can use it with async/await...
(async () => {
  const [data2, data3] = await loadData([ // ... and with multiple files
    'data2.tsv',
    'data3.json',
  ]);

  // do something with data2 and data3
}());

Browser:

<script src="https://unpkg.com/@financial-times/load-data"></script>
<script>
  loadData('data1.tsv').then((data1) => {
    // Do something with data1 here
  });
</script>

Supported file types:

N.b., load-data detects file type using extension. Ensure it has the following or it will fail!

  • TSV
  • Annotated TSV
  • CSV
  • JSON

Package Sidebar

Install

npm i @financial-times/load-data

Weekly Downloads

6

Version

1.0.12

License

ISC

Last publish

Collaborators

  • robertboulton
  • seraph2000
  • hamza.samih
  • notlee
  • emmalewis
  • aendra
  • the-ft
  • rowanmanning
  • chee
  • alexwilson