I am using node 12 to run my application and I am using the fs.createReadStream() method to create a readable stream. The code is running fine in node 10. but in node 12 it gave me the following response:
Promise { _handler: Pending { consumers: undefined, receiver: undefined, handler: undefined, resolved: false } }
I am getting the following object for S3:
{ fieldName: 'asset', originalFilename: 'Screenshot_from_2021-03-25_15-51-33.png', path: '/tmp/YBXXvSKRTKbz7P1eV9jG0cbsF.png', headers: { 'content-disposition': 'form-data; name="asset"; filename="Screenshot_from_2021-03-25_15-51-33.png"', 'content-type': 'image/png' }, size: 223445 }
I am passing the following value to createReadStream like:
fs.createReadStream('/tmp/YBXXvSKRTKbz7P1eV9jG0cbsF.png')
so I am getting the above output. What is wrong here? is any change in node 12 for fs.createReadStream(). Kindly help me here.
sample Code
var fs = require('fs') var getDimension = async function (path) { let stream = fs.createReadStream(path) console.log("Stream:",stream) }
here in the path, I am sending path like: '/tmp/YBXXvSKRTKbz7P1eV9jG0cbsF.png'
but still, it gives me the above error. but the same code working fine in node 10.24.0 and giving an error in node 12.18.0.
https://stackoverflow.com/questions/66882378/node-12-fs-createreadstream-giving-pending-result March 31, 2021 at 01:53PM
没有评论:
发表评论