@blocklet/uploader
v0.3.14
Published
blocklet upload component
Readme
@blocklet/uploader
@blocklet/uploader is a package that integrates the uppy service to provide universal upload capability for blocklets. For more information about uppy, refer to the official documentation.
Package Structure
The package is composed of both frontend and backend components. The frontend code resides in the react folder.
Development
Install In Blocklet
# You can use npm / yarn
pnpm add @blocklet/uploaderInstall Dependencies
To install the required dependencies, run the following command:
pnpm iBuild Packages
To build the packages, execute the following command:
pnpm buildBuild, Watch, and Run Development Server
For building, watching changes, and running the development server, use the following command:
pnpm run devFrontend Example
import { lazy } from 'react';
// eslint-disable-next-line import/no-unresolved
const UploaderComponent = lazy(() => import('@blocklet/uploader').then((res) => ({ default: res.Uploader })));
<UploaderComponent
key="uploader"
ref={uploaderRef}
popup
onUploadFinish={(result) => {
prependUpload(result.data);
}}
plugins={['ImageEditor', 'Url', 'Webcam', canUseUnsplash && 'Unsplash'].filter(Boolean)}
coreProps={{
restrictions: {
allowedFileTypes,
maxFileSize,
},
}}
apiPathProps={{
uploader: '/api/uploads',
companion: '/api/companion',
disableMediaKitPrefix: false,
disableAutoPrefix: false,
disableMediaKitStatus: false,
}}
/>;License
This package is licensed under the MIT license.
