Dropbox

Dropbox via the official SDK. Path-addressable, virtual keys map directly to Dropbox paths - no cache.

Installation

dropbox is an optional peer dependency of files-sdk - install alongside the SDK so the adapter's imports resolve at runtime.

npm install files-sdk dropbox

Dropbox via the official dropbox SDK. Path-addressable like OneDrive (/folder/file.txt), so virtual keys map directly to Dropbox paths - no virtual-key cache, no bookkeeping. Four auth shapes (pre-built client, static or dynamic access token, OAuth refresh token + app key, or env-var fallback) cover personal Dropbox, Dropbox Business, and team-space deployments.

import { Files } from "files-sdk";import { dropbox } from "files-sdk/dropbox";// OAuth2 refresh-token flow (recommended for server-side apps).// The adapter exchanges the refresh token at api.dropboxapi.com/oauth2/token// and caches the access token until ~60s before expiry.const files = new Files({  adapter: dropbox({    refreshToken: process.env.DROPBOX_REFRESH_TOKEN!,    appKey: process.env.DROPBOX_APP_KEY!,    appSecret: process.env.DROPBOX_APP_SECRET, // omit for PKCE public clients    rootFolderPath: "/Uploads",    // publicByDefault: true → upload() also creates a public shared link    //                       and url() returns it (rewritten to ?dl=1 for    //                       direct download).  }),});

Options

Limitations

signedUploadUrl() throws - Dropbox's filesGetTemporaryUploadLink returns a URL that expects POST with a raw body, which fits neither the SDK's PUT-with-headers nor POST-with-form-fields shape. Use upload() or drop to raw.filesGetTemporaryUploadLink(...) for client-side uploads. Direct upload() handles up to Dropbox's 150 MB single-call limit; larger bodies switch to filesUploadSession* (chunked, up to 350 GB). url() is capped at Dropbox's 4-hour temporary-link maximum - expiresIn above 14400 throws; use publicByDefault: true for permanent shared links. responseContentDisposition always throws - Dropbox temporary and shared links have no Content-Disposition override. User metadata and cacheControl on upload() throw - Dropbox files have no native arbitrary-metadata field; use raw with property_groups (requires a registered template) if you need it. Stream-mode download() fetches the temporary link rather than streaming through the SDK, since filesDownload buffers the full body.