itinance / itinance/react-native-fs

how to open and download CSV File ?

Open
#678 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

const url = this.state.fileUrl
// const url = 'http://workdemo.xyz/rundelivery/uploads/license_pdf/1552214519GJAHD1657131000_certificate_allotment.pdf';
const localFile = getLocalPath(url);

function getLocalPath(url) {
const filename = url.split('/').pop();
console.log('filename', filename)
// feel free to change main path according to your requirements
return `${RNFS.DocumentDirectoryPath}/${filename}`;
}

const options = {
fromUrl: url,
toFile: localFile
};
RNFS.downloadFile(options).promise
.then(() => FileViewer.open(localFile))
.then(() => {
console.log('open sucess')
})
.catch(error => {
console.log('error', error)
});

@timscott @emannick @MadavaramRamesh

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.