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 +} 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" } }