title: Can I create S3 putObject presigned URLs with data stream?
body: <p>I know it is possible to create a presigned url by linking to an existing file on your system as seen in the code below, but is it also possible to create a presigned url directly from data content or a simple text (e.g. filename: test.txt, content: 'Hello world')? I tried but could not get it working.</p>
  
  <pre><code>function main() {
    const uploadFile = './image.jpg'; // File to upload
    const contentType = mime.lookup(uploadFile);
    const uploadedFilename = 'random file name'; // Name of uploaded file
    const params = buildUploadParams(BUCKET_NAME, UPLOAD_FOLDER + uploadedFilename, contentType, 120);
  
    const readFile = fs.readFileSync(uploadFile);
    const preSignedGetUrl = s3.getSignedUrl('putObject', params);
    console.log('Presigned URL: ' + preSignedGetUrl);
  }
  
  function buildUploadParams(bucket, key, contentType, expires) {
    return {
      Bucket: bucket,
      Key: key + '.jpg',
      ContentType: contentType,
      ACL: 'bucket-owner-full-control',
      Expires: expires
    }
  }
  </code></pre>