All Projects → HuasoFoundries → Node Google Drive

HuasoFoundries / Node Google Drive

Licence: mit
Library to operate with Google Drive API v3 from Node.js, using system user tokens or personal keys

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Node Google Drive

Gdrivefs
An innovative FUSE wrapper for Google Drive.
Stars: ✭ 618 (+1371.43%)
Mutual labels:  google-drive
Ct gdrive
Lustre/HSM Google Drive copytool
Stars: ✭ 16 (-61.9%)
Mutual labels:  google-drive
Vue Gdrive
VueJS text editor with Google Drive integration
Stars: ✭ 34 (-19.05%)
Mutual labels:  google-drive
Rclone
"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Yandex Files
Stars: ✭ 30,541 (+72616.67%)
Mutual labels:  google-drive
Drive Db
📊 Use Google Drive spreadsheets as a simple database
Stars: ✭ 782 (+1761.9%)
Mutual labels:  google-drive
Drivebackupv2
Uploads Minecraft backups to Google Drive/OneDrive or by (S)FTP
Stars: ✭ 26 (-38.1%)
Mutual labels:  google-drive
Raidrive.translation
RaiDrive Translation
Stars: ✭ 518 (+1133.33%)
Mutual labels:  google-drive
Autorclone
AutoRclone: rclone copy/move/sync (automatically) with thousands of service accounts
Stars: ✭ 1,002 (+2285.71%)
Mutual labels:  google-drive
Packt Publishing Free Learning
Scripts that automatically claim and download free daily eBooks from https://www.packtpub.com/packt/offers/free-learning
Stars: ✭ 788 (+1776.19%)
Mutual labels:  google-drive
Openly Rails
"GitHub" for Google Drive [inactive]
Stars: ✭ 20 (-52.38%)
Mutual labels:  google-drive
Packtpub Crawler
Download your daily free Packt Publishing eBook https://www.packtpub.com/packt/offers/free-learning
Stars: ✭ 717 (+1607.14%)
Mutual labels:  google-drive
Googlesheets
Google Spreadsheets R API
Stars: ✭ 771 (+1735.71%)
Mutual labels:  google-drive
Elodie
An EXIF-based photo assistant, organizer, manager and workflow automation tool.
Stars: ✭ 840 (+1900%)
Mutual labels:  google-drive
Homescripts
My Scripts for Plex / Emby with Google Drive and rclone
Stars: ✭ 652 (+1452.38%)
Mutual labels:  google-drive
Gdown
Download a large file from Google Drive (curl/wget fails because of the security notice).
Stars: ✭ 962 (+2190.48%)
Mutual labels:  google-drive
Drive Music Player
Fully client side Music Player for Google Drive
Stars: ✭ 554 (+1219.05%)
Mutual labels:  google-drive
Forge View.googledrive.models
View models from Google Drive: Sample Viewer application that displays files of supported formats from Google Drive, and generates them in the Viewer
Stars: ✭ 18 (-57.14%)
Mutual labels:  google-drive
Action Google Drive
GitHub Action to interact with Google Drive
Stars: ✭ 41 (-2.38%)
Mutual labels:  google-drive
Fastlane Plugin Google drive
fastlane plugin to upload files to Google Drive
Stars: ✭ 39 (-7.14%)
Mutual labels:  google-drive
Multipart Related
MIME multipart/related as defined in RFC 2387
Stars: ✭ 10 (-76.19%)
Mutual labels:  google-drive

node-google-drive

Travis CI FOSSA Status

Library to operate with Google Drive API v3 from Node.js, using system user tokens or personal keys

This library is heavily inspired on theozero's' google-spreadsheet. No, I mean, really inspired. As in blatantly copied. The only difference being his library is to operate with google spreadsheets and this one is to interact with google drive.

So, basically, you can operate in two ways. You either use Google Oauth and manually enter your credentials everytime, or use a Service Account and forget about further authentications.

How to create a Service Account

(the following is taken from google-spreadsheet docs)

  1. Go to the Google Developers Console
  2. Select your project or create a new one (and then select it)
  3. Enable the Drive API for your project
  • In the sidebar on the left, expand APIs & auth > APIs
  • Search for "drive"
  • Click on "Drive API"
  • click the blue "Enable API" button
  1. Create a service account for your project
  • In the sidebar on the left, expand APIs & auth > Credentials
  • Click blue "Add credentials" button
  • Select the "Service account" option
  • Select "Furnish a new private key" checkbox
  • Select the "JSON" key type option
  • Click blue "Create" button
  • your JSON key file is generated and downloaded to your machine (it is the only copy!)
  • note your service account's email address (also available in the JSON key file)
  1. Share the doc (or docs) with your service account using the email noted above

Example usage:

Let's say you stored your user credentials in a file called my_credentials.json. And you gave permission to the service account's email address over a folder in your Google Drive whose id is 1bibD4HDZVbqOPq882YSDTmZlI06fZvLU. So you would do:

const YOUR_ROOT_FOLDER = '1bibD4HDZVbqOPq882YSDTmZlI06fZvLU',
	PATH_TO_CREDENTIALS = path.resolve(`${__dirname}/my_credentials.json`);

// Let's wrap everything in an async function to use await sugar
async function ExampleOperations() {
	const creds_service_user = require(PATH_TO_CREDENTIALS);

	const googleDriveInstance = new NodeGoogleDrive({
		ROOT_FOLDER: YOUR_ROOT_FOLDER
	});

	let gdrive = await googleDriveInstance.useServiceAccountAuth(
		creds_service_user
	);

	// List Folders under the root folder
	let folderResponse = await googleDriveInstance.listFolders(
		YOUR_ROOT_FOLDER,
		null,
		false
	);

	console.log({ folders: folderResponse.folders });

	// Create a folder under your root folder
	let newFolder = { name: 'folder_example' + Date.now() },
		createFolderResponse = await googleDriveInstance.createFolder(
			YOUR_ROOT_FOLDER,
			newFolder.name
		);

	newFolder.id = createFolderResponse.id;

	debug(`Created folder ${newFolder.name} with id ${newFolder.id}`);

	// List files under your root folder.
	let listFilesResponse = await googleDriveInstance.listFiles(
		YOUR_ROOT_FOLDER,
		null,
		false
	);

	for (let file of listFilesResponse.files) {
		debug({ file });
	}
}

ExampleOperations();

See API for a description of available methods.

License

FOSSA Status

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].