Skip to content

Commit

Permalink
Explain the uses of certain parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
denizariyan committed Apr 30, 2022
1 parent 73439df commit 89be336
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
"md5": "^2.3.0",
"usb-detection": "^4.14.1",
"uuid": "^8.3.2"
}
},
"devDependencies": {}
}
12 changes: 6 additions & 6 deletions scripts/scan.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async function sendStatus(status) {
/**
* Scan the given directory path for infected files
* Call the result sending function to send the results to the frontend API
* @param {string} path
* @param {string} path - Path for the directory to be scanned
*/
async function scanDirectory(path) {
const clamscan = await new NodeClam().init(options);
Expand All @@ -90,7 +90,7 @@ async function scanDirectory(path) {

/**
* Add the ability to wait in parts of the code without blocking rest of the program
* @param {integer} ms
* @param {integer} ms - Time to wait
*/
function sleep(ms) {
return new Promise((resolve) => {
Expand All @@ -101,7 +101,7 @@ function sleep(ms) {
/**
* Parses the scanner log file to get detailed information about infected files
* Takes a keyword parameter which has the path of a given infected file
* @param {string} keyword
* @param {string} keyword - Keyword that we are looking for
*/
async function parseLog(keyword) {
let badFiles = [];
Expand All @@ -124,7 +124,7 @@ async function parseLog(keyword) {

/**
* Get the mounting point for a given serial number
* @param {string} serialNumber
* @param {string} serialNumber - Serial number of the USB device, can include chars and integers
*/
async function getMountPoint(serialNumber) {
sendStatus("Accessing the USB Device...");
Expand All @@ -136,7 +136,7 @@ async function getMountPoint(serialNumber) {
/**
* Mount the given device to a auto-generated dir under the
* products own mounting directory
* @param {string} source
* @param {string} source - source for the device to be mounted
*/
function mount(source) {
let uuid = uuidv4();
Expand All @@ -149,7 +149,7 @@ function mount(source) {
/**
* Enable watcher to detect newly plugged USB devices
* Calls the mounting point getter function when a new device is detected
* @param {string} 'add'
* @param {string} 'add' - Const string
*/
USBWatch.on('add', function (device) {
getMountPoint(device.serialNumber);
Expand Down

0 comments on commit 89be336

Please sign in to comment.