AnyMux

Google Drive API reference

Exports of @anymux/google-drive. Back to the module

Classes

GoogleDriveFileSystem

class
class GoogleDriveFileSystem

constructor

constructor
constructor(config: GoogleDriveConfig): GoogleDriveFileSystem

readFile

method
readFile(path: string, options?: { encoding?: BufferEncoding; flag?: string; } | BufferEncoding): Promise<Buffer | string>

writeFile

method
writeFile(path: string, data: Buffer | string | Uint8Array, _options?: { encoding?: BufferEncoding; mode?: number; flag?: string; }): Promise<void>

appendFile

method
appendFile(path: string, data: Buffer | string | Uint8Array, options?: { encoding?: BufferEncoding; mode?: number; flag?: string; }): Promise<void>

readdir

method
readdir(path: string, options?: { encoding?: BufferEncoding; withFileTypes?: false; recursive?: boolean; }): Promise<string[]>

readdir

method
readdir(path: string, options: { encoding?: BufferEncoding; withFileTypes: true; recursive?: boolean; }): Promise<Dirent[]>

readdir

method
readdir(path: string, options?: { encoding?: BufferEncoding; withFileTypes?: boolean; recursive?: boolean; }): Promise<string[] | Dirent[]>

stat

method
stat(path: string, options?: { bigint?: false; }): Promise<Stats>

stat

method
stat(path: string, options: { bigint: true; }): Promise<BigIntStats>

stat

method
stat(path: string, _options?: { bigint?: boolean; }): Promise<Stats | BigIntStats>

lstat

method
lstat(path: string, options?: { bigint?: false; }): Promise<Stats>

lstat

method
lstat(path: string, options: { bigint: true; }): Promise<BigIntStats>

lstat

method
lstat(path: string, _options?: { bigint?: boolean; }): Promise<Stats | BigIntStats>

mkdir

method
mkdir(path: string, _options?: { recursive?: boolean; mode?: number; }): Promise<string | undefined>

unlink

method
unlink(path: string): Promise<void>

rename

method
rename(oldPath: string, newPath: string): Promise<void>

copyFile

method
copyFile(src: string, dest: string, _mode?: number): Promise<void>

access

method
access(path: string, _mode?: number): Promise<void>

exists

method
exists(path: string): Promise<boolean>

rm

method
rm(path: string, options?: { force?: boolean; recursive?: boolean; }): Promise<void>

rmdir

method
rmdir(path: string, _options?: { maxRetries?: number; recursive?: boolean; retryDelay?: number; }): Promise<void>

truncate

method
truncate(path: string, _len?: number): Promise<void>

utimes

method
utimes(_path: string, _atime: string | number | Date, _mtime: string | number | Date): Promise<void>

realpath

method
realpath(path: string): Promise<string>

cp

method
cp(src: string, dest: string, _options?: { recursive?: boolean; }): Promise<void>

mkdtemp

method
mkdtemp(prefix: string): Promise<string>

chmod

method
chmod(_path: string, _mode: string | number): Promise<void>

chown

method
chown(_path: string, _uid: number, _gid: number): Promise<void>

lchown

method
lchown(_path: string, _uid: number, _gid: number): Promise<void>

lchmod

method
lchmod(_path: string, _mode: string | number): Promise<void>

lutimes

method
lutimes(_path: string, _atime: string | number | Date, _mtime: string | number | Date): Promise<void>

symlink

method
symlink(_target: string, _path: string, _type?: "dir" | "file" | "junction"): Promise<void>

link

method
link(_existingPath: string, _newPath: string): Promise<void>

readlink

method
readlink(_path: string, _options?: { encoding?: BufferEncoding; }): Promise<string>

statfs

method
statfs(path: string, options?: { bigint?: false; }): Promise<StatFs>

statfs

method
statfs(path: string, options: { bigint: true; }): Promise<BigIntStatFs>

statfs

method
statfs(_path: string, _options?: { bigint?: boolean; }): Promise<StatFs | BigIntStatFs>

open

method
open(_path: string, _flags?: string | number, _mode?: number): Promise<IFileHandle>

opendir

method
opendir(_path: string, _options?: { encoding?: BufferEncoding; bufferSize?: number; recursive?: boolean; }): Promise<IDir>

