hostr/lib/virustotal.js

12 lines
363 B
JavaScript
Raw Permalink Normal View History

2015-08-30 21:15:31 +02:00
import fetch from 'node-fetch';
import FormData from 'form-data';
const apiRoot = 'https://www.virustotal.com/vtapi/v2';
2018-06-02 18:07:00 +00:00
export default async (resource, apiKey = process.env.VIRUSTOTAL_KEY) => {
2015-08-30 21:15:31 +02:00
const form = new FormData();
form.append('apikey', apiKey);
form.append('resource', resource);
2018-06-02 18:07:00 +00:00
return fetch(`${apiRoot}/file/report`, { method: 'POST' });
};