Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed option is not defined in saveFile() #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async function runSpeedTest(option){
if(option.save === true){
try {
await checkDirectorySync(option.saveDir);
await saveFile(option.saveDir,result.result,'json');
await saveFile(option.saveDir,result.result,'json',option.quiet);
} catch (err) {
console.error(err)
}
Expand All @@ -114,7 +114,7 @@ async function runSpeedTest(option){
if(option.save === true){
try {
checkDirectorySync(option.saveDir);
await saveFile(option.saveDir,result.result,'csv');
await saveFile(option.saveDir,result.result,'csv',option.quiet);
} catch (err) {
console.error(err)
}
Expand Down Expand Up @@ -223,7 +223,7 @@ async function launch (puppeteer) {
}
}

async function saveFile(dirpath,result,type){
async function saveFile(dirpath,result,type,quiet){
let filename;
let date = new Date().getTime();
if(type === 'csv'){
Expand All @@ -233,8 +233,8 @@ async function launch (puppeteer) {

fs.writeFile(filename, csv, (err) => {
if (err) throw err;
if (option.quiet == undefined) {
console.log("The file was successfully saved!", filename);
if (quiet == undefined) {
console.log("The file was successfully saved!", filename)
}
});

Expand All @@ -244,8 +244,8 @@ async function launch (puppeteer) {
filename = dirpath+path.sep+'result-'+date+".json";
fs.writeFile(filename, JSON.stringify(result), (err) => {
if (err) throw err;
if (option.quiet == undefined) {
console.log("The file was successfully saved!", filename);
if (quiet == undefined) {
console.log("The file was successfully saved!", filename)
}
});
}
Expand Down