![38% of CISOs Fear They’re Not Moving Fast Enough on AI](https://cdn.sanity.io/images/cgdhsj6q/production/faa0bc28df98f791e11263f8239b34207f84b86f-1024x1024.webp?w=400&fit=max&auto=format)
Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
react-native-gdrive-api-wrapper
Advanced tools
This wrapper facilitates the use of the google drive api.
This wrapper facilitates the use of the google drive api.
It doesn't provide any authorization mechanism, so another package has to be used. I use react-native-google-signin (thanks for the great work guys!).
npm i --save react-native-google-drive-api-wrapper
react-native link react-native-fs
react-native-fs is a package my code depends on and it needs linking.
This is the "entry point" of the wrapper. It contains only static
methods and fields.
import GDrive from "react-native-google-drive-api-wrapper";
Sets the access token for use in subsequent calls to the api. Get the token from a package you choose to use.
GDrive.setAccessToken(accessToken);
Initializes the wrapper.
GDrive.init();
or
const params = {
files: {
boundary: String // The boundary string for multipart file uploads. Default: "foo_bar_baz".
}
};
GDrive.init(params);
Returns true
if an access token has been supplied, false
otherwise.
GDrive.isInitialized() ? <some code> : <some other code>;
Creates a file using multipart upload. Returns the result of fetch()
.
If contents
is a base64 string, set isBase64
to true
.
const contents = "My text file contents";
// or
const contents = [10, 20, 30];
GDrive.files.createFileMultipart(
contents,
"corresponding mime type", {
parents: ["root"],
name: "My file"
},
isBase64);
Deletes the specified file returning the result of fetch()
.
GDrive.files.delete(fileId);
Gets a file's metadata or a text-file's content by ID. By default the metadata is returned. Use download()
for binary files. For queryParams
see "Optional query parameters" here. If you want the content of a text-file and not its metadata add alt: "media"
to queryParams
.
const queryParams = { ... };
GDrive.files.get(fileId, queryParams);
Downloads the specified text or binary file.
For downloadFileOptions
see the description ofdownloadFile()
here. Please, bear in mind that fromUrl
is set automatically and any user supplied value will be overwritten.
The meaning of queryParams
is the same as in get()
.
The function returns the result of RNFS.downloadFile(downloadFileOptions)
.
GDrive.files.download(fileId, downloadFileOptions, queryParams);
Exports a google document, returning the result of fetch()
.
GDrive.files.export(fileId, mimeType);
Gets the id of the first file with the specified metadata. The function returns a Promise
. It's rejected on failure and resolved to the file id or undefined
(if nothing is found) on success.
GDrive.files.getId(
name: String, // The name.
parents: [String], // The parents.
mimeType: String, // The mime type.
trashed: Boolean // Whether the file is trashed. Default: false
);
Lists or searches files returning the result of fetch()
.
GDrive.files.list({q: "'root' in parents"});
Gets the id of the first folder with the specified name
and parents
, creating the folder if it doesn't exist. The function returns a Promise
that is rejected on failure and resolved to the folder id on success.
GDrive.files.safeCreateFolder({
name: "My folder",
parents: ["root"]
});
Creates a permission for the specified file returning the result of fetch().
GDrive.permissions.create(
fileId, {
role: "reader",
type: "anyone"
});
Version number | Changes |
---|---|
v1.2.0 | GDrive.files.createFileMultipart() — isBase64 . Merge pull request #10 from duyluonglc/master. Thanks, duyluonglc! |
v1.1.1 | GDrive.files.export() added. |
v1.0.1 | 1. A critical bug with invalid imports fixed. 2. client-side-common-utils deprecated; switched to simple-common-utils . |
v1.0.0 | Initial release. |
Written with StackEdit.
FAQs
This wrapper facilitates the use of the google drive api.
The npm package react-native-gdrive-api-wrapper receives a total of 0 weekly downloads. As such, react-native-gdrive-api-wrapper popularity was classified as not popular.
We found that react-native-gdrive-api-wrapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.