Skip to main content
Deno 2 is finally here 🎉️
Learn more

Google

Drive

A simple google drive index without any external dependencies.

import { GoogleDrive } from "https://deno.land/x/google/drive.ts";

const gd = new GoogleDrive({
  client_id: "xxxxx-xxxxxxxxxxxxxx.apps.googleusercontent.com",
  client_secret: "xxxxxxxxxxxxxxx",
  refresh_token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  logger: false,
});

try {
  await gd.authorize();
  const metadata = await gd.index("your/path"); // default root

  if (metadata.isFolder) {
    console.log(metadata.list);
  } else {
    // handle metadata.raw;
  }
} catch (e) {
  console.log(e);
}