How to Scan a Google Cloud Platform (GCP) Storage File in Node.JS

With the ever-changing and evolving threats to cloud storage, it’s vital that you take steps to ensure your data is safe. If you have a virus that is undetected, there’s a chance it could seep into other critical applications, or even be downloaded by users, which would be detrimental to both your business and the users. The following API allows you to be proactive by scanning your GCP file in Node.JS for multiple threats at one time.

Image for post
Image for post

To begin the process, you can run this command to install the SDK:

npm install cloudmersive-virus-api-client –save

Or, add this snippet to your package.json:

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

Then, we are calling the function with the following code; please note you will need the bucket name, object/file name, and JSON credential file as well.

var CloudmersiveVirusApiClient = require('cloudmersive-virus-api-client');
var defaultClient = CloudmersiveVirusApiClient.ApiClient.instance;

In no time at all, this will return a response which will specify the virus name (if detected) or that your GCP file is currently out of harm’s way. In order to retrieve the free API Key, visit the Cloudmersive website; this will give you access to 800 monthly calls across our portfolio of APIs.

Written by

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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store