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