New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

drive-uploady

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

drive-uploady

wrapper for react-uploady to upload to google-drive

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
Maintainers
1
Weekly downloads
 
Created
Source

react-uploady Logo

Drive Uploady

Provides a custom React Uploady for uploading to Google Drive. All Uploady functionality such as hooks and components (ex: Upload-Preview) can be used with this package.

Uploads are sent to the multipart endpoint: Google Drive docs.

Note: no support for URL based uploads, only files.

Installation

#Yarn: 
   $ yarn add drive-uploady

#NPM:
   $ npm i drive-uploady

Props

Name (* = mandatory)TypeDefaultDescription
clientId* (unless gapi instance provided)stringThe API client Id. Obtained from the Google dev console
scopes* (unless gapi instance provided)stringThe scopes your app requires (Drive docs)
gApiScriptIdstring"uploady-drive-api"The id of the script tag (loading google api) that will be added to the page
gapiprovide the Google API instance directly to be used
queryParamsObjectOptional query parameters

All other Uploady props can be passed as well. See docs here.

Note: no support for concurrent > 1

Example

import React from "react";
import DriveUploady from "drive-uploady";
import UploadButton from "@rpldy/upload-button";

export const App = () => {

    return <DriveUploady        
            clientId="<my-client-id>"
            scope="https://www.googleapis.com/auth/drive.file"
           >
              <h2>Drive Uploady</h2>

            <UploadButton>Upload to Drive</UploadButton>
        </DriveUploady>;
};

Upload to folder

import React from "react";
import DriveUploady from "drive-uploady";
import UploadButton from "@rpldy/upload-button";

export const App = () => {

    return <DriveUploady        
          clientId="<my-client-id>"
          scope="https://www.googleapis.com/auth/drive.file"
          params={{ parents: ["folder-id"] }}
        >
          <h2>Drive Uploady</h2>

          <UploadButton>Upload to Drive</UploadButton>
      </DriveUploady>;
};

Use own GAPI instance

Drive-Uploady will try and use an existing window.gapi instance if its available. If not, it will create a new one (by adding a script tag).

In case you already have a GAPI client running in your page/app that's not available on the window, you can pass it as a prop:

import React from "react";
import DriveUploady from "drive-uploady";
import UploadButton from "@rpldy/upload-button";

export const App = () => {

    return <DriveUploady        
          clientId="<my-client-id>"
          scope="https://www.googleapis.com/auth/drive.file"
          gapi={window.parent.gapi}
        >
          <h2>Drive Uploady</h2>

          <UploadButton>Upload to Drive</UploadButton>
      </DriveUploady>;
};

Keywords

FAQs

Package last updated on 17 Nov 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc