Appearance
Function: getFile()
ts
function getFile(client: Client, options: {
driveId: string;
fileId: string;
responseType?: ResponseType;
}): Promise<any>;Defined in: src/ms-graph/sharepointGraph.ts:196
Get file content from a SharePoint drive.
Parameters
| Parameter | Type | Description |
|---|---|---|
client | Client | The Microsoft Graph client instance. |
options | { driveId: string; fileId: string; responseType?: ResponseType; } | The file location options. |
options.driveId | string | The drive ID. |
options.fileId | string | The file ID. |
options.responseType? | ResponseType | The response type. Defaults to ResponseType.ARRAYBUFFER. |
Returns
Promise<any>
The file content in the requested format.
Example
ts
const client = await getMsGraphClient(creds);
const content = await getFile(client, {
driveId: 'drive-id',
fileId: 'file-id',
responseType: ResponseType.ARRAYBUFFER,
});
console.log('Downloaded', content.byteLength, 'bytes');