![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
formidable-upload
Advanced tools
Chainable file upload api for express using formidable.
$ npm install formidable-upload
var upload = require('formidable-upload');
// ..
upload()
.accept('image/jpeg')
.to(['public', 'images'])
.resize({
use: 'resize',
settings: {
width: 800,
quality: 80
}
})
.imguri()
.exec(req.files.displayImage, function(err, file) {
// further process file
});
After creating an Upload
object by calling upload()
the upload object exposes API methods
Restricts files accepted by upload to specified mime types. Mime types can be specified as strings, array of strings, regex or array of regex. In case match fails an err
object is passed to the exec
callback field accept
set to true.
Accept mp4, ogg and jpeg files in upload
accept(['audio/mp4', 'audio/ogg', 'image/jpeg'])
Accept only mp4
accept('audio/mp4')
Accept all image mime types
accept([/image*/])
Moves files from temp express upload location to the target location. The to
processor modifies file.path
and file.name
fields of the original express upload file to point to the moved upload file. to
will use any given file extension from the original file.name
. A target directory is expected as argument, in case an array of strings is passed this array will be joined via path.join
.
Moves uploaded files to public/images
to(['public', 'images'])
Moves uploaded files to public/images
to('public/images')
Allows uploaded files to be processed via Magickwand. See magickwand page for using magickwand. Magicwand supports resize
and thumbnail
methods. Please refer the magickwand page if you face any issue while installing the module.
Resize an uploaded image to width of 800 and quality of 80 maintaining the aspect ratio.
resize({
use: 'resize',
settings: {
width: 800,
quality: 80
}
})
Convert the uploaded image to data uri, sets req.files.userfile.data
with Base64 encoded data.
imguri()
Generic handler to pass custom transformation code in the processing chain. Functions passed to process
must have the signature
fn(file, cb)
Where file is the processed upload file and cb
is the callback.
Executes a processing chain. Processing chains are reusable and may be executed multiple times. In case the file is not part of the upload or is empty an err
is passed to the callback with a field noFile
set to true.
Instead of executing and managing upload file processing in your routes, express-upload can be used as middleware in express. Any processing errors (no file, file type not accepted,...) are stored in a err
property of the file to upload.
// Build an upload instance but don't execute it right now
var uploader = upload()
.accept('image/jpeg')
.to(['public', 'images'])
.resize({
use: 'resize',
settings: {
width: 800,
quality: 80
}
})
.imguri();
// Define a middleware for handling image upload
app.post('/upload', uploader.middleware('userfile'), routes.upload);
In case an error would occur when uploading the next middleware will be called with the error.
FAQs
Chainable file upload api for express using formidable
The npm package formidable-upload receives a total of 0 weekly downloads. As such, formidable-upload popularity was classified as not popular.
We found that formidable-upload demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.