- endpoint:
'/api/fileanalyse'
- response π
{
"name": "tweet-export-15978-1637590343.8907.png",
"type": "image/png",
"size": 522301
}
const fileDataSchema = new mongoose.Schema({
name: String,
type: String,
size: Number,
});
- multer: for handling file uploading.
Note: You can add more fields to the response. Check out the what multer does by attaching a file attr. to the request object.
- The file attr. is also an object w/ the following attributes/properties π
{
fieldname: 'upfile',
originalname: 'icon',
encoding: '7bit',
mimetype: 'image/png',
destination: 'uploads/',
filename: '2927e6dfdacfcec4eece9fec28865e84',
path: 'uploads/2927e6dfdacfcec4eece9fec28865e84',
size: 1332
}
Code on Clouds ββClick to expand!
- find the link to Replit: here