'Getting File Metadata from Google API V3 in Typescript (React Native)
I am using react-native-google-drive-api-wrapper This wrapper facilitates the use of the google drive api..
import GDrive from "react-native-google-drive-api-wrapper";
This should be the line that to get content of the file:
let result = await GDrive.files.get(fileID, { alt: "media" });
And by removing the { alt: "media" }, I should get all the metadata list
I tried to get metadata by this line:
let result = await GDrive.files.get(fileID);
but I get this error:
WARN Possible Unhandled Promise Rejection (id: 5): TypeError: undefined is not an object (evaluating 'Object.keys(queryParams)')
P/S: I want to get the description of the files
Solution 1:[1]
You can use the @robinbobin/react-native-google-drive-api-wrapper
To get file metadata
import {GDrive} from "@robinbobin/react-native-google-drive-api-wrapper";
const gDrive = new GDrive();
gDrive.accessToken = (await GoogleSignin.getTokens()).accessToken;
const queryParameters = {fields:'*'};
gDrive.files.getMetadata("fileId", queryParameters).then(res => console.log(res));
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | M.Mthimunye |
