1
type Gdrive = {
2
token: string;
3
};
4
export async function main(
5
gdrive_auth: Gdrive,
6
fileId: string,
7
mimeType: string,
8
) {
9
const DOWNLOAD_FILE_URL = `https://www.googleapis.com/drive/v3/files/fileId=${fileId}/export/?mimeType=${mimeType}`;
10
11
const token = gdrive_auth["token"];
12
13
const response = await fetch(DOWNLOAD_FILE_URL, {
14
method: "GET",
15
headers: {
16
Authorization: "Bearer " + token,
17
"Content-Type": "application/json",
18
},
19
});
20
21
const result = await response.json();
22
23
return result;
24
}
25