Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Commit

Permalink
fix: added util for parsing cookies from json and convert to single-l…
Browse files Browse the repository at this point in the history
…ine string to .txt
  • Loading branch information
mariusbegby committed Jul 18, 2023
1 parent 4b7e81b commit 06a3b68
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
/app-*.log
/logs
/logs/app-*.log
/cookies.json
/cookies.txt
17 changes: 17 additions & 0 deletions src/utils/other/cookieParser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const path = require('node:path');
const fs = require('node:fs');
const cookies = require(path.resolve('./cookies.json'));

try {
const cookieString = cookies
.map(({ name, value }) => {
return `${name}=${value}`;
})
.join('; ');

fs.writeFile(path.resolve('./cookies.txt'), cookieString, () => {
return process.exit(0);
});
} catch (error) {
process.exit(1);
}

0 comments on commit 06a3b68

Please # to comment.