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

gdrivekit

v3.2.0

Published

A lightweight Google Drive toolkit for effortless file management — handle uploads, downloads, and Drive operations in just a few lines of code.

Readme

🧩 gdrivekit

Google Drive file automation in just a few lines of code. Perform uploads, downloads, folder management, and advanced search operations effortlessly using TypeScript or Node.js.


🚀 Features

  • 📂 Upload, download, and manage Google Drive files
  • 🗂️ Create and organize folders
  • 🔍 Powerful search and filter utilities
  • ⚙️ Batch file operations
  • Lazy Loading Architecture: Functions are loaded only when needed.
  • 💡 Works with Node.js and Bun

📦 Installation

npm install gdrivekit

or

bun add gdrivekit

💻 Example Usage

⚙️ One-Time Setup (Token Generation)

Before you can use Google Drive operations, you must generate access and refresh tokens. This only needs to be done once.

import { generateCredentialsAndTokens } from "gdrivekit";

await generateCredentialsAndTokens({
  clientid: process.env.GOOGLE_CLIENT_ID!,
  projectid: process.env.GOOGLE_PROJECT_ID!,
  clientsecret: process.env.GOOGLE_CLIENT_SECRET!,
  redirecturis: ["http://localhost:3000/oauth2callback"],
  javascript_origin: ["http://localhost:3000"],
});

🔄 Initializing the Drive Service

Initialize the service and access operations through categorized groups:

import { initDriveService, operations } from "gdrivekit";

async function main() {
  initDriveService();

  // Example: Search files by name using searchOperations
  const files = await operations.searchOperations.searchByName("test");
  console.log(files.data?.files);

  // Example: Get Folder ID by Name using folderOperations
  const folder = await operations.folderOperations.getFolderIdByName(
    "My Documents"
  );
  console.log(folder);

  // Example: List all folders using listOperations
  const allFolders = await operations.listOperations.listAllFolders();
  console.log(allFolders);
}

main();

🧠 Available Operations

All operations are grouped by category under the main operations object.

📁 operations.fileOperations

| Method | Description | | ----------------------- | ----------------------------------------------- | | readFileData() | Read file content | | uploadFile() | Upload a new file to Google Drive | | downloadFile() | Download a file from Drive | | deleteFile() | Permanently delete a file | | renameFile() | Rename an existing file | | updateFile() | Update file metadata or content | | getFileInfo() | Get details of a specific file | | getFileIdByName() | Fetch file ID by its name (Exact Match) | | getCompleteFileInfo() | Get complete file metadata including all fields | | moveFile() | Move file to another folder using file ID | | copyFile() | Make a copy of a file in Drive | | getImageMetadata() | Get image metadata (EXIF data, dimensions) | | getVideoMetadata() | Get video metadata (duration, dimensions) |


🗂️ operations.folderOperations

| Method | Description | | --------------------- | ----------------------------------------- | | createFolder() | Create a new folder | | deleteFolder() | Delete an existing folder | | renameFolder() | Rename an existing folder | | getFolderIdByName() | Fetch folder ID by its name (Exact Match) |


🔍 operations.searchOperations

| Method | Description | | ----------------------- | -------------------------------------- | | searchByName() | Search files containing a name | | searchByExactName() | Search files matching exact name | | searchByType() | Search by file type (e.g., PDF, image) | | searchModifiedAfter() | Find files modified after a given date | | searchStarredFiles() | List all starred files | | searchSharedFiles() | Find files shared with you | | searchByContent() | Search within file content |


📋 operations.listOperations

| Method | Description | | ----------------------- | ----------------------------------------- | | listFiles() | List all files in Drive | | listRecentFiles() | List recently modified or added files | | listFoldersByName() | List all folders with a specific name | | listAllFolders() | List all folders in Drive | | listFilesInFolder() | List all files within a specific folder | | listFoldersInFolder() | List all folders within a specific folder | | listPDFs() | List all PDF files | | listImages() | List all image files | | listVideos() | List all video files | | listAudios() | List all audio files | | listArchives() | List all archive files | | listJSONs() | List all json files | | listSheets() | List all sheet files | | listPresentations() | List all presentation files | | listDocs() | List all docs files |


