Giter VIP home page Giter VIP logo

gdriver's Introduction

gdriver

Build Status

gdriver is a command-line tool, written in Go, used for uploading and downloading large personal files from Google Drive (API v3). The tool provides file selection, integrity checks, transfer retries and requires a user-defined Cloud Platform project.

Click on the image to open a screencast:

asciicast

Features

  • Uses Google Drive v3 API
  • TUI-based file selection
  • File integrity check (MD5 checksum)
  • Transfer retries (app-internal and on application restart)
  • OAuth 2.0 authorization protocol

Requirements

  • User-defined Cloud Platform project with enabled Drive API (Quickstart)

Getting started

If you have installed Go SDK, you can download and build the latest master of the gdriver binary:

go get github.com/mtojek/gdriver

Without Go SDK you can download prebuilt distribution from the Releases page. If you're working on a remote workstation, copy the URL link for particular release, use curl or wget to download the archive and unpack it later (e.g tar xvzf gdriver_X.Y.Z_linux_amd64.tar.gz).

Run the help command to see available commands:

Use gdriver to download and upload large files to Google Drive.

Usage:
  gdriver [command]

Available Commands:
  auth        Authenticate Google account
  check       Check files
  download    Download files
  help        Help about any command
  upload      Upload files

Flags:
  -h, --help   help for gdriver

Use "gdriver [command] --help" for more information about a command.

Run the application for the first time

Import client configuration (credentials.json) for the Cloud Platform project. If you haven't created the project yet or enabled the Drive API, follow the Quickstart steps.

Hints:

  • Use a meaningful project name as it will be presented as title in the Google authentication form.
  • Select Desktop application type for the OAuth client.
  • There were issues reported in the past with downloading and saving the credentials file in Firefox. In case of facing a similar issue, please try to use Google Chrome.

Once you create the project, remember to download related login credentials.

The command will import the above credentials into the ~/.gdriver directory and authenticate the Google user account:

gdriver auth --import-credentials credentials.json

You should be good to go now. Try to download first files using the gdriver download command, e.g.:

gdriver download <folderID> --select --output tmp

The folderID is the ID of a Drive folder (e.g. Ax9h4tAyI53ZhqMSoa2opZ6o6m21OUyww). The value can be easily copied from the URL bar in the web browser. Open the directory in the Google Drive console and pick the folderID part from the URL (e.g. https://drive.google.com/drive/u/0/folders/Ax9h4tAyI53ZhqMSoa2opZ6o6m21OUyww).

Releases

Find latest revisions on the Releases page.

License

Apache License

gdriver's People

Contributors

mtojek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gdriver's Issues

Question: About quota limits

I have a 145TB Google Drive account with lots of videos which is accessed frequently and always maxes out daily bandwidth.

Using this utility, through the Drive API, will I have any limits regarding quotas per day and the amount of downloads I can do? The fact that the Google Drive account, web version, runs out of bandwidth for a while, will not affect the use of this tool?

didn't close resp.Body

Hi mtojek,
I'm building something with the Google Drive API and wanted to see the idiomatic way to download a file, when I stumbled upon this project.
If I'm not mistaken, then you forgot to close the resp.Body in downloadFileData(), which leds to a resource leak. More specificially, the connection isn't reused and thus the file descriptor isn't freed.

If the returned error is nil, the Response will contain a non-nil Body which the user is expected to close. If the Body is not both read to EOF and closed, the Client's underlying RoundTripper (typically Transport) may not be able to re-use a persistent TCP connection to the server for a subsequent "keep-alive" request. more

To fix this, add defer resp.Body.Close() after you check the error of ...Download().
Have a nice day! :)

About restricted files

Hello i really liked your server but i want to download some shared folder files but the thing is i cannot access the Anyone link. The files are restricted to specific users. Even if i have auth from the same id i cannot download them using your gdriver program what can i do please tell me. it gives this error

Read folder metadata for "17bOYXU3lpoDlg-yYgDPea_frqWbAEY6g"
Error: downloading files failed: can't read folder metadata (ID: 17bOYXU3lpoDlg-yYgDPea_frqWbAEY6g): googleapi: Error 404: File not found: 17bOYXU3lpoDlg-yYgDPea_frqWbAEY6g., notFound

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.