nas

nativescript-azure-storage

Azure Storage for NativeScript

Showing:

Popularity

Downloads/wk

1

GitHub Stars

2

Maintenance

Last Commit

5yrs ago

Contributors

2

Package

Dependencies

1

License

MIT

Type Definitions

Built-In

Tree-Shakeable

No?

Categories

Readme

npm npm

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<any>();
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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial