npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@adonis-agora/media-react

v0.5.1

Published

React hook + headless uploader component and a framework-free browser upload client for @adonis-agora/media — resumable TUS, direct-S3 multipart, and proxy uploads. Part of the Agora ecosystem.

Downloads

2,897

Readme

@adonis-agora/media-react

React hook + headless uploader component and a framework-free browser upload client for @adonis-agora/media. It speaks the AdonisJS provider's actual upload contract across all three server strategies:

  • TUS resumablePOST/HEAD/PATCH/DELETE against uploads.resumable.routes.prefix (default /media/uploads/tus), Content-Type: application/offset+octet-stream, resumes from the server's Upload-Offset. The default strategy.
  • Direct-S3 multipartPOST /direct/initiate returns presigned part URLs; parts are PUT straight to S3 (ETags collected) and assembled via POST /direct/:uploadId/complete (uploads.routes.prefix, default /media/uploads).
  • Proxy — a single PUT /proxy streams the whole body through the app.

Install

npm i @adonis-agora/media-react react

react is an (optional) peer dependency — the ./client entry point is framework-free and needs no React.

useMediaUpload

import { useMediaUpload } from '@adonis-agora/media-react'

function Uploader() {
  const { upload, pause, resume, abort, status, progress } = useMediaUpload({ mode: 'tus' })

  return (
    <div>
      <input
        type="file"
        onChange={(e) => {
          const file = e.target.files?.[0]
          if (file) upload(file, { filename: file.name, contentType: file.type })
        }}
      />
      <progress value={progress} max={1} />
      <span>{status}</span>
    </div>
  )
}
  • mode: 'tus' (resumable, default) · 'direct' (presigned S3 multipart) · 'proxy'.
  • pause() / resume() — for tus, resume continues from the server offset; direct/proxy restart.
  • abort() — cancels and terminates the TUS session server-side.
  • direct/proxy require a key in the upload meta (resolve it server-side in real apps).

MediaUploader (headless-friendly component)

import { MediaUploader } from '@adonis-agora/media-react'

<MediaUploader mode="tus" accept="image/*" onUploaded={(r) => console.log(r)} />

// Fully headless:
<MediaUploader render={({ status, progress, selectFile }) => (/* your UI */)} />

The default markup is a file input + progress bar, themed through Agora design tokens (--agora-primary, --agora-primary-soft, --agora-ink) via overridable --agora-media-* CSS custom properties. Pass unstyled to drop the default stylesheet, or override any variable to retheme. No vendor branding.

createMediaUploadClient (framework-free)

import { createMediaUploadClient } from '@adonis-agora/media-react/client'

const client = createMediaUploadClient({ baseUrl: 'https://api.example.com' })
await client.uploadTus(file, { filename: 'a.png', contentType: 'image/png' })
await client.uploadDirect(file, { filename: 'a.png', key: 'u/1/a.png' })
await client.uploadProxy(file, { filename: 'a.png', key: 'u/1/a.png' })

Static headers and a fresh-per-request getHeaders() (for short-lived tokens) are merged into every app request; presigned S3 PUTs deliberately receive neither, so the SigV4 signature stays intact.