tus is a protocol based on HTTP for resumable file uploads. Resumable means that an upload can be interrupted at any moment and can be resumed without re-uploading the previous data again. An interruption may happen willingly, if the user wants to pause, or bn accident in case of an network issue or server outage.
tus-node-server is an official implementation of the tus resumable upload protocol. The protocol specifies a flexible method to upload files to remote servers using HTTP. The special feature is the ability to pause and resume uploads at any moment allowing to continue seamlessly after e.g. network interruptions.
It is capable of accepting uploads with arbitrary sizes and storing them locally on disk, on Google Cloud Storage or on AWS S3 (or any other S3-compatible storage system). Due to its modularization and extensibility, support for nearly any other cloud provider could easily be added to tus-node-server
Important
Read the 2.0.0 announcement post: integrate in all meta-frameworks and JS runtimes.
When you want reliable, resumable uploads. Together with a client like tus-js-client or Uppy, you'll have a plug-and-play experience.
tus Node.js in particular makes sense if you want to host a Node.js server or integrate it into your existing one. You can also run tus Node.js in all meta frameworks (such as Next.js, Nuxt, React Router, SvelteKit, etc) and other Node.js compatible runtime environments (AWS Lambda, Cloudflare, Bun, Deno Deploy, etc).
There are also other mature servers, like tusd, tusdotnet, rustus, and many others.
A standalone server which stores files on disk.
Tip
Try it yourself in StackBlitz
import { Server } from "@tus/server";
import { FileStore } from "@tus/file-store";
const host = "127.0.0.1";
const port = 1080;
const server = new Server({
path: "/files",
datastore: new FileStore({ directory: "./files" }),
});
server.listen({ host, port });
A tus server integrated into your existing Node.js server. @tus/server
has no
dependencies so it can be integrated in any server-side framework. More examples can be
found in @tus/server
.
import fastify from "fastify";
import { Server } from "@tus/server";
import { FileStore } from "@tus/file-store";
const app = fastify({ logger: true });
const tusServer = new Server({
path: "/files",
datastore: new FileStore({ directory: "./files" }),
});
app.addContentTypeParser(
"application/offset+octet-stream",
(request, payload, done) => done(null)
);
app.all("/files", (req, res) => {
tusServer.handle(req.raw, res.raw);
});
app.all("/files/*", (req, res) => {
tusServer.handle(req.raw, res.raw);
});
app.listen(3000, (err) => {
if (err) {
app.log.error(err);
process.exit(1);
}
});
@tus/server
. The tus server. Standalone or integrate it into your Node.js server.@tus/file-store
. Store files on disk.@tus/s3-store
. Store files on AWS S3.@tus/gcs-store
. Store files on Google Cloud Storage.@tus/azure-store
. Store files on Azure.
The tus protocol supports optional extensions. Below is a table of the supported extensions.
Extension | file-store |
s3-store |
gcs-store |
azure-store |
---|---|---|---|---|
Creation | ✅ | ✅ | ✅ | ✅ |
Creation With Upload | ✅ | ✅ | ✅ | ✅ |
Expiration | ✅ | ✅ | ❌ | ❌ |
Checksum | ❌ | ❌ | ❌ | ❌ |
Termination | ✅ | ✅ | ❌ | ❌ |
Concatenation | ❌ | ❌ | ❌ | ❌ |
All packages are fully typed with TypeScript.
All packages require Node.js >=20.19.0.
See
contributing.md
.