diff --git a/changelog.md b/changelog.md index ae9a33b..45b59c0 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2025-02-05 - 1.3.0 - feat(ClamAvService) +Add support for enhanced streaming methods in ClamAvService + +- Add methods to ClamAvService: scanStream for NodeJS streams, scanWebStream for Web API streams, and scanFileFromWebAsStream for fetching and scanning files from URLs. +- Update usage examples in readme for new streaming methods. + ## 2025-02-05 - 1.2.0 - feat(ClamAvService) Add stream scanning methods to ClamAvService diff --git a/readme.md b/readme.md index c0a0f64..4baf024 100644 --- a/readme.md +++ b/readme.md @@ -96,10 +96,11 @@ main().catch(console.error); ### Streaming Scanning -The `ClamAvService` now also supports scanning streams directly using two new methods: +The `ClamAvService` supports scanning both NodeJS streams and Web API streams using three specialized methods: -- `scanStream(stream: NodeJS.ReadableStream)`: Scans a NodeJS stream (local file streams, network streams, etc.) -- `scanWebStream(url: string)`: Fetches a web resource as a stream and scans it +- `scanStream(stream: NodeJS.ReadableStream)`: Scans any NodeJS readable stream (files, network, etc.) +- `scanWebStream(webstream: ReadableStream)`: Scans a Web API ReadableStream +- `scanFileFromWebAsStream(url: string)`: Fetches and scans a file from a URL using NodeJS http/https #### Example Usage @@ -110,14 +111,21 @@ import { createReadStream } from 'fs'; async function main() { const clamService = new ClamAvService('127.0.0.1', 3310); - // Example 1: Scanning a local file stream + // Example 1: Scanning a local file stream (NodeJS) const fileStream = createReadStream('path/to/local/file'); const streamResult = await clamService.scanStream(fileStream); console.log('Stream Scan Result:', streamResult); - // Example 2: Scanning a web resource - const webResult = await clamService.scanWebStream('http://example.com/file'); + // Example 2: Scanning a web resource using NodeJS http/https + const webResult = await clamService.scanFileFromWebAsStream('http://example.com/file'); console.log('Web Stream Scan Result:', webResult); + + // Example 3: Scanning a Web API ReadableStream + const response = await fetch('http://example.com/file'); + if (response.body) { + const webStreamResult = await clamService.scanWebStream(response.body); + console.log('Web Stream API Scan Result:', webStreamResult); + } } main().catch(console.error); diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 41a31dc..73bcf31 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartantivirus', - version: '1.2.0', + version: '1.3.0', description: 'A Node.js package for integrating antivirus scanning capabilities using ClamAV, allowing in-memory file and data scanning.' }