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

gcs-resumable-upload

Package Overview
Dependencies
Maintainers
6
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gcs-resumable-upload - npm Package Compare versions

Comparing version 3.3.1 to 3.4.0

4

build/src/index.d.ts

@@ -159,4 +159,8 @@ /*!

}
export interface GoogleInnerError {
reason?: string;
}
export interface ApiError extends Error {
code?: number;
errors?: GoogleInnerError[];
}

@@ -163,0 +167,0 @@ export declare class Upload extends Pumpify {

@@ -20,2 +20,3 @@ "use strict";

const streamEvents = require("stream-events");
const retry = require("async-retry");
const TERMINATED_UPLOAD_STATUS_CODE = 410;

@@ -98,3 +99,3 @@ const RESUMABLE_INCOMPLETE_STATUS_CODE = 308;

this.numBytesWritten = 0;
this.numRetries = 0;
this.numRetries = 0; //counter for number of retries currently executed
if (autoRetry && ((_b = cfg === null || cfg === void 0 ? void 0 : cfg.retryOptions) === null || _b === void 0 ? void 0 : _b.maxRetries) !== undefined) {

@@ -173,4 +174,34 @@ this.retryLimit = cfg.retryOptions.maxRetries;

}
const resp = await this.makeRequest(reqOpts);
const uri = resp.headers.location;
const uri = await retry(async (bail) => {
var _a, _b, _c, _d;
try {
const res = await this.makeRequest(reqOpts);
return res.headers.location;
}
catch (e) {
const apiError = {
code: (_a = e.response) === null || _a === void 0 ? void 0 : _a.status,
name: (_b = e.response) === null || _b === void 0 ? void 0 : _b.statusText,
message: (_c = e.response) === null || _c === void 0 ? void 0 : _c.statusText,
errors: [
{
reason: (_d = e.response) === null || _d === void 0 ? void 0 : _d.statusText,
},
],
};
if (this.retryLimit > 0 &&
this.retryableErrorFn &&
this.retryableErrorFn(apiError)) {
throw e;
}
else {
return bail(e);
}
}
}, {
retries: this.retryLimit,
factor: this.retryDelayMultiplier,
maxTimeout: this.maxRetryDelay * 1000,
maxRetryTime: this.maxRetryTotalTimeout * 1000,
});
this.uri = uri;

@@ -177,0 +208,0 @@ this.offset = 0;

@@ -7,2 +7,14 @@ # Changelog

## [3.4.0](https://www.github.com/googleapis/gcs-resumable-upload/compare/v3.3.1...v3.4.0) (2021-11-03)
### Features
* retry URI creation ([#475](https://www.github.com/googleapis/gcs-resumable-upload/issues/475)) ([e3d380f](https://www.github.com/googleapis/gcs-resumable-upload/commit/e3d380f892e75d95595fddac70fb9551700283e7))
### Bug Fixes
* throw informative error in the case that retries run out ([#477](https://www.github.com/googleapis/gcs-resumable-upload/issues/477)) ([4b3db66](https://www.github.com/googleapis/gcs-resumable-upload/commit/4b3db6651ae09e8c8abaa75720747e97cab79966))
### [3.3.1](https://www.github.com/googleapis/gcs-resumable-upload/compare/v3.3.0...v3.3.1) (2021-09-02)

@@ -9,0 +21,0 @@

6

package.json
{
"name": "gcs-resumable-upload",
"version": "3.3.1",
"version": "3.4.0",
"description": "Upload a file to Google Cloud Storage with built-in resumable behavior",

@@ -46,2 +46,3 @@ "repository": "googleapis/gcs-resumable-upload",

"abort-controller": "^3.0.0",
"async-retry": "^1.3.3",
"configstore": "^5.0.0",

@@ -56,2 +57,3 @@ "extend": "^3.0.2",

"@compodoc/compodoc": "^1.1.7",
"@types/async-retry": "^1.4.3",
"@types/configstore": "^5.0.0",

@@ -62,3 +64,3 @@ "@types/extend": "^3.0.1",

"@types/mockery": "^1.4.29",
"@types/node": "^14.0.0",
"@types/node": "^16.0.0",
"@types/pumpify": "^1.4.1",

@@ -65,0 +67,0 @@ "@types/sinon": "^10.0.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