Home

Awesome

node-uploadx

npm version Build status commits since latest release

Resumable upload middleware for express and plain node.js. Server-side part of ngx-uploadx

✨ Features

🌩ī¸ Installation

All-In-One with cloud storage support:

npm install node-uploadx

Separate modules can also be used to save disk space and for faster installation process.:

♨ī¸ Usage

Express example:

const express = require('express');
const { uploadx } = require('@uploadx/core');

const app = express();

app.use(
  '/uploads',
  uploadx({
    directory: './files',
    maxUploadSize: '10GB',
    allowMIME: ['video/*'],
    onComplete: file => console.log('Upload complete: ', file)
  })
);

app.listen(3003);

Please navigate to the examples for more.

🛠ī¸ Options

Some available options: :

optiontypedefault valuedescription
directorystring"files"DiskStorage upload directory
bucketstring"node-uploadx"Storage bucket
pathstring"/files"Node http base path
allowMIMEstring[]["*\*"]Allowed MIME types
maxUploadSizestring|number"5TB"File size limit
metaStorageMetaStorageProvide custom meta storage
metaStorageConfigMetaStorageOptionsConfigure metafiles storage
maxMetadataSizestring|number"4MB"Metadata size limit
validationValidationUpload validation options
useRelativeLocationbooleanfalseUse relative urls
filenameFunctionFile naming function
userIdentifierUserIdentifierGet user identity
onCreateOnCreateCallback that is called when a new upload is created
onUpdateOnUpdateCallback that is called when an upload is updated
onCompleteOnCompleteCallback that is called when an upload is completed
onDeleteOnDeleteCallback that is called when an upload is cancelled
onErrorOnErrorCustomize error response
expirationExpirationOptionsConfiguring the cleanup of abandoned and completed uploads
loggerLoggerCustom logger injection
logLevelLogLevel"none"Set built-in logger severity level

Contributing

If you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are welcome!

License

MIT