Socket
Socket
Sign inDemoInstall

tus

Package Overview
Dependencies
1
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    tus

Node.js resumable upload middleware for express/connect


Version published
Weekly downloads
584
decreased by-2.83%
Maintainers
1
Install size
496 kB
Created
Weekly downloads
 

Readme

Source

node-tus

Build Status NPM Downloads NPM Version

Node.js resumable upload middleware for express/connect implementing the tus resumable upload protocol.

Installation

$ npm install tus

Usage

To attach the resumable upload middleware to express or connect, create an upload server by calling createServer passing it an options object. Available options are:

  • directory - String - Path where to upload the files (required)
  • maxFileSize - Number - Maximum file size for uploads, in bytes (optional)
  • complete - Function - Callback to inform when a file (all chunks) have been uploaded. Passes the request and response streams, with the metadata assigned to the upload property within the request. The response must be handled manually if a complete callback is used. (optional)
  • path - String - Override path to be returned for Location header when creating new files, for example if you proxy forward requests to a different host/path (optional)

Example:

var express = require("express"),
    upload = require("tus");

var app = express();
var port = 3000;

app.use("/files", upload.createServer({
    directory: __dirname + "/uploads",
    maxFileSize: 1024 * 1024 * 5 // 5 mb,
    complete: function(req, res, next) {
        console.log("File uploaded with the following metadata:", req.upload);
        res.send(200);
    }
}));

app.listen(port);

Running Tests

$ npm test

License

Licensed under the MIT license.

Keywords

FAQs

Last updated on 25 Jul 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc