Socket
Socket
Sign inDemoInstall

@tus/server

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tus/server - npm Package Compare versions

Comparing version 1.0.0-beta.3 to 1.0.0-beta.4

4

dist/constants.d.ts

@@ -32,2 +32,6 @@ export declare const REQUEST_METHODS: readonly ["POST", "HEAD", "PATCH", "OPTIONS", "DELETE"];

};
readonly INVALID_METADATA: {
readonly status_code: 400;
readonly body: "Upload-Metadata is invalid. It MUST consist of one or more comma-separated key-value pairs. The key and value MUST be separated by a space. The key MUST NOT contain spaces and commas and MUST NOT be empty. The key SHOULD be ASCII encoded and the value MUST be Base64 encoded. All keys MUST be unique";
};
readonly UNKNOWN_ERROR: {

@@ -34,0 +38,0 @@ readonly status_code: 500;

@@ -55,2 +55,6 @@ "use strict";

},
INVALID_METADATA: {
status_code: 400,
body: 'Upload-Metadata is invalid. It MUST consist of one or more comma-separated key-value pairs. The key and value MUST be separated by a space. The key MUST NOT contain spaces and commas and MUST NOT be empty. The key SHOULD be ASCII encoded and the value MUST be Base64 encoded. All keys MUST be unique',
},
UNKNOWN_ERROR: {

@@ -57,0 +61,0 @@ status_code: 500,

@@ -48,2 +48,9 @@ "use strict";

}
let metadata;
try {
metadata = models_1.Metadata.parse(upload_metadata);
}
catch (error) {
throw constants_1.ERRORS.INVALID_METADATA;
}
const upload = new models_1.Upload({

@@ -53,3 +60,3 @@ id,

offset: 0,
metadata: models_1.Metadata.parse(upload_metadata),
metadata,
});

@@ -56,0 +63,0 @@ if (this.options.onUploadCreate) {

2

dist/models/Metadata.d.ts
import { Upload } from './Upload';
export declare function validateKey(key: string): boolean;
export declare function validateValue(value: string): boolean;
export declare function parse(str?: string): Record<string, string | undefined>;
export declare function parse(str?: string): Record<string, string | null> | undefined;
export declare function stringify(metadata: NonNullable<Upload['metadata']>): string;

@@ -32,3 +32,3 @@ "use strict";

if (!str) {
return {};
return undefined;
}

@@ -41,5 +41,3 @@ for (const pair of str.split(',')) {

!(key in meta)) {
const decodedValue = value
? Buffer.from(value, 'base64').toString('utf8')
: undefined;
const decodedValue = value ? Buffer.from(value, 'base64').toString('utf8') : null;
meta[key] = decodedValue;

@@ -57,3 +55,3 @@ }

.map(([key, value]) => {
if (value === undefined) {
if (value === null) {
return key;

@@ -60,0 +58,0 @@ }

@@ -5,3 +5,3 @@ type TUpload = {

offset: number;
metadata?: Record<string, string | undefined | never>;
metadata?: Record<string, string | null>;
creation_date?: string;

@@ -8,0 +8,0 @@ };

{
"$schema": "https://json.schemastore.org/package.json",
"name": "@tus/server",
"version": "1.0.0-beta.3",
"version": "1.0.0-beta.4",
"description": "Tus resumable upload protocol in Node.js",

@@ -6,0 +6,0 @@ "main": "dist/index.js",

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