I'm trying to download users images in the browser using the google drive rest api, but I can't seem to get to the actual image data. I'm able to successfully call the files endpoint, but I don't know what to do with the response.
my fetch request:
fetch(`https://www.googleapis.com/drive/v3/files/${fileId}?key=${driveInfo.key}`, settings)
.then(res => {
return res.json();
})
.then(json => {
console.log("drive json", json);
});
which outputs:
drive json
{
kind: "drive#file"
id: "1qXXBU6oIxs2Y4PZskA-kj6ljMjTfGKjf"
name: "Screenshot_20180919-160538.png"
mimeType: "image/png"
}
I've also noticed that response.body
is a ReadableStream<Uint8Array>
which is great, as I ultimately need a uint8 array, but it looks like the uint8 array represents the above meta data rather than the actual image data.
Am I even going about this the right way, or am I way off in this attempt to download images in the client?