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

google-drive-to-s3-sync

v1.0.0

Published

Google Drive to Amazon S3 Sync

Downloads

4

Readme

License

Made with Node Made with Npm

Overview

This is a Node.js package that simplifies the process of transferring files from Google Drive to Amazon S3. This package utilizes AWS S3 and Google Drive APIs to securely and efficiently sync files from a specified Google Drive folder to a designated bucket on Amazon S3.

Features

  • Sync files from Google Drive to Amazon S3.
  • Secure access with AWS IAM user credentials.
  • Authenticate using Google Drive service account.
  • Effortless file transfer between Google Drive and Amazon S3.

System Requirements

Before using the package, make sure you have the following:

AWS Account and IAM User:

  • Create an IAM user in your AWS account with S3FULLACCESS permissions.
  • Create an S3 bucket where the Google Drive files will be synced. Google Cloud Platform Account:

Create a project on Google Cloud Platform (GCP).

  • Generate a service account for the project and download the credentials as a JSON file.
  • Enable the Google Drive API for the project in the GCP dashboard.

Google Drive Setup:

  • Identify the folder in your Google Drive that you want to sync with Amazon S3.
  • Share the folder with the client_email present in the service account credentials JSON.

Node.js and NPM:

  • Ensure you have Node.js >=18.17.0 and NPM >=9.6.7 (Node Package Manager) installed on your system.

Installation

Install the package via NPM:

npm install google-drive-to-s3-sync

Configuration

Before using the package, set up the configuration:

  1. Copy the downloaded service account credentials json to project folder and rename it as 'service_account_key.json'
  2. Set GOOGLE_DRIVE_FOLDER_ID to the folder ID of the Google Drive folder you want to sync.
  3. Set S3_BUCKET_NAME to the name of your AWS S3 bucket.
  4. Set S3_BUCKET_PREFIX if you want to specify.
  5. Set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION to access the s3 bucket and sync.

Usage

Use the package in your Node.js application:

const GoogleDriveToS3 = require('google-drive-to-s3-sync');
const googleServiceAccountCredentials = require('./service_account_key.json');

const googleDriveFolderId = 'GOOGLE_DRIVE_FOLDER_ID';
const s3BucketName = 'S3_BUCKET_NAME';
const s3BucketPrefix = 'S3_BUCKET_PREFIX';
const awsAccessKeyId = 'AWS_ACCESS_KEY_ID';
const awsSecretAccessKey = 'AWS_SECRET_ACCESS_KEY';
const awsRegion = 'AWS_REGION';

try {
  const credentials = {
    aws: {
      accessKeyId: awsAccessKeyId,
      region: awsRegion,
      secretAccessKey: awsSecretAccessKey,
    },
    google: googleServiceAccountCredentials,
  };

  const migration = new GoogleDriveToS3(
    credentials,
    googleDriveFolderId,
    s3BucketName,
    s3BucketPrefix
  );

  migration.startMigration();
} catch (error) {
  console.error(error);
}

The package will start syncing files from the specified Google Drive folder to the Amazon S3 bucket.

Note: Ensure that you have proper network connectivity, and both your AWS and GCP credentials are correctly configured before using the package.

License

This project is licensed under the MIT License