Search... Ctrl + K

Delete File (gdrive)
One script reply has been approved by the moderators Verified

Created by rossmccrann 128 days ago Used 33 times 1 Point

No comments yet

Points: 0
deno
One script reply has been approved by the moderators
Ap­pro­ved
import * as wmill from "https://deno.land/x/windmill@v1.23.0/mod.ts";

export async function main(
  gdrive_auth: wmill.Resource<"gdrive">,
  fileId: string,
) {
    const supportsAllDrives=true;
  const DELETE_FILE_URL =`https://www.googleapis.com/drive/v3/files/${fileId}/?supportsAllDrives=${supportsAllDrives}`;

  const token = gdrive_auth["token"];

  const response = await fetch(DELETE_FILE_URL, {
    method: "DELETE",
    headers: {
      Authorization: "Bearer " + token,
      "Content-Type": "application/json",
    },
  });

  return await response.text();
}

Submitted by rossmccrann 128 days ago

Edited 128 days ago

No comments yet