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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@anamico/musselav

v1.0.6

Published

![musselAV](https://github.com/TrendAndrew/musselav/blob/main/img/musselAV.png)

Downloads

8

Readme

@anamico/musselav

musselAV

What is it?

musselAV is a simple javascript clamAV server emulator library.

It's been designed to essentially impersonate a clamAV TCP server for simple file submission for AV Scanning.

usage

add the library

npm i --save @anamico/musselav

then utilise the server component in your code

const musselAV = require('@anamico/musselav');

const customAVScanner = new /*<your custom scanner>*/;

const dataHandler = async (session, chunk) => {
    // handle each chunk of file data as it is received.
    // Recommend just piping it through to your backend process
    // rather than assembling and staging the whole file.
    // eg:
    customAVScanner.addChunk(chunk);
};

const endHandler = async (session) => {
    // process the file, get your answer and then respond to the caller
    const result = await customAVScanner.getResult(); // or whatever you need to call

    // via musselAV
    const response = {
        is_infected: result.isInfected,
        viruses: result.viruses
    }
    // this will automatically stringify the json response
    session.respond(response);
};

const server = musselAV.newServer({
    // port: 3310,              // default
    // sessionHandler: null,    // default
    dataHandler: dataHandler,
    endHandler: endHandler
});

server.start().then(({ port }) => {
    console.log('example MusselAV server running on localhost:3310');
});

Obviously should run your resulting server with pm2 or something similar to make sure it's always up and running. Should work fine in a cluster behind a session aware load balancer for servicing a lot of requests.

Note that clamAV has a standard max file size, and even by configuration it cannot get above 4Gb, so probably do the same check on your end if you want to remain functionally identical. Or use bigger files if you can handle them.

example

In the example folder, there is an example server and an example client that will submit a file to the server.

cd example

# start the example server
node exampleServer.js

# and run the client in a different terminal
node exampleClient.js

The example server is just doing a basic "echo" response that reports a virus on any file you submit. You need to implement the routing to a different AV scanner, sandbox or whatever you are using to implement the AV scan.

used by

TrendyClam - A drop in replacement for clamAV to use Trend Micro enterprise strength scanning instead. Using this library it just masquerades as a clamAV server for simple swap and replacement with no other changes.