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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@miinded/nestjs-google-drive

v1.0.0

Published

Production-ready NestJS module for Google Drive integration. Features file uploads, downloads, sharing, folder management, and full TypeScript support with service account authentication.

Readme

@miinded/nestjs-google-drive

npm version License: MIT

Production-ready NestJS module for Google Drive integration. Features file uploads, downloads, sharing, folder management, and full TypeScript support with service account authentication.

Features

  • 🚀 Easy Integration - Simple module registration with sync and async configuration
  • 🔐 Service Account Auth - Secure server-to-server authentication
  • 📁 Folder Management - Create and manage folders programmatically
  • 🔗 Sharing & Permissions - Generate shareable links and manage access
  • 📝 Full TypeScript - Complete type definitions for excellent DX
  • Well Tested - Unit, integration, and E2E tests

Installation

npm install @miinded/nestjs-google-drive
# or
pnpm add @miinded/nestjs-google-drive
# or
yarn add @miinded/nestjs-google-drive

Prerequisites

  1. Create a Google Cloud Project
  2. Enable Google Drive API
  3. Create a Service Account
  4. Generate and download the JSON key file
  5. Share your Drive folders with the service account email

Quick Start

import { Module } from '@nestjs/common';
import { GoogleDriveModule } from '@miinded/nestjs-google-drive';

@Module({
  imports: [
    GoogleDriveModule.register({
      clientEmail: process.env.GOOGLE_CLIENT_EMAIL,
      privateKey: process.env.GOOGLE_PRIVATE_KEY, // The full private key including \n
    }),
  ],
  providers: [DocumentService],
})
export class AppModule {}

Async Configuration

import { ConfigModule, ConfigService } from '@nestjs/config';
import { GoogleDriveModule } from '@miinded/nestjs-google-drive';

@Module({
  imports: [
    ConfigModule.forRoot(),
    GoogleDriveModule.registerAsync({
      imports: [ConfigModule],
      inject: [ConfigService],
      useFactory: (config: ConfigService) => ({
        clientEmail: config.getOrThrow('GOOGLE_CLIENT_EMAIL'),
        privateKey: config.getOrThrow('GOOGLE_PRIVATE_KEY'),
      }),
    }),
  ],
})
export class AppModule {}

Usage Example

import { Injectable } from '@nestjs/common';
import { InjectDrive, GoogleDriveService, UploadResult } from '@miinded/nestjs-google-drive';

@Injectable()
export class DocumentService {
  constructor(@InjectDrive() private readonly drive: GoogleDriveService) {}

  async uploadReport(reportId: string, content: Buffer): Promise<UploadResult> {
    const key = `reports/${reportId}.pdf`;
    return this.drive.uploadPrivateFile(key, content, 'application/pdf');
  }

  async downloadReport(fileId: string): Promise<Uint8Array> {
    return this.drive.download(fileId);
  }

  async shareReport(fileId: string): Promise<string> {
    return this.drive.getLink(fileId);
  }

  async listReports() {
    return this.drive.listFiles('reports');
  }
}

API Reference

| Method | Description | Returns | | ---------------------------------------------- | --------------------- | ------------------------------ | | uploadFile(key, buffer, mimeType, isPublic?) | Upload a file | Promise<UploadResult> | | uploadPublicFile(key, buffer, mimeType) | Upload a public file | Promise<UploadResult> | | uploadPrivateFile(key, buffer, mimeType) | Upload a private file | Promise<UploadResult> | | download(fileId) | Download file content | Promise<Uint8Array> | | getStream(fileId) | Get readable stream | Promise<Readable> | | exists(key) | Check if file exists | Promise<boolean> | | getLink(fileId) | Get shareable URL | Promise<string> | | listFiles(path) | List files in path | Promise<{name, size, key}[]> | | delete(fileId) | Delete a file | Promise<void> |

Configuration Options

| Option | Type | Required | Description | | ------------- | -------- | -------- | ----------------------------------------------------------------------- | | clientEmail | string | ✅ | Service account email (client_email from JSON key) | | privateKey | string | ✅ | Service account private key (private_key from JSON key, include \n) |

Getting Your Credentials

  1. Go to Google Cloud Console
  2. Create a new project or select existing
  3. Enable Google Drive API
  4. Go to IAM & Admin > Service Accounts
  5. Create a service account
  6. Create a key (JSON format)
  7. Extract client_email and private_key from the JSON file

Environment Variables

GOOGLE_CLIENT_EMAIL=your-service-account@project.iam.gserviceaccount.com
GOOGLE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"

License

MIT © Miinded