Checksums in tus-node-server

Hi,

I’ve noticed here that the checksum extension is not supported for the tus-node-server. Is there a reason for that?

Is there any other recommended way I might be able to get (or calculate) the checksum in the onUploadCreate callback?

For reference, I’m using the uppy dashboard with tus connected to the S3Store plugin.

Thanks

Anyone using checksums in Node.js?

Hi, this has not been implemented yet. You might be able to do this yourself if you are not setting a chunkSize on the client (so everything is done over one request), use the Creation with Upload extension, and read the entire body in onUploadCreate and try to verify it.

However I haven’t looked closely enough into the Checksum extension to know the edge cases with this approach rather than building it into the server itself.

Hi,

Thanks alot for your reply. I’m not sure about the phasing here and in the docs. Do I need to do anything to be able to use Creation with Upload extension, or does the tus-node-server implement it by default? I can’t see any example of how to use it.

For example, this is my init function:

const tusDatafileServer = new Server({
    path: '/upload',
    datastore: datafileS3Store,
    // callback provided by tus, gets called for each upload
    async onUploadCreate(req, res, upload) {
        return res;
    },
})

I’m not chunking anything and I’m not seeing any body in req, unless its called something else? req.headers seems to read fine.

Thanks

You can set it on the client and it will work in the server:

Then you should always have a body at the time of onUploadCreate. Maybe @marius knows if there are caveats to attempting this in a hook.

Thanks for this. I’m setting the flag in Uppy:

uppy.use(Tus, {
    endpoint: 'http://0.0.0.0:8181/upload/',
    uploadDataDuringCreation: true,
});

But still can’t see a body in req.

Setting uploadDataDuringCreation: true should be enough to cause tus-js-client to put the upload data in the POST request (instead of the PATCH request).