Google Drive API reference
Exports of @anymux/google-drive. Back to the module
Classes
GoogleDriveFileSystem
classclass GoogleDriveFileSystem
constructor
constructorconstructor(config: GoogleDriveConfig): GoogleDriveFileSystem
readFile
methodreadFile(path: string, options?: { encoding?: BufferEncoding; flag?: string; } | BufferEncoding): Promise<Buffer | string>writeFile
methodwriteFile(path: string, data: Buffer | string | Uint8Array, _options?: { encoding?: BufferEncoding; mode?: number; flag?: string; }): Promise<void>appendFile
methodappendFile(path: string, data: Buffer | string | Uint8Array, options?: { encoding?: BufferEncoding; mode?: number; flag?: string; }): Promise<void>readdir
methodreaddir(path: string, options?: { encoding?: BufferEncoding; withFileTypes?: false; recursive?: boolean; }): Promise<string[]>readdir
methodreaddir(path: string, options: { encoding?: BufferEncoding; withFileTypes: true; recursive?: boolean; }): Promise<Dirent[]>readdir
methodreaddir(path: string, options?: { encoding?: BufferEncoding; withFileTypes?: boolean; recursive?: boolean; }): Promise<string[] | Dirent[]>stat
methodstat(path: string, options?: { bigint?: false; }): Promise<Stats>stat
methodstat(path: string, options: { bigint: true; }): Promise<BigIntStats>stat
methodstat(path: string, _options?: { bigint?: boolean; }): Promise<Stats | BigIntStats>lstat
methodlstat(path: string, options?: { bigint?: false; }): Promise<Stats>lstat
methodlstat(path: string, options: { bigint: true; }): Promise<BigIntStats>lstat
methodlstat(path: string, _options?: { bigint?: boolean; }): Promise<Stats | BigIntStats>mkdir
methodmkdir(path: string, _options?: { recursive?: boolean; mode?: number; }): Promise<string | undefined>unlink
methodunlink(path: string): Promise<void>
rename
methodrename(oldPath: string, newPath: string): Promise<void>
copyFile
methodcopyFile(src: string, dest: string, _mode?: number): Promise<void>
access
methodaccess(path: string, _mode?: number): Promise<void>
exists
methodexists(path: string): Promise<boolean>
rm
methodrm(path: string, options?: { force?: boolean; recursive?: boolean; }): Promise<void>rmdir
methodrmdir(path: string, _options?: { maxRetries?: number; recursive?: boolean; retryDelay?: number; }): Promise<void>truncate
methodtruncate(path: string, _len?: number): Promise<void>
utimes
methodutimes(_path: string, _atime: string | number | Date, _mtime: string | number | Date): Promise<void>
realpath
methodrealpath(path: string): Promise<string>
cp
methodcp(src: string, dest: string, _options?: { recursive?: boolean; }): Promise<void>mkdtemp
methodmkdtemp(prefix: string): Promise<string>
chmod
methodchmod(_path: string, _mode: string | number): Promise<void>
chown
methodchown(_path: string, _uid: number, _gid: number): Promise<void>
lchown
methodlchown(_path: string, _uid: number, _gid: number): Promise<void>
lchmod
methodlchmod(_path: string, _mode: string | number): Promise<void>
lutimes
methodlutimes(_path: string, _atime: string | number | Date, _mtime: string | number | Date): Promise<void>
symlink
methodsymlink(_target: string, _path: string, _type?: "dir" | "file" | "junction"): Promise<void>
link
methodlink(_existingPath: string, _newPath: string): Promise<void>
readlink
methodreadlink(_path: string, _options?: { encoding?: BufferEncoding; }): Promise<string>statfs
methodstatfs(path: string, options?: { bigint?: false; }): Promise<StatFs>statfs
methodstatfs(path: string, options: { bigint: true; }): Promise<BigIntStatFs>statfs
methodstatfs(_path: string, _options?: { bigint?: boolean; }): Promise<StatFs | BigIntStatFs>open
methodopen(_path: string, _flags?: string | number, _mode?: number): Promise<IFileHandle>
opendir
methodopendir(_path: string, _options?: { encoding?: BufferEncoding; bufferSize?: number; recursive?: boolean; }): Promise<IDir>createReadStream
methodcreateReadStream(_path: string, _options?: { encoding?: BufferEncoding; start?: number; end?: number; }): ReadStreamcreateWriteStream
methodcreateWriteStream(_path: string, _options?: { encoding?: BufferEncoding; flags?: string; mode?: number; }): WriteStreamwatch
methodwatch(_path: string, _options?: { encoding?: BufferEncoding; persistent?: boolean; recursive?: boolean; }): FSWatcherPathCache
classclass PathCache
constructor
constructorconstructor(rootFolderId: string): PathCache
get
methodget(path: string): string | undefined
set
methodset(path: string, id: string): void
invalidate
methodinvalidate(path: string): void
clear
methodclear(): void
GooglePhotosMediaProvider
classclass GooglePhotosMediaProvider
constructor
constructorconstructor(accessToken: string): GooglePhotosMediaProvider
listItems
methodlistItems(): Promise<MediaItem[]>
getItem
methodgetItem(id: string): Promise<MediaItem | null>
createItem
methodcreateItem(_item: Omit<MediaItem, "id" | "createdAt" | "updatedAt">): Promise<MediaItem>
updateItem
methodupdateItem(_id: string, _updates: Partial<MediaItem>): Promise<MediaItem>
deleteItem
methoddeleteItem(_id: string): Promise<void>
search
methodsearch(query: string): Promise<MediaItem[]>
getAlbums
methodgetAlbums(): Promise<string[]>
getByAlbum
methodgetByAlbum(album: string): Promise<MediaItem[]>
getByDateRange
methodgetByDateRange(start: Date, end: Date): Promise<MediaItem[]>
GoogleCalendarProvider
classclass GoogleCalendarProvider
constructor
constructorconstructor(accessToken: string): GoogleCalendarProvider
listItems
methodlistItems(): Promise<CalendarEvent[]>
getItem
methodgetItem(id: string): Promise<CalendarEvent | null>
createItem
methodcreateItem(item: Omit<CalendarEvent, "id" | "createdAt" | "updatedAt">): Promise<CalendarEvent>
updateItem
methodupdateItem(id: string, updates: Partial<CalendarEvent>): Promise<CalendarEvent>
deleteItem
methoddeleteItem(id: string): Promise<void>
search
methodsearch(query: string): Promise<CalendarEvent[]>
getCalendars
methodgetCalendars(): Promise<CalendarInfo[]>
getEventsByRange
methodgetEventsByRange(start: Date, end: Date): Promise<CalendarEvent[]>
getEventsByCalendar
methodgetEventsByCalendar(calendarId: string): Promise<CalendarEvent[]>
GoogleContactsProvider
classclass GoogleContactsProvider
constructor
constructorconstructor(accessToken: string): GoogleContactsProvider
listItems
methodlistItems(): Promise<ContactItem[]>
getItem
methodgetItem(id: string): Promise<ContactItem | null>
createItem
methodcreateItem(item: Omit<ContactItem, "id" | "createdAt" | "updatedAt">): Promise<ContactItem>
updateItem
methodupdateItem(id: string, updates: Partial<ContactItem>): Promise<ContactItem>
deleteItem
methoddeleteItem(id: string): Promise<void>
search
methodsearch(query: string): Promise<ContactItem[]>
getGroups
methodgetGroups(): Promise<ContactGroup[]>
getByGroup
methodgetByGroup(groupId: string): Promise<ContactItem[]>
searchByName
methodsearchByName(name: string): Promise<ContactItem[]>
Types
GoogleDriveConfig
typetype GoogleDriveConfig = { accessToken?: string; rootFolderId?: string; baseUrl?: string; }GoogleDriveConfigInput
typeWhat a constructor accepts: fields with a schema default may be omitted.
type GoogleDriveConfigInput = { accessToken?: string; rootFolderId?: string; baseUrl?: string; }Constants
GoogleDriveConfigSchema
constconst 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; }>