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

zohodrive-asset-uploader

v1.0.0

Published

API to upload images and PDFs to Zoho WorkDrive

Readme

🚀 Zoho WorkDrive Asset Uploader

This project is a Node.js API that connects an application with Zoho WorkDrive. It handles Zoho’s OAuth2 authentication process and provides easy REST APIs to upload, view, and download files like images and PDFs. The main goal of this project is to make file management simple and secure while reducing the complexity of authentication for developers.


✨ Features

  • Easy Authentication: The system automatically manages Zoho OAuth2 login and refreshes tokens in the background, so no manual work is needed.

  • Supports Multiple Regions: It works with both India (.in) and Global (.com) Zoho data centers.

  • Supports Many File Types: You can upload and manage files like JPG, PNG, WEBP, SVG, and PDF easily.

  • Efficient File Handling: Files can be viewed and downloaded directly from Zoho using streaming, which helps save server memory.

  • Simple API Testing: Swagger UI is included, so you can test all API endpoints without building a frontend.


🛠️ Setup & Installation

1. Prerequisites

  • A Zoho account (Self Client registered in Zoho API Console)
  • Generate yor client secret, client id and object id from the self clien id

2. Installation

git clone https://github.com/AadvikLabs/Zohodrive-Asset-Uploader.git
cd Zohodrive-Asset-Uploader
npm install

3. Environment Configuration (.env)

Create a .env file in the root directory and fill in your Zoho credentials:

PORT=3000

# Zoho API Credentials
ZOHO_CLIENT_ID=YOUR_CLIENT_ID
ZOHO_CLIENT_SECRET=YOUR_CLIENT_SECRET
ZOHO_FOLDER_ID=YOUR_TARGET_FOLDER_ID

* once you the upper required id you can create the refresh token from the terminal
# Domain Setup (Use .in for India, .com for Global)
ZOHO_ACCOUNTS_URL=https://accounts.zoho.in
on scope write 
WorkDrive.files.ALL,WorkDrive.team.READ,WorkDrive.workspace.READ,ZohoFiles.files.ALL
press the generate code button past copy the token and past that in the terminal

### 4. Generate Your Refresh Token
We've included a helper script to make the one-time authentication setup easy:

1.  Run the script:
    -> node scripts/generateToken.js
2.  Copy the token at the terminal 

3. The new refresh token will generate which has no expiry date

---

## ▶️ Running the App

**Development Mode:**
```bash
npm run dev

Production Mode:

npm start

Interactive API Docs: Open http://localhost:3000/api-docs to test the API directly from your browser.


📡 API Endpoints

| Method | Endpoint | Description | | :--- | :--- | :--- | | POST | /api/upload | Upload a file. Returns an attachmentId. | | GET | /api/view/:id | View a file directly in the browser tab. | | GET | /api/download/:id | Download a file with its original filename. |


🏗️ Project Structure

  • /src/controllers: Logic for handling requests and responses.
  • /src/services: The core ZohoService which manages the OAuth singleton and Zoho API requests.
  • /src/routes: API endpoint definitions.
  • /scripts/generateToken: Setup utilities (Token generator).
  • swagger.yaml: OpenAPI 3.0 contract.

📦 Usage as an npm package

You can consume this project as a library instead of running the bundled server. Example usage:

  1. Install your local tarball or publish and install from the registry.

  2. Minimal Express mounting example:

const express = require('express');
const { createApp } = require('zohodrive-asset-uploader'); // or local path to the package

const app = createApp({ mountPath: '/api' });
app.listen(3000, () => console.log('Listening on 3000'));
  1. Programmatic access to services:
const { zohoService } = require('zohodrive-asset-uploader');

// Use zohoService.uploadToWorkDrive(...) or zohoService.getFileStream(...)

When used as a package, the host application must provide the required environment variables (see the Configuration section above) so the SDK can authenticate with Zoho.


� Security & Reliability

  • Encapsulation: Zoho access tokens are cached in-memory and never exposed or logged.
  • Error Resiliency: Custom error handling prevents circular-reference crashes during networking issues.
  • Singleton Pattern: Ensures only one authentication state exists across your entire app instance.