@upflowi/transport-xhr
v0.2.1
Published
upflowi transport backed by XMLHttpRequest, for browser environments that need fine-grained upload progress via xhr.upload.onprogress.
Maintainers
Readme
@upflowi/transport-xhr
An UploadTransport for upflowi backed by XMLHttpRequest. Browser-only — use it when you need fine-grained, continuously-updating upload progress that the standard Fetch API cannot provide.
pnpm add @upflowi/core @upflowi/transport-xhrimport { createUploader } from "@upflowi/core";
import { createXhrTransport } from "@upflowi/transport-xhr";
const uploader = createUploader({
transport: createXhrTransport(),
});When to use this vs. @upflowi/transport-fetch
@upflowi/transport-xhr— browser-only. Reports upload progress viaxhr.upload'sprogressevent, giving smoother, more granular progress updates than Fetch can.@upflowi/transport-fetch— works in both browsers and Node.js 18+. Use it by default unless you specifically needtransport-xhr's progress granularity.
A non-2xx HTTP response is returned as a normal response object, not thrown — @upflowi/core decides what counts as a failure. Only network failures and aborts are thrown, as NetworkError and AbortError respectively.
Peer dependency
Requires @upflowi/core as a peer dependency — install both.
Documentation
See the monorepo README for full usage examples and AGENTS.md for the architecture.
