Skip to content

Instantly share code, notes, and snippets.

@sergeyt
Created August 5, 2021 18:08
Show Gist options
  • Save sergeyt/a7f3e0ed904d08e085008d4a9c147bce to your computer and use it in GitHub Desktop.
Save sergeyt/a7f3e0ed904d08e085008d4a9c147bce to your computer and use it in GitHub Desktop.
Drive abstraction
export type ItemType = "file" | "folder";
export interface Item {
type: ItemType;
id: string;
name: string;
path: string;
driveId: string;
}
export interface File extends Item {
size: number;
createdAt: Date;
url?: string;
download?: () => Promise<any>;
}
export interface Drive {
options: any;
provider: string;
getItems(folderId?: string): Promise<Item[]>;
deleteFile(fileId: string): Promise<void>;
deleteFolder(folderId: string): Promise<void>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment