Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kenotron/azure-storage-node-promisify
https://github.com/kenotron/azure-storage-node-promisify
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/kenotron/azure-storage-node-promisify
- Owner: kenotron
- Created: 2018-10-22T18:00:51.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-29T03:42:17.000Z (about 6 years ago)
- Last Synced: 2024-11-07T21:11:40.672Z (2 months ago)
- Language: TypeScript
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# azure-storage-node-promisify
`azure-storage` is a wonderful and _cheap_ way to store objects and blobs. Be sure to check it out here: [https://azure.microsoft.com/en-us/services/storage/]. However, the current version of the [Azure Storage API for Node](https://github.com/Azure/azure-storage-node). The entire API uses callbacks. Node.js APIs suffered the same issue, leading ot callback hell. The solution is to promisify the callback functions so that it is compatible with await / async syntax. Since Node.js 8.x, a new `promisify` function has been introduced for the `util` module.
## Installation
`npm install azure-storage-node-promisify`
## Usage
This library is Typescript friendly. It tries to preserve the parameter as much as possible.
```ts
import azure from 'azure-storage';
import { promisifyTableService } from 'azure-storage-node-promisify';const connectionString = '...'; // you can use any of the Azure Storage Node SDK's auth methods
const tableService = promisifyTableService(azure.createTableService(connectionString));(async () => {
await tableService.createTableIfNotExistsAsync('testTable');// Welcome to the future of CHEAP storage and async / await syntax!
})();
```