MCPcopy Index your code
hub / github.com/simstudioai/sim / fetchFileContent

Function fetchFileContent

apps/sim/connectors/google-drive/google-drive.ts:106–123  ·  view source on GitHub ↗
(
  accessToken: string,
  fileId: string,
  mimeType: string
)

Source from the content-addressed store, hash-verified

104}
105
106async 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
125interface DriveFile {
126 id: string

Callers 1

google-drive.tsFile · 0.70

Calls 5

htmlToPlainTextFunction · 0.90
isGoogleWorkspaceFileFunction · 0.85
downloadTextFileFunction · 0.85
isSupportedTextFileFunction · 0.70

Tested by

no test coverage detected