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

npm install cloudmersive-virus-api-client -–save
  "dependencies": {
"cloudmersive-virus-api-client": "^1.1.7"
}
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 bucketName = "bucketName_example"; // String | Name of the bucket in Google Cloud Storagevar objectName = "objectName_example"; // String | Name of the object or file in Google Cloud Storagevar jsonCredentialFile = Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer); // File | Service Account credential for Google Cloud stored in a JSON file.var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.scanCloudStorageScanGcpStorageFile(bucketName, objectName, jsonCredentialFile, callback);

--

--

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