How to Scan an Azure Blob for Viruses in Node.JS

Cloudmersive
2 min readJan 7, 2021

--

When you’ve stored valuable content in an Azure Blob, you want to ensure that it’s free from threats such as viruses, trojans, malware, spyware, and ransomware. Fortunately, we’ve got an API for that! The following API in Node.JS leverages continuously updated signatures to scan the contents of a single Azure Blob for multiple threats, so you can be confident that your storage is safe.

To install the SDK, you can run this command:

npm install cloudmersive-virus-api-client --save

Or, add this snippet to your package.json:

  "dependencies": {
"cloudmersive-virus-api-client": "^1.1.7"
}

Then, you can call the function using the following code:

var CloudmersiveVirusApiClient = require('cloudmersive-virus-api-client');
var defaultClient = CloudmersiveVirusApiClient.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';
var apiInstance = new CloudmersiveVirusApiClient.ScanCloudStorageApi();var connectionString = "connectionString_example"; // String | Connection string for the Azure Blob Storage Account; you can get this connection string from the Access Keys tab of the Storage Account blade in the Azure Portal.var containerName = "containerName_example"; // String | Name of the Blob container within the Azure Blob Storage accountvar blobPath = "blobPath_example"; // String | Path to the blob within the container, such as 'hello.pdf' or '/folder/subfolder/world.pdf'var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.scanCloudStorageScanAzureBlob(connectionString, containerName, blobPath, callback);

This will provide you with the results of the scan instantly! Our rapid response time ensures you have the information to rest easy, or if a virus is identified, address the issue swiftly and efficiently.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet