Skip to content

Commit 3bdb071

Browse files
author
Noah Andrews
authored
Remove support for storing cookie jar in file
Temporary workaround for jkhsjdhjs#10
1 parent dee2761 commit 3bdb071

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

src/cookie-jar.mjs

+2-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {promises as fs} from "fs";
21
import url from "url";
32
import Cookie from "./cookie.mjs";
43
import {paramError, CookieParseError} from "./errors.mjs";
@@ -96,19 +95,9 @@ export default class CookieJar {
9695
validCookies.forEach(c => this.addCookie(c));
9796
}
9897
async load(file = this.file) {
99-
if (typeof file !== "string")
100-
throw new Error("No file has been specified for this cookie jar!");
101-
JSON.parse(await fs.readFile(file)).forEach(c =>
102-
this.addCookie(Cookie.fromObject(c))
103-
);
98+
throw new Error("This version doesn't support saving to a file");
10499
}
105100
async save(file = this.file) {
106-
if (typeof file !== "string")
107-
throw new Error("No file has been specified for this cookie jar!");
108-
// only save cookies that haven't expired
109-
await fs.writeFile(
110-
this.file,
111-
JSON.stringify([...this.cookiesValid(false)])
112-
);
101+
throw new Error("This version doesn't support saving to a file");
113102
}
114103
}

0 commit comments

Comments
 (0)