This repository has been archived by the owner on Sep 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: added util for parsing cookies from json and convert to single-l…
…ine string to .txt
- Loading branch information
1 parent
4b7e81b
commit 06a3b68
Showing
2 changed files
with
19 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 |
---|---|---|
|
@@ -5,3 +5,5 @@ | |
/app-*.log | ||
/logs | ||
/logs/app-*.log | ||
/cookies.json | ||
/cookies.txt |
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,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); | ||
} |