Skip to content

Adding the SDK Binding Support for Storage Blob #341

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

Open
wants to merge 28 commits into
base: v4.x
Choose a base branch
from

Conversation

swapnil-nagar
Copy link

@swapnil-nagar swapnil-nagar commented Apr 28, 2025

This pull request introduces support for SDK binding for Azure Storage Blob in the Azure Functions Node.js library. Key changes include adding a new boolean property, deferredBinding, which allows users to enable deferred binding for storage blobs. When deferredBinding is enabled, the StorageBlobClient is returned to the user, which contains both the blobClient and containerClient, providing enhanced functionality for interacting with blob storage.

Example

app.storageBlob("storageBlobTrigger", {
  path: "snippets/{name}",
  connection: "SwapnilUserMiTest",
  deferredBinding: true,
  handler: storageBlobTrigger1,
});
export async function storageBlobTrigger1(
  blobStorageClient: StorageBlobClient,
  context: InvocationContext
): Promise<void> {
  context.log(
    `Storage blob function processed blob "${context.triggerMetadata.name}"`
  );
  try {
    // Download the blob content
    const downloadBlockBlobResponse =
      await blobStorageClient.blobClient.download();

    context.log("Contemt: ", downloadBlockBlobResponse );
  } catch (error) {
    console.error("Error downloading blob content:", error.message);
    throw error;
  }
  context.log("Storage blob trigger function executed successfully!");
}

Definition of StorageBlobClient

{
    /**
     * Blob client to be used by this blob input or output. This is the client that will be used to perform operations on the blob storage.
     */
    blobClient: BlobClient;

    /**
     * Container client to be used by this blob input or output. This is the client that will be used to perform operations on the container storage.
     */
    conatinerClient: ContainerClient;
}

@swapnil-nagar swapnil-nagar marked this pull request as ready for review April 28, 2025 03:41
@swapnil-nagar swapnil-nagar requested a review from a team as a code owner April 28, 2025 03:41
Swapnil Nagar and others added 2 commits April 28, 2025 09:29
Bumps [serialize-javascript](https://github.com/yahoo/serialize-javascript) to 6.0.2 and updates ancestor dependency [mocha](https://github.com/mochajs/mocha). These dependencies need to be updated together.


Updates `serialize-javascript` from 6.0.0 to 6.0.2
- [Release notes](https://github.com/yahoo/serialize-javascript/releases)
- [Commits](yahoo/serialize-javascript@v6.0.0...v6.0.2)

Updates `mocha` from 9.2.2 to 11.1.0
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/main/CHANGELOG.md)
- [Commits](mochajs/mocha@v9.2.2...v11.1.0)

---
updated-dependencies:
- dependency-name: serialize-javascript
  dependency-type: indirect
- dependency-name: mocha
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@swapnil-nagar swapnil-nagar enabled auto-merge (squash) May 15, 2025 15:47
@swapnil-nagar swapnil-nagar disabled auto-merge May 15, 2025 22:57
@swapnil-nagar swapnil-nagar enabled auto-merge (squash) May 15, 2025 22:57
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

Successfully merging this pull request may close these issues.

4 participants