Azure / azure-storage-js

Microsoft Azure Storage Library for JavaScript (This repo has been moved to https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage on Apr18, 2019. This Repo will be deprecated.)
https://docs.microsoft.com/en-us/javascript/api/overview/azure/storage/client?view=azure-node-preview
MIT License
74 stars 34 forks source link

where in the response of an upload do I get the details to retrieve the file #63

Open dagda1 opened 5 years ago

dagda1 commented 5 years ago

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

blob

Which version of the SDK was used?

10.3

What's the Node.js/Browser version?

8.11.1

What problem was encountered?

I have a backing database table that stores additional searchable metadata about each file that gets uploaded into azure storage, such as description, name and other details. There will also be a pseudo directory structure which is all very normal stuff for document management.

I am making a call to uploadBrowserDataToBlockBlob but I cannot see anything in the response that will help me later retrieve the file later.

My code looks like this:

response = await Azure.uploadBrowserDataToBlockBlob(Azure.Aborter.none, file, blockBlobURL, options);

but I can't see anything in that response that will let me later uniquely get this file, unless the blob name is the only thing that I have.

In which case am I best to generate some unique name for the identifier?

Steps to reproduce the issue?

Have you found a mitigation/solution?

donniekerr commented 5 years ago

I'm looking for same thing. I'd like to get the url of the uploaded file back as confirmation that it is there and the link works. But, I don't see a response object in the documentation. Thanks, Donnie

XiaoningLiu commented 5 years ago

@dagda1 @donniekerr Every response has a inner _response property to get original request urls.

response = await Azure.uploadBrowserDataToBlockBlob(Azure.Aborter.none, file, blockBlobURL, options);
console.log(response._response.request.url);
XiaoningLiu commented 5 years ago

@seguler Do you know is the correct person in doc team to improve the document generation?

This is the original code:

/**
 * Type for uploadFileToBlockBlob, uploadStreamToBlockBlob and uploadBrowserDateToBlockBlob.
 *
 * @export
 */
export type BlobUploadCommonResponse = Models.BlockBlobUploadHeaders & {
  /**
   * The underlying HTTP response.
   *
   * @type {HttpResponse}
   * @memberof IBlobUploadCommonResponse
   */
  _response: HttpResponse;
};

And this is the document generated which missing _response

image