Registry / storage / restbox

restbox

JSON →
library4.0.1jsnpmunverified

RESTful CRUD middleware for Dropbox file operations: get, create, update, delete files and directories via HTTP. Current stable version is 4.0.1, updated November 2024. Built on Node.js >=18, uses Express-like middleware pattern. Provides sorting, ordering, hashing, and unzip capabilities. Lightweight alternative to full Dropbox SDK wrappers, focused on file system semantics over HTTP.

npm install restbox
INSTALL
IMPORT
SIG · RESTBOX
R
restbox
storagejavascriptv4.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const restbox = require('restbox')
import restbox from 'restbox'
CJS-only, no ESM export. Use require().
types
import type { RestboxOptions } from 'restbox'
Type definitions shipped, but import path may vary; check @types/restbox if missing.
no named export
const restbox = require('restbox')
const { restbox } = require('restbox')
Only default export exists.

Initializes Restbox with a Dropbox token, mounts on /dropbox prefix, and serves static files. Run with Node >=18.

const restbox = require('restbox'); const http = require('http'); const express = require('express'); const app = express(); const server = http.createServer(app); const port = 1337; const token = process.env.DROPBOX_TOKEN || ''; app.use(restbox({ token: token, prefix: '/dropbox', root: '/home/docs' })); app.use(express.static(__dirname)); server.listen(port, () => console.log(`Server running on port ${port}`));
Debug
Known issues
breakingEngine requires Node >=18. Older versions cause runtime errors.
fix
Upgrade Node to version 18 or later.
affects: >=4.0.0
deprecatedDropbox API v1 has been deprecated by Dropbox; ensure your token supports v2.
fix
Use an OAuth 2.0 token with scopes for files.metadata.read/write.
affects: all
gotchaPrefix must not conflict with other routes; Restbox will not check for collisions.
fix
Choose a unique prefix or mount in a sub-app to avoid conflicts.
affects: all
gotchaDELETE with 'files' query expects array in body; malformed JSON leads to silent failures.
fix
Send valid JSON array: ["file1.txt", "file2.txt"] in request body.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'restbox'
Module not installed or import path wrong.
fix
Run 'npm install restbox' and ensure no typo in the package name.
TypeError: restbox is not a function
Using named import instead of default import.
fix
Use const restbox = require('restbox') (CJS) or import restbox from 'restbox' (if ESM were supported, but not yet).
Dropbox API error: invalid access token
Token is missing, expired, or invalid for the requested scope.
fix
Generate a new token from Dropbox App Console with correct scopes.
Upgrade
Version history
4.0.1latest on npm
Audit
Dependencies
expressoptionalused as middleware in examples
Agent activity
26 hits · last 30 days
node
22
Amazon
1
Resources
restbox — npm install restbox · libregistry