n8n/packages/nodes-base/nodes/Aws/S3/AwsS3.node.ts
agobrech 109442f38f
feat(AwsS3 Node): Small overhaul of the node with multipart uploading (#6017)
* Create new version for S3

* Update S3 to new aws s3 methods

* Switch from SAOP to Rest api

* Add multipart request

* Seperate stream into chunks and send the multipart

* Fix chunk into buffer

* Fix wrong sha256 mismatch

* Add abort multipart on error

* Complete multipart and list parts

* Change format to xml and add a minmum size of 5MB for each part

* Fix returned data for uploading a file

* Remove console.logs

* Seperate needed headers and multipart headers

* Throw error on aborting, remove console.logs

* Remove soap request from generic function

* Keep buffer

* Add unit test for V2

* fix upload file content body

* removed unused import

* Fix bug where the object was too smal and used only one part

* Fix naming for bucket name

* Fix issue with file name not returning data

* Add parent name

* Remove console.logs

* Add content type

* fix headears for other upload mode

---------

Co-authored-by: Marcus <marcus@n8n.io>
2023-06-15 13:19:22 +02:00

28 lines
761 B
TypeScript

import type { INodeTypeBaseDescription, IVersionedNodeType } from 'n8n-workflow';
import { VersionedNodeType } from 'n8n-workflow';
import { AwsS3V1 } from './V1/AwsS3V1.node';
import { AwsS3V2 } from './V2/AwsS3V2.node';
export class AwsS3 extends VersionedNodeType {
constructor() {
const baseDescription: INodeTypeBaseDescription = {
displayName: 'AwsS3',
name: 'awsS3',
icon: 'file:s3.svg',
group: ['output'],
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Sends data to AWS S3',
defaultVersion: 2,
};
const nodeVersions: IVersionedNodeType['nodeVersions'] = {
1: new AwsS3V1(baseDescription),
2: new AwsS3V2(baseDescription),
};
super(nodeVersions, baseDescription);
}
}