createReadStream

method
createReadStream(_path: string, _options?: { encoding?: BufferEncoding; start?: number; end?: number; }): ReadStream

createWriteStream

method
createWriteStream(_path: string, _options?: { encoding?: BufferEncoding; flags?: string; mode?: number; }): WriteStream

watch

method
watch(_path: string, _options?: { encoding?: BufferEncoding; persistent?: boolean; recursive?: boolean; }): FSWatcher

PathCache

class
class PathCache

constructor

constructor
constructor(rootFolderId: string): PathCache

get

method
get(path: string): string | undefined

set

method
set(path: string, id: string): void

invalidate

method
invalidate(path: string): void

clear

method
clear(): void

GooglePhotosMediaProvider

class
class GooglePhotosMediaProvider

constructor

constructor
constructor(accessToken: string): GooglePhotosMediaProvider

listItems

method
listItems(): Promise<MediaItem[]>

getItem

method
getItem(id: string): Promise<MediaItem | null>

createItem

method
createItem(_item: Omit<MediaItem, "id" | "createdAt" | "updatedAt">): Promise<MediaItem>

updateItem

method
updateItem(_id: string, _updates: Partial<MediaItem>): Promise<MediaItem>

deleteItem

method
deleteItem(_id: string): Promise<void>

search

method
search(query: string): Promise<MediaItem[]>

getAlbums

method
getAlbums(): Promise<string[]>

getByAlbum

method
getByAlbum(album: string): Promise<MediaItem[]>

getByDateRange

method
getByDateRange(start: Date, end: Date): Promise<MediaItem[]>

GoogleCalendarProvider

class
class GoogleCalendarProvider

constructor

constructor
constructor(accessToken: string): GoogleCalendarProvider

listItems

method
listItems(): Promise<CalendarEvent[]>

getItem

method
getItem(id: string): Promise<CalendarEvent | null>

createItem

method
createItem(item: Omit<CalendarEvent, "id" | "createdAt" | "updatedAt">): Promise<CalendarEvent>

updateItem

method
updateItem(id: string, updates: Partial<CalendarEvent>): Promise<CalendarEvent>

deleteItem

method
deleteItem(id: string): Promise<void>

search

method
search(query: string): Promise<CalendarEvent[]>

getCalendars

method
getCalendars(): Promise<CalendarInfo[]>

getEventsByRange

method
getEventsByRange(start: Date, end: Date): Promise<CalendarEvent[]>

getEventsByCalendar

method
getEventsByCalendar(calendarId: string): Promise<CalendarEvent[]>

GoogleContactsProvider

class
class GoogleContactsProvider

constructor

constructor
constructor(accessToken: string): GoogleContactsProvider

listItems

method
listItems(): Promise<ContactItem[]>

getItem

method
getItem(id: string): Promise<ContactItem | null>

createItem

method
createItem(item: Omit<ContactItem, "id" | "createdAt" | "updatedAt">): Promise<ContactItem>

updateItem

method
updateItem(id: string, updates: Partial<ContactItem>): Promise<ContactItem>

deleteItem

method
deleteItem(id: string): Promise<void>

search

method
search(query: string): Promise<ContactItem[]>

getGroups

method
getGroups(): Promise<ContactGroup[]>

getByGroup

method
getByGroup(groupId: string): Promise<ContactItem[]>

searchByName

method
searchByName(name: string): Promise<ContactItem[]>

Types

GoogleDriveConfig

type
type GoogleDriveConfig = { accessToken?: string; rootFolderId?: string; baseUrl?: string; }

GoogleDriveConfigInput

type

What a constructor accepts: fields with a schema default may be omitted.

type GoogleDriveConfigInput = { accessToken?: string; rootFolderId?: string; baseUrl?: string; }

Constants

GoogleDriveConfigSchema

const
const GoogleDriveConfigSchema: z.ZodObject<{ accessToken: z.ZodString; rootFolderId: z.ZodDefault<z.ZodString>; baseUrl: z.ZodDefault<z.ZodString>; }, "strip", z.ZodTypeAny, { accessToken?: string; rootFolderId?: string; baseUrl?: string; }, { accessToken?: string; rootFolderId?: string; baseUrl?: string; }>