ajnavidya-file-upload-client
v3.0.0
Published
file upload package for react/next/electron js
Downloads
10
Maintainers
Readme
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} />;
}