dimah-s3v0.4.1

Download

Download hooks for native and fetch-based flows.

  • useDownload — native browser download (no progress)
  • useFetchDownloadfetch with progress and cancel

Browser download

"use client";

import { useDownload } from "@dimah-s3/react";

const { phase, download, presign } = useDownload();

await download("reports/2024.pdf", "Annual Report.pdf");

// URL only — previews, embeds, custom links
const result = await presign("images/photo.jpg");

Fetch download with progress

"use client";

import { useFetchDownload } from "@dimah-s3/react";

const { phase, progress, download, cancel } = useFetchDownload();

await download("file.zip");
// cancel() to abort

On this page