How to use FileSystem.downloadAsync with a POST endpoint

Can I download a file using a HTTP POST method endpoint?

E.g. Expo.FileSystem.downloadAsync('http://myhost/my-post-endpoint', someBodyData, ....);

I need to consume this endpoint with a body data.

By now, I’m using fetch API to retrieve the file, but I’m stucked with his result. I got a Blob object, without a fileUri. In my use case, I need a fileURI, not a Blob itself.

fetch('http://myhost/my-post-endpoint', {
		method: 'POST',
		headers: {
			"Accept": " image/png"
		},
		body: JSON.stringify(someBodyData),
	})
        .then(res => res.blob())
        .then(blob => console.log(blob)) ////Where is the fileUri from the blob file? Where this blob file is downloaded? Where is my mother?

Someone can help me? Thanks!

1 Like

I would check out the FileSystem API for how to move further with this: FileSystem - Expo Documentation

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.