Skip to main content
Search...

Client

UploadClient configuration and plugin system.

The client layer is the public entry point. It normalizes configuration, wires plugins, and returns a stable store interface.

Create a Client

import { createUploadClient } from '@gentleduck/upload/core'
 
const client = createUploadClient({
  api,
  strategies,
  config: {
    maxConcurrentUploads: 3,
    autoStart: (purpose) => purpose === 'avatar',
  },
})
import { createUploadClient } from '@gentleduck/upload/core'
 
const client = createUploadClient({
  api,
  strategies,
  config: {
    maxConcurrentUploads: 3,
    autoStart: (purpose) => purpose === 'avatar',
  },
})

createUploadClient is a thin alias around createUploadStore to match the "Upload Query" mental model.

Config Defaults

All config fields are optional. Defaults are applied by resolveUploadConfig:

OptionDefaultDescription
maxConcurrentUploads3Maximum number of simultaneous uploads
progressThrottleMs100Minimum interval between progress updates
maxAttempts3Maximum retry attempts per upload
maxItems100Maximum number of items in the store

Plugins and Hooks

  • Plugins attach to dispatch, on, and getSnapshot.
  • Hooks can observe internal events for diagnostics.

Keep plugins read-only: do not mutate state directly.