How to virus scan a Flash FLV or SWF in Javascript

Flash files can be a double edged sword, having great potential for both excellent content and also malware threats. Some good built-in virus protection can really save your bacon. What if I told you it could all be set up in a couple minutes? Stay tuned.

First we are going to install our API client with the insertion of this script tag into our page between the head tags.

<script src=""></script>

Now call our virus scan function with this lovely bit of code here.

var CloudmersiveVirusApiClient = require('cloudmersive-virus-api-client');var defaultClient = CloudmersiveVirusApiClient.ApiClient.instance;// Configure API key authorization: Apikeyvar Apikey = defaultClient.authentications['Apikey'];Apikey.apiKey = 'YOUR API KEY';// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//Apikey.apiKeyPrefix = 'Token';var apiInstance = new CloudmersiveVirusApiClient.ScanApi();var inputFile = "/path/to/file"; // File | Input file to perform the operation on.var callback = function(error, data, response) {if (error) {console.error(error);} else {console.log('API called successfully. Returned data: ' + data);}};apiInstance.scanFile(inputFile, callback);

And that wraps it right up. Any file you input will be scanned, with potential threats being returned by name from our database of 17 million plus definitions.

Image for post

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