New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@aws-sdk/lib-storage

Package Overview
Dependencies
Maintainers
5
Versions
465
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/lib-storage - npm Package Compare versions

Comparing version 3.85.0 to 3.86.0

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [3.86.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.85.0...v3.86.0) (2022-05-06)
### Bug Fixes
* **lib-storage:** add missing return keys ([#2700](https://github.com/aws/aws-sdk-js-v3/issues/2700)) ([cbab94e](https://github.com/aws/aws-sdk-js-v3/commit/cbab94e901aec4650ab9e0eb19a4515e44d4ba62))
# [3.85.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.84.0...v3.85.0) (2022-05-05)

@@ -8,0 +19,0 @@

25

dist-cjs/Upload.js

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

const client_s3_1 = require("@aws-sdk/client-s3");
const smithy_client_1 = require("@aws-sdk/smithy-client");
const events_1 = require("events");

@@ -41,3 +42,3 @@ const bytelength_1 = require("./bytelength");

this.uploadEvent = event;
super.on(event, listener);
return super.on(event, listener);
}

@@ -47,4 +48,20 @@ async __uploadUsingPut(dataPart) {

const params = { ...this.params, Body: dataPart.data };
const putResult = await this.client.send(new client_s3_1.PutObjectCommand(params));
this.putResponse = putResult;
const [putResult, endpoint] = await Promise.all([
this.client.send(new client_s3_1.PutObjectCommand(params)),
this.client.config.endpoint(),
]);
const locationKey = this.params
.Key.split("/")
.map((segment) => (0, smithy_client_1.extendedEncodeURIComponent)(segment))
.join("/");
const locationBucket = (0, smithy_client_1.extendedEncodeURIComponent)(this.params.Bucket);
const Location = this.client.config.forcePathStyle
? `${endpoint.protocol}//${endpoint.hostname}/${locationBucket}/${locationKey}`
: `${endpoint.protocol}//${locationBucket}.${endpoint.hostname}/${locationKey}`;
this.singleUploadResult = {
...putResult,
Bucket: this.params.Bucket,
Key: this.params.Key,
Location,
};
const totalSize = (0, bytelength_1.byteLength)(dataPart.data);

@@ -145,3 +162,3 @@ this.__notifyProgress({

else {
result = this.putResponse;
result = this.singleUploadResult;
}

@@ -148,0 +165,0 @@ if (this.tags.length) {

30

dist-es/Upload.js

@@ -1,4 +0,5 @@

import { __assign, __asyncValues, __awaiter, __extends, __generator } from "tslib";
import { __assign, __asyncValues, __awaiter, __extends, __generator, __read } from "tslib";
import { AbortController } from "@aws-sdk/abort-controller";
import { CompleteMultipartUploadCommand, CreateMultipartUploadCommand, PutObjectCommand, PutObjectTaggingCommand, UploadPartCommand, } from "@aws-sdk/client-s3";
import { extendedEncodeURIComponent } from "@aws-sdk/smithy-client";
import { EventEmitter } from "events";

@@ -52,16 +53,27 @@ import { byteLength } from "./bytelength";

this.uploadEvent = event;
_super.prototype.on.call(this, event, listener);
return _super.prototype.on.call(this, event, listener);
};
Upload.prototype.__uploadUsingPut = function (dataPart) {
return __awaiter(this, void 0, void 0, function () {
var params, putResult, totalSize;
return __generator(this, function (_a) {
switch (_a.label) {
var params, _a, putResult, endpoint, locationKey, locationBucket, Location, totalSize;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
this.isMultiPart = false;
params = __assign(__assign({}, this.params), { Body: dataPart.data });
return [4, this.client.send(new PutObjectCommand(params))];
return [4, Promise.all([
this.client.send(new PutObjectCommand(params)),
this.client.config.endpoint(),
])];
case 1:
putResult = _a.sent();
this.putResponse = putResult;
_a = __read.apply(void 0, [_b.sent(), 2]), putResult = _a[0], endpoint = _a[1];
locationKey = this.params
.Key.split("/")
.map(function (segment) { return extendedEncodeURIComponent(segment); })
.join("/");
locationBucket = extendedEncodeURIComponent(this.params.Bucket);
Location = this.client.config.forcePathStyle
? "".concat(endpoint.protocol, "//").concat(endpoint.hostname, "/").concat(locationBucket, "/").concat(locationKey)
: "".concat(endpoint.protocol, "//").concat(locationBucket, ".").concat(endpoint.hostname, "/").concat(locationKey);
this.singleUploadResult = __assign(__assign({}, putResult), { Bucket: this.params.Bucket, Key: this.params.Key, Location: Location });
totalSize = byteLength(dataPart.data);

@@ -210,3 +222,3 @@ this.__notifyProgress({

case 3:
result = this.putResponse;
result = this.singleUploadResult;
_a.label = 4;

@@ -213,0 +225,0 @@ case 4:

@@ -10,2 +10,3 @@ import { PutObjectCommandInput, S3Client, Tag } from "@aws-sdk/client-s3";

export declare type BodyDataTypes = PutObjectCommandInput["Body"];
export declare type ServiceClients = S3Client;

@@ -26,3 +27,3 @@ export interface Configuration {

client: ServiceClients;
client: S3Client;
}
import { AbortSignal } from "@aws-sdk/abort-controller";
import { ServiceOutputTypes } from "@aws-sdk/client-s3";
import { AbortMultipartUploadCommandOutput, CompleteMultipartUploadCommandOutput } from "@aws-sdk/client-s3";
import { EventEmitter } from "events";

@@ -29,14 +28,14 @@ import { BodyDataTypes, Options, Progress } from "./types";

private isMultiPart;
private putResponse?;
private singleUploadResult?;
constructor(options: Options);
abort(): Promise<void>;
done(): Promise<ServiceOutputTypes>;
on(event: "httpUploadProgress", listener: (progress: Progress) => void): any;
__uploadUsingPut(dataPart: RawDataPart): Promise<void>;
__createMultipartUpload(): Promise<void>;
__doConcurrentUpload(dataFeeder: AsyncGenerator<RawDataPart, void, undefined>): Promise<void>;
__doMultipartUpload(): Promise<ServiceOutputTypes>;
__notifyProgress(progress: Progress): void;
__abortTimeout(abortSignal: AbortSignal): Promise<ServiceOutputTypes>;
__validateInput(): void;
done(): Promise<CompleteMultipartUploadCommandOutput | AbortMultipartUploadCommandOutput>;
on(event: "httpUploadProgress", listener: (progress: Progress) => void): this;
private __uploadUsingPut;
private __createMultipartUpload;
private __doConcurrentUpload;
private __doMultipartUpload;
private __notifyProgress;
private __abortTimeout;
private __validateInput;
}

@@ -10,2 +10,5 @@ import { PutObjectCommandInput, S3Client, Tag } from "@aws-sdk/client-s3";

export declare type BodyDataTypes = PutObjectCommandInput["Body"];
/**
* @deprecated redundant, use {@link S3Client} directly.
*/
export declare type ServiceClients = S3Client;

@@ -43,3 +46,3 @@ export interface Configuration {

*/
client: ServiceClients;
client: S3Client;
}
/// <reference types="node" />
import { AbortSignal } from "@aws-sdk/abort-controller";
import { ServiceOutputTypes } from "@aws-sdk/client-s3";
import { AbortMultipartUploadCommandOutput, CompleteMultipartUploadCommandOutput } from "@aws-sdk/client-s3";
import { EventEmitter } from "events";

@@ -31,14 +30,14 @@ import { BodyDataTypes, Options, Progress } from "./types";

private isMultiPart;
private putResponse?;
private singleUploadResult?;
constructor(options: Options);
abort(): Promise<void>;
done(): Promise<ServiceOutputTypes>;
on(event: "httpUploadProgress", listener: (progress: Progress) => void): any;
__uploadUsingPut(dataPart: RawDataPart): Promise<void>;
__createMultipartUpload(): Promise<void>;
__doConcurrentUpload(dataFeeder: AsyncGenerator<RawDataPart, void, undefined>): Promise<void>;
__doMultipartUpload(): Promise<ServiceOutputTypes>;
__notifyProgress(progress: Progress): void;
__abortTimeout(abortSignal: AbortSignal): Promise<ServiceOutputTypes>;
__validateInput(): void;
done(): Promise<CompleteMultipartUploadCommandOutput | AbortMultipartUploadCommandOutput>;
on(event: "httpUploadProgress", listener: (progress: Progress) => void): this;
private __uploadUsingPut;
private __createMultipartUpload;
private __doConcurrentUpload;
private __doMultipartUpload;
private __notifyProgress;
private __abortTimeout;
private __validateInput;
}
{
"name": "@aws-sdk/lib-storage",
"version": "3.85.0",
"version": "3.86.0",
"description": "Storage higher order operation",

@@ -37,3 +37,3 @@ "main": "./dist-cjs/index.js",

"@aws-sdk/abort-controller": "3.78.0",
"@aws-sdk/client-s3": "3.85.0",
"@aws-sdk/client-s3": "3.86.0",
"@tsconfig/recommended": "1.0.1",

@@ -40,0 +40,0 @@ "@types/node": "^14.11.2",

@@ -11,24 +11,26 @@ # @aws-sdk/lib-storage

```js
import { Upload } from "@aws-sdk/lib-storage";
import { S3Client, S3 } from "@aws-sdk/client-s3";
import { Upload } from "@aws-sdk/lib-storage";
import { S3Client, S3 } from "@aws-sdk/client-s3";
const target = { Bucket, Key, Body };
try {
const parallelUploads3 = new Upload({
client: new S3({}) || new S3Client({}),
tags: [...], // optional tags
queueSize: 4, // optional concurrency configuration
partSize: 5MB, // optional size of each part
leavePartsOnError: false, // optional manually handle dropped parts
params: target,
});
try {
const parallelUploads3 = new Upload({
client: new S3({}) || new S3Client({}),
params: { Bucket, Key, Body },
parallelUploads3.on("httpUploadProgress", (progress) => {
console.log(progress);
});
tags: [
/*...*/
], // optional tags
queueSize: 4, // optional concurrency configuration
partSize: 1024 * 1024 * 5, // optional size of each part, in bytes, at least 5MB
leavePartsOnError: false, // optional manually handle dropped parts
});
await parallelUploads3.done();
} catch (e) {
console.log(e);
}
parallelUploads3.on("httpUploadProgress", (progress) => {
console.log(progress);
});
await parallelUploads3.done();
} catch (e) {
console.log(e);
}
```
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