UNPKG

ddivfs

Version:

ddivfs 📂🔒 - A Secure and Efficient File Upload Middleware for Node.js. ddivfs is a lightweight and highly secure file upload middleware designed for seamless file uploads with built-in security features and optimizations. Whether you're handling images,

30 lines (23 loc) • 739 B
const path = require('path'); const fs = require('fs'); class fsinfo { constructor(fileLocation) { this.fileLocation = fileLocation; // Correct assignment } displayFileInfo() { const location = this.fileLocation; return new Promise((resolve, reject) => { fs.stat(location, (error, state) => { if (error) { reject('Error:', error); } let fileInformation = { name: path.basename(location), size: state.size, }; resolve(fileInformation); }); }); } } module.exports = fsinfo;