Socket
Socket
Sign inDemoInstall

tus

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tus - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

21

lib/tus.js

@@ -125,5 +125,3 @@ var fs = require('fs'),

});
}).then(function() {
return offset;
});
}).return(offset);
}).then(function(offset) {

@@ -151,14 +149,15 @@ var stream = fs.createWriteStream(options.directory + "/" + id + ".bin", {

info.offset = byteOffset;
return writeFile(options.directory + "/" + id + ".info", JSON.stringify(info), "utf8").then(function() {
if (typeof options.complete === "function" && info.offset >= info.entityLength) {
options.complete(info, req, res);
}
});
return writeFile(options.directory + "/" + id + ".info", JSON.stringify(info), "utf8").return(info);
}
return Promise.resolve();
return Promise.resolve(info);
});
})
];
}).spread(function() {
res.send(200);
}).spread(function(promise, info) {
if (typeof options.complete === "function" && info.offset >= info.entityLength) {
req.upload = info;
options.complete(req, res);
} else {
res.send(200);
}
}).catch(BadRequest, function(err) {

@@ -165,0 +164,0 @@ res.send(400, err.message);

{
"name": "tus",
"version": "0.1.5",
"version": "0.1.6",
"description": "Node.js resumable upload middleware for express/connect",

@@ -5,0 +5,0 @@ "main": "lib/tus.js",

@@ -19,3 +19,3 @@ # node-tus

- **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 file metadata as an argument (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)

@@ -35,4 +35,5 @@

maxFileSize: 1024 * 1024 * 5 // 5 mb,
complete: function(fileMetadata) {
console.log("File uploaded with the following metadata:", fileMetadata);
complete: function(req, res) {
console.log("File uploaded with the following metadata:", req.upload);
res.send(200);
}

@@ -39,0 +40,0 @@ }));

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc