Skip to content

Commit

Permalink
Remove support for storing cookie jar in file
Browse files Browse the repository at this point in the history
Temporary workaround for jkhsjdhjs#10
  • Loading branch information
Noah Andrews authored Aug 4, 2020
1 parent dee2761 commit 3bdb071
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/cookie-jar.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {promises as fs} from "fs";
import url from "url";
import Cookie from "./cookie.mjs";
import {paramError, CookieParseError} from "./errors.mjs";
Expand Down Expand Up @@ -96,19 +95,9 @@ export default class CookieJar {
validCookies.forEach(c => this.addCookie(c));
}
async load(file = this.file) {
if (typeof file !== "string")
throw new Error("No file has been specified for this cookie jar!");
JSON.parse(await fs.readFile(file)).forEach(c =>
this.addCookie(Cookie.fromObject(c))
);
throw new Error("This version doesn't support saving to a file");
}
async save(file = this.file) {
if (typeof file !== "string")
throw new Error("No file has been specified for this cookie jar!");
// only save cookies that haven't expired
await fs.writeFile(
this.file,
JSON.stringify([...this.cookiesValid(false)])
);
throw new Error("This version doesn't support saving to a file");
}
}

0 comments on commit 3bdb071

Please sign in to comment.