### Install and Start Azurite (NPM) Source: https://context7.com/arafato/azurite/llms.txt Instructions for installing Azurite globally via npm and starting the emulators. ```APIDOC ## NPM Global Install Install and start all three storage emulators (blob, queue, table) in one command. ```bash # Install globally npm install -g azurite # Start all emulators, storing data in /tmp/azurite-data azurite -l /tmp/azurite-data # Start only the Blob emulator azurite-blob -l /tmp/azurite-data # Start only the Queue emulator azurite-queue # Start only the Table emulator azurite-table -l /tmp/azurite-data # Start silently (suppress logging) azurite -l /tmp/azurite-data --silent ``` ``` -------------------------------- ### Install and Start Azurite via NPM Source: https://context7.com/arafato/azurite/llms.txt Install Azurite globally using npm and start all storage emulators. Specify a data storage location with the -l flag. Use specific commands like `azurite-blob` to start individual services. The `--silent` flag suppresses logging. ```bash # Install globally npm install -g azurite # Start all emulators, storing data in /tmp/azurite-data azurite -l /tmp/azurite-data # Start only the Blob emulator azurite-blob -l /tmp/azurite-data # Start only the Queue emulator azurite-queue # Start only the Table emulator azurite-table -l /tmp/azurite-data # Start silently (suppress logging) azurite -l /tmp/azurite-data --silent ``` -------------------------------- ### Start Azurite Queue Storage Emulator Source: https://github.com/arafato/azurite/blob/master/README.md Starts only the Azurite Queue Storage emulator. ```bash $ azurite-queue ``` -------------------------------- ### Install Azurite via Nuget Source: https://github.com/arafato/azurite/blob/master/README.md Installs the Azurite Nuget package into the current project. This also starts Azurite in a dedicated console window and does not require Node.js. ```powershell PM> Install-Package Azurite ``` -------------------------------- ### Start Azurite with Local Folder Source: https://github.com/arafato/azurite/blob/master/README.md Starts Azurite, storing all data in the specified local folder. If the folder is omitted, the current working directory is used. This command starts both blob and queue storage emulators. ```bash $ azurite -l path/to/localfolder ``` -------------------------------- ### Install Azurite with NuGet Source: https://context7.com/arafato/azurite/llms.txt Instructions for installing Azurite as a NuGet package for .NET projects. ```APIDOC ### NuGet Install Install Azurite as a NuGet package for .NET projects (no Node.js required — self-contained executable). ```powershell PM> Install-Package Azurite # Azurite starts automatically in a dedicated console window after install ``` ``` -------------------------------- ### Start Azurite Table Storage Emulator Source: https://github.com/arafato/azurite/blob/master/README.md Starts only the Azurite Table Storage emulator, storing data in the specified workspace. ```bash $ azurite-table -l path/to/azurite/workspace ``` -------------------------------- ### Install Azurite via NPM Source: https://github.com/arafato/azurite/blob/master/README.md Installs Azurite globally using npm. Requires Node.js to be installed. ```bash $ npm install -g azurite ``` -------------------------------- ### Start Azurite Blob Storage Emulator Source: https://github.com/arafato/azurite/blob/master/README.md Starts only the Azurite Blob Storage emulator, storing data in the specified workspace. ```bash $ azurite-blob -l path/to/azurite/workspace ``` -------------------------------- ### Programmatic Initialization (Node.js) Source: https://context7.com/arafato/azurite/llms.txt Demonstrates how to start Azurite emulators programmatically from Node.js code, useful for test suites. ```APIDOC ### Programmatic Initialization (Node.js) Start Azurite emulators programmatically from Node.js code, for use in test suites. ```js const AzuriteBlob = require('azurite/lib/AzuriteBlob'); const AzuriteQueue = require('azurite/lib/AzuriteQueue'); const AzuriteTable = require('azurite/lib/AzuriteTable'); const blob = new AzuriteBlob(); const queue = new AzuriteQueue(); const table = new AzuriteTable(); // Options: l/location (storage path), s/silent (suppress logs), // p/blobPort, q/queuePort, t/tablePort, overwrite blob.init({ l: '/tmp/azurite', silent: true }) .then(() => console.log('Blob emulator running on port 10000')); queue.init({ l: '/tmp/azurite', silent: true }) .then(() => console.log('Queue emulator running on port 10001')); table.init({ l: '/tmp/azurite', silent: true }) .then(() => console.log('Table emulator running on port 10002')); // Graceful shutdown blob.close().then(() => console.log('Blob emulator stopped')); queue.close().then(() => console.log('Queue emulator stopped')); table.close().then(() => console.log('Table emulator stopped')); ``` ``` -------------------------------- ### List Blob Containers Source: https://context7.com/arafato/azurite/llms.txt Use GET with `comp=list` to retrieve a list of all containers in the storage account. The response is in XML format. ```bash curl -s \ "http://127.0.0.1:10000/devstoreaccount1?comp=list" # Expected response (XML): # # # # # mycontainer # ... # # # ``` -------------------------------- ### Run Azurite Docker Container for Blob Storage Only Source: https://github.com/arafato/azurite/blob/master/README.md Runs the Azurite Docker container, configured to start only the Blob Storage Emulator using the 'executable' environment variable. Ports are mapped and a volume is mounted for data. ```bash $ docker run -e executable=blob -d -t -p 10000:10000 -v /path/to/folder:/opt/azurite/folder arafato/azurite ``` -------------------------------- ### Create Blob Container using Azure CLI Source: https://github.com/arafato/azurite/blob/master/README.md Example command to create a blob container named 'test' using the Azure Cross-Platform CLI 2.0. It utilizes a specific connection string for the Azurite emulator. ```shell $ az storage container create --name 'test' --connection-string 'DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;' { "created": true } ``` -------------------------------- ### Get Queue Metadata Source: https://context7.com/arafato/azurite/llms.txt Retrieves user-defined metadata associated with a queue. Use `-sI` to get only headers. ```bash # Get metadata curl -sI "http://127.0.0.1:10001/devstoreaccount1/myqueue/?comp=metadata" # Response headers: x-ms-meta-priority: high, x-ms-meta-owner: teamA # x-ms-approximate-messages-count: ``` -------------------------------- ### Set and Get Container ACL Source: https://context7.com/arafato/azurite/llms.txt Configure public access level and stored access policies on a container. Use 'blob' for public blob-level access. The GET request returns headers with ACL information. ```bash # Set container ACL (public blob-level access) curl -X PUT \ -H "x-ms-blob-public-access: blob" \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer?restype=container&comp=acl" # Expected: 200 ``` ```bash # Get container ACL curl -sI \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer?restype=container&comp=acl" # Expected headers: x-ms-blob-public-access: blob ``` -------------------------------- ### Run Azurite Docker Image Source: https://github.com/arafato/azurite/blob/master/README.md Runs the Azurite Docker image in detached mode, mapping ports and mounting a volume for data storage. By default, it starts all services (blob, queue, table). ```bash $ docker run -d -t -p 10000:10000 -p 10001:10001 -v /path/to/folder:/opt/azurite/folder arafato/azurite ``` -------------------------------- ### Set / Get Blob Properties Source: https://context7.com/arafato/azurite/llms.txt Allows setting and retrieving system properties like Content-Type, Cache-Control, etc., on blobs. ```APIDOC ## Set / Get Blob Properties ### Description Set and retrieve system properties (Content-Type, Content-Encoding, Cache-Control, etc.) on blobs. ### Method PUT (Set Properties), HEAD (Get Properties) ### Endpoint `/{account}/{container}/{blob}?comp=properties` (for PUT) `/{account}/{container}/{blob}` (for HEAD) ### Headers (for PUT) - **x-ms-blob-content-type**: (string) - The content type of the blob. - **x-ms-blob-content-encoding**: (string) - The content encoding of the blob. - **x-ms-blob-content-language**: (string) - The content language of the blob. - **x-ms-blob-cache-control**: (string) - The cache control settings for the blob. ### Request Example (Set Properties) ```bash curl -s -o /dev/null -w "%{http_code}" -X PUT -H "x-ms-blob-content-type: application/pdf" -H "x-ms-blob-content-encoding: gzip" -H "x-ms-blob-content-language: en-US" -H "x-ms-blob-cache-control: max-age=3600" "http://127.0.0.1:10000/devstoreaccount1/mycontainer/report.pdf?comp=properties" ``` ### Response (Get Properties via HEAD) #### Success Response (200 OK for HEAD) Headers include system properties like `Content-Type`, `Content-Encoding`, `Cache-Control`, `x-ms-blob-type`, etc. ### Response Example (Get Properties via HEAD) ```bash curl -sI "http://127.0.0.1:10000/devstoreaccount1/mycontainer/report.pdf" # Expected headers: # Content-Type: application/pdf # Content-Encoding: gzip # Cache-Control: max-age=3600 # x-ms-blob-type: BlockBlob ``` ``` -------------------------------- ### Get / Set Blob Service Properties Source: https://context7.com/arafato/azurite/llms.txt Configure CORS, logging, and other service-level settings for the Blob service. ```APIDOC ## Get / Set Blob Service Properties ### Description Configure CORS, logging, and other service-level settings for the Blob service. ### Method GET (for retrieving properties), PUT (for setting properties) ### Endpoint `http://127.0.0.1:10000/{account}?restype=service&comp=properties` ### Request Example (Get Properties) ```bash curl "http://127.0.0.1:10000/devstoreaccount1?restype=service&comp=properties" ``` ### Request Example (Set Properties with CORS) ```bash curl -X PUT \ -H "Content-Type: application/xml" \ -d ' http://localhost:3000 GET,PUT,POST,DELETE * * 3600 ' "http://127.0.0.1:10000/devstoreaccount1?restype=service&comp=properties" ``` ### Response Example (Set Properties) ``` # Expected: 202 ``` ``` -------------------------------- ### Get Block List Source: https://context7.com/arafato/azurite/llms.txt Retrieves the list of committed and uncommitted blocks for a blob. ```APIDOC ## Get Block List ### Description Retrieves the list of committed and uncommitted blocks for a blob. ### Method GET ### Endpoint `/{account}/{container}/{blob}?comp=blocklist&blocklisttype={all|committed|uncommitted}` ### Parameters #### Query Parameters - **blocklisttype** (string) - Required - Specifies the type of block list to retrieve (`all`, `committed`, or `uncommitted`). ### Request Example ```bash curl "http://127.0.0.1:10000/devstoreaccount1/mycontainer/bigfile.bin?comp=blocklist&blocklisttype=all" ``` ``` -------------------------------- ### Get / Set Queue Metadata Source: https://context7.com/arafato/azurite/llms.txt Retrieves or sets user-defined metadata for a specific queue. ```APIDOC ## GET|PUT /{account}/{queue}/?comp=metadata ### Description Retrieve or set user-defined metadata on a queue. ### Method GET | PUT ### Endpoint `/{account}/{queue}/?comp=metadata` ### Request Example (Set Metadata) ```bash curl -X PUT \ -H "x-ms-meta-priority: high" \ -H "x-ms-meta-owner: teamA" \ "http://127.0.0.1:10001/devstoreaccount1/myqueue/?comp=metadata" ``` ### Request Example (Get Metadata) ```bash curl -sI "http://127.0.0.1:10001/devstoreaccount1/myqueue/?comp=metadata" ``` ### Response (Get Metadata) #### Success Response Headers include `x-ms-meta-priority` and `x-ms-meta-owner`. ``` -------------------------------- ### Get and Set Blob Service Properties Source: https://context7.com/arafato/azurite/llms.txt Configure CORS rules and other service-level settings for the Blob service. The PUT request requires XML payload for configuration. ```bash # Get current blob service properties curl "http://127.0.0.1:10000/devstoreaccount1?restype=service&comp=properties" ``` ```bash # Set CORS rules and service properties curl -X PUT \ -H "Content-Type: application/xml" \ -d ' http://localhost:3000 GET,PUT,POST,DELETE * * 3600 ' \ "http://127.0.0.1:10000/devstoreaccount1?restype=service&comp=properties" # Expected: 202 ``` -------------------------------- ### Set / Get Container ACL Source: https://context7.com/arafato/azurite/llms.txt Configure public access level and stored access policies on a container. ```APIDOC ## Set / Get Container ACL ### Description Configure public access level and stored access policies on a container. ### Method PUT (for setting ACL), GET (for retrieving ACL) ### Endpoint `http://127.0.0.1:10000/{account}/{container}?restype=container&comp=acl` ### Headers (for PUT) - `x-ms-blob-public-access`: Specifies the public access level (e.g., `blob`, `container`, `off`). ### Request Example (Set Container ACL) ```bash curl -X PUT \ -H "x-ms-blob-public-access: blob" \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer?restype=container&comp=acl" ``` ### Response Example (Set Container ACL) ``` # Expected: 200 ``` ### Request Example (Get Container ACL) ```bash curl -sI \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer?restype=container&comp=acl" ``` ### Response Example (Get Container ACL) ``` # Expected headers: x-ms-blob-public-access: blob ``` ``` -------------------------------- ### Get Blob Source: https://context7.com/arafato/azurite/llms.txt Retrieves the content of a blob. Supports downloading the entire blob or a specific byte range. ```APIDOC ## Get Blob ### Description Retrieves blob content. Returns `200 OK` with blob body and headers. ### Method GET ### Endpoint `/{account}/{container}/{blob}` ### Headers - **x-ms-range**: bytes=[start]-[end] - Optional - Specifies a byte range to retrieve. ### Request Example ```bash # Download a blob curl -o downloaded.txt "http://127.0.0.1:10000/devstoreaccount1/mycontainer/hello.txt" # Get a specific byte range curl -H "x-ms-range: bytes=0-4" "http://127.0.0.1:10000/devstoreaccount1/mycontainer/hello.txt" ``` ### Response #### Success Response (200) - Blob content (entire blob or specified range). - Various headers including `x-ms-blob-type`, `Content-Length`, `Content-Range` (if range requested). ``` -------------------------------- ### Get Blob Properties via HEAD Source: https://context7.com/arafato/azurite/llms.txt Retrieves system properties of a blob using a HEAD request. This includes Content-Type, Cache-Control, and other system-defined properties. ```bash curl -sI \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer/report.pdf" ``` -------------------------------- ### Get Page Blob Ranges Source: https://context7.com/arafato/azurite/llms.txt Retrieves the list of page ranges that have been written to a page blob. The response is in XML format. ```bash curl "http://127.0.0.1:10000/devstoreaccount1/mycontainer/pages.vhd?comp=pagelist" ``` -------------------------------- ### Set / Get Blob Metadata Source: https://context7.com/arafato/azurite/llms.txt Allows setting and retrieving custom metadata key-value pairs on blobs using `x-ms-meta-*` headers. ```APIDOC ## Set / Get Blob Metadata ### Description Attach and retrieve custom metadata key-value pairs on blobs via `x-ms-meta-*` headers. ### Method PUT (Set Metadata), GET (Get Metadata) ### Endpoint `/{account}/{container}/{blob}?comp=metadata` ### Headers (for PUT) - **x-ms-meta-[key]**: [value] - Custom metadata key-value pairs. ### Request Example (Set Metadata) ```bash curl -s -o /dev/null -w "%{http_code}" -X PUT -H "x-ms-meta-author: johndoe" -H "x-ms-meta-category: reports" "http://127.0.0.1:10000/devstoreaccount1/mycontainer/report.pdf?comp=metadata" ``` ### Response (Get Metadata) #### Success Response (200) Headers include `x-ms-meta-[key]: [value]` for all set metadata. ### Response Example (Get Metadata) ```bash curl -sI "http://127.0.0.1:10000/devstoreaccount1/mycontainer/report.pdf?comp=metadata" # Expected response headers: # x-ms-meta-author: johndoe # x-ms-meta-category: reports ``` ``` -------------------------------- ### List Blobs with Prefix Filter Source: https://context7.com/arafato/azurite/llms.txt Lists blobs in a container that match a specified prefix. This is useful for filtering results, for example, to list blobs within a virtual directory. ```bash curl "http://127.0.0.1:10000/devstoreaccount1/mycontainer?restype=container&comp=list&prefix=reports/" ``` -------------------------------- ### Create Queue Source: https://context7.com/arafato/azurite/llms.txt Creates a new queue in the emulated account. ```APIDOC ## Create Queue ### Description Creates a new queue in the emulated account. ### Method PUT ### Endpoint `http://127.0.0.1:10001/{account}/{queue}/` ### Request Example ```bash curl -s -o /dev/null -w "%{http_code}" \ -X PUT \ "http://127.0.0.1:10001/devstoreaccount1/myqueue/" ``` ### Response Example ``` # Expected: 201 ``` ``` -------------------------------- ### Create Queue Source: https://context7.com/arafato/azurite/llms.txt Creates a new queue in the emulated account. The command returns the HTTP status code. ```bash curl -s -o /dev/null -w "%{http_code}" \ -X PUT \ "http://127.0.0.1:10001/devstoreaccount1/myqueue/" # Expected: 201 ``` -------------------------------- ### Build Azurite Docker Image Source: https://github.com/arafato/azurite/blob/master/README.md Builds the Azurite Docker image locally from the current directory. ```bash $ docker build -t arafato/azurite . ``` -------------------------------- ### Deploy Azurite with Docker Source: https://context7.com/arafato/azurite/llms.txt Instructions for deploying Azurite as a Docker container, including running all services or specific ones. ```APIDOC ## Docker Deployment Pull and run Azurite as a Docker container with volume-mounted storage. ```bash # Pull from Docker Hub docker pull arafato/azurite # Run all services (blob :10000, queue :10001, table :10002) docker run -d -t \ -p 10000:10000 \ -p 10001:10001 \ -p 10002:10002 \ -v /path/to/local/folder:/opt/azurite/folder \ arafato/azurite # Run blob service only docker run -e executable=blob -d -t \ -p 10000:10000 \ -v /path/to/local/folder:/opt/azurite/folder \ arafato/azurite # Run queue service only docker run -e executable=queue -d -t -p 10001:10001 arafato/azurite # Run table service only docker run -e executable=table -d -t \ -p 10002:10002 \ -v /path/to/local/folder:/opt/azurite/folder \ arafato/azurite ``` ``` -------------------------------- ### Get Page Ranges Source: https://context7.com/arafato/azurite/llms.txt Retrieves the list of page ranges that have been written to a page blob. ```APIDOC ## Get Page Ranges ### Description Retrieves a list of all page ranges that have been written to a page blob. This is useful for understanding the populated areas of a page blob. ### Method GET ### Endpoint `http://127.0.0.1:10000/devstoreaccount1/mycontainer/pages.vhd?comp=pagelist` ### Response #### Success Response - **PageList**: Container for page range information. - **PageRange**: Represents a single range of pages. - **Start**: (integer) - The starting byte of the page range. - **End**: (integer) - The ending byte of the page range. ### Response Example ```xml 0511 ``` ``` -------------------------------- ### Deploy Azurite using Docker Source: https://context7.com/arafato/azurite/llms.txt Pull the Azurite Docker image and run it, mapping ports for blob, queue, and table services. Use volume mounting to persist data. Environment variable `executable` can specify which service to run. ```bash # Pull from Docker Hub docker pull arafato/azurite # Run all services (blob :10000, queue :10001, table :10002) docker run -d -t \ -p 10000:10000 \ -p 10001:10001 \ -p 10002:10002 \ -v /path/to/local/folder:/opt/azurite/folder \ arafato/azurite # Run blob service only docker run -e executable=blob -d -t \ -p 10000:10000 \ -v /path/to/local/folder:/opt/azurite/folder \ arafato/azurite # Run queue service only docker run -e executable=queue -d -t -p 10001:10001 arafato/azurite # Run table service only docker run -e executable=table -d -t \ -p 10002:10002 \ -v /path/to/local/folder:/opt/azurite/folder \ arafato/azurite ``` -------------------------------- ### Get / Set Queue ACL Source: https://context7.com/arafato/azurite/llms.txt Manages stored access policies (signed identifiers) for a queue. ```APIDOC ## GET|PUT /{account}/{queue}/?comp=acl ### Description Manage stored access policies (signed identifiers) for a queue. ### Method GET | PUT ### Endpoint `/{account}/{queue}/?comp=acl` ### Request Example (Set ACL) ```bash curl -X PUT \ -H "Content-Type: application/xml" \ -d ' policy1 2024-01-01T00:00:00Z 2025-01-01T00:00:00Z raup ' "http://127.0.0.1:10001/devstoreaccount1/myqueue/?comp=acl" ``` ### Request Example (Get ACL) ```bash curl "http://127.0.0.1:10001/devstoreaccount1/myqueue/?comp=acl" ``` ### Response (Set ACL) #### Success Response (204) No content. ``` -------------------------------- ### Get Queue ACL Source: https://context7.com/arafato/azurite/llms.txt Retrieves the stored access policies for a queue. This allows viewing configured permissions. ```bash # Get ACL curl "http://127.0.0.1:10001/devstoreaccount1/myqueue/?comp=acl" ``` -------------------------------- ### Programmatic Initialization of Azurite in Node.js Source: https://context7.com/arafato/azurite/llms.txt Initialize Azurite emulators programmatically from Node.js code, useful for test suites. Options include storage location, silent mode, and port configuration. Includes graceful shutdown. ```javascript const AzuriteBlob = require('azurite/lib/AzuriteBlob'); const AzuriteQueue = require('azurite/lib/AzuriteQueue'); const AzuriteTable = require('azurite/lib/AzuriteTable'); const blob = new AzuriteBlob(); const queue = new AzuriteQueue(); const table = new AzuriteTable(); // Options: l/location (storage path), s/silent (suppress logs), // p/blobPort, q/queuePort, t/tablePort, overwrite blob.init({ l: '/tmp/azurite', silent: true }) .then(() => console.log('Blob emulator running on port 10000')); queue.init({ l: '/tmp/azurite', silent: true }) .then(() => console.log('Queue emulator running on port 10001')); table.init({ l: '/tmp/azurite', silent: true }) .then(() => console.log('Table emulator running on port 10002')); // Graceful shutdown blob.close().then(() => console.log('Blob emulator stopped')); queue.close().then(() => console.log('Queue emulator stopped')); table.close().then(() => console.log('Table emulator stopped')); ``` -------------------------------- ### Query Tables Source: https://context7.com/arafato/azurite/llms.txt Lists all tables within the emulated Table Storage account. Useful for managing tables. ```bash curl -H "Accept: application/json;odata=minimalmetadata" \ "http://127.0.0.1:10002/devstoreaccount1/Tables" # Response (JSON): {"value":[{"TableName":"Employees"}, ...]} ``` -------------------------------- ### Node.js SDK Blob and Queue Operations with Azurite Source: https://context7.com/arafato/azurite/llms.txt Shows how to perform blob and queue operations using the `azure-storage` npm package against Azurite. Configure the connection string via environment variable or explicitly. ```javascript const azure = require('azure-storage'); // Option 1: use the environment variable process.env.AZURE_STORAGE_CONNECTION_STRING = 'DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;' 'AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;' 'BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;'; const blobService = azure.createBlobService(); // Create container blobService.createContainerIfNotExists('mycontainer', (err, result) => { if (err) return console.error('Error:', err); console.log('Container created:', result.created); // Upload blob blobService.createBlockBlobFromText( 'mycontainer', 'hello.txt', 'Hello from Node.js SDK!', { contentSettings: { contentType: 'text/plain' } }, (err, result) => { if (err) return console.error('Upload error:', err); console.log('Blob uploaded:', result.name); // Download blob blobService.getBlobToText('mycontainer', 'hello.txt', (err, text) => { if (err) return console.error('Download error:', err); console.log('Blob content:', text); // "Hello from Node.js SDK!" }); } ); }); // Queue example const queueService = azure.createQueueService(); queueService.createQueueIfNotExists('myqueue', (err) => { if (err) return console.error(err); queueService.createMessage('myqueue', 'Task payload', (err) => { if (err) return console.error(err); queueService.getMessages('myqueue', (err, result) => { console.log('Received:', result.entries[0].messageText); }); }); }); ``` -------------------------------- ### Delete Message Source: https://context7.com/arafato/azurite/llms.txt Deletes a specific message after it has been processed, using its `messageId` and `popReceipt` from a prior Get Messages call. ```APIDOC ## Delete Message ### Description Deletes a specific message after it has been processed, using its `messageId` and `popReceipt` from a prior Get Messages call. ### Method DELETE ### Endpoint `http://127.0.0.1:10001/{account}/{queue}/messages/{messageId}?popreceipt={popReceipt}` ### Path Parameters - **messageId** (string): Required. The ID of the message to delete. - **popReceipt** (string): Required. The pop receipt of the message to delete. ### Request Example ```bash curl -X DELETE \ "http://127.0.0.1:10001/devstoreaccount1/myqueue/messages/?popreceipt=" ``` ### Response Example ``` # Expected: 204 ``` ``` -------------------------------- ### Get Messages Source: https://context7.com/arafato/azurite/llms.txt Dequeues up to 32 messages from a queue. Dequeued messages become invisible for the visibility timeout duration. ```APIDOC ## Get Messages ### Description Dequeues up to 32 messages from a queue. Dequeued messages become invisible for the visibility timeout duration. ### Method GET ### Endpoint `http://127.0.0.1:10001/{account}/{queue}/messages` ### Query Parameters - `numofmessages` (integer): Optional. The number of messages to retrieve (1-32). - `visibilitytimeout` (integer): Optional. The duration in seconds for which the dequeued messages will be invisible. ### Request Example ```bash # Dequeue 1 message with 30s visibility timeout curl "http://127.0.0.1:10001/devstoreaccount1/myqueue/messages?numofmessages=1&visibilitytimeout=30" ``` ### Response Example ```xml ... ... SGVsbG8gQXp1cml0ZQ== ... ... ``` ``` -------------------------------- ### Create Table Source: https://context7.com/arafato/azurite/llms.txt Creates a new table in the emulated Table Storage service. Requires a JSON payload with the table name. ```bash curl -X POST \ -H "Content-Type: application/json" \ -H "Accept: application/json;odata=minimalmetadata" \ -d '{"TableName": "Employees"}' \ "http://127.0.0.1:10002/devstoreaccount1/Tables" # Expected: 201 # Response (JSON): {"odata.metadata":"...","TableName":"Employees"} ``` -------------------------------- ### List Queues Source: https://context7.com/arafato/azurite/llms.txt Lists all queues within the emulated storage account. ```APIDOC ## GET /{account}?comp=list ### Description Lists all queues in the emulated account. ### Method GET ### Endpoint `/{account}?comp=list` ### Request Example ```bash curl "http://127.0.0.1:10001/devstoreaccount1?comp=list" ``` ``` -------------------------------- ### Azure CLI Blob Operations with Azurite Source: https://context7.com/arafato/azurite/llms.txt Demonstrates common blob storage operations (create container, upload, list, download, delete) using the Azure CLI and Azurite. Requires setting the connection string. ```bash # Set a reusable connection string variable export CONN="DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;" # Create a container az storage container create --name mycontainer --connection-string "$CONN" # Output: {"created": true} # Upload a blob az storage blob upload \ --container-name mycontainer \ --name readme.txt \ --file ./README.md \ --connection-string "$CONN" # List blobs az storage blob list \ --container-name mycontainer \ --connection-string "$CONN" \ --output table # Download a blob az storage blob download \ --container-name mycontainer \ --name readme.txt \ --file ./downloaded.md \ --connection-string "$CONN" # Delete a blob az storage blob delete \ --container-name mycontainer \ --name readme.txt \ --connection-string "$CONN" ``` -------------------------------- ### Create Table Source: https://context7.com/arafato/azurite/llms.txt Creates a new table within the emulated Table Storage. ```APIDOC ## POST /{account}/Tables ### Description Creates a new table in the emulated Table Storage. ### Method POST ### Endpoint `/{account}/Tables` ### Parameters #### Request Body - **TableName** (string) - Required - The name of the table to create. ### Request Example ```bash curl -X POST \ -H "Content-Type: application/json" \ -H "Accept: application/json;odata=minimalmetadata" \ -d '{"TableName": "Employees"}' \ "http://127.0.0.1:10002/devstoreaccount1/Tables" ``` ### Response #### Success Response (201) - **TableName** (string) - The name of the created table. ``` -------------------------------- ### Query Tables Source: https://context7.com/arafato/azurite/llms.txt Lists all tables in the emulated Table Storage account. ```APIDOC ## GET /{account}/Tables ### Description Lists all tables in the emulated account. ### Method GET ### Endpoint `/{account}/Tables` ### Request Example ```bash curl -H "Accept: application/json;odata=minimalmetadata" \ "http://127.0.0.1:10002/devstoreaccount1/Tables" ``` ### Response #### Success Response - **value** (array) - An array of table objects, each containing a `TableName` property. ``` -------------------------------- ### Delete Message Source: https://context7.com/arafato/azurite/llms.txt Deletes a specific message from a queue after processing. Requires the messageId and popReceipt obtained from a prior Get Messages call. ```bash curl -X DELETE \ "http://127.0.0.1:10001/devstoreaccount1/myqueue/messages/?popreceipt=" # Expected: 204 ``` -------------------------------- ### List Queues Source: https://context7.com/arafato/azurite/llms.txt Retrieves a list of all queues within the emulated storage account. Useful for inventorying queues. ```bash curl "http://127.0.0.1:10001/devstoreaccount1?comp=list" ``` -------------------------------- ### Multi-block Upload (Put Block / Put Block List) Source: https://context7.com/arafato/azurite/llms.txt Upload a blob in multiple blocks by staging each block with a unique `blockid`, then committing them using an XML block list. Each stage returns 201 Created. ```bash # Stage block 1 curl -X PUT \ -H "Content-Type: application/octet-stream" \ -d "BLOCK_DATA_1" \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer/bigfile.bin?comp=block&blockid=AAAAAA==" # Stage block 2 curl -X PUT \ -H "Content-Type: application/octet-stream" \ -d "BLOCK_DATA_2" \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer/bigfile.bin?comp=block&blockid=BBBBBB==" # Commit the block list curl -X PUT \ -H "Content-Type: application/xml" \ -d ' AAAAAA== BBBBBB== ' \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer/bigfile.bin?comp=blocklist" # Expected: 201 # Get the block list curl "http://127.0.0.1:10000/devstoreaccount1/mycontainer/bigfile.bin?comp=blocklist&blocklisttype=all" ``` -------------------------------- ### Get Specific Byte Range of Blob Source: https://context7.com/arafato/azurite/llms.txt Retrieves a specific byte range from a blob's content using the 'x-ms-range' header. ```bash curl -H "x-ms-range: bytes=0-4" \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer/hello.txt" ``` -------------------------------- ### Acquire, Release, and Break Blob/Container Leases Source: https://context7.com/arafato/azurite/llms.txt Use these commands to manage distributed locks on blobs or containers. Specify lease duration for blobs and use -1 for infinite leases on containers. Ensure you replace placeholders like . ```bash # Acquire a 30-second lease on a blob curl -s -D - \ -X PUT \ -H "x-ms-lease-action: acquire" \ -H "x-ms-lease-duration: 30" \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer/locked.txt?comp=lease" # Expected: 201 # Response header: x-ms-lease-id: ``` ```bash # Release a lease (replace with the acquired UUID) curl -X PUT \ -H "x-ms-lease-action: release" \ -H "x-ms-lease-id: " \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer/locked.txt?comp=lease" # Expected: 200 ``` ```bash # Acquire an infinite lease on a container curl -X PUT \ -H "x-ms-lease-action: acquire" \ -H "x-ms-lease-duration: -1" \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer?restype=container&comp=lease" # Expected: 201 ``` -------------------------------- ### Get Blob Metadata Source: https://context7.com/arafato/azurite/llms.txt Retrieves custom metadata associated with a blob using a HEAD request with the '?comp=metadata' query parameter. Metadata is returned in response headers. ```bash curl -sI \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer/report.pdf?comp=metadata" ``` -------------------------------- ### Set Blob Metadata Source: https://context7.com/arafato/azurite/llms.txt Attaches custom metadata key-value pairs to a blob using 'x-ms-meta-*' headers. The operation returns '200 OK' on success. ```bash curl -s -o /dev/null -w "%{http_code}" \ -X PUT \ -H "x-ms-meta-author: johndoe" \ -H "x-ms-meta-category: reports" \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer/report.pdf?comp=metadata" ``` -------------------------------- ### Insert Entity into Table Source: https://context7.com/arafato/azurite/llms.txt Inserts a new entity into a table. Requires `PartitionKey` and `RowKey` for unique identification. ```bash curl -X POST \ -H "Content-Type: application/json" \ -H "Accept: application/json;odata=minimalmetadata" \ -d '{ "PartitionKey": "Engineering", "RowKey": "emp001", "Name": "Alice", "Department": "Backend", "Salary": 95000 }' \ "http://127.0.0.1:10002/devstoreaccount1/Employees" # Expected: 201 ``` -------------------------------- ### Create Blob Container Source: https://context7.com/arafato/azurite/llms.txt Use PUT to create a new container. A 201 status code indicates success. A 409 is returned if the container already exists. ```bash curl -s -o /dev/null -w "%{http_code}" \ -X PUT \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer?restype=container" # Expected: 201 ``` ```bash curl -X PUT \ -H "x-ms-blob-public-access: blob" \ "http://127.0.0.1:10000/devstoreaccount1/publiccontainer?restype=container" # Expected: 201 ``` ```bash curl -s -o /dev/null -w "%{http_code}" \ -X PUT \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer?restype=container" # Expected: 409 ``` -------------------------------- ### Upload Block Blob Source: https://context7.com/arafato/azurite/llms.txt Use PUT with `x-ms-blob-type: BlockBlob` to upload a block blob. Content-Type should be set appropriately. A 201 Created is returned on success. Uploads fail with 404 if the container does not exist. ```bash # Upload a text block blob curl -s -o /dev/null -w "%{http_code}" \ -X PUT \ -H "x-ms-blob-type: BlockBlob" \ -H "Content-Type: text/plain" \ -d "Hello, Azurite!" \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer/hello.txt" # Expected: 201 ``` ```bash # Upload binary data from a file curl -X PUT \ -H "x-ms-blob-type: BlockBlob" \ -H "Content-Type: application/octet-stream" \ --data-binary @/path/to/file.bin \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer/file.bin" # Expected: 201 ``` ```bash # Upload fails if container doesn't exist curl -s -o /dev/null -w "%{http_code}" \ -X PUT \ -H "x-ms-blob-type: BlockBlob" \ -d "data" \ "http://127.0.0.1:10000/devstoreaccount1/nosuchcontainer/blob.txt" # Expected: 404 ``` -------------------------------- ### Create and Append to Append Blob Source: https://context7.com/arafato/azurite/llms.txt Create an empty append blob using PUT with `x-ms-blob-type: AppendBlob`. Append data using PUT with `comp=appendblock`. Creating an append blob with body content fails with 409. ```bash # Create an empty append blob curl -s -o /dev/null -w "%{http_code}" \ -X PUT \ -H "x-ms-blob-type: AppendBlob" \ -H "Content-Type: application/octet-stream" \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer/log.txt" # Expected: 201 ``` ```bash # Append data to the blob curl -s -o /dev/null -w "%{http_code}" \ -X PUT \ -H "x-ms-blob-type: AppendBlob" \ -H "Content-Type: application/octet-stream" \ -d "Log line 1\n" \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer/log.txt?comp=appendblock" # Expected: 201 ``` ```bash # Creating an append blob with body content fails curl -s -o /dev/null -w "%{http_code}" \ -X PUT \ -H "x-ms-blob-type: AppendBlob" \ -d "non-empty" \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer/log.txt" # Expected: 409 ``` -------------------------------- ### Create Container Source: https://context7.com/arafato/azurite/llms.txt Creates a new blob container in the storage account. Returns 201 on success, 409 if the container already exists. ```APIDOC ## Create Container ### Description Creates a new blob container. Returns `201 Created` on success, or `409 Conflict` if the container already exists. ### Method PUT ### Endpoint `/{account}/{container}?restype=container` ### Request Example ```bash curl -s -o /dev/null -w "%{http_code}" \ -X PUT \ "http://127.0.0.1:10000/devstoreaccount1/mycontainer?restype=container" ``` ### Response Example ``` 201 ``` ```