Coder Social home page Coder Social logo

google-drive-io's Introduction

google-drive-io

Node.js library that makes file access in Google Drive easy.

Abstract

The official Google Drive API requires fetching of files by their id. This is particular problematic when manipulating files/folders with directory structures (as recursion is often required). This library provides convenience methods that can retrieve / insert files based on their paths.

Methods

This library exposes a number of utility methods that aid file IO in Google Drive:

  • getFolder(folderPath, returnFields, auth, callback)

    Attempts to fetch a google drive folder with path specified.
    Returns Google Drive file resource object if exists, otherwise err via callback(err, folder).
    @param  folderPath folder path to search for
    @param  returnFields fields in Google file resource to return (comma separated)
    @param  auth OAuth2 client for accessing user's Google Drive
    @param  callback(err, folder) where folder is the Google Drive folder resource object
    
  • getRootFolder(returnFields, auth, callback)

    Attempts to fetch the root directory in google drive.
    Returns Google Drive file resource object if exists, otherwise err via callback(err, folder).
    @param  returnFields fields in Google file resource to return (comma separated)
    @param  auth OAuth2 client for accessing user's Google Drive
    @param  callback(err, folder) where folder is the Google Drive folder resource object
    
  • getFile(filePath, returnFields, auth, callback)

    Attempts to fetch a google drive file with path specified.
    Returns Google Drive file resource object if exists, otherwise err via callback(err, folder).
    @param  filePath file path to search for
    @param  returnFields fields in Google file resource to return (comma separated)
    @param  auth OAuth2 client for accessing user's Google Drive
    @param  callback(err, folder) where file is the Google Drive file resource object
    
  • createFolder(folderPath, returnFields, auth, callback)

    Creates a google drive folder with path specified.
    @param  folderPath folder path to search for / create if not exists
    @param  returnFields fields in Google file resource to return (comma separated)
    @param  auth OAuth2 client for accessing user's Google Drive
    @param  err, folder where folder is the Google Drive folder resource object
    
  • createFolderIfNotExists(folderPath, returnFields, auth, callback)

    See documentation for `createFolder`.
    
  • uploadFile(filePath, uploadPath, returnFields, auth, callback)

    Upload a file to google drive.
    @param  filePath path to local file object
    @param  uploadPath path to upload to in Google Drive
    @param  returnFields fields in Google file resource to return (comma separated)
    @param  auth OAuth2 client for accessing user's Google Drive
    @param  callback(err, newFile) where newFile is Google Drive file resource object of the uploaded file
    
  • uploadFileIfNotExists(filePath, uploadPath, returnFields, auth, callback)

    See documentation for `uploadFile`.
    

google-drive-io's People

Contributors

karl-chan avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.