Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mirage.strukto.ai/llms.txt

Use this file to discover all available pages before exploring further.

GDriveResource exposes a user’s Drive (My Drive plus shared drives the user can see) as a tree. Setup steps for OAuth credentials live at Google Workspace Credentials.

Node

pnpm add @struktoai/mirage-node
import { GDriveResource, MountMode, Workspace } from '@struktoai/mirage-node'

const drive = new GDriveResource({
  clientId: process.env.GOOGLE_CLIENT_ID!,
  clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
  refreshToken: process.env.GOOGLE_REFRESH_TOKEN!,
})

const ws = new Workspace({ '/drive': drive }, { mode: MountMode.READ })
await ws.execute('ls /drive/owned/')

Browser

pnpm add @struktoai/mirage-browser
import { GDriveResource, MountMode, Workspace } from '@struktoai/mirage-browser'

const drive = new GDriveResource({
  clientId: GOOGLE_CLIENT_ID,
  clientSecret: GOOGLE_CLIENT_SECRET,
  refreshToken: localStorage.getItem('gdrive.refresh_token')!,
})

const ws = new Workspace({ '/drive': drive }, { mode: MountMode.READ })
The browser examples in examples/typescript/browser/src/gdrive_pkce.ts show a full PKCE flow that keeps the secret out of the page.

Config

FieldDefaultNotes
clientIdrequiredGoogle OAuth client ID.
clientSecretrequiredGoogle OAuth client secret. Redacted in snapshots.
refreshTokenrequiredUser’s refresh token. Redacted in snapshots.
refreshFnbuilt-inOptional override for the access-token refresh callback.

Mount mode

read, partial write (uploads under /drive/owned/). For the mounted layout (owned/, shared/, mime-aware listings) see the Python Drive docs.