How to virus scan a Flash FLV or SWF in Javascript

Cloudmersive
2 min readMar 18, 2020

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="https://cdn.cloudmersive.com/jsclient/cloudmersive-virus-client.js"></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.

--

--

Cloudmersive

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