Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clamscan

Package Overview
Dependencies
Maintainers
2
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clamscan - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

2

package.json
{
"name": "clamscan",
"version": "1.0.3",
"version": "1.0.4",
"author": "Kyle Farris <kfarris@chomponllc.com> (http://chomponllc.com)",

@@ -5,0 +5,0 @@ "description": "Use Node JS to scan files on your server with ClamAV's clamscan/clamdscan binary or via TCP to a remote server or local UNIX Domain socket. This is especially useful for scanning uploaded files provided by un-trusted sources.",

@@ -600,7 +600,7 @@ [![NPM Version][npm-version-image]][npm-url] [![NPM Downloads][npm-downloads-image]][npm-url] [![Node.js Version][node-image]][node-url] [![Build Status][travis-image]][travis-url]

Typically, a file is uploaded to the local filesytem and then subsequently scanned. In this case, you have to wait for the upload to complete _and then_ for the scan to complete. This method could theoretically speed up user uploads intended to be scanned by up to 2x because the files are simultaneously scanned and written to any WriteableStream output (examples: filesystem, S3, gzip, etc...).
In typical, non-passthrough setups, a file is uploaded to the local filesytem and then subsequently scanned. With that setup, you have to wait for the upload to complete _and then wait again_ for the scan to complete. Using this module's `passthrough` method, you could theoretically speed up user uploads intended to be scanned by up to 2x because the files are simultaneously scanned and written to any WriteableStream output (examples: filesystem, S3, gzip, etc...).
As for the theoretical gains, your mileage my vary and I'd love to hear feedback on this to see where things can still be improved.
As for these theoretical gains, your mileage my vary and I'd love to hear feedback on this to see where things can still be improved.
Pleae note that this method is different than all the others in that it returns a PassthroughStream object and does not support a Promise or Callback API. This makes sense once you see the example below (a practical working example can be found in the examples directory of this module):
Please note that this method is different than all the others in that it returns a PassthroughStream object and does not support a Promise or Callback API. This makes sense once you see the example below (a practical working example can be found in the examples directory of this module):

@@ -648,6 +648,5 @@ ### Example

// NOTE: no errors are being handled in this example but standard errors will be emitted according to NodeJS's Stream specifications
// NOTE: no errors (or other events) are being handled in this example but standard errors will be emitted according to NodeJS's Stream specifications
```
Just keep in mind that some of the nice validation that happens on instantiation won't happen if it's done this way. Of course, you could also just create a new instance with different a different initial configuration.

@@ -654,0 +653,0 @@ # Contribute

@@ -332,3 +332,3 @@ const fs = require('fs');

});
// TODO: earlier versions of Node (<=10.0.0) have no public way of determining the timeout

@@ -617,2 +617,21 @@ it.skip('should have the same timeout as the one configured through this module', async () => {

});
// it('should respond with properties: "file" (string), "is_infected" (boolean), and "viruses" (array) when scanning with remote host', async () => {
// const clamdscan_options = Object.assign({}, config.clamdscan, {active: true, socket: false, host: 'localhost', port: 3310});
// const options = Object.assign({}, config, {clamdscan: clamdscan_options});
//
// try {
// clamscan = await reset_clam(options);
// const {viruses, is_infected, file} = await clamscan.is_infected(good_scan_file);
// expect(viruses).to.be.an('array');
// expect(viruses).to.have.length(0);
// expect(is_infected).to.be.a('boolean');
// expect(is_infected).to.eql(false);
// expect(viruses).to.be.an('array');
// expect(viruses).to.have.length(0);
// } catch (e) {
// // console.error("Annoying error: ", e);
// throw e;
// }
// });
});

@@ -619,0 +638,0 @@ });

@@ -22,3 +22,3 @@ const fs = require('fs');

clamdscan: {
socket: '/var/run/clamav/clamd.ctl', // required for testing (change for your system) - can be set to null
socket: '/var/run/clamav/clamd.ctl', // required for testing (change for your system) - can be set to null
host: '127.0.0.1', // required for testing (change for your system) - can be set to null

@@ -25,0 +25,0 @@ port: 3310, // required for testing (change for your system) - can be set to null

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc