@@ -105,7 +105,7 @@ const initCycleTLS = require('cycletls');
105105 console .log (data);
106106
107107 // Cleanly exit CycleTLS
108- cycleTLS .exit ();
108+ await cycleTLS .exit ();
109109
110110})();
111111
@@ -134,8 +134,8 @@ const initCycleTLS = require('cycletls');
134134 console .log (' JA4:' , data .tls .ja4 );
135135 console .log (' JA4_r:' , data .tls .ja4_r );
136136 console .log (' TLS Version:' , data .tls .tls_version_negotiated );
137-
138- cycleTLS .exit ();
137+
138+ await cycleTLS .exit ();
139139})();
140140```
141141
@@ -186,8 +186,8 @@ const initCycleTLS = require('cycletls');
186186 const data = await response .json ();
187187 console .log (' HTTP/2 Fingerprint:' , data .http2 .akamai_fingerprint );
188188 console .log (' Settings:' , data .http2 .sent_frames [0 ].settings );
189-
190- cycleTLS .exit ();
189+
190+ await cycleTLS .exit ();
191191})();
192192```
193193
@@ -242,8 +242,8 @@ const initCycleTLS = require('cycletls');
242242 console .log (' Complete fingerprint applied successfully' );
243243 console .log (' JA4:' , data .tls .ja4 );
244244 console .log (' HTTP/2:' , data .http2 .akamai_fingerprint );
245-
246- cycleTLS .exit ();
245+
246+ await cycleTLS .exit ();
247247})();
248248```
249249
@@ -275,12 +275,12 @@ const initCycleTLS = require('cycletls');
275275
276276 stream .on (' end' , () => {
277277 console .log (" stream done" );
278- cycleTLS .exit ();
278+ await cycleTLS .exit ();
279279 });
280280
281281 stream .on (' error' , (error ) => {
282282 console .error (' Stream error:' , error);
283- cycleTLS .exit ();
283+ await cycleTLS .exit ();
284284 });
285285})();
286286```
@@ -314,17 +314,17 @@ const initCycleTLS = require('cycletls');
314314 console .log (' Stream complete' );
315315 const fullData = Buffer .concat (chunks);
316316 console .log (' Total received:' , fullData .length , ' bytes' );
317- cycleTLS .exit ();
317+ await cycleTLS .exit ();
318318 });
319319
320320 response .data .on (' error' , (error ) => {
321321 console .error (' Stream error:' , error);
322- cycleTLS .exit ();
322+ await cycleTLS .exit ();
323323 });
324324
325325 } catch (error) {
326326 console .error (' Request failed:' , error);
327- cycleTLS .exit ();
327+ await cycleTLS .exit ();
328328 }
329329})();
330330```
@@ -578,7 +578,7 @@ const initCycleTLS = require('cycletls');
578578 const data = await response .json ();
579579 console .log (' Decompressed data:' , data);
580580
581- cycleTLS .exit ();
581+ await cycleTLS .exit ();
582582})();
583583```
584584
@@ -671,7 +671,7 @@ const initCycleTLS = require('cycletls');
671671 } catch (error) {
672672 console .error (' Request failed:' , error);
673673 } finally {
674- cycleTLS .exit ();
674+ await cycleTLS .exit ();
675675 }
676676})();
677677```
@@ -761,8 +761,8 @@ const initCycleTLS = require('cycletls');
761761
762762 console .log (' HTTP Proxy IP:' , await httpResponse .json ());
763763 console .log (' SOCKS5 IP:' , await socksResponse .json ());
764-
765- cycleTLS .exit ();
764+
765+ await cycleTLS .exit ();
766766})();
767767```
768768
@@ -936,9 +936,9 @@ const requestDict = {
936936
937937 // Wait for all requests to complete
938938 await Promise .all (promises);
939-
939+
940940 // Cleanly exit CycleTLS
941- cycleTLS .exit ();
941+ await cycleTLS .exit ();
942942})();
943943` ` `
944944
@@ -1094,7 +1094,7 @@ const initCycleTLS = require("cycletls");
10941094 }
10951095 }
10961096 */
1097- cycleTLS .exit ();
1097+ await cycleTLS .exit ();
10981098})();
10991099` ` `
11001100
@@ -1157,7 +1157,7 @@ const initCycleTLS = require("cycletls");
11571157 }
11581158 }
11591159 */
1160- cycleTLS .exit ();
1160+ await cycleTLS .exit ();
11611161})();
11621162` ` `
11631163
@@ -1254,7 +1254,7 @@ const Cookie = tough.Cookie;
12541254 }
12551255 }
12561256 */
1257- cycleTLS .exit ();
1257+ await cycleTLS .exit ();
12581258})();
12591259
12601260async function processCookies (response , url , cookieJar ) {
@@ -1357,7 +1357,7 @@ const FormData = require('form-data');
13571357 const data = await response .json ();
13581358 console .log (data);
13591359
1360- cycleTLS .exit ();
1360+ await cycleTLS .exit ();
13611361})();
13621362
13631363` ` `
@@ -1384,7 +1384,7 @@ const fs = require('fs');
13841384 const data = await response .json ();
13851385 console .log (data);
13861386
1387- cycleTLS .exit ();
1387+ await cycleTLS .exit ();
13881388})();
13891389
13901390` ` `
@@ -1517,7 +1517,7 @@ const initCycleTLS = require("cycletls");
15171517 const data = await response .json ();
15181518 console .log (data);
15191519
1520- cycleTLS .exit ();
1520+ await cycleTLS .exit ();
15211521})();
15221522
15231523` ` `
@@ -1625,7 +1625,7 @@ var fs = require("fs");
16251625 fs .writeFileSync (' ./videos/sample_video.mp4' , Buffer .from (videoBuffer));
16261626 console .log (' Video downloaded' );
16271627
1628- cycleTLS .exit ();
1628+ await cycleTLS .exit ();
16291629})();
16301630
16311631` ` `
@@ -1662,13 +1662,13 @@ var fs = require("fs");
16621662 stream .on (' end' , () => {
16631663 writeStream .end ();
16641664 console .log (` Stream complete. Total size: ${ totalSize} bytes` );
1665- cycleTLS .exit ();
1665+ await cycleTLS .exit ();
16661666 });
16671667
16681668 stream .on (' error' , (error ) => {
16691669 console .error (' Stream error:' , error);
16701670 writeStream .end ();
1671- cycleTLS .exit ();
1671+ await cycleTLS .exit ();
16721672 });
16731673})();
16741674` ` `
@@ -1928,7 +1928,7 @@ const initCycleTLS = require('cycletls');
19281928 console .log (' Response headers:' , wsResponse .headers );
19291929 }
19301930
1931- cycleTLS .exit ();
1931+ await cycleTLS .exit ();
19321932})();
19331933` ` `
19341934
@@ -2066,7 +2066,7 @@ const initCycleTLS = require('cycletls');
20662066 const eventData = await sseResponse .text ();
20672067 console .log (' SSE events:' , eventData);
20682068
2069- cycleTLS .exit ();
2069+ await cycleTLS .exit ();
20702070})();
20712071` ` `
20722072
@@ -2114,12 +2114,12 @@ const initCycleTLS = require('cycletls');
21142114
21152115 stream .on (' end' , () => {
21162116 console .log (' SSE stream ended' );
2117- cycleTLS .exit ();
2117+ await cycleTLS .exit ();
21182118 });
21192119
21202120 stream .on (' error' , (error ) => {
21212121 console .error (' SSE stream error:' , error);
2122- cycleTLS .exit ();
2122+ await cycleTLS .exit ();
21232123 });
21242124})();
21252125` ` `
@@ -2437,7 +2437,7 @@ const initCycleTLS = require('cycletls');
24372437 const data = await response.json();
24382438 console.log(data);
24392439 // You can verify the HTTP_Version in the response
2440- cycleTLS.exit();
2440+ await cycleTLS.exit();
24412441
24422442})();
24432443
@@ -2469,7 +2469,7 @@ const initCycleTLS = require('cycletls');
24692469 const data = await response.json();
24702470 console.log(data);
24712471 // HTTP/3 requests use QUIC protocol
2472- cycleTLS.exit();
2472+ await cycleTLS.exit();
24732473
24742474})();
24752475` ` `
0 commit comments