File tree 1 file changed +2
-13
lines changed
1 file changed +2
-13
lines changed Original file line number Diff line number Diff line change 1
- import { promises as fs } from "fs" ;
2
1
import url from "url" ;
3
2
import Cookie from "./cookie.mjs" ;
4
3
import { paramError , CookieParseError } from "./errors.mjs" ;
@@ -96,19 +95,9 @@ export default class CookieJar {
96
95
validCookies . forEach ( c => this . addCookie ( c ) ) ;
97
96
}
98
97
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" ) ;
104
99
}
105
100
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" ) ;
113
102
}
114
103
}
You can’t perform that action at this time.
0 commit comments