Socket
Socket
Sign inDemoInstall

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 2.1.1 to 2.2.0

3

build/src/index.d.ts

@@ -121,2 +121,3 @@ /**

authClient: GoogleAuth;
cacheKey: string;
generation?: number;

@@ -155,3 +156,3 @@ key?: string | Buffer;

private set;
private deleteConfig;
deleteConfig(): void;
/**

@@ -158,0 +159,0 @@ * @return {bool} is the request good?

@@ -36,2 +36,7 @@ "use strict";

this.bucket = cfg.bucket;
const cacheKeyElements = [cfg.bucket, cfg.file];
if (cfg.generation) {
cacheKeyElements.push(`${cfg.generation}`);
}
this.cacheKey = cacheKeyElements.join('/');
this.file = cfg.file;

@@ -328,3 +333,3 @@ this.generation = cfg.generation;

get(prop) {
const store = this.configStore.get([this.bucket, this.file].join('/'));
const store = this.configStore.get(this.cacheKey);
return store && store[prop];

@@ -334,6 +339,6 @@ }

set(props) {
this.configStore.set([this.bucket, this.file].join('/'), props);
this.configStore.set(this.cacheKey, props);
}
deleteConfig() {
this.configStore.delete([this.bucket, this.file].join('/'));
this.configStore.delete(this.cacheKey);
}

@@ -350,3 +355,3 @@ /**

else {
this.destroy(new Error('Retry limit exceeded'));
this.destroy(new Error('Retry limit exceeded - ' + resp.data));
}

@@ -363,3 +368,3 @@ return false;

else {
this.destroy(new Error('Retry limit exceeded'));
this.destroy(new Error('Retry limit exceeded - ' + resp.data));
}

@@ -366,0 +371,0 @@ return false;

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

## [2.2.0](https://www.github.com/googleapis/gcs-resumable-upload/compare/v2.1.1...v2.2.0) (2019-07-14)
### Bug Fixes
* **docs:** make anchors work in jsdoc ([#238](https://www.github.com/googleapis/gcs-resumable-upload/issues/238)) ([86e4433](https://www.github.com/googleapis/gcs-resumable-upload/commit/86e4433))
* expose 'Retry limit exceeded' server error message ([#240](https://www.github.com/googleapis/gcs-resumable-upload/issues/240)) ([40a1306](https://www.github.com/googleapis/gcs-resumable-upload/commit/40a1306))
* make cache key unique by including generation ([#243](https://www.github.com/googleapis/gcs-resumable-upload/issues/243)) ([85f80ab](https://www.github.com/googleapis/gcs-resumable-upload/commit/85f80ab))
### Features
* allow removing cache file ([#244](https://www.github.com/googleapis/gcs-resumable-upload/issues/244)) ([eb8976a](https://www.github.com/googleapis/gcs-resumable-upload/commit/eb8976a))
### [2.1.1](https://www.github.com/googleapis/gcs-resumable-upload/compare/v2.1.0...v2.1.1) (2019-06-20)

@@ -9,0 +23,0 @@

{
"name": "gcs-resumable-upload",
"version": "2.1.1",
"version": "2.2.0",
"description": "Upload a file to Google Cloud Storage with built-in resumable behavior",

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

"docs": "compodoc src/",
"docs-test": "linkinator docs -r",
"docs-test": "linkinator docs",
"predocs-test": "npm run docs"

@@ -61,2 +61,3 @@ },

"@types/pumpify": "^1.4.1",
"@types/sinon": "^7.0.10",
"assert-rejects": "^1.0.0",

@@ -68,6 +69,7 @@ "c8": "^5.0.1",

"is-stream": "^2.0.0",
"linkinator": "^1.1.2",
"linkinator": "^1.5.0",
"mocha": "^6.1.4",
"mockery": "^2.1.0",
"nock": "^10.0.0",
"sinon": "^7.3.2",
"source-map-support": "^0.5.6",

@@ -74,0 +76,0 @@ "typescript": "~3.5.0"

@@ -43,13 +43,40 @@ # gcs-resumable-upload

### {upload} = require('gcs-resumable-upload')
```js
const {gcsResumableUpload} = require('gcs-resumable-upload')
const upload = gcsResumableUpload(config)
```
`upload` is an instance of [`Duplexify`](http://gitnpm.com/duplexify).
---
<a name="methods"></a>
### Methods
#### upload(config)
#### upload.createURI(callback)
- Returns: [`Duplexify`](http://gitnpm.com/duplexify)
##### callback(err, resumableURI)
###### callback.err
- Type: `Error`
Invoked if the authorization failed or the request to start a resumable session failed.
###### callback.resumableURI
- Type: `String`
The resumable upload session URI.
#### upload.deleteConfig()
This will remove the config data associated with the provided file.
---
<a name="config"></a>
##### config
### Configuration
#### config
- Type: `object`

@@ -59,3 +86,3 @@

###### config.authClient
##### config.authClient

@@ -67,3 +94,3 @@ - Type: [`GoogleAuth`](http://gitnpm.com/google-auth-library)

###### config.authConfig
##### config.authConfig

@@ -75,3 +102,3 @@ - Type: `object`

###### config.bucket
##### config.bucket

@@ -83,3 +110,3 @@ - Type: `string`

###### config.configPath
##### config.configPath

@@ -91,3 +118,3 @@ - Type: `string`

###### config.file
##### config.file

@@ -99,3 +126,3 @@ - Type: `string`

###### config.generation
##### config.generation

@@ -107,3 +134,3 @@ - Type: `number`

###### config.key
##### config.key

@@ -115,3 +142,3 @@ - Type: `string|buffer`

###### config.kmsKeyName
##### config.kmsKeyName

@@ -123,3 +150,3 @@ - Type: `string`

###### config.metadata
##### config.metadata

@@ -139,3 +166,3 @@ - Type: `object`

###### config.offset
##### config.offset

@@ -147,3 +174,3 @@ - Type: `number`

###### config.origin
##### config.origin

@@ -155,3 +182,3 @@ - Type: `string`

###### config.predefinedAcl
##### config.predefinedAcl

@@ -172,3 +199,3 @@ - Type: `string`

###### config.private
##### config.private

@@ -180,3 +207,3 @@ - Type: `boolean`

###### config.public
##### config.public

@@ -188,3 +215,3 @@ - Type: `boolean`

###### config.uri
##### config.uri

@@ -196,3 +223,3 @@ - Type: `string`

###### config.userProject
##### config.userProject

@@ -204,10 +231,10 @@ - Type: `string`

--
---
<a name="events"></a>
### Events
#### Events
#### .on('error', function (err) {})
##### .on('error', function (err) {})
##### err
###### err
- Type: `Error`

@@ -217,5 +244,5 @@

##### .on('response', function (response) {})
#### .on('response', function (response) {})
###### resp
##### resp

@@ -226,3 +253,3 @@ - Type: `Object`

###### metadata
##### metadata

@@ -233,3 +260,3 @@ - Type: `Object`

##### .on('finish', function () {})
#### .on('finish', function () {})

@@ -239,4 +266,8 @@ The file was uploaded successfully.

---
<a name="static-methods"></a>
### Static Methods
### {createURI} = require('gcs-resumable-upload);
```js
const {createURI} = require('gcs-resumable-upload')
````

@@ -243,0 +274,0 @@ #### createURI([config](#config), callback)

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