JSPM

multiple-files-loader

0.1.3
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 1
    • Score
      100M100P100Q40047F

    file loader test

    Package Exports

    • multiple-files-loader

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (multiple-files-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Multiple Files Loader

    Ready to use uploader component

    Features

    • Multiple or single file loader
    • Return array of attached files for working on
    • Uploading files animation

    Installation

    npm i multiple-files-loader

    Using

    • Component
    <FileUploader
        files={files}
        onRemoveFile={handleRemoveFile}
        onSelectFiles={handleSelectFile}
    />
    • Example of outer functions
    const [files, setFiles] = useState([]);
    
      const handleSelectFile = (filesArr) => {
        const objArr = filesArr.map((file) => {
          return {
            name: file.name,
            size: file.size,
            type: file.type,
            url: "https://file.com/file.pdf",
            loading: false
          };
        });
        setFiles(objArr);
      };
    
      const handleRemoveFile = (fileName) => {
        setFiles(files.filter((file) => file.name !== fileName));
      };