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 (25 loc) • 975 B
JavaScript
const BufferManage = require('./src/fs');
const fsinfo = require('./src/fsinf');
class fileStream {
constructor(req, buffer,folderName) {
this.req = req;
this.buffer = buffer;
this.filepth = '';
this.folderName=folderName || 'ddiv'
}
async buffersend() {
if (this.req && this.buffer) {
const file = new BufferManage(this.req, this.buffer,this.folderName);
const fileinformation = await file.FunctionbufferManage(); // Ensure this returns the correct value
this.filepth = fileinformation.filepath;
return fileinformation; // Return the result
} else {
return { error: "Request or buffer is missing" };
}
}
async getFileInfo() {
const filein = new fsinfo(this.filepth);
return await filein.displayFileInfo(); // Correctly call the method to get file info
}
}
module.exports = fileStream;