Gathering detailed insights and metrics for uni-blueimp-file-upload-expressjs
Gathering detailed insights and metrics for uni-blueimp-file-upload-expressjs
Gathering detailed insights and metrics for uni-blueimp-file-upload-expressjs
Gathering detailed insights and metrics for uni-blueimp-file-upload-expressjs
Express.js Module for jQuery blueimp file upload
npm install uni-blueimp-file-upload-expressjs
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
6 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Jul 13, 2016
Latest Version
0.1.1
Package Id
uni-blueimp-file-upload-expressjs@0.1.1
Size
9.07 kB
NPM Version
3.7.3
Node Version
5.9.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
5
1
The code was forked from blueimp-file-upload-expressjs to support the unique id name for the uploaded file, thnks to Arvind Ravulavaru.
Although this code was initially meant for educational purposes, enhancements were made. Users can additionally:
Setup an Express project and install the package.
1$ npm install uni-blueimp-file-upload-expressjs
Beginners can follow the tutorial for detailed instructions.
Unit tests can be run with Jasmine using npm test
or this command:
1$ jasmine-node specs/
1options = { 2 tmpDir: __dirname + '/tmp', // tmp dir to upload files to 3 uploadDir: __dirname + '/public/files', // actual location of the file 4 uploadUrl: '/files/', // end point for delete route 5 maxPostSize: 11000000000, // 11 GB 6 minFileSize: 1, 7 maxFileSize: 10000000000, // 10 GB 8 acceptFileTypes: /.+/i, 9 inlineFileTypes: /\.(gif|jpe?g|png)/i, 10 imageTypes: /\.(gif|jpe?g|png)/i, 11 copyImgAsThumb : true, // required 12 imageVersions :{ 13 maxWidth : 200, 14 maxHeight : 200 15 }, 16 accessControl: { 17 allowOrigin: '*', 18 allowMethods: 'OPTIONS, HEAD, GET, POST, PUT, DELETE', 19 allowHeaders: 'Content-Type, Content-Range, Content-Disposition' 20 }, 21 storage : { 22 type : 'local', // local or aws 23 aws : { 24 accessKeyId : 'xxxxxxxxxxxxxxxxx', // required if aws 25 secretAccessKey : 'xxxxxxxxxxxxxxxxxxxxxxx', // required if aws 26 region : 'us-west-2', //make sure you know the region, else leave this option out 27 bucketName : 'xxxxxxxxx' // required if aws 28 } 29 } 30}; 31
(refer tutorial)
1// config the uploader 2var options = { 3 tmpDir: __dirname + '/../public/uploaded/tmp', 4 uploadDir: __dirname + '/../public/uploaded/files', 5 uploadUrl: '/uploaded/files/', 6 maxPostSize: 11000000000, // 11 GB 7 minFileSize: 1, 8 maxFileSize: 10000000000, // 10 GB 9 acceptFileTypes: /.+/i, 10 // Files not matched by this regular expression force a download dialog, 11 // to prevent executing any scripts in the context of the service domain: 12 inlineFileTypes: /\.(gif|jpe?g|png)/i, 13 imageTypes: /\.(gif|jpe?g|png)/i, 14 copyImgAsThumb : true, // required 15 imageVersions :{ 16 maxWidth : 200, 17 maxHeight : 200 18 }, 19 accessControl: { 20 allowOrigin: '*', 21 allowMethods: 'OPTIONS, HEAD, GET, POST, PUT, DELETE', 22 allowHeaders: 'Content-Type, Content-Range, Content-Disposition' 23 }, 24 storage : { 25 type : 'aws', 26 aws : { 27 accessKeyId : 'xxxxxxxxxxxxxxxxx', 28 secretAccessKey : 'xxxxxxxxxxxxxxxxx', 29 region : 'us-east-1',//make sure you know the region, else leave this option out 30 bucketName : 'xxxxxxxxxxxxxxxxx' 31 } 32 } 33}; 34 35// init the uploader 36var uploader = require('uni-blueimp-file-upload-expressjs')(options); 37 38 39module.exports = function (router) { 40 router.get('/upload', function(req, res) { 41 uploader.get(req, res, function (obj) { 42 res.send(JSON.stringify(obj)); 43 }); 44 45 }); 46 47 router.post('/upload', function(req, res) { 48 uploader.post(req, res, function (obj, redirect, error) { 49 if(!error) 50 { 51 res.send(JSON.stringify(obj)); 52 } 53 }); 54 55 }); 56 57 // the path SHOULD match options.uploadUrl 58 router.delete('/uploaded/files/:name', function(req, res) { 59 uploader.delete(req, res, function (obj) { 60 res.send(JSON.stringify(obj)); 61 }); 62 63 }); 64 return router; 65}
Set the useSSL
option to true
to use the package with an HTTPS server.
1var express = require('express') 2var fs = require('fs') 3var https = require('https'); 4 5var app = express() 6 7// config the uploader 8var options = { 9 ... 10 useSSL: true 11 ... 12}; 13 14// init the uploader 15var uploader = require('uni-blueimp-file-upload-expressjs')(options); 16 17app.get('/upload', function(req, res) { 18 uploader.get(req, res, function (obj) { 19 res.send(JSON.stringify(obj)); 20}) 21 .post('/upload', // ... 22 .delete('/uploaded/files/:name', // ... 23 24// create the HTTPS server 25var app_key = fs.readFileSync('key.pem'); 26var app_cert = fs.readFileSync('cert.pem'); 27 28https.createServer({key: app_key, cert: app_cert}, app).listen(443); 29
To generate multiple thumbnails while uploading
1var options = { 2 tmpDir: __dirname + '/../public/uploaded/tmp', 3 uploadDir: __dirname + '/../public/uploaded/files', 4 uploadUrl: '/uploaded/files/', 5 copyImgAsThumb: true, // required 6 imageVersions: { 7 maxWidth: 200, 8 maxHeight: 200 9 }, 10 storage: { 11 type: 'local' 12 } 13};
copyImgAsThumb
needs to be set to true. imageVersions
, maxWidth
and maxHeight
will by default create a thumbnail
folder and place the specified width/height thumbnail in it.
Optionally, you can omit the maxHeight
. In this case, it will be resize proportionally to the specified width.
1imageVersions: { 2 maxWidth: 200 3 },
also
1imageVersions: { 2 maxWidth: 200, 3 maxHeight : 'auto' 4 },
PS : auto
value works only with height.
You can also specify multiple thumbnail generations like
1var options = { 2 tmpDir: __dirname + '/../public/uploaded/tmp', 3 uploadDir: __dirname + '/../public/uploaded/files', 4 uploadUrl: '/uploaded/files/', 5 copyImgAsThumb: true, 6 imageVersions: { 7 maxWidth: 200, 8 maxHeight: 'auto', 9 "large" : { 10 width : 600, 11 height : 600 12 }, 13 "medium" : { 14 width : 300, 15 height : 300 16 }, 17 "small" : { 18 width : 150, 19 height : 150 20 } 21 }, 22 storage: { 23 type: 'local' 24 } 25};
Changes and improvements are welcome! Feel free to fork and open a pull request.
winston
,uni-blueimp-file-upload-expressjs is licensed under the MIT licence.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/6 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More