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

@danielbug/upload-manager

v1.0.0

Published

Composant FileUpload + hook useFileUpload pour upload vers Backblaze B2 (API Railway)

Downloads

101

Readme

upload-manager-module

Module réutilisable : composant FileUpload + hook useFileUpload pour l’upload vers Backblaze B2 (API déployée sur Railway).

Pour l’utiliser distant / en ligne dans tes autres projets, il faut d’abord le publier sur npm (une fois). Voir PUBLISH-NPM.md.


Installation (depuis internet, après publication)

Une fois le package publié sur npm :

npm install @TON_USERNAME/upload-manager

Ou si tu as gardé le nom sans scope :

npm install upload-manager-module

Remplace TON_USERNAME par ton username npm (ex. @danielbug25/upload-manager). Le module est alors installé depuis npm (en ligne), pas depuis un chemin local.


Installation en local (avant ou sans publication)

Pour tester sans publier, depuis un autre projet sur ta machine :

npm install /chemin/vers/upload-manager/packages/upload-module

Dépendances requises dans le projet qui utilise le module

Le module déclare en peerDependencies :

  • react (>= 18)
  • react-dom (>= 18)
  • lucide-react
  • sonner

Donc dans ton autre projet :

npm install lucide-react sonner

Et afficher les toasts (ex. dans le layout) :

import { Toaster } from "sonner";
// ...
<Toaster richColors position="top-center" />

Variables d’environnement (projet qui utilise le module)

Dans ton autre projet, dans .env.local :

NEXT_PUBLIC_UPLOAD_API_URL=https://upload-manager-api-production.up.railway.app

(Sinon cette URL est déjà la valeur par défaut dans le module.)


Utilisation dans l’autre projet

Avec le composant FileUpload

"use client";

import { useState } from "react";
import { FileUpload, useFileUpload } from "upload-manager-module";  // ou "@ton-username/upload-manager"
import { Upload } from "lucide-react";

export function MaPage() {
  const [file, setFile] = useState<File | null>(null);
  const [fileUrl, setFileUrl] = useState<string | undefined>();
  const [fileKey, setFileKey] = useState<string | undefined>();

  return (
    <FileUpload
      onFileSelect={(selectedFile, url, fileName) => {
        setFile(selectedFile ?? null);
        setFileUrl(url);
        setFileKey(fileName); // clé B2 pour delete ou BDD
      }}
      selectedFile={file}
      selectedUrl={fileUrl}
      accept="image/*,.pdf"
      label="Fichier"
      description="Glissez ou cliquez pour choisir"
      icon={Upload}
      maxSize={5 * 1024 * 1024}
    />
  );
}

Avec le hook uniquement

import { useFileUpload } from "upload-manager-module";

function MonComposant() {
  const { handleFileSelectWithValidation, deleteFile } = useFileUpload();

  const handleChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
    const f = e.target.files?.[0];
    if (!f) return;
    const result = await handleFileSelectWithValidation(f, {
      maxSize: 5 * 1024 * 1024,
      accept: "image/*",
    });
    if (result) {
      console.log("URL:", result.url, "Clé:", result.fileName);
    }
  };

  return <input type="file" onChange={handleChange} accept="image/*" />;
}

Résumé

  1. Installer le module (local, Git ou npm).
  2. Installer les peer deps : lucide-react, sonner (et avoir React).
  3. Configurer NEXT_PUBLIC_UPLOAD_API_URL si besoin.
  4. Importer FileUpload et/ou useFileUpload depuis upload-manager-module et les utiliser comme ci‑dessus.

L’API backend est déjà en ligne ; le module ne fait qu’appeler cette API depuis ton projet.