title: How to get direct URL to multipart file uploaded via Node.js
body: <p>I wish to post file to multipart form and upload it to Amazon S3 Bucket and return to user link to the file.</p>
  
  <pre class="lang-js prettyprint-override"><code>const express = require('express'),
      aws = require('aws-sdk'),
      bodyParser = require('body-parser'),
      multer = require('multer'),
      multerS3 = require('multer-s3');
  
  aws.config.update({
      secretAccessKey: 'secret',
      accessKeyId: 'secret',
      region: 'us-east-2'
  });
  
  const app = express(),
      s3 = new aws.S3();
  
  app.use(bodyParser.json());
  
  const upload = multer({
      storage: multerS3({
          s3: s3,
          bucket: 'some-name',
          key: (req, file, cb) =&gt; {
              console.log(file);
              cb(null, file.originalname); //use Date.now() for unique file keys
          }
      })
  });
  
  app.post('/upload', upload.array('file',1), (req, res, next) =&gt; {
      res.send("How to return File URL?");
  });
  
  app.listen(3000);
  </code></pre>
  
  <p>How can I have the direct URL to the file?</p>