npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gdrive-backup

v2.3.2

Published

A shell command-line tool for easy backups by uploading, downloading and listing Google Drive files.

Downloads

25

Readme

Use Google Drive from the command line

Install NodeJs and npm to use this package.

Installation

Install globally from npm:

npm install gdrive-backup -g

Prerequesits

Create an application on Google Drive to get the credentials.json that needs to be sent with each request.

[https://developers.google.com/drive/api/v3/quickstart/nodejs#step_1_turn_on_the](Access Google Api Authorization)

Click Enable the Drive Api button to create an application and download your credentials.

Usage

Currently the following three commands are available (all on the root location):

  • Authorization with Google Drive
  • Backup (upload) of a file
  • Download of a backed up file

If a folder has to be backed up tar or similar compression programs should be used.

Backup a file

I file is uploaded using the backup option. The second argument adds a tag to the backup that is used to retrieve the backup.

gdrive-backup backup testupload.txt testtag -c mycredentials.json

Help:

Usage: backup [options] <path> <name>

Backup a specific folder with a backup name tag.

Options:

	-c, --credentials-path <credentials-path>  set [credentials-path] file path (default: credentials.json)
	-t, --token-path <token>                   set [token] file path (default: token.json)
	-s, --encryption-key <encryption-key>      set [encryption-key] file path used for encryption (default: encryption-key)
	--token-code <code>                        set token code needed to authorize the app
	-h, --help                                 output usage information

Download a file

After a successful backup the file can be downloaded using the provided name tag. If there are multiple files with the same tag, always the latest (newest) file is downloaded.

gdrive-backup download testtag -c mycredentials.json -d testupload.txt

Help:

Usage: download [options] <name>

Download latest backup with given name tag.

Options:

	-d, --dest <file>                          set destination file
	-c, --credentials-path <credentials-path>  set [credentials-path] file path (default: credentials.json)
	-t, --token-path <token>                   set [token] file path (default: token.json)
	--token-code <code>                        set token code needed to authorize the app
	--no-input                                 set flag to not process user input (e.g. to input the authorization token in shell)
	-h, --help                                 output usage information

Storing and retrieving backups with properties

When backup is called the file is identified with the provided name tag. This tag is set as the backup_name property for the uploaded and created backup file on Google Drive to allow finding it within a folder.

The counterpart download searches for the newest backup ordering by addedTime desc and checking the property backup_name. If a directory is provided also the directory id is included. The final search query therefore looks like this:

properties has { key='backup_name' and value='name' } and 'folder_id' in parents

Next Steps

  • Backup into folder
  • Make tutorial about backup (download latest file from specific folder)
    • Instruction steps for token verification
  • Name files automatically