# aws-sharp

> This contains a reference to the aws-sdk and sharp module. It is a valid use case to use

Latest version **1.0.6** (published 2021-02-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install aws-sharp
pnpm add aws-sharp
yarn add aws-sharp
bun add aws-sharp
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2021-02-25 |
| First published | 2021-02-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 25.6 KB |
| Known vulnerabilities | 0 (+6 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | developer@scube.me |
| Maintainers | scube |
| Keywords | aws-cli, sharp, s3, compress, s3upload, base64 |

## Links

- npm: https://www.npmjs.com/package/aws-sharp
- Repository: https://github.com/scube-elate/aws-sharp
- Homepage: https://github.com/scube-elate/aws-sharp#readme
- Issues: https://github.com/scube-elate/aws-sharp/issues
- npm.io page: https://npm.io/package/aws-sharp

## Dependencies (2)

- [sharp](https://npm.io/package/sharp.md) ^0.27.1
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.845.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.6 (latest) — 2021-02-25
- 1.0.5 — 2021-02-24
- 1.0.4 — 2021-02-22
- 1.0.3 — 2021-02-22
- 1.0.2 — 2021-02-17
- 1.0.1 — 2021-02-17
- 1.0.0 — 2021-02-17

## README

## Installation

`npm install aws-sharp -s`

## Features

 * Upload Images to AWS S3 with compressed  size without loosing Quality.
 * It should supported to JPG,PNG,JPEG WEBP.
 * Forced to save image into required format.
 * Provide  Image Quality Option While compressing.


## Synopsis

### Create a AWSClient

```js
var aws_sharp = require('aws-sharp');

var AWSClient = aws_sharp.createCredentials({
  s3Credentials: {
    accessKeyId: "your s3 key",
    secretAccessKey: "your s3 secret"
  },
});
```

### Upload a Image to S3

```js
const options : {
    toFile:"string" // force to convert into required image format,
    quality:Number  // provide quality while compressimage, max allowed to 80
}
var params = {
    "Base64 Image",
    "Bucket Name",
    options
  },
};

AWSClient.uploadBase64ImageWithCompress(params).then(s3_path=>{
    console.log(s3_path)
}).catch(error=>{
    console.log(error)
})
```

## API Documentation


This contains a reference to the aws-sdk and sharp module. It is a valid use case to use
both this module and the lower level aws-sdk module in tandem.

### aws_sharp.createCredentials(options)

Creates an S3 client.

`options`:

 * `s3Credentials` - optional, an instance of `AWS.S3`. Leave blank if you set aws-cli configuration .




### aws_sharp.uploadBase64ImageWithCompress(params)

See http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#putObject-property

`params`:

 * `base64Image`: base64 image string passes as argument.
 * `bucketName`: bucket name  to the save file on particualr s3 bucket.
 *  `options` : (optional)`toFile`: Force to save to particular format ['png','jpeg','jpg','webp']   default set to `webp`.
 * `quality` parameter in `sharp`, set qaulity while compress default set to `20` Max allowed to `80`


## Examples

### Upload Base64 Image to S3 with compress size without loose quality


```js
var AWSClient = require('aws-sharp').createCredentials({ /* AWS KEYS */ });
AWSClient.uploadBase64ImageWithCompress(params).then(s3_path=>{
   console.log('S3_Path',s3_path)
}).catch(error=>{
    console.log("Error", error)
})
```

## Testing

create .env file in root folder and set following keys.

`AWS_S3_KEY_ID=<valid_s3_key> AWS_S3_SECRET=<valid_s3_secret> AWS_S3_BUCKET=<valid_s3_bucket> npm test`

---
_Source: https://npm.io/package/aws-sharp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
