( accessToken: string, fileId: string, mimeType: string )
| 104 | } |
| 105 | |
| 106 | async function fetchFileContent( |
| 107 | accessToken: string, |
| 108 | fileId: string, |
| 109 | mimeType: string |
| 110 | ): Promise<string> { |
| 111 | if (isGoogleWorkspaceFile(mimeType)) { |
| 112 | return exportGoogleWorkspaceFile(accessToken, fileId, mimeType) |
| 113 | } |
| 114 | if (mimeType === 'text/html') { |
| 115 | const html = await downloadTextFile(accessToken, fileId) |
| 116 | return htmlToPlainText(html) |
| 117 | } |
| 118 | if (isSupportedTextFile(mimeType)) { |
| 119 | return downloadTextFile(accessToken, fileId) |
| 120 | } |
| 121 | |
| 122 | throw new Error(`Unsupported MIME type for content extraction: ${mimeType}`) |
| 123 | } |
| 124 | |
| 125 | interface DriveFile { |
| 126 | id: string |
no test coverage detected