1
Delete File
One script reply has been approved by the moderators Verified
Created by rossmccrann 832 days ago Viewed 9344 times
0
Submitted by rossmccrann Deno
Verified 832 days ago
1
type Gdrive = {
2
  token: string;
3
};
4
export async function main(gdrive_auth: Gdrive, fileId: string) {
5
  const supportsAllDrives = true;
6
  const DELETE_FILE_URL = `https://www.googleapis.com/drive/v3/files/${fileId}/?supportsAllDrives=${supportsAllDrives}`;
7

8
  const token = gdrive_auth["token"];
9

10
  const response = await fetch(DELETE_FILE_URL, {
11
    method: "DELETE",
12
    headers: {
13
      Authorization: "Bearer " + token,
14
      "Content-Type": "application/json",
15
    },
16
  });
17

18
  return await response.text();
19
}
20