From 6625662d31f1ea71c5733a766caf3dcf147b2830 Mon Sep 17 00:00:00 2001 From: Devansh Shah Date: Fri, 2 Oct 2020 13:05:18 -0400 Subject: [PATCH 1/2] Update package.json added path dep --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 868fc9b..c669712 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "homepage": "https://github.com/hyunjiLeeTech/URL-FI#readme", "dependencies": { "colors": "^1.4.0", + "path": "^0.12.7", "request": "^2.88.2" } } From 171aa74755e1c97e9a4853c1e8f37afd47d79047 Mon Sep 17 00:00:00 2001 From: Devansh Shah Date: Fri, 2 Oct 2020 13:07:53 -0400 Subject: [PATCH 2/2] Update index.js added the feature to process multiple file types instead of just one --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 62649d7..24abaa1 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ #!/usr/bin/env node const request = require("request"); +const path = require("path"); const colors = require("colors"); const fs = require("fs"); const regex = /(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g @@ -42,7 +43,7 @@ for (let i = 2; i < process.argv.length; i++) { for (let i = 2; i < process.argv.length; i++) { let arg = process.argv[i]; if (!arg.startsWith("-")) { - fs.readFile(arg, 'utf8', function (err, data) { + fs.readFile(path.normalize(arg), 'utf8', function (err, data) { if (err) { console.log(colors.red(err)); process.exit(1); @@ -79,4 +80,4 @@ function checkUrl(url) { console.log(colors.grey(`[UNKNOWN] [${res.statusCode}] ${url}`)) } }) -} \ No newline at end of file +}