How to use custom S3 path in S3Store to store files from TUS?

I want to upload files to a custom path in S3 Bucket through TUS but I could not found any way to provide the custom path. I am just able to provide the bucket name only because of that all the files getting copied in the root of S3. I gone through the Github source code but could not found any relevant information.

Here is the snippet I am using from the example provided:

const Server = require('tus-node-server/lib/Server');
const S3Store = require('tus-node-server/lib/stores/S3Store');
const server = new Server();

server.datastore = new S3Store({
  path: '/tus-files',
  bucket: 'My_Bucket',
  accessKeyId: 'access',
  secretAccessKey: 'secret',
  region: 'region',
  partSize: 5 * 1024 * 1024, // each uploaded part will have ~5MB,  
});

The tus-node-server currently does not have an option to specify a path under with the file will be stored in S3. That being said, you can use the CopyObject method from the AWS S3 API to move the file to a new location with your custom path once the upload is complete.

If you want to contribute to tus-node-server, we are already eager to help!

Hey Marius. Thanks for responding. Does it available in Go implementation of Tus then?

Yes, tusd supports this! You can use the -s3-object-prefix flag for this: https://github.com/tus/tusd/blob/master/docs/usage-binary.md