Skip to content

Commit fddac08

Browse files
authored
Update readme with a complete browser example
1 parent 4fcda10 commit fddac08

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

readme.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,14 @@ If a module packager is preferred, just simply `require("csvtojson")`:
674674
var csv=require("csvtojson");
675675

676676
// or with import
677-
import * as csv from "csvtojson";
677+
import {csv} from "csvtojson";
678+
679+
//then use csv as normal, you'll need to load the CSV first, this example is using Fetch https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
680+
fetch('http://mywebsite.com/mycsvfile.csv')
681+
.then(response => response.text())
682+
.then(text => csv.fromString(text));
683+
.then(function(result){
684+
685+
})
678686

679-
//then use csv as normal
680687
```

0 commit comments

Comments
 (0)