tus-js-client
Advanced tools
Comparing version 4.2.1 to 4.2.2
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
var _nodeFs = require("node:fs"); | ||
var _fs = require("fs"); | ||
var _isStream = _interopRequireDefault(require("is-stream")); | ||
@@ -69,3 +69,3 @@ var _BufferSource = _interopRequireDefault(require("./sources/BufferSource.js")); | ||
} | ||
if (input instanceof _nodeFs.ReadStream && input.path != null) { | ||
if (input instanceof _fs.ReadStream && input.path != null) { | ||
return (0, _FileSource.default)(input); | ||
@@ -72,0 +72,0 @@ } |
@@ -7,5 +7,5 @@ "use strict"; | ||
exports.default = fingerprint; | ||
var _nodeCrypto = require("node:crypto"); | ||
var fs = _interopRequireWildcard(require("node:fs")); | ||
var path = _interopRequireWildcard(require("node:path")); | ||
var _crypto = require("crypto"); | ||
var fs = _interopRequireWildcard(require("fs")); | ||
var path = _interopRequireWildcard(require("path")); | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
@@ -24,3 +24,3 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
var content = file.slice(0, Math.min(blockSize, file.length)); | ||
var hash = (0, _nodeCrypto.createHash)('md5').update(content).digest('hex'); | ||
var hash = (0, _crypto.createHash)('md5').update(content).digest('hex'); | ||
var ret = ['node-buffer', hash, file.length, options.endpoint].join('-'); | ||
@@ -27,0 +27,0 @@ return Promise.resolve(ret); |
@@ -7,6 +7,6 @@ "use strict"; | ||
exports.default = void 0; | ||
var http = _interopRequireWildcard(require("node:http")); | ||
var https = _interopRequireWildcard(require("node:https")); | ||
var _nodeStream = require("node:stream"); | ||
var _nodeUrl = require("node:url"); | ||
var http = _interopRequireWildcard(require("http")); | ||
var https = _interopRequireWildcard(require("https")); | ||
var _stream = require("stream"); | ||
var _url = require("url"); | ||
var _lodash = _interopRequireDefault(require("lodash.throttle")); | ||
@@ -212,3 +212,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
return new Promise(function (resolve, reject) { | ||
var options = _objectSpread(_objectSpread(_objectSpread({}, (0, _nodeUrl.parse)(_this._url)), _this._requestOptions), {}, { | ||
var options = _objectSpread(_objectSpread(_objectSpread({}, (0, _url.parse)(_this._url)), _this._requestOptions), {}, { | ||
method: _this._method, | ||
@@ -236,3 +236,3 @@ headers: _objectSpread(_objectSpread({}, _this._requestOptions.headers || {}), _this._headers) | ||
}); | ||
if (body instanceof _nodeStream.Readable) { | ||
if (body instanceof _stream.Readable) { | ||
// Readable stream are piped through a PassThrough instance, which | ||
@@ -323,3 +323,3 @@ // counts the number of bytes passed through. This is used, for example, | ||
}]); | ||
}(_nodeStream.Transform); // writeBufferToStreamWithProgress writes chunks from `source` (either a | ||
}(_stream.Transform); // writeBufferToStreamWithProgress writes chunks from `source` (either a | ||
// Buffer or Uint8Array) to the readable stream `stream`. | ||
@@ -326,0 +326,0 @@ // The size of the chunk depends on the stream's highWaterMark to fill the |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.default = getFileSource; | ||
var _nodeFs = require("node:fs"); | ||
var _fs = require("fs"); | ||
function _typeof(o) { | ||
@@ -400,3 +400,3 @@ "@babel/helpers - typeof"; | ||
_context.next = 3; | ||
return _nodeFs.promises.stat(path); | ||
return _fs.promises.stat(path); | ||
case 3: | ||
@@ -444,3 +444,3 @@ _yield$fsPromises$sta = _context.sent; | ||
var offset = (_this$_stream$start = this._stream.start) !== null && _this$_stream$start !== void 0 ? _this$_stream$start : 0; | ||
var stream = (0, _nodeFs.createReadStream)(this._path, { | ||
var stream = (0, _fs.createReadStream)(this._path, { | ||
start: offset + start, | ||
@@ -447,0 +447,0 @@ // The `end` option for createReadStream is treated inclusively |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.canStoreURLs = exports.FileUrlStorage = void 0; | ||
var _nodeFs = require("node:fs"); | ||
var _fs = require("fs"); | ||
var _combineErrors = _interopRequireDefault(require("combine-errors")); | ||
@@ -195,3 +195,3 @@ var lockfile = _interopRequireWildcard(require("proper-lockfile")); | ||
}; | ||
(0, _nodeFs.writeFile)(this.path, JSON.stringify(data), opts, function (err) { | ||
(0, _fs.writeFile)(this.path, JSON.stringify(data), opts, function (err) { | ||
return cb(err); | ||
@@ -203,3 +203,3 @@ }); | ||
value: function _getData(cb) { | ||
(0, _nodeFs.readFile)(this.path, 'utf8', function (err, data) { | ||
(0, _fs.readFile)(this.path, 'utf8', function (err, data) { | ||
if (err) { | ||
@@ -206,0 +206,0 @@ // return empty data if file does not exist |
@@ -7,3 +7,3 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } | ||
import { ReadStream } from 'node:fs'; | ||
import { ReadStream } from 'fs'; | ||
import isStream from 'is-stream'; | ||
@@ -10,0 +10,0 @@ import BufferSource from './sources/BufferSource.js'; |
@@ -1,4 +0,4 @@ | ||
import { createHash } from 'node:crypto'; | ||
import * as fs from 'node:fs'; | ||
import * as path from 'node:path'; | ||
import { createHash } from 'crypto'; | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
@@ -5,0 +5,0 @@ /** |
@@ -19,6 +19,6 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } | ||
// but it is still included in Node.js | ||
import * as http from 'node:http'; | ||
import * as https from 'node:https'; | ||
import { Readable, Transform } from 'node:stream'; | ||
import { parse } from 'node:url'; | ||
import * as http from 'http'; | ||
import * as https from 'https'; | ||
import { Readable, Transform } from 'stream'; | ||
import { parse } from 'url'; | ||
import throttle from 'lodash.throttle'; | ||
@@ -25,0 +25,0 @@ var NodeHttpStack = /*#__PURE__*/function () { |
@@ -10,3 +10,3 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } | ||
import { createReadStream, promises as fsPromises } from 'node:fs'; | ||
import { createReadStream, promises as fsPromises } from 'fs'; | ||
export default function getFileSource(_x) { | ||
@@ -13,0 +13,0 @@ return _getFileSource.apply(this, arguments); |
@@ -7,3 +7,3 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } | ||
import { readFile, writeFile } from 'node:fs'; | ||
import { readFile, writeFile } from 'fs'; | ||
import combineErrors from 'combine-errors'; | ||
@@ -10,0 +10,0 @@ import * as lockfile from 'proper-lockfile'; |
@@ -1,2 +0,2 @@ | ||
import { ReadStream } from 'node:fs' | ||
import { ReadStream } from 'fs' | ||
import isStream from 'is-stream' | ||
@@ -3,0 +3,0 @@ |
@@ -1,4 +0,4 @@ | ||
import { createHash } from 'node:crypto' | ||
import * as fs from 'node:fs' | ||
import * as path from 'node:path' | ||
import { createHash } from 'crypto' | ||
import * as fs from 'fs' | ||
import * as path from 'path' | ||
@@ -5,0 +5,0 @@ /** |
// The url.parse method is superseeded by the url.URL constructor, | ||
// but it is still included in Node.js | ||
import * as http from 'node:http' | ||
import * as https from 'node:https' | ||
import { Readable, Transform } from 'node:stream' | ||
import { parse } from 'node:url' | ||
import * as http from 'http' | ||
import * as https from 'https' | ||
import { Readable, Transform } from 'stream' | ||
import { parse } from 'url' | ||
import throttle from 'lodash.throttle' | ||
@@ -8,0 +8,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { createReadStream, promises as fsPromises } from 'node:fs' | ||
import { createReadStream, promises as fsPromises } from 'fs' | ||
@@ -3,0 +3,0 @@ export default async function getFileSource(stream) { |
@@ -1,2 +0,2 @@ | ||
import { readFile, writeFile } from 'node:fs' | ||
import { readFile, writeFile } from 'fs' | ||
import combineErrors from 'combine-errors' | ||
@@ -3,0 +3,0 @@ import * as lockfile from 'proper-lockfile' |
{ | ||
"name": "tus-js-client", | ||
"version": "4.2.1", | ||
"version": "4.2.2", | ||
"description": "A pure JavaScript client for the tus resumable upload protocol", | ||
@@ -5,0 +5,0 @@ "main": "lib.es5/node/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2582003
16
6