Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to track progress with uploadBrowserDataToBlockBlob #61

Closed
dagda1 opened this issue Feb 4, 2019 · 2 comments
Closed

how to track progress with uploadBrowserDataToBlockBlob #61

dagda1 opened this issue Feb 4, 2019 · 2 comments

Comments

@dagda1
Copy link

dagda1 commented Feb 4, 2019

Which service(blob, file, queue, table) does this issue concern?

blob

Which version of the SDK was used?

10.3.0

What's the Node.js/Browser version?

What problem was encountered?

How do I use the progress call back passed to uploadBrowserDataToBlockBlob

      response = await Azure.uploadBrowserDataToBlockBlob(Azure.Aborter.none, file, blockBlobURL, {
        maxSingleShotSize: 4 * 1024 * 1024,
        progress: (progressEvent: TransferProgressEvent) => {
          console.log(progressEvent);
        }
      });

I just get an object with loadedBytes which seems to be the full amount of the block.

Is there a way I can track the progress with this?

@dagda1 dagda1 closed this as completed Feb 5, 2019
@MonteKrysto
Copy link

What was your answer to this?

@dagda1
Copy link
Author

dagda1 commented Apr 8, 2019

@MonteKrysto if you look at the definition of uploadBrowserDataToBlockBlob

export declare function uploadBrowserDataToBlockBlob(aborter: Aborter, browserData: Blob | ArrayBuffer | ArrayBufferView, blockBlobURL: BlockBlobURL, options?: IUploadToBlockBlobOptions): Promise<BlobUploadCommonResponse>;

It takes an options argument:

export interface IUploadToBlockBlobOptions {
    /**
     * Destination block blob size in bytes.
     *
     * @type {number}
     * @memberof IUploadToBlockBlobOptions
     */
    blockSize?: number;
    /**
     * Blob size threshold in bytes to start concurrency uploading.
     * Default value is 256MB, blob size less than this option will
     * be uploaded via one I/O operation without concurrency.
     * You can customize a value less equal than the default value.
     *
     * @type {number}
     * @memberof IUploadToBlockBlobOptions
     */
    maxSingleShotSize?: number;
    /**
     * Progress updater.
     *
     * @memberof IUploadToBlockBlobOptions
     */
    progress?: (progress: TransferProgressEvent) => void;
    /**
     * Blob HTTP Headers.
     *
     * @type {IBlobHTTPHeaders}
     * @memberof IUploadToBlockBlobOptions
     */
    blobHTTPHeaders?: Models.BlobHTTPHeaders;
    /**
     * Metadata of block blob.
     *
     * @type {{ [propertyName: string]: string }}
     * @memberof IUploadToBlockBlobOptions
     */
    metadata?: {
        [propertyName: string]: string;
    };
    /**
     * Access conditions headers.
     *
     * @type {IBlobAccessConditions}
     * @memberof IUploadToBlockBlobOptions
     */
    blobAccessConditions?: IBlobAccessConditions;
    /**
     * Concurrency of parallel uploading. Must be >= 0.
     *
     * @type {number}
     * @memberof IUploadToBlockBlobOptions
     */
    parallelism?: number;
}

You can pass a progress function that you can use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants