1.1.11 • Published 5 years ago
ssv-file-upload
Licence
bankonly
Version
1.1.11
Deps
0
Size
11 kB
Vulns
0
Weekly
0
Register
====================
const file = require("ssv-file-upload");
app.use(file.ssv_file_upload);
// ENV
IMAGE_SIZE_ALLOW = 3000000; // bytes = 3MB
IMAGE_TYPE_ACCEPT = jpg, png, jpeg, mp4, mp3, mpeg, wave;
Get start ,image ,videos, files
====================
const path = "./../../img/"
// 1.
file.fileUpload({
file:req.files.img,// img body
path:path
});
// response = {data,code,message,status}
// 2.
file.fileUpload({
file:req.files.img,// img body
path:path,
fileType:"jpg",
originalName:true // if false file's name will be uuid v4
});
// 3.
file.fileUpload({
file:req.files.img,// img body
path:path,
fileType:"jpg",
resize:[800,500],// define your resize image
limit:3
});
| Param | type | desc |
|---|---|---|
| file | file as array or one file | file from form data |
| path | string | destination |
| fileType | string | define file's format |
| resize | array as number | resize image |
| limit | number | allow to upload by limit |
| originalName | boolean | use original name of file |
| removeSpace | boolean | remove space from file's name |
function can be use
uploadImageMany fileUpload remove imageValidate createDirIfNotExist resizeImage removeFile removeFileMany uploadImage