From React dropzone, i receive a File object with a File.preview property whose value is a blob:url. i.e. File {preview: \"blob:http://localhost:8080/52b6bad4-58f4-4ths-a2
Yes, its possible with FileReader
and csv
:
import csv from 'csv';
// ...
const onDrop = onDrop = (e) => {
const reader = new FileReader();
reader.onload = () => {
csv.parse(reader.result, (err, data) => {
console.log(data);
});
};
reader.readAsBinaryString(e[0]);
}
// ...
FileReader API: https://developer.mozilla.org/en/docs/Web/API/FileReader
csv package: https://www.npmjs.com/package/csv