npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@attachmentav/virus-scan-sdk-ts

v0.6.0

Published

An SDK to integrate virus and malware scan capabilities into JavaScript / TypeScript applications. Scan files for viruses, trojans, and other kinds of malware with attachmentAV powered by Sophos.

Readme

attachmentav-sdk-ts

An SDK to integrate virus and malware scan capabilities into JavaScript / TypeScript applications. Scan files for viruses, trojans, and other kinds of malware with attachmentAV powered by Sophos.

Getting started

First, install the module.

npm i @attachmentav/virus-scan-sdk-ts

Second, get an API key by subscribing to the attachmentAV API (SaaS).

Third, send a scan request. Make sure to replace the API_KEY_PLACEHOLDER placeholder.

import { AttachmentAVApi, Configuration } from '@attachmentav/virus-scan-sdk-js';
import * as fs from 'fs';

const config = new Configuration({
  apiKey: '<API_KEY_PLACEHOLDER>'
});

const api = new AttachmentAVApi(config);

async function scanFile() {
  const fileBuffer = fs.readFileSync('./demo.txt');
  const blob = new Blob([fileBuffer]);
  const scanResult = await api.scanSyncBinaryPost({
    body: blob
  });
  console.log('Sync binary scan result:', scanResult);
}

scanFile();

The request returns a scan result similar to the following example.

Sync binary scan result: {
  status: 'clean',
  finding: undefined,
  size: 8100,
  realfiletype: 'ASCII text / 8-bit Unicode Transformation Format'
}

What is attachmentAV?

attachmentAV offers antivirus for SaaS and cloud platforms. Scan your files and attachments stored in the cloud for viruses, worms, and trojans. attachmentAV detects malware in real-time. Supports Amazon S3, Atlassian, Cloudflare R2, Salesforce, WordPress, and more.

The attachmentAV Virus and Malware Scan API provides a REST API that allows you to integrate malware scans into your application. The solution comes in two variants:

attachmentAV raises the bar for information security. Our solution is ISO 27001 certified and GDPR compliant. We are establishing, implementing, maintaining, and continually improving an information security management system (ISMS). Sensitive data is encrypted in transit as well as at rest and deleted immediately after processing. More than 1,000 customers trust our malware protection technology.

Install SDK

npm i @attachmentav/virus-scan-sdk-ts

Configure SDK

Configure SDK (SaaS)

An active subscription and API key are required. Replace <API_KEY_PLACEHOLDER> with the API key.

import { AttachmentAVApi, Configuration } from '@attachmentav/virus-scan-sdk-ts';

const config = new Configuration({
  apiKey: '<API_KEY_PLACEHOLDER>',
});

const api = new AttachmentAVApi(config);

Configure SDK (self-hosted on AWS)

When following the setup guide, you specified the ApiKeys parameter for the CloudFormation stack. Replace <API_KEY_PLACEHOLDER> with one of those keys.

import { AttachmentAVApi, Configuration } from '@attachmentav/virus-scan-sdk-ts';

const config = new Configuration({
  apiKey: '<API_KEY_PLACEHOLDER>',
  basePath: 'https://example.com/api/v1'
});

const api = new AttachmentAVApi(config);

Examples

Sync Scan: File

Send a file to the attachmentAV Virus Scan API and process the scan result.

See ScanResult for details.

The maximum file size is 10 MB. The request timeout is 60 seconds.

const fileBuffer = fs.readFileSync('./README.md');
const blob = new Blob([fileBuffer]);

const scanResult = await api.scanSyncBinaryPost({
  body: blob
});
console.log('Sync binary scan result:', scanResult);

Sync Scan: Download

Send a URL to the attachmentAV Virus Scan API. attachmentAV will download the file and return the scan result immediately.

See SyncDownloadScanRequest and ScanResult for details.

The maximum file size is 10 MB. The request timeout is 60 seconds.

const scanResult = await api.scanSyncDownloadPost({
  syncDownloadScanRequest: {
    downloadUrl: 'https://example.com/demo.txt'
  }
});
console.log('Sync download scan result:', scanResult);

Sync Scan: S3

Send an S3 bucket name and object key to the attachmentAV Virus Scan API. attachmentAV will download the file and return the scan result immediately.

See SyncS3ScanRequest and ScanResult for details.

The maximum file size is 10 MB. The request timeout is 60 seconds.

A bucket policy is required to grant attachmentAV access to private S3 objects.

const scanResult = await api.scanSyncS3Post({
  syncS3ScanRequest: {
    bucket: 'example-bucket',
    key: 'demo.txt',
  }
});
console.log('Sync S3 scan result:', scanResult);

Async Scan: Download

Send a URL to the attachmentAV Virus Scan API. attachmentAV will send the scan result to the callback URL. See callback URL for details.

See AsyncDownloadScanRequest for details.

The maximum file size is 5 GB. The request timeout is 29 seconds; the asynchronous scan job is not affected by this limit.

Not supported by attachmentAV Virus Scan API (Self-hosted on AWS) yet. Contact [email protected] to let us know, in case you need this feature.

await api.scanAsyncDownloadPost({
  asyncDownloadScanRequest: {
    downloadUrl: 'https://example.com/demo.txt',
    callbackUrl: 'https://example.com/callback'
  }
});
console.log('Async download scan request submitted');

Async Scan: S3

Send an S3 bucket name and object key to the attachmentAV Virus Scan API. attachmentAV will send the scan result to the callback URL. See callback URL for details.

See AsyncS3ScanRequest for details.

The maximum file size is 5 GB. The request timeout is 29 seconds; the asynchronous scan job is not affected by this limit.

A bucket policy is required to grant attachmentAV access to private S3 objects.

Not supported by attachmentAV Virus Scan API (Self-hosted on AWS) yet. Contact [email protected] to let us know, in case you need this feature.

await api.scanAsyncS3Post({
  asyncS3ScanRequest: {
    bucket: 'example-bucket',
    key: 'demo.txt',
    callbackUrl: 'https://example.com/callback'
  }
});
console.log('Async S3 scan request submitted');

Model

For more details about the data model, please refer to the following pages.

Need help?

Do you need any help to get started with attachmentAV? [email protected].