{"_id":"@aadvik-teklabs/dropbox-uploader","_rev":"3-d706a861b6362b644c1ea7849ec48e15","name":"@aadvik-teklabs/dropbox-uploader","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@aadvik-teklabs/dropbox-uploader","version":"1.0.0","keywords":["dropbox","box","upload","cloud-storage","express","multer"],"author":{"name":"Aadvik Labs"},"license":"MIT","_id":"@aadvik-teklabs/dropbox-uploader@1.0.0","maintainers":[{"name":"aadvik-teklabs","email":"info@aadviklabs.com"}],"homepage":"https://github.com/AadvikLabs/npm-dropbox-uploder#readme","bugs":{"url":"https://github.com/AadvikLabs/npm-dropbox-uploder/issues"},"dist":{"shasum":"c6ed7e4dd6c5ad1a894338c563641e4be7f1178d","tarball":"https://registry.npmjs.org/@aadvik-teklabs/dropbox-uploader/-/dropbox-uploader-1.0.0.tgz","fileCount":6,"integrity":"sha512-24abAHbYEZLLmuD5T0xQXxyhKKLoTrX9OCprMcDCN8g2SmLuxuuNM+zZALEag5cEJOJ2k9+GNSXMKHtgUBFSRg==","signatures":[{"sig":"MEUCIH1Zb73+cgtEk3vxsb+9esyDl4+a7u/o04w/JYbeXoxGAiEA6m77PQRJvHudGR2NprRRieolFjol4uxbbqdiunRq0SY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7613},"main":"index.js","gitHead":"e4552fec5bbcafcc6135f15a1400f43b7e65d88b","scripts":{"test":"echo \"Error: no test specified\" && exit 1","start":"node demo/app.js"},"_npmUser":{"name":"aadvik-teklabs","email":"info@aadviklabs.com"},"repository":{"url":"git+https://github.com/AadvikLabs/npm-dropbox-uploder.git","type":"git"},"_npmVersion":"11.12.1","description":"Cloud storage uploader with Express routes and service wrapper (currently backed by Box SDK)","directories":{},"_nodeVersion":"24.15.0","dependencies":{"cors":"^2.8.6","open":"^11.0.0","dotenv":"^17.4.2","multer":"^2.1.1","express":"^5.2.1","box-node-sdk":"^4.8.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/dropbox-uploader_1.0.0_1783078878124_0.7549029526570923","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@aadvik-teklabs/dropbox-uploader","version":"1.0.1","keywords":["dropbox","box","upload","cloud-storage","express","multer"],"author":{"name":"Aadvik Labs"},"license":"MIT","_id":"@aadvik-teklabs/dropbox-uploader@1.0.1","maintainers":[{"name":"aadvik-teklabs","email":"info@aadviklabs.com"}],"homepage":"https://github.com/AadvikLabs/npm-dropbox-uploder#readme","bugs":{"url":"https://github.com/AadvikLabs/npm-dropbox-uploder/issues"},"dist":{"shasum":"f4aac8f293a85ed3597a6a4828db0c7f053f3308","tarball":"https://registry.npmjs.org/@aadvik-teklabs/dropbox-uploader/-/dropbox-uploader-1.0.1.tgz","fileCount":6,"integrity":"sha512-243L6Z1fMvia5lhCGt3ZZJAdqosQN1W5MamASC/OUgC0bAHb44IqQ8umJxQo2S8EqioHTq1swz27dv9CbmMbuQ==","signatures":[{"sig":"MEUCIQCSY4RuVC6e3UNiwqpgD5vmyQ65d9KJ+A43yfojjLuBqgIgCrQqe4zizwF3qMr9aYTHq0ImhXcG9FqLnkWW0cmp78k=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7613},"main":"index.js","gitHead":"e4552fec5bbcafcc6135f15a1400f43b7e65d88b","scripts":{"test":"echo \"Error: no test specified\" && exit 1","start":"node demo/app.js"},"_npmUser":{"name":"aadvik-teklabs","email":"info@aadviklabs.com"},"repository":{"url":"git+https://github.com/AadvikLabs/npm-dropbox-uploder.git","type":"git"},"_npmVersion":"11.12.1","description":"Cloud storage uploader with Express routes and service wrapper (currently backed by Box SDK)","directories":{},"_nodeVersion":"24.15.0","dependencies":{"cors":"^2.8.6","open":"^11.0.0","dotenv":"^17.4.2","multer":"^2.1.1","express":"^5.2.1","box-node-sdk":"^4.8.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/dropbox-uploader_1.0.1_1783080204682_0.5055965529626258","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@aadvik-teklabs/dropbox-uploader","version":"1.0.2","description":"Cloud storage uploader with Express routes and service wrapper (currently backed by Box SDK)","main":"index.js","scripts":{"start":"node demo/app.js","test":"echo \"Error: no test specified\" && exit 1"},"keywords":["dropbox","box","upload","cloud-storage","express","multer"],"author":{"name":"Aadvik Labs"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/AadvikLabs/npm-dropbox-uploder.git"},"bugs":{"url":"https://github.com/AadvikLabs/npm-dropbox-uploder/issues"},"homepage":"https://github.com/AadvikLabs/npm-dropbox-uploder#readme","dependencies":{"box-node-sdk":"^4.8.0","cors":"^2.8.6","dotenv":"^17.4.2","express":"^5.2.1","multer":"^2.1.1","open":"^11.0.0"},"gitHead":"567edde0f064151b220e5137811e88cf3e34da56","_id":"@aadvik-teklabs/dropbox-uploader@1.0.2","_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-6j2dKXv4/BQnFIkIYWhWSrePcMda6cCW4Y8DeeHLJY9iryFzRwT4xTVTYQJb1Df3blxBiuhkTX5WB/bv6JGz0Q==","shasum":"1454d5237d677660a6a146ddaf2aa65744ae9633","tarball":"https://registry.npmjs.org/@aadvik-teklabs/dropbox-uploader/-/dropbox-uploader-1.0.2.tgz","fileCount":6,"unpackedSize":12528,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCv5s2GszTB++MVDa/BeOnjGd3CQ5UiJSvnJrYWpvAydQIgRwzGMmd24vkAmFEbg7V8glpVkZB/ckQZrTQYaaxmg34="}]},"_npmUser":{"name":"aadvik-teklabs","email":"info@aadviklabs.com"},"directories":{},"maintainers":[{"name":"aadvik-teklabs","email":"info@aadviklabs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dropbox-uploader_1.0.2_1783081448095_0.005990913351422211"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-03T11:41:17.936Z","modified":"2026-07-03T12:24:08.364Z","1.0.0":"2026-07-03T11:41:18.277Z","1.0.1":"2026-07-03T12:03:24.830Z","1.0.2":"2026-07-03T12:24:08.242Z"},"bugs":{"url":"https://github.com/AadvikLabs/npm-dropbox-uploder/issues"},"author":{"name":"Aadvik Labs"},"license":"MIT","homepage":"https://github.com/AadvikLabs/npm-dropbox-uploder#readme","keywords":["dropbox","box","upload","cloud-storage","express","multer"],"repository":{"type":"git","url":"git+https://github.com/AadvikLabs/npm-dropbox-uploder.git"},"description":"Cloud storage uploader with Express routes and service wrapper (currently backed by Box SDK)","maintainers":[{"name":"aadvik-teklabs","email":"info@aadviklabs.com"}],"readme":"# @aadvik-teklabs/dropbox-uploader\r\n\r\n[![npm version](https://img.shields.io/npm/v/@aadvik-teklabs/dropbox-uploader.svg)](https://www.npmjs.com/package/@aadvik-teklabs/dropbox-uploader)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\r\n\r\nA 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.\r\n\r\n> **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.\r\n\r\n---\r\n\r\n## ✨ Features\r\n\r\n- 📤 **Upload** files (Buffer) to a folder\r\n- 📋 **List** folder contents with metadata\r\n- 🔗 **Shared links** — generate public sharing URLs\r\n- 👁️ **Preview URLs** — get embed/preview links\r\n- 🗑️ **Delete** files\r\n- 🔁 **Automatic duplicate handling** — retries with timestamped filename on 409 conflicts\r\n- ♻️ **Persistent auth** — refresh tokens are auto-rotated and written back to `.env`\r\n- 🚏 **Drop-in Express router** — `/upload`, `/files`, `/download/:fileId`\r\n\r\n---\r\n\r\n## 📦 Installation\r\n\r\n```bash\r\nnpm install @aadvik-teklabs/dropbox-uploader\r\n```\r\n\r\n---\r\n\r\n## 🔧 Setup\r\n\r\n### 1. Create a Box Developer App\r\n\r\n1. Go to <https://app.box.com/developers/console> → **Create New App** → **Custom App** → **OAuth 2.0 (User Authentication)**.\r\n2. Enable the following scopes: Read/Write files, manage sharing links.\r\n3. Copy your **Client ID** and **Client Secret**.\r\n4. Generate a **Refresh Token** using the included `generate-token.js` helper (in the repo) or the Box OAuth playground.\r\n\r\n### 2. Create a `.env` file\r\n\r\n```env\r\nBOX_CLIENT_ID=your-client-id\r\nBOX_CLIENT_SECRET=your-client-secret\r\nBOX_REFRESH_TOKEN=your-refresh-token\r\n```\r\n\r\nThe refresh token will be **auto-updated** in this file whenever Box rotates it.\r\n\r\n---\r\n\r\n## 🚀 Usage\r\n\r\n### Programmatic API\r\n\r\n```js\r\nconst { boxService } = require('@aadvik-teklabs/dropbox-uploader');\r\nconst fs = require('fs');\r\n\r\nasync function main() {\r\n    const buffer = fs.readFileSync('./document.pdf');\r\n\r\n    // Upload\r\n    const file = await boxService.uploadFile(buffer, 'document.pdf');\r\n    console.log('Uploaded file ID:', file.id);\r\n\r\n    // Create a public sharing link\r\n    const shareUrl = await boxService.createSharingLink(file.id);\r\n    console.log('Share URL:', shareUrl);\r\n\r\n    // Get download URL\r\n    const downloadUrl = await boxService.getDownloadUrl(file.id);\r\n\r\n    // List files in root folder\r\n    const files = await boxService.listFiles('0');\r\n\r\n    // Preview link\r\n    const preview = await boxService.getFilePreview(file.id);\r\n\r\n    // Delete\r\n    await boxService.deleteFile(file.id);\r\n}\r\n\r\nmain().catch(console.error);\r\n```\r\n\r\n### Drop-in Express router\r\n\r\n```js\r\nconst express = require('express');\r\nconst { uploadRoutes } = require('@aadvik-teklabs/dropbox-uploader');\r\n\r\nconst app = express();\r\napp.use('/api', uploadRoutes);\r\n\r\napp.listen(3000, () => console.log('Server running on port 3000'));\r\n```\r\n\r\nExposed endpoints:\r\n\r\n| Method | Path | Description |\r\n|---|---|---|\r\n| POST | `/api/upload` | Upload a file (multipart field: `file`) |\r\n| GET  | `/api/files` | List files in root folder |\r\n| GET  | `/api/download/:fileId` | Redirect to a temporary download URL |\r\n\r\nExample `curl` upload:\r\n\r\n```bash\r\ncurl -X POST http://localhost:3000/api/upload -F \"file=@./photo.jpg\"\r\n```\r\n\r\n---\r\n\r\n## 📖 API Reference\r\n\r\n### `boxService.uploadFile(buffer, fileName, folderId?)`\r\nUploads a file buffer. Auto-renames with timestamp on duplicate name (HTTP 409).\r\n\r\n### `boxService.listFiles(folderId?)`\r\nReturns an array of `{ id, name, size, type, modifiedAt, sharedLink }`.\r\n\r\n### `boxService.createSharingLink(fileId)`\r\nReturns a public URL string.\r\n\r\n### `boxService.getDownloadUrl(fileId)`\r\nReturns a temporary direct-download URL string.\r\n\r\n### `boxService.getFilePreview(fileId)`\r\nReturns an expiring embed URL, or `null` if not available.\r\n\r\n### `boxService.deleteFile(fileId)`\r\nDeletes the file. Returns `true` on success.\r\n\r\n### `getBoxClient(refreshToken)`\r\nLow-level: returns a raw `box-node-sdk` persistent client if you need custom operations.\r\n\r\n---\r\n\r\n## 🔒 Security\r\n\r\n- Never commit `.env` to source control (it's auto-updated with refreshed tokens).\r\n- Rotate the Box refresh token if it may have been exposed.\r\n- Restrict Box app scopes to the minimum required.\r\n\r\n---\r\n\r\n## 📝 License\r\n\r\nMIT © [Aadvik Labs](https://github.com/AadvikLabs)\r\n\r\n## 🔗 Links\r\n\r\n- [GitHub Repository](https://github.com/AadvikLabs/npm-dropbox-uploder)\r\n- [Report Issues](https://github.com/AadvikLabs/npm-dropbox-uploder/issues)\r\n- [Box API Docs](https://developer.box.com/reference/)\r\n","readmeFilename":"README.md"}