# aws-promisify

> This module helps to promisify AWS SDK functions

Latest version **1.0.1** (published 2020-02-10) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-02-10 |
| First published | 2020-02-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Sudhir Yelikar |
| Maintainers | sudhiryelikar |
| Keywords | AWS, aws-sdk, Nodejs |

## Links

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

## 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.1 (latest) — 2020-02-10
- 1.0.0 — 2020-02-09
- 1.0.0-alpha.0 — 2020-02-09

## README

# aws-promisify

[![build status](https://img.shields.io/travis/sudhiry/aws-promisify/master.svg?style=flat-square)](https://travis-ci.org/sudhiry/aws-promisify)
[![npm version](https://img.shields.io/npm/v/aws-promisify.svg?style=flat-square)](https://www.npmjs.com/package/aws-promisify)
[![npm downloads](https://img.shields.io/npm/dm/aws-promisify.svg?style=flat-square)](https://www.npmjs.com/package/aws-promisify)


## Installtion

```js
npm install aws-promisify
```

## Usage 

You can use `aws-promisify` to wrap any `aws-sdk` function with promise. Following are some of the examples.

For DynamoDB queries:

```js
import AWS from 'aws-sdk';
import aws_promisify from 'aws-promisify';

const dynamoDb = new AWS.DynamoDB.DocumentClient({
    region: 'YOUR_REGION',
    accessKeyId: 'YOUR_AWS_ACCESS_KEY_ID',
    secretAccessKey: 'YOUR_AWS_SECRET_ACCESS_KEY'
})

const params = {
    // Any parameters required by aws-sdk dynamodb documentation
    TableName: 'YOUR_TABLE_NAME',
}

aws_promisify(dynamoDb, dynamoDb.scan)(params).then((data) => {
    // Here will be output of your Dynamodb query 
    console.log(data)
}).catch((err) => {
    // If anything fails you can catch error here.
    console.error(err)
})

```

For S3:

```js
import AWS from 'aws-sdk';
import aws_promisify from 'aws-promisify';

const S3 = new AWS.S3()

const params = {
    // Any params listed by aws-sdk S3 documentation
    Bucket: 'YOUR_S3_BUCKET_NAME',
    ACL: 'YOUR_ACL_SCOPE', // For example 'public-read'
}

aws_promisify(S3, S3.createBucket)(params).then((data) => {
    // Here will be output of your S3 operation
    console.log(data)
}).catch((err) => {
    // If anything fails you can catch error here.
    console.error(err)
})

```

If you are using `async await` 

```js

import AWS from 'aws-sdk';
import aws_promisify from 'aws-promisify';

const dynamoDb = new AWS.DynamoDB.DocumentClient({
    region: 'YOUR_REGION',
    accessKeyId: 'YOUR_AWS_ACCESS_KEY_ID',
    secretAccessKey: 'YOUR_AWS_SECRET_ACCESS_KEY'
})

// You can also implement this using async await
const scan  = async (params) => {
    try {
        // Here will be output of your Dynamodb query 
        const data = await aws_promisify(dynamoDb, dynamoDb.scan)(params)

        return data
    } catch (err) {
        console.error(err)
    }
    
}
```

## License

MIT

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