1.0.4 • Published 4 years ago

astm-s3-dev v1.0.4

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

Installation

npm install astm-nodejs-sdk

Environment variables setup

AWS_REGION= AWS_ACCESS_KEY= AWS_SECRET_KEY= AWS_S3_BUCKET_NAME=

Use

Package import

const astm = require('astm-nodejs-sdk'); const s3 = astm.S3;

Methods


uploadFile(Object params, fun callback)

Use this method to upload file on S3

Parameters | Name | Type | Mandatory | Description | | ------ | ------ | ------ | ------ | | bucketName | String | No | S3 Bucket name, if not provided bucket name will be picked from env | | filename | String | Yes | Full S3 path of object, including folder name, filename and extension |

| body | Byte | Yes | Byte stream of the file to be uploaded |

deleteFile(Object params, fun callback)

Use this method to delete a file on S3

Parameters | Name | Type | Mandatory | Description | | ------ | ------ | ------ | ------ | | bucketName | String | No | S3 Bucket name, if not provided bucket name will be picked from env | | filename | String | Yes | Full S3 path of object, including folder name, filename and extension |


downloadFile(Object params, fun callback)

Use this method to delete file on S3

Parameters | Name | Type | Mandatory | Description | | ------ | ------ | ------ | ------ | | bucketName | String | No | S3 Bucket name, if not provided bucket name will be picked from env | | filename | String | Yes | Full S3 path of object, including folder name, filename and extension |


presignedUrlGet(Object params, fun callback)

Use this method to delete a file on S3

Parameters | Name | Type | Mandatory | Description | | ------ | ------ | ------ | ------ | | bucketName | String | No | S3 Bucket name, if not provided bucket name will be picked from env | | filename | String | Conditional Mandatory | Full S3 path of the object, including folder name, filename and extension. This field is mandatory if the identifier field is not provided | | identifier | String | Conditional Mandatory | Object's filename only. This field is mandatory if filename field is not provided | | fileType | String | Conditional Mandatory | Object's extension only excluding ".". This field is mandatory if filename field is not provided |

| expireSeconds | Integer | Yes | Duration in seconds presigned URL be valid after creation time |

presignedUrlPut(Object params, fun callback)

Use this method to delete file on S3

Parameters | Name | Type | Mandatory | Description | | ------ | ------ | ------ | ------ | | bucketName | String | No | S3 Bucket name, if not provided bucket name will be picked from env | | filename | String | Yes | Full S3 path of the object, including folder name, filename and extension. |

| expireSeconds | Integer | Yes | Duration in seconds presigned URL be valid after creation time |

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago