Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

tus-js-client

Package Overview
Dependencies
Maintainers
2
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tus-js-client - npm Package Compare versions

Comparing version 3.0.1 to 3.1.0

6

lib.es5/browser/urlStorage.js

@@ -38,5 +38,9 @@ "use strict";

// Mode on Safari on iOS (see #49)
// If the key was not used before, we remove it from local storage again to
// not cause confusion where the entry came from.
var key = 'tusSupport';
localStorage.setItem(key, localStorage.getItem(key));
var originalValue = localStorage.getItem(key);
localStorage.setItem(key, originalValue);
if (originalValue === null) localStorage.removeItem(key);
} catch (e) {

@@ -43,0 +47,0 @@ // If we try to access localStorage inside a sandboxed iframe, a SecurityError

10

lib.es5/node/sources/FileSource.js

@@ -10,4 +10,2 @@ "use strict";

var _promises = require("fs/promises");
function _typeof(obj) {

@@ -444,3 +442,3 @@ "@babel/helpers - typeof";

var path, _yield$stat, size, start, end, actualSize;
var path, _yield$fsPromises$sta, size, start, end, actualSize;

@@ -453,7 +451,7 @@ return _regeneratorRuntime().wrap(function _callee$(_context) {

_context.next = 3;
return (0, _promises.stat)(path);
return _fs.promises.stat(path);
case 3:
_yield$stat = _context.sent;
size = _yield$stat.size; // The fs.ReadStream might be configured to not read from the beginning
_yield$fsPromises$sta = _context.sent;
size = _yield$fsPromises$sta.size; // The fs.ReadStream might be configured to not read from the beginning
// to the end, but instead from a slice in between. In this case, we consider

@@ -460,0 +458,0 @@ // that range to indicate the actual uploadable size.

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

onError: null,
_onUploadUrlAvailable: null,
onUploadUrlAvailable: null,
overridePatchMethod: false,

@@ -424,3 +424,3 @@ headers: {},

// them to the URL storage.
_onUploadUrlAvailable: function _onUploadUrlAvailable() {
onUploadUrlAvailable: function onUploadUrlAvailable() {
_this3._parallelUploadUrls[index] = upload.url; // Test if all uploads have received an URL

@@ -715,4 +715,4 @@

if (typeof _this6.options._onUploadUrlAvailable === 'function') {
_this6.options._onUploadUrlAvailable();
if (typeof _this6.options.onUploadUrlAvailable === 'function') {
_this6.options.onUploadUrlAvailable();
}

@@ -811,4 +811,4 @@

if (typeof _this7.options._onUploadUrlAvailable === 'function') {
_this7.options._onUploadUrlAvailable();
if (typeof _this7.options.onUploadUrlAvailable === 'function') {
_this7.options.onUploadUrlAvailable();
}

@@ -815,0 +815,0 @@

@@ -12,5 +12,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

// Mode on Safari on iOS (see #49)
// If the key was not used before, we remove it from local storage again to
// not cause confusion where the entry came from.
var key = 'tusSupport';
localStorage.setItem(key, localStorage.getItem(key));
var originalValue = localStorage.getItem(key);
localStorage.setItem(key, originalValue);
if (originalValue === null) localStorage.removeItem(key);
} catch (e) {

@@ -17,0 +21,0 @@ // If we try to access localStorage inside a sandboxed iframe, a SecurityError

@@ -15,4 +15,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

import { createReadStream } from 'fs';
import { stat } from 'fs/promises';
import { createReadStream, promises as fsPromises } from 'fs';
export default function getFileSource(_x) {

@@ -26,3 +25,3 @@ return _getFileSource.apply(this, arguments);

var path, _yield$stat, size, start, end, actualSize;
var path, _yield$fsPromises$sta, size, start, end, actualSize;

@@ -35,7 +34,7 @@ return _regeneratorRuntime().wrap(function _callee$(_context) {

_context.next = 3;
return stat(path);
return fsPromises.stat(path);
case 3:
_yield$stat = _context.sent;
size = _yield$stat.size;
_yield$fsPromises$sta = _context.sent;
size = _yield$fsPromises$sta.size;
// The fs.ReadStream might be configured to not read from the beginning

@@ -42,0 +41,0 @@ // to the end, but instead from a slice in between. In this case, we consider

@@ -40,3 +40,3 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

onError: null,
_onUploadUrlAvailable: null,
onUploadUrlAvailable: null,
overridePatchMethod: false,

@@ -307,3 +307,3 @@ headers: {},

// them to the URL storage.
_onUploadUrlAvailable: function _onUploadUrlAvailable() {
onUploadUrlAvailable: function onUploadUrlAvailable() {
_this3._parallelUploadUrls[index] = upload.url; // Test if all uploads have received an URL

@@ -598,4 +598,4 @@

if (typeof _this6.options._onUploadUrlAvailable === 'function') {
_this6.options._onUploadUrlAvailable();
if (typeof _this6.options.onUploadUrlAvailable === 'function') {
_this6.options.onUploadUrlAvailable();
}

@@ -694,4 +694,4 @@

if (typeof _this7.options._onUploadUrlAvailable === 'function') {
_this7.options._onUploadUrlAvailable();
if (typeof _this7.options.onUploadUrlAvailable === 'function') {
_this7.options.onUploadUrlAvailable();
}

@@ -698,0 +698,0 @@

@@ -7,4 +7,8 @@ let hasStorage = false

// Mode on Safari on iOS (see #49)
// If the key was not used before, we remove it from local storage again to
// not cause confusion where the entry came from.
const key = 'tusSupport'
localStorage.setItem(key, localStorage.getItem(key))
const originalValue = localStorage.getItem(key)
localStorage.setItem(key, originalValue)
if (originalValue === null) localStorage.removeItem(key)
} catch (e) {

@@ -11,0 +15,0 @@ // If we try to access localStorage inside a sandboxed iframe, a SecurityError

@@ -36,2 +36,3 @@ // Type definitions for tus-js-client

onShouldRetry?: ((error: (Error | DetailedError), retryAttempt: number, options: UploadOptions) => boolean) | null;
onUploadUrlAvailable?: (() => void) | null;

@@ -38,0 +39,0 @@ overridePatchMethod?: boolean;

@@ -1,7 +0,6 @@

import { createReadStream } from 'fs'
import { stat } from 'fs/promises'
import { createReadStream, promises as fsPromises } from 'fs'
export default async function getFileSource (stream) {
const path = stream.path.toString()
const { size } = await stat(path)
const { size } = await fsPromises.stat(path)

@@ -8,0 +7,0 @@ // The fs.ReadStream might be configured to not read from the beginning

@@ -15,7 +15,7 @@ import { Base64 } from 'js-base64'

onProgress : null,
onChunkComplete : null,
onSuccess : null,
onError : null,
_onUploadUrlAvailable: null,
onProgress : null,
onChunkComplete : null,
onSuccess : null,
onError : null,
onUploadUrlAvailable: null,

@@ -315,3 +315,3 @@ overridePatchMethod: false,

// them to the URL storage.
_onUploadUrlAvailable: () => {
onUploadUrlAvailable: () => {
this._parallelUploadUrls[index] = upload.url

@@ -573,4 +573,4 @@ // Test if all uploads have received an URL

if (typeof this.options._onUploadUrlAvailable === 'function') {
this.options._onUploadUrlAvailable()
if (typeof this.options.onUploadUrlAvailable === 'function') {
this.options.onUploadUrlAvailable()
}

@@ -653,4 +653,4 @@

if (typeof this.options._onUploadUrlAvailable === 'function') {
this.options._onUploadUrlAvailable()
if (typeof this.options.onUploadUrlAvailable === 'function') {
this.options.onUploadUrlAvailable()
}

@@ -657,0 +657,0 @@

{
"name": "tus-js-client",
"version": "3.0.1",
"version": "3.1.0",
"description": "A pure JavaScript client for the tus resumable upload protocol",

@@ -70,7 +70,7 @@ "main": "lib.es5/node/index.js",

"npm-run-all": "^4.1.5",
"puppeteer": "^17.1.3",
"puppeteer": "^19.0.0",
"regenerator-runtime": "^0.13.5",
"temp": "^0.9.4",
"throttle": "^1.0.3",
"tsd": "0.23.0",
"tsd": "0.25.0",
"uglify-js": "^3.9.2"

@@ -77,0 +77,0 @@ },

# tus-js-client
<img alt="Tus logo" src="https://github.com/tus/tus.io/blob/master/assets/img/tus1.png?raw=true" width="30%" align="right" />
<img alt="Tus logo" src="https://github.com/tus/tus.io/blob/main/assets/img/tus1.png?raw=true" width="30%" align="right" />

@@ -5,0 +5,0 @@ > **tus** is a protocol based on HTTP for *resumable file uploads*. Resumable

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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