Search code examples
node.jsazureazure-storageazure-blob-storage

What's the best way to set up my Azure Node.js app service with an Azure Storage/Blob service


I have an Azure node.js "App Service" already set up and running, working just fine. It's connected to an Azure DB, all that works great.

What I don't have is any sort of Storage / Blob service on my account whatsoever, and I'm having trouble finding documentation about the best way to set Blob Storage up to work with my App Service.

My goal is to be able to store and retrieve files, including primarily image files (.png, .jpg) and pdfs. I think Blob storage is what I'm looking for, and I'll want to set up an API on my node.js App Service for web clients to be able to upload and download files on the Storage service.


Solution

  • There are 2 Azure Storage blob npm packages you can use and add to your project dependencies:

    1. azure-storage https://www.npmjs.com/package/azure-storage
    2. @azure/storage-blob https://www.npmjs.com/package/@azure/storage-blob

    The 1st package is the most widely used azure-storage Node.js SDK. Supports blob/queue/file/table.

    The 2nd package is the latest released package for blob, more lightweight and based on the latest Azure Storage architecture. Supports async methods, promise and HTTP pipeline injection.

    You can go to their npm package or GitHub page for their samples.