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

@aadvik-teklabs/dropbox-uploader

v1.0.2

Published

Cloud storage uploader with Express routes and service wrapper (currently backed by Box SDK)

Readme

@aadvik-teklabs/dropbox-uploader

npm version License: MIT

A cloud-storage asset uploader for Node.js with a ready-to-use Express router and a simple service wrapper. Includes upload, list, delete, sharing-link generation, and preview URL retrieval.

Note: The current implementation is backed by the Box SDK (box-node-sdk). A native Dropbox adapter is on the roadmap. The public API surface is provider-agnostic, so migrating an integration will require only a token/credential swap.


✨ Features

  • 📤 Upload files (Buffer) to a folder
  • 📋 List folder contents with metadata
  • 🔗 Shared links — generate public sharing URLs
  • 👁️ Preview URLs — get embed/preview links
  • 🗑️ Delete files
  • 🔁 Automatic duplicate handling — retries with timestamped filename on 409 conflicts
  • ♻️ Persistent auth — refresh tokens are auto-rotated and written back to .env
  • 🚏 Drop-in Express router/upload, /files, /download/:fileId

📦 Installation

npm install @aadvik-teklabs/dropbox-uploader

🔧 Setup

1. Create a Box Developer App

  1. Go to https://app.box.com/developers/consoleCreate New AppCustom AppOAuth 2.0 (User Authentication).
  2. Enable the following scopes: Read/Write files, manage sharing links.
  3. Copy your Client ID and Client Secret.
  4. Generate a Refresh Token using the included generate-token.js helper (in the repo) or the Box OAuth playground.

2. Create a .env file

BOX_CLIENT_ID=your-client-id
BOX_CLIENT_SECRET=your-client-secret
BOX_REFRESH_TOKEN=your-refresh-token

The refresh token will be auto-updated in this file whenever Box rotates it.


🚀 Usage

Programmatic API

const { boxService } = require('@aadvik-teklabs/dropbox-uploader');
const fs = require('fs');

async function main() {
    const buffer = fs.readFileSync('./document.pdf');

    // Upload
    const file = await boxService.uploadFile(buffer, 'document.pdf');
    console.log('Uploaded file ID:', file.id);

    // Create a public sharing link
    const shareUrl = await boxService.createSharingLink(file.id);
    console.log('Share URL:', shareUrl);

    // Get download URL
    const downloadUrl = await boxService.getDownloadUrl(file.id);

    // List files in root folder
    const files = await boxService.listFiles('0');

    // Preview link
    const preview = await boxService.getFilePreview(file.id);

    // Delete
    await boxService.deleteFile(file.id);
}

main().catch(console.error);

Drop-in Express router

const express = require('express');
const { uploadRoutes } = require('@aadvik-teklabs/dropbox-uploader');

const app = express();
app.use('/api', uploadRoutes);

app.listen(3000, () => console.log('Server running on port 3000'));

Exposed endpoints:

| Method | Path | Description | |---|---|---| | POST | /api/upload | Upload a file (multipart field: file) | | GET | /api/files | List files in root folder | | GET | /api/download/:fileId | Redirect to a temporary download URL |

Example curl upload:

curl -X POST http://localhost:3000/api/upload -F "file=@./photo.jpg"

📖 API Reference

boxService.uploadFile(buffer, fileName, folderId?)

Uploads a file buffer. Auto-renames with timestamp on duplicate name (HTTP 409).

boxService.listFiles(folderId?)

Returns an array of { id, name, size, type, modifiedAt, sharedLink }.

boxService.createSharingLink(fileId)

Returns a public URL string.

boxService.getDownloadUrl(fileId)

Returns a temporary direct-download URL string.

boxService.getFilePreview(fileId)

Returns an expiring embed URL, or null if not available.

boxService.deleteFile(fileId)

Deletes the file. Returns true on success.

getBoxClient(refreshToken)

Low-level: returns a raw box-node-sdk persistent client if you need custom operations.


🔒 Security

  • Never commit .env to source control (it's auto-updated with refreshed tokens).
  • Rotate the Box refresh token if it may have been exposed.
  • Restrict Box app scopes to the minimum required.

📝 License

MIT © Aadvik Labs

🔗 Links