angular-azure-blob

AngularJS module providing a service to upload to azure blob storage in parallel blocks with MD5 hashing

Added by: Sam Deering

GitHub

Repository

sjdweb/angular-azure-blob

Stats

Stars: 0

Watchers: 0

Forks: 0

Author

Sean Drumm
Sean Drumm

Module Description

Angular Azure Blob Upload

AngularJS service for uploading to azure blob storage in HTML5 browsers via FileReader with effective error handling and parallel block uploads.

Library will send MD5 of blocks for integrity by default, and can also optionally MD5 the whole file for usage in your own app once upload completed.

Upload task happens in a separate Web Worker thread.

Prerequisites

  • IE10+
  • Existing Angular app (ofcourse)
  • CryptoJS with MD5 module referenced in your SPA
  • Underscore.js library referenced

How to use

Download the latest release here

or

Build the library on your machine

npm install
bower install
grunt package

There will be a zip file in the dist/ folder for use.

Reference the dist library in your SPA along with CryptoJS MD5 and Underscore.js

<script src="/dist/angular-azure-blob.js"></script>

Require the azureBlobStorage module:

angular.module('appx', ['azureBlobStorage']);

Use the service in your controller, make sure the paths are correct!

angular.module('appx').controller('UploadController', [
    '$scope', 'azureBlobUpload',
    function($scope, azureBlobUpload) {
        $scope.upload = function(files) {
            azureBlobUpload.upload({
                path: '/dist/',
                libPath: '/libs/',
                blobUri: xxx,
                file: files[0],
                process: function cb(){},
                complete: function cb() {},
                error: function cb() {},
                blockSize: 1024, // optional
                calculateFileMd5: false // optional, false by default
            });
        };
    }
]);

CORS

Cross Origin Resource Sharing (CORS) must be enabled on the azure blob storage account. The following articles can assist with this...

Windows Azure Storage Introducing CORS

Windows Azure Storage and CORS

Thanks To

Gaurav Mantri for this blog http://gauravmantri.com/2013/02/16/uploading-large-files-in-windows-azure-blob-storage-using-shared-access-signature-html-and-javascript

Stephen Brannan for his original library https://github.com/kinstephen/angular-azure-blob-upload

UMG

Module stats last updated: 2015-04-19 05:14:53

Disclaimer: Some data on this page may have been gathered from the authors GitHub respository. If you see any mistakes or outdated information please let us know. Thanks!