$ show dropbox/dropbox-sdk-js
The Dropbox SDK for JavaScript (dropbox-sdk-js) is a lightweight, promise-based client library that provides a programmatic interface to the Dropbox v2 API. It supports both Node.js and browser environments, with full OAuth 2.0/PKCE authentication, file upload and download with resumable and parallel streaming, exponential backoff retries, progress reporting, and content hash validation. The library is auto-generated from Dropbox's API specification (Stone) and exposes hundreds of endpoint methods covering files, sharing, team management, users, and more. It is designed for production use with robust error handling, rate-limit awareness, and environment-aware binary types. The codebase demonstrates strong architectural separation of concerns: authentication logic is encapsulated in `DropboxAuth`, file transfer logic in dedicated uploader/downloader classes, and API request routing in generated route definitions. The SDK is well-tested with unit, integration, and TypeScript type tests, and includes comprehensive examples for both browser and Node.js usage patterns.
The LLM identified 4 files worth highlighting for reuse:
DropboxAuth class – provides OAuth 2.0 authorization code flow, PKCE support, token refresh, and access token management. Implements secure PKCE code verifier and challenge generation, supports custom fetch and storage, and is fully self-contained with no tight coupling to the main Dropbox class. Reusable in any OAuth 2.0 client application.
DropboxFileDownloader class and downloadFile helper – handles large file downloads with resumable range requests, parallel range fetching, content hash validation, exponential backoff, and `.part` file renaming. Implements `AbortSignal` support and progress callbacks. Designed to be extracted for any resumable download scenario.
DropboxFileUploader class – manages chunked uploads with configurable chunk size, parallel upload sessions, automatic retries with exponential backoff, and progress reporting. Supports `AbortSignal` cancellation and handles edge cases like session expiry. A clean, reusable pattern for uploads with streaming.
Dropbox content hash computation – implements the block-based SHA-256 hashing algorithm used by Dropbox for upload/download integrity. Provides dual implementations: one for Node.js (using the `crypto` module) and one for browsers (using the Web Crypto API). Isolated, well-documented, and directly reusable in any project needing Dropbox-compatible content checksums.