Azure / azure-iot-sdk-node

A Node.js SDK for connecting devices to Microsoft Azure IoT services
https://docs.microsoft.com/en-us/azure/iot-hub/
Other
261 stars 227 forks source link

Allow devices to add custom metadata to uploaded files #916

Closed djosemartine closed 3 years ago

djosemartine commented 3 years ago

It would be very convenient to allow the devices to set custom metadata to the uploaded file. Some options that cross my mind:

  1. Setting metadata to the blob resource
  2. Enriching the file upload notification

thoughts?

elhorton commented 3 years ago

Hi @djosemartine , thanks for the feedback! Would you mind elaborating a bit more on your scenario so we can better understand the limitation? What "enrichment" are you thinking of when it comes to the file upload notification? Thanks!

az-iot-builder-01 commented 3 years ago

@djosemartine, thank you for your contribution to our open-sourced project! Please help us improve by filling out this 2-minute customer satisfaction survey

djosemartine commented 3 years ago

Hi @elhorton, thanks for writing back. I closed the issue by mistake but I could reopen it again. Let me explain better the feature request: The Device Client does not support to add metadata to the files to be uploaded. It would be very helpful if the upload-to-blob method had an option to set the file metadata, something like: uploadToBlob(blobName: string, blobMetadata: Map<string, string>, stream: Stream, streamLength: number): Promise<void>; The metadata is really useful to process the file once it is uploaded.

What do you think?

Please, forget about the enrich option. I think that is out of the scope of the SDK. Thanks in advance

elhorton commented 3 years ago

got it, thanks @djosemartine ! That makes sense, and agreed that the enrich option is unfortunately outside the scope of the SDK. Adding metadata is feasible-- I've added it to our feature backlog and will keep this issue updated as we evaluate this in the new year.

YoDaMa commented 3 years ago

Hi @djosemartine, taking a look at this issue. We have an API for more fine grained use of the uploadToBlob. See the example: https://github.com/Azure/azure-iot-sdk-node/blob/master/device/samples/upload_to_blob_advanced.js

Because it's just getting the information from IoT hub to communicate with the storage blob api it gives you more control over using custom metadata.

anthonyvercolano commented 3 years ago

This is something that would just go in your application logic.

djosemartine commented 3 years ago

This is something that would just go in your application logic.

It works. Thanks