ajnavidya-file-upload-client

3.0.0 • Public • Published

File Uploader Client

This Package demonstrates a file upload mechanism that breaks files into smaller chunks for more efficient transfer and utilizes a progress bar to track the upload process.

How to Use

npm i file-upload-client

Import Into File

import Uploader from "file-upload-client";

Example

function Upload() {
  const [progress, setProgress] = useState(0);
  const [fileURL, setFileURL] = useState("");
  const getFileContext = (e) => {
    const a = Uploader({
      file: e,
      setProgress: setProgress,
      url: {
        apiOrigin: "http://localhost:3002",
        status: "/upload/status",
        upload: "/upload/files",
        complete: "/upload/complete",
      },
      setFileURL: setFileURL,
    });
  };
  console.log("progress", progress);
  console.log("fileURL", fileURL);

  return <input type="file" onChange={getFileContext} />;
}

Package Sidebar

Install

npm i ajnavidya-file-upload-client

Weekly Downloads

3

Version

3.0.0

License

ISC

Unpacked Size

10.5 kB

Total Files

3

Last publish

Collaborators

  • ajnavidyadeveloper