Giter Club home page Giter Club logo

node-tus's Introduction

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.

node-tus's People

Contributors

jfgodoy avatar niklasvh avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

node-tus's Issues

Compatibility with tus 1.0

tus 1.0 is just around the corner. I would be pleased to see this implementation being updated to support the next version. Most updates are outside the core so only minimal changes are required to maintain comparability. You can find detailed information or get feedback at the according issue tus/tus-resumable-upload-protocol#57.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.