🧩 operations.batchOperations

| Method | Description | | ------------------------- | ------------------------------------ | | uploadMultipleFiles() | Upload multiple files at once | | deleteMultipleFiles() | Delete multiple files simultaneously | | downloadMultipleFiles() | Download multiple files in parallel |


🧰 operations.utilityOperations

| Method | Description | | -------------------------------- | --------------------------------------------------------- | | encryptText() | Encrypt plain text using AES-256-GCM | | decryptText() | Decrypt encrypted text using AES-256-GCM | | filesAndFoldersToZip() | Create a zip archive of folder and multiple files | | findDuplicateFilesAndFolders() | Find duplicate file and folder names in Drive | | getFileTypeBreakdown() | Get folder type breakdown in a parent folder | | getAllFilesInParent() | Get all files in a parent folder not including subfolders | | shareFile() | Share a file with a user | | fileExists() | Check if a file exists | | getStorageQuota() | Get storage quota information | | createStream() | Create stream for any Google Drive file |


❴❵ operations.jsonOperations

| Method | Description | | ---------------------------- | --------------------------------------- | | createJsonFile() | Create a new JSON file | | readJsonFileData() | Read JSON file content | | addJsonKeyValue() | Add a new key-value pair to a JSON file | | pushJsonObjectToArray() | Push a new object to a JSON array field | | updateJsonFieldAndValues() | Update an existing field in a JSON file | | selectJsonContent() | Select content from a JSON file | | deleteJsonFieldAndKeys() | Delete a field from a JSON file |


operations.conversionOperations

| Method | Description | | ----------------------- | ------------------------------------------ | | convertTextToDocs() | Convert a text file to Google Docs format | | convertDocsToPdf() | Convert a Google Docs file to PDF | | convertDocsToWord() | Convert a Google Docs file to Word | | convertDocsToText() | Convert a Google Docs file to plain text | | convertCsvToSheet() | Convert a CSV file to Google Sheets | | convertExcelToSheet() | Convert an Excel file to Google Sheets | | convertSheetToCsv() | Convert a Google Sheet to CSV | | convertSheetToPdf() | Convert a Google Sheet to PDF | | convertPptToSlides() | Convert a PowerPoint file to Google Slides | | convertSlidesToPpt() | Convert a Google Slides file to PowerPoint | | convertSlidesToPdf() | Convert a Google Slides file to PDF | | convertPdfToDocs() | Convert a PDF file to Google Docs (OCR) | | convertDrawingToPng() | Convert a Google Drawing to PNG | | convertDrawingToPdf() | Convert a Google Drawing to PDF |


operations.watcherOperations

| Method | Description | | ------------------------ | ------------------------------------------------------------ | | watchFolderEvent() | Detect add/modify/delete events in a folder (non-recursive). | | watchFolderDeepEvent() | Detect events recursively in a folder and subfolders. |


operations.scriptOperations

| Method | Description | | ---------------------- | ----------------------------------------------- | | createGoogleScript() | Create a new Google Apps Script project. | | updateGoogleScript() | Update code in an existing Apps Script project. | | deleteGoogleScript() | Move an Apps Script project to trash. | | deployGoogleScript() | Deploy a new version of an Apps Script project. |

🔑 Enabling Google Apps Script API (Required for Script Tools)

1️⃣ Enable Apps Script API in Google Cloud Console

Open this link (replace YOUR_PROJECT_ID if needed):

👉 https://console.cloud.google.com/apis/library/script.googleapis.com?project=YOUR_PROJECT_ID

Then:

  1. Click Enable
  2. Make sure the Apps Script API is active in your Cloud project

2️⃣ Enable Apps Script API in Your Google Account

Apps Script also requires user-level permission.

Open:

👉 https://script.google.com/home/usersettings

Then turn ON:

🔘 “Apps Script API”

This MUST be enabled or script creation, updating, and deployment will fail.


🧑‍💻 Author

VK GitHubNPM


⚖️ License

MIT License — free to use, modify, and distribute.