Google Drive
Simplified Google Drive API.
- package:
@deepagent/google-drive
- exports:
class GoogleDriveClient
,namespace googleDrive
- source
- google drive docs
Install
npm install @deepagent/google-drive googleapis google-auth-library
yarn add @deepagent/google-drive googleapis google-auth-library
pnpm add @deepagent/google-drive googleapis google-auth-library
Example Usage
import { GoogleDriveClient } from '@deepagent/google-drive'
import { GoogleAuth } from 'google-auth-library'
import { google } from 'googleapis'
const auth = new GoogleAuth({ scopes: 'https://www.googleapis.com/auth/drive' })
const drive = google.drive({ version: 'v3', auth })
const client = new GoogleDriveClient({ drive })
const result = await client.listFiles()
const file = result.files[0]!
const metadata = await client.getFile({ fileId: file.id })
const content = await client.exportFile({
fileId: file.id,
mimeType: 'application/pdf'
})