Illustration for Resumable.js Configuration Options API reference

Configuration Options

Complete reference for all Resumable.js constructor options including target, chunkSize, simultaneousUploads, and more.

API·Updated 2025-11-12

Configuration Options

Every Resumable.js instance starts with a configuration object passed to the constructor. These options control where chunks go, how large they are, how many fly in parallel, what happens on failure, and how files get validated before they ever touch the network. This reference covers every available option with types, defaults, and practical notes on when to change them. For the full API surface, see the API hub.

Constructor Usage

var r = new Resumable({
  target: '/api/upload',
  chunkSize: 1 * 1024 * 1024,
  simultaneousUploads: 3,
  // ...additional options
});

Upload Target Options

OptionTypeDefaultDescription
targetstring'/'The endpoint that receives POST requests for each chunk. Can also be a function returning a string, evaluated per chunk — useful for signed URLs or rotating endpoints.
testTargetstring | nullnullThe endpoint for GET requests when testChunks is enabled. Defaults to the value of target if not set.
methodstring'multipart'Upload method. 'multipart' sends the chunk as a multipart form field. 'octet' sends raw binary in the request body.
uploadMethodstring'POST'HTTP method for chunk uploads. Override to 'PUT' for endpoints that expect it.
testMethodstring'GET'HTTP method for chunk existence checks when testChunks is true.

Chunk Behavior

OptionTypeDefaultDescription
chunkSizenumber1048576 (1 MB)Size of each chunk in bytes. Smaller chunks mean more HTTP requests but finer resume granularity. Larger chunks reduce overhead but increase the cost of a single retry. Finding the sweet spot depends on your users' typical connection speeds.
forceChunkSizebooleanfalseWhen true, forces every chunk (including the last one) to be exactly chunkSize bytes by padding. Rarely needed — most servers handle a smaller final chunk just fine.
simultaneousUploadsnumber3Number of chunks uploaded in parallel. Increasing this saturates bandwidth faster but may overwhelm servers or trigger rate limits. Three is a sensible default for most environments.
testChunksbooleantrueWhen true, sends a GET request for each chunk before uploading to check if it already exists on the server. This is the mechanism that enables resuming after interruption. Set to false if your server doesn't support chunk checks.
prioritizeFirstAndLastChunkbooleanfalseWhen true, the first and last chunks upload before the middle ones. Useful for media files where the server needs header and trailer data early for metadata extraction or validation.
preprocessfunction | nullnullA function called before each chunk upload. Receives the ResumableChunk object. Call chunk.preprocessFinished() when done. Use this for client-side encryption, compression, or custom headers per chunk.

Parameter Names

These control the form field names sent with each chunk request. Only change them if your server expects non-default parameter names.

OptionTypeDefaultDescription
fileParameterNamestring'file'The multipart form field name for the chunk data.
chunkNumberParameterNamestring'resumableChunkNumber'Parameter name for the current chunk index (1-based).
chunkSizeParameterNamestring'resumableChunkSize'Parameter name for the configured chunk size.
currentChunkSizeParameterNamestring'resumableCurrentChunkSize'Parameter name for the actual byte size of this specific chunk.
totalSizeParameterNamestring'resumableTotalSize'Parameter name for the total file size.
identifierParameterNamestring'resumableIdentifier'Parameter name for the unique file identifier.
fileNameParameterNamestring'resumableFilename'Parameter name for the original file name.
relativePathParameterNamestring'resumableRelativePath'Parameter name for the relative path (when uploading folder structures).
totalChunksParameterNamestring'resumableTotalChunks'Parameter name for the total number of chunks in the file.

Request Options

OptionTypeDefaultDescription
queryobject or functionempty objectAdditional query parameters or POST data sent with every chunk request. If a function, receives the file, chunk, and a boolean indicating whether it's a test request.
headersobject or functionempty objectAdditional HTTP headers sent with every chunk request. If a function, receives the file and chunk. Commonly used for authorization tokens.
withCredentialsbooleanfalseSets XMLHttpRequest.withCredentials to send cookies and auth headers in cross-origin requests. Required when your upload endpoint is on a different subdomain and uses cookie-based authentication.

Retry Configuration

OptionTypeDefaultDescription
maxChunkRetriesnumber0Number of times to retry a failed chunk before triggering the error event. Set to 2 or 3 for unstable networks. Zero means no retries.
chunkRetryIntervalnumber | nullnullMilliseconds to wait between retries. null retries immediately. A value like 5000 gives transient server errors time to resolve.
permanentErrorsarray[404, 415, 500, 501]HTTP status codes that should not be retried. If the server returns one of these, the chunk fails immediately regardless of maxChunkRetries. Remove 500 from this list if your server sometimes returns recoverable 500s.

File Validation

OptionTypeDefaultDescription
maxFilesnumber | undefinedundefinedMaximum number of files allowed in the queue. undefined means no limit.
maxFileSizenumber | undefinedundefinedMaximum file size in bytes. Files exceeding this are rejected via maxFileSizeErrorCallback.
minFileSizenumber | undefinedundefinedMinimum file size in bytes. Useful for rejecting empty or trivially small files.
fileTypearray[]Allowed file extensions (without dots), e.g. ['png', 'jpg', 'pdf']. An empty array allows all types. Checked against the file name extension, not the MIME type.
fileTypeErrorCallbackfunctiondefault handlerCalled when a file is rejected due to type mismatch. Receives file and errorCount.
maxFileSizeErrorCallbackfunctiondefault handlerCalled when a file exceeds maxFileSize. Receives file and errorCount.
minFileSizeErrorCallbackfunctiondefault handlerCalled when a file is smaller than minFileSize. Receives file and errorCount.

Advanced Options

OptionTypeDefaultDescription
throttleProgressCallbacksnumber0.5Minimum interval in seconds between fileProgress / progress event calls. Prevents excessive DOM updates during fast uploads. Set to 0 for real-time updates at the cost of more frequent repaints.
generateUniqueIdentifierfunction | nullnullCustom function to generate the unique identifier for each file. Receives the file object. The default identifier is size-filename. Override this when you need deterministic IDs for resume-after-refresh workflows or to avoid collisions.
maxFilesnumber | undefinedundefinedMaximum number of files that can be added to the queue.

Practical Defaults

For most applications uploading files under 100 MB on typical broadband connections, these defaults work well:

var r = new Resumable({
  target: '/api/upload',
  chunkSize: 2 * 1024 * 1024,   // 2 MB — good balance
  simultaneousUploads: 3,
  testChunks: true,
  maxChunkRetries: 2,
  chunkRetryInterval: 3000,
  permanentErrors: [400, 404, 415, 500, 501],
  withCredentials: false
});

For large file uploads (1 GB+), increase chunkSize to 5–10 MB and consider lowering simultaneousUploads to 2 to avoid saturating the connection. For mobile users on cellular networks, smaller chunks (512 KB) with higher maxChunkRetries gives a more resilient experience.

Configuration isn't set-and-forget — profile your real-world usage, then adjust.