{"id":16896642,"url":"https://github.com/ninglin-p/clamdjs","last_synced_at":"2025-04-11T13:41:24.449Z","repository":{"id":43788916,"uuid":"142785830","full_name":"NingLin-P/clamdjs","owner":"NingLin-P","description":"A ClamAV client on node.js","archived":false,"fork":false,"pushed_at":"2023-12-14T13:50:24.000Z","size":12,"stargazers_count":7,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-03-14T19:18:13.569Z","etag":null,"topics":["clamav-client","clamdscan","node-module"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NingLin-P.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-29T18:30:12.000Z","updated_at":"2024-06-18T21:33:55.469Z","dependencies_parsed_at":"2024-06-18T21:33:54.141Z","dependency_job_id":"369f0bd1-e95a-4f89-93ca-909cc5bc7e59","html_url":"https://github.com/NingLin-P/clamdjs","commit_stats":{"total_commits":9,"total_committers":3,"mean_commits":3.0,"dds":0.2222222222222222,"last_synced_commit":"bb40bea5396c4e9e74d146cdfc905b1cd1e29302"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NingLin-P%2Fclamdjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NingLin-P%2Fclamdjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NingLin-P%2Fclamdjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NingLin-P%2Fclamdjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NingLin-P","download_url":"https://codeload.github.com/NingLin-P/clamdjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239666549,"owners_count":19677161,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clamav-client","clamdscan","node-module"],"created_at":"2024-10-13T17:32:26.992Z","updated_at":"2025-02-19T13:32:16.513Z","avatar_url":"https://github.com/NingLin-P.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Clamdjs\n===\nA ClamAV client on node.js\n---\n\nThe library will uses TCP socket communicate with `clamd` (ClamAV daemon) through some commands\n\nClamd protocol is explained here:\nhttp://linux.die.net/man/8/clamd\n\n----\n## Provide\n- Scan `Stream` and `Buffer`\n- Scan `local File` and `local Directory`\n- Check the daemon’s state\n- Get the version detail of the running ClamAV program\n\n----\n## Installation\n\n```sh\n$ npm install clamdjs\n```\n----\n### API\n```js\nconst clamd = require('clamdjs')\nconst scanner = clamd.createScanner(host, port)\n```\n## scanner.scanStream(stream, [timeout])\n```js\nscanner.scanStream(stream, 3000)\n       .then(function (reply) {\n           console.log(reply) \n           // print some thing like\n           // 'stream: OK', if not infected\n           // `stream: ${virus} FOUND`, if infected\n       })\n       .catch(handler)\n```\n**Returns a promise, which will resovle with the reply from the ClamAV server**\n- `stream (Object)` - read stream object \n- `timeout (Number)` - use to set the socket's timeout option, default `5000`\n\n## scanner.scanBuffer(buffer, [timeout], [chunkSize])\n```js\nscanner.scanBuffer(buffer, 3000, 1024 * 1024)\n       .then(function (reply) {\n           console.log(reply) \n           // print some thing like\n           // 'stream: OK', if not infected\n           // `stream: ${virus} FOUND`, if infected\n       })\n       .catch(handler)\n```\n**Returns a promise, which will resovle with the reply from the ClamAV server**\n- `buffer (Object)`\n- `timeout (Number)` - use to set the socket's timeout option, default `5000`\n- `chunkSize (Number)` - size of the chunk, which will send to ClamAV server, default `64 * 1024`\n\n## scanner.scanFile(path, [timeout], [chunkSize])\n```js\nscanner.scanFile(path, 3000, 1024 * 1024)\n       .then(function (reply) {\n           console.log(reply) \n           // print some thing like\n           // 'stream: OK', if not infected\n           // `stream: ${virus} FOUND`, if infected\n       })\n       .catch(handler)\n```\n**Returns a promise, which will resovle with the reply from the ClamAV server**\n- `path (String)` - file path, will be pass to path.normalize() first\n- `timeout (Number)` - use to set the socket's timeout option, default `5000`\n- `chunkSize (Number)` - size of the chunk, which will send to ClamAV server, default `64 * 1024`\n\n## scanner.scanDirectory(rootPath, [options])\n```js\nlet optins = {\n    timeout: 5000,\n    chunkSize: 64 * 1024,\n    scanningFile: 10,\n    detail: true,\n    cont: true\n}\nscanner.scanDirectory(rootPath, options)\n       .then(function (reply) {\n           console.log(reply) \n           /* print some thing like\n           {\n                ScannedFiles: 11,\n                Infected: 3,\n                EncounterError: 1,\n                Result:[...]\n           }\n           */\n       })\n       .catch(handler)\n```\n**Returns a promise, which will resovle with a object which contained the scan summary**\n\n- `rootPath (String)` - directory path, will be pass to path.normalize() first\n- `optinns (Object)`\n  - `timeout (Number)` - use to set the socket's timeout option, default `5000`\n  - `chunkSize (Number)` - size of the chunk, which will send to ClamAV server, default `64 * 1024`\n  - `scanningFile (Number)` - the number of file will scan concurrently, should not be greater than the file table limit in node.js, default `10`\n  - `detail (Boolean)` - if `true` the output object will contain the scan summary and all scaned files's scan result no matter infected or not, if `false` the output object will contain the scan summary and scan result of infected files and file that encountered error when scanning, default `true`\n  - `cont (Boolean)` - when scanning a path and an Error throw, if `true`, will move on to scan next path, if `false`, will stop scanning and return a rejected promise, default `true`\n\n## clamd.ping()\n**Returns true if clamd daemon alive**\n\n## clamd.version()\n**Returns clamav version information**\n\n## clamd.isCleanReply(reply)\n**Returns true if the reply of a scan means OK, false if means infected**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fninglin-p%2Fclamdjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fninglin-p%2Fclamdjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fninglin-p%2Fclamdjs/lists"}