@rebalworks/transfer-react
v0.1.3
Published
React hooks for rebalTransfer uploads
Downloads
398
Maintainers
Readme
@rebalworks/transfer-react
React hooks for rebalTransfer uploads.
Use this package when a React or Next.js screen needs file upload state without building its own transfer orchestration.
Install
npm install @rebalworks/transfer-reactHooks
| Hook | Purpose |
| --- | --- |
| useTransferUpload | Starts an upload and exposes progress, completion, abort, and error state. |
| useStorageProfiles | Loads the storage profiles configured on the rebalTransfer server. |
Upload Example
'use client';
import { useTransferUpload } from '@rebalworks/transfer-react';
export function UploadField() {
const upload = useTransferUpload({
apiBase: 'https://transfer.example.com/api/v1/sessions',
storageProfile: 'google-drive-main',
});
return (
<>
<input
type="file"
onChange={(event) => {
const file = event.currentTarget.files?.[0];
if (file) upload.upload(file);
}}
/>
<progress value={upload.progress?.percent ?? 0} max={100} />
<button type="button" onClick={() => void upload.abort()}>
Cancel
</button>
</>
);
}Storage Profiles
import { useStorageProfiles } from '@rebalworks/transfer-react';
const { profiles, loading, error, reload } = useStorageProfiles({
apiRoot: 'https://transfer.example.com/api/v1',
});Package Contents
The npm package contains minified JavaScript, public TypeScript declarations, README, LICENSE, and package metadata only. It does not include source maps, test files, or original TypeScript sources.
License
Commercial/proprietary. See LICENSE.
