Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dzfweb/nativescript-azure-storage
Azure Storage for NativeScript
https://github.com/dzfweb/nativescript-azure-storage
azure-storage microsoft nativescript
Last synced: about 2 months ago
JSON representation
Azure Storage for NativeScript
- Host: GitHub
- URL: https://github.com/dzfweb/nativescript-azure-storage
- Owner: dzfweb
- License: other
- Created: 2017-05-12T16:10:26.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-19T14:06:46.000Z (over 7 years ago)
- Last Synced: 2024-09-28T19:05:16.910Z (3 months ago)
- Topics: azure-storage, microsoft, nativescript
- Language: TypeScript
- Size: 1.91 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![npm](https://img.shields.io/npm/v/nativescript-azure-storage.svg)](https://www.npmjs.com/package/nativescript-azure-storage)
[![npm](https://img.shields.io/npm/dt/nativescript-azure-storage.svg?label=npm%20downloads)](https://www.npmjs.com/package/nativescript-azure-storage)# nativescript-azure-storage
## Installation
`tns plugin add nativescript-azure-storage`## Usage
```
import { NativeScriptAzureStorage } from 'nativescript-azure-storage';
let azureStorage = new NativeScriptAzureStorage(this.azureStorageConnectionString);
```## Available Methods for Android and iOS
`createBlobContainer`: Create a blob container
```
azureStorage.createBlobContainer('blobContainer')
.then(() => console.log(`Blog container Created!`))
.catch((err) => console.log(`Error creating blob container: ${err}`));
````deleteBlobContainer`: Delete a blob container
```
azureStorage.deleteBlobContainer('blobContainer')
.then(() => console.log(`Blog container deleted!`))
.catch((err) => console.log(`Error deleting blob container: ${err}`));
````uploadBlob`: Upload blob
```
azureStorage.uploadBlob('blobContainer', 'blobName', 'Hello World!')
.then(() => console.log(`Uploaded successfuly`))
.catch((err) => console.log(`Error uploading: ${err}`));
````deleteBlob`: Delete blob
```
azureStorage.deleteBlob('blobContainer', 'blobName')
.then(() => console.log(`Blob deleted successfuly`))
.catch((err) => console.log(`Error deleting blob: ${err}`));
````downloadBlob`: Download blob
```
azureStorage.downloadBlob('blobContainer', 'blobName')
.then((blob) => console.log(`Blob downloaded successfuly`))
.catch((err) => console.log(`Error getting tables: ${err}`));
```## Available Methods only for Android (for now)
`createTable`: Create table with the specified name
```
azureStorage.createTable('table')
.then(() => console.log(`Table Created!`))
.catch((err) => console.log(`Error creating table: ${err}`));
````addRow`: Insert new row from an object
```
azureStorage.addRow('table', { foo: 'bar' }, 'partitionKey', 'rowKey')
.then(() => console.log(`Row created successfuly!`))
.catch((err) => console.log(`Error creating row: ${err}`));
````addRows`: Insert new row from a list of object
```
let array = new Array();
array.push({ foo: 'bar' });
azureStorage.addRows('table', 'partitionKey', 'foo', array)
.then(() => console.log(`Rows created successfuly!`))
.catch((err) => console.log(`Error creating rows: ${err}`));
````listTables`: List all tables from storage
```
azureStorage.listTables()
.then((tables) => {
tables.forEach((table) => {
console.log(`Table:${table}`);
});
})
.catch((err) => console.log(`Error getting tables: ${err}`));
````listRows`: List all rows from a specified table
```
azureStorage.listRows('table')
.then((rows) => {
rows.forEach((row) => {
console.log(`Row:${row.partitionKey} | ${row.rowKey} | ${row.getTimestamp() }`);
});
})
.catch((err) => console.log(`Error getting rows: ${err}`));
```## Next Version (available soon)
`updateRow`;`deleteRow`;
`tables methods for iOS`