-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const fs = require("node:fs"); | ||
const path = require("node:path"); | ||
const readline = require("node:readline"); | ||
const { stdin: input, stdout: output } = require("node:process"); | ||
|
||
const rl = readline.createInterface({ input, output }); | ||
|
||
rl.question( | ||
"\n\x1b[33m Enter the name of the folder that exported from Google Keep?\x1b[0m\n\n > ", | ||
(folderName) => { | ||
console.log(`Answer is here: ${folderName}`); | ||
|
||
// TODO: Below will read directory and create array of json fles | ||
fs.readdir(__dirname + `/${folderName}/Keep/`, (err, files) => { | ||
if (err) { | ||
console.log("Error getting directory info"); | ||
} | ||
const jsonFiles = files.filter( | ||
(file) => path.extname(file).toLocaleLowerCase() === ".json" | ||
); | ||
console.log("filllllles", jsonFiles); | ||
}); | ||
// TODO: Iterate over all json files (jsonFiles) and handle each file and structure data | ||
// TODO: Below will read the json file | ||
fs.readFile("test-file.json", "utf-8", (err, data) => { | ||
if (err) { | ||
console.error(err); | ||
return; | ||
} | ||
const jsonData = JSON.parse(data); | ||
console.log("jsonData here", jsonData); | ||
}); | ||
|
||
rl.close(); | ||
} | ||
); | ||
|
||
// console.log("\n\x1b[92m The file has been formatted and saved! \x1b[0m\n"); |