Hi! I have ana api that returns blob object and I want to open it in my react native project using another library react-native-file-viewer but I don't know how to get path from blob.
could anyone help me in this please?
My code is like this:
axios.get(url, {
header,
responseType: 'blob'
})
.then(async res => {
let blob = res.data._data;
console.log(blob);
RNFetchBlob.config({
fileCache: true,
appendExt: step.MimeType.split("/")[1]
})
.fetch("GET", fileLocation) // don't know how can I get fileLocation value
.then(res => {
let path = res.path();
console.log(path)
FileViewer.open(path)
.then(() => {
console.log("success")
this.setState({
modalVisible: false
});
})
.catch(error => {
this.setState({
modalVisible: false
});
});
})
.catch((errorMessage, statusCode) => {
console.log(errorMessage)
this.setState({
modalVisible: false
});
});
})
.catch(err =>{
console.log(err)
})
Hi! I have ana api that returns blob object and I want to open it in my react native project using another library
react-native-file-viewer
but I don't know how to get path from blob.could anyone help me in this please?
My code is like this: