packages/@uppy/companion/src/server/controllers/s3.js
function signPartUpload (req, res, next) {
    // @ts-ignore The `uppy` property is added by middleware before reaching here.
    const client = req.uppy.s3Client
    const { uploadId, partNumber } = req.params
    const { key } = req.query

    if (typeof key !== 'string') {
      return res.status(400).json({ error: 's3: the object key must be passed as a query parameter. For example: "?key=abc.jpg"' })
    }
    if (!parseInt(partNumber, 10)) {
      return res.status(400).json({ error: 's3: the part number must be a number between 1 and 10000.' })
    }

    client.getSignedUrl('uploadPart', {
      Bucket: config.bucket,
      Key: key,
      UploadId: uploadId,
      PartNumber: partNumber,
      Body: '',
      Expires: ms('5 minutes') / 1000
    }, (err, url) => {
      if (err) {
        next(err)
        return
      }
      res.json({ url })
    })
  }
function signPartUpload (req, res, next) {
    // @ts-ignore The `uppy` property is added by middleware before reaching here.
    const client = req.uppy.s3Client
    const { uploadId, partNumber } = req.params
    const { key } = req.query

    if (typeof key !== 'string') {
      return res.status(400).json({ error: 's3: the object key must be passed as a query parameter. For example: "?key=abc.jpg"' })
    }
    if (!parseInt(partNumber, 10)) {
      return res.status(400).json({ error: 's3: the part number must be a number between 1 and 10000.' })
    }

    client.getSignedUrl('uploadPart', {
      Bucket: config.bucket,
      Key: key,
      UploadId: uploadId,
      PartNumber: partNumber,
      Body: '',
      Expires: ms('5 minutes') / 1000
    }, (err, url) => {
      if (err) {
        next(err)
        return
      }
      res.json({ url })
    })
  }
function signPartUpload ( req , res , next ) { // @ts-ignore The `uppy` property is added by middleware before reaching here. const client = req . uppy . s3Client const { uploadId , partNumber } = req . params const { key } = req . query if ( typeof key !== 'string' ) { return res . status ( 400 ) . json ( { error : 's3: the object key must be passed as a query parameter. For example: "?key=abc.jpg"' } ) } if ( ! parseInt ( partNumber , 10 ) ) { return res . status ( 400 ) . json ( { error : 's3: the part number must be a number between 1 and 10000.' } ) } client . getSignedUrl ( 'uploadPart' , { Bucket : config . bucket , Key : key , UploadId : uploadId , PartNumber : partNumber , Body : '' , Expires : ms ( '5 minutes' ) / 1000 } , ( err , url ) => { if ( err ) { next ( err ) return } res . json ( { url } ) } ) }
Get parameters for uploading one part.

Expected URL parameters:
- uploadId - The uploadId returned from `createMultipartUpload`.
- partNumber - This part's index in the file (1-10000).
Expected query parameters:
- key - The object key in the S3 bucket.
Response JSON:
- url - The URL to upload to, including signed query parameters.
Get parameters for uploading one part .