title: How to get file size before upload on s3 bucket in nodeJs + sequelize+graphql?
body: <p>Validate file size before upload on s3 bucket.currently use this code for get file size:</p>
  
  <pre class="lang-js prettyprint-override"><code>const {
    createReadStream,
    filename
  } = await file
  const stream = await createReadStream()
  let chunk = [];
  let conLength;
  stream.on('data', data =&gt; chunk.push(data))
    .on('end', () =&gt; {
      const buffer = Buffer.concat(chunk);
      conLength = buffer.length;
    });
  console.log(conLength)
  const url = await uploadToS3(stream, filename)
  assetRequestUrls.push(url)
  </code></pre>
  
  <p>But file size get in conLength variable that use only in function not used outside function. So, please help me.</p>