Files
cadence-discord-bot/src/utils/other/cookieParser.ts
T

20 lines
545 B
TypeScript

import fs from 'node:fs';
import path from 'node:path';
/* eslint-disable @typescript-eslint/no-var-requires */
const cookies: { name: string; value: string }[] = require(path.resolve('./cookies.json'));
try {
const cookieString: string = cookies
.map(({ name, value }: { name: string; value: string }) => {
return `${name}=${value}`;
})
.join('; ');
fs.writeFile(path.resolve('./cookies.txt'), cookieString, () => {
return process.exit(0);
});
} catch (error) {
process.exit(1);
}