Skip to content

Commit

Permalink
work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
lugenx committed Apr 29, 2023
1 parent 3d95d91 commit 2571827
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
38 changes: 38 additions & 0 deletions index.js
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");

0 comments on commit 2571827

Please sign in to comment.