Skip to content

Commit

Permalink
feat: add originalFile to onFileLoaded
Browse files Browse the repository at this point in the history
  • Loading branch information
adeel55 authored and nzambello committed Oct 4, 2021
1 parent a37b515 commit 0d379bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class App extends Component {

render() {
return (
<CSVReader onFileLoaded={(data, fileInfo) => console.dir(data, fileInfo)} />
<CSVReader onFileLoaded={(data, fileInfo, originalFile) => console.dir(data, fileInfo, originalFile)} />
)
}
}
Expand Down Expand Up @@ -118,7 +118,7 @@ The second argument to `onFileLoaded` will be an object with infos about loaded
```typescript
// data: PapaParse.ParseResult.data
// fileInfo: IFileInfo
onFileLoaded: (data: Array<any>, fileInfo: IFileInfo) => any
onFileLoaded: (data: Array<any>, fileInfo: IFileInfo, originalFile: File) => any
```

For type definitions, see [here](src/index.tsx#L20).
Expand Down
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const CSVReader: React.FC<CSVReaderProps> = ({
encoding: fileEncoding,
}),
)
onFileLoaded(csvData?.data ?? [], fileInfo)
onFileLoaded(csvData?.data ?? [], fileInfo, files[0])
}

reader.readAsText(files[0], fileEncoding)
Expand Down

0 comments on commit 0d379bd

Please sign in to comment.