I am getting this error while uploading file from postman.
(node:13648) [DEP0135] DeprecationWarning: ReadStream.prototype.open() is deprecated
My node version is 15.0. I'm using apollo-server-express. And this is my code
export const processUpload = async (file) => {
const {
createReadStream, mimetype, encoding, filename
} = await file;
const path = `uploads/${uuid()}${filename}`;
const stream = createReadStream();
return new Promise((resolve, reject) => {
stream
.pipe(fs.createWriteStream(path))
.on('finish', () => {
resolve({
success: true,
message: 'Successfully Uploaded',
mimetype,
filename,
encoding,
location: path
});
})
.on('error', (err) => {
console.log('Error Event Emitted', err);
});
});
};