How to Upload to Azure Blob Storage Using NodeJS
| January 16, 2024 | in
When building modern cloud applications, we usually need to store some files in the cloud. It could be images uploaded by users or CSV files generated by the application. In this blog post, I will show you how to upload files to Azure Blob Storage.
First, install the storage-blob npm package.
npm install @azure/storage-blob
After that, sending the file to the blob is very easy. We need to call the upload on the
BlockBlobClient class. This will upload the file for us.
To call the upload on
BlockBlobClient, we must first create
BlockBlobClient. To do that, we need to create
Here’s the code to complete these steps.
After we upload something, we often want to access those files. The files will be unavailable by default, but we can create a SAS URI that will allow someone to download these files. Creating one of those URIs requires a similar set of code.
Feel free to try this the next time you need to upload some files using NodeJS to Azure Blob Storage.