Drive

REST Provider
storage
7 methods

List, get, search, upload, and download files from Google Drive. Also supports creating folders and deleting files.

See SDK Overview for installation and initialization.

listFiles

List files in the user's Drive. Supports filtering by folder and query.

TypeScript
const drive = integrations.drive
// List recent files
const files = await drive.listFiles({ maxResults: 25 })
// List files in a specific folder
const folderFiles = await drive.listFiles({
folderId: 'folder-id-here',
maxResults: 50,
})

getFile

Get metadata for a single file by ID.

TypeScript
const file = await drive.getFile(fileId)
// => { id, name, mimeType, size, modifiedTime, ... }

searchFiles

Search files using Google Drive query syntax.

TypeScript
const results = await drive.searchFiles(
'name contains "report" and mimeType = "application/pdf"',
10 // maxResults (optional)
)

Additional operations

The Drive client also supports downloading file content, creating folders, uploading files, and deleting files.

TypeScript
// Download file content
const content = await drive.downloadFile(fileId)
// Create a folder
const folder = await drive.createFolder('My Folder')
const subfolder = await drive.createFolder('Sub Folder', parentFolderId)
// Upload a file
const uploaded = await drive.uploadFile({
name: 'report.txt',
content: 'File content here',
mimeType: 'text/plain',
parentId: folderId, // optional
})
// Delete a file
await drive.deleteFile(fileId)