content large_stringlengths 3 20.5k | url large_stringlengths 54 193 | branch large_stringclasses 4 values | source large_stringclasses 42 values | embeddings listlengths 384 384 | score float64 -0.21 0.65 |
|---|---|---|---|---|---|
\_packageURL\_ be the URL resolution of \_"node\\_modules/"\_ > concatenated with \_packageName\_, relative to \_parentURL\_. > 2. Set \_parentURL\_ to the parent folder URL of \_parentURL\_. > 3. If the folder at \_packageURL\_ does not exist, then > 1. Continue the next loop iteration. > 4. Let \_pjson\_ be the result of \*\*READ\\_PACKAGE\\_JSON\*\*(\_packageURL\_). > 5. If \_pjson\_ is not \*\*null\*\* and \_pjson\_.\_exports\_ is not \*\*null\*\* or > \*\*undefined\*\*, then > 1. Return the result of \*\*PACKAGE\\_EXPORTS\\_RESOLVE\*\*(\_packageURL\_, > \_packageSubpath\_, \_pjson.exports\_, \_defaultConditions\_). > 6. Otherwise, if \_packageSubpath\_ is equal to \_"."\_, then > 1. If \_pjson.main\_ is a string, then > 1. Return the URL resolution of \_main\_ in \_packageURL\_. > 7. Otherwise, > 1. Return the URL resolution of \_packageSubpath\_ in \_packageURL\_. > 11. Throw a \_Module Not Found\_ error. \*\*PACKAGE\\_SELF\\_RESOLVE\*\*(\_packageName\_, \_packageSubpath\_, \_parentURL\_) > 1. Let \_packageURL\_ be the result of \*\*LOOKUP\\_PACKAGE\\_SCOPE\*\*(\_parentURL\_). > 2. If \_packageURL\_ is \*\*null\*\*, then > 1. Return \*\*undefined\*\*. > 3. Let \_pjson\_ be the result of \*\*READ\\_PACKAGE\\_JSON\*\*(\_packageURL\_). > 4. If \_pjson\_ is \*\*null\*\* or if \_pjson\_.\_exports\_ is \*\*null\*\* or > \*\*undefined\*\*, then > 1. Return \*\*undefined\*\*. > 5. If \_pjson.name\_ is equal to \_packageName\_, then > 1. Return the result of \*\*PACKAGE\\_EXPORTS\\_RESOLVE\*\*(\_packageURL\_, > \_packageSubpath\_, \_pjson.exports\_, \_defaultConditions\_). > 6. Otherwise, return \*\*undefined\*\*. \*\*PACKAGE\\_EXPORTS\\_RESOLVE\*\*(\_packageURL\_, \_subpath\_, \_exports\_, \_conditions\_) Note: This function is directly invoked by the CommonJS resolution algorithm. > 1. If \_exports\_ is an Object with both a key starting with \_"."\_ and a key not > starting with \_"."\_, throw an \_Invalid Package Configuration\_ error. > 2. If \_subpath\_ is equal to \_"."\_, then > 1. Let \_mainExport\_ be \*\*undefined\*\*. > 2. If \_exports\_ is a String or Array, or an Object containing no keys > starting with \_"."\_, then > 1. Set \_mainExport\_ to \_exports\_. > 3. Otherwise if \_exports\_ is an Object containing a \_"."\_ property, then > 1. Set \_mainExport\_ to \_exports\_\[\_"."\_]. > 4. If \_mainExport\_ is not \*\*undefined\*\*, then > 1. Let \_resolved\_ be the result of \*\*PACKAGE\\_TARGET\\_RESOLVE\*\*( > \_packageURL\_, \_mainExport\_, \*\*null\*\*, \*\*false\*\*, \_conditions\_). > 2. If \_resolved\_ is not \*\*null\*\* or \*\*undefined\*\*, return \_resolved\_. > 3. Otherwise, if \_exports\_ is an Object and all keys of \_exports\_ start with > \_"."\_, then > 1. Assert: \_subpath\_ begins with \_"./"\_. > 2. Let \_resolved\_ be the result of \*\*PACKAGE\\_IMPORTS\\_EXPORTS\\_RESOLVE\*\*( > \_subpath\_, \_exports\_, \_packageURL\_, \*\*false\*\*, \_conditions\_). > 3. If \_resolved\_ is not \*\*null\*\* or \*\*undefined\*\*, return \_resolved\_. > 4. Throw a \_Package Path Not Exported\_ error. \*\*PACKAGE\\_IMPORTS\\_RESOLVE\*\*(\_specifier\_, \_parentURL\_, \_conditions\_) Note: This function is directly invoked by the CommonJS resolution algorithm. > 1. Assert: \_specifier\_ begins with \_"#"\_. > 2. If \_specifier\_ is exactly equal to \_"#"\_, then > 1. Throw an \_Invalid Module Specifier\_ error. > 3. Let \_packageURL\_ be the result of \*\*LOOKUP\\_PACKAGE\\_SCOPE\*\*(\_parentURL\_). > 4. If \_packageURL\_ is not \*\*null\*\*, then > 1. Let \_pjson\_ be the result of \*\*READ\\_PACKAGE\\_JSON\*\*(\_packageURL\_). > 2. If \_pjson.imports\_ is a non-null Object, then > 1. Let \_resolved\_ be the result of > \*\*PACKAGE\\_IMPORTS\\_EXPORTS\\_RESOLVE\*\*( > \_specifier\_, \_pjson.imports\_, \_packageURL\_, \*\*true\*\*, \_conditions\_). > 2. If \_resolved\_ is not \*\*null\*\* or \*\*undefined\*\*, return \_resolved\_. > 5. Throw a \_Package Import Not Defined\_ error. \*\*PACKAGE\\_IMPORTS\\_EXPORTS\\_RESOLVE\*\*(\_matchKey\_, \_matchObj\_, \_packageURL\_, \_isImports\_, \_conditions\_) > 1. If \_matchKey\_ ends in \_"/"\_, then > 1. Throw an \_Invalid Module Specifier\_ error. > 2. If \_matchKey\_ is a key of \_matchObj\_ and does not contain \_"\\*"\_, then > 1. Let \_target\_ be the value of \_matchObj\_\[\_matchKey\_]. > 2. Return the result of \*\*PACKAGE\\_TARGET\\_RESOLVE\*\*(\_packageURL\_, > \_target\_, \*\*null\*\*, \_isImports\_, \_conditions\_). > 3. Let \_expansionKeys\_ be the list of keys of \_matchObj\_ containing only a > single \_"\\*"\_, sorted by the sorting function \*\*PATTERN\\_KEY\\_COMPARE\*\* > which orders in descending order of specificity. > | https://github.com/nodejs/node/blob/main//doc/api/esm.md | main | nodejs | [
-0.038708388805389404,
0.017831526696681976,
0.0386299267411232,
-0.031844839453697205,
0.048392586410045624,
-0.009507774375379086,
0.01260452251881361,
0.07186360657215118,
0.013360916636884212,
-0.0405244305729866,
0.11863739043474197,
-0.022580144926905632,
-0.027049260213971138,
0.012846902012825012,
0.0534396730363369,
0.10588686168193817,
-0.08965609222650528,
0.09260591864585876,
-0.05100644379854202,
-0.046091046184301376,
0.036828309297561646,
0.04176654666662216,
0.025939930230379105,
-0.010707222856581211,
-0.013975568115711212,
0.07576022297143936,
-0.0262153223156929,
-0.03785351663827896,
-0.00024579037562943995,
0.04064922034740448,
-0.01241715345531702,
0.022073080763220787,
-0.04072338342666626,
-0.012097645550966263,
0.17322978377342224,
0.1445349007844925,
0.000031278646929422393,
-0.08938246965408325,
0.04944340139627457,
-0.05181184783577919,
0.09552139788866043,
0.11922318488359451,
0.03271176293492317,
-0.174489364027977,
0.026933465152978897,
-0.0912569984793663,
-0.041306860744953156,
0.02074793353676796,
-0.03255866467952728,
-0.047031089663505554,
-0.024627065286040306,
-0.02796982415020466,
-0.07340973615646362,
-0.08410610258579254,
0.05720324069261551,
0.022347183898091316,
-0.036310598254203796,
0.06368737667798996,
-0.05343344807624817,
0.07673177868127823,
0.07529397308826447,
-0.06134844571352005,
-0.04021630808711052,
-0.06287532299757004,
-0.05176805704832077,
-0.014806970953941345,
-0.07705996930599213,
-0.023990416899323463,
-0.010204767808318138,
0.028513887897133827,
-0.06970110535621643,
0.08224590122699738,
-0.03510814160108566,
0.034142449498176575,
-0.014757929369807243,
-0.03999772295355797,
0.024724042043089867,
0.022268909960985184,
-0.05101213604211807,
-0.07927429676055908,
0.03263549879193306,
-0.04112156108021736,
0.034073326736688614,
0.010570120997726917,
-0.017134716734290123,
0.0025247528683394194,
-0.015909269452095032,
0.0021826636511832476,
-0.04581764340400696,
0.004905860871076584,
-0.11587997525930405,
-0.1655508279800415,
-0.012827541679143906,
0.02353072538971901,
-0.018527738749980927,
0.0805324986577034,
0.00925032515078783,
0.00029815651942044497,
-0.02818429470062256,
0.028685225173830986,
-0.021981708705425262,
-0.0037436343263834715,
0.05044477432966232,
-0.06779559701681137,
0.02294781059026718,
0.05762918293476105,
-0.038247641175985336,
-0.05644062161445618,
-0.03211444243788719,
-0.053873609751462936,
-0.04149315878748894,
0.05278069153428078,
0.024061333388090134,
-0.037023987621068954,
-0.046624504029750824,
-0.03515232354402542,
0.013748163357377052,
0.0050051030702888966,
0.044910166412591934,
0.045775361359119415,
0.16697870194911957,
-0.02822030708193779,
0.10690829157829285,
0.020128624513745308,
0.03671618551015854,
-0.07034993171691895,
0.047793302685022354,
-3.907348732263053e-33,
-0.05721026286482811,
-0.013595479540526867,
0.05044901743531227,
0.04550764337182045,
0.021703500300645828,
-0.06131422147154808,
0.09536965191364288,
0.00964197888970375,
0.0001357083674520254,
-0.01445240993052721,
-0.059178777039051056,
-0.024529237300157547,
-0.06561650335788727,
0.012411405332386494,
-0.05541675537824631,
-0.01536608301103115,
0.05524574965238571,
0.035913385450839996,
0.0991259515285492,
0.025852704420685768,
0.00877029076218605,
0.033308420330286026,
-0.0018783685518428683,
0.04429353028535843,
0.046119868755340576,
-0.08495711535215378,
0.043338190764188766,
0.03564928099513054,
-0.03750048205256462,
-0.028179733082652092,
0.09603109955787659,
0.027266157791018486,
-0.01975996047258377,
0.020810497924685478,
-0.0132862888276577,
0.06396523863077164,
0.0402560792863369,
-0.013555292040109634,
-0.09194664657115936,
0.003676112974062562,
-0.058042749762535095,
-0.011086273938417435,
-0.11229417473077774,
0.06892310827970505,
0.02648690529167652,
-0.03549322113394737,
-0.023677628487348557,
-0.10666724294424057,
-0.03081035241484642,
-0.039029136300086975,
-0.0821945071220398,
0.04881393164396286,
0.05125927925109863,
-0.021956590935587883,
0.0665440633893013,
-0.06641080975532532,
-0.008666353300213814,
0.014320514164865017,
0.024685142561793327,
-0.021423015743494034,
0.008349995128810406,
-0.028441116213798523,
-0.07020124793052673,
0.04223915934562683,
-0.01078012678772211,
0.0428263396024704,
-0.007306384388357401,
-0.020737886428833008,
-0.01568818837404251,
0.034887708723545074,
-0.014358025044202805,
0.04263650253415108,
0.00397768197581172,
-0.090663842856884,
0.001180659863166511,
-0.005241472274065018,
-0.05560719221830368,
0.01357501745223999,
0.0013029169058427215,
-0.05239098519086838,
-0.03624366968870163,
-0.01832670532166958,
0.023414889350533485,
0.04950786754488945,
0.00015713443281129003,
0.03398139402270317,
-0.03705514594912529,
-0.0004811146354768425,
0.00914938747882843,
-0.0015704244142398238,
-0.024350302293896675,
-0.02967783994972706,
-0.0000833137019071728,
-0.05073937028646469,
0.009302070364356041,
4.027229870592733e-34,
0.1290569007396698,
0.06236384063959122,
0.05157352611422539,
-0.014014936983585358,
-0.051949698477983475,
-0.04920738935470581,
-0.01699579320847988,
-0.04690919071435928,
-0.008570619858801365,
0.04724431410431862,
-0.02763552963733673,
0.0022950666025280952,
0.0665082037448883,
-0.04346751049160957,
0.0543438158929348,
0.11019187420606613,
-0.04252792149782181,
-0.026738425716757774,
0.0043195514008402824,
-0.0024596350267529488,
0.037050459533929825,
0.10896380245685577,
-0.012760832905769348,
0.029912669211626053,
-0.04521004483103752,
-0.029957277700304985,
-0.03328656405210495,
-0.04704664275050163,
-0.07412172108888626,
0.06128035858273506,
0.00829373486340046,
0.028673773631453514,
0.04864782467484474,
0.07740838080644608,
-0.01319018192589283,
0.0014639764558523893,
-0.034671857953071594,
0.01110160443931818,
0.02076651342213154,
-0.01273419801145792,
0.037934087216854095,
-0.06511514633893967,
-0.055034659802913666,
0.006785146426409483,
0.005260074976831675,
-0.10577777028083801,
0.045605964958667755,
0.030536655336618423,
-0.02937096171081066,
-0.01005800161510706,
0.002718064934015274,
-0.03619993105530739,
-0.06641270220279694,
-0.027767814695835114,
0.04952729865908623,
0.07071256637573242,
-0.009895557537674904,
0.0017807825934141874,
0.008885020390152931,
-0.02377992495894432,
-0.029169606044888496,
-0.14170320332050323,
-0.05634552612900734,
-0.007124793715775013,
-0.05645610764622688,
-0.044847484678030014,
-0.09856802225112915,
0.05937851592898369,
0.051258500665426254,
0.020005187019705772,
-0.05655235797166824,
0.043051786720752716,
-0.016322972252964973,
0.0035017707850784063,
-0.004649845417588949,
0.038455553352832794,
0.006173427682369947,
0.03238354250788689,
0.03194834291934967,
0.07839955389499664,
-0.10030697286128998,
0.04050439968705177,
-0.06012646108865738,
0.030929209664463997,
0.0362350158393383,
-0.07571627199649811,
0.020801473408937454,
0.005746135953813791,
-0.021503673866391182,
-0.038041140884160995,
0.09130155295133591,
0.049184951931238174,
0.021920861676335335,
-0.06615343689918518,
0.003372295992448926,
-5.04269515033684e-8,
-0.037886857986450195,
-0.060132380574941635,
-0.09784555435180664,
0.007828077301383018,
0.051891498267650604,
-0.031125323846936226,
0.03927956894040108,
0.07802996039390564,
0.028884682804346085,
0.025948887690901756,
-0.00857405737042427,
0.033200256526470184,
-0.0394541434943676,
-0.018680104985833168,
-0.07655870914459229,
-0.017081787809729576,
-0.07807579636573792,
0.054480552673339844,
0.008832353167235851,
0.031722214072942734,
0.006831806618720293,
0.06713559478521347,
0.05223137512803078,
0.07345311343669891,
0.007307682652026415,
-0.04436352476477623,
0.029912997037172318,
-0.026171673089265823,
-0.04224319010972977,
0.007299158256500959,
0.017040567472577095,
-0.02860639989376068,
-0.06354270875453949,
-0.008874519728124142,
-0.008965738117694855,
-0.039687614887952805,
0.10526980459690094,
0.015425647608935833,
0.03263189271092415,
0.08295755088329315,
-0.011762079782783985,
0.030542347580194473,
0.0019747831393033266,
0.053624577820301056,
-0.01945141889154911,
-0.07899691164493561,
-0.028276437893509865,
0.06250899285078049,
0.04471968114376068,
0.005039744544774294,
-0.03826672583818436,
-0.00389789417386055,
-0.032816410064697266,
-0.017137901857495308,
0.011006235145032406,
0.014237264171242714,
-0.040191829204559326,
0.05776577815413475,
-0.08969075977802277,
0.04946637898683548,
0.010647025890648365,
0.026350492611527443,
0.0537981279194355,
-0.0413467101752758
] | -0.03511 |
\_target\_ be the value of \_matchObj\_\[\_matchKey\_]. > 2. Return the result of \*\*PACKAGE\\_TARGET\\_RESOLVE\*\*(\_packageURL\_, > \_target\_, \*\*null\*\*, \_isImports\_, \_conditions\_). > 3. Let \_expansionKeys\_ be the list of keys of \_matchObj\_ containing only a > single \_"\\*"\_, sorted by the sorting function \*\*PATTERN\\_KEY\\_COMPARE\*\* > which orders in descending order of specificity. > 4. For each key \_expansionKey\_ in \_expansionKeys\_, do > 1. Let \_patternBase\_ be the substring of \_expansionKey\_ up to but excluding > the first \_"\\*"\_ character. > 2. If \_matchKey\_ starts with but is not equal to \_patternBase\_, then > 1. Let \_patternTrailer\_ be the substring of \_expansionKey\_ from the > index after the first \_"\\*"\_ character. > 2. If \_patternTrailer\_ has zero length, or if \_matchKey\_ ends with > \_patternTrailer\_ and the length of \_matchKey\_ is greater than or > equal to the length of \_expansionKey\_, then > 1. Let \_target\_ be the value of \_matchObj\_\[\_expansionKey\_]. > 2. Let \_patternMatch\_ be the substring of \_matchKey\_ starting at the > index of the length of \_patternBase\_ up to the length of > \_matchKey\_ minus the length of \_patternTrailer\_. > 3. Return the result of \*\*PACKAGE\\_TARGET\\_RESOLVE\*\*(\_packageURL\_, > \_target\_, \_patternMatch\_, \_isImports\_, \_conditions\_). > 5. Return \*\*null\*\*. \*\*PATTERN\\_KEY\\_COMPARE\*\*(\_keyA\_, \_keyB\_) > 1. Assert: \_keyA\_ contains only a single \_"\\*"\_. > 2. Assert: \_keyB\_ contains only a single \_"\\*"\_. > 3. Let \_baseLengthA\_ be the index of \_"\\*"\_ in \_keyA\_. > 4. Let \_baseLengthB\_ be the index of \_"\\*"\_ in \_keyB\_. > 5. If \_baseLengthA\_ is greater than \_baseLengthB\_, return -1. > 6. If \_baseLengthB\_ is greater than \_baseLengthA\_, return 1. > 7. If the length of \_keyA\_ is greater than the length of \_keyB\_, return -1. > 8. If the length of \_keyB\_ is greater than the length of \_keyA\_, return 1. > 9. Return 0. \*\*PACKAGE\\_TARGET\\_RESOLVE\*\*(\_packageURL\_, \_target\_, \_patternMatch\_, \_isImports\_, \_conditions\_) > 1. If \_target\_ is a String, then > 1. If \_target\_ does not start with \_"./"\_, then > 1. If \_isImports\_ is \*\*false\*\*, or if \_target\_ starts with \_"../"\_ or > \_"/"\_, or if \_target\_ is a valid URL, then > 1. Throw an \_Invalid Package Target\_ error. > 2. If \_patternMatch\_ is a String, then > 1. Return \*\*PACKAGE\\_RESOLVE\*\*(\_target\_ with every instance of \_"\\*"\_ > replaced by \_patternMatch\_, \_packageURL\_ + \_"/"\_). > 3. Return \*\*PACKAGE\\_RESOLVE\*\*(\_target\_, \_packageURL\_ + \_"/"\_). > 2. If \_target\_ split on \_"/"\_ or \_"\\"\_ contains any \_""\_, \_"."\_, \_".."\_, > or \_"node\\_modules"\_ segments after the first \_"."\_ segment, case > insensitive and including percent encoded variants, throw an \_Invalid > Package Target\_ error. > 3. Let \_resolvedTarget\_ be the URL resolution of the concatenation of > \_packageURL\_ and \_target\_. > 4. Assert: \_packageURL\_ is contained in \_resolvedTarget\_. > 5. If \_patternMatch\_ is \*\*null\*\*, then > 1. Return \_resolvedTarget\_. > 6. If \_patternMatch\_ split on \_"/"\_ or \_"\\"\_ contains any \_""\_, \_"."\_, > \_".."\_, or \_"node\\_modules"\_ segments, case insensitive and including > percent encoded variants, throw an \_Invalid Module Specifier\_ error. > 7. Return the URL resolution of \_resolvedTarget\_ with every instance of > \_"\\*"\_ replaced with \_patternMatch\_. > 2. Otherwise, if \_target\_ is a non-null Object, then > 1. If \_target\_ contains any index property keys, as defined in ECMA-262 > [6.1.7 Array Index][], throw an \_Invalid Package Configuration\_ error. > 2. For each property \_p\_ of \_target\_, in object insertion order as, > 1. If \_p\_ equals \_"default"\_ or \_conditions\_ contains an entry for \_p\_, > then > 1. Let \_targetValue\_ be the value of the \_p\_ property in \_target\_. > 2. Let \_resolved\_ be the result of \*\*PACKAGE\\_TARGET\\_RESOLVE\*\*( > \_packageURL\_, \_targetValue\_, \_patternMatch\_, \_isImports\_, > \_conditions\_). > 3. If \_resolved\_ is equal to \*\*undefined\*\*, continue the loop. | https://github.com/nodejs/node/blob/main//doc/api/esm.md | main | nodejs | [
-0.018831342458724976,
0.027542730793356895,
0.06687823683023453,
-0.058412134647369385,
-0.05269705131649971,
0.018669921904802322,
0.08216450363397598,
0.038387298583984375,
-0.06774896383285522,
0.027633490040898323,
0.0016089624259620905,
-0.06165933981537819,
0.045652907341718674,
-0.044773321598768234,
0.04891692474484444,
0.11745941638946533,
0.017248425632715225,
0.05080825090408325,
-0.08635071665048599,
-0.02933567762374878,
0.012515605427324772,
0.009047169238328934,
-0.04730314388871193,
-0.028847433626651764,
-0.03287980705499649,
0.06259138882160187,
0.0016862296033650637,
0.021628791466355324,
-0.026415832340717316,
0.004360200837254524,
-0.05306238308548927,
0.08686881512403488,
0.01314464583992958,
0.07445647567510605,
0.16563785076141357,
0.0024034460075199604,
-0.04801690950989723,
-0.016948916018009186,
0.05279432609677315,
0.013331982307136059,
0.013262791559100151,
0.0395796000957489,
0.06332435458898544,
-0.014342240057885647,
-0.007122071459889412,
-0.02303382381796837,
-0.03060799278318882,
0.030571088194847107,
-0.0909452885389328,
-0.13500386476516724,
-0.07556332647800446,
-0.008993728086352348,
-0.11658141016960144,
0.01818600669503212,
0.059616390615701675,
-0.006217005662620068,
-0.006056933663785458,
-0.03102288395166397,
-0.054149072617292404,
-0.0248110368847847,
0.01205428596585989,
-0.09989912062883377,
-0.04253200441598892,
-0.08443934470415115,
-0.09851184487342834,
-0.025008738040924072,
-0.011443158611655235,
-0.04850387945771217,
0.10075975209474564,
0.039889611303806305,
-0.10308794677257538,
0.06693369150161743,
-0.011963986791670322,
0.09446479380130768,
-0.001398466876707971,
0.05938732624053955,
0.009166105650365353,
-0.04623108357191086,
0.027874156832695007,
-0.1070442646741867,
-0.0603402704000473,
-0.07658258080482483,
-0.008256847970187664,
0.04461679607629776,
-0.007970286533236504,
-0.05218760669231415,
-0.03314002975821495,
-0.049275144934654236,
0.008197912946343422,
0.06856898963451385,
-0.08213349431753159,
-0.0979793518781662,
0.11928857117891312,
-0.013618597760796547,
0.04655853286385536,
0.060950614511966705,
0.03351658582687378,
-0.041380319744348526,
0.042774349451065063,
0.060849081724882126,
-0.012905138544738293,
0.0008562591392546892,
0.03146103769540787,
-0.05772582069039345,
-0.027408163994550705,
0.07869667559862137,
-0.08438970893621445,
-0.05763334035873413,
0.00453903479501605,
-0.058051373809576035,
-0.04975394532084465,
-0.03726144880056381,
0.024786295369267464,
-0.05555197596549988,
-0.023432567715644836,
0.007136679720133543,
0.06690758466720581,
-0.00044235686073079705,
0.006844548508524895,
0.05569428205490112,
0.04650352522730827,
-0.034116726368665695,
0.023485632613301277,
0.0043776677921414375,
-0.04832124337553978,
0.07514657825231552,
-0.03795429691672325,
-5.937072991117974e-34,
-0.013034329749643803,
-0.01114802248775959,
-0.011743210256099701,
-0.06513211131095886,
-0.027943633496761322,
0.007132509257644415,
0.04249443858861923,
0.03826206177473068,
-0.01225760392844677,
0.030988510698080063,
-0.039018429815769196,
0.026035401970148087,
-0.062407929450273514,
-0.022869810461997986,
-0.014475676231086254,
-0.03544332832098007,
0.02825852856040001,
0.09860598295927048,
-0.05651570111513138,
0.023577412590384483,
-0.010281759314239025,
-0.0036973499227315187,
-0.09204921871423721,
0.015303564257919788,
0.0012504641199484468,
-0.08671125769615173,
-0.010038499720394611,
-0.05142754316329956,
0.02652820199728012,
0.007321609649807215,
-0.023136330768465996,
-0.00612611835822463,
-0.013312092050909996,
-0.0040206704288721085,
0.07306000590324402,
0.03411656245589256,
0.031043674796819687,
-0.05064406618475914,
-0.017316443845629692,
-0.04584809020161629,
-0.08418554067611694,
-0.007091619074344635,
-0.052652157843112946,
0.01806540973484516,
0.09727796167135239,
-0.06577590852975845,
-0.11221228539943695,
-0.010107181034982204,
0.0734623596072197,
-0.029518673196434975,
0.02323363721370697,
0.02689479850232601,
0.00895924586802721,
0.015127251856029034,
-0.009859900921583176,
-0.07146743685007095,
-0.015258420258760452,
0.04930644854903221,
0.05959613621234894,
0.07292704284191132,
-0.06399461627006531,
-0.01839466206729412,
-0.03257178142666817,
0.06349437683820724,
0.07161635905504227,
-0.005356690380722284,
0.04944494366645813,
-0.06237807124853134,
-0.0514623261988163,
0.030942633748054504,
0.025866102427244186,
0.05327346920967102,
0.04487467184662819,
-0.042221520096063614,
-0.0072586252354085445,
-0.038451213389635086,
0.002869868651032448,
0.02449236623942852,
-0.04741615056991577,
-0.11327984929084778,
-0.053153540939092636,
0.026701221242547035,
0.01900702714920044,
0.016913237050175667,
-0.061826325953006744,
0.03810052573680878,
0.0012099887244403362,
-0.07858414202928543,
-0.03198646008968353,
-0.11356423050165176,
-0.016452500596642494,
-0.0029915310442447662,
-0.1094406396150589,
-0.05761606618762016,
0.03430052101612091,
-1.8112027977729345e-33,
0.11600814759731293,
0.037549443542957306,
0.03683960437774658,
-0.04349972680211067,
0.023210817947983742,
-0.06472119688987732,
-0.0007478736806660891,
-0.047039229422807693,
0.027374353259801865,
-0.0013538053026422858,
0.04445585608482361,
-0.0009042692254297435,
0.10033447295427322,
-0.120057612657547,
-0.01476390939205885,
0.03198782727122307,
-0.01641005463898182,
-0.02398793213069439,
0.0014968946343287826,
0.07675047963857651,
0.06957407295703888,
0.0075210873037576675,
-0.07408613711595535,
0.09550689160823822,
-0.0005988734774291515,
-0.042984019964933395,
-0.02319607324898243,
0.017603019252419472,
-0.026993339881300926,
0.0709102526307106,
0.05803690478205681,
0.02019631490111351,
-0.04386351630091667,
-0.03822841867804527,
-0.08015214651823044,
-0.08731992542743683,
-0.031185554340481758,
0.07777363061904907,
0.01584264263510704,
0.060824934393167496,
0.012216229923069477,
0.017784181982278824,
-0.0072577474638819695,
0.04725867509841919,
-0.002451473381370306,
-0.07628241926431656,
0.04190998524427414,
0.035470832139253616,
0.006135202944278717,
-0.04801854118704796,
0.011031770147383213,
-0.04153132438659668,
-0.040223535150289536,
-0.04937633126974106,
-0.0063372328877449036,
0.0840928852558136,
-0.03056926839053631,
0.05342577397823334,
-0.10244298726320267,
-0.017523957416415215,
0.00820088293403387,
0.024792836979031563,
0.050384972244501114,
0.018135394901037216,
0.07687287032604218,
0.050702959299087524,
-0.07206542789936066,
0.010094305500388145,
0.016764119267463684,
-0.047555938363075256,
0.035501882433891296,
-0.025799354538321495,
-0.04734642803668976,
0.06025495007634163,
0.015586525201797485,
0.005843091290444136,
0.021818792447447777,
0.03828444331884384,
0.013916440308094025,
0.09038779884576797,
-0.10655257850885391,
0.022493062540888786,
0.02857804298400879,
0.09368462860584259,
-0.02346395142376423,
0.01744307018816471,
-0.01903831772506237,
0.07249317318201065,
0.00006757322262274101,
0.012179710902273655,
-0.004902892280369997,
0.004075129050761461,
0.03779590502381325,
-0.03507603704929352,
0.04974310100078583,
-4.81330175716721e-8,
-0.04140084236860275,
-0.07623440772294998,
-0.08987568318843842,
0.04916159808635712,
0.04780633747577667,
0.04579630121588707,
-0.060261327773332596,
0.004931554198265076,
0.026787223294377327,
-0.04020571708679199,
0.028264258056879044,
0.06020093709230423,
-0.09955386072397232,
0.03786569461226463,
-0.010799923911690712,
0.01070825383067131,
-0.06742469221353531,
-0.0033748990390449762,
-0.07608882337808609,
0.009840790182352066,
-0.047057315707206726,
0.0436374694108963,
0.0663953423500061,
0.0005761911743320525,
0.009102828800678253,
0.023985885083675385,
0.012722516432404518,
0.031958889216184616,
0.03680134192109108,
0.073260098695755,
0.0831543430685997,
0.011017275974154472,
-0.005700959358364344,
-0.09215489029884338,
-0.02390998601913452,
0.06859257072210312,
0.060965076088905334,
0.008814489468932152,
-0.06022307276725769,
0.04519009217619896,
0.03912699595093727,
0.01576307788491249,
-0.008119207806885242,
0.06955667585134506,
0.02558775618672371,
-0.1151377335190773,
-0.0292704775929451,
-0.004449850879609585,
0.0114110317081213,
-0.04249010235071182,
-0.050603460520505905,
0.015660809352993965,
-0.03791553154587746,
0.06914201378822327,
-0.061239685863256454,
0.0649770125746727,
-0.013331507332623005,
0.03745804354548454,
-0.040348783135414124,
-0.016175661236047745,
0.031169667840003967,
-0.01596979983150959,
0.03975053131580353,
0.0741049274802208
] | 0.068099 |
\_"default"\_ or \_conditions\_ contains an entry for \_p\_, > then > 1. Let \_targetValue\_ be the value of the \_p\_ property in \_target\_. > 2. Let \_resolved\_ be the result of \*\*PACKAGE\\_TARGET\\_RESOLVE\*\*( > \_packageURL\_, \_targetValue\_, \_patternMatch\_, \_isImports\_, > \_conditions\_). > 3. If \_resolved\_ is equal to \*\*undefined\*\*, continue the loop. > 4. Return \_resolved\_. > 3. Return \*\*undefined\*\*. > 3. Otherwise, if \_target\_ is an Array, then > 1. If \\_target.length is zero, return \*\*null\*\*. > 2. For each item \_targetValue\_ in \_target\_, do > 1. Let \_resolved\_ be the result of \*\*PACKAGE\\_TARGET\\_RESOLVE\*\*( > \_packageURL\_, \_targetValue\_, \_patternMatch\_, \_isImports\_, > \_conditions\_), continuing the loop on any \_Invalid Package Target\_ > error. > 2. If \_resolved\_ is \*\*undefined\*\*, continue the loop. > 3. Return \_resolved\_. > 3. Return or throw the last fallback resolution \*\*null\*\* return or error. > 4. Otherwise, if \_target\_ is \_null\_, return \*\*null\*\*. > 5. Otherwise throw an \_Invalid Package Target\_ error. \*\*ESM\\_FILE\\_FORMAT\*\*(\_url\_) > 1. Assert: \_url\_ corresponds to an existing file. > 2. If \_url\_ ends in \_".mjs"\_, then > 1. Return \_"module"\_. > 3. If \_url\_ ends in \_".cjs"\_, then > 1. Return \_"commonjs"\_. > 4. If \_url\_ ends in \_".json"\_, then > 1. Return \_"json"\_. > 5. If \_url\_ ends in > \_".wasm"\_, then > 1. Return \_"wasm"\_. > 6. If `--experimental-addon-modules` is enabled and \_url\_ ends in > \_".node"\_, then > 1. Return \_"addon"\_. > 7. Let \_packageURL\_ be the result of \*\*LOOKUP\\_PACKAGE\\_SCOPE\*\*(\_url\_). > 8. Let \_pjson\_ be the result of \*\*READ\\_PACKAGE\\_JSON\*\*(\_packageURL\_). > 9. Let \_packageType\_ be \*\*null\*\*. > 10. If \_pjson?.type\_ is \_"module"\_ or \_"commonjs"\_, then > 1. Set \_packageType\_ to \_pjson.type\_. > 11. If \_url\_ ends in \_".js"\_, then > 1. If \_packageType\_ is not \*\*null\*\*, then > 1. Return \_packageType\_. > 2. If the result of \*\*DETECT\\_MODULE\\_SYNTAX\*\*(\_source\_) is true, then > 1. Return \_"module"\_. > 3. Return \_"commonjs"\_. > 12. If \_url\_ does not have any extension, then > 1. If \_packageType\_ is \_"module"\_ and the file at \_url\_ contains the > "application/wasm" content type header for a WebAssembly module, then > 1. Return \_"wasm"\_. > 2. If \_packageType\_ is not \*\*null\*\*, then > 1. Return \_packageType\_. > 3. If the result of \*\*DETECT\\_MODULE\\_SYNTAX\*\*(\_source\_) is true, then > 1. Return \_"module"\_. > 4. Return \_"commonjs"\_. > 13. Return \*\*undefined\*\* (will throw during load phase). \*\*LOOKUP\\_PACKAGE\\_SCOPE\*\*(\_url\_) > 1. Let \_scopeURL\_ be \_url\_. > 2. While \_scopeURL\_ is not the file system root, > 1. Set \_scopeURL\_ to the parent URL of \_scopeURL\_. > 2. If \_scopeURL\_ ends in a \_"node\\_modules"\_ path segment, return \*\*null\*\*. > 3. Let \_pjsonURL\_ be the resolution of \_"package.json"\_ within > \_scopeURL\_. > 4. if the file at \_pjsonURL\_ exists, then > 1. Return \_scopeURL\_. > 3. Return \*\*null\*\*. \*\*READ\\_PACKAGE\\_JSON\*\*(\_packageURL\_) > 1. Let \_pjsonURL\_ be the resolution of \_"package.json"\_ within \_packageURL\_. > 2. If the file at \_pjsonURL\_ does not exist, then > 1. Return \*\*null\*\*. > 3. If the file at \_packageURL\_ does not parse as valid JSON, then > 1. Throw an \_Invalid Package Configuration\_ error. > 4. Return the parsed JSON source of the file at \_pjsonURL\_. \*\*DETECT\\_MODULE\\_SYNTAX\*\*(\_source\_) > 1. Parse \_source\_ as an ECMAScript module. > 2. If the parse is successful, then > 1. If \_source\_ contains top-level `await`, static `import` or `export` > statements, or `import.meta`, return \*\*true\*\*. > 2. If \_source\_ contains a top-level lexical declaration (`const`, `let`, > or `class`) of any of the CommonJS wrapper variables (`require`, > `exports`, `module`, `\_\_filename`, or `\_\_dirname`) then return \*\*true\*\*. > 3. Else return \*\*false\*\*. ### Customizing ESM specifier resolution algorithm [Module customization hooks][] provide a mechanism for customizing the ESM specifier resolution | https://github.com/nodejs/node/blob/main//doc/api/esm.md | main | nodejs | [
-0.026284057646989822,
0.0647270530462265,
-0.0016364908078685403,
-0.004824372474104166,
-0.025705283507704735,
-0.00865343026816845,
0.10441544651985168,
0.008967287838459015,
-0.049784403294324875,
-0.02421693317592144,
0.022121487185359,
-0.07912160456180573,
-0.006939746905118227,
-0.008822833187878132,
0.09632770717144012,
0.09050008654594421,
-0.057784553617239,
-0.0024691843427717686,
-0.05855085328221321,
-0.018984423950314522,
0.06289058178663254,
0.0025157607160508633,
-0.056675657629966736,
-0.012651033699512482,
-0.06258565187454224,
0.10501578450202942,
-0.003703122725710273,
-0.07912805676460266,
0.05276781693100929,
0.006166948936879635,
-0.017329834401607513,
0.07397046685218811,
-0.0467136949300766,
0.04157531261444092,
0.17275165021419525,
0.07383712381124496,
-0.043959733098745346,
-0.03100219927728176,
-0.017135530710220337,
0.005542367231100798,
0.0703551173210144,
0.023638026788830757,
-0.04245927557349205,
-0.10390256345272064,
0.017358915880322456,
-0.03951292112469673,
-0.023286208510398865,
0.013413121923804283,
-0.057995568960905075,
-0.08493258059024811,
-0.06552155315876007,
-0.018638107925653458,
-0.08640129864215851,
-0.0504133477807045,
0.14079074561595917,
-0.0019957374315708876,
-0.0016848748782649636,
-0.01754927821457386,
-0.035283565521240234,
-0.016077425330877304,
0.03225826099514961,
-0.06790263205766678,
-0.036585479974746704,
-0.007709076162427664,
0.0005149419303052127,
-0.016613733023405075,
-0.05566507950425148,
-0.006592338904738426,
0.069111667573452,
0.06992321461439133,
-0.1058771163225174,
0.06928849965333939,
0.0479753278195858,
0.0773940309882164,
0.05738406255841255,
0.0033698256593197584,
0.012873298488557339,
-0.0606534443795681,
-0.0034661025274544954,
-0.05304180458188057,
-0.029238786548376083,
-0.083794504404068,
-0.032046474516391754,
-0.009540566243231297,
0.05105549097061157,
-0.014185147359967232,
-0.07113514840602875,
0.012219954282045364,
0.07093358039855957,
0.012225795537233353,
-0.12500546872615814,
-0.09992111474275589,
0.004519608803093433,
0.06288187205791473,
0.056626591831445694,
0.09884937107563019,
0.0392901636660099,
-0.08569636940956116,
-0.04505510628223419,
0.07536031305789948,
-0.0014065885916352272,
-0.03612641617655754,
0.03284285590052605,
-0.04333585873246193,
-0.05902083218097687,
0.016020726412534714,
-0.06492425501346588,
-0.10548234730958939,
-0.08074796199798584,
-0.010995945893228054,
-0.024021292105317116,
0.00800042599439621,
0.0839366465806961,
-0.07005161046981812,
-0.021608859300613403,
-0.0414762869477272,
-0.0022480401676148176,
-0.0016588355647400022,
0.029073847457766533,
0.014558677561581135,
0.1271553486585617,
-0.0004976198542863131,
0.06291641294956207,
0.043933767825365067,
-0.00249055540189147,
0.00008641434396849945,
-0.027445530518889427,
-3.584093663258678e-33,
-0.017651036381721497,
-0.03653273731470108,
-0.023647792637348175,
-0.010081946849822998,
-0.01967543736100197,
-0.0046442411839962006,
0.07885774970054626,
0.052294496446847916,
0.021990031003952026,
0.10061798989772797,
0.021061832085251808,
0.01825748197734356,
-0.07998690009117126,
0.08765989542007446,
-0.013983940705657005,
-0.0059951613657176495,
0.036901555955410004,
0.1291501224040985,
0.021118655800819397,
0.02773575857281685,
0.027536194771528244,
-0.011029656045138836,
-0.0706963762640953,
0.03963286802172661,
0.014258744195103645,
-0.06631602346897125,
-0.019722048193216324,
-0.02497618831694126,
-0.05383497476577759,
-0.014044319279491901,
0.06333843618631363,
-0.01021887268871069,
0.05327048897743225,
0.020767604932188988,
0.0554700642824173,
0.07087546586990356,
-0.03840310871601105,
-0.024810699746012688,
-0.06204266846179962,
-0.02461228147149086,
-0.037870608270168304,
-0.00640271557494998,
-0.014832602813839912,
0.05462058261036873,
0.009394762106239796,
-0.1191568598151207,
-0.07807879894971848,
-0.006526365876197815,
-0.0017358963377773762,
-0.07807821780443192,
-0.015412576496601105,
0.08487005531787872,
-0.0057719056494534016,
-0.028010010719299316,
0.029398083686828613,
-0.04963614046573639,
-0.04322879761457443,
0.03533315658569336,
-0.028397949412465096,
0.045355554670095444,
-0.010381556116044521,
-0.004957741592079401,
-0.07661759853363037,
0.011529706418514252,
-0.011723245494067669,
0.07339663803577423,
0.020699702203273773,
-0.04488968849182129,
0.03961145505309105,
-0.018243366852402687,
-0.034019600600004196,
0.051867783069610596,
-0.0021106188651174307,
-0.02441810443997383,
0.057071518152952194,
-0.06870826333761215,
-0.0146242156624794,
-0.01686963066458702,
-0.030687518417835236,
-0.11746421456336975,
-0.008115975186228752,
0.0033175728749483824,
-0.022985681891441345,
0.11297694593667984,
-0.029804954305291176,
0.005807777401059866,
-0.01457703672349453,
-0.09342079609632492,
-0.07862561196088791,
-0.06701084226369858,
-0.01500555407255888,
-0.014143211767077446,
-0.06339763849973679,
-0.0722559317946434,
0.051614053547382355,
-1.2269123104371775e-33,
0.10185571759939194,
0.06314131617546082,
-0.012657222338020802,
-0.036511123180389404,
0.005696045700460672,
-0.05492798611521721,
0.08787277340888977,
-0.05210207402706146,
0.04585035890340805,
-0.001526948413811624,
-0.019130803644657135,
-0.00331510161049664,
0.024422544986009598,
-0.07199113816022873,
0.037811100482940674,
0.07763547450304031,
-0.10229872167110443,
-0.0979401245713234,
0.0316358357667923,
0.02520822547376156,
0.02888909913599491,
0.08646851032972336,
-0.034674353897571564,
0.06151924282312393,
-0.06034498289227486,
-0.02202368713915348,
0.017609354108572006,
-0.04872193560004234,
-0.021669534966349602,
0.07084119319915771,
0.061795737594366074,
-0.0140109583735466,
-0.06530191749334335,
0.03292745351791382,
-0.049943212419748306,
-0.04693415388464928,
0.05513107404112816,
0.004319579340517521,
-0.028587982058525085,
0.010280613787472248,
0.045995794236660004,
-0.006451471708714962,
-0.003937229514122009,
0.04614822939038277,
-0.004828066099435091,
-0.07754950225353241,
0.05737689882516861,
0.03658159822225571,
0.06214183568954468,
-0.08094467967748642,
0.00266922521404922,
-0.10156647861003876,
-0.06757139414548874,
-0.006139739416539669,
0.00697973370552063,
0.06322897970676422,
-0.05518455430865288,
-0.05284017696976662,
0.003932147286832333,
0.011549036018550396,
-0.074522003531456,
-0.0074212453328073025,
0.02746574580669403,
0.014735360629856586,
0.027538547292351723,
0.012129264883697033,
-0.08754817396402359,
-0.006835689768195152,
0.0154845230281353,
0.01536473073065281,
0.020532481372356415,
-0.00006448289786931127,
-0.034053463488817215,
-0.021125271916389465,
0.0016151221934705973,
0.04035032540559769,
0.002770564751699567,
0.02108694054186344,
0.020123528316617012,
0.08144322782754898,
-0.08552195876836777,
0.006683134473860264,
-0.011511481367051601,
0.05734746530652046,
-0.017054347321391106,
-0.009497113525867462,
0.0400550477206707,
0.07843948900699615,
-0.009293008595705032,
-0.010616674087941647,
0.02459978312253952,
0.05272572115063667,
-0.008334701880812645,
-0.023143718019127846,
-0.02538004145026207,
-5.526429447400005e-8,
-0.10427461564540863,
-0.0697844997048378,
-0.09337115287780762,
0.005338345188647509,
0.02325528860092163,
0.016829736530780792,
0.031027186661958694,
0.009743882343173027,
0.0013105933321639895,
-0.06517183035612106,
0.012527982704341412,
0.05527971684932709,
-0.02717398852109909,
0.025802578777074814,
-0.04601740464568138,
-0.03937442600727081,
-0.09545306861400604,
0.02475782297551632,
-0.07519141584634781,
0.01223570667207241,
-0.005815781187266111,
0.043988969177007675,
-0.016595426946878433,
-0.010184482671320438,
0.0450611338019371,
-0.017773132771253586,
0.032251060009002686,
0.02226601541042328,
0.06647156924009323,
0.11282198131084442,
0.09307201951742172,
0.011742337606847286,
0.01814131811261177,
-0.019612399861216545,
0.012978540733456612,
-0.003644344862550497,
0.0528503879904747,
0.007333440240472555,
0.007476977538317442,
0.037852492183446884,
0.037106286734342575,
0.08634381741285324,
-0.025472210720181465,
0.0520760715007782,
0.0167859997600317,
-0.08620009571313858,
-0.09481698274612427,
-0.011891478672623634,
0.05554937943816185,
-0.055363744497299194,
-0.0389053113758564,
0.06763824075460434,
-0.0777134820818901,
0.06032032147049904,
-0.038413792848587036,
-0.03236065059900284,
-0.014038301073014736,
0.013509745709598064,
-0.019493086263537407,
0.02842562645673752,
0.0018638577312231064,
-0.05313381925225258,
0.015242761932313442,
0.05053051933646202
] | 0.071308 |
contains a top-level lexical declaration (`const`, `let`, > or `class`) of any of the CommonJS wrapper variables (`require`, > `exports`, `module`, `\_\_filename`, or `\_\_dirname`) then return \*\*true\*\*. > 3. Else return \*\*false\*\*. ### Customizing ESM specifier resolution algorithm [Module customization hooks][] provide a mechanism for customizing the ESM specifier resolution algorithm. An example that provides CommonJS-style resolution for ESM specifiers is [commonjs-extension-resolution-loader][]. [6.1.7 Array Index]: https://tc39.es/ecma262/#integer-index [Addons]: addons.md [Built-in modules]: modules.md#built-in-modules [CommonJS]: modules.md [Determining module system]: packages.md#determining-module-system [Dynamic `import()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import [ES Module Integration Proposal for WebAssembly]: https://github.com/webassembly/esm-integration [Import Attributes]: #import-attributes [Import Attributes MDN]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import/with [JSON modules]: #json-modules [Loading ECMAScript modules using `require()`]: modules.md#loading-ecmascript-modules-using-require [Module customization hooks]: module.md#customization-hooks [Node.js Module Resolution And Loading Algorithm]: #resolution-algorithm-specification [Source Phase Imports]: https://github.com/tc39/proposal-source-phase-imports [Terminology]: #terminology [URL]: https://url.spec.whatwg.org/ [WebAssembly JS String Builtins Proposal]: https://github.com/WebAssembly/js-string-builtins [`"exports"`]: packages.md#exports [`"type"`]: packages.md#type [`--input-type`]: cli.md#--input-typetype [`data:` URLs]: https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/data [`export`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export [`import()`]: #import-expressions [`import.meta.dirname`]: #importmetadirname [`import.meta.filename`]: #importmetafilename [`import.meta.main`]: #importmetamain [`import.meta.resolve`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta/resolve [`import.meta.url`]: #importmetaurl [`import`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import [`module.createRequire()`]: module.md#modulecreaterequirefilename [`module.syncBuiltinESMExports()`]: module.md#modulesyncbuiltinesmexports [`package.json`]: packages.md#nodejs-packagejson-field-definitions [`path.dirname()`]: path.md#pathdirnamepath [`process.dlopen`]: process.md#processdlopenmodule-filename-flags [`require(esm)`]: modules.md#loading-ecmascript-modules-using-require [`url.fileURLToPath()`]: url.md#urlfileurltopathurl-options [commonjs-extension-resolution-loader]: https://github.com/nodejs/loaders-test/tree/main/commonjs-extension-resolution-loader [custom https loader]: module.md#import-from-https [import.meta.resolve]: #importmetaresolvespecifier [merve]: https://github.com/anonrig/merve/tree/v1.0.0 [percent-encoded]: url.md#percent-encoding-in-urls [special scheme]: https://url.spec.whatwg.org/#special-scheme [status code]: process.md#exit-codes [the official standard format]: https://tc39.github.io/ecma262/#sec-modules [url.pathToFileURL]: url.md#urlpathtofileurlpath-options | https://github.com/nodejs/node/blob/main//doc/api/esm.md | main | nodejs | [
-0.021477842703461647,
0.007488431874662638,
0.034186217933893204,
0.01155165396630764,
0.07138056308031082,
-0.063120998442173,
-0.006949991453438997,
0.030481180176138878,
-0.042791251093149185,
0.01570654846727848,
-0.013430251739919186,
0.0026914614718407393,
-0.007745730224996805,
0.028105130419135094,
0.09203703701496124,
0.03132375702261925,
-0.02577967569231987,
0.02845894545316696,
-0.014327209442853928,
-0.0384158119559288,
0.08517917990684509,
0.011494545266032219,
0.05346102640032768,
-0.02911183424293995,
-0.029430896043777466,
0.0039606415666639805,
0.05525457486510277,
0.07299299538135529,
0.05409496650099754,
-0.0586189366877079,
0.05381422117352486,
0.09628330916166306,
0.010846826247870922,
0.03557603061199188,
0.01026312168687582,
0.08346276730298996,
-0.0039178431034088135,
-0.09875408560037613,
0.012574856169521809,
-0.05898217856884003,
0.042235564440488815,
0.07412470132112503,
0.028644323348999023,
-0.06825672090053558,
0.016615942120552063,
-0.05858081206679344,
-0.08118205517530441,
-0.03396020084619522,
-0.16828283667564392,
-0.00860278494656086,
0.03678297623991966,
-0.07553686201572418,
-0.10523249208927155,
-0.01898651197552681,
0.03305752947926521,
0.020866431295871735,
-0.06611111015081406,
0.015447570011019707,
-0.0016747304471209645,
0.10326597094535828,
-0.03791825845837593,
-0.0016203514533117414,
-0.00357169471681118,
-0.001457713544368744,
0.009283922612667084,
0.0356760174036026,
0.07088875770568848,
0.008011668920516968,
-0.0008462844416499138,
0.025271184742450714,
-0.06251531839370728,
0.0265461727976799,
0.08681973814964294,
0.05246530845761299,
-0.06930972635746002,
-0.06697501242160797,
-0.05148226022720337,
0.059199947863817215,
-0.0028829711955040693,
0.02673957683146,
-0.08471491932868958,
-0.00030681179487146437,
0.01017643604427576,
0.05221804603934288,
0.07461169362068176,
0.04851403832435608,
-0.01446069311350584,
-0.010747200809419155,
0.06236623600125313,
0.011358372867107391,
-0.0414283312857151,
-0.18507681787014008,
-0.056604161858558655,
0.07620729506015778,
-0.03947887942194939,
0.015550903044641018,
-0.0072342450730502605,
-0.009161802008748055,
-0.005397223401814699,
0.05108268931508064,
-0.014724786393344402,
0.03523535281419754,
0.0932125449180603,
0.024065840989351273,
0.0683540552854538,
0.014445208944380283,
0.06002561375498772,
0.03319737687706947,
-0.036955010145902634,
-0.010832644067704678,
0.053288958966732025,
-0.0014499286189675331,
0.026144754141569138,
-0.06359444558620453,
0.028670646250247955,
-0.014826334081590176,
0.06704596430063248,
-0.023941177874803543,
0.1262209564447403,
0.04595230892300606,
0.06653928756713867,
-0.002162439515814185,
0.049745939671993256,
-0.07398132234811783,
0.08060453832149506,
0.032793741673231125,
-0.029963510110974312,
4.9971789322691665e-33,
0.035742830485105515,
0.023579657077789307,
-0.038580190390348434,
0.1055808886885643,
0.04223272576928139,
0.03669435903429985,
0.015081186778843403,
-0.019231343641877174,
-0.0976242646574974,
0.020447565242648125,
0.04647799953818321,
0.13301947712898254,
-0.014638237655162811,
0.034581467509269714,
0.03010481968522072,
-0.01324572041630745,
0.023895729333162308,
0.0567593090236187,
0.02800346165895462,
0.014482389204204082,
0.04176560789346695,
0.03500352054834366,
-0.024743737652897835,
0.021526873111724854,
-0.02991587109863758,
0.014330262318253517,
-0.020939456298947334,
-0.009613815695047379,
-0.059439390897750854,
-0.0003110129327978939,
0.0708429142832756,
-0.010821766220033169,
0.04185023158788681,
0.09372064471244812,
0.0466296523809433,
-0.026793792843818665,
-0.05595431476831436,
0.03288548067212105,
-0.051400572061538696,
-0.010061092674732208,
0.013000094331800938,
0.01797417178750038,
-0.07175485044717789,
-0.01137333270162344,
-0.07617901265621185,
-0.1152384802699089,
-0.03345884010195732,
-0.09308557212352753,
0.0905134379863739,
-0.06357622146606445,
-0.036969829350709915,
0.040967073291540146,
0.05727120861411095,
-0.03705623745918274,
0.08042410761117935,
-0.0040614549070596695,
0.04366785287857056,
-0.006710196379572153,
0.030680397525429726,
-0.022452007979154587,
-0.026673147454857826,
-0.0046941437758505344,
-0.052061036229133606,
0.0314050056040287,
0.03880608081817627,
-0.010035029612481594,
-0.009039103984832764,
-0.02393968775868416,
-0.013880858197808266,
0.013390080071985722,
-0.01056387647986412,
0.015755558386445045,
0.0020637339912354946,
0.011912325397133827,
0.061259496957063675,
-0.08670368045568466,
0.002468554303050041,
0.02079566940665245,
-0.04241493344306946,
-0.06158282235264778,
-0.0012009602505713701,
0.014005409553647041,
0.010331639088690281,
0.025062527507543564,
0.013217009603977203,
-0.008093047887086868,
-0.039925508201122284,
-0.017018577083945274,
0.055402714759111404,
-0.023745864629745483,
-0.00022228117450140417,
0.01729235053062439,
-0.05629235878586769,
-0.09639102220535278,
-0.11238910257816315,
-4.498428434158778e-33,
0.07943296432495117,
0.009704537689685822,
0.009846200235188007,
0.10559780150651932,
-0.0896555483341217,
-0.04797377064824104,
0.04521505907177925,
0.03616098314523697,
0.03227553889155388,
-0.07326778024435043,
0.022581296041607857,
0.023194439709186554,
0.021017281338572502,
-0.03502434864640236,
0.0626569390296936,
0.12010861188173294,
-0.10027392953634262,
-0.11093095690011978,
0.05327840894460678,
-0.07220297306776047,
0.028284890577197075,
0.04746329411864281,
-0.005887763109058142,
-0.008594486862421036,
-0.02165365032851696,
-0.0022370603401213884,
-0.06200317665934563,
-0.03236888721585274,
-0.020853661000728607,
-0.03285127133131027,
-0.06760648638010025,
-0.0738379955291748,
-0.029439350590109825,
-0.01330386009067297,
-0.07071809470653534,
-0.05249662697315216,
-0.001570211723446846,
0.07078900188207626,
-0.04335528612136841,
-0.00046258774818852544,
0.0135048171505332,
0.010046917013823986,
-0.08557534217834473,
-0.014802641235291958,
-0.002694576047360897,
-0.045573268085718155,
0.03253209963440895,
0.020917775109410286,
0.05230340361595154,
-0.09757470339536667,
-0.024982701987028122,
-0.06308213621377945,
-0.032680921256542206,
-0.0297117717564106,
-0.036297507584095,
-0.04137042537331581,
-0.009495826438069344,
-0.04434654116630554,
-0.02675490453839302,
0.05386381223797798,
0.08965637534856796,
-0.10700725764036179,
-0.04709191247820854,
-0.07937806099653244,
0.00883547030389309,
-0.00816267915070057,
-0.06757411360740662,
-0.009921379387378693,
0.04060705378651619,
-0.015989646315574646,
-0.00884973630309105,
-0.038756150752305984,
-0.04729807376861572,
-0.02420649491250515,
0.0029270504601299763,
-0.021187499165534973,
0.0060414886102080345,
-0.030785392969846725,
0.03331819549202919,
0.03731172904372215,
0.0590449720621109,
0.027883823961019516,
-0.05266802757978439,
0.024256577715277672,
0.048916954547166824,
0.02696712128818035,
0.008182675577700138,
0.08884572982788086,
-0.010280254296958447,
-0.005269523710012436,
0.01920292153954506,
0.058367837220430374,
-0.07802219688892365,
-0.0003600680211093277,
-0.03194775432348251,
-5.770099775759263e-8,
-0.1374547779560089,
-0.048424702137708664,
-0.13089874386787415,
-0.05719692260026932,
0.02301217056810856,
-0.0023687609937042,
0.05299118533730507,
0.007253998424857855,
0.05983709171414375,
-0.013140021823346615,
0.09892235696315765,
0.06923974305391312,
-0.03606155514717102,
0.08884000778198242,
0.017426278442144394,
-0.013346635736525059,
-0.02385127916932106,
0.12890198826789856,
-0.09243138134479523,
0.01883106864988804,
-0.04029771685600281,
0.04139915108680725,
0.055916134268045425,
0.006674072239547968,
0.06094658374786377,
-0.009943070821464062,
-0.010641980916261673,
0.0569288544356823,
0.016824673861265182,
0.06181076541543007,
-0.1129928007721901,
0.03200022131204605,
0.033534735441207886,
-0.011489304713904858,
-0.016038881614804268,
0.05111754685640335,
-0.02048330195248127,
0.002299671759828925,
0.03595299273729324,
0.052257876843214035,
0.03047403134405613,
-0.01744828373193741,
-0.09228123724460602,
0.06492143124341965,
0.04557120427489281,
-0.0033327226992696524,
-0.01502750813961029,
-0.03504297882318497,
-0.0807686522603035,
-0.06710560619831085,
0.06519655138254166,
0.03921135887503624,
-0.04472913220524788,
0.04267629235982895,
-0.06536336988210678,
-0.007122285198420286,
0.0021206513047218323,
-0.005775453522801399,
-0.004736987873911858,
-0.017660822719335556,
0.04334265738725662,
0.010032338090240955,
0.060839515179395676,
-0.045142848044633865
] | 0.154859 |
# About this documentation Welcome to the official API reference documentation for Node.js! Node.js is a JavaScript runtime built on the [V8 JavaScript engine][]. ## Contributing Report errors in this documentation in [the issue tracker][]. See [the contributing guide][] for directions on how to submit pull requests. ## Stability index Throughout the documentation are indications of a section's stability. Some APIs are so proven and so relied upon that they are unlikely to ever change at all. Others are brand new and experimental, or known to be hazardous. The stability indexes are as follows: > Stability: 0 - Deprecated. The feature may emit warnings. Backward > compatibility is not guaranteed. > Stability: 1 - Experimental. The feature is not subject to > [semantic versioning][] rules. Non-backward compatible changes or removal may > occur in any future release. Use of the feature is not recommended in > production environments. > > Experimental features are subdivided into stages: > > \* 1.0 - Early development. Experimental features at this stage are unfinished > and subject to substantial change. > \* 1.1 - Active development. Experimental features at this stage are nearing > minimum viability. > \* 1.2 - Release candidate. Experimental features at this stage are hopefully > ready to become stable. No further breaking changes are anticipated but may > still occur in response to user feedback or the features' underlying > specification development. We encourage user testing and feedback so that > we can know that this feature is ready to be marked as stable. > > Experimental features leave the experimental status typically either by > graduating to stable, or are removed without a deprecation cycle. > Stability: 2 - Stable. Compatibility with the npm ecosystem is a high > priority. > Stability: 3 - Legacy. Although this feature is unlikely to be removed and is > still covered by semantic versioning guarantees, it is no longer actively > maintained, and other alternatives are available. Features are marked as legacy rather than being deprecated if their use does no harm, and they are widely relied upon within the npm ecosystem. Bugs found in legacy features are unlikely to be fixed. Use caution when making use of Experimental features, particularly when authoring libraries. Users may not be aware that experimental features are being used. Bugs or behavior changes may surprise users when Experimental API modifications occur. To avoid surprises, use of an Experimental feature may need a command-line flag. Experimental features may also emit a [warning][]. ## Stability overview ## JSON output Every `.html` document has a corresponding `.json` document. This is for IDEs and other utilities that consume the documentation. ## System calls and man pages Node.js functions which wrap a system call will document that. The docs link to the corresponding man pages which describe how the system call works. Most Unix system calls have Windows analogues. Still, behavior differences may be unavoidable. [V8 JavaScript engine]: https://v8.dev/ [semantic versioning]: https://semver.org/ [the contributing guide]: https://github.com/nodejs/node/blob/HEAD/CONTRIBUTING.md [the issue tracker]: https://github.com/nodejs/node/issues/new [warning]: process.md#event-warning | https://github.com/nodejs/node/blob/main//doc/api/documentation.md | main | nodejs | [
-0.048651546239852905,
-0.010997778736054897,
0.035166364163160324,
0.05956641957163811,
0.08562659472227097,
-0.025782275944948196,
-0.12311645597219467,
0.025363534688949585,
-0.0764101892709732,
-0.01448400691151619,
-0.05889443680644035,
0.0962047427892685,
-0.0389450378715992,
-0.08448878675699234,
-0.012310429476201534,
0.07021839916706085,
0.04358379542827606,
-0.0027501555159687996,
-0.0016612224280834198,
0.040216632187366486,
-0.029159823432564735,
-0.022680215537548065,
0.042179908603429794,
-0.002356738317757845,
-0.00651527289301157,
0.017510516569018364,
-0.11094162613153458,
0.018162071704864502,
0.04515752196311951,
-0.006476750131696463,
-0.05910559743642807,
0.020048368722200394,
-0.08141382783651352,
-0.009593918919563293,
-0.08198746293783188,
0.045934613794088364,
0.01956011913716793,
-0.08895526081323624,
-0.022244157269597054,
-0.0006866184994578362,
-0.013316434808075428,
0.045786239206790924,
-0.020427649840712547,
-0.08619433641433716,
0.04172046482563019,
-0.030283771455287933,
-0.10505787283182144,
-0.03198573738336563,
-0.10776066780090332,
0.034259263426065445,
-0.0018789893947541714,
-0.05995604395866394,
0.028796538710594177,
-0.031537361443042755,
0.023733898997306824,
0.019329657778143883,
-0.030936218798160553,
0.032920777797698975,
0.01957108825445175,
0.09977158159017563,
0.10179933905601501,
-0.04755027964711189,
-0.004355798475444317,
-0.027955809608101845,
0.09104585647583008,
0.03581225872039795,
0.024311857298016548,
-0.09079482406377792,
0.016844768077135086,
0.04279988259077072,
-0.04611637443304062,
0.00012958158913534135,
-0.03766699135303497,
-0.04268379136919975,
-0.03364896401762962,
0.021567823365330696,
0.0038058264181017876,
0.0006482615135610104,
0.03235505893826485,
-0.021371634677052498,
-0.01685362309217453,
-0.06980162858963013,
-0.0402139313519001,
0.03556496649980545,
-0.025235481560230255,
0.07666537910699844,
0.026080094277858734,
-0.022919220849871635,
0.022881900891661644,
0.03870513662695885,
-0.009045515209436417,
-0.022470757365226746,
0.054011087864637375,
0.053325772285461426,
-0.0116276191547513,
0.044289007782936096,
-0.02006208710372448,
-0.027536755427718163,
-0.04111021012067795,
0.003038747701793909,
-0.0023779182229191065,
0.010822485201060772,
0.08097359538078308,
0.029321987181901932,
0.024671247228980064,
-0.04181733354926109,
0.022114211693406105,
-0.02974291332066059,
0.01084250770509243,
0.055037278681993484,
-0.0034844500478357077,
0.049795374274253845,
-0.008987589739263058,
-0.05296405404806137,
-0.08573082089424133,
-0.037625622004270554,
0.009063014760613441,
-0.024623848497867584,
0.0910939946770668,
0.08605610579252243,
0.1398244947195053,
0.04501095414161682,
0.0451415553689003,
-0.03332919999957085,
0.036410849541425705,
-0.03935958072543144,
0.013665389269590378,
6.121225568775809e-33,
0.00048452161718159914,
-0.03649815544486046,
0.017910471186041832,
0.07249101996421814,
0.008847874589264393,
-0.03811820223927498,
0.012392397969961166,
-0.03983761742711067,
-0.14320775866508484,
-0.006922471337020397,
0.02660832554101944,
0.028006454929709435,
-0.07481428235769272,
-0.02769523300230503,
0.014932047575712204,
-0.06655362248420715,
0.046796396374702454,
0.0168082807213068,
0.08141592890024185,
-0.0036073995288461447,
0.02536076493561268,
-0.0963856428861618,
-0.042422208935022354,
0.00044769298983737826,
0.020525025203824043,
0.023866748437285423,
0.011656826362013817,
0.08729983866214752,
-0.10657180845737457,
0.015557447448372841,
0.006253849249333143,
0.05422183498740196,
-0.01973060518503189,
-0.04866103455424309,
0.013624981977045536,
-0.004314604215323925,
-0.09016336500644684,
-0.013548378832638264,
0.0021772554609924555,
0.0069724563509225845,
-0.030497316271066666,
0.08014218509197235,
-0.06007087975740433,
-0.02068188786506653,
0.08015131205320358,
-0.030265670269727707,
0.02615736611187458,
-0.05012486129999161,
0.032603561878204346,
-0.017836760729551315,
-0.09831929951906204,
0.06232890114188194,
-0.017597487196326256,
-0.025057604536414146,
0.056719593703746796,
-0.01998872496187687,
0.061499614268541336,
-0.0005654434789903462,
-0.10050506144762039,
0.02800518088042736,
0.0821363553404808,
0.0024000494740903378,
-0.028528736904263496,
-0.11199433356523514,
-0.04447909817099571,
0.08946733921766281,
-0.0578317791223526,
0.011312686838209629,
-0.0512678362429142,
0.016083508729934692,
0.001246791216544807,
0.021927643567323685,
-0.021379046142101288,
0.004286180250346661,
-0.01100489404052496,
-0.04717008396983147,
-0.054282478988170624,
0.010988755151629448,
0.04424939304590225,
-0.03445540368556976,
-0.024258777499198914,
-0.004231632221490145,
-0.05989518389105797,
0.08173591643571854,
0.03590119257569313,
-0.03667423874139786,
-0.026453455910086632,
0.04025924205780029,
0.03773669898509979,
0.07120613008737564,
0.07049903273582458,
0.011127819307148457,
0.021666178479790688,
-0.0036538473796099424,
-0.075182244181633,
-7.610864540041614e-33,
-0.10413060337305069,
-0.02875446155667305,
-0.12254851311445236,
0.1288837045431137,
-0.0835350751876831,
-0.07494581490755081,
-0.04744429886341095,
0.04805659502744675,
0.04449591785669327,
-0.015191236510872841,
-0.007239833474159241,
0.016332382336258888,
-0.08689416944980621,
-0.00814798567444086,
0.052495021373033524,
0.09204264730215073,
-0.12587828934192657,
-0.05322468653321266,
0.04897638410329819,
0.011861296370625496,
0.007730274461209774,
0.014330529607832432,
-0.04414452612400055,
0.07659251987934113,
-0.02232322096824646,
-0.04682176932692528,
-0.035253774374723434,
-0.06587918102741241,
-0.0023857515770941973,
-0.09263046085834503,
-0.02188115380704403,
-0.02158799022436142,
-0.03908306360244751,
0.10579361766576767,
0.04316038265824318,
-0.08367506414651871,
-0.053333260118961334,
-0.05754991993308067,
0.05559339374303818,
-0.03555189445614815,
0.01992766745388508,
0.06955675035715103,
-0.013257901184260845,
-0.024034691974520683,
0.05938797444105148,
0.0556565523147583,
0.04132360965013504,
0.08611555397510529,
-0.01431265752762556,
-0.03952207788825035,
0.024602781981229782,
-0.001421564375050366,
0.0351102352142334,
-0.004054929595440626,
-0.01596604846417904,
-0.00920202024281025,
-0.03183208033442497,
0.03553015738725662,
0.030305327847599983,
0.08713509887456894,
0.025584779679775238,
-0.013339345343410969,
0.004394646733999252,
0.007043521851301193,
0.024703536182641983,
0.027372295036911964,
-0.09947288781404495,
0.003586753737181425,
0.05562123283743858,
0.03449143096804619,
-0.007459232117980719,
-0.0570160448551178,
0.01629100739955902,
-0.046750083565711975,
-0.016398662701249123,
-0.044199611991643906,
0.023177767172455788,
-0.1312386393547058,
0.01739882305264473,
-0.03754544258117676,
-0.10518983751535416,
0.1623290479183197,
0.010255984961986542,
0.06575822830200195,
0.052344877272844315,
0.015797022730112076,
-0.017404140904545784,
0.053691569715738297,
-0.0313882902264595,
0.022137710824608803,
0.042486660182476044,
0.023984411731362343,
-0.15552976727485657,
-0.013748562894761562,
0.0011166168842464685,
-6.207319103168629e-8,
-0.05316788703203201,
0.0258383359760046,
-0.0925246924161911,
-0.013299857266247272,
0.034520141780376434,
0.016898706555366516,
0.030200907960534096,
-0.0236101895570755,
0.08435612916946411,
0.04677700251340866,
0.020167965441942215,
0.02461547963321209,
-0.02065317891538143,
0.0004103036771994084,
0.04001111537218094,
0.02251605875790119,
-0.04936627671122551,
0.10479476302862167,
-0.04613381624221802,
0.016798773780465126,
-0.049325644969940186,
0.01804070733487606,
0.04264272749423981,
-0.04025403782725334,
-0.024116214364767075,
-0.07532846927642822,
0.0380132682621479,
0.09510966390371323,
0.013363020494580269,
-0.000495163956657052,
-0.030239613726735115,
0.035461317747831345,
0.03832472488284111,
-0.022568462416529655,
0.048742230981588364,
0.0435183122754097,
-0.024662168696522713,
0.04417793080210686,
0.11358974874019623,
0.06873191148042679,
0.057237278670072556,
0.05140834301710129,
-0.05076773464679718,
0.05355202406644821,
-0.002285001100972295,
0.039805009961128235,
-0.024602217599749565,
-0.028874803334474564,
-0.006458821706473827,
-0.006423536688089371,
0.012267637997865677,
-0.032400667667388916,
-0.07025735080242157,
0.046512093394994736,
0.024684766307473183,
0.006937617436051369,
-0.04520106315612793,
-0.03969050198793411,
0.028314203023910522,
-0.027132323011755943,
0.06675810366868973,
0.019378606230020523,
0.06704135239124298,
-0.0171656534075737
] | 0.081975 |
# Console > Stability: 2 - Stable The `node:console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. The module exports two specific components: \* A `Console` class with methods such as `console.log()`, `console.error()`, and `console.warn()` that can be used to write to any Node.js stream. \* A global `console` instance configured to write to [`process.stdout`][] and [`process.stderr`][]. The global `console` can be used without calling `require('node:console')`. \_\*\*Warning\*\*\_: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. Programs that desire to depend on the synchronous / asynchronous behavior of the console functions should first figure out the nature of console's backing stream. This is because the stream is dependent on the underlying platform and standard stream configuration of the current process. See the [note on process I/O][] for more information. Example using the global `console`: ```js console.log('hello world'); // Prints: hello world, to stdout console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); // Prints error message and stack trace to stderr: // Error: Whoops, something bad happened // at [eval]:5:15 // at Script.runInThisContext (node:vm:132:18) // at Object.runInThisContext (node:vm:309:38) // at node:internal/process/execution:77:19 // at [eval]-wrapper:6:22 // at evalScript (node:internal/process/execution:76:60) // at node:internal/main/eval\_string:23:3 const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ``` Example using the `Console` class: ```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err); myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err const name = 'Will Robinson'; myConsole.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ``` ## Class: `Console` The `Console` class can be used to create a simple logger with configurable output streams and can be accessed using either `require('node:console').Console` or `console.Console` (or their destructured counterparts): ```mjs import { Console } from 'node:console'; ``` ```cjs const { Console } = require('node:console'); ``` ```js const { Console } = console; ``` ### `new Console(stdout[, stderr][, ignoreErrors])` ### `new Console(options)` \* `options` {Object} \* `stdout` {stream.Writable} \* `stderr` {stream.Writable} \* `ignoreErrors` {boolean} Ignore errors when writing to the underlying streams. \*\*Default:\*\* `true`. \* `colorMode` {boolean|string} Set color support for this `Console` instance. Setting to `true` enables coloring while inspecting values. Setting to `false` disables coloring while inspecting values. Setting to `'auto'` makes color support depend on the value of the `isTTY` property and the value returned by `getColorDepth()` on the respective stream. This option can not be used, if `inspectOptions.colors` is set as well. \*\*Default:\*\* `'auto'`. \* `inspectOptions` {Object|Map} Specifies options that are passed along to [`util.inspect()`][]. Can be an options object or, if different options for stdout and stderr are desired, a `Map` from stream objects to options. \* `groupIndentation` {number} Set group indentation. \*\*Default:\*\* `2`. Creates a new `Console` with one or two writable stream instances. `stdout` is a writable stream to print log or info output. `stderr` is used for warning or error output. If `stderr` is not provided, `stdout` is used for `stderr`. ```mjs import { createWriteStream } from 'node:fs'; import { Console } from 'node:console'; // Alternatively // const { Console } = console; const output = createWriteStream('./stdout.log'); const errorOutput = createWriteStream('./stderr.log'); // Custom simple logger const logger = new Console({ stdout: output, stderr: errorOutput }); // use it like console const count = 5; logger.log('count: %d', count); // In stdout.log: count 5 ``` ```cjs | https://github.com/nodejs/node/blob/main//doc/api/console.md | main | nodejs | [
-0.011594424955546856,
-0.021868811920285225,
-0.01944529451429844,
0.05513899400830269,
0.13284580409526825,
-0.0373120978474617,
-0.03609495609998703,
0.08691086620092392,
0.04157190024852753,
-0.011215905658900738,
-0.06483466178178787,
0.03565612807869911,
0.008522569201886654,
-0.04768962785601616,
0.01549539715051651,
-0.0017949212342500687,
-0.011385805904865265,
-0.019084880128502846,
-0.000712530396413058,
-0.027523698285222054,
0.028004752472043037,
0.017341628670692444,
-0.006167513784021139,
0.03210552781820297,
-0.07918571680784225,
0.015228929929435253,
-0.051180098205804825,
-0.0373227521777153,
0.04539228603243828,
-0.001078174915164709,
-0.07263001054525375,
-0.04650011286139488,
-0.08356381952762604,
0.008285701274871826,
-0.07414165139198303,
0.11756233870983124,
0.03002290613949299,
-0.11665945500135422,
-0.08937560766935349,
-0.02043825387954712,
0.04683220386505127,
0.0968751609325409,
-0.09512477368116379,
-0.05078480392694473,
-0.022937344387173653,
-0.0696941688656807,
-0.12949085235595703,
-0.010138241574168205,
-0.1123136654496193,
-0.02535381354391575,
0.003956409636884928,
0.017648804932832718,
0.01369126234203577,
-0.07483386248350143,
0.004105198662728071,
0.058260656893253326,
0.0023516169749200344,
-0.006723887752741575,
0.044911324977874756,
0.09518825262784958,
-0.042948346585035324,
-0.004732196684926748,
-0.01654079556465149,
0.012911076657474041,
0.08978401124477386,
0.014607870951294899,
-0.00493733212351799,
0.03205965459346771,
0.012806105427443981,
0.08707960695028305,
-0.0836019441485405,
0.007326992694288492,
-0.05890270322561264,
-0.01679346337914467,
-0.0795091986656189,
-0.08577883243560791,
0.004528459161520004,
0.020597606897354126,
-0.034077394753694534,
0.0605149045586586,
-0.026876788586378098,
-0.03936237096786499,
-0.010109680704772472,
0.027425279840826988,
-0.017007088288664818,
0.1218390241265297,
-0.03683279827237129,
0.0017122173449024558,
0.015015341341495514,
0.036674343049526215,
-0.057931188493967056,
-0.09990355372428894,
0.006330209318548441,
0.1069740280508995,
-0.03946172446012497,
0.017478574067354202,
0.056028470396995544,
0.017548998817801476,
-0.017027685418725014,
0.019215339794754982,
-0.031923193484544754,
0.04573763161897659,
0.09332173317670822,
-0.0012028098572045565,
0.06672655045986176,
-0.01771792210638523,
-0.025693409144878387,
0.023079566657543182,
0.039221640676259995,
-0.021419821307063103,
-0.0028458721935749054,
0.04264437407255173,
-0.01377211045473814,
0.003164000576362014,
0.04067744314670563,
0.013920416124165058,
0.02236313559114933,
-0.036919109523296356,
0.0748487189412117,
0.13737858831882477,
0.15570318698883057,
0.04847903922200203,
0.05228635296225548,
0.055916331708431244,
0.12926951050758362,
-0.0091213658452034,
0.049792565405368805,
2.6087173074303e-33,
0.030970342457294464,
-0.08925911784172058,
0.04017820954322815,
0.05463293939828873,
0.05586890131235123,
0.07792243361473083,
0.017981868237257004,
0.019502298906445503,
-0.03552834689617157,
-0.010722516104578972,
0.02193126082420349,
0.02879948914051056,
-0.02226179465651512,
-0.03146830573678017,
0.038402192294597626,
-0.011895117349922657,
0.09098158776760101,
0.015872592106461525,
0.08241947740316391,
0.02704665996134281,
0.023255730047822,
-0.028534887358546257,
0.012685704976320267,
0.015788715332746506,
0.03226502612233162,
-0.0025309983175247908,
-0.0238304752856493,
0.004456221126019955,
-0.011232981458306313,
0.0090872123837471,
-0.04262036457657814,
0.04559144750237465,
0.00887052621692419,
0.008706032298505306,
0.04409697279334068,
-0.05638943985104561,
-0.05817275494337082,
-0.02026936039328575,
-0.05970650538802147,
0.013357355259358883,
-0.044117607176303864,
0.02329082600772381,
-0.06084812432527542,
0.005053121596574783,
-0.002243831055238843,
-0.12496286630630493,
-0.04627681151032448,
-0.015216832980513573,
-0.015734171494841576,
-0.04298635572195053,
-0.044408105313777924,
0.10726424306631088,
0.0435616634786129,
-0.014712335541844368,
0.04492991790175438,
-0.05338633432984352,
0.07991935312747955,
-0.047275349497795105,
-0.03570248931646347,
0.04221191629767418,
0.05466760694980621,
-0.020144984126091003,
-0.02250227890908718,
-0.02409779652953148,
0.030961785465478897,
0.0364767462015152,
-0.039808906614780426,
0.012354847975075245,
-0.011456704698503017,
-0.0022254984360188246,
-0.060814566910266876,
0.026392102241516113,
-0.005000234115868807,
0.008895589970052242,
0.033140797168016434,
0.007031118962913752,
-0.08056583255529404,
-0.020895643159747124,
-0.00662813289090991,
-0.07168237864971161,
0.030527539551258087,
-0.018039727583527565,
-0.07788898795843124,
0.07148352265357971,
0.008953391574323177,
-0.00727528752759099,
-0.020223548635840416,
0.02437472902238369,
-0.006653449963778257,
0.05093101039528847,
-0.012806533835828304,
-0.05365082994103432,
0.029947811737656593,
-0.04888322204351425,
-0.0568857304751873,
-6.467328207198338e-33,
-0.0322684571146965,
0.005415747873485088,
-0.09403465688228607,
0.06859174370765686,
-0.05212065950036049,
-0.05320347100496292,
-0.060380782932043076,
-0.049977049231529236,
0.01471086498349905,
-0.014051119796931744,
-0.06042315438389778,
0.0423959381878376,
-0.015360255725681782,
0.08544714003801346,
0.009137316606938839,
0.11844669282436371,
-0.0907120332121849,
-0.019414979964494705,
0.02626618929207325,
-0.1113082617521286,
0.060249652713537216,
-0.016364486888051033,
0.04286358505487442,
0.022475559264421463,
-0.015033562667667866,
-0.04916604980826378,
-0.012991128489375114,
-0.02465386502444744,
-0.013891348615288734,
-0.07947590202093124,
0.0016001652693375945,
0.07608220726251602,
0.01551290974020958,
0.01741950213909149,
-0.007866108790040016,
-0.040374767035245895,
0.02131587453186512,
0.03153012692928314,
0.03905190899968147,
-0.024133170023560524,
0.09811896830797195,
0.06942268460988998,
0.007212738040834665,
-0.025956464931368828,
0.002078674267977476,
0.03366732597351074,
0.01746799424290657,
-0.03203827887773514,
0.0038502051029354334,
-0.018893500789999962,
-0.017175117507576942,
-0.08159308135509491,
0.009729655459523201,
0.017745358869433403,
-0.09056641906499863,
-0.06964060664176941,
-0.011136215180158615,
0.008719007484614849,
-0.008782449178397655,
0.014462734572589397,
0.03464925289154053,
-0.030116239562630653,
-0.08039939403533936,
-0.040365107357501984,
-0.015234038233757019,
-0.07556785643100739,
-0.019080275669693947,
-0.01438609417527914,
0.11833483725786209,
-0.01504476647824049,
0.010834394954144955,
-0.04381268471479416,
-0.009645611047744751,
0.0505971722304821,
-0.029350407421588898,
0.027466248720884323,
-0.006578544620424509,
-0.15241435170173645,
-0.01795930229127407,
0.043143901973962784,
-0.05903701111674309,
0.0523662231862545,
-0.02468132972717285,
0.007055001333355904,
0.02691597491502762,
-0.02392607554793358,
0.08296182006597519,
0.08307724446058273,
-0.04009615257382393,
-0.011645638383924961,
0.024010004475712776,
0.08286281675100327,
-0.14199015498161316,
-0.05327562242746353,
-0.021831480786204338,
-5.114357648494661e-8,
-0.027728945016860962,
-0.030717961490154266,
-0.14201213419437408,
-0.022303057834506035,
0.06271132081747055,
-0.03288767486810684,
0.04789748415350914,
-0.02587825246155262,
0.03200182691216469,
0.03333421051502228,
-0.047555018216371536,
0.006581553258001804,
0.017964377999305725,
-0.10457423329353333,
0.010719976387917995,
0.055340394377708435,
-0.04667430371046066,
0.0031341766007244587,
-0.017030835151672363,
-0.03735733777284622,
0.031382638961076736,
-0.016814187169075012,
-0.00994099210947752,
0.06880015134811401,
-0.08101578801870346,
-0.0777423232793808,
0.07896128296852112,
0.10141526907682419,
-0.04000694677233696,
-0.034274231642484665,
-0.06388366967439651,
0.0400143526494503,
0.006497622933238745,
-0.002333484124392271,
0.012074779719114304,
0.05894865840673447,
0.03286174312233925,
-0.05011957511305809,
0.07457856088876724,
0.04143642634153366,
-0.0008053328492678702,
0.05589932203292847,
-0.033661071211099625,
0.02602037787437439,
-0.025393657386302948,
-0.012849719263613224,
-0.022805307060480118,
0.003408886259421706,
0.034107159823179245,
-0.04809755086898804,
-0.0480186827480793,
-0.009233956225216389,
-0.08470148593187332,
0.08376174420118332,
-0.001860891468822956,
-0.01686771959066391,
-0.025630854070186615,
-0.10328003019094467,
0.011798584833741188,
0.017102709040045738,
0.011348946020007133,
-0.0017020676750689745,
0.1236083135008812,
-0.04918842762708664
] | 0.060572 |
// Alternatively // const { Console } = console; const output = createWriteStream('./stdout.log'); const errorOutput = createWriteStream('./stderr.log'); // Custom simple logger const logger = new Console({ stdout: output, stderr: errorOutput }); // use it like console const count = 5; logger.log('count: %d', count); // In stdout.log: count 5 ``` ```cjs const fs = require('node:fs'); const { Console } = require('node:console'); // Alternatively // const { Console } = console; const output = fs.createWriteStream('./stdout.log'); const errorOutput = fs.createWriteStream('./stderr.log'); // Custom simple logger const logger = new Console({ stdout: output, stderr: errorOutput }); // use it like console const count = 5; logger.log('count: %d', count); // In stdout.log: count 5 ``` The global `console` is a special `Console` whose output is sent to [`process.stdout`][] and [`process.stderr`][]. It is equivalent to calling: ```js new Console({ stdout: process.stdout, stderr: process.stderr }); ``` ### `console.assert(value[, ...message])` \* `value` {any} The value tested for being truthy. \* `...message` {any} All arguments besides `value` are used as error message. `console.assert()` writes a message if `value` is [falsy][] or omitted. It only writes a message and does not otherwise affect execution. The output always starts with `"Assertion failed"`. If provided, `message` is formatted using [`util.format()`][]. If `value` is [truthy][], nothing happens. ```js console.assert(true, 'does nothing'); console.assert(false, 'Whoops %s work', 'didn\'t'); // Assertion failed: Whoops didn't work console.assert(); // Assertion failed ``` ### `console.clear()` When `stdout` is a TTY, calling `console.clear()` will attempt to clear the TTY. When `stdout` is not a TTY, this method does nothing. The specific operation of `console.clear()` can vary across operating systems and terminal types. For most Linux operating systems, `console.clear()` operates similarly to the `clear` shell command. On Windows, `console.clear()` will clear only the output in the current terminal viewport for the Node.js binary. ### `console.count([label])` \* `label` {string} The display label for the counter. \*\*Default:\*\* `'default'`. Maintains an internal counter specific to `label` and outputs to `stdout` the number of times `console.count()` has been called with the given `label`. ```js > console.count() default: 1 undefined > console.count('default') default: 2 undefined > console.count('abc') abc: 1 undefined > console.count('xyz') xyz: 1 undefined > console.count('abc') abc: 2 undefined > console.count() default: 3 undefined > ``` ### `console.countReset([label])` \* `label` {string} The display label for the counter. \*\*Default:\*\* `'default'`. Resets the internal counter specific to `label`. ```js > console.count('abc'); abc: 1 undefined > console.countReset('abc'); undefined > console.count('abc'); abc: 1 undefined > ``` ### `console.debug(data[, ...args])` \* `data` {any} \* `...args` {any} The `console.debug()` function is an alias for [`console.log()`][]. ### `console.dir(obj[, options])` \* `obj` {any} \* `options` {Object} \* `showHidden` {boolean} If `true` then the object's non-enumerable and symbol properties will be shown too. \*\*Default:\*\* `false`. \* `depth` {number} Tells [`util.inspect()`][] how many times to recurse while formatting the object. This is useful for inspecting large complicated objects. To make it recurse indefinitely, pass `null`. \*\*Default:\*\* `2`. \* `colors` {boolean} If `true`, then the output will be styled with ANSI color codes. Colors are customizable; see [customizing `util.inspect()` colors][]. \*\*Default:\*\* `false`. Uses [`util.inspect()`][] on `obj` and prints the resulting string to `stdout`. This function bypasses any custom `inspect()` function defined on `obj`. ### `console.dirxml(...data)` \* `...data` {any} This method calls `console.log()` passing it the arguments received. This method does not produce any XML formatting. ### `console.error([data][, ...args])` \* `data` {any} \* `...args` {any} Prints to `stderr` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to [`util.format()`][]). ```js const code = 5; console.error('error #%d', code); // Prints: error #5, to stderr console.error('error', code); // Prints: | https://github.com/nodejs/node/blob/main//doc/api/console.md | main | nodejs | [
0.02709469199180603,
0.046701472252607346,
-0.014581411145627499,
0.037228915840387344,
-0.0000114935437522945,
0.017541948705911636,
-0.03883681446313858,
0.13245879113674164,
0.06543058156967163,
0.025444036349654198,
-0.038527969270944595,
-0.041239216923713684,
0.014320071786642075,
-0.004852816462516785,
-0.012806239537894726,
-0.06565354019403458,
-0.10789365321397781,
0.04740716889500618,
0.006990132853388786,
-0.07809191942214966,
0.09216088056564331,
-0.006486511789262295,
-0.015394183807075024,
0.015270108357071877,
-0.02974247746169567,
-0.028279569000005722,
-0.03664851561188698,
-0.061314720660448074,
0.01332218199968338,
-0.012415353208780289,
0.031874366104602814,
-0.05368305742740631,
-0.06695537269115448,
0.05206039547920227,
-0.02584548480808735,
0.05060776323080063,
0.004661483224481344,
-0.11495222896337509,
-0.023770878091454506,
-0.015957560390233994,
0.03723182901740074,
0.1030220314860344,
-0.01959412172436714,
-0.0400828942656517,
-0.003354896092787385,
-0.04470363259315491,
-0.13450542092323303,
0.060238782316446304,
-0.018168695271015167,
0.03140837699174881,
0.05332404002547264,
0.044143665581941605,
-0.014025242999196053,
-0.048894546926021576,
0.014449117705225945,
0.01352892816066742,
-0.04179093614220619,
-0.061894867569208145,
0.004259528126567602,
0.016708211973309517,
-0.024191563948988914,
-0.007638060953468084,
0.0408027358353138,
-0.07038810849189758,
0.03606855496764183,
-0.04109947383403778,
-0.03877951204776764,
0.13917265832424164,
0.0578303299844265,
0.13611727952957153,
-0.11626122146844864,
0.04722651466727257,
-0.0167961698025465,
-0.02464565448462963,
-0.06396473944187164,
-0.07182708382606506,
-0.0006374652730301023,
0.07385317981243134,
-0.05432434752583504,
0.05964173376560211,
-0.0491047166287899,
-0.0031803073361516,
-0.02589884214103222,
-0.0010152800241485238,
-0.011099327355623245,
0.10847587883472443,
-0.06774131953716278,
0.0621100552380085,
-0.017723064869642258,
-0.036212481558322906,
-0.10972054302692413,
-0.014522714540362358,
-0.07927519083023071,
0.05352359265089035,
-0.01905984617769718,
0.03296169638633728,
0.00743770832195878,
0.10243342816829681,
0.0141999376937747,
-0.00594343850389123,
-0.018926851451396942,
0.026399224996566772,
0.052565205842256546,
-0.039379652589559555,
0.02061675302684307,
0.006947303656488657,
-0.02362862043082714,
0.04283858463168144,
-0.010296201333403587,
-0.049283940345048904,
0.017525874078273773,
0.08692744374275208,
-0.007221105042845011,
-0.00861275289207697,
0.10461914539337158,
0.008112489245831966,
0.010484987869858742,
-0.08836963027715683,
0.06354193389415741,
0.09244188666343689,
0.11167982220649719,
-0.005883093923330307,
-0.0028138267807662487,
0.060714662075042725,
0.0732361301779747,
-0.053732678294181824,
0.09345542639493942,
1.4862670473533721e-33,
0.009232481941580772,
0.006698189303278923,
0.03956077992916107,
0.047173552215099335,
0.06342573463916779,
0.09721115231513977,
-0.0009373357170261443,
0.0056357309222221375,
-0.071934774518013,
0.00015053959214128554,
-0.07235807925462723,
-0.057023294270038605,
0.019926898181438446,
-0.05107535421848297,
0.044044774025678635,
-0.04081820696592331,
0.07030665129423141,
-0.005988474003970623,
0.0696185752749443,
-0.029983220621943474,
0.011633030138909817,
0.021951934322714806,
0.0206941869109869,
-0.03276030346751213,
0.06119123101234436,
-0.02095833420753479,
-0.01114055048674345,
-0.026159511879086494,
-0.03996526077389717,
-0.04899301379919052,
0.09554091840982437,
0.05084642767906189,
0.036901019513607025,
-0.024558793753385544,
0.06733499467372894,
-0.05058320239186287,
0.029365332797169685,
0.06910837441682816,
-0.10782964527606964,
-0.027986034750938416,
-0.04776665195822716,
0.0252396147698164,
-0.04170061647891998,
0.04449858516454697,
0.0016422937624156475,
-0.033580224961042404,
-0.04942888021469116,
-0.06314826756715775,
0.02027607336640358,
-0.06761888414621353,
0.02993134967982769,
0.10177179425954819,
0.024114780128002167,
-0.042166225612163544,
0.10273425281047821,
-0.02305658347904682,
0.03387521207332611,
-0.09485173225402832,
-0.01953079365193844,
0.015353982336819172,
0.021279683336615562,
0.057509612292051315,
-0.00679766433313489,
-0.008824270218610764,
0.04898490011692047,
0.013329090550541878,
0.06559010595083237,
0.02874753065407276,
0.02870882675051689,
-0.016282005235552788,
-0.05196341127157211,
-0.029222426936030388,
-0.00422781053930521,
-0.010375142097473145,
0.008535187691450119,
0.06323709338903427,
-0.0165898185223341,
-0.010436193086206913,
-0.07306032627820969,
-0.05008018761873245,
0.029972799122333527,
-0.08006886392831802,
-0.06759073585271835,
0.045726362615823746,
0.07983087003231049,
-0.003442597109824419,
-0.053500812500715256,
0.026414092630147934,
0.06786252558231354,
0.05262080952525139,
-0.03234292194247246,
-0.062481705099344254,
0.015378723852336407,
-0.10703292489051819,
-0.05767825245857239,
-3.633292877286391e-33,
-0.0305036474019289,
0.09752662479877472,
-0.05341290682554245,
0.043525680899620056,
0.0037173940800130367,
-0.005284775514155626,
0.019055720418691635,
-0.03892461583018303,
-0.013250489719212055,
0.028758855536580086,
-0.058705683797597885,
0.049367982894182205,
0.030213363468647003,
0.091855987906456,
-0.042964283376932144,
0.028935769572854042,
-0.11338987201452255,
0.03491939231753349,
-0.00632113590836525,
-0.0656527727842331,
0.03745044395327568,
0.009256415069103241,
0.07089842110872269,
0.029148263856768608,
-0.03835089132189751,
0.047517355531454086,
-0.0384015254676342,
0.010524353012442589,
-0.062388185411691666,
-0.07681848108768463,
0.04293372109532356,
-0.021839698776602745,
0.04565196484327316,
-0.007472586818039417,
0.05369811877608299,
-0.1093597486615181,
0.020364098250865936,
0.0985448807477951,
0.03359660506248474,
-0.0006692135357297957,
0.03654390200972557,
0.003063984913751483,
0.021816261112689972,
-0.0679398775100708,
-0.01633259654045105,
-0.016600361093878746,
0.0040514771826565266,
-0.03816808760166168,
0.00739607959985733,
-0.01135156862437725,
-0.07318631559610367,
-0.08287827670574188,
-0.06183052435517311,
0.047554951161146164,
-0.04524623602628708,
-0.06223409250378609,
0.011399730108678341,
-0.016964057460427284,
0.012932507321238518,
0.05810543894767761,
-0.040115077048540115,
-0.09283725172281265,
-0.0017387402476742864,
-0.03806667774915695,
0.016555162146687508,
-0.14166706800460815,
-0.08479152619838715,
0.030254608020186424,
0.052443988621234894,
-0.0030886714812368155,
-0.053223688155412674,
0.04178430512547493,
-0.005969309248030186,
0.09269169718027115,
0.026259344071149826,
-0.0002074203803204,
-0.03146320581436157,
-0.08659272640943527,
0.003641925286501646,
0.10774379968643188,
-0.04542490839958191,
0.011743356473743916,
-0.020418554544448853,
0.051338229328393936,
0.03461457043886185,
-0.01973898895084858,
0.09707014262676239,
0.03167169913649559,
-0.007714669685810804,
-0.012541777454316616,
0.004805116914212704,
0.08975423127412796,
-0.05953669548034668,
-0.06260206550359726,
-0.013103941455483437,
-3.929934422330916e-8,
-0.10106249898672104,
-0.07637550681829453,
-0.05233537778258324,
-0.026259776204824448,
0.03541319817304611,
-0.005532163195312023,
-0.023608826100826263,
-0.03893980011343956,
-0.0441933274269104,
0.0062422179616987705,
-0.09295015782117844,
-0.036826565861701965,
0.002926744520664215,
-0.04981711134314537,
0.0023644734174013138,
-0.04253343492746353,
0.011201429180800915,
-0.038184814155101776,
0.026334717869758606,
-0.013837960548698902,
0.029223717749118805,
0.04774310812354088,
-0.013062852434813976,
0.07336649298667908,
-0.03005680814385414,
-0.07766184210777283,
0.09451363980770111,
0.04450729116797447,
-0.07710149884223938,
0.006950447801500559,
-0.018343286588788033,
0.07901190966367722,
0.05006006360054016,
0.04759499803185463,
-0.01254967413842678,
-0.02484544739127159,
0.00310144922696054,
-0.012781853787600994,
-0.009611365385353565,
0.019886724650859833,
0.023809466511011124,
0.06099434196949005,
-0.014584669843316078,
0.03458969667553902,
-0.04759795591235161,
-0.06358388066291809,
0.010299473069608212,
-0.037671495229005814,
0.058876607567071915,
0.006150323897600174,
-0.027696527540683746,
-0.004293758887797594,
-0.02745874412357807,
0.022637492045760155,
-0.021427031606435776,
-0.043743740767240524,
-0.021797819063067436,
-0.0755545049905777,
0.0051221600733697414,
0.0030641588382422924,
0.08485224843025208,
0.0075811478309333324,
0.06247510015964508,
0.0050290534272789955
] | 0.060828 |
with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to [`util.format()`][]). ```js const code = 5; console.error('error #%d', code); // Prints: error #5, to stderr console.error('error', code); // Prints: error 5, to stderr ``` If formatting elements (e.g. `%d`) are not found in the first string then [`util.inspect()`][] is called on each argument and the resulting string values are concatenated. See [`util.format()`][] for more information. ### `console.group([...label])` \* `...label` {any} Increases indentation of subsequent lines by spaces for `groupIndentation` length. If one or more `label`s are provided, those are printed first without the additional indentation. ### `console.groupCollapsed()` An alias for [`console.group()`][]. ### `console.groupEnd()` Decreases indentation of subsequent lines by spaces for `groupIndentation` length. ### `console.info([data][, ...args])` \* `data` {any} \* `...args` {any} The `console.info()` function is an alias for [`console.log()`][]. ### `console.log([data][, ...args])` \* `data` {any} \* `...args` {any} Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to [`util.format()`][]). ```js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout ``` See [`util.format()`][] for more information. ### `console.table(tabularData[, properties])` \* `tabularData` {any} \* `properties` {string\[]} Alternate properties for constructing the table. Try to construct a table with the columns of the properties of `tabularData` (or use `properties`) and rows of `tabularData` and log it. Falls back to just logging the argument if it can't be parsed as tabular. ```js // These can't be parsed as tabular data console.table(Symbol()); // Symbol() console.table(undefined); // undefined console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]); // ┌─────────┬─────┬─────┐ // │ (index) │ a │ b │ // ├─────────┼─────┼─────┤ // │ 0 │ 1 │ 'Y' │ // │ 1 │ 'Z' │ 2 │ // └─────────┴─────┴─────┘ console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']); // ┌─────────┬─────┐ // │ (index) │ a │ // ├─────────┼─────┤ // │ 0 │ 1 │ // │ 1 │ 'Z' │ // └─────────┴─────┘ ``` ### `console.time([label])` \* `label` {string} \*\*Default:\*\* `'default'` Starts a timer that can be used to compute the duration of an operation. Timers are identified by a unique `label`. Use the same `label` when calling [`console.timeEnd()`][] to stop the timer and output the elapsed time in suitable time units to `stdout`. For example, if the elapsed time is 3869ms, `console.timeEnd()` displays "3.869s". ### `console.timeEnd([label])` \* `label` {string} \*\*Default:\*\* `'default'` Stops a timer that was previously started by calling [`console.time()`][] and prints the result to `stdout`: ```js console.time('bunch-of-stuff'); // Do a bunch of stuff. console.timeEnd('bunch-of-stuff'); // Prints: bunch-of-stuff: 225.438ms ``` ### `console.timeLog([label][, ...data])` \* `label` {string} \*\*Default:\*\* `'default'` \* `...data` {any} For a timer that was previously started by calling [`console.time()`][], prints the elapsed time and other `data` arguments to `stdout`: ```js console.time('process'); const value = expensiveProcess1(); // Returns 42 console.timeLog('process', value); // Prints "process: 365.227ms 42". doExpensiveProcess2(value); console.timeEnd('process'); ``` ### `console.trace([message][, ...args])` \* `message` {any} \* `...args` {any} Prints to `stderr` the string `'Trace: '`, followed by the [`util.format()`][] formatted message and stack trace to the current position in the code. ```js console.trace('Show me'); // Prints: (stack trace will vary based on where trace is called) // Trace: Show me // at repl:2:9 // at REPLServer.defaultEval (repl.js:248:27) // at bound (domain.js:287:14) // at REPLServer.runBound [as eval] (domain.js:300:12) // at REPLServer. (repl.js:412:12) // at emitOne (events.js:82:20) // at REPLServer.emit (events.js:169:7) // at | https://github.com/nodejs/node/blob/main//doc/api/console.md | main | nodejs | [
-0.048083070665597916,
0.028014788404107094,
0.0036532259546220303,
0.039575956761837006,
-0.0002726947423070669,
0.028107495978474617,
0.05275924503803253,
0.04520794004201889,
0.04165713116526604,
-0.06009215489029884,
-0.007229739334434271,
-0.0030872100032866,
-0.008045862428843975,
-0.058034252375364304,
0.012790342792868614,
0.002716328715905547,
-0.14364641904830933,
0.0008326161769218743,
-0.04615949094295502,
-0.08394095301628113,
0.08814171701669693,
0.02345978654921055,
-0.0348275750875473,
0.005094580817967653,
-0.018223917111754417,
0.03491804376244545,
0.013573297299444675,
-0.008190596476197243,
0.030655160546302795,
-0.0049133989959955215,
0.0025692859198898077,
-0.04107103496789932,
0.03150198608636856,
0.026277154684066772,
0.042959921061992645,
0.06395208835601807,
-0.02215643599629402,
-0.03464467078447342,
0.004214373417198658,
0.026264913380146027,
-0.026052989065647125,
0.08492284268140793,
-0.07482782751321793,
0.0019249266479164362,
0.02918865531682968,
-0.025545217096805573,
-0.12232328951358795,
0.012972895056009293,
-0.0411795973777771,
0.014946776442229748,
0.00448616873472929,
0.033864639699459076,
-0.037132952362298965,
-0.06459743529558182,
0.054660819470882416,
-0.06326459348201752,
-0.01817178726196289,
-0.07476231455802917,
0.04572364687919617,
-0.006440014112740755,
-0.01998477429151535,
-0.01597338728606701,
0.03590735048055649,
0.011908703483641148,
0.060353558510541916,
-0.023724418133497238,
0.01563032902777195,
0.09808136522769928,
-0.030008206143975258,
0.08971564471721649,
-0.10538157820701599,
0.055623091757297516,
-0.027868853881955147,
0.019945252686738968,
-0.05063743516802788,
-0.019330987706780434,
-0.01237490028142929,
0.08106430619955063,
0.01675190031528473,
0.03108178824186325,
-0.0033420673571527004,
-0.007541032042354345,
0.03750767931342125,
0.06508155912160873,
0.006506605539470911,
0.057287197560071945,
-0.04402333125472069,
0.01247099507600069,
0.02315133810043335,
-0.004487628582865,
-0.0007674905937165022,
-0.06661941111087799,
-0.08392469584941864,
0.11662959307432175,
0.0013045379891991615,
0.04598842188715935,
0.042200956493616104,
-0.03154659643769264,
-0.008104223757982254,
0.03561815246939659,
-0.013241099193692207,
0.012113146483898163,
0.09063100069761276,
-0.06625813990831375,
-0.036396268755197525,
-0.024954479187726974,
0.02543226256966591,
-0.03697546198964119,
-0.004225039388984442,
0.00578538840636611,
0.02116377092897892,
0.04198325425386429,
-0.02188931219279766,
0.03698186203837395,
0.03770269826054573,
-0.0309470035135746,
0.06725011020898819,
-0.0541745126247406,
0.12316931784152985,
0.039256881922483444,
0.12775017321109772,
-0.0010767128551378846,
-0.022770956158638,
0.029832646250724792,
0.06548060476779938,
0.014100057072937489,
0.04118800163269043,
2.564927387797285e-33,
-0.0013631545007228851,
-0.04578523710370064,
0.026520058512687683,
0.03389858454465866,
-0.04229660704731941,
0.0428115613758564,
-0.12297338247299194,
0.03256234526634216,
-0.0448262020945549,
-0.021969813853502274,
-0.013543506152927876,
-0.02194976806640625,
0.07547581195831299,
-0.027473928406834602,
0.0048154243268072605,
-0.012619533576071262,
0.06115672364830971,
0.045226119458675385,
-0.004629357717931271,
0.00293846451677382,
-0.11167218536138535,
0.04081624373793602,
0.08172781020402908,
0.02363506704568863,
-0.010324048809707165,
-0.0001360612513963133,
0.004025377333164215,
-0.03232572227716446,
-0.057547517120838165,
-0.03342580422759056,
-0.01525086723268032,
-0.07340840250253677,
0.009320858865976334,
0.06295108050107956,
0.01982330158352852,
0.080209881067276,
0.05119204521179199,
0.0035433729644864798,
-0.06983095407485962,
0.0684756487607956,
-0.07841409742832184,
0.0009693959727883339,
-0.007327105849981308,
0.04358121380209923,
0.01975390873849392,
-0.03537677973508835,
-0.06068192794919014,
0.046785201877355576,
0.003520822385326028,
0.0570673830807209,
-0.12099828571081161,
0.1277555376291275,
0.0500984825193882,
-0.013175949454307556,
0.0473870113492012,
0.03190581500530243,
0.03170057758688927,
-0.05293548107147217,
-0.032034166157245636,
-0.019938139244914055,
-0.028201719745993614,
0.07713453471660614,
0.02952241338789463,
0.05194530636072159,
0.01531102042645216,
0.009919745847582817,
0.06810237467288971,
0.056132588535547256,
0.04287051409482956,
-0.022207172587513924,
-0.09868579357862473,
0.0005065237055532634,
-0.016281675547361374,
0.024969778954982758,
-0.005454450845718384,
-0.05350688844919205,
-0.030885662883520126,
-0.0017811338184401393,
-0.004615964367985725,
-0.10800579935312271,
0.034719888120889664,
-0.007452431600540876,
-0.02181190997362137,
0.05951978638768196,
-0.013630617409944534,
0.01608145236968994,
0.01774473302066326,
-0.047029558569192886,
0.042036887258291245,
0.08284959197044373,
-0.042420972138643265,
-0.09706180542707443,
-0.05418431758880615,
-0.04889101907610893,
0.0012539817253127694,
-6.033606423917423e-33,
0.03500059247016907,
-0.013035503216087818,
0.01688973419368267,
0.0027490737847983837,
-0.059907544404268265,
-0.037245605140924454,
0.026015540584921837,
0.05210046097636223,
0.05928129330277443,
0.010771234519779682,
-0.02549145184457302,
0.04858076944947243,
-0.019099272787570953,
0.0031126930844038725,
0.017734192311763763,
0.038058992475271225,
-0.13418352603912354,
0.05080074071884155,
0.08016858249902725,
-0.0530422069132328,
0.1266026645898819,
-0.043597012758255005,
0.07388902455568314,
0.04356920346617699,
-0.07477907836437225,
0.03076453134417534,
0.07936404645442963,
-0.05450912564992905,
0.005750512704253197,
-0.0262692142277956,
0.05926568806171417,
-0.022433320060372353,
0.07259782403707504,
0.06000339239835739,
0.03172677010297775,
-0.06221974268555641,
0.06438078731298447,
0.07636995613574982,
-0.0007129315054044127,
-0.0015888640191406012,
0.07126043736934662,
0.05054266378283501,
0.007729081902652979,
-0.044106945395469666,
-0.019247841089963913,
-0.019339323043823242,
-0.020031524822115898,
0.035463716834783554,
-0.052503641694784164,
-0.04631220921874046,
-0.03395145758986473,
-0.09609675407409668,
-0.052281517535448074,
0.00155796785838902,
-0.08781011402606964,
-0.02120339870452881,
-0.059761736541986465,
-0.031548451632261276,
-0.06156442314386368,
0.07201311737298965,
-0.07147561758756638,
-0.04892706125974655,
-0.011009043082594872,
-0.08709410578012466,
0.052700866013765335,
-0.13981235027313232,
-0.04950585216283798,
-0.04431651532649994,
0.044745586812496185,
-0.03159462660551071,
-0.001263733021914959,
-0.10424207150936127,
-0.06586829572916031,
0.0009985805954784155,
-0.034022923558950424,
0.01688927598297596,
-0.040577422827482224,
-0.08807505667209625,
-0.026245156303048134,
0.03914131224155426,
0.04811691492795944,
-0.021089505404233932,
0.03405138850212097,
0.10234537720680237,
-0.06830006837844849,
0.035652413964271545,
0.11859861016273499,
0.10335046052932739,
-0.05718839168548584,
-0.057724349200725555,
0.05160794407129288,
0.052043721079826355,
-0.014412139542400837,
0.056964464485645294,
-0.06722565740346909,
-5.900977839701227e-8,
-0.06881071627140045,
-0.04523640125989914,
-0.04352555423974991,
-0.05170903354883194,
-0.0026486897841095924,
-0.0361504852771759,
-0.014320614747703075,
-0.06927903741598129,
-0.029768507927656174,
0.02763550542294979,
0.041269294917583466,
0.037476006895303726,
-0.052564844489097595,
-0.10417849570512772,
-0.04851892963051796,
0.0639059990644455,
-0.06092733517289162,
-0.027872134000062943,
-0.01758379116654396,
0.047888536006212234,
-0.026240499690175056,
0.002798385452479124,
-0.01706557534635067,
-0.06913257390260696,
-0.02926480770111084,
-0.0537482313811779,
0.061014872044324875,
0.07986598461866379,
-0.031864069402217865,
-0.014287672005593777,
-0.0076487804763019085,
0.035033464431762695,
0.05198542773723602,
0.01228312961757183,
-0.029168633744120598,
-0.048456888645887375,
-0.009057261049747467,
-0.07006310671567917,
0.10996005684137344,
0.09657366573810577,
-0.010994553565979004,
0.02166854776442051,
-0.04091377556324005,
-0.005761811044067144,
-0.1057765856385231,
-0.09304347634315491,
-0.029387762770056725,
-0.005916334688663483,
0.003548750188201666,
-0.0749039277434349,
-0.0525936521589756,
0.005463109351694584,
-0.06896449625492096,
0.004446300677955151,
-0.08005941659212112,
0.022456593811511993,
-0.07871738821268082,
0.007268351968377829,
0.017619147896766663,
0.05120348930358887,
0.03136212006211281,
0.046872470527887344,
0.05294402316212654,
-0.00870787538588047
] | 0.065753 |
```js console.trace('Show me'); // Prints: (stack trace will vary based on where trace is called) // Trace: Show me // at repl:2:9 // at REPLServer.defaultEval (repl.js:248:27) // at bound (domain.js:287:14) // at REPLServer.runBound [as eval] (domain.js:300:12) // at REPLServer. (repl.js:412:12) // at emitOne (events.js:82:20) // at REPLServer.emit (events.js:169:7) // at REPLServer.Interface.\_onLine (readline.js:210:10) // at REPLServer.Interface.\_line (readline.js:549:8) // at REPLServer.Interface.\_ttyWrite (readline.js:826:14) ``` ### `console.warn([data][, ...args])` \* `data` {any} \* `...args` {any} The `console.warn()` function is an alias for [`console.error()`][]. ## Inspector only methods The following methods are exposed by the V8 engine in the general API but do not display anything unless used in conjunction with the [inspector][] (`--inspect` flag). ### `console.profile([label])` \* `label` {string} This method does not display anything unless used in the inspector. The `console.profile()` method starts a JavaScript CPU profile with an optional label until [`console.profileEnd()`][] is called. The profile is then added to the \*\*Profile\*\* panel of the inspector. ```js console.profile('MyLabel'); // Some code console.profileEnd('MyLabel'); // Adds the profile 'MyLabel' to the Profiles panel of the inspector. ``` ### `console.profileEnd([label])` \* `label` {string} This method does not display anything unless used in the inspector. Stops the current JavaScript CPU profiling session if one has been started and prints the report to the \*\*Profiles\*\* panel of the inspector. See [`console.profile()`][] for an example. If this method is called without a label, the most recently started profile is stopped. ### `console.timeStamp([label])` \* `label` {string} This method does not display anything unless used in the inspector. The `console.timeStamp()` method adds an event with the label `'label'` to the \*\*Timeline\*\* panel of the inspector. [`console.error()`]: #consoleerrordata-args [`console.group()`]: #consolegrouplabel [`console.log()`]: #consolelogdata-args [`console.profile()`]: #consoleprofilelabel [`console.profileEnd()`]: #consoleprofileendlabel [`console.time()`]: #consoletimelabel [`console.timeEnd()`]: #consoletimeendlabel [`process.stderr`]: process.md#processstderr [`process.stdout`]: process.md#processstdout [`util.format()`]: util.md#utilformatformat-args [`util.inspect()`]: util.md#utilinspectobject-options [customizing `util.inspect()` colors]: util.md#customizing-utilinspect-colors [falsy]: https://developer.mozilla.org/en-US/docs/Glossary/Falsy [inspector]: debugger.md [note on process I/O]: process.md#a-note-on-process-io [truthy]: https://developer.mozilla.org/en-US/docs/Glossary/Truthy | https://github.com/nodejs/node/blob/main//doc/api/console.md | main | nodejs | [
-0.08838636428117752,
-0.028949635103344917,
-0.030431151390075684,
0.025507710874080658,
0.09093930572271347,
-0.07854104042053223,
0.03578338772058487,
0.014629719778895378,
0.09661533683538437,
-0.018502958118915558,
0.0034262987319380045,
0.010583898983895779,
-0.08012837916612625,
-0.007682110648602247,
-0.024086030200123787,
0.001642115181311965,
-0.027851484715938568,
-0.023302465677261353,
-0.012288819067180157,
-0.11290138214826584,
0.05431319773197174,
-0.00703317578881979,
-0.04443005472421646,
-0.018810559064149857,
0.010912498459219933,
-0.03644035384058952,
0.022678665816783905,
0.04720594733953476,
0.005065992008894682,
-0.06157093867659569,
0.03953045979142189,
-0.08294300734996796,
-0.08466776460409164,
-0.0041675325483083725,
0.021757308393716812,
0.10646415501832962,
0.014066155068576336,
-0.047024551779031754,
-0.035023033618927,
-0.04720333218574524,
0.10075906664133072,
0.02852352149784565,
0.021746261045336723,
0.002514519961550832,
-0.01996791362762451,
-0.10585777461528778,
-0.08004537224769592,
-0.06688238680362701,
-0.09283207356929779,
0.008571235463023186,
0.030352240428328514,
0.03565691411495209,
-0.0005998125998303294,
-0.05344612896442413,
-0.0016170538729056716,
0.02240804396569729,
-0.03185534477233887,
0.013449021615087986,
0.05209781602025032,
0.05414113774895668,
-0.010472058318555355,
-0.06845322251319885,
-0.011932134628295898,
0.013177442364394665,
-0.017537647858262062,
0.005671280901879072,
0.036222998052835464,
0.06368031352758408,
0.05186500772833824,
0.006601247470825911,
-0.12363269180059433,
0.019166206941008568,
-0.09903766214847565,
-0.017880717292428017,
0.009359791874885559,
-0.052122559398412704,
-0.017436031252145767,
0.004784155637025833,
-0.006635414436459541,
-0.08680487424135208,
-0.014679012820124626,
-0.07678958773612976,
0.0008826485136523843,
0.08462948352098465,
0.0424368791282177,
0.14658813178539276,
0.010431209579110146,
-0.016471510753035545,
0.10773415118455887,
0.06692327558994293,
-0.03822488710284233,
-0.030237795785069466,
0.07203080505132675,
0.11215585470199585,
-0.04888418689370155,
0.09137462079524994,
0.04331338778138161,
0.012014204636216164,
-0.0023491745814681053,
0.04864039644598961,
-0.023819539695978165,
0.047901496291160583,
0.03401481360197067,
0.07124843448400497,
-0.0047970418818295,
-0.013570302166044712,
-0.011007824912667274,
0.0584540069103241,
-0.04588513448834419,
0.013071158900856972,
0.030397094786167145,
0.013857342302799225,
0.014453145675361156,
-0.01658855378627777,
0.04357719421386719,
0.02797730267047882,
0.06358835846185684,
0.017048103734850883,
0.013918471522629261,
0.05739762261509895,
0.08398090302944183,
0.025590352714061737,
-0.006872526835650206,
0.005642744246870279,
0.04064084589481354,
-0.0012179093901067972,
0.08917199075222015,
5.776305036859825e-33,
0.004683089908212423,
-0.03210293874144554,
-0.03260261192917824,
-0.004190398380160332,
0.06359408050775528,
0.017122136428952217,
0.004789168946444988,
0.042026735842227936,
-0.09223151206970215,
0.07002601772546768,
0.003262978745624423,
0.03650789335370064,
-0.003633471904322505,
-0.051133908331394196,
0.0377209410071373,
0.017782291397452354,
0.07075458765029907,
0.06534437835216522,
0.017319027334451675,
0.00826820358633995,
-0.03153958544135094,
0.005233151372522116,
-0.02218809723854065,
-0.028611065819859505,
0.03409133851528168,
0.012034920044243336,
-0.010877461172640324,
0.07228098809719086,
-0.025373172014951706,
-0.015306403860449791,
0.05298646166920662,
-0.018390333279967308,
-0.0028237898368388414,
0.09328241646289825,
0.04863203316926956,
-0.011133531108498573,
-0.022128282114863396,
-0.05153694376349449,
-0.0656922236084938,
0.03907705843448639,
0.010167442262172699,
-0.004481647163629532,
-0.14913621544837952,
-0.024932805448770523,
-0.0407637320458889,
-0.09571386873722076,
-0.10062642395496368,
-0.0236968956887722,
0.09106282144784927,
0.0019097684416919947,
-0.08723585307598114,
0.09162210673093796,
0.0593048520386219,
-0.06055588275194168,
0.09763146191835403,
-0.0029845277313143015,
-0.0426144152879715,
0.00896871741861105,
0.05652550235390663,
0.07016410678625107,
0.02310277335345745,
0.04588482156395912,
-0.04631859436631203,
0.010525594465434551,
-0.06564219295978546,
0.009273015893995762,
-0.03894396498799324,
-0.05710066482424736,
-0.026941483840346336,
0.046082962304353714,
-0.05810709297657013,
0.05401676893234253,
0.0930124968290329,
0.03432352468371391,
0.04418597370386124,
-0.024199699983000755,
-0.12772534787654877,
0.055953409522771835,
-0.018960759043693542,
-0.022761637344956398,
0.01763395220041275,
-0.061229266226291656,
-0.08260940760374069,
0.04401411488652229,
0.025644319131970406,
-0.05937603861093521,
-0.08096654713153839,
-0.040493182837963104,
0.029458362609148026,
0.062278397381305695,
-0.05988633260130882,
-0.04988327994942665,
-0.0071305446326732635,
-0.025974048301577568,
-0.12002246081829071,
-7.582472678049409e-33,
0.0015410443302243948,
0.031423576176166534,
-0.03547150269150734,
0.05559619516134262,
-0.08273855596780777,
-0.05619018152356148,
0.01932252012193203,
0.06004105135798454,
0.013723544776439667,
0.012841913849115372,
0.005934849847108126,
0.09530903398990631,
-0.0024416176602244377,
0.001734865945763886,
0.05103951320052147,
0.0651637464761734,
-0.03361503779888153,
-0.06395403295755386,
0.010164900682866573,
-0.09962061047554016,
-0.02247011475265026,
0.07666143029928207,
-0.005442682653665543,
0.06576340645551682,
-0.045824069529771805,
-0.00031889844103716314,
0.10177423059940338,
0.010522180236876011,
-0.07074157148599625,
-0.039102647453546524,
0.03099037893116474,
0.04747608304023743,
-0.05778387561440468,
0.0520588643848896,
0.012978978455066681,
-0.015448623336851597,
0.05856362357735634,
0.11855257302522659,
0.02950708568096161,
-0.03666185960173607,
0.09461909532546997,
-0.0014114375226199627,
-0.09121319651603699,
0.017167119309306145,
-0.0266269464045763,
0.015053972601890564,
-0.02675485424697399,
0.07894832640886307,
0.017520060762763023,
-0.03618178516626358,
-0.001799702295102179,
-0.07968083024024963,
0.06355792284011841,
-0.006284048315137625,
-0.03870513290166855,
-0.008946753107011318,
0.058335188776254654,
-0.06267248094081879,
0.00938535388559103,
0.02862449549138546,
0.02134253829717636,
-0.11534412950277328,
-0.06054610386490822,
0.023297961801290512,
0.030283458530902863,
-0.046095434576272964,
-0.06812209635972977,
0.015101366676390171,
0.0329422652721405,
-0.03889837861061096,
0.029325993731617928,
-0.07457748800516129,
-0.0646350160241127,
-0.042229607701301575,
0.043367769569158554,
-0.03499221429228783,
0.04147547110915184,
-0.0968637466430664,
-0.013393892906606197,
0.05399347096681595,
-0.04993957281112671,
0.048552606254816055,
0.008242107927799225,
-0.08056621253490448,
0.03598616272211075,
0.012971724383533001,
-0.07464975863695145,
0.09598086029291153,
0.03759656846523285,
-0.04415225610136986,
0.008514772169291973,
0.08220575749874115,
-0.08812011778354645,
-0.000258396117715165,
0.029050206765532494,
-5.7248033868972925e-8,
-0.04044592007994652,
-0.010653388686478138,
0.021777929738163948,
-0.01606898568570614,
0.04998522996902466,
0.01924348808825016,
0.06756260246038437,
-0.05981946736574173,
-0.004872251767665148,
0.03709348663687706,
-0.05003909021615982,
0.0004972234019078314,
-0.01435096375644207,
-0.0007618684903718531,
0.06337366998195648,
-0.03504206985235214,
-0.06083616614341736,
-0.0006046817870810628,
-0.06441545486450195,
-0.037020619958639145,
-0.04060009866952896,
-0.008336634375154972,
-0.00030412880005314946,
-0.024046869948506355,
-0.049013372510671616,
-0.07154644280672073,
0.0687803328037262,
0.0887499451637268,
-0.07913176715373993,
-0.0012882516020908952,
-0.05649931728839874,
0.04629211500287056,
0.03104611113667488,
-0.02326510101556778,
-0.044286005198955536,
0.0322059765458107,
0.028040878474712372,
-0.0639883354306221,
0.00941129308193922,
0.06897392123937607,
-0.0114065483212471,
-0.0443735308945179,
0.02644112892448902,
0.031104180961847305,
0.011455360800027847,
-0.0002139374118996784,
-0.06348330527544022,
0.015738410875201225,
0.09884414076805115,
-0.04521136358380318,
-0.030559750273823738,
-0.03443269804120064,
-0.04696761071681976,
0.009060613811016083,
-0.03562019392848015,
-0.029138317331671715,
0.010736258700489998,
-0.050881028175354004,
0.002345193410292268,
0.060729630291461945,
0.08760976791381836,
-0.03180145472288132,
0.017538512125611305,
-0.03261449933052063
] | 0.096329 |
# Modules: Packages ## Introduction A package is a folder tree described by a `package.json` file. The package consists of the folder containing the `package.json` file and all subfolders until the next folder containing another `package.json` file, or a folder named `node\_modules`. This page provides guidance for package authors writing `package.json` files along with a reference for the [`package.json`][] fields defined by Node.js. ## Determining module system ### Introduction Node.js will treat the following as [ES modules][] when passed to `node` as the initial input, or when referenced by `import` statements or `import()` expressions: \* Files with an `.mjs` extension. \* Files with a `.js` extension when the nearest parent `package.json` file contains a top-level [`"type"`][] field with a value of `"module"`. \* Strings passed in as an argument to `--eval`, or piped to `node` via `STDIN`, with the flag `--input-type=module`. \* Code containing syntax only successfully parsed as [ES modules][], such as `import` or `export` statements or `import.meta`, with no explicit marker of how it should be interpreted. Explicit markers are `.mjs` or `.cjs` extensions, `package.json` `"type"` fields with either `"module"` or `"commonjs"` values, or the `--input-type` flag. Dynamic `import()` expressions are supported in either CommonJS or ES modules and would not force a file to be treated as an ES module. See [Syntax detection][]. Node.js will treat the following as [CommonJS][] when passed to `node` as the initial input, or when referenced by `import` statements or `import()` expressions: \* Files with a `.cjs` extension. \* Files with a `.js` extension when the nearest parent `package.json` file contains a top-level field [`"type"`][] with a value of `"commonjs"`. \* Strings passed in as an argument to `--eval` or `--print`, or piped to `node` via `STDIN`, with the flag `--input-type=commonjs`. \* Files with a `.js` extension with no parent `package.json` file or where the nearest parent `package.json` file lacks a `type` field, and where the code can evaluate successfully as CommonJS. In other words, Node.js tries to run such "ambiguous" files as CommonJS first, and will retry evaluating them as ES modules if the evaluation as CommonJS fails because the parser found ES module syntax. Writing ES module syntax in "ambiguous" files incurs a performance cost, and therefore it is encouraged that authors be explicit wherever possible. In particular, package authors should always include the [`"type"`][] field in their `package.json` files, even in packages where all sources are CommonJS. Being explicit about the `type` of the package will future-proof the package in case the default type of Node.js ever changes, and it will also make things easier for build tools and loaders to determine how the files in the package should be interpreted. ### Syntax detection > Stability: 1.2 - Release candidate Node.js will inspect the source code of ambiguous input to determine whether it contains ES module syntax; if such syntax is detected, the input will be treated as an ES module. Ambiguous input is defined as: \* Files with a `.js` extension or no extension; and either no controlling `package.json` file or one that lacks a `type` field. \* String input (`--eval` or `STDIN`) when `--input-type`is not specified. ES module syntax is defined as syntax that would throw when evaluated as CommonJS. This includes the following: \* `import` statements (but \_not\_ `import()` expressions, which are valid in CommonJS). \* `export` statements. \* `import.meta` references. \* `await` at the top level of a module. \* Lexical redeclarations of the CommonJS wrapper variables (`require`, `module`, `exports`, `\_\_dirname`, `\_\_filename`). ### Module resolution and loading Node.js has two types of module resolution and loading, chosen based on how the module is requested. When | https://github.com/nodejs/node/blob/main//doc/api/packages.md | main | nodejs | [
-0.08689867705106735,
0.007850089110434055,
0.00955816637724638,
0.03432018682360649,
0.11364065855741501,
-0.04439668729901314,
0.04890310764312744,
0.08863891661167145,
0.01465260237455368,
-0.04533977806568146,
0.039220649749040604,
0.09144388884305954,
0.037736453115940094,
0.024890312924981117,
0.06315787881612778,
0.08326809853315353,
-0.022056132555007935,
0.03509281948208809,
0.0000298418672173284,
-0.06334352493286133,
0.041233137249946594,
0.038709841668605804,
-0.020565712824463844,
-0.009287123568356037,
-0.02373572438955307,
0.05271172896027565,
-0.012820965610444546,
0.027824642136693,
0.019587961956858635,
0.01051957719027996,
-0.014262188225984573,
0.0738968774676323,
0.0540103018283844,
0.02092714235186577,
-0.007831231690943241,
0.16318495571613312,
-0.014634626917541027,
-0.10371411591768265,
-0.005173907149583101,
-0.05832012742757797,
0.03210553899407387,
0.12879429757595062,
0.0020643575116991997,
-0.10031259804964066,
0.011257803998887539,
-0.08505357801914215,
-0.08654415607452393,
-0.03316532447934151,
-0.11929915845394135,
-0.02037598192691803,
-0.009427613578736782,
-0.04007698595523834,
-0.07758495956659317,
-0.03413230925798416,
0.008932921104133129,
0.0436423122882843,
-0.04357878118753433,
0.01876796782016754,
-0.035904351621866226,
0.08169805258512497,
-0.012084325775504112,
0.014703732915222645,
-0.01575147919356823,
-0.019429104402661324,
0.024868668988347054,
-0.008538168855011463,
-0.024557489901781082,
0.0072677405551075935,
0.054204996675252914,
-0.017539801076054573,
-0.048144515603780746,
0.05224980413913727,
-0.03005014732480049,
0.04766560345888138,
-0.04191773757338524,
-0.09100858122110367,
0.05338447540998459,
0.07911103963851929,
-0.006451040506362915,
-0.005985858850181103,
-0.023873629048466682,
-0.05681832879781723,
0.010512185283005238,
0.053715355694293976,
-0.06620334088802338,
0.06364315003156662,
-0.02592412196099758,
0.05965275317430496,
0.04437293857336044,
0.05506831780076027,
-0.06819326430559158,
-0.17648564279079437,
-0.01599554903805256,
0.05845433473587036,
0.026734840124845505,
0.055230025202035904,
0.0007008124957792461,
0.03431639447808266,
-0.021752649918198586,
-0.0003320182440802455,
-0.03974541649222374,
0.029254652559757233,
0.09866660833358765,
-0.008613986894488335,
0.04962867870926857,
0.006663614884018898,
-0.0306125208735466,
-0.08002334833145142,
-0.012277714908123016,
-0.017968814820051193,
-0.02483217790722847,
-0.006175711285322905,
-0.031211135908961296,
-0.07326430827379227,
-0.07098989188671112,
-0.019698141142725945,
0.08191249519586563,
0.009889301843941212,
0.03777848184108734,
0.1332838535308838,
0.09606128931045532,
0.04274655878543854,
0.08108672499656677,
-0.047935374081134796,
0.07278165966272354,
-0.01933796890079975,
-0.024701446294784546,
7.733254073113353e-34,
-0.019384974613785744,
-0.010270360857248306,
0.009908154606819153,
0.1402546465396881,
0.027100488543510437,
-0.04928010329604149,
0.06553711742162704,
-0.0022689925972372293,
-0.08552628010511398,
0.014168960973620415,
-0.06815297156572342,
0.09376449882984161,
-0.03387949615716934,
0.07070700079202652,
-0.030224474146962166,
-0.0314597524702549,
0.017096243798732758,
-0.023960668593645096,
0.03289811313152313,
-0.0053417496383190155,
-0.0013271078933030367,
0.050773441791534424,
0.013328871689736843,
0.05746738985180855,
0.04361633583903313,
0.01834835670888424,
0.04175268113613129,
-0.007946917787194252,
0.02230929210782051,
-0.011040753684937954,
0.0029842446092516184,
0.004841214511543512,
-0.02418496273458004,
0.02861333265900612,
0.04912915453314781,
0.07165646553039551,
-0.009166354313492775,
-0.008703912608325481,
-0.024784089997410774,
-0.035164933651685715,
0.01866479590535164,
0.0782117024064064,
-0.07675193250179291,
0.03756820410490036,
-0.019690020009875298,
-0.08648832887411118,
-0.02448619343340397,
-0.021044407039880753,
0.04038316756486893,
-0.025914108380675316,
-0.07917212694883347,
0.03297055885195732,
0.06712072342634201,
0.025121396407485008,
0.03299829736351967,
-0.01849685236811638,
0.048935774713754654,
0.006097870413213968,
0.024907846003770828,
-0.005147360730916262,
0.05018151178956032,
-0.031406741589307785,
-0.02168772928416729,
0.07458320260047913,
0.04399517923593521,
0.027333008125424385,
-0.0807872787117958,
-0.029777146875858307,
0.031864963471889496,
0.06932418048381805,
-0.01607701927423477,
0.050085391849279404,
-0.05002459138631821,
-0.02807328663766384,
-0.01662173494696617,
0.0020405284594744444,
-0.04609571024775505,
0.002034630859270692,
-0.010091228410601616,
-0.027157390490174294,
-0.009765464812517166,
-0.0012133608106523752,
0.00023713614791631699,
0.04493431746959686,
-0.015437177382409573,
-0.03335714712738991,
-0.05563262104988098,
0.026320405304431915,
0.025578049942851067,
-0.08927630633115768,
0.037584029138088226,
-0.01820499449968338,
-0.046109046787023544,
-0.05202491208910942,
-0.004154769703745842,
-3.313124950320863e-33,
0.07953954488039017,
0.06337954103946686,
-0.025602230802178383,
0.0720205008983612,
-0.059345848858356476,
-0.0703311562538147,
-0.05457029864192009,
-0.03256374970078468,
0.08234372735023499,
0.03974262997508049,
-0.09373702108860016,
0.014818590134382248,
0.07638592272996902,
-0.020976804196834564,
0.02154095657169819,
0.08681469410657883,
-0.133560910820961,
-0.06345333158969879,
0.02857506275177002,
-0.04797831550240517,
-0.06518612056970596,
0.04802646487951279,
0.05056694895029068,
-0.010529500432312489,
-0.0041521890088915825,
-0.04598594084382057,
-0.008226507343351841,
-0.056126825511455536,
-0.06558560580015182,
-0.01450938917696476,
-0.055638864636421204,
-0.01953965425491333,
-0.008443915285170078,
0.017424900084733963,
-0.02754822187125683,
-0.0010937401093542576,
-0.0012664437526836991,
0.04783811420202255,
0.08341111242771149,
-0.053327787667512894,
0.05888480320572853,
0.030942004173994064,
-0.032671406865119934,
-0.015754451975226402,
-0.004859622102230787,
-0.0665334165096283,
0.005913166329264641,
0.09012477844953537,
0.007043476216495037,
-0.09728888422250748,
-0.11012080311775208,
-0.04821368306875229,
-0.03235718980431557,
-0.032545994967222214,
-0.023539438843727112,
-0.0013997972710058093,
0.029123708605766296,
0.05004240199923515,
0.03797655925154686,
0.003077409928664565,
0.018263688310980797,
-0.09628105908632278,
-0.04432891309261322,
-0.04292219504714012,
-0.1019122377038002,
-0.07435207813978195,
-0.0878579169511795,
-0.08682181686162949,
0.0844481810927391,
-0.054262321442365646,
-0.004498862195760012,
0.002763316035270691,
-0.015741687268018723,
0.004465256817638874,
-0.056346166878938675,
-0.03927896171808243,
0.0023385605309158564,
-0.008872468024492264,
0.033085912466049194,
-0.008778365328907967,
-0.011370114050805569,
0.03760572150349617,
-0.01697242073714733,
0.05934034660458565,
0.05859784781932831,
-0.04413367435336113,
0.04146815836429596,
0.03490850701928139,
-0.03522522374987602,
-0.006274890620261431,
0.03403623774647713,
0.028410326689481735,
-0.03801969438791275,
-0.01905745081603527,
-0.05360935628414154,
-5.1692531144453824e-8,
-0.0769345685839653,
-0.035401005297899246,
-0.15344414114952087,
-0.009057924151420593,
0.048358067870140076,
0.03235897794365883,
0.016898294910788536,
0.09092332422733307,
0.05044969543814659,
0.0634283646941185,
0.06783685833215714,
0.04933231323957443,
-0.08531332015991211,
-0.035309478640556335,
-0.0365377739071846,
0.0896792858839035,
-0.011157293803989887,
0.08675933629274368,
-0.033697593957185745,
0.02584584802389145,
0.051864348351955414,
0.022731328383088112,
0.03658341243863106,
0.05662161856889725,
0.023294124752283096,
0.0022505340166389942,
0.01565161533653736,
0.060262538492679596,
-0.022115902975201607,
-0.03364837169647217,
-0.0705982968211174,
0.0021388183813542128,
-0.010165213607251644,
-0.04945848137140274,
-0.029387298971414566,
0.004623019136488438,
0.07226831465959549,
-0.03897668793797493,
0.08221987634897232,
0.05544537678360939,
-0.014285596087574959,
-0.005463078618049622,
-0.08055327087640762,
0.01629619672894478,
-0.05971302464604378,
-0.01077650859951973,
-0.017926888540387154,
0.020230500027537346,
-0.05955315753817558,
-0.004989595152437687,
0.0159606896340847,
-0.022141553461551666,
-0.05757159739732742,
0.004747725557535887,
-0.03231867402791977,
0.05408012121915817,
-0.010773341171443462,
-0.0397464893758297,
0.021407589316368103,
-0.07466225326061249,
-0.04026847705245018,
0.06565842777490616,
0.08361534029245377,
-0.09149469435214996
] | 0.150231 |
`export` statements. \* `import.meta` references. \* `await` at the top level of a module. \* Lexical redeclarations of the CommonJS wrapper variables (`require`, `module`, `exports`, `\_\_dirname`, `\_\_filename`). ### Module resolution and loading Node.js has two types of module resolution and loading, chosen based on how the module is requested. When a module is requested via `require()` (available by default in CommonJS modules, and can be dynamically generated using `createRequire()` in both CommonJS and ES Modules): \* Resolution: \* The resolution initiated by `require()` supports [folders as modules][]. \* When resolving a specifier, if no exact match is found, `require()` will try to add extensions (`.js`, `.json`, and finally `.node`) and then attempt to resolve [folders as modules][]. \* It does not support URLs as specifiers by default. \* Loading: \* `.json` files are treated as JSON text files. \* `.node` files are interpreted as compiled addon modules loaded with `process.dlopen()`. \* `.ts`, `.mts` and `.cts` files are treated as [TypeScript][] text files. \* Files with any other extension, or without extensions, are treated as JavaScript text files. \* `require()` can only be used to [load ECMAScript modules from CommonJS modules][] if the [ECMAScript module][ES Module] \_and its dependencies\_ are synchronous (i.e. they do not contain top-level `await`). When a module is requested via static `import` statements (only available in ES Modules) or `import()` expressions (available in both CommonJS and ES Modules): \* Resolution: \* The resolution of `import`/`import()` does not support folders as modules, directory indexes (e.g. `'./startup/index.js'`) must be fully specified. \* It does not perform extension searching. A file extension must be provided when the specifier is a relative or absolute file URL. \* It supports `file://` and `data:` URLs as specifiers by default. \* Loading: \* `.json` files are treated as JSON text files. When importing JSON modules, an import type attribute is required (e.g. `import json from './data.json' with { type: 'json' }`). \* `.node` files are interpreted as compiled addon modules loaded with `process.dlopen()`, if [`--experimental-addon-modules`][] is enabled. \* `.ts`, `.mts` and `.cts` files are treated as [TypeScript][] text files. \* It accepts only `.js`, `.mjs`, and `.cjs` extensions for JavaScript text files. \* `.wasm` files are treated as [WebAssembly modules][]. \* Any other file extensions will result in a [`ERR\_UNKNOWN\_FILE\_EXTENSION`][] error. Additional file extensions can be facilitated via [customization hooks][]. \* `import`/`import()` can be used to load JavaScript [CommonJS modules][commonjs]. Such modules are passed through [merve][] to try to identify named exports, which are available if they can be determined through static analysis. Regardless of how a module is requested, the resolution and loading process can be customized using [customization hooks][]. ### `package.json` and file extensions Within a package, the [`package.json`][] [`"type"`][] field defines how Node.js should interpret `.js` files. If a `package.json` file does not have a `"type"` field, `.js` files are treated as [CommonJS][]. A `package.json` `"type"` value of `"module"` tells Node.js to interpret `.js` files within that package as using [ES module][] syntax. The `"type"` field applies not only to initial entry points (`node my-app.js`) but also to files referenced by `import` statements and `import()` expressions. ```js // my-app.js, treated as an ES module because there is a package.json // file in the same folder with "type": "module". import './startup/init.js'; // Loaded as ES module since ./startup contains no package.json file, // and therefore inherits the "type" value from one level up. import 'commonjs-package'; // Loaded as CommonJS since ./node\_modules/commonjs-package/package.json // lacks a "type" field or contains "type": "commonjs". import './node\_modules/commonjs-package/index.js'; // Loaded as CommonJS since ./node\_modules/commonjs-package/package.json // lacks a "type" field or contains "type": "commonjs". ``` Files ending with `.mjs` | https://github.com/nodejs/node/blob/main//doc/api/packages.md | main | nodejs | [
-0.08433514833450317,
-0.023320065811276436,
0.047889478504657745,
0.05646843463182449,
0.10186391323804855,
-0.04585682973265648,
-0.05015133321285248,
0.04221446067094803,
0.022673213854432106,
-0.023280790075659752,
-0.005020368378609419,
0.01433776319026947,
-0.06065025553107262,
0.025414828211069107,
0.10531964153051376,
0.05573996528983116,
-0.03462065011262894,
0.006037613842636347,
-0.043294262140989304,
0.006953967735171318,
0.06960312277078629,
-0.0008093163487501442,
0.059989310801029205,
-0.04141107574105263,
-0.01071247924119234,
-0.058215949684381485,
-0.003432882484048605,
0.014099531807005405,
0.045626237988471985,
-0.0005892011104151607,
0.01740357279777527,
0.08807181566953659,
-0.05609780550003052,
0.007816951721906662,
0.010276549495756626,
0.15812678635120392,
-0.05803467705845833,
-0.10559380054473877,
0.007043509278446436,
-0.11296626925468445,
0.073224738240242,
0.12671230733394623,
0.005547923501580954,
-0.08414749801158905,
0.009374380111694336,
-0.048365138471126556,
-0.06993354856967926,
0.015780558809638023,
-0.11447831988334656,
-0.010603895410895348,
-0.02674306556582451,
-0.04144175723195076,
-0.0767570361495018,
-0.05497176572680473,
-0.00476399902254343,
0.06501537561416626,
-0.044153518974781036,
0.011924320831894875,
0.04333025962114334,
0.11707504838705063,
-0.04399051144719124,
-0.015282480977475643,
0.01503189280629158,
-0.04594063758850098,
0.011970444582402706,
0.02246047928929329,
-0.01948373019695282,
0.005564025603234768,
-0.004727776627987623,
0.06284643709659576,
-0.05619240552186966,
0.048126913607120514,
-0.028000622987747192,
0.03703826665878296,
-0.03867267817258835,
-0.1009087935090065,
-0.037991609424352646,
0.04019208624958992,
-0.03187725320458412,
0.007654995657503605,
-0.05129534751176834,
-0.015623352490365505,
-0.00330441165715456,
0.03539542108774185,
0.010965337045490742,
0.042946819216012955,
-0.00516675878316164,
-0.015691984444856644,
0.039582423865795135,
0.01239466480910778,
-0.056054502725601196,
-0.17287500202655792,
-0.035708218812942505,
0.08525285869836807,
-0.04750709608197212,
0.012081192806363106,
0.0220971517264843,
0.06723600625991821,
-0.02137008309364319,
-0.01491529680788517,
0.023770855739712715,
0.04722776263952255,
0.11050726473331451,
0.018598319962620735,
0.023552199825644493,
-0.006829193327575922,
0.009784848429262638,
0.0008692318806424737,
-0.02967005781829357,
-0.01934655010700226,
0.03777146339416504,
0.014103217050433159,
0.037856291979551315,
-0.09235379099845886,
-0.0165547002106905,
-0.011045278050005436,
0.06463491916656494,
-0.036054231226444244,
0.055420663207769394,
0.11131571233272552,
0.07564229518175125,
0.024103788658976555,
0.07621477544307709,
-0.04113621637225151,
0.10451717674732208,
-0.02415441907942295,
-0.013024802319705486,
2.5726682017684422e-33,
0.007573046255856752,
-0.03996646776795387,
-0.01969609409570694,
0.14291948080062866,
0.012388662435114384,
-0.011596993543207645,
0.022147662937641144,
-0.03577745705842972,
-0.09578775614500046,
-0.007844872772693634,
-0.03346030041575432,
0.10771674662828445,
-0.04083241894841194,
0.008105605840682983,
-0.025301864370703697,
0.011495999060571194,
0.10553494840860367,
0.004135123919695616,
0.07677599042654037,
0.06287442892789841,
0.02018226683139801,
0.03239070624113083,
0.007789384573698044,
0.05569158494472504,
0.00010282816219842061,
0.00864084716886282,
0.02730659581720829,
0.0011686003999784589,
-0.026093315333127975,
-0.002842102199792862,
0.022517142817378044,
0.0071642352268099785,
0.04594827815890312,
0.093266561627388,
0.021443834528326988,
0.03790067136287689,
-0.0003266480634920299,
0.015404761768877506,
-0.1298934519290924,
0.0066450308077037334,
-0.019103845581412315,
0.10159073024988174,
-0.09470794349908829,
0.0011652479879558086,
-0.05395755171775818,
-0.1338573545217514,
-0.025256039574742317,
-0.04618608206510544,
0.06955096125602722,
0.003274965798482299,
-0.10466025769710541,
-0.006060002837330103,
0.07687834650278091,
-0.020297415554523468,
0.050023630261421204,
-0.02873675338923931,
0.006795661523938179,
-0.0459228940308094,
0.019279057160019875,
-0.034565310925245285,
0.041871149092912674,
-0.04536212235689163,
-0.10858137905597687,
0.08303408324718475,
0.050593532621860504,
0.050244513899087906,
-0.03002580814063549,
0.004578273743391037,
-0.027776839211583138,
0.04267538711428642,
0.0026176224928349257,
0.002089076442644,
-0.015618005767464638,
-0.02045607753098011,
0.07133510708808899,
-0.04314208775758743,
-0.03910135105252266,
0.01361760776489973,
0.00016521528596058488,
-0.006321976892650127,
-0.018146878108382225,
0.004020430147647858,
-0.024252334609627724,
0.03533375263214111,
0.026116058230400085,
-0.005406524054706097,
-0.06312847137451172,
0.02474299632012844,
0.07895874977111816,
-0.0270293690264225,
0.06455283612012863,
0.005773071199655533,
-0.048349324613809586,
-0.05861581861972809,
-0.07838213443756104,
-4.518725180835648e-33,
0.06711374223232269,
0.02414277382194996,
-0.025046635419130325,
0.061771247535943985,
-0.03819591924548149,
-0.02140892669558525,
-0.013616824522614479,
-0.02756384201347828,
0.04215334355831146,
-0.02095133066177368,
-0.053915612399578094,
-0.012700148858129978,
0.056110888719558716,
-0.0186461191624403,
0.013031569309532642,
0.12121761590242386,
-0.04804379120469093,
-0.047454554587602615,
0.039587195962667465,
-0.04216659069061279,
0.0012944650370627642,
0.042453255504369736,
0.02206806279718876,
0.015089732594788074,
-0.007012801244854927,
-0.017928890883922577,
-0.06033437326550484,
-0.017522966489195824,
-0.07113014906644821,
-0.036507219076156616,
-0.030065007507801056,
-0.02988586574792862,
0.00236316816881299,
-0.027286142110824585,
-0.025171691551804543,
-0.03114074096083641,
-0.052928611636161804,
0.07654114067554474,
0.020766956731677055,
-0.06323474645614624,
0.051280733197927475,
-0.018215378746390343,
-0.07880615442991257,
-0.0039238519966602325,
-0.01766161248087883,
-0.0769127607345581,
-0.013056577183306217,
0.029784100130200386,
0.03113558515906334,
-0.0967416986823082,
-0.015636587515473366,
-0.0554891936480999,
-0.019336044788360596,
-0.06214920058846474,
-0.02028263546526432,
-0.03985301032662392,
-0.026205021888017654,
0.02172430045902729,
0.005288146901875734,
0.031121021136641502,
0.07064063102006912,
-0.07851728796958923,
-0.06353522837162018,
-0.07500609010457993,
-0.05037759616971016,
-0.031588539481163025,
-0.0797211080789566,
-0.018990347161889076,
0.08966072648763657,
-0.021860681474208832,
-0.05556642636656761,
-0.03372115641832352,
-0.015615548938512802,
-0.012451764196157455,
-0.04380898177623749,
0.009935234673321247,
-0.006865058094263077,
-0.02971722185611725,
0.07091012597084045,
0.08235205709934235,
0.0024016050156205893,
0.06176234409213066,
-0.04588267579674721,
-0.005555673502385616,
0.056816138327121735,
-0.03167707100510597,
0.013512878678739071,
0.09422218054533005,
-0.012811973690986633,
0.011359907686710358,
0.07387048006057739,
0.003648515325039625,
-0.07980822026729584,
0.0036243582144379616,
-0.033651530742645264,
-5.3994437365645354e-8,
-0.06544901430606842,
0.033032532781362534,
-0.1501249372959137,
-0.03872895613312721,
0.029003623872995377,
-0.03216716647148132,
0.08000466972589493,
0.01796100102365017,
0.06115572527050972,
0.08154257386922836,
0.026540575549006462,
0.051902174949645996,
-0.01581578329205513,
0.05531085282564163,
-0.012132160365581512,
0.01662725955247879,
0.013315854594111443,
0.1334821879863739,
-0.07211502641439438,
-0.03582773357629776,
-0.04544108361005783,
-0.0034999491181224585,
0.018579026684165,
0.03467702120542526,
0.004639679566025734,
-0.03201471269130707,
0.016494374722242355,
-0.0026020894292742014,
-0.017835980281233788,
-0.028218742460012436,
-0.1582653820514679,
0.021672222763299942,
-0.007885271683335304,
-0.05883927270770073,
-0.044568415731191635,
0.031039735302329063,
0.04765035957098007,
-0.013799257576465607,
0.061846546828746796,
0.05997135862708092,
0.0019424761412665248,
0.010351376608014107,
-0.027679186314344406,
0.02464802749454975,
-0.0032717811409384012,
-0.01688740961253643,
-0.013503356836736202,
0.039538633078336716,
-0.031248150393366814,
-0.008851617574691772,
0.05664130672812462,
-0.020835626870393753,
-0.06665339320898056,
0.01624573953449726,
0.0026181405410170555,
0.04005344957113266,
0.00000982299661700381,
-0.0011539908591657877,
-0.022697990760207176,
-0.0653076097369194,
0.08105913549661636,
0.017742525786161423,
0.07653100043535233,
-0.06270263344049454
] | 0.078893 |
// and therefore inherits the "type" value from one level up. import 'commonjs-package'; // Loaded as CommonJS since ./node\_modules/commonjs-package/package.json // lacks a "type" field or contains "type": "commonjs". import './node\_modules/commonjs-package/index.js'; // Loaded as CommonJS since ./node\_modules/commonjs-package/package.json // lacks a "type" field or contains "type": "commonjs". ``` Files ending with `.mjs` are always loaded as [ES modules][] regardless of the nearest parent `package.json`. Files ending with `.cjs` are always loaded as [CommonJS][] regardless of the nearest parent `package.json`. ```js import './legacy-file.cjs'; // Loaded as CommonJS since .cjs is always loaded as CommonJS. import 'commonjs-package/src/index.mjs'; // Loaded as ES module since .mjs is always loaded as ES module. ``` The `.mjs` and `.cjs` extensions can be used to mix types within the same package: \* Within a `"type": "module"` package, Node.js can be instructed to interpret a particular file as [CommonJS][] by naming it with a `.cjs` extension (since both `.js` and `.mjs` files are treated as ES modules within a `"module"` package). \* Within a `"type": "commonjs"` package, Node.js can be instructed to interpret a particular file as an [ES module][] by naming it with an `.mjs` extension (since both `.js` and `.cjs` files are treated as CommonJS within a `"commonjs"` package). ### `--input-type` flag Strings passed in as an argument to `--eval` (or `-e`), or piped to `node` via `STDIN`, are treated as [ES modules][] when the `--input-type=module` flag is set. ```bash node --input-type=module --eval "import { sep } from 'node:path'; console.log(sep);" echo "import { sep } from 'node:path'; console.log(sep);" | node --input-type=module ``` For completeness there is also `--input-type=commonjs`, for explicitly running string input as CommonJS. This is the default behavior if `--input-type` is unspecified. ## Package entry points In a package's `package.json` file, two fields can define entry points for a package: [`"main"`][] and [`"exports"`][]. Both fields apply to both ES module and CommonJS module entry points. The [`"main"`][] field is supported in all versions of Node.js, but its capabilities are limited: it only defines the main entry point of the package. The [`"exports"`][] provides a modern alternative to [`"main"`][] allowing multiple entry points to be defined, conditional entry resolution support between environments, and \*\*preventing any other entry points besides those defined in [`"exports"`][]\*\*. This encapsulation allows module authors to clearly define the public interface for their package. For new packages targeting the currently supported versions of Node.js, the [`"exports"`][] field is recommended. For packages supporting Node.js 10 and below, the [`"main"`][] field is required. If both [`"exports"`][] and [`"main"`][] are defined, the [`"exports"`][] field takes precedence over [`"main"`][] in supported versions of Node.js. [Conditional exports][] can be used within [`"exports"`][] to define different package entry points per environment, including whether the package is referenced via `require` or via `import`. For more information about supporting both CommonJS and ES modules in a single package please consult [the dual CommonJS/ES module packages section][]. Existing packages introducing the [`"exports"`][] field will prevent consumers of the package from using any entry points that are not defined, including the [`package.json`][] (e.g. `require('your-package/package.json')`). \*\*This will likely be a breaking change.\*\* To make the introduction of [`"exports"`][] non-breaking, ensure that every previously supported entry point is exported. It is best to explicitly specify entry points so that the package's public API is well-defined. For example, a project that previously exported `main`, `lib`, `feature`, and the `package.json` could use the following `package.exports`: ```json { "name": "my-package", "exports": { ".": "./lib/index.js", "./lib": "./lib/index.js", "./lib/index": "./lib/index.js", "./lib/index.js": "./lib/index.js", "./feature": "./feature/index.js", "./feature/index": "./feature/index.js", "./feature/index.js": "./feature/index.js", "./package.json": "./package.json" } } ``` Alternatively a project could choose to export entire folders both with and without extensioned subpaths using export patterns: | https://github.com/nodejs/node/blob/main//doc/api/packages.md | main | nodejs | [
-0.07776746898889542,
0.010323625057935715,
0.06645020097494125,
-0.037089791148900986,
0.0992981418967247,
0.03313172981142998,
-0.04531722143292427,
0.08282957226037979,
-0.020752856507897377,
-0.030217895284295082,
0.04332056641578674,
0.037726327776908875,
-0.03175977244973183,
0.06808467209339142,
0.08576228469610214,
0.0734555795788765,
-0.06621035933494568,
-0.006378088612109423,
-0.03405588120222092,
0.027703041210770607,
-0.01227111741900444,
-0.02486824057996273,
0.06467915326356888,
0.005138356238603592,
-0.05796624720096588,
0.02701309137046337,
0.02482885867357254,
0.013052995316684246,
0.021242566406726837,
0.02573796547949314,
-0.04305769503116608,
0.07633095979690552,
-0.02006581611931324,
0.021266993135213852,
-0.049477215856313705,
0.08838621526956558,
-0.03165854513645172,
-0.09258229285478592,
0.07572182267904282,
-0.06133439764380455,
0.011738971807062626,
0.09662569314241409,
0.06614779680967331,
-0.060922227799892426,
-0.0037736922968178988,
-0.07281389832496643,
-0.07767599821090698,
-0.01599707268178463,
-0.0756785199046135,
-0.008896276354789734,
0.005589738488197327,
-0.04174517095088959,
-0.10075902193784714,
-0.00334158050827682,
0.020499056205153465,
0.06407617777585983,
-0.08281026780605316,
0.030349940061569214,
0.017697658389806747,
0.04124613478779793,
-0.06655646860599518,
0.0027402923442423344,
-0.030699407681822777,
-0.03687386214733124,
-0.028577657416462898,
-0.029053032398223877,
0.000306254078168422,
-0.012053996324539185,
0.026206575334072113,
-0.02158777229487896,
-0.05295523256063461,
0.012751064263284206,
-0.013511634431779385,
0.028210222721099854,
-0.03748190402984619,
-0.08364077657461166,
-0.01722625643014908,
0.0509481206536293,
-0.05569973587989807,
-0.04085451364517212,
-0.07138729840517044,
-0.027622049674391747,
0.038735147565603256,
-0.013497937470674515,
0.02952153980731964,
0.021538205444812775,
-0.002647634129971266,
-0.028044968843460083,
0.022236866876482964,
0.039768800139427185,
-0.010677555575966835,
-0.14929352700710297,
0.009406163357198238,
0.07871589809656143,
0.027808772400021553,
0.05739755928516388,
-0.012759392149746418,
0.10113562643527985,
-0.017769500613212585,
0.02941455878317356,
-0.008519306778907776,
-0.030580025166273117,
0.09799905866384506,
0.08446460962295532,
0.08208160102367401,
0.01573340781033039,
-0.0002314807934453711,
-0.021609283983707428,
-0.05665535107254982,
-0.04313760995864868,
-0.049064334481954575,
-0.04375427961349487,
-0.02752954699099064,
-0.07638437300920486,
-0.07201999425888062,
-0.01621359772980213,
0.049490585923194885,
-0.006022757384926081,
-0.00929352454841137,
0.08716373890638351,
0.04074744135141373,
-0.03954486548900604,
0.08690426498651505,
-0.05054989457130432,
0.06659071892499924,
-0.036579351872205734,
0.023723803460597992,
2.345860148361632e-34,
-0.02780303917825222,
-0.02256481535732746,
0.010854191146790981,
0.10706380754709244,
-0.04034489020705223,
-0.008983458392322063,
0.03643420711159706,
0.03491606563329697,
-0.09514103084802628,
-0.03202197700738907,
-0.05424821004271507,
0.10254461318254471,
-0.08562799543142319,
0.016676627099514008,
-0.03339110314846039,
0.042102109640836716,
0.030758921056985855,
-0.041523829102516174,
0.07317546010017395,
0.010139010846614838,
0.022838015109300613,
0.10325466096401215,
0.005000913515686989,
0.03753407672047615,
0.043833669275045395,
0.003050495870411396,
0.06401658803224564,
-0.012964902445673943,
-0.0009740310488268733,
-0.02420687861740589,
0.08274811506271362,
0.006765834987163544,
0.057047292590141296,
-0.01888459175825119,
0.004816223867237568,
0.08537892252206802,
0.021629076451063156,
-0.003964516334235668,
-0.08189136534929276,
-0.06557866930961609,
-0.000894512515515089,
0.08771373331546783,
-0.022574346512556076,
-0.019024718552827835,
0.039468053728342056,
-0.06459548324346542,
-0.018799470737576485,
-0.008447546511888504,
-0.02818494290113449,
-0.02315790206193924,
-0.05488111451268196,
-0.013413457199931145,
0.07314252853393555,
0.009922321885824203,
0.01950293406844139,
-0.005401940550655127,
0.03455473855137825,
0.042209699749946594,
0.047173433005809784,
-0.04760304465889931,
0.03219208866357803,
-0.021138327196240425,
-0.015921728685498238,
0.07732582837343216,
0.05869597941637039,
0.03908485919237137,
-0.09004249423742294,
0.007467024959623814,
-0.00020354444859549403,
0.11739998310804367,
0.056399933993816376,
0.007872434332966805,
-0.06408865749835968,
0.005233601666986942,
0.011524791829288006,
0.006033483427017927,
-0.03987696021795273,
-0.00828306470066309,
0.03472873941063881,
-0.03319131210446358,
-0.05984106287360191,
0.013919300399720669,
-0.025594504550099373,
0.03135952726006508,
-0.022253133356571198,
0.02759493701159954,
-0.05822456255555153,
-0.024636300280690193,
0.13456280529499054,
-0.003100838977843523,
0.06898099929094315,
-0.0031906436197459698,
-0.04555077850818634,
-0.06328167021274567,
-0.048809319734573364,
-2.5839321927142045e-33,
0.08792026340961456,
0.08340656012296677,
-0.0371045358479023,
0.060485027730464935,
-0.036191824823617935,
-0.04283948987722397,
0.002610823605209589,
-0.048727814108133316,
0.029975607991218567,
0.07719271630048752,
-0.0121569549664855,
-0.028034184128046036,
0.09206649661064148,
-0.03672584518790245,
0.03145734593272209,
0.08668820559978485,
-0.09003230184316635,
-0.0145482886582613,
0.005793894175440073,
-0.05048474669456482,
-0.024413492530584335,
0.06206818297505379,
0.004404427949339151,
0.03620993718504906,
0.018432414159178734,
-0.0030194283463060856,
-0.12866003811359406,
0.01996508054435253,
-0.0817813128232956,
0.012958304025232792,
-0.0879107266664505,
-0.05492863804101944,
0.031168581917881966,
-0.023218708112835884,
-0.050402168184518814,
-0.014100090600550175,
-0.06795208156108856,
0.05573464557528496,
0.047769878059625626,
-0.059751518070697784,
0.010585670359432697,
0.011149408295750618,
-0.04984856769442558,
0.042086411267519,
-0.005914520937949419,
-0.06910537928342819,
0.04751594364643097,
0.053739555180072784,
0.022057510912418365,
-0.09505414217710495,
-0.11704569309949875,
-0.048372432589530945,
0.00846496969461441,
-0.05846814438700676,
-0.027320871129631996,
0.01735616847872734,
0.02000831812620163,
0.03864182159304619,
-0.04957222193479538,
-0.018192380666732788,
0.1160399541258812,
-0.04801585525274277,
-0.0698283389210701,
-0.05582033842802048,
-0.03210868313908577,
-0.05837717652320862,
-0.1192232072353363,
-0.0031138299964368343,
0.044717997312545776,
-0.04858800396323204,
-0.07158088684082031,
0.0012356394436210394,
0.012990185059607029,
-0.08082664757966995,
-0.014470056630671024,
-0.03960011154413223,
0.037999413907527924,
0.0738738477230072,
0.07864904403686523,
0.015159218572080135,
-0.01845240220427513,
0.012091690674424171,
-0.012495675124228,
0.021275099366903305,
-0.0022352240048348904,
0.028689546510577202,
0.018864333629608154,
-0.021074481308460236,
-0.008646134287118912,
0.022673863917589188,
0.039429787546396255,
0.028101997449994087,
-0.025105521082878113,
-0.047471314668655396,
0.0004210492770653218,
-4.41067591339106e-8,
-0.06982753425836563,
-0.028446558862924576,
-0.11696787178516388,
0.0020115578081458807,
0.06984562426805496,
-0.027134183794260025,
-0.006231841631233692,
0.0479285903275013,
0.05685729533433914,
0.08302144706249237,
-0.03456089645624161,
0.053643278777599335,
-0.07722336053848267,
0.00536250788718462,
-0.017031928524374962,
0.04659254103899002,
-0.055807363241910934,
0.0619480274617672,
-0.07239051908254623,
0.03951464593410492,
-0.03290963172912598,
-0.005256196949630976,
0.05350425839424133,
0.08534872531890869,
-0.02186315506696701,
0.023895567283034325,
0.05782173201441765,
-0.006675349082797766,
-0.029116742312908173,
0.04608429968357086,
-0.08357856422662735,
-0.03956327587366104,
-0.011964691802859306,
-0.0785612091422081,
-0.005376783665269613,
-0.0011382990051060915,
0.09737033396959305,
0.017104893922805786,
0.058381348848342896,
0.04673342406749725,
-0.01358440238982439,
-0.05429473891854286,
-0.04721205309033394,
0.022752774879336357,
0.005868344102054834,
-0.054248031228780746,
-0.02522202581167221,
0.05987132713198662,
-0.01497382391244173,
0.02998589724302292,
0.004039715975522995,
-0.018700556829571724,
-0.08507642149925232,
-0.005200617481023073,
0.036779846996068954,
0.01310058031231165,
0.03701895847916603,
0.04273200035095215,
-0.015787389129400253,
-0.14958906173706055,
0.06914326548576355,
-0.01320762000977993,
0.12335849553346634,
-0.05916783958673477
] | 0.067413 |
the `package.json` could use the following `package.exports`: ```json { "name": "my-package", "exports": { ".": "./lib/index.js", "./lib": "./lib/index.js", "./lib/index": "./lib/index.js", "./lib/index.js": "./lib/index.js", "./feature": "./feature/index.js", "./feature/index": "./feature/index.js", "./feature/index.js": "./feature/index.js", "./package.json": "./package.json" } } ``` Alternatively a project could choose to export entire folders both with and without extensioned subpaths using export patterns: ```json { "name": "my-package", "exports": { ".": "./lib/index.js", "./lib": "./lib/index.js", "./lib/\*": "./lib/\*.js", "./lib/\*.js": "./lib/\*.js", "./feature": "./feature/index.js", "./feature/\*": "./feature/\*.js", "./feature/\*.js": "./feature/\*.js", "./package.json": "./package.json" } } ``` With the above providing backwards-compatibility for any minor package versions, a future major change for the package can then properly restrict the exports to only the specific feature exports exposed: ```json { "name": "my-package", "exports": { ".": "./lib/index.js", "./feature/\*.js": "./feature/\*.js", "./feature/internal/\*": null } } ``` ### Main entry point export When writing a new package, it is recommended to use the [`"exports"`][] field: ```json { "exports": "./index.js" } ``` When the [`"exports"`][] field is defined, all subpaths of the package are encapsulated and no longer available to importers. For example, `require('pkg/subpath.js')` throws an [`ERR\_PACKAGE\_PATH\_NOT\_EXPORTED`][] error. This encapsulation of exports provides more reliable guarantees about package interfaces for tools and when handling semver upgrades for a package. It is not a strong encapsulation since a direct require of any absolute subpath of the package such as `require('/path/to/node\_modules/pkg/subpath.js')` will still load `subpath.js`. All currently supported versions of Node.js and modern build tools support the `"exports"` field. For projects using an older version of Node.js or a related build tool, compatibility can be achieved by including the `"main"` field alongside `"exports"` pointing to the same module: ```json { "main": "./index.js", "exports": "./index.js" } ``` ### Subpath exports When using the [`"exports"`][] field, custom subpaths can be defined along with the main entry point by treating the main entry point as the `"."` subpath: ```json { "exports": { ".": "./index.js", "./submodule.js": "./src/submodule.js" } } ``` Now only the defined subpath in [`"exports"`][] can be imported by a consumer: ```js import submodule from 'es-module-package/submodule.js'; // Loads ./node\_modules/es-module-package/src/submodule.js ``` While other subpaths will error: ```js import submodule from 'es-module-package/private-module.js'; // Throws ERR\_PACKAGE\_PATH\_NOT\_EXPORTED ``` #### Extensions in subpaths Package authors should provide either extensioned (`import 'pkg/subpath.js'`) or extensionless (`import 'pkg/subpath'`) subpaths in their exports. This ensures that there is only one subpath for each exported module so that all dependents import the same consistent specifier, keeping the package contract clear for consumers and simplifying package subpath completions. Traditionally, packages tended to use the extensionless style, which has the benefits of readability and of masking the true path of the file within the package. With [import maps][] now providing a standard for package resolution in browsers and other JavaScript runtimes, using the extensionless style can result in bloated import map definitions. Explicit file extensions can avoid this issue by enabling the import map to utilize a [packages folder mapping][] to map multiple subpaths where possible instead of a separate map entry per package subpath export. This also mirrors the requirement of using [the full specifier path][] in relative and absolute import specifiers. #### Path Rules and Validation for Export Targets When defining paths as targets in the [`"exports"`][] field, Node.js enforces several rules to ensure security, predictability, and proper encapsulation. Understanding these rules is crucial for authors publishing packages. ##### Targets must be relative URLs All target paths in the [`"exports"`][] map (the values associated with export keys) must be relative URL strings starting with `./`. ```json // package.json { "name": "my-package", "exports": { ".": "./dist/main.js", // Correct "./feature": "./lib/feature.js", // Correct // "./origin-relative": "/dist/main.js", // Incorrect: Must start with ./ // "./absolute": "file:///dev/null", // Incorrect: Must start with ./ // "./outside": "../common/util.js" | https://github.com/nodejs/node/blob/main//doc/api/packages.md | main | nodejs | [
-0.07967036217451096,
-0.023672284558415413,
0.044550251215696335,
-0.002000231761485338,
0.09990037977695465,
-0.010280124843120575,
-0.01864159107208252,
0.04534263163805008,
-0.028806013986468315,
-0.02209942601621151,
0.03239021822810173,
-0.01525003369897604,
-0.03101542964577675,
0.0991341695189476,
0.11037340760231018,
0.07182170450687408,
-0.055006448179483414,
0.05627860128879547,
-0.04065457731485367,
-0.02451801672577858,
0.06494610756635666,
0.06386245042085648,
0.042329058051109314,
-0.041600022464990616,
-0.04740268364548683,
0.04362840577960014,
-0.019310899078845978,
-0.04804204776883125,
-0.01270544994622469,
0.04614255949854851,
0.023691363632678986,
0.051346585154533386,
-0.06395979970693588,
0.013935630209743977,
0.11309411376714706,
0.1068035215139389,
-0.0056829811073839664,
-0.030710730701684952,
0.042739033699035645,
-0.04630741849541664,
0.020565273240208626,
0.09425902366638184,
-0.005051321350038052,
-0.08884070813655853,
-0.06214408949017525,
-0.13766257464885712,
-0.020037375390529633,
-0.06048345938324928,
-0.051009029150009155,
0.029728930443525314,
-0.012320289388298988,
-0.017304008826613426,
-0.09736532717943192,
-0.05017215013504028,
0.08763714134693146,
0.03534941002726555,
-0.06598377972841263,
0.02689497359097004,
-0.03176166117191315,
0.08586793392896652,
0.07447859644889832,
-0.0113719766959548,
-0.046360455453395844,
-0.03368088975548744,
-0.06872552633285522,
-0.016995135694742203,
-0.03430093452334404,
0.04700474813580513,
-0.004464378580451012,
0.0005600705626420677,
-0.05081785097718239,
0.05081424489617348,
-0.11201753467321396,
-0.0004724565369542688,
0.01368673425167799,
-0.05224534869194031,
0.04126524552702904,
0.03650030121207237,
-0.0030099432915449142,
-0.06018716096878052,
-0.06655857712030411,
-0.061361685395240784,
0.022080624476075172,
0.02338903397321701,
-0.012425044551491737,
0.013240962289273739,
0.0008322771755047143,
-0.015705706551671028,
-0.04576082155108452,
0.012657120823860168,
-0.05859896540641785,
-0.19867941737174988,
0.05221472308039665,
-0.004652845207601786,
0.007576504722237587,
0.034021202474832535,
0.0013838320737704635,
0.06622368097305298,
-0.00881441030651331,
0.0045152101665735245,
-0.09418315440416336,
-0.042634446173906326,
0.06658376008272171,
0.019225766882300377,
0.05279390513896942,
0.055285051465034485,
-0.053502146154642105,
-0.07053444534540176,
-0.04219633340835571,
0.04166269302368164,
-0.03761483356356621,
0.08314968645572662,
-0.022615524008870125,
-0.08469997346401215,
-0.041369520127773285,
0.011308843269944191,
0.004342295229434967,
-0.027699170634150505,
0.009211402386426926,
0.13207466900348663,
0.0895674005150795,
-0.04080844670534134,
0.14007967710494995,
0.058428164571523666,
0.09903263300657272,
0.002965745283290744,
0.012687123380601406,
-2.654546342420007e-33,
-0.002615848323330283,
-0.025368744507431984,
0.01071497704833746,
-0.003760500578209758,
0.02286478504538536,
-0.03877212852239609,
0.052745502442121506,
0.026931609958410263,
-0.011453934945166111,
0.03638332709670067,
-0.0825650542974472,
0.07766123116016388,
-0.0882420539855957,
0.04813836142420769,
0.027294209226965904,
-0.02778537943959236,
0.02667541615664959,
0.016997195780277252,
0.053050633519887924,
-0.0006211482686921954,
-0.026895910501480103,
0.0026418170891702175,
-0.010403159074485302,
0.04685944318771362,
0.01062304712831974,
-0.05751733109354973,
0.09550131857395172,
-0.015572765842080116,
-0.02699262462556362,
0.0207778662443161,
0.049147479236125946,
0.005254670977592468,
0.02580225095152855,
0.04913945123553276,
-0.03197818621993065,
0.054197750985622406,
-0.05561399459838867,
-0.001359316403977573,
-0.0869656652212143,
0.047118306159973145,
0.0026596016250550747,
0.05063171312212944,
-0.10343527793884277,
0.011537004262208939,
0.010647510178387165,
-0.006334158591926098,
0.02377104014158249,
-0.08513158559799194,
-0.00307448604144156,
-0.07621167600154877,
-0.05142500251531601,
0.040066689252853394,
0.06477706879377365,
-0.05145077779889107,
0.07847544550895691,
-0.05559158697724342,
0.04561161622405052,
-0.0011042370460927486,
0.017905343323946,
-0.05088968947529793,
-0.02718217298388481,
0.04001656919717789,
-0.031592026352882385,
0.0589977391064167,
0.03499917685985565,
-0.014669950120151043,
-0.009074301458895206,
0.029563819989562035,
-0.027589738368988037,
0.02646619640290737,
0.03178241848945618,
0.032399099320173264,
0.02098829112946987,
-0.06886566430330276,
0.030453767627477646,
-0.027333522215485573,
0.01744920201599598,
0.06537842005491257,
0.007384188938885927,
-0.07631173729896545,
-0.053898654878139496,
-0.0303685013204813,
0.01038945559412241,
-0.00827159732580185,
0.05699867010116577,
0.036612048745155334,
-0.08115170896053314,
0.018634112551808357,
-0.004018315114080906,
-0.13063602149486542,
0.01627109944820404,
-0.009327448904514313,
0.0011385016841813922,
-0.10682126879692078,
-0.0076871952041983604,
-7.391562201735796e-34,
0.11271914094686508,
0.02443789504468441,
0.01278817281126976,
0.003489953465759754,
-0.012210950255393982,
-0.009822591207921505,
-0.012875703163444996,
-0.0341123603284359,
0.006549488753080368,
0.06093788146972656,
-0.08955574035644531,
-0.00729105481877923,
0.05699128285050392,
-0.056300003081560135,
-0.012262297794222832,
0.05333102494478226,
-0.076894611120224,
-0.07653100788593292,
0.03829766437411308,
-0.021325726062059402,
-0.03181076422333717,
0.08247677236795425,
0.04841267690062523,
0.033061351627111435,
0.03984694555401802,
-0.08554071933031082,
-0.080681711435318,
-0.026479756459593773,
-0.048547107726335526,
0.025851337239146233,
-0.02242807112634182,
0.0017967814346775413,
-0.010015541687607765,
-0.06299299746751785,
-0.04747254028916359,
-0.031282391399145126,
-0.11076817661523819,
0.04827934876084328,
0.05154281109571457,
0.02988262288272381,
-0.017904624342918396,
-0.04584679752588272,
-0.032662637531757355,
0.05855780467391014,
-0.0009110803948715329,
-0.07052601128816605,
0.04925377294421196,
0.02753189392387867,
-0.042672161012887955,
-0.060877006500959396,
-0.016913706436753273,
0.024539506062865257,
-0.05977248400449753,
-0.05173906683921814,
0.008374568074941635,
0.06868354231119156,
-0.03222070261836052,
0.0014002019306644797,
-0.028208814561367035,
-0.00792606733739376,
0.0388595387339592,
-0.023369936272501945,
0.03978557884693146,
-0.022573640570044518,
-0.003073733299970627,
-0.0813944861292839,
-0.0883648693561554,
0.012322409078478813,
-0.009718147106468678,
-0.025429006665945053,
-0.05540625751018524,
-0.021098434925079346,
0.0035759001038968563,
0.03834858536720276,
0.027011042460799217,
-0.04978489875793457,
0.034956421703100204,
0.012885808944702148,
0.08010895550251007,
0.034009408205747604,
-0.08620400726795197,
0.06160856410861015,
-0.03182268887758255,
0.03717837110161781,
0.03580699861049652,
-0.04845296964049339,
-0.03376464173197746,
0.047859858721494675,
0.035517312586307526,
-0.01880773715674877,
0.09615477174520493,
0.048500608652830124,
-0.014650458469986916,
-0.03742435574531555,
-0.005577153991907835,
-5.23411891606429e-8,
-0.03810551017522812,
0.0071724094450473785,
-0.10613007098436356,
-0.008647589012980461,
0.02306758612394333,
-0.04509839415550232,
0.015299428254365921,
0.09118011593818665,
0.055023256689310074,
0.03205455467104912,
0.026732638478279114,
0.10038594901561737,
-0.12895777821540833,
0.039535846561193466,
-0.05792563781142235,
-0.04391751065850258,
0.026349052786827087,
0.10941100120544434,
-0.06363283097743988,
0.042012277990579605,
0.013780717737972736,
0.038438957184553146,
0.03726910054683685,
0.04135472699999809,
-0.01200024038553238,
-0.05087539553642273,
-0.012724797241389751,
-0.08121579140424728,
0.07225552201271057,
-0.016088999807834625,
-0.05357156693935394,
-0.013751131482422352,
-0.051436275243759155,
-0.0032567374873906374,
0.011300740763545036,
-0.05646144971251488,
0.09760554879903793,
-0.013300083577632904,
0.02622368559241295,
0.05319621413946152,
0.006385740824043751,
-0.018098311498761177,
0.014969144016504288,
0.06543432921171188,
-0.06418996304273605,
-0.025591354817152023,
-0.034336257725954056,
-0.017808785662055016,
0.024056607857346535,
0.07194367051124573,
-0.036347370594739914,
0.007980290800333023,
-0.043012406677007675,
0.040134817361831665,
0.039165180176496506,
0.08535455912351608,
-0.0350503996014595,
-0.014967277646064758,
-0.005199977662414312,
-0.07899787276983261,
0.025233149528503418,
-0.013492144644260406,
0.031082969158887863,
-0.04033515602350235
] | -0.010316 |
values associated with export keys) must be relative URL strings starting with `./`. ```json // package.json { "name": "my-package", "exports": { ".": "./dist/main.js", // Correct "./feature": "./lib/feature.js", // Correct // "./origin-relative": "/dist/main.js", // Incorrect: Must start with ./ // "./absolute": "file:///dev/null", // Incorrect: Must start with ./ // "./outside": "../common/util.js" // Incorrect: Must start with ./ } } ``` Reasons for this behavior include: \* \*\*Security:\*\* Prevents exporting arbitrary files from outside the package's own directory. \* \*\*Encapsulation:\*\* Ensures all exported paths are resolved relative to the package root, making the package self-contained. ##### No path traversal or invalid segments Export targets must not resolve to a location outside the package's root directory. Additionally, path segments like `.` (single dot), `..` (double dot), or `node\_modules` (and their URL-encoded equivalents) are generally disallowed within the `target` string after the initial `./` and in any `subpath` part substituted into a target pattern. ```json // package.json { "name": "my-package", "exports": { // ".": "./dist/../../elsewhere/file.js", // Invalid: path traversal // ".": "././dist/main.js", // Invalid: contains "." segment // ".": "./dist/../dist/main.js", // Invalid: contains ".." segment // "./utils/./helper.js": "./utils/helper.js" // Key has invalid segment } } ``` ### Exports sugar If the `"."` export is the only export, the [`"exports"`][] field provides sugar for this case being the direct [`"exports"`][] field value. ```json { "exports": { ".": "./index.js" } } ``` can be written: ```json { "exports": "./index.js" } ``` ### Subpath imports In addition to the [`"exports"`][] field, there is a package `"imports"` field to create private mappings that only apply to import specifiers from within the package itself. Entries in the `"imports"` field must always start with `#` to ensure they are disambiguated from external package specifiers. For example, the imports field can be used to gain the benefits of conditional exports for internal modules: ```json // package.json { "imports": { "#dep": { "node": "dep-node-native", "default": "./dep-polyfill.js" } }, "dependencies": { "dep-node-native": "^1.0.0" } } ``` where `import '#dep'` does not get the resolution of the external package `dep-node-native` (including its exports in turn), and instead gets the local file `./dep-polyfill.js` relative to the package in other environments. Unlike the `"exports"` field, the `"imports"` field permits mapping to external packages. The resolution rules for the imports field are otherwise analogous to the exports field. ### Subpath patterns For packages with a small number of exports or imports, we recommend explicitly listing each exports subpath entry. But for packages that have large numbers of subpaths, this might cause `package.json` bloat and maintenance issues. For these use cases, subpath export patterns can be used instead: ```json // ./node\_modules/es-module-package/package.json { "exports": { "./features/\*.js": "./src/features/\*.js" }, "imports": { "#internal/\*.js": "./src/internal/\*.js" } } ``` \*\*`\*` maps expose nested subpaths as it is a string replacement syntax only.\*\* All instances of `\*` on the right hand side will then be replaced with this value, including if it contains any `/` separators. ```js import featureX from 'es-module-package/features/x.js'; // Loads ./node\_modules/es-module-package/src/features/x.js import featureY from 'es-module-package/features/y/y.js'; // Loads ./node\_modules/es-module-package/src/features/y/y.js import internalZ from '#internal/z.js'; // Loads ./src/internal/z.js ``` This is a direct static matching and replacement without any special handling for file extensions. Including the `"\*.js"` on both sides of the mapping restricts the exposed package exports to only JS files. The property of exports being statically enumerable is maintained with exports patterns since the individual exports for a package can be determined by treating the right hand side target pattern as a `\*\*` glob against the list of files within the package. Because `node\_modules` paths are forbidden in exports targets, this expansion is dependent on only the files of the package itself. | https://github.com/nodejs/node/blob/main//doc/api/packages.md | main | nodejs | [
-0.0930718407034874,
-0.0017932645278051496,
0.045039910823106766,
-0.038930609822273254,
0.0918494462966919,
-0.013552919030189514,
-0.010174925439059734,
0.06032000109553337,
0.0037080394104123116,
-0.0010066566755995154,
0.060628488659858704,
-0.016075434163212776,
-0.022058069705963135,
0.068903349339962,
0.08565976470708847,
0.11886905133724213,
0.006521312519907951,
-0.02438955195248127,
-0.06947004050016403,
0.04479121044278145,
-0.04940556362271309,
0.023584527894854546,
0.06866727024316788,
-0.015934733673930168,
0.025650424882769585,
0.03591887280344963,
-0.02681623585522175,
0.01879710704088211,
0.009142803959548473,
0.007178477942943573,
-0.019891656935214996,
-0.01791233941912651,
-0.03767850250005722,
-0.04541961848735809,
0.0990462675690651,
0.14424054324626923,
0.025787919759750366,
-0.08497607707977295,
0.02014906145632267,
-0.0272457804530859,
0.04263883829116821,
0.09746423363685608,
0.0007523197564296424,
-0.0373849980533123,
-0.056765928864479065,
-0.00823946762830019,
-0.03949093073606491,
-0.0452909916639328,
-0.08206082880496979,
0.023576553910970688,
-0.047260139137506485,
0.056035928428173065,
-0.054216671735048294,
-0.05367814749479294,
0.04937021806836128,
0.03868371993303299,
-0.05528693646192551,
0.02560570277273655,
0.0013452240964397788,
0.1164890006184578,
0.08468510955572128,
-0.0320250503718853,
-0.0690322294831276,
-0.0229705311357975,
-0.06106831878423691,
-0.04311170056462288,
-0.06232857704162598,
-0.007750926073640585,
-0.029491912573575974,
-0.03596624732017517,
-0.0829838216304779,
0.03824525326490402,
-0.0813501626253128,
0.03874249756336212,
-0.001328643411397934,
-0.05012820288538933,
-0.015664542093873024,
0.03499194234609604,
-0.03724861145019531,
-0.09457056224346161,
-0.01049342006444931,
-0.08336479961872101,
0.007464405614882708,
0.05110320821404457,
0.037511203438043594,
0.0334206186234951,
0.029433809220790863,
-0.03974485024809837,
-0.034366294741630554,
0.07544665038585663,
-0.05049721896648407,
-0.20466426014900208,
0.049535587430000305,
0.04754021018743515,
0.0773310735821724,
0.05764005333185196,
0.01062560174614191,
0.024202145636081696,
-0.06969232857227325,
0.011949166655540466,
-0.07297788560390472,
-0.06825128942728043,
0.10278162360191345,
0.010018368251621723,
0.07747332751750946,
0.021589165553450584,
-0.041318219155073166,
-0.04572708532214165,
0.013428649865090847,
0.003016094211488962,
-0.022639958187937737,
0.03853093460202217,
-0.03196537122130394,
-0.07364045083522797,
-0.08187156170606613,
-0.030582677572965622,
0.03654453530907631,
-0.04326903447508812,
0.03185460716485977,
0.06357928365468979,
0.09036973863840103,
-0.05463065579533577,
0.06670510768890381,
0.06937899440526962,
0.021275795996189117,
-0.017384063452482224,
0.036960113793611526,
-3.425966530528049e-33,
0.022563688457012177,
-0.0340258963406086,
-0.014834223315119743,
0.02396205998957157,
0.002511032624170184,
-0.040058527141809464,
-0.03493957221508026,
0.037722039967775345,
-0.02574734017252922,
0.020442625507712364,
-0.03894665837287903,
0.03581971302628517,
-0.037994734942913055,
0.03908076882362366,
0.005024784244596958,
0.007003971841186285,
0.02854691632091999,
-0.007060335483402014,
0.04090672731399536,
-0.008069275878369808,
0.0037867319770157337,
-0.007709883153438568,
-0.032138705253601074,
0.03919276222586632,
-0.05127091705799103,
-0.02022574283182621,
0.027222493663430214,
0.006746456492692232,
-0.019856484606862068,
-0.009120816364884377,
0.05900587514042854,
-0.00033082664594985545,
0.06274570524692535,
0.04333728924393654,
0.021847447380423546,
0.07660217583179474,
0.028136178851127625,
-0.08124770224094391,
-0.08614296466112137,
-0.003503605956211686,
-0.0201057568192482,
0.07155486196279526,
-0.12480217218399048,
0.006012590602040291,
0.051173850893974304,
-0.035425279289484024,
-0.008658423088490963,
-0.07236060500144958,
0.014707408845424652,
-0.01662103645503521,
-0.11776785552501678,
0.08571729063987732,
0.07208213955163956,
-0.04236680641770363,
0.0279102623462677,
-0.08890526741743088,
-0.015909280627965927,
-0.06104898452758789,
-0.009693456813693047,
-0.024180348962545395,
-0.041866518557071686,
0.08174094557762146,
0.011651166714727879,
0.024202441796660423,
0.02112399786710739,
-0.05060741305351257,
-0.002500763162970543,
0.03165919706225395,
-0.024567535147070885,
0.021457724273204803,
-0.008666928857564926,
0.017987389117479324,
-0.007309656124562025,
-0.05146317556500435,
0.031190741807222366,
-0.002677262993529439,
0.01469669584184885,
0.06106026843190193,
0.08747611939907074,
-0.08957066386938095,
-0.03246569633483887,
-0.0004158758674748242,
-0.002755573485046625,
0.020946454256772995,
-0.004878625739365816,
0.036296483129262924,
-0.0658794566988945,
-0.016452832147479057,
0.04597678408026695,
-0.011284745298326015,
0.11938075721263885,
-0.0187110286206007,
-0.04188504070043564,
-0.008587012998759747,
-0.09701859951019287,
-1.5593077663741573e-33,
0.0909891352057457,
-0.014575961045920849,
-0.025084445253014565,
-0.006813493091613054,
-0.018617527559399605,
0.010284852236509323,
0.0016040656482800841,
-0.04025433957576752,
0.05671633780002594,
0.049522366374731064,
-0.05610542744398117,
0.05689162760972977,
0.04214645177125931,
-0.07335707545280457,
0.04474512115120888,
0.036930959671735764,
-0.04828561842441559,
-0.037445418536663055,
0.029720880091190338,
-0.051690272986888885,
0.015995990484952927,
0.07946838438510895,
-0.01983684115111828,
0.12916049361228943,
0.010683022439479828,
-0.03344396501779556,
-0.05380484461784363,
-0.060666523873806,
-0.0949169173836708,
0.02253568358719349,
-0.010113805532455444,
0.05330352485179901,
-0.01732880063354969,
-0.04154634475708008,
-0.06677126884460449,
-0.04436478763818741,
-0.13756431639194489,
0.05759790167212486,
0.0830802321434021,
-0.008739514276385307,
0.028894050046801567,
-0.030272556468844414,
-0.03298306092619896,
0.0008023976697586477,
-0.022833624854683876,
-0.040164873003959656,
0.038874756544828415,
0.027691667899489403,
-0.020741213113069534,
-0.04434315860271454,
0.02771955169737339,
-0.020388280972838402,
0.02348632737994194,
-0.08007120341062546,
-0.026065925136208534,
0.0344284251332283,
-0.07088603079319,
0.047930482774972916,
-0.01595805585384369,
0.02316914312541485,
0.04893645644187927,
-0.03640105947852135,
0.014101259410381317,
-0.03322654217481613,
-0.0581723116338253,
-0.03438695892691612,
-0.07609353214502335,
0.08050937205553055,
0.019618088379502296,
-0.06706765294075012,
-0.09931999444961548,
-0.0753498449921608,
0.030428754165768623,
-0.03791983798146248,
-0.004558677319437265,
-0.03451601415872574,
0.009390212595462799,
-0.06877411156892776,
0.03644873946905136,
0.057386159896850586,
-0.04784919694066048,
0.05686623603105545,
-0.058579474687576294,
0.06932968646287918,
0.053887899965047836,
-0.0879240334033966,
-0.0417814776301384,
0.01186650525778532,
0.03281262144446373,
-0.01765379123389721,
0.061955876648426056,
0.05783168599009514,
-0.07713276892900467,
-0.000032622574508422986,
0.022374743595719337,
-5.672221448094206e-8,
-0.03515433892607689,
0.019314197823405266,
-0.13737627863883972,
0.006249118596315384,
-0.017838317900896072,
-0.0075643896125257015,
0.06298734992742538,
0.02785751223564148,
0.041141949594020844,
0.04240081459283829,
0.02787875197827816,
0.08173273503780365,
-0.11154472827911377,
0.0019168618600815535,
-0.1159784123301506,
0.013635656796395779,
-0.048635825514793396,
0.1347200572490692,
-0.020114513114094734,
0.03451314941048622,
-0.019862333312630653,
0.009002568200230598,
0.039073970168828964,
-0.026090243831276894,
-0.0006147976964712143,
-0.013676016591489315,
0.03295803815126419,
0.0011529045877978206,
0.04611736163496971,
0.0045272232964634895,
-0.02891593985259533,
-0.0108269602060318,
-0.013529527001082897,
-0.025318318977952003,
-0.06815692782402039,
0.019949309527873993,
0.10915016382932663,
-0.014210548251867294,
0.019109060987830162,
-0.01846732757985592,
0.003216029843315482,
0.026997271925210953,
-0.002179034985601902,
0.044351670891046524,
-0.12582513689994812,
-0.01775071583688259,
-0.05387473106384277,
0.05329173058271408,
0.008785474114120007,
-0.0067218816839158535,
0.024509919807314873,
-0.010345613583922386,
-0.01917610503733158,
0.06317960470914841,
0.07298404723405838,
0.04360982030630112,
-0.03625904396176338,
-0.0031274151988327503,
0.007792031392455101,
-0.07956787198781967,
0.009065838530659676,
0.02335950918495655,
0.028718197718262672,
0.007483060471713543
] | -0.00644 |
since the individual exports for a package can be determined by treating the right hand side target pattern as a `\*\*` glob against the list of files within the package. Because `node\_modules` paths are forbidden in exports targets, this expansion is dependent on only the files of the package itself. To exclude private subfolders from patterns, `null` targets can be used: ```json // ./node\_modules/es-module-package/package.json { "exports": { "./features/\*.js": "./src/features/\*.js", "./features/private-internal/\*": null } } ``` ```js import featureInternal from 'es-module-package/features/private-internal/m.js'; // Throws: ERR\_PACKAGE\_PATH\_NOT\_EXPORTED import featureX from 'es-module-package/features/x.js'; // Loads ./node\_modules/es-module-package/src/features/x.js ``` ### Conditional exports Conditional exports provide a way to map to different paths depending on certain conditions. They are supported for both CommonJS and ES module imports. For example, a package that wants to provide different ES module exports for `require()` and `import` can be written: ```json // package.json { "exports": { "import": "./index-module.js", "require": "./index-require.cjs" }, "type": "module" } ``` Node.js implements the following conditions, listed in order from most specific to least specific as conditions should be defined: \* `"node-addons"` - similar to `"node"` and matches for any Node.js environment. This condition can be used to provide an entry point which uses native C++ addons as opposed to an entry point which is more universal and doesn't rely on native addons. This condition can be disabled via the [`--no-addons` flag][]. \* `"node"` - matches for any Node.js environment. Can be a CommonJS or ES module file. \_In most cases explicitly calling out the Node.js platform is not necessary.\_ \* `"import"` - matches when the package is loaded via `import` or `import()`, or via any top-level import or resolve operation by the ECMAScript module loader. Applies regardless of the module format of the target file. \_Always mutually exclusive with `"require"`.\_ \* `"require"` - matches when the package is loaded via `require()`. The referenced file should be loadable with `require()` although the condition matches regardless of the module format of the target file. Expected formats include CommonJS, JSON, native addons, and ES modules. \_Always mutually exclusive with `"import"`.\_ \* `"module-sync"` - matches no matter the package is loaded via `import`, `import()` or `require()`. The format is expected to be ES modules that does not contain top-level await in its module graph - if it does, `ERR\_REQUIRE\_ASYNC\_MODULE` will be thrown when the module is `require()`-ed. \* `"default"` - the generic fallback that always matches. Can be a CommonJS or ES module file. \_This condition should always come last.\_ Within the [`"exports"`][] object, key order is significant. During condition matching, earlier entries have higher priority and take precedence over later entries. \_The general rule is that conditions should be from most specific to least specific in object order\_. Using the `"import"` and `"require"` conditions can lead to some hazards, which are further explained in [the dual CommonJS/ES module packages section][]. The `"node-addons"` condition can be used to provide an entry point which uses native C++ addons. However, this condition can be disabled via the [`--no-addons` flag][]. When using `"node-addons"`, it's recommended to treat `"default"` as an enhancement that provides a more universal entry point, e.g. using WebAssembly instead of a native addon. Conditional exports can also be extended to exports subpaths, for example: ```json { "exports": { ".": "./index.js", "./feature.js": { "node": "./feature-node.js", "default": "./feature.js" } } } ``` Defines a package where `require('pkg/feature.js')` and `import 'pkg/feature.js'` could provide different implementations between Node.js and other JS environments. When using environment branches, always include a `"default"` condition where possible. Providing a `"default"` condition ensures that any unknown JS environments are able to use this universal implementation, which helps avoid these JS environments from | https://github.com/nodejs/node/blob/main//doc/api/packages.md | main | nodejs | [
-0.03917619585990906,
-0.012031467631459236,
0.07189464569091797,
0.02103124000132084,
0.15101276338100433,
0.0031495008151978254,
0.03635093942284584,
0.02275724895298481,
0.007922016084194183,
-0.021939842030405998,
0.08559590578079224,
-0.031581345945596695,
-0.007846320979297161,
0.05134647339582443,
0.07058782875537872,
0.016728172078728676,
-0.02287564054131508,
0.046755027025938034,
-0.021237624809145927,
-0.0032120379619300365,
0.06912220269441605,
0.048269085586071014,
0.04335601627826691,
0.0065245660953223705,
-0.012041729874908924,
0.04088246077299118,
0.009795092046260834,
-0.06164367496967316,
0.017238138243556023,
-0.04434690997004509,
0.00820360891520977,
0.07891234755516052,
-0.015673497691750526,
-0.041548654437065125,
0.1097690537571907,
0.06824319809675217,
-0.054411452263593674,
-0.07922045141458511,
0.006143938284367323,
-0.06739278882741928,
0.0030247357208281755,
0.09231777489185333,
0.025418100878596306,
-0.09744855016469955,
-0.03684830293059349,
-0.10270827263593674,
-0.052765797823667526,
-0.0134378457441926,
-0.06778517365455627,
0.008776788599789143,
0.0360797755420208,
-0.01405324973165989,
-0.1232832744717598,
-0.0307769775390625,
0.038945991545915604,
-0.0009161846246570349,
-0.04302336648106575,
-0.014866610057651997,
0.018550965934991837,
0.0845998078584671,
0.09742619842290878,
-0.044352125376462936,
0.00011002807877957821,
-0.05312337353825569,
-0.06321411579847336,
-0.004919998347759247,
0.005274039227515459,
0.048052869737148285,
-0.026155363768339157,
0.02866269461810589,
-0.03142420947551727,
0.066852867603302,
-0.011977880261838436,
0.025064608082175255,
0.07935961335897446,
-0.04268328472971916,
0.03380684554576874,
0.016816509887576103,
0.008645671419799328,
-0.05210316181182861,
-0.062109675258398056,
-0.0723201334476471,
0.028435133397579193,
-0.013830459676682949,
0.006955485790967941,
0.041178736835718155,
0.006023021414875984,
0.031616389751434326,
-0.03524348884820938,
0.03672938793897629,
-0.08611413836479187,
-0.1965845823287964,
-0.0017624413594603539,
0.0015186381060630083,
0.029588861390948296,
0.008651990443468094,
-0.05322135239839554,
0.09073842316865921,
-0.023343827575445175,
0.0004679929406847805,
-0.04565507173538208,
-0.01291532814502716,
0.08671781420707703,
0.047221697866916656,
0.08591774106025696,
0.02053438499569893,
-0.02714397944509983,
-0.0849984660744667,
-0.023795796558260918,
0.005408965051174164,
-0.040729451924562454,
0.031241323798894882,
-0.007316586095839739,
-0.10006052255630493,
-0.052937958389520645,
0.013030166737735271,
0.06633143872022629,
-0.004156323149800301,
0.03876122459769249,
0.07653702050447464,
0.09361324459314346,
0.008030646480619907,
0.1534927487373352,
0.025464177131652832,
0.06133095547556877,
0.041726600378751755,
-0.02729911543428898,
-1.5971070729217942e-33,
-0.009472319856286049,
-0.04349316656589508,
-0.025208599865436554,
-0.02023366279900074,
-0.006830441765487194,
-0.003579509211704135,
0.033209048211574554,
0.006474048364907503,
0.01991298794746399,
0.03518658131361008,
-0.09279751777648926,
0.054464682936668396,
-0.021822642534971237,
0.06765401363372803,
0.08369732648134232,
-0.013598517514765263,
0.07142174243927002,
-0.07407332211732864,
0.05764489248394966,
0.013049558736383915,
0.022291677072644234,
-0.00634705601260066,
-0.036175090819597244,
0.06516914069652557,
-0.019467508420348167,
-0.04757019132375717,
0.0036758913192898035,
-0.004560015629976988,
-0.009419841691851616,
0.025798119604587555,
0.02648025192320347,
0.04804864525794983,
0.0332396924495697,
0.0771564245223999,
0.0502835288643837,
0.022405926138162613,
-0.01956549659371376,
-0.037174616008996964,
-0.009254880249500275,
0.054945722222328186,
-0.012453513219952583,
0.06665680557489395,
-0.10131723433732986,
0.026534445583820343,
-0.034862276166677475,
-0.04924113675951958,
0.03635683283209801,
-0.07742653042078018,
0.06377657502889633,
-0.04897873476147652,
-0.07567740976810455,
0.0586460679769516,
0.06590763479471207,
-0.09116986393928528,
0.05980326607823372,
-0.022758852690458298,
0.011545640416443348,
-0.04530465602874756,
-0.010882402770221233,
-0.04791279509663582,
0.01790003478527069,
0.018150733783841133,
0.030090173706412315,
0.05691150575876236,
-0.011565234512090683,
0.022673219442367554,
-0.020382126793265343,
-0.01908419281244278,
-0.06315487623214722,
-0.04694624990224838,
-0.014527752064168453,
0.03951794654130936,
0.020477259531617165,
-0.1011144295334816,
0.038696229457855225,
-0.03588896244764328,
0.025225507095456123,
0.0857205018401146,
-0.006181912962347269,
-0.07998279482126236,
-0.05647176876664162,
0.024659859016537666,
-0.011456753127276897,
-0.008379054255783558,
0.028348907828330994,
0.03727526217699051,
-0.07257058471441269,
0.0370633639395237,
0.04728845879435539,
0.009591060690581799,
0.006970515009015799,
-0.02206449583172798,
-0.08520199358463287,
-0.08632644265890121,
-0.06374300271272659,
-1.3957348805568551e-33,
0.0900995060801506,
0.10549590736627579,
0.01767575740814209,
-0.03041411191225052,
-0.07894953340291977,
-0.013798126019537449,
0.006469656713306904,
-0.00816881749778986,
0.03314650431275368,
0.03891478106379509,
-0.07770860195159912,
0.02757643349468708,
0.08097442984580994,
-0.07681377232074738,
-0.047806911170482635,
0.05686385557055473,
-0.044324103742837906,
-0.0034536735620349646,
0.021373901516199112,
-0.07016211748123169,
0.009538265876471996,
0.06857279688119888,
0.035570017993450165,
0.050545886158943176,
0.009248730726540089,
-0.05313017591834068,
-0.1053076758980751,
-0.03074752353131771,
-0.03182462975382805,
-0.01935742050409317,
-0.04219881072640419,
0.04723604395985603,
-0.005914761684834957,
-0.042613059282302856,
-0.04789477586746216,
-0.06425395607948303,
-0.10630293190479279,
0.09933420270681381,
0.08047973364591599,
-0.0038014103192836046,
0.026157766580581665,
-0.007810335140675306,
-0.04749579355120659,
0.03451184555888176,
-0.035020142793655396,
-0.025534413754940033,
0.06413337588310242,
0.05172935873270035,
-0.023077107965946198,
-0.047295745462179184,
-0.08099235594272614,
0.0010886805830523372,
-0.05279528349637985,
-0.026934703812003136,
-0.02530176192522049,
0.05259351059794426,
-0.015471379272639751,
-0.04146479815244675,
-0.0060907150618731976,
0.024346239864826202,
0.0869787186384201,
-0.006361663807183504,
-0.015938865020871162,
-0.10661382228136063,
0.00780956307426095,
-0.020193839445710182,
-0.08531396836042404,
0.06929852813482285,
0.0572364516556263,
-0.026815513148903847,
-0.05933564156293869,
-0.07354811578989029,
-0.05324305221438408,
-0.01106654480099678,
-0.017339063808321953,
0.0056312535889446735,
-0.054169412702322006,
-0.05280974879860878,
0.09345003962516785,
-0.004354323726147413,
-0.04544777795672417,
0.03446599096059799,
-0.041330501437187195,
-0.012165740132331848,
0.10368750244379044,
-0.023492146283388138,
-0.02765859104692936,
0.009238275699317455,
0.02534947358071804,
-0.02354087308049202,
0.07971842586994171,
-0.010067952796816826,
-0.0032400931231677532,
-0.023647572845220566,
0.05088191106915474,
-4.75087809093111e-8,
-0.014974355697631836,
-0.045076556503772736,
-0.12300476431846619,
-0.026647761464118958,
0.013417099602520466,
-0.06725720316171646,
0.028686651960015297,
0.04280800744891167,
0.06245363876223564,
0.057211022824048996,
0.010218396782875061,
0.057166166603565216,
-0.08093267679214478,
0.01229669526219368,
-0.02969176694750786,
0.010879234410822392,
0.017933927476406097,
0.10266458988189697,
-0.07644391059875488,
-0.030034944415092468,
0.012247930280864239,
-0.008907762356102467,
0.011235157027840614,
0.03480808064341545,
-0.028518740087747574,
-0.004077587742358446,
0.06780935823917389,
-0.05982726439833641,
0.055422987788915634,
0.0018060777802020311,
-0.08398980647325516,
-0.015509610995650291,
-0.07101044803857803,
-0.0432283952832222,
-0.041029125452041626,
0.017092322930693626,
0.1309029757976532,
0.020920809358358383,
0.031763482838869095,
0.05626504868268967,
-0.031737323850393295,
-0.05644502863287926,
-0.0027888959739357233,
0.03941581770777702,
-0.06992118805646896,
-0.007818191312253475,
-0.033394865691661835,
-0.022423749789595604,
0.0022183586843311787,
0.027896426618099213,
0.01954221911728382,
0.013977366499602795,
-0.07080480456352234,
0.09879593551158905,
0.013939916156232357,
0.027225449681282043,
-0.00993348378688097,
0.021086599677801132,
0.013503916561603546,
-0.07689840346574783,
-0.010821577161550522,
0.02482638880610466,
0.05735399201512337,
-0.04810301214456558
] | 0.048891 |
where `require('pkg/feature.js')` and `import 'pkg/feature.js'` could provide different implementations between Node.js and other JS environments. When using environment branches, always include a `"default"` condition where possible. Providing a `"default"` condition ensures that any unknown JS environments are able to use this universal implementation, which helps avoid these JS environments from having to pretend to be existing environments in order to support packages with conditional exports. For this reason, using `"node"` and `"default"` condition branches is usually preferable to using `"node"` and `"browser"` condition branches. ### Nested conditions In addition to direct mappings, Node.js also supports nested condition objects. For example, to define a package that only has dual mode entry points for use in Node.js but not the browser: ```json { "exports": { "node": { "import": "./feature-node.mjs", "require": "./feature-node.cjs" }, "default": "./feature.mjs" } } ``` Conditions continue to be matched in order as with flat conditions. If a nested condition does not have any mapping it will continue checking the remaining conditions of the parent condition. In this way nested conditions behave analogously to nested JavaScript `if` statements. ### Resolving user conditions When running Node.js, custom user conditions can be added with the `--conditions` flag: ```bash node --conditions=development index.js ``` which would then resolve the `"development"` condition in package imports and exports, while resolving the existing `"node"`, `"node-addons"`, `"default"`, `"import"`, and `"require"` conditions as appropriate. Any number of custom conditions can be set with repeat flags. Typical conditions should only contain alphanumerical characters, using ":", "-", or "=" as separators if necessary. Anything else may run into compability issues outside of node. In node, conditions have very few restrictions, but specifically these include: 1. They must contain at least one character. 2. They cannot start with "." since they may appear in places that also allow relative paths. 3. They cannot contain "," since they may be parsed as a comma-separated list by some CLI tools. 4. They cannot be integer property keys like "10" since that can have unexpected effects on property key ordering for JS objects. ### Community Conditions Definitions Condition strings other than the `"import"`, `"require"`, `"node"`, `"module-sync"`, `"node-addons"` and `"default"` conditions [implemented in Node.js core](#conditional-exports) are ignored by default. Other platforms may implement other conditions and user conditions can be enabled in Node.js via the [`--conditions` / `-C` flag][]. Since custom package conditions require clear definitions to ensure correct usage, a list of common known package conditions and their strict definitions is provided below to assist with ecosystem coordination. \* `"types"` - can be used by typing systems to resolve the typing file for the given export. \_This condition should always be included first.\_ \* `"browser"` - any web browser environment. \* `"development"` - can be used to define a development-only environment entry point, for example to provide additional debugging context such as better error messages when running in a development mode. \_Must always be mutually exclusive with `"production"`.\_ \* `"production"` - can be used to define a production environment entry point. \_Must always be mutually exclusive with `"development"`.\_ For other runtimes, platform-specific condition key definitions are maintained by the [WinterCG][] in the [Runtime Keys][] proposal specification. New conditions definitions may be added to this list by creating a pull request to the [Node.js documentation for this section][]. The requirements for listing a new condition definition here are that: \* The definition should be clear and unambiguous for all implementers. \* The use case for why the condition is needed should be clearly justified. \* There should exist sufficient existing implementation usage. \* The condition name should not conflict with another condition definition or condition in | https://github.com/nodejs/node/blob/main//doc/api/packages.md | main | nodejs | [
-0.05676385760307312,
0.0020039917435497046,
0.06181400269269943,
0.017878800630569458,
0.08494465053081512,
-0.015448486432433128,
-0.060993291437625885,
0.07450947165489197,
-0.005857070907950401,
-0.009356935508549213,
0.00936232041567564,
0.014392325654625893,
0.00933736190199852,
0.06911729276180267,
0.16360631585121155,
0.0316726453602314,
-0.003470596857368946,
-0.005059141665697098,
0.036242928355932236,
0.016399972140789032,
0.05275629460811615,
-0.04939323291182518,
0.004641241859644651,
-0.052720971405506134,
-0.057387545704841614,
-0.010180254466831684,
0.002719768090173602,
0.03177069500088692,
0.04415379837155342,
-0.0006534818094223738,
-0.02907252311706543,
0.08499866724014282,
-0.07223573327064514,
0.0327126644551754,
-0.017434880137443542,
0.13982851803302765,
-0.04344475641846657,
-0.13028617203235626,
-0.07796552777290344,
-0.0820397138595581,
0.04680167883634567,
0.054167602211236954,
-0.025185154750943184,
-0.06554578989744186,
0.030751297250390053,
-0.00411138404160738,
-0.09609082341194153,
-0.005507663823664188,
-0.07623724639415741,
-0.05498870089650154,
0.025342494249343872,
-0.027424734085798264,
-0.055945321917533875,
-0.05069756880402565,
0.015179564245045185,
0.07850063592195511,
-0.04412283003330231,
-0.0007382463081739843,
0.021008668467402458,
0.09382551908493042,
0.022322140634059906,
-0.040662702172994614,
0.01740667037665844,
0.00810141209512949,
0.04535945877432823,
0.024584157392382622,
-0.08376894891262054,
0.029279589653015137,
0.026181159541010857,
0.026906481012701988,
-0.062496818602085114,
0.011257754638791084,
-0.04608885571360588,
-0.026392607018351555,
-0.051629867404699326,
-0.05202220380306244,
-0.00029489179723896086,
0.0425943098962307,
-0.035493139177560806,
-0.015041474252939224,
-0.07203957438468933,
-0.0837591364979744,
-0.07501327991485596,
0.05154035985469818,
-0.0016848809318616986,
0.05211617425084114,
-0.057923298329114914,
-0.03263406455516815,
-0.004634742625057697,
0.08538710325956345,
-0.0477120466530323,
-0.16351817548274994,
0.04779364541172981,
0.0436263382434845,
-0.007389742415398359,
0.024589400738477707,
0.008350452408194542,
0.06124873831868172,
-0.026000937446951866,
-0.01542544737458229,
-0.0398133210837841,
-0.07345811277627945,
0.11213214695453644,
-0.0006225243560038507,
0.06247134506702423,
-0.03769694268703461,
-0.05328633636236191,
-0.0731692984700203,
0.03137480095028877,
0.01654409058392048,
-0.025222904980182648,
0.04828982055187225,
0.05357128009200096,
-0.1368432193994522,
-0.03776783123612404,
-0.0015883365413174033,
0.09744351357221603,
-0.027850311249494553,
0.059135980904102325,
0.13190990686416626,
0.006286997813731432,
0.010159121826291084,
0.10662729293107986,
0.01798303611576557,
0.07946263253688812,
-0.012134256772696972,
-0.006756672170013189,
1.3329137073840274e-33,
0.02011667564511299,
-0.07342939078807831,
0.03553629666566849,
-0.02153734676539898,
0.014039174653589725,
-0.0038236412219703197,
0.021168382838368416,
-0.0293186716735363,
-0.09025681018829346,
-0.010415430180728436,
-0.02791697345674038,
0.04599945619702339,
-0.0600726343691349,
0.05595793202519417,
0.056409891694784164,
0.05319632962346077,
0.011179912835359573,
-0.012759862467646599,
0.0883914902806282,
0.02227228879928589,
-0.026093298569321632,
-0.06797203421592712,
-0.029654551297426224,
0.08951981365680695,
0.07542143762111664,
-0.010683546774089336,
0.03514593839645386,
-0.015459367074072361,
-0.07048312574625015,
-0.004514540545642376,
-0.009599728509783745,
-0.02500889077782631,
0.024331742897629738,
0.037092335522174835,
-0.003920684102922678,
0.08411122113466263,
-0.0574938990175724,
-0.034889061003923416,
-0.06590799987316132,
-0.02526741661131382,
0.003433082951232791,
0.03233129158616066,
-0.019961679354310036,
0.05488288030028343,
0.03616878762841225,
-0.059086643159389496,
0.005710913799703121,
-0.04221983999013901,
-0.01651623845100403,
-0.004383292980492115,
-0.04229455068707466,
0.03037071041762829,
0.07490896433591843,
-0.0495925210416317,
0.05563797801733017,
-0.02145170234143734,
0.03159108757972717,
-0.020994197577238083,
-0.03766840323805809,
-0.028976891189813614,
0.0661691278219223,
-0.012635165825486183,
-0.008869269862771034,
-0.002930625341832638,
0.023892132565379143,
0.032548949122428894,
-0.03990321233868599,
0.04901755973696709,
-0.05956132709980011,
-0.029401550069451332,
-0.04315299913287163,
0.0024410008918493986,
-0.039204783737659454,
-0.010781414806842804,
0.012434499338269234,
-0.008770638145506382,
-0.00655098631978035,
0.04473942890763283,
0.04218227043747902,
-0.058531470596790314,
-0.03200431913137436,
0.011569168418645859,
-0.04966733604669571,
0.09052061289548874,
0.04196322709321976,
-0.011443303897976875,
0.02535485289990902,
0.029571274295449257,
0.05308199301362038,
-0.007966763339936733,
0.08407486975193024,
-0.0007070210995152593,
0.0021627871319651604,
0.021669624373316765,
0.00581930810585618,
-3.830814499132922e-33,
0.0034778527915477753,
0.0002598680730443448,
-0.02595551870763302,
0.036737218499183655,
-0.04998450353741646,
-0.00944434106349945,
0.03114418312907219,
-0.11831989884376526,
0.05522429943084717,
0.0009505075286142528,
-0.02495882287621498,
0.050925761461257935,
0.052565231919288635,
-0.0323956124484539,
-0.06164318323135376,
0.09275244176387787,
-0.1468624472618103,
-0.016356023028492928,
0.06767473369836807,
-0.01290414109826088,
-0.010593491606414318,
0.04009595885872841,
0.009282195009291172,
0.06835386902093887,
-0.01214232575148344,
-0.027960970997810364,
-0.06815247982740402,
-0.01731981709599495,
-0.08699523657560349,
0.0019397120922803879,
-0.008633723482489586,
0.047414813190698624,
-0.03914555162191391,
-0.02372404932975769,
-0.03214104101061821,
-0.11379998177289963,
-0.09945742785930634,
0.052955035120248795,
0.07294703274965286,
0.0029338584281504154,
0.0159292109310627,
0.014303171075880527,
-0.05007932335138321,
0.039388418197631836,
-0.06881289929151535,
0.05699784308671951,
0.07411598414182663,
-0.0006460754666477442,
0.04077183082699776,
-0.09098781645298004,
-0.056597720831632614,
0.03321104496717453,
0.008486174046993256,
0.010895635932683945,
-0.07549329102039337,
-0.011755661107599735,
-0.0737362802028656,
0.05034150555729866,
0.04901959374547005,
-0.034317173063755035,
0.03293249011039734,
-0.05274651199579239,
-0.005119699519127607,
-0.042146917432546616,
-0.10614988952875137,
-0.08081219345331192,
-0.04867108538746834,
0.05112971365451813,
0.007570090238004923,
-0.05472419410943985,
-0.0605655200779438,
-0.01860354281961918,
0.027732903137803078,
-0.010453615337610245,
-0.04594563692808151,
0.00417017936706543,
0.03829503804445267,
-0.023694781586527824,
0.015281700529158115,
0.01792340725660324,
-0.0974692553281784,
0.12085690349340439,
-0.06127747520804405,
0.05588110536336899,
0.04218641668558121,
0.00002684405080799479,
-0.008527321740984917,
0.011817816644906998,
0.02127125672996044,
-0.02610979788005352,
0.04272506386041641,
0.0754430964589119,
-0.12450098991394043,
-0.018527209758758545,
-0.04211651533842087,
-5.4258215698155254e-8,
-0.05271412804722786,
0.022189069539308548,
-0.11527729034423828,
-0.04320966452360153,
0.04977298900485039,
-0.047672368586063385,
0.07864539325237274,
0.01413160189986229,
0.05033004283905029,
0.06331826001405716,
0.005093197338283062,
0.12487095594406128,
-0.06555262953042984,
-0.02100313827395439,
0.028099872171878815,
0.030229933559894562,
0.011171657592058182,
0.08548499643802643,
-0.023126069456338882,
0.044376906007528305,
-0.0026634915266186,
-0.0033809731248766184,
0.0046352818608284,
0.08341777324676514,
0.01276305876672268,
-0.02940830960869789,
0.05788806453347206,
0.00873651634901762,
0.07085053622722626,
0.009192057885229588,
-0.031773969531059265,
0.05011501535773277,
-0.072259820997715,
0.019785700365900993,
-0.027025889605283737,
0.0202329121530056,
0.0031203418038785458,
0.010683637112379074,
0.026453981176018715,
-0.022960858419537544,
-0.005841630045324564,
-0.026813386008143425,
-0.012433268129825592,
0.01748480089008808,
-0.1109747663140297,
0.013840827159583569,
0.04905088245868683,
0.011443136259913445,
0.02616315521299839,
0.01844136416912079,
-0.01403765007853508,
-0.006444673053920269,
-0.028188420459628105,
0.038180917501449585,
0.06383902579545975,
0.09282265603542328,
0.028702525421977043,
-0.06354231387376785,
-0.021838905289769173,
-0.1001070886850357,
0.03196965157985687,
-0.012615516781806946,
0.06814205646514893,
-0.025398042052984238
] | -0.002041 |
here are that: \* The definition should be clear and unambiguous for all implementers. \* The use case for why the condition is needed should be clearly justified. \* There should exist sufficient existing implementation usage. \* The condition name should not conflict with another condition definition or condition in wide usage. \* The listing of the condition definition should provide a coordination benefit to the ecosystem that wouldn't otherwise be possible. For example, this would not necessarily be the case for company-specific or application-specific conditions. \* The condition should be such that a Node.js user would expect it to be in Node.js core documentation. The `"types"` condition is a good example: It doesn't really belong in the [Runtime Keys][] proposal but is a good fit here in the Node.js docs. The above definitions may be moved to a dedicated conditions registry in due course. ### Self-referencing a package using its name Within a package, the values defined in the package's `package.json` [`"exports"`][] field can be referenced via the package's name. For example, assuming the `package.json` is: ```json // package.json { "name": "a-package", "exports": { ".": "./index.mjs", "./foo.js": "./foo.js" } } ``` Then any module \_in that package\_ can reference an export in the package itself: ```js // ./a-module.mjs import { something } from 'a-package'; // Imports "something" from ./index.mjs. ``` Self-referencing is available only if `package.json` has [`"exports"`][], and will allow importing only what that [`"exports"`][] (in the `package.json`) allows. So the code below, given the previous package, will generate a runtime error: ```js // ./another-module.mjs // Imports "another" from ./m.mjs. Fails because // the "package.json" "exports" field // does not provide an export named "./m.mjs". import { another } from 'a-package/m.mjs'; ``` Self-referencing is also available when using `require`, both in an ES module, and in a CommonJS one. For example, this code will also work: ```cjs // ./a-module.js const { something } = require('a-package/foo.js'); // Loads from ./foo.js. ``` Finally, self-referencing also works with scoped packages. For example, this code will also work: ```json // package.json { "name": "@my/package", "exports": "./index.js" } ``` ```cjs // ./index.js module.exports = 42; ``` ```cjs // ./other.js console.log(require('@my/package')); ``` ```console $ node other.js 42 ``` ## Dual CommonJS/ES module packages See [the package examples repository][] for details. ## Node.js `package.json` field definitions This section describes the fields used by the Node.js runtime. Other tools (such as [npm](https://docs.npmjs.com/cli/v8/configuring-npm/package-json)) use additional fields which are ignored by Node.js and not documented here. The following fields in `package.json` files are used in Node.js: \* [`"name"`][] - Relevant when using named imports within a package. Also used by package managers as the name of the package. \* [`"main"`][] - The default module when loading the package, if exports is not specified, and in versions of Node.js prior to the introduction of exports. \* [`"type"`][] - The package type determining whether to load `.js` files as CommonJS or ES modules. \* [`"exports"`][] - Package exports and conditional exports. When present, limits which submodules can be loaded from within the package. \* [`"imports"`][] - Package imports, for use by modules within the package itself. ### `"name"` \* Type: {string} ```json { "name": "package-name" } ``` The `"name"` field defines your package's name. Publishing to the \_npm\_ registry requires a name that satisfies [certain requirements](https://docs.npmjs.com/files/package.json#name). The `"name"` field can be used in addition to the [`"exports"`][] field to [self-reference][] a package using its name. ### `"main"` \* Type: {string} ```json { "main": "./index.js" } ``` The `"main"` field defines the entry point of a package when imported by name via a `node\_modules` lookup. Its value is a path. When | https://github.com/nodejs/node/blob/main//doc/api/packages.md | main | nodejs | [
-0.16155964136123657,
0.04338507354259491,
0.0562623031437397,
-0.04630783200263977,
0.05174745246767998,
0.00922438409179449,
0.017985675483942032,
0.07139761745929718,
-0.05474201962351799,
-0.008353735320270061,
-0.01766354776918888,
-0.012284817174077034,
0.035314157605171204,
-0.03862863406538963,
0.1386926919221878,
0.02987617813050747,
0.01721147820353508,
-0.05508024990558624,
-0.013436559587717056,
0.04648759588599205,
0.04930160939693451,
0.021797338500618935,
-0.08661552518606186,
0.013318459503352642,
-0.114644855260849,
0.018624190241098404,
0.01558671984821558,
-0.0163575429469347,
0.04885386675596237,
0.06915320456027985,
-0.04715486615896225,
0.07274268567562103,
-0.0029999488033354282,
0.07087329775094986,
-0.004161297809332609,
0.0968228355050087,
-0.03679303079843521,
-0.10031966865062714,
-0.08812659978866577,
-0.04251187667250633,
0.023941943421959877,
0.04169633612036705,
-0.011886876076459885,
-0.004538948182016611,
0.02186378464102745,
-0.03946530818939209,
-0.05704003944993019,
-0.06185959279537201,
-0.0950511246919632,
-0.03501349687576294,
-0.02057698927819729,
-0.02069965936243534,
-0.02558213472366333,
-0.03926021605730057,
0.03764611855149269,
0.041893020272254944,
-0.01252999622374773,
-0.020310085266828537,
-0.05020194873213768,
0.03943025693297386,
0.03345959633588791,
-0.09864424914121628,
-0.02862442471086979,
-0.008054811507463455,
0.08692995458841324,
0.024671770632267,
-0.05100560560822487,
-0.0015643941005691886,
0.034295130521059036,
0.0798024833202362,
-0.06569415330886841,
0.046435561031103134,
-0.0485832579433918,
0.022769717499613762,
-0.11137410253286362,
-0.030340850353240967,
0.05888315290212631,
0.005599756725132465,
-0.06034637987613678,
0.005403620190918446,
-0.0457170344889164,
0.001341165043413639,
-0.0010385141940787435,
0.09606467932462692,
-0.02509896457195282,
0.08320381492376328,
0.011627616360783577,
-0.06730068475008011,
0.05019073560833931,
0.03296723589301109,
-0.026118479669094086,
-0.13516339659690857,
0.018891938030719757,
0.0032026544213294983,
0.06408433616161346,
0.051103074103593826,
0.00910127442330122,
-0.04049776867032051,
-0.044236909598112106,
0.010429780930280685,
-0.056613363325595856,
-0.04836636409163475,
0.07542457431554794,
-0.07003439962863922,
0.05312761664390564,
-0.03295540809631348,
-0.01094042044132948,
-0.09400641173124313,
0.02948845364153385,
-0.016985807567834854,
0.01513630896806717,
0.009963972494006157,
0.00698690814897418,
-0.10141710937023163,
-0.029997579753398895,
-0.013369565829634666,
0.09014647454023361,
-0.040216077119112015,
0.09568346291780472,
0.057469047605991364,
0.04180028289556503,
0.050475623458623886,
0.06125801429152489,
-0.009155758656561375,
0.053282078355550766,
-0.07094836235046387,
-0.054946862161159515,
3.16604085233224e-33,
-0.0579819492995739,
0.0018366321455687284,
-0.047875791788101196,
0.054844293743371964,
0.022141985595226288,
-0.04330037534236908,
-0.0030966715421527624,
0.008360696025192738,
-0.04530317336320877,
0.004185501020401716,
0.07651723176240921,
0.09261287748813629,
-0.055670421570539474,
0.05000333487987518,
0.006630174349993467,
-0.04983391612768173,
0.01786033995449543,
0.04112996906042099,
0.08598043769598007,
0.020198816433548927,
-0.007889543659985065,
-0.045203737914562225,
-0.04121645167469978,
0.11741069704294205,
0.01660039648413658,
-0.01761713996529579,
0.023199820891022682,
0.004286549054086208,
0.044218242168426514,
-0.017863664776086807,
0.06750147044658661,
-0.03282080590724945,
0.010489027947187424,
0.013062065467238426,
0.06123059242963791,
0.09512355178594589,
-0.09812610596418381,
-0.012326102703809738,
-0.0218216460198164,
-0.05162060260772705,
-0.05571209639310837,
0.04207959398627281,
-0.04981422424316406,
0.05025498941540718,
0.06641226261854172,
-0.13309355080127716,
0.0028514100704342127,
-0.07138606905937195,
0.05317414924502373,
-0.03707583621144295,
-0.036569997668266296,
0.01874147355556488,
0.08471206575632095,
-0.07116000354290009,
0.0431809164583683,
-0.04081195592880249,
0.02039220556616783,
0.026735972613096237,
-0.05335460975766182,
0.07753923535346985,
-0.004594509024173021,
-0.02564360573887825,
0.007624112535268068,
-0.01866156794130802,
-0.0477447472512722,
0.049968961626291275,
-0.08388525992631912,
0.001780704129487276,
0.02507639490067959,
-0.047109901905059814,
-0.006995562929660082,
0.0026632342487573624,
-0.05900374427437782,
0.02594035118818283,
0.028126636520028114,
0.0001863742363639176,
-0.0049018533900380135,
0.03508538380265236,
-0.007252252660691738,
-0.09493803232908249,
-0.05584269389510155,
0.02999519556760788,
0.02753218077123165,
0.10814650356769562,
-0.003831638488918543,
-0.021599633619189262,
0.038986049592494965,
0.010374766774475574,
0.02378312684595585,
-0.00960746593773365,
0.05977209284901619,
0.0062972381711006165,
-0.07746755331754684,
0.03457793593406677,
-0.032831016927957535,
-4.840009092750488e-33,
0.01779712550342083,
-0.002346541965380311,
-0.061982955783605576,
0.010305103845894337,
0.0015789095778018236,
-0.036328475922346115,
-0.008882604539394379,
-0.06734200567007065,
0.12244211882352829,
0.0007485118112526834,
-0.026977548375725746,
0.034167684614658356,
-0.011602267622947693,
-0.05103329196572304,
-0.08057907223701477,
0.039735663682222366,
-0.12982894480228424,
-0.10033223032951355,
0.025335462763905525,
0.03467043861746788,
-0.0022120249923318624,
0.01996825449168682,
-0.024691978469491005,
0.027803804725408554,
-0.015096975490450859,
-0.007596647832542658,
-0.08533661812543869,
-0.020932329818606377,
-0.04101796820759773,
0.0005003990954719484,
-0.051433928310871124,
-0.04544379189610481,
-0.06304842978715897,
0.007587416097521782,
0.0010833070846274495,
-0.10891032218933105,
-0.02110765129327774,
0.0888267233967781,
0.04541366547346115,
-0.02100742794573307,
0.05052240565419197,
0.002382372971624136,
-0.029841145500540733,
0.01712661050260067,
-0.05711649730801582,
0.0050172521732747555,
0.07427171617746353,
0.009566530585289001,
0.049592647701501846,
-0.035312261432409286,
-0.007638962473720312,
-0.07318676263093948,
0.019654283300042152,
0.07247520983219147,
-0.060251202434301376,
-0.013723631389439106,
-0.02754979021847248,
-0.008093689568340778,
0.011854608543217182,
0.039401087909936905,
0.016230003908276558,
-0.012970305979251862,
0.015095056034624577,
0.019535334780812263,
-0.06260102242231369,
-0.105690598487854,
-0.018385853618383408,
-0.03659889101982117,
0.012503774836659431,
0.008958953432738781,
-0.03486010432243347,
-0.017813879996538162,
-0.05549084395170212,
-0.028602341189980507,
-0.030407046899199486,
0.0002617135760374367,
0.08881805837154388,
-0.02980051562190056,
-0.013039802201092243,
0.061550967395305634,
-0.06663205474615097,
0.08935317397117615,
-0.03124227561056614,
0.12409000098705292,
-0.006732586771249771,
0.07814156264066696,
0.026804158464074135,
0.037952158600091934,
-0.030934331938624382,
0.04157503321766853,
0.0015062290476635098,
0.061066631227731705,
-0.09550212323665619,
-0.0015667579136788845,
-0.0847054123878479,
-5.637886602016806e-8,
-0.031993746757507324,
-0.006746762432157993,
-0.06438730657100677,
-0.0835079699754715,
0.03874587267637253,
-0.018767790868878365,
0.03133479505777359,
-0.05374046787619591,
0.0432589128613472,
0.09075582772493362,
0.0004248440673109144,
0.09628185629844666,
-0.06218774616718292,
-0.022915147244930267,
-0.04586954787373543,
0.0011536433594301343,
-0.020558292046189308,
0.07730982452630997,
-0.044463545083999634,
0.11695334315299988,
0.009434525854885578,
-0.016749244183301926,
-0.009162927977740765,
0.024946751073002815,
0.029871147125959396,
0.01635296456515789,
0.08154355734586716,
0.03532940149307251,
0.008282085880637169,
0.05106812343001366,
0.01364150270819664,
0.08385688811540604,
0.012948076240718365,
-0.05304621532559395,
-0.02887664921581745,
0.030461231246590614,
0.06121983751654625,
0.02151767536997795,
0.05309101939201355,
0.10637708753347397,
0.005103681236505508,
0.057814594358205795,
-0.023686453700065613,
0.0431625135242939,
0.02013472281396389,
0.006191654596477747,
-0.006544626317918301,
0.0424167737364769,
-0.011295822449028492,
-0.008222058415412903,
-0.043519485741853714,
0.02622583508491516,
-0.04831715673208237,
0.09417854249477386,
-0.02511199563741684,
0.04912509769201279,
0.030142750591039658,
-0.01279161125421524,
-0.006327076815068722,
-0.05801152065396309,
0.055384013801813126,
0.03969522565603256,
0.07987997680902481,
-0.008189411833882332
] | 0.188723 |
be used in addition to the [`"exports"`][] field to [self-reference][] a package using its name. ### `"main"` \* Type: {string} ```json { "main": "./index.js" } ``` The `"main"` field defines the entry point of a package when imported by name via a `node\_modules` lookup. Its value is a path. When a package has an [`"exports"`][] field, this will take precedence over the `"main"` field when importing the package by name. It also defines the script that is used when the [package directory is loaded via `require()`](modules.md#folders-as-modules). ```cjs // This resolves to ./path/to/directory/index.js. require('./path/to/directory'); ``` ### `"type"` \* Type: {string} The `"type"` field defines the module format that Node.js uses for all `.js` files that have that `package.json` file as their nearest parent. Files ending with `.js` are loaded as ES modules when the nearest parent `package.json` file contains a top-level field `"type"` with a value of `"module"`. The nearest parent `package.json` is defined as the first `package.json` found when searching in the current folder, that folder's parent, and so on up until a node\\_modules folder or the volume root is reached. ```json // package.json { "type": "module" } ``` ```bash # In same folder as preceding package.json node my-app.js # Runs as ES module ``` If the nearest parent `package.json` lacks a `"type"` field, or contains `"type": "commonjs"`, `.js` files are treated as [CommonJS][]. If the volume root is reached and no `package.json` is found, `.js` files are treated as [CommonJS][]. `import` statements of `.js` files are treated as ES modules if the nearest parent `package.json` contains `"type": "module"`. ```js // my-app.js, part of the same example as above import './startup.js'; // Loaded as ES module because of package.json ``` Regardless of the value of the `"type"` field, `.mjs` files are always treated as ES modules and `.cjs` files are always treated as CommonJS. ### `"exports"` \* Type: {Object|string|string\[]} ```json { "exports": "./index.js" } ``` The `"exports"` field allows defining the [entry points][] of a package when imported by name loaded either via a `node\_modules` lookup or a [self-reference][] to its own name. It is supported in Node.js 12+ as an alternative to the [`"main"`][] that can support defining [subpath exports][] and [conditional exports][] while encapsulating internal unexported modules. [Conditional Exports][] can also be used within `"exports"` to define different package entry points per environment, including whether the package is referenced via `require` or via `import`. All paths defined in the `"exports"` must be relative file URLs starting with `./`. ### `"imports"` \* Type: {Object} ```json // package.json { "imports": { "#dep": { "node": "dep-node-native", "default": "./dep-polyfill.js" } }, "dependencies": { "dep-node-native": "^1.0.0" } } ``` Entries in the imports field must be strings starting with `#`. Package imports permit mapping to external packages. This field defines [subpath imports][] for the current package. [CommonJS]: modules.md [Conditional exports]: #conditional-exports [ES module]: esm.md [ES modules]: esm.md [Node.js documentation for this section]: https://github.com/nodejs/node/blob/HEAD/doc/api/packages.md#conditions-definitions [Runtime Keys]: https://runtime-keys.proposal.wintercg.org/ [Syntax detection]: #syntax-detection [TypeScript]: typescript.md [WebAssembly modules]: esm.md#wasm-modules [WinterCG]: https://wintercg.org/ [`"exports"`]: #exports [`"imports"`]: #imports [`"main"`]: #main [`"name"`]: #name [`"type"`]: #type [`--conditions` / `-C` flag]: #resolving-user-conditions [`--experimental-addon-modules`]: cli.md#--experimental-addon-modules [`--no-addons` flag]: cli.md#--no-addons [`ERR\_PACKAGE\_PATH\_NOT\_EXPORTED`]: errors.md#err\_package\_path\_not\_exported [`ERR\_UNKNOWN\_FILE\_EXTENSION`]: errors.md#err\_unknown\_file\_extension [`package.json`]: #nodejs-packagejson-field-definitions [customization hooks]: module.md#customization-hooks [entry points]: #package-entry-points [folders as modules]: modules.md#folders-as-modules [import maps]: https://github.com/WICG/import-maps [load ECMAScript modules from CommonJS modules]: modules.md#loading-ecmascript-modules-using-require [merve]: https://github.com/anonrig/merve [packages folder mapping]: https://github.com/WICG/import-maps#packages-via-trailing-slashes [self-reference]: #self-referencing-a-package-using-its-name [subpath exports]: #subpath-exports [subpath imports]: #subpath-imports [the dual CommonJS/ES module packages section]: #dual-commonjses-module-packages [the full specifier path]: esm.md#mandatory-file-extensions [the package examples repository]: https://github.com/nodejs/package-examples | https://github.com/nodejs/node/blob/main//doc/api/packages.md | main | nodejs | [
-0.09082197397947311,
0.03172043710947037,
-0.05132661759853363,
-0.018231702968478203,
0.09096331894397736,
0.008711147122085094,
0.028643742203712463,
0.08255703002214432,
0.03450281172990799,
-0.03635994344949722,
-0.018250491470098495,
0.07858116179704666,
-0.03106802888214588,
0.0011778352782130241,
0.05110529065132141,
0.07819820195436478,
-0.022907264530658722,
-0.01202088687568903,
0.016498904675245285,
0.0006719541852362454,
0.023832326754927635,
0.014255772344768047,
0.024301469326019287,
0.004823366645723581,
-0.050136249512434006,
0.004246446304023266,
-0.035471078008413315,
0.01634962484240532,
-0.015543217770755291,
0.02313775010406971,
-0.03620032221078873,
0.09263694286346436,
-0.01639086753129959,
-0.0005519074620679021,
-0.029520254582166672,
0.16894009709358215,
-0.027991630136966705,
-0.04033878073096275,
0.008597000502049923,
-0.08178692311048508,
0.07288926094770432,
0.1166280135512352,
0.02305850014090538,
-0.10775069147348404,
0.0037361776921898127,
-0.09004861861467361,
-0.03823728859424591,
-0.004072961397469044,
-0.042561549693346024,
0.0025928078684955835,
-0.013644522987306118,
0.007269923109561205,
-0.10065165162086487,
-0.021016016602516174,
-0.022643418982625008,
0.09368444234132767,
-0.07324672490358353,
0.011188839562237263,
-0.012548770755529404,
0.11394025385379791,
-0.006011940073221922,
0.038774728775024414,
0.04298652336001396,
-0.019277676939964294,
0.02896037884056568,
-0.01932859979569912,
-0.06266419589519501,
0.0009670904837548733,
0.02569017931818962,
-0.018530873581767082,
-0.037513647228479385,
0.061105236411094666,
-0.03897617384791374,
-0.04970400780439377,
-0.0321466401219368,
-0.10426312685012817,
-0.0035352520644664764,
0.04680696502327919,
-0.01649324595928192,
-0.026893535628914833,
-0.0403781533241272,
-0.028392033651471138,
-0.02034260332584381,
0.04788488522171974,
-0.06398878246545792,
0.06161622703075409,
-0.03684336319565773,
0.01629333198070526,
0.032860226929187775,
0.06278334558010101,
-0.06635128706693649,
-0.18708977103233337,
-0.010078301653265953,
0.034586530178785324,
0.035691093653440475,
0.061291273683309555,
0.03287053108215332,
0.10180869698524475,
-0.029215678572654724,
-0.05066030099987984,
-0.0154890026897192,
-0.052018631249666214,
0.11114152520895004,
-0.0033770224545150995,
0.043711282312870026,
0.020322732627391815,
-0.03172164782881737,
-0.06078854575753212,
0.002821609377861023,
-0.013073554262518883,
-0.029662560671567917,
0.04903409257531166,
-0.04648248478770256,
-0.07591022551059723,
-0.05091111361980438,
0.039458759129047394,
0.04647362604737282,
-0.02349345199763775,
0.012097499333322048,
0.11779659241437912,
0.051809437572956085,
0.022885113954544067,
0.09126424789428711,
-0.020819904282689095,
0.05462699383497238,
-0.0031450625974684954,
0.01593024656176567,
-2.929180577351472e-33,
-0.012888694182038307,
0.028172681108117104,
0.00780764315277338,
0.07632298767566681,
-0.02351466938853264,
-0.04503137245774269,
0.028831029310822487,
0.02944728545844555,
-0.04623052105307579,
0.012659922242164612,
-0.04300829768180847,
0.09926623106002808,
-0.03847756236791611,
0.05634607747197151,
-0.019330469891428947,
-0.016704188659787178,
0.017778679728507996,
0.006316046696156263,
0.06742779165506363,
-0.04172550514340401,
0.031123127788305283,
0.05377829819917679,
-0.019439099356532097,
0.10959981381893158,
0.09682176262140274,
-0.0024246040266007185,
0.02224423550069332,
0.0182479377835989,
-0.03622700273990631,
-0.02271178551018238,
0.04767441377043724,
0.02815883792936802,
0.010005624033510685,
-0.017191283404827118,
0.07603923231363297,
0.0454750657081604,
-0.0035905693657696247,
0.03850894793868065,
-0.11320853978395462,
-0.03373030945658684,
0.013656266033649445,
0.0909455269575119,
-0.08523249626159668,
0.05986364558339119,
-0.00907865073531866,
-0.04032348841428757,
-0.02860938012599945,
-0.031221311539411545,
0.07425395399332047,
-0.04807185009121895,
-0.09616674482822418,
-0.0261220745742321,
0.12349952012300491,
-0.007146743126213551,
0.031152265146374702,
0.012010007165372372,
0.04649970680475235,
-0.043792080134153366,
-0.009746789932250977,
-0.014855205081403255,
0.028523754328489304,
-0.039652466773986816,
-0.025719264522194862,
0.09371626377105713,
0.05180984362959862,
0.03064492531120777,
-0.04994134604930878,
-0.028034541755914688,
-0.017080767080187798,
0.03651825338602066,
-0.020644795149564743,
0.042930763214826584,
-0.04029851034283638,
0.01592523604631424,
0.06342513114213943,
0.010402850806713104,
-0.041407860815525055,
0.00604453356936574,
0.004634716548025608,
-0.019386272877454758,
-0.04053480923175812,
0.03205104544758797,
-0.03286571055650711,
0.005902701057493687,
-0.00570840435102582,
0.031093399971723557,
-0.08842695504426956,
-0.008709286339581013,
0.0813961923122406,
-0.0903327688574791,
0.10026486963033676,
0.0076708002015948296,
-0.05960038676857948,
-0.053314175456762314,
-0.0716291144490242,
-1.16893793924508e-33,
0.06775174289941788,
0.006117716897279024,
-0.016045531257987022,
0.04865194112062454,
-0.04311439394950867,
-0.04148409515619278,
-0.03139566630125046,
-0.023581283167004585,
0.11309055984020233,
0.04797375574707985,
-0.07943552732467651,
0.04551810398697853,
0.05084842070937157,
0.0037591883447021246,
0.013438013382256031,
0.06666794419288635,
-0.09986845403909683,
-0.006710471119731665,
-0.005783050321042538,
-0.06944148242473602,
-0.03396640345454216,
0.019012251868844032,
0.029292860999703407,
0.003185417503118515,
-0.02561143785715103,
-0.01994631625711918,
-0.07098361849784851,
-0.05588208884000778,
-0.05910366773605347,
-0.016524692997336388,
-0.03933766111731529,
0.030054770410060883,
-0.0008330885320901871,
0.007796627003699541,
-0.06138245388865471,
0.009674450382590294,
-0.08471626043319702,
0.033134374767541885,
0.11263623833656311,
-0.01585090160369873,
0.02941044606268406,
0.010340201668441296,
-0.0542830266058445,
0.02235485054552555,
-0.029226822778582573,
-0.07768134772777557,
-0.023438071832060814,
0.08881206810474396,
0.020107517018914223,
-0.06150223687291145,
-0.10145492851734161,
-0.05713849142193794,
-0.04879799112677574,
-0.021446991711854935,
0.0068860482424497604,
0.009330659173429012,
0.01414013933390379,
0.055620890110731125,
0.019414022564888,
-0.0038087312132120132,
0.06701045483350754,
-0.05013395845890045,
-0.04789293184876442,
-0.014031103812158108,
-0.11943752318620682,
-0.07645593583583832,
-0.08728212118148804,
-0.04967771843075752,
0.05159446597099304,
-0.033868107944726944,
-0.061951979994773865,
-0.0011721551418304443,
0.03722376003861427,
-0.001235363306477666,
-0.052003901451826096,
-0.04786728322505951,
0.04422048106789589,
0.015482677146792412,
0.042809516191482544,
0.04365195706486702,
-0.013986456207931042,
0.05392742156982422,
-0.016407357528805733,
0.07173153758049011,
-0.006399139761924744,
-0.05743709206581116,
0.03822274133563042,
0.029459618031978607,
-0.027233822271227837,
-0.008462313562631607,
0.06099307909607887,
-0.021431349217891693,
-0.06326193362474442,
-0.041610490530729294,
-0.10010801255702972,
-5.2026056351905936e-8,
-0.06966038793325424,
0.011142212897539139,
-0.12939126789569855,
-0.0047111003659665585,
0.013143254444003105,
-0.0017855503829196095,
0.020271949470043182,
0.07057031989097595,
0.07968971133232117,
0.09151533246040344,
0.022540520876646042,
0.05094684660434723,
-0.08274473249912262,
-0.01470528170466423,
-0.07376677542924881,
0.03928608074784279,
0.0034873411059379578,
0.09071647375822067,
-0.03541609272360802,
0.011541510000824928,
-0.016728095710277557,
-0.017967715859413147,
0.024935249239206314,
0.03197687864303589,
0.029626160860061646,
0.011514708399772644,
0.021804815158247948,
0.014008956961333752,
-0.007576087024062872,
0.010033697821199894,
-0.08139950037002563,
0.055648427456617355,
-0.013035167008638382,
-0.05188741907477379,
-0.022314222529530525,
-0.00040284128044731915,
0.08042643219232559,
0.0018979987362399697,
0.10936525464057922,
0.07331931591033936,
-0.033631257712841034,
0.00938298087567091,
-0.048830270767211914,
0.0068300822749733925,
-0.04321383312344551,
-0.03517724946141243,
-0.0428086556494236,
0.049756959080696106,
-0.03007146343588829,
-0.018010303378105164,
0.023184845224022865,
-0.04994319751858711,
-0.03603510558605194,
0.018061013892292976,
0.03937400504946709,
0.038170456886291504,
-0.03176327794790268,
-0.01986551284790039,
0.01073075644671917,
-0.13085167109966278,
-0.013999630697071552,
0.032043613493442535,
0.07812073081731796,
-0.05462667718529701
] | 0.096162 |
[subpath imports]: #subpath-imports [the dual CommonJS/ES module packages section]: #dual-commonjses-module-packages [the full specifier path]: esm.md#mandatory-file-extensions [the package examples repository]: https://github.com/nodejs/package-examples | https://github.com/nodejs/node/blob/main//doc/api/packages.md | main | nodejs | [
-0.028761999681591988,
-0.06824274361133575,
0.044548239558935165,
-0.03383895754814148,
0.12494891881942749,
0.012285711243748665,
-0.04524298384785652,
0.05255527421832085,
-0.04590945690870285,
0.006210509687662125,
-0.03233081474900246,
0.006947208661586046,
-0.035454507917165756,
0.03561897575855255,
0.11718694865703583,
0.08268766105175018,
-0.013773697428405285,
0.06574329733848572,
0.007033668924123049,
-0.007737896405160427,
0.027526473626494408,
0.0025812480598688126,
0.06569705903530121,
-0.04726402088999748,
-0.05417195335030556,
0.003774181241169572,
0.030920706689357758,
0.05750783905386925,
0.004257316701114178,
-0.050082940608263016,
0.02675175853073597,
0.01629496179521084,
0.013855574652552605,
0.036042120307683945,
-0.04046453908085823,
0.1108149066567421,
-0.031386565417051315,
-0.06154199317097664,
-0.0013865868095308542,
-0.044525936245918274,
0.02640857920050621,
0.09771033376455307,
0.048659175634384155,
-0.09929370135068893,
-0.018389275297522545,
-0.11802590638399124,
-0.14162316918373108,
-0.06216662749648094,
-0.0777597427368164,
-0.00426237378269434,
0.08396164327859879,
-0.12077595293521881,
-0.11341299116611481,
-0.00820245873183012,
-0.00039433452184312046,
0.04775109142065048,
-0.04178595915436745,
0.03930985927581787,
0.010814826004207134,
0.08600752800703049,
0.03202279657125473,
0.004912564996629953,
0.001894177752546966,
0.01158562209457159,
-0.025580979883670807,
0.023629626259207726,
0.019104959443211555,
0.05847996100783348,
0.024794844910502434,
-0.00600374536588788,
-0.04587911069393158,
0.011274253018200397,
0.017880355939269066,
-0.04046673700213432,
-0.07106942683458328,
-0.09268107265233994,
0.02750266343355179,
0.07639580219984055,
0.0076989769004285336,
0.0000802436115918681,
-0.058917805552482605,
0.0355890654027462,
-0.011525805108249187,
0.020844586193561554,
0.030053487047553062,
0.0684506818652153,
-0.006274004001170397,
0.027968022972345352,
0.015740016475319862,
0.020984424278140068,
-0.004068324342370033,
-0.16992224752902985,
-0.005506753921508789,
0.04619211703538895,
-0.044212110340595245,
0.017612356692552567,
-0.05741332471370697,
0.09842872619628906,
-0.01461885217577219,
-0.0056280940771102905,
-0.06249551847577095,
0.019226301461458206,
0.08224307745695114,
0.017676370218396187,
0.025503085926175117,
0.004787395242601633,
0.03915786370635033,
-0.029652683064341545,
0.016241662204265594,
-0.003984764683991671,
-0.0038638017140328884,
0.019721215590834618,
-0.0014378641499206424,
-0.10914796590805054,
-0.03503827005624771,
-0.015753112733364105,
0.040721189230680466,
-0.04842935875058174,
0.07686111330986023,
0.09149076044559479,
-0.0365101657807827,
0.011460347101092339,
0.12262488156557083,
-0.07310930639505386,
0.09251099824905396,
-0.035311102867126465,
-0.01711733639240265,
-1.5969590341019875e-33,
0.010383914224803448,
0.02888212539255619,
0.005510024260729551,
0.06844522804021835,
0.03933476284146309,
-0.06595563888549805,
0.004905358422547579,
-0.05812149494886398,
-0.11367437988519669,
0.005922176409512758,
-0.035516608506441116,
0.1044137179851532,
-0.02594391256570816,
0.05901557207107544,
-0.026756364852190018,
-0.011494067497551441,
0.037385910749435425,
-0.0007619050447829068,
0.07453620433807373,
-0.06967175006866455,
-0.04702300205826759,
0.04114241153001785,
0.02266634814441204,
0.06528930366039276,
0.037496794015169144,
-0.013619013130664825,
0.05776617303490639,
-0.008705409243702888,
0.05607592687010765,
0.022549856454133987,
0.022665495052933693,
0.0450296625494957,
0.010489794425666332,
0.09001680463552475,
0.011857565492391586,
0.054072584956884384,
-0.07720141857862473,
0.05116873234510422,
-0.027512477710843086,
0.03183932974934578,
0.06326639652252197,
0.06716611236333847,
-0.009486611932516098,
-0.0048978026024997234,
-0.02047812193632126,
-0.09283427894115448,
0.007867450825870037,
-0.09241467714309692,
0.12777996063232422,
-0.039216239005327225,
-0.0927540510892868,
-0.013727955520153046,
0.05104387551546097,
-0.008827434852719307,
0.01787251979112625,
-0.01126906555145979,
0.03622834011912346,
-0.012960860505700111,
0.04149286821484566,
-0.057071276009082794,
0.01821708120405674,
-0.008638797327876091,
-0.0257294662296772,
0.024978945031762123,
0.036072853952646255,
-0.005442826077342033,
-0.08605366945266724,
-0.06182674691081047,
-0.030530303716659546,
0.06639541685581207,
0.0021880771964788437,
-0.025367729365825653,
0.0009494299301877618,
0.0038509501609951258,
0.029413731768727303,
-0.017645826563239098,
0.021409887820482254,
0.015743523836135864,
0.017823217436671257,
-0.019100995734333992,
-0.10296598821878433,
-0.013207857497036457,
-0.007319269236177206,
0.038146503269672394,
0.03147262707352638,
0.018521564081311226,
-0.03564019501209259,
0.008779377676546574,
0.1002424880862236,
0.003461455460637808,
0.023844163864850998,
0.0012641166104003787,
-0.049957580864429474,
-0.08771886676549911,
-0.047259557992219925,
2.9023449137594128e-34,
0.057688865810632706,
0.09738893806934357,
-0.030696025118231773,
0.08705028891563416,
-0.04182729870080948,
0.013873484916985035,
-0.010117978788912296,
-0.014572232030332088,
0.07445071637630463,
0.08754565566778183,
-0.018129482865333557,
0.01966851018369198,
0.09592294692993164,
-0.002085405169054866,
0.01135046686977148,
0.04896484315395355,
-0.04156678542494774,
-0.030246006324887276,
0.037955593317747116,
-0.08403700590133667,
0.01732633449137211,
0.031131355091929436,
0.013651632703840733,
-0.05734755098819733,
0.037732359021902084,
-0.0063930111937224865,
-0.048482269048690796,
-0.010780302807688713,
-0.04607803374528885,
-0.015538732521235943,
-0.07575936615467072,
-0.00010882169590331614,
0.0003846915205940604,
-0.018082372844219208,
-0.12099365890026093,
-0.01693693920969963,
0.005424912553280592,
0.04908290132880211,
0.014064301736652851,
-0.07616066932678223,
-0.03531993180513382,
0.01904173754155636,
-0.0383906327188015,
0.004349337890744209,
-0.013892079703509808,
-0.047696828842163086,
0.012749860994517803,
0.042875684797763824,
-0.010835501365363598,
-0.08142252266407013,
-0.10945257544517517,
-0.0165293887257576,
-0.050077423453330994,
-0.03343823924660683,
-0.04008881002664566,
-0.0064095002599060535,
0.02528560534119606,
0.01880078949034214,
-0.003465957473963499,
-0.022891337051987648,
0.08255533128976822,
0.009701657108962536,
-0.06951211392879486,
-0.10697463899850845,
-0.003976122476160526,
-0.0068113068118691444,
-0.09383340924978256,
-0.0377892330288887,
0.005050033330917358,
-0.04051421210169792,
-0.05292711406946182,
0.02836143970489502,
-0.019251149147748947,
-0.022911906242370605,
0.027937456965446472,
-0.028733987361192703,
-0.0031090539414435625,
0.025019627064466476,
0.06892596930265427,
-0.012666095048189163,
0.04460117965936661,
0.04793087765574455,
-0.033216241747140884,
0.01449884194880724,
0.047034669667482376,
0.02138989418745041,
0.013120648451149464,
-0.02682124264538288,
-0.02864384837448597,
-0.0333130918443203,
0.013609842397272587,
0.055915746837854385,
-0.0141268540173769,
0.006847857031971216,
-0.026758641004562378,
-2.947199995162464e-8,
-0.0668649673461914,
-0.00652242312207818,
-0.10496312379837036,
-0.05764796957373619,
0.06987027823925018,
0.0059779915027320385,
0.037213776260614395,
0.07189775258302689,
0.06884697079658508,
0.08107293397188187,
-0.010939529165625572,
0.07508202642202377,
-0.037348758429288864,
0.04212796315550804,
-0.02099751867353916,
0.07689991593360901,
-0.013111691921949387,
0.17583753168582916,
-0.06817837059497833,
-0.006299949716776609,
-0.025623809546232224,
0.07773283123970032,
0.04976818710565567,
0.04994378238916397,
0.03554629534482956,
0.0426933653652668,
0.036796391010284424,
0.036745473742485046,
0.004266703501343727,
-0.0378766693174839,
-0.11570348590612411,
0.01708216406404972,
-0.01899884082376957,
-0.0679733082652092,
-0.004055687692016363,
0.02528536692261696,
0.046962615102529526,
0.028132429346442223,
0.04340855032205582,
0.052776824682950974,
-0.02222304977476597,
-0.046405330300331116,
-0.009147929027676582,
0.01745479926466942,
-0.05354996398091316,
0.02233872003853321,
-0.021349137648940086,
0.0035691114608198404,
-0.09265769273042679,
-0.003718193620443344,
0.03255634009838104,
-0.02791331149637699,
-0.06497763842344284,
0.042000021785497665,
-0.030606810003519058,
0.03326123207807541,
-0.006400649435818195,
-0.07882343977689743,
0.00009385737212141976,
-0.11931245774030685,
0.037196286022663116,
0.003525108564645052,
0.07480171322822571,
-0.08188016712665558
] | 0.11404 |
# HTTP/2 > Stability: 2 - Stable The `node:http2` module provides an implementation of the [HTTP/2][] protocol. It can be accessed using: ```js const http2 = require('node:http2'); ``` ## Determining if crypto support is unavailable It is possible for Node.js to be built without including support for the `node:crypto` module. In such cases, attempting to `import` from `node:http2` or calling `require('node:http2')` will result in an error being thrown. When using CommonJS, the error thrown can be caught using try/catch: ```cjs let http2; try { http2 = require('node:http2'); } catch (err) { console.error('http2 support is disabled!'); } ``` When using the lexical ESM `import` keyword, the error can only be caught if a handler for `process.on('uncaughtException')` is registered \_before\_ any attempt to load the module is made (using, for instance, a preload module). When using ESM, if there is a chance that the code may be run on a build of Node.js where crypto support is not enabled, consider using the [`import()`][] function instead of the lexical `import` keyword: ```mjs let http2; try { http2 = await import('node:http2'); } catch (err) { console.error('http2 support is disabled!'); } ``` ## Core API The Core API provides a low-level interface designed specifically around support for HTTP/2 protocol features. It is specifically \_not\_ designed for compatibility with the existing [HTTP/1][] module API. However, the [Compatibility API][] is. The `http2` Core API is much more symmetric between client and server than the `http` API. For instance, most events, like `'error'`, `'connect'` and `'stream'`, can be emitted either by client-side code or server-side code. ### Server-side example The following illustrates a simple HTTP/2 server using the Core API. Since there are no browsers known that support [unencrypted HTTP/2][HTTP/2 Unencrypted], the use of [`http2.createSecureServer()`][] is necessary when communicating with browser clients. ```mjs import { createSecureServer } from 'node:http2'; import { readFileSync } from 'node:fs'; const server = createSecureServer({ key: readFileSync('localhost-privkey.pem'), cert: readFileSync('localhost-cert.pem'), }); server.on('error', (err) => console.error(err)); server.on('stream', (stream, headers) => { // stream is a Duplex stream.respond({ 'content-type': 'text/html; charset=utf-8', ':status': 200, }); stream.end(' # Hello World '); }); server.listen(8443); ``` ```cjs const http2 = require('node:http2'); const fs = require('node:fs'); const server = http2.createSecureServer({ key: fs.readFileSync('localhost-privkey.pem'), cert: fs.readFileSync('localhost-cert.pem'), }); server.on('error', (err) => console.error(err)); server.on('stream', (stream, headers) => { // stream is a Duplex stream.respond({ 'content-type': 'text/html; charset=utf-8', ':status': 200, }); stream.end(' # Hello World '); }); server.listen(8443); ``` To generate the certificate and key for this example, run: ```bash openssl req -x509 -newkey rsa:2048 -nodes -sha256 -subj '/CN=localhost' \ -keyout localhost-privkey.pem -out localhost-cert.pem ``` ### Client-side example The following illustrates an HTTP/2 client: ```mjs import { connect } from 'node:http2'; import { readFileSync } from 'node:fs'; const client = connect('https://localhost:8443', { ca: readFileSync('localhost-cert.pem'), }); client.on('error', (err) => console.error(err)); const req = client.request({ ':path': '/' }); req.on('response', (headers, flags) => { for (const name in headers) { console.log(`${name}: ${headers[name]}`); } }); req.setEncoding('utf8'); let data = ''; req.on('data', (chunk) => { data += chunk; }); req.on('end', () => { console.log(`\n${data}`); client.close(); }); req.end(); ``` ```cjs const http2 = require('node:http2'); const fs = require('node:fs'); const client = http2.connect('https://localhost:8443', { ca: fs.readFileSync('localhost-cert.pem'), }); client.on('error', (err) => console.error(err)); const req = client.request({ ':path': '/' }); req.on('response', (headers, flags) => { for (const name in headers) { console.log(`${name}: ${headers[name]}`); } }); req.setEncoding('utf8'); let data = ''; req.on('data', (chunk) => { data += chunk; }); req.on('end', () => { console.log(`\n${data}`); client.close(); }); req.end(); ``` ### Class: `Http2Session` \* Extends: {EventEmitter} Instances of the `http2.Http2Session` class represent an active communications session between an HTTP/2 client and server. Instances of this class are \_not\_ intended to be constructed directly by user code. Each `Http2Session` instance | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.08762390166521072,
-0.008550201542675495,
-0.0072602443397045135,
0.008517125621438026,
0.07394813001155853,
-0.052068229764699936,
-0.0834648534655571,
0.017178164795041084,
-0.009066454134881496,
-0.036946579813957214,
-0.008470476604998112,
0.04142075404524803,
0.009878977201879025,
0.01894465833902359,
0.11023063212633133,
0.01656768098473549,
0.051398538053035736,
0.03798374533653259,
-0.04542139917612076,
0.013598413206636906,
0.042757172137498856,
-0.052162982523441315,
0.02218928001821041,
-0.035277269780635834,
-0.07044532150030136,
-0.04511535167694092,
-0.05239411070942879,
0.021495560184121132,
0.03216138109564781,
0.01882813684642315,
0.00531937787309289,
-0.034504033625125885,
-0.13950605690479279,
0.040965598076581955,
-0.1209164708852768,
0.06675685942173004,
-0.02750214748084545,
-0.09807893633842468,
-0.02709900587797165,
-0.035886526107788086,
0.006716212723404169,
0.06197751313447952,
-0.09366937726736069,
-0.09395638108253479,
-0.02724384516477585,
-0.032542698085308075,
-0.051357369869947433,
0.016888150945305824,
-0.09721994400024414,
-0.052585043013095856,
-0.00976365152746439,
-0.041198235005140305,
-0.01667509227991104,
0.0067994799464941025,
-0.042520880699157715,
0.006697396282106638,
-0.048602499067783356,
0.05346687138080597,
0.008124850690364838,
0.06504887342453003,
0.0026329061947762966,
-0.016247916966676712,
0.020319974049925804,
0.01811622455716133,
0.04265976697206497,
-0.03535585105419159,
0.020798103883862495,
-0.018554290756583214,
0.0051997448317706585,
0.09775824844837189,
-0.05865468829870224,
0.002150463405996561,
-0.03699149191379547,
0.04262984171509743,
-0.006024402566254139,
-0.057206891477108,
-0.02325446531176567,
-0.023133793845772743,
-0.029464876279234886,
0.014816963113844395,
-0.015980232506990433,
-0.08322741836309433,
-0.011558810248970985,
0.024604637175798416,
0.0030307737179100513,
0.06349511444568634,
-0.0019699744880199432,
0.014490975998342037,
0.045705396682024,
0.018801670521497726,
-0.03507121279835701,
-0.012041494250297546,
0.039659284055233,
0.07365279644727707,
0.05951749160885811,
0.02738003060221672,
0.05169915407896042,
0.03696189820766449,
-0.06809483468532562,
-0.030428044497966766,
-0.013319692574441433,
-0.015825917944312096,
0.05673665180802345,
-0.05356156453490257,
0.07640518248081207,
-0.01940579153597355,
-0.009222090244293213,
-0.04864700138568878,
0.07762520760297775,
-0.019247936084866524,
0.056231994181871414,
0.018019501119852066,
-0.003598056733608246,
-0.012498290278017521,
-0.055942319333553314,
0.06283091008663177,
0.08534584939479828,
-0.03269069641828537,
0.06051480397582054,
0.09975659847259521,
0.042029138654470444,
-0.007657067384570837,
0.08617222309112549,
-0.05864226073026657,
0.019174844026565552,
-0.1057957336306572,
0.08153219521045685,
3.23915770297934e-33,
-0.022660795599222183,
-0.07485835999250412,
-0.04196134954690933,
0.07178957015275955,
0.029266031458973885,
-0.005689012352377176,
0.0328754298388958,
0.011580158956348896,
-0.09406435489654541,
-0.06445645540952682,
0.02253253571689129,
-0.013662458397448063,
0.03392757475376129,
-0.049210093915462494,
0.06836143136024475,
0.010677405633032322,
0.1468690186738968,
-0.0486893467605114,
0.1554485559463501,
0.05071263015270233,
0.0628441870212555,
-0.00004479111157706939,
0.06533221155405045,
0.018893854692578316,
0.001048785517923534,
0.015496793203055859,
0.038259390741586685,
0.009254004806280136,
0.051112450659275055,
0.0179044958204031,
0.010353479534387589,
0.047081999480724335,
-0.028582168743014336,
0.03258897364139557,
0.059124432504177094,
-0.004825544077903032,
0.0008697378216311336,
0.03387446701526642,
-0.07425915449857712,
-0.04404766857624054,
0.03852585703134537,
0.08342889696359634,
-0.031130759045481682,
0.027467215433716774,
0.005046959035098553,
-0.15677259862422943,
-0.060849010944366455,
-0.08323661237955093,
0.03914714977145195,
0.031922247260808945,
-0.1029014065861702,
0.04688336327672005,
0.04571434110403061,
-0.0339072085916996,
0.04870129004120827,
-0.03292526304721832,
0.0212373286485672,
-0.027436716482043266,
-0.04656343534588814,
-0.04064225032925606,
0.008264138363301754,
-0.03453546389937401,
-0.03881560638546944,
-0.01943252980709076,
-0.019351821392774582,
0.03898648917675018,
-0.07647436857223511,
0.01728292554616928,
-0.0651836171746254,
0.08932902663946152,
-0.013886552304029465,
-0.03222011402249336,
0.021590517833828926,
0.055755991488695145,
0.01755356788635254,
0.006960234139114618,
-0.016542738303542137,
-0.013540396466851234,
0.06048604100942612,
-0.022985942661762238,
0.019871070981025696,
-0.035868771374225616,
0.04476900398731232,
0.09441450238227844,
-0.04105889052152634,
-0.0006294870981946588,
-0.06329665333032608,
0.03492195904254913,
0.028686413541436195,
0.06540632992982864,
0.03758727386593819,
0.04055535048246384,
-0.022418061271309853,
-0.0925767719745636,
-0.030249755829572678,
-5.860629124116062e-33,
-0.02382810413837433,
0.040874745696783066,
-0.059216611087322235,
0.13518309593200684,
-0.007475257385522127,
-0.0354665108025074,
-0.04765693470835686,
-0.0677381083369255,
0.03142991662025452,
0.042987238615751266,
-0.016041327267885208,
0.00617769081145525,
0.1148885041475296,
0.03592846170067787,
0.021694276481866837,
0.038002174347639084,
-0.11409269273281097,
0.026955004781484604,
0.00071149313589558,
0.002050339011475444,
0.0011522285640239716,
-0.022480370476841927,
0.0024353456683456898,
0.0011024639243260026,
-0.04531761631369591,
0.021192938089370728,
-0.07286511361598969,
-0.054709725081920624,
-0.052551694214344025,
-0.04265469312667847,
-0.04691625013947487,
0.006400051526725292,
0.02261931262910366,
0.040149539709091187,
0.003745866008102894,
-0.08675950020551682,
-0.03487381339073181,
0.059759169816970825,
0.0009482937166467309,
-0.06411776691675186,
0.07636086642742157,
0.05189129710197449,
0.010071170516312122,
0.033268120139837265,
0.02179008722305298,
-0.09040286391973495,
0.017886443063616753,
0.010560130700469017,
-0.03893356770277023,
-0.024458162486553192,
-0.06300670653581619,
-0.021906469017267227,
0.015322644263505936,
0.020843347534537315,
-0.035364869982004166,
-0.017848463729023933,
0.035730861127376556,
0.09831899404525757,
-0.0019841508474200964,
0.0283584613353014,
0.04795243218541145,
-0.06574516743421555,
-0.059913571923971176,
0.02278370037674904,
0.06722279638051987,
0.018969053402543068,
-0.12988699972629547,
0.01776355504989624,
0.08724362403154373,
0.05082893371582031,
-0.001982710789889097,
0.004866998177021742,
-0.007337615825235844,
-0.04495096206665039,
-0.0059669530019164085,
-0.015750311315059662,
-0.032269299030303955,
-0.0777331069111824,
0.017548412084579468,
0.05451337248086929,
-0.007508660200983286,
0.07608813047409058,
-0.019576745107769966,
-0.03863482549786568,
0.06598103791475296,
-0.006905045360326767,
-0.023495227098464966,
0.003629158018156886,
-0.08729906380176544,
-0.05684193968772888,
0.04714629799127579,
0.031245572492480278,
-0.1350582242012024,
0.009319055825471878,
0.03377927467226982,
-5.0692580799704956e-8,
-0.03422016650438309,
0.006063740700483322,
-0.08682763576507568,
-0.04015044495463371,
0.0782570019364357,
-0.00421522930264473,
-0.01949796825647354,
-0.04469109699130058,
0.024121996015310287,
0.0913647934794426,
-0.04398755356669426,
0.02639586292207241,
0.00009583705104887486,
-0.04246668517589569,
0.005171554163098335,
0.08175104111433029,
-0.056118302047252655,
0.013965429738163948,
-0.033717360347509384,
-0.052274711430072784,
-0.039159685373306274,
-0.025928787887096405,
-0.01799953356385231,
0.0857851579785347,
-0.04073057696223259,
0.020210761576890945,
0.0455654039978981,
0.04817298799753189,
-0.042414721101522446,
-0.05569474771618843,
-0.1300169825553894,
-0.023486824706196785,
0.024819718673825264,
-0.007553392555564642,
-0.030187565833330154,
0.03235812112689018,
-0.07149544358253479,
-0.029878096655011177,
0.07403374463319778,
-0.025054320693016052,
0.07652949541807175,
0.0753229483962059,
0.015720529481768608,
0.0736062228679657,
0.05255462974309921,
0.047508835792541504,
0.06544847041368484,
0.023975856602191925,
-0.032781314104795456,
-0.0237539354711771,
0.027630768716335297,
-0.016614828258752823,
-0.04734257608652115,
0.02207127958536148,
-0.05195470154285431,
0.04925824701786041,
-0.02313826233148575,
-0.09697264432907104,
-0.037623144686222076,
-0.06922087073326111,
0.11821797490119934,
-0.004133789800107479,
0.08999080955982208,
-0.04695804789662361
] | 0.06594 |
chunk; }); req.on('end', () => { console.log(`\n${data}`); client.close(); }); req.end(); ``` ### Class: `Http2Session` \* Extends: {EventEmitter} Instances of the `http2.Http2Session` class represent an active communications session between an HTTP/2 client and server. Instances of this class are \_not\_ intended to be constructed directly by user code. Each `Http2Session` instance will exhibit slightly different behaviors depending on whether it is operating as a server or a client. The `http2session.type` property can be used to determine the mode in which an `Http2Session` is operating. On the server side, user code should rarely have occasion to work with the `Http2Session` object directly, with most actions typically taken through interactions with either the `Http2Server` or `Http2Stream` objects. User code will not create `Http2Session` instances directly. Server-side `Http2Session` instances are created by the `Http2Server` instance when a new HTTP/2 connection is received. Client-side `Http2Session` instances are created using the `http2.connect()` method. #### `Http2Session` and sockets Every `Http2Session` instance is associated with exactly one [`net.Socket`][] or [`tls.TLSSocket`][] when it is created. When either the `Socket` or the `Http2Session` are destroyed, both will be destroyed. Because of the specific serialization and processing requirements imposed by the HTTP/2 protocol, it is not recommended for user code to read data from or write data to a `Socket` instance bound to a `Http2Session`. Doing so can put the HTTP/2 session into an indeterminate state causing the session and the socket to become unusable. Once a `Socket` has been bound to an `Http2Session`, user code should rely solely on the API of the `Http2Session`. #### Event: `'close'` The `'close'` event is emitted once the `Http2Session` has been destroyed. Its listener does not expect any arguments. #### Event: `'connect'` \* `session` {Http2Session} \* `socket` {net.Socket} The `'connect'` event is emitted once the `Http2Session` has been successfully connected to the remote peer and communication may begin. User code will typically not listen for this event directly. #### Event: `'error'` \* `error` {Error} The `'error'` event is emitted when an error occurs during the processing of an `Http2Session`. #### Event: `'frameError'` \* `type` {integer} The frame type. \* `code` {integer} The error code. \* `id` {integer} The stream id (or `0` if the frame isn't associated with a stream). The `'frameError'` event is emitted when an error occurs while attempting to send a frame on the session. If the frame that could not be sent is associated with a specific `Http2Stream`, an attempt to emit a `'frameError'` event on the `Http2Stream` is made. If the `'frameError'` event is associated with a stream, the stream will be closed and destroyed immediately following the `'frameError'` event. If the event is not associated with a stream, the `Http2Session` will be shut down immediately following the `'frameError'` event. #### Event: `'goaway'` \* `errorCode` {number} The HTTP/2 error code specified in the `GOAWAY` frame. \* `lastStreamID` {number} The ID of the last stream the remote peer successfully processed (or `0` if no ID is specified). \* `opaqueData` {Buffer} If additional opaque data was included in the `GOAWAY` frame, a `Buffer` instance will be passed containing that data. The `'goaway'` event is emitted when a `GOAWAY` frame is received. The `Http2Session` instance will be shut down automatically when the `'goaway'` event is emitted. #### Event: `'localSettings'` \* `settings` {HTTP/2 Settings Object} A copy of the `SETTINGS` frame received. The `'localSettings'` event is emitted when an acknowledgment `SETTINGS` frame has been received. When using `http2session.settings()` to submit new settings, the modified settings do not take effect until the `'localSettings'` event is emitted. ```js session.settings({ enablePush: false }); session.on('localSettings', (settings) => { /\* Use the new settings \*/ }); ``` #### | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.01241982914507389,
0.062270957976579666,
0.0261386651545763,
0.029420562088489532,
0.011849269270896912,
-0.10128521919250488,
0.03754773736000061,
0.005225066095590591,
0.10622692853212357,
0.002789901802316308,
0.006337076425552368,
0.04562337324023247,
-0.0744740441441536,
-0.030240634456276894,
0.1285930722951889,
0.03849150985479355,
0.0006316646467894316,
-0.08040019124746323,
-0.05458065867424011,
-0.03530830517411232,
0.10198820382356644,
-0.033626899123191833,
-0.06484571099281311,
-0.011873469687998295,
-0.08403745293617249,
0.05288492143154144,
-0.04086146503686905,
-0.029203210026025772,
0.09454890340566635,
0.030945472419261932,
0.03620661422610283,
-0.04995286837220192,
-0.18798384070396423,
-0.028761515393853188,
-0.04195514693856239,
0.07280934602022171,
0.05924048274755478,
-0.019036244601011276,
-0.03865835815668106,
-0.0018438517581671476,
0.07021962106227875,
0.022258292883634567,
-0.04466865956783295,
0.0097986850887537,
-0.018224302679300308,
-0.0314163938164711,
-0.07800131291151047,
0.016892507672309875,
-0.11863665282726288,
-0.06306526809930801,
-0.0094623863697052,
0.014497057534754276,
-0.03767489641904831,
0.08470937609672546,
0.03537764772772789,
0.0015784972347319126,
-0.08003268390893936,
0.0820639431476593,
-0.03433728590607643,
0.047214921563863754,
-0.022033216431736946,
-0.01993507705628872,
-0.026031842455267906,
0.004709445405751467,
0.04871908202767372,
-0.06606495380401611,
0.03030424378812313,
-0.009462714195251465,
0.008264788426458836,
0.0022884923964738846,
-0.05481826886534691,
-0.029865480959415436,
-0.09740542620420456,
-0.005597550421953201,
0.03694487735629082,
-0.09329817444086075,
-0.06456867605447769,
0.028229225426912308,
-0.024610016494989395,
-0.03918161615729332,
0.015113774687051773,
-0.10994130373001099,
0.021958546712994576,
0.02776886522769928,
0.014328131452202797,
0.01603231392800808,
0.003715301165357232,
0.02165190689265728,
0.04461235925555229,
0.060418274253606796,
-0.09488043189048767,
0.03615010529756546,
0.057112134993076324,
0.07739091664552689,
-0.023268572986125946,
0.0698632076382637,
0.008782059885561466,
0.025072932243347168,
0.005894610658288002,
0.07178238779306412,
0.0021487849298864603,
0.054664496332407,
0.028567956760525703,
0.04076948016881943,
0.012861969880759716,
-0.05500168353319168,
-0.08419392257928848,
0.034672338515520096,
0.06593790650367737,
-0.03818410262465477,
0.008064358495175838,
-0.00021486106561496854,
-0.016925713047385216,
-0.03147615119814873,
0.031985748559236526,
0.060601234436035156,
0.018324602395296097,
0.04617752134799957,
-0.030087992548942566,
0.09156401455402374,
0.0988062247633934,
-0.03705989941954613,
-0.012111282907426357,
-0.010879243724048138,
0.046545907855033875,
-0.028438782319426537,
0.04924866557121277,
4.2689910386614684e-33,
0.03532632440328598,
-0.0843774825334549,
-0.0673941969871521,
0.0810108333826065,
0.046673621982336044,
0.10937231034040451,
-0.037380535155534744,
0.05385216698050499,
-0.0120295574888587,
0.03193218261003494,
0.026072340086102486,
-0.04281098023056984,
0.016280900686979294,
0.01640484482049942,
0.09699631482362747,
0.0105940792709589,
0.0556708462536335,
-0.004479304421693087,
0.05218145623803139,
0.05009125545620918,
-0.031224636361002922,
0.05724594369530678,
0.01041228137910366,
0.08881033211946487,
0.02009706012904644,
0.010338515974581242,
-0.011173542588949203,
0.005925379227846861,
-0.06198926270008087,
0.004853496327996254,
0.08774980157613754,
-0.06297080963850021,
-0.02591661363840103,
0.011570043861865997,
0.036487381905317307,
0.004113350063562393,
0.025829864665865898,
-0.023873521015048027,
-0.06303928047418594,
-0.09774933010339737,
0.03906077891588211,
0.021499209105968475,
-0.06520328670740128,
0.028585856780409813,
-0.09525017440319061,
-0.19581085443496704,
-0.06642572581768036,
0.00977423693984747,
0.007206022273749113,
-0.00941332709044218,
-0.037758536636829376,
0.07375725358724594,
0.14309819042682648,
0.01189117506146431,
0.02755804918706417,
0.026253337040543556,
-0.00219295104034245,
0.06279278546571732,
-0.03245987743139267,
0.032591670751571655,
0.01128503680229187,
-0.06279430538415909,
0.01954507641494274,
-0.01603432185947895,
-0.053695760667324066,
0.0020892093889415264,
-0.05646444112062454,
-0.013909339904785156,
0.06142139434814453,
0.018186675384640694,
-0.012361613102257252,
0.06955154985189438,
0.007160053122788668,
0.030844734981656075,
0.03862862288951874,
-0.01956571266055107,
-0.04861976206302643,
0.01709682308137417,
0.04172227904200554,
0.0065050311386585236,
0.06882437318563461,
-0.02125551365315914,
0.058505624532699585,
0.05941751226782799,
-0.1244010180234909,
-0.009879713878035545,
-0.021446367725729942,
-0.049622491002082825,
0.01986987330019474,
0.06287907063961029,
-0.02859583869576454,
-0.016492201015353203,
0.011317149735987186,
-0.014290615916252136,
-0.00821756012737751,
-6.149993956302261e-33,
-0.02429753728210926,
0.018594326451420784,
-0.12134920805692673,
0.006727762054651976,
-0.018017413094639778,
0.0008578223641961813,
-0.016598138958215714,
0.0219669658690691,
-0.10502537339925766,
-0.022170238196849823,
0.08662622421979904,
0.05501733720302582,
-0.0006643296801485121,
0.03813701868057251,
-0.023571530357003212,
0.04253668710589409,
-0.043544843792915344,
-0.08193989843130112,
0.04947986081242561,
-0.05463401600718498,
-0.035729728639125824,
-0.0061288331635296345,
0.07657171040773392,
0.03670642524957657,
-0.020505141466856003,
-0.013087456114590168,
-0.02618960104882717,
-0.02314668893814087,
-0.030287543311715126,
-0.058264657855033875,
0.005704463925212622,
-0.0296018049120903,
-0.018148742616176605,
0.03055073320865631,
-0.02359769120812416,
-0.04349922761321068,
0.020464345812797546,
0.07507432997226715,
0.002667524851858616,
-0.06442900747060776,
0.11436393857002258,
0.024757560342550278,
-0.018641550093889236,
0.04620061069726944,
0.002311206888407469,
-0.031014099717140198,
-0.017662568017840385,
0.05394071713089943,
-0.010667900554835796,
-0.01918306201696396,
-0.04013584554195404,
-0.03273360803723335,
0.031613271683454514,
0.09497441351413727,
-0.0191215667873621,
-0.026467200368642807,
0.005872001405805349,
-0.00885061826556921,
-0.0350295826792717,
0.004731062799692154,
0.0028426654171198606,
-0.09897682070732117,
-0.021017208695411682,
0.05215700343251228,
-0.02563079446554184,
-0.09650542587041855,
-0.06714065372943878,
-0.021435488015413284,
0.05260505527257919,
-0.04737905412912369,
-0.008208914659917355,
-0.04629168659448624,
-0.06780926883220673,
-0.025201085954904556,
-0.010414251126348972,
0.010391661897301674,
0.021227840334177017,
-0.14183422923088074,
0.032509442418813705,
0.028741423040628433,
-0.08034037053585052,
0.011462193913757801,
-0.03982788696885109,
-0.0535922572016716,
0.03532615303993225,
-0.07905489206314087,
-0.03824591264128685,
0.030491482466459274,
-0.07745577394962311,
-0.0235773716121912,
0.010293987579643726,
0.10284411162137985,
-0.12895412743091583,
0.008804175071418285,
0.022030409425497055,
-5.550323223246778e-8,
-0.03829845041036606,
-0.05681274086236954,
0.025082619860768318,
0.017791355028748512,
0.06057785823941231,
0.004287533462047577,
-0.01827952079474926,
0.03600030019879341,
0.02809465490281582,
0.026881642639636993,
-0.024103695526719093,
-0.022365178912878036,
0.034453392028808594,
-0.052240777760744095,
0.043479010462760925,
0.030725346878170967,
0.06520627439022064,
-0.024618206545710564,
-0.031249793246388435,
0.011088727973401546,
-0.027206730097532272,
-0.09761131554841995,
0.0003844912862405181,
0.0025521591305732727,
-0.04530817270278931,
-0.01103766355663538,
0.00765314931049943,
0.0799756869673729,
-0.05313397943973541,
-0.06495258212089539,
-0.03898142650723457,
0.05148990452289581,
0.06308325380086899,
-0.005506201181560755,
-0.06919550150632858,
0.07436352223157883,
-0.047622401267290115,
-0.014012180268764496,
0.019598646089434624,
-0.01662382297217846,
0.10964591056108475,
-0.02290540188550949,
0.006334709003567696,
0.07687323540449142,
0.09869803488254547,
0.0055668237619102,
0.0701620802283287,
0.06841222941875458,
0.026494450867176056,
-0.036634065210819244,
-0.02389836497604847,
-0.01981324329972267,
-0.025677692145109177,
-0.03229745477437973,
-0.05862007662653923,
0.00526321679353714,
0.03289693593978882,
0.012131530791521072,
0.020717164501547813,
-0.008252650499343872,
0.03613657131791115,
0.03729318082332611,
-0.03769395500421524,
-0.07406390458345413
] | 0.064278 |
`'localSettings'` event is emitted when an acknowledgment `SETTINGS` frame has been received. When using `http2session.settings()` to submit new settings, the modified settings do not take effect until the `'localSettings'` event is emitted. ```js session.settings({ enablePush: false }); session.on('localSettings', (settings) => { /\* Use the new settings \*/ }); ``` #### Event: `'ping'` \* `payload` {Buffer} The `PING` frame 8-byte payload The `'ping'` event is emitted whenever a `PING` frame is received from the connected peer. #### Event: `'remoteSettings'` \* `settings` {HTTP/2 Settings Object} A copy of the `SETTINGS` frame received. The `'remoteSettings'` event is emitted when a new `SETTINGS` frame is received from the connected peer. ```js session.on('remoteSettings', (settings) => { /\* Use the new settings \*/ }); ``` #### Event: `'stream'` \* `stream` {Http2Stream} A reference to the stream \* `headers` {HTTP/2 Headers Object} An object describing the headers \* `flags` {number} The associated numeric flags \* `rawHeaders` {HTTP/2 Raw Headers} An array containing the raw headers The `'stream'` event is emitted when a new `Http2Stream` is created. ```js session.on('stream', (stream, headers, flags) => { const method = headers[':method']; const path = headers[':path']; // ... stream.respond({ ':status': 200, 'content-type': 'text/plain; charset=utf-8', }); stream.write('hello '); stream.end('world'); }); ``` On the server side, user code will typically not listen for this event directly, and would instead register a handler for the `'stream'` event emitted by the `net.Server` or `tls.Server` instances returned by `http2.createServer()` and `http2.createSecureServer()`, respectively, as in the example below: ```mjs import { createServer } from 'node:http2'; // Create an unencrypted HTTP/2 server const server = createServer(); server.on('stream', (stream, headers) => { stream.respond({ 'content-type': 'text/html; charset=utf-8', ':status': 200, }); stream.on('error', (error) => console.error(error)); stream.end(' # Hello World '); }); server.listen(8000); ``` ```cjs const http2 = require('node:http2'); // Create an unencrypted HTTP/2 server const server = http2.createServer(); server.on('stream', (stream, headers) => { stream.respond({ 'content-type': 'text/html; charset=utf-8', ':status': 200, }); stream.on('error', (error) => console.error(error)); stream.end(' # Hello World '); }); server.listen(8000); ``` Even though HTTP/2 streams and network sockets are not in a 1:1 correspondence, a network error will destroy each individual stream and must be handled on the stream level, as shown above. #### Event: `'timeout'` After the `http2session.setTimeout()` method is used to set the timeout period for this `Http2Session`, the `'timeout'` event is emitted if there is no activity on the `Http2Session` after the configured number of milliseconds. Its listener does not expect any arguments. ```js session.setTimeout(2000); session.on('timeout', () => { /\* .. \*/ }); ``` #### `http2session.alpnProtocol` \* Type: {string|undefined} Value will be `undefined` if the `Http2Session` is not yet connected to a socket, `h2c` if the `Http2Session` is not connected to a `TLSSocket`, or will return the value of the connected `TLSSocket`'s own `alpnProtocol` property. #### `http2session.close([callback])` \* `callback` {Function} Gracefully closes the `Http2Session`, allowing any existing streams to complete on their own and preventing new `Http2Stream` instances from being created. Once closed, `http2session.destroy()` \_might\_ be called if there are no open `Http2Stream` instances. If specified, the `callback` function is registered as a handler for the `'close'` event. #### `http2session.closed` \* Type: {boolean} Will be `true` if this `Http2Session` instance has been closed, otherwise `false`. #### `http2session.connecting` \* Type: {boolean} Will be `true` if this `Http2Session` instance is still connecting, will be set to `false` before emitting `connect` event and/or calling the `http2.connect` callback. #### `http2session.destroy([error][, code])` \* `error` {Error} An `Error` object if the `Http2Session` is being destroyed due to an error. \* `code` {number} The HTTP/2 error code to send in the final `GOAWAY` frame. If unspecified, and `error` is not undefined, the default is `INTERNAL\_ERROR`, otherwise defaults to `NO\_ERROR`. Immediately terminates the `Http2Session` and the | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
0.019763663411140442,
-0.003248833818361163,
0.006551716011017561,
0.07824087888002396,
-0.00034554090234450996,
-0.035087741911411285,
0.030468443408608437,
-0.0036999217700213194,
0.0466570183634758,
0.04059918224811554,
0.024470211938023567,
-0.0011364066740497947,
-0.03324833884835243,
0.014806919731199741,
0.04157974570989609,
-0.0012456440599635243,
0.015472756698727608,
-0.09038339555263519,
-0.09142739325761795,
-0.07757419347763062,
-0.030876781791448593,
-0.09953179955482483,
0.041303277015686035,
-0.022780293598771095,
0.062056317925453186,
0.03221611678600311,
-0.01517622172832489,
-0.01778084598481655,
0.01762697473168373,
0.03537065163254738,
-0.030393393710255623,
-0.020261399447917938,
-0.11231597512960434,
-0.058643635362386703,
0.004909499082714319,
0.030165690928697586,
0.062131136655807495,
-0.013747072778642178,
-0.012794578447937965,
-0.026804160326719284,
0.022288529202342033,
-0.01720987632870674,
0.014702318236231804,
-0.026157287880778313,
-0.05797359347343445,
0.04950164258480072,
-0.01405141968280077,
0.023110155016183853,
-0.10391481965780258,
-0.014712836593389511,
0.04332617670297623,
0.04999899864196777,
-0.007149804383516312,
0.027936464175581932,
0.002241207752376795,
0.06848543882369995,
-0.017399057745933533,
0.14167380332946777,
0.03647725656628609,
-0.039804473519325256,
-0.1058679074048996,
-0.06524975597858429,
-0.012196539901196957,
0.06704957783222198,
-0.011583561077713966,
0.0010976437479257584,
0.0042663319036364555,
-0.012715557590126991,
0.004913985729217529,
0.041400909423828125,
-0.016437426209449768,
0.12781737744808197,
-0.013623053207993507,
-0.0165092796087265,
0.04713378846645355,
-0.044959910213947296,
-0.07218677550554276,
0.023139948025345802,
-0.05020502209663391,
-0.031467754393815994,
0.03882454335689545,
-0.07189662009477615,
-0.02713640220463276,
0.008597285486757755,
-0.016853535547852516,
-0.023989474400877953,
0.009095974266529083,
-0.00221068412065506,
0.05431954935193062,
0.04125557839870453,
-0.06410685181617737,
-0.003754166653379798,
0.0022558411583304405,
0.04878230020403862,
-0.08132985979318619,
0.014984575100243092,
0.025953413918614388,
0.038189955055713654,
-0.02112913876771927,
0.0034628319554030895,
0.04642501473426819,
-0.0430905818939209,
0.011890470050275326,
0.10389270633459091,
0.07596904784440994,
-0.049896642565727234,
-0.0855129212141037,
0.035721343010663986,
0.06498202681541443,
0.08025140315294266,
0.006678573787212372,
0.03170724958181381,
0.03130713105201721,
0.01620566099882126,
0.0010058985790237784,
0.08307241648435593,
0.08093733340501785,
0.02711614780128002,
0.045960355550050735,
0.0194393303245306,
0.07542479038238525,
-0.06939628720283508,
-0.022529494017362595,
-0.05982236936688423,
0.014279607683420181,
0.03743009269237518,
0.04517650976777077,
1.581546282781792e-33,
0.008731271140277386,
-0.053796328604221344,
-0.07876350730657578,
0.02322361245751381,
0.025949496775865555,
0.041887734085321426,
0.009066076949238777,
0.05002765730023384,
-0.009415038861334324,
-0.06580252945423126,
-0.025225456804037094,
0.0036628996022045612,
0.04231337457895279,
0.02284170314669609,
0.04891412705183029,
0.025285247713327408,
0.0712941586971283,
0.012255984358489513,
0.10637716203927994,
0.06688616424798965,
0.005143029615283012,
0.018209954723715782,
0.028740357607603073,
-0.011141468770802021,
0.008237148635089397,
0.011408928781747818,
0.04608391970396042,
0.0622955746948719,
-0.1270434707403183,
-0.007533733732998371,
0.0453488752245903,
0.026478908956050873,
0.008588527329266071,
0.0001051640065270476,
0.04822773486375809,
0.0047362023033201694,
-0.0007415519212372601,
-0.02398459054529667,
-0.010743848979473114,
-0.01624145917594433,
0.056313976645469666,
-0.04697990044951439,
-0.12223542481660843,
-0.009400970302522182,
-0.0755804181098938,
-0.10149811953306198,
-0.05747346207499504,
-0.027773702517151833,
0.02992597036063671,
0.01914256624877453,
-0.10303477942943573,
0.05156169459223747,
0.05668456479907036,
-0.014355546794831753,
0.05283574014902115,
0.006422554142773151,
-0.012901077046990395,
-0.06897667050361633,
-0.05152945965528488,
-0.04112214595079422,
0.05834498628973961,
-0.04951141029596329,
0.02845842018723488,
-0.04986339434981346,
0.04157726466655731,
0.04204317554831505,
0.009253422729671001,
-0.01144364196807146,
-0.00679712975397706,
-0.05826583877205849,
-0.04776648432016373,
0.07403966784477234,
0.06686665862798691,
0.04928550124168396,
-0.042325668036937714,
-0.02313802018761635,
-0.03720581904053688,
0.08753738552331924,
-0.03646024316549301,
0.0005364871467463672,
0.08129619807004929,
-0.0048215752467513084,
-0.06307289004325867,
0.08009868115186691,
0.01804037019610405,
-0.0416506864130497,
-0.007175249978899956,
0.02781730145215988,
-0.09163804352283478,
0.09532956779003143,
0.05503067001700401,
-0.01368698664009571,
0.024594873189926147,
0.0392267107963562,
-0.09851351380348206,
-3.655375640692542e-33,
0.018607892096042633,
0.007056120317429304,
-0.09280387312173843,
0.08095424622297287,
-0.0015164195792749524,
0.001849278574809432,
0.03067057579755783,
0.06469181180000305,
-0.027017829939723015,
-0.03846951574087143,
-0.004118070006370544,
0.008478017523884773,
-0.04636983573436737,
-0.025433829054236412,
-0.06323542445898056,
0.07679715752601624,
-0.022913863882422447,
-0.013741831295192242,
0.10077767819166183,
-0.07719184458255768,
0.0008333027362823486,
-0.02983943745493889,
-0.019523270428180695,
0.07115249335765839,
0.025824779644608498,
-0.07760456204414368,
-0.02380448952317238,
-0.04103968292474747,
-0.12895163893699646,
-0.04608708620071411,
-0.026148352771997452,
0.06021612137556076,
-0.09076069295406342,
0.0453505776822567,
-0.01106623001396656,
-0.060362428426742554,
0.039159808307886124,
0.03800324723124504,
-0.04333506524562836,
0.01802181452512741,
0.05205217003822327,
0.03835497051477432,
-0.08505535870790482,
0.06361113488674164,
0.0229769516736269,
0.08528472483158112,
0.0015518020372837782,
0.02428012154996395,
-0.09846614301204681,
0.03643672913312912,
0.0380496084690094,
-0.09415195882320404,
0.050118234008550644,
0.05431829020380974,
0.00022104136587586254,
0.018584707751870155,
-0.019711079075932503,
-0.04131130874156952,
0.05001421645283699,
-0.020247293636202812,
0.04731537401676178,
-0.1341371387243271,
-0.06596439331769943,
0.057670872658491135,
-0.0067479913122951984,
0.061773817986249924,
-0.009363015182316303,
0.08615834265947342,
0.07758722454309464,
0.02194962464272976,
0.010333498008549213,
-0.13708430528640747,
-0.005921734031289816,
-0.07021941244602203,
0.00301827653311193,
0.016697119921445847,
0.013038361445069313,
-0.13361431658267975,
-0.05071825534105301,
0.03779350221157074,
-0.07750944048166275,
0.007822254672646523,
-0.043921999633312225,
-0.07321636378765106,
0.08065846562385559,
0.05460667237639427,
-0.037289492785930634,
0.12209929525852203,
-0.04975546523928642,
0.021528717130422592,
-0.05785413086414337,
0.05674401670694351,
-0.0884493738412857,
-0.02414063550531864,
0.0019183096010237932,
-4.5025746686633283e-8,
-0.013279270380735397,
0.00319612305611372,
-0.11941294372081757,
-0.006439218297600746,
-0.00991772674024105,
0.0415123887360096,
0.016150733456015587,
0.010771714150905609,
-0.015258587896823883,
-0.0662991926074028,
-0.03844798356294632,
0.019458292052149773,
0.06427717953920364,
-0.01212697196751833,
-0.02538081258535385,
-0.01917225681245327,
-0.009269822388887405,
0.01235586404800415,
-0.035959742963314056,
-0.03182853013277054,
0.05956616997718811,
-0.030773518607020378,
0.016802098602056503,
0.04910790175199509,
0.004773580469191074,
-0.019687656313180923,
0.03736640885472298,
0.04463754594326019,
-0.036737315356731415,
0.009034886956214905,
-0.11112317442893982,
-0.017611555755138397,
0.04647619649767876,
-0.039250101894140244,
-0.06139175221323967,
0.061418309807777405,
-0.0608295202255249,
-0.07634442299604416,
0.06324878334999084,
-0.07477093487977982,
0.04459693282842636,
-0.032799020409584045,
-0.05122235789895058,
0.04488324001431465,
0.011420058086514473,
0.0037061315961182117,
0.07777827233076096,
0.0729617029428482,
0.022883402183651924,
-0.05411621555685997,
0.0000012193678458061186,
0.028588267043232918,
-0.021303590387105942,
-0.02195367030799389,
0.09564482420682907,
-0.03774191811680794,
0.022260740399360657,
-0.05137644335627556,
0.08298799395561218,
-0.017880376428365707,
-0.020639460533857346,
0.03687140345573425,
-0.07610531896352768,
-0.08136049658060074
] | 0.015738 |
`error` {Error} An `Error` object if the `Http2Session` is being destroyed due to an error. \* `code` {number} The HTTP/2 error code to send in the final `GOAWAY` frame. If unspecified, and `error` is not undefined, the default is `INTERNAL\_ERROR`, otherwise defaults to `NO\_ERROR`. Immediately terminates the `Http2Session` and the associated `net.Socket` or `tls.TLSSocket`. Once destroyed, the `Http2Session` will emit the `'close'` event. If `error` is not undefined, an `'error'` event will be emitted immediately before the `'close'` event. If there are any remaining open `Http2Streams` associated with the `Http2Session`, those will also be destroyed. #### `http2session.destroyed` \* Type: {boolean} Will be `true` if this `Http2Session` instance has been destroyed and must no longer be used, otherwise `false`. #### `http2session.encrypted` \* Type: {boolean|undefined} Value is `undefined` if the `Http2Session` session socket has not yet been connected, `true` if the `Http2Session` is connected with a `TLSSocket`, and `false` if the `Http2Session` is connected to any other kind of socket or stream. #### `http2session.goaway([code[, lastStreamID[, opaqueData]]])` \* `code` {number} An HTTP/2 error code \* `lastStreamID` {number} The numeric ID of the last processed `Http2Stream` \* `opaqueData` {Buffer|TypedArray|DataView} A `TypedArray` or `DataView` instance containing additional data to be carried within the `GOAWAY` frame. Transmits a `GOAWAY` frame to the connected peer \_without\_ shutting down the `Http2Session`. #### `http2session.localSettings` \* Type: {HTTP/2 Settings Object} A prototype-less object describing the current local settings of this `Http2Session`. The local settings are local to \_this\_ `Http2Session` instance. #### `http2session.originSet` \* Type: {string\[]|undefined} If the `Http2Session` is connected to a `TLSSocket`, the `originSet` property will return an `Array` of origins for which the `Http2Session` may be considered authoritative. The `originSet` property is only available when using a secure TLS connection. #### `http2session.pendingSettingsAck` \* Type: {boolean} Indicates whether the `Http2Session` is currently waiting for acknowledgment of a sent `SETTINGS` frame. Will be `true` after calling the `http2session.settings()` method. Will be `false` once all sent `SETTINGS` frames have been acknowledged. #### `http2session.ping([payload, ]callback)` \* `payload` {Buffer|TypedArray|DataView} Optional ping payload. \* `callback` {Function} \* Returns: {boolean} Sends a `PING` frame to the connected HTTP/2 peer. A `callback` function must be provided. The method will return `true` if the `PING` was sent, `false` otherwise. The maximum number of outstanding (unacknowledged) pings is determined by the `maxOutstandingPings` configuration option. The default maximum is 10. If provided, the `payload` must be a `Buffer`, `TypedArray`, or `DataView` containing 8 bytes of data that will be transmitted with the `PING` and returned with the ping acknowledgment. The callback will be invoked with three arguments: an error argument that will be `null` if the `PING` was successfully acknowledged, a `duration` argument that reports the number of milliseconds elapsed since the ping was sent and the acknowledgment was received, and a `Buffer` containing the 8-byte `PING` payload. ```js session.ping(Buffer.from('abcdefgh'), (err, duration, payload) => { if (!err) { console.log(`Ping acknowledged in ${duration} milliseconds`); console.log(`With payload '${payload.toString()}'`); } }); ``` If the `payload` argument is not specified, the default payload will be the 64-bit timestamp (little endian) marking the start of the `PING` duration. #### `http2session.ref()` Calls [`ref()`][`net.Socket.prototype.ref()`] on this `Http2Session` instance's underlying [`net.Socket`][]. #### `http2session.remoteSettings` \* Type: {HTTP/2 Settings Object} A prototype-less object describing the current remote settings of this `Http2Session`. The remote settings are set by the \_connected\_ HTTP/2 peer. #### `http2session.setLocalWindowSize(windowSize)` \* `windowSize` {number} Sets the local endpoint's window size. The `windowSize` is the total window size to set, not the delta. ```mjs import { createServer } from 'node:http2'; const server = createServer(); const expectedWindowSize = 2 \*\* 20; server.on('session', (session) => { // Set local window size to be 2 \*\* 20 session.setLocalWindowSize(expectedWindowSize); }); ``` ```cjs | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.044495563954114914,
0.00267549860291183,
-0.012945596128702164,
0.006452402099967003,
0.03160630166530609,
-0.0788455531001091,
0.014287148602306843,
-0.02081950753927231,
0.1204010397195816,
0.021073319017887115,
-0.00500117614865303,
0.026813708245754242,
0.0132822934538126,
0.05105902999639511,
0.012244706973433495,
0.025751754641532898,
-0.018251094967126846,
-0.04534556716680527,
-0.049690742045640945,
-0.04209768772125244,
0.07020723819732666,
0.032864440232515335,
-0.035645194351673126,
0.05159907415509224,
-0.0630933940410614,
0.056428808718919754,
-0.039774179458618164,
-0.07621872425079346,
-0.006898852065205574,
0.037648241966962814,
0.007124331779778004,
-0.08383069187402725,
-0.1496308445930481,
-0.019234569743275642,
-0.001165652764029801,
0.01647970825433731,
0.02866407297551632,
-0.03652705252170563,
-0.0109096085652709,
-0.03568222001194954,
0.04827122762799263,
-0.006853565573692322,
-0.09076978266239166,
0.02761857956647873,
-0.04680034890770912,
0.01551181823015213,
-0.030389025807380676,
-0.007248716428875923,
-0.10022042691707611,
-0.04418404772877693,
-0.028950663283467293,
0.03343065455555916,
-0.031206583604216576,
0.08578436076641083,
0.07770267128944397,
-0.05480559915304184,
-0.07123565673828125,
0.04948767274618149,
-0.07277598977088928,
0.09305182099342346,
0.01841181516647339,
0.025708142668008804,
-0.015391930937767029,
0.032883547246456146,
0.05961711332201958,
0.0034219801891595125,
0.023803867399692535,
-0.01845649629831314,
0.04038139805197716,
0.0926053524017334,
-0.09277880936861038,
0.008204750716686249,
-0.08541880548000336,
0.024230485782027245,
0.017882315441966057,
-0.020044399425387383,
-0.0324297770857811,
-0.04052635282278061,
-0.09424523264169693,
-0.018610475584864616,
-0.007689539343118668,
-0.16641269624233246,
-0.02247343584895134,
-0.0033827857114374638,
0.04559144377708435,
0.04261898621916771,
0.01630358211696148,
0.006618432700634003,
0.06397493183612823,
0.07009207457304001,
-0.04053870588541031,
0.04982297122478485,
0.08113806694746017,
0.11903928220272064,
0.040635671466588974,
0.026777537539601326,
-0.02996699884533882,
-0.000014998427104728762,
-0.06105797737836838,
0.004185877740383148,
-0.012455117888748646,
-0.0368240624666214,
-0.001590576721355319,
-0.0674050822854042,
0.007976201362907887,
-0.0069663324393332005,
-0.053347524255514145,
0.00861801952123642,
0.0878990888595581,
0.005471584852784872,
-0.009620820172131062,
0.0035263511817902327,
0.07573255151510239,
-0.009041505865752697,
-0.013104126788675785,
0.08058056980371475,
-0.0052987923845648766,
0.06792140752077103,
0.0016740683931857347,
0.04767758771777153,
0.046376101672649384,
-0.03290163353085518,
0.06902948766946793,
-0.009354914538562298,
-0.03873644024133682,
-0.07814746350049973,
0.06740758568048477,
1.18139450594395e-33,
-0.017419185489416122,
-0.059250228106975555,
-0.10999663174152374,
0.10006147623062134,
0.010404955595731735,
0.07613501697778702,
-0.02476448193192482,
0.013783465139567852,
0.007598559372127056,
-0.0017697657458484173,
0.02797074243426323,
-0.0932920053601265,
-0.016723357141017914,
-0.046637460589408875,
0.07802870869636536,
0.00680114608258009,
0.08186972886323929,
0.013822831213474274,
0.0996994599699974,
0.014438096433877945,
-0.009514532051980495,
0.021022779867053032,
0.0016374817350879312,
0.0026409432757645845,
0.022526590153574944,
0.03396805748343468,
0.028707299381494522,
0.0028227309230715036,
-0.07764069736003876,
0.008905948139727116,
0.01940694823861122,
-0.030150948092341423,
-0.02121063880622387,
0.020203210413455963,
0.09289683401584625,
-0.021544190123677254,
0.05359239503741264,
0.00769183412194252,
-0.05919749662280083,
-0.06124698743224144,
-0.01039691548794508,
0.01764398068189621,
-0.11537932604551315,
0.10810210555791855,
-0.008107964880764484,
-0.17816144227981567,
-0.02377653308212757,
0.05951009690761566,
0.055563271045684814,
-0.012336217798292637,
-0.037110380828380585,
-0.0051843877881765366,
0.08145952969789505,
-0.021058177575469017,
0.005418336950242519,
0.022303592413663864,
-0.0016738182166591287,
0.021389272063970566,
-0.0007557769422419369,
-0.017895447090268135,
0.03441181033849716,
-0.06512634456157684,
-0.05925590172410011,
-0.0996035560965538,
0.014724649488925934,
0.012010236270725727,
0.028355414047837257,
-0.00006349163595587015,
-0.06936732679605484,
-0.04750621318817139,
-0.039184361696243286,
0.016402022913098335,
0.08896563947200775,
0.07110448181629181,
-0.010230381973087788,
-0.022970275953412056,
0.010393156670033932,
0.021838346496224403,
0.06418376415967941,
-0.006793794687837362,
0.04274921491742134,
-0.05429138243198395,
0.05887773633003235,
0.056104179471731186,
-0.03251834958791733,
0.06451578438282013,
0.0024645172525197268,
-0.02563207969069481,
-0.09810861200094223,
0.10253357887268066,
0.02553483471274376,
-0.018786374479532242,
0.03600260987877846,
0.006585936993360519,
0.010716002434492111,
-3.885806328916296e-33,
-0.05372246727347374,
-0.0005659011076204479,
-0.1135532557964325,
0.044499389827251434,
-0.04574824497103691,
-0.059921178966760635,
0.0074393791146576405,
0.05369538813829422,
-0.04434138163924217,
-0.05077493190765381,
0.06671880185604095,
0.03377482667565346,
0.037948813289403915,
0.02185015380382538,
-0.03298458456993103,
-0.03406936675310135,
-0.015006973408162594,
-0.06788470596075058,
-0.043990325182676315,
-0.03675832226872444,
0.04454098269343376,
-0.006190052255988121,
0.013434662483632565,
-0.0032274192199110985,
-0.03759332746267319,
0.06622648984193802,
-0.016964532434940338,
0.01371681783348322,
-0.08748652786016464,
-0.04382467642426491,
0.11399862915277481,
-0.029268521815538406,
-0.00869907159358263,
0.09620979428291321,
-0.008766204118728638,
-0.035586852580308914,
0.05279918760061264,
-0.02271239459514618,
-0.01698729768395424,
-0.03760181739926338,
0.1247592642903328,
0.07728943973779678,
0.016055617481470108,
-0.0098934480920434,
0.031176483258605003,
-0.008016091771423817,
-0.004759298171848059,
0.027508974075317383,
-0.030456222593784332,
-0.031230667605996132,
-0.023331131786108017,
-0.010302367620170116,
-0.009446474723517895,
0.045530226081609726,
0.018689990043640137,
0.0717470794916153,
0.024129193276166916,
0.029619308188557625,
0.021916188299655914,
-0.01815936341881752,
0.015220537781715393,
-0.08492866158485413,
0.025591546669602394,
0.08717931061983109,
0.0029059273656457663,
0.0027543012984097004,
-0.06425635516643524,
0.06779387593269348,
0.10410990566015244,
0.008821575902402401,
0.025018250569701195,
0.007374643348157406,
-0.10056871920824051,
-0.03128580376505852,
0.002137861680239439,
0.00985963735729456,
0.028747644275426865,
-0.07295423746109009,
0.012836737558245659,
0.016052719205617905,
-0.06423761695623398,
0.032611578702926636,
-0.06602849066257477,
-0.06084232032299042,
0.050871044397354126,
-0.06875966489315033,
-0.023441514000296593,
0.04333535581827164,
-0.028024056926369667,
-0.025766758248209953,
-0.07457268238067627,
0.07076115906238556,
-0.07356034219264984,
0.011981615796685219,
0.03217095136642456,
-4.691645116849941e-8,
-0.08024551719427109,
0.013543382287025452,
-0.031454309821128845,
-0.0039697857573628426,
0.03253310173749924,
-0.03348461538553238,
-0.013080179691314697,
0.0010240081464871764,
0.03524074703454971,
-0.05806500092148781,
-0.040351688861846924,
0.00495392270386219,
-0.007058174815028906,
-0.02886611595749855,
-0.04213172569870949,
-0.027743104845285416,
-0.01907830312848091,
-0.05989019200205803,
0.0060360608622431755,
-0.09559162706136703,
0.04175563529133797,
-0.09366398304700851,
-0.008985576219856739,
0.04286247119307518,
-0.04823748767375946,
-0.04507140815258026,
0.04920376092195511,
0.09410984814167023,
-0.060551319271326065,
-0.02647758089005947,
-0.07861743867397308,
-0.03221040219068527,
0.08615345507860184,
0.029773693531751633,
-0.08612535893917084,
0.13115382194519043,
-0.08435846120119095,
-0.036358438432216644,
0.012183815240859985,
0.00023653135576751083,
0.09085893630981445,
0.011034836992621422,
0.0107037965208292,
0.09003312885761261,
0.06019194424152374,
0.021353594958782196,
0.0824018120765686,
0.0459597110748291,
-0.0007518246420659125,
-0.05340388044714928,
-0.007120419759303331,
0.03770939260721207,
-0.07765986770391464,
0.03181346505880356,
-0.05756590887904167,
-0.0340518057346344,
0.020021842792630196,
0.0018534749979153275,
-0.020806415006518364,
-0.010926352813839912,
0.07027900218963623,
0.01737620122730732,
-0.0173797607421875,
-0.08316890150308609
] | 0.094647 |
endpoint's window size. The `windowSize` is the total window size to set, not the delta. ```mjs import { createServer } from 'node:http2'; const server = createServer(); const expectedWindowSize = 2 \*\* 20; server.on('session', (session) => { // Set local window size to be 2 \*\* 20 session.setLocalWindowSize(expectedWindowSize); }); ``` ```cjs const http2 = require('node:http2'); const server = http2.createServer(); const expectedWindowSize = 2 \*\* 20; server.on('session', (session) => { // Set local window size to be 2 \*\* 20 session.setLocalWindowSize(expectedWindowSize); }); ``` For http2 clients the proper event is either `'connect'` or `'remoteSettings'`. #### `http2session.setTimeout(msecs, callback)` \* `msecs` {number} \* `callback` {Function} Used to set a callback function that is called when there is no activity on the `Http2Session` after `msecs` milliseconds. The given `callback` is registered as a listener on the `'timeout'` event. #### `http2session.socket` \* Type: {net.Socket|tls.TLSSocket} Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but limits available methods to ones safe to use with HTTP/2. `destroy`, `emit`, `end`, `pause`, `read`, `resume`, and `write` will throw an error with code `ERR\_HTTP2\_NO\_SOCKET\_MANIPULATION`. See [`Http2Session` and Sockets][] for more information. `setTimeout` method will be called on this `Http2Session`. All other interactions will be routed directly to the socket. #### `http2session.state` Provides miscellaneous information about the current state of the `Http2Session`. \* Type: {Object} \* `effectiveLocalWindowSize` {number} The current local (receive) flow control window size for the `Http2Session`. \* `effectiveRecvDataLength` {number} The current number of bytes that have been received since the last flow control `WINDOW\_UPDATE`. \* `nextStreamID` {number} The numeric identifier to be used the next time a new `Http2Stream` is created by this `Http2Session`. \* `localWindowSize` {number} The number of bytes that the remote peer can send without receiving a `WINDOW\_UPDATE`. \* `lastProcStreamID` {number} The numeric id of the `Http2Stream` for which a `HEADERS` or `DATA` frame was most recently received. \* `remoteWindowSize` {number} The number of bytes that this `Http2Session` may send without receiving a `WINDOW\_UPDATE`. \* `outboundQueueSize` {number} The number of frames currently within the outbound queue for this `Http2Session`. \* `deflateDynamicTableSize` {number} The current size in bytes of the outbound header compression state table. \* `inflateDynamicTableSize` {number} The current size in bytes of the inbound header compression state table. An object describing the current status of this `Http2Session`. #### `http2session.settings([settings][, callback])` \* `settings` {HTTP/2 Settings Object} \* `callback` {Function} Callback that is called once the session is connected or right away if the session is already connected. \* `err` {Error|null} \* `settings` {HTTP/2 Settings Object} The updated `settings` object. \* `duration` {integer} Updates the current local settings for this `Http2Session` and sends a new `SETTINGS` frame to the connected HTTP/2 peer. Once called, the `http2session.pendingSettingsAck` property will be `true` while the session is waiting for the remote peer to acknowledge the new settings. The new settings will not become effective until the `SETTINGS` acknowledgment is received and the `'localSettings'` event is emitted. It is possible to send multiple `SETTINGS` frames while acknowledgment is still pending. #### `http2session.type` \* Type: {number} The `http2session.type` will be equal to `http2.constants.NGHTTP2\_SESSION\_SERVER` if this `Http2Session` instance is a server, and `http2.constants.NGHTTP2\_SESSION\_CLIENT` if the instance is a client. #### `http2session.unref()` Calls [`unref()`][`net.Socket.prototype.unref()`] on this `Http2Session` instance's underlying [`net.Socket`][]. ### Class: `ServerHttp2Session` \* Extends: {Http2Session} #### `serverhttp2session.altsvc(alt, originOrStream)` \* `alt` {string} A description of the alternative service configuration as defined by [RFC 7838][]. \* `originOrStream` {number|string|URL|Object} Either a URL string specifying the origin (or an `Object` with an `origin` property) or the numeric identifier of an active `Http2Stream` as given by the `http2stream.id` property. Submits an `ALTSVC` frame (as defined by [RFC 7838][]) to the connected client. ```mjs import { createServer | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
0.04014739394187927,
0.04688799008727074,
0.025695761665701866,
0.006966819986701012,
-0.05451597273349762,
-0.04339925944805145,
-0.05588241294026375,
0.09298571199178696,
0.013388709165155888,
0.026055796071887016,
-0.03551366925239563,
-0.007223782129585743,
-0.062133971601724625,
-0.04292839393019676,
0.06548871845006943,
0.04418392479419708,
0.02833782695233822,
0.015676390379667282,
-0.02940075658261776,
-0.08128521591424942,
0.0291048064827919,
-0.11803773045539856,
0.025286482647061348,
-0.056975964456796646,
0.01790842041373253,
-0.004637614358216524,
-0.086460642516613,
0.012048942036926746,
0.08231541514396667,
-0.019099855795502663,
0.08495385199785233,
-0.023166371509432793,
-0.13851870596408844,
0.0030314114410430193,
0.008403956890106201,
-0.013973142951726913,
-0.03814509138464928,
-0.06289840489625931,
-0.019988123327493668,
-0.0547805055975914,
0.04680664464831352,
0.10840640962123871,
0.010321693494915962,
0.0009743369300849736,
-0.028228528797626495,
0.016145998612046242,
-0.09659861773252487,
0.06986343860626221,
-0.03247232362627983,
-0.03023315593600273,
-0.03160206228494644,
0.0020099340472370386,
-0.05133917182683945,
-0.035561736673116684,
-0.05733257904648781,
0.0025390631053596735,
-0.02867262437939644,
0.1076003685593605,
-0.004148463718593121,
0.077642060816288,
-0.02419540099799633,
-0.011979945003986359,
0.02318631298840046,
0.018993381410837173,
0.008866310119628906,
-0.015345553867518902,
-0.03198160231113434,
-0.00957933347672224,
-0.041172560304403305,
0.014257518574595451,
-0.05050084739923477,
-0.011997452937066555,
-0.06625062227249146,
0.006084401160478592,
-0.040288135409355164,
-0.13062523305416107,
-0.017715519294142723,
0.04461052641272545,
-0.012930351309478283,
0.0012368846219033003,
0.031059887260198593,
-0.04121936112642288,
-0.04289477318525314,
-0.010041615925729275,
-0.03268636763095856,
0.025103820487856865,
-0.03658267483115196,
0.025743499398231506,
0.02847112901508808,
0.013499032706022263,
-0.04313187673687935,
-0.014000686816871166,
-0.12141450494527817,
0.07957041263580322,
0.011903285048902035,
-0.005936586298048496,
-0.03287337347865105,
0.03187769651412964,
-0.02391427755355835,
0.0044434466399252415,
0.04656743258237839,
-0.03149984031915665,
0.09501053392887115,
0.06633909791707993,
0.01658911444246769,
-0.04858000576496124,
-0.03209296241402626,
0.060602378100156784,
0.07746127992868423,
-0.03450537845492363,
0.018811199814081192,
0.06791508942842484,
0.005235768388956785,
0.043429989367723465,
0.040507301688194275,
0.04835562780499458,
0.13570868968963623,
-0.007655235938727856,
0.046402908861637115,
0.049095407128334045,
0.05510436370968819,
-0.03594733402132988,
-0.05244921147823334,
-0.08486098796129227,
0.010743897408246994,
-0.03522627428174019,
0.13888974487781525,
5.580661267238733e-33,
-0.015194151550531387,
-0.09054481238126755,
-0.0332423560321331,
0.08616042137145996,
0.11978494375944138,
0.07851076871156693,
0.05509133264422417,
-0.01312047615647316,
-0.10163100063800812,
-0.04917381703853607,
-0.06032713130116463,
-0.009719992987811565,
0.0032593244686722755,
-0.04291185364127159,
0.05443268269300461,
-0.03987354412674904,
0.057407673448324203,
0.03894224017858505,
0.06323835253715515,
-0.003197076730430126,
0.028208065778017044,
0.0049357106909155846,
0.03953186422586441,
0.02858191542327404,
0.008405621163547039,
-0.07147549092769623,
-0.016745131462812424,
0.07848438620567322,
-0.07451999932527542,
-0.008561343885958195,
0.0030815701466053724,
0.05167178437113762,
-0.013132793828845024,
-0.02878539264202118,
0.05294092372059822,
-0.0578824020922184,
-0.0005938657559454441,
0.01882484182715416,
-0.023980241268873215,
-0.1083834320306778,
-0.026743415743112564,
0.06899948418140411,
-0.006189317442476749,
0.026572778820991516,
-0.11814896762371063,
-0.12808451056480408,
-0.05998736247420311,
-0.023089691996574402,
0.008325542323291302,
-0.01675388216972351,
-0.03195315971970558,
0.05259985104203224,
0.01638903096318245,
0.020386813208460808,
0.04276216775178909,
0.03182193264365196,
0.04617127403616905,
0.05804099887609482,
-0.028852473944425583,
0.010248386301100254,
-0.03201409429311752,
-0.033890027552843094,
-0.058460332453250885,
0.0249008908867836,
0.026565764099359512,
0.007927480153739452,
-0.04868917912244797,
0.0594392828643322,
-0.025209564715623856,
0.008394273929297924,
0.020167425274848938,
0.027204448357224464,
0.10283838957548141,
0.04496120288968086,
0.018400084227323532,
-0.02001103386282921,
0.0038539241068065166,
0.057608745992183685,
-0.0004922228399664164,
0.00250800559297204,
0.04774641990661621,
0.011453335173428059,
0.03132324293255806,
0.011992956511676311,
-0.00031439418671652675,
-0.1045343205332756,
-0.038635533303022385,
-0.012317468412220478,
-0.01540552731603384,
0.055757779628038406,
0.012283156625926495,
-0.0014906302094459534,
0.06975148618221283,
0.03918970748782158,
-0.044382743537425995,
-7.39398730168284e-33,
-0.060891252011060715,
0.0666661262512207,
-0.021618107333779335,
0.04694190248847008,
-0.0073584518395364285,
0.09733641892671585,
0.032286446541547775,
0.037617865949869156,
-0.08427093923091888,
-0.007120877038687468,
0.01296660490334034,
0.03872102499008179,
0.03562837839126587,
0.0433281734585762,
-0.02790241688489914,
0.0013656875817105174,
0.052301570773124695,
0.01566549763083458,
0.003430427983403206,
-0.041034530848264694,
0.0353301465511322,
0.010689880698919296,
-0.0036394051276147366,
-0.003051305189728737,
0.03449268639087677,
-0.01787390746176243,
-0.01424952782690525,
-0.018299810588359833,
-0.08981490135192871,
-0.07787511497735977,
-0.0340302400290966,
0.023084793239831924,
-0.05332512408494949,
0.05451414734125137,
0.05214959755539894,
-0.10161136090755463,
0.05537717789411545,
0.10818727314472198,
-0.008483979851007462,
-0.007381464820355177,
0.0896175280213356,
-0.01576869562268257,
-0.011419474147260189,
0.008110102266073227,
0.0750635415315628,
0.0468345545232296,
-0.0330338291823864,
-0.016390930861234665,
-0.12009982019662857,
-0.0006112844566814601,
-0.10818836838006973,
-0.0615372471511364,
-0.020717494189739227,
0.046774983406066895,
-0.010675197467207909,
-0.03246995806694031,
-0.0040036579594016075,
-0.0058761718682944775,
0.03502757102251053,
-0.007886191830039024,
0.03405100479722023,
-0.15967105329036713,
-0.023603608831763268,
-0.007210626732558012,
-0.0063378154300153255,
-0.02614804357290268,
-0.09862601011991501,
0.06136240065097809,
0.05697428435087204,
0.02562665194272995,
-0.08443043380975723,
0.01373780146241188,
-0.00904872640967369,
0.005223041400313377,
-0.0470743402838707,
0.03671751916408539,
0.0551614873111248,
-0.13461396098136902,
0.04491908475756645,
0.03914619982242584,
-0.06647433340549469,
0.0768049955368042,
0.010459554381668568,
-0.009602664038538933,
0.03306170180439949,
0.00043533832649700344,
-0.02475224807858467,
0.08309075236320496,
-0.05171594023704529,
0.021216893568634987,
-0.03718450292944908,
0.04775214195251465,
-0.06429106742143631,
-0.0014362969668582082,
0.029057467356324196,
-4.9552134839814244e-8,
-0.10111654549837112,
-0.02570355497300625,
-0.031922224909067154,
0.04091111943125725,
-0.08590991050004959,
-0.0014434747863560915,
-0.009890666231513023,
0.019407173618674278,
0.016602810472249985,
0.016269775107502937,
-0.034663744270801544,
-0.007350672502070665,
0.05175352469086647,
0.02208581380546093,
-0.0334535650908947,
-0.020044080913066864,
0.021982163190841675,
-0.02735363505780697,
0.022593598812818527,
-0.0218769833445549,
-0.005984223913401365,
-0.06245572119951248,
0.12899211049079895,
0.10072997957468033,
-0.012994120828807354,
-0.045620109885931015,
-0.041462093591690063,
0.10989011079072952,
-0.033787600696086884,
-0.05719674751162529,
-0.0903157889842987,
0.04149337485432625,
0.003944949246942997,
0.04220648854970932,
-0.0533888079226017,
-0.03545683994889259,
-0.09340643882751465,
0.023326801136136055,
0.026400988921523094,
0.0017575150122866035,
0.06598847359418869,
0.006809356156736612,
-0.023510757833719254,
0.07145272195339203,
0.07812029868364334,
0.03734416514635086,
0.03200959786772728,
0.06828492879867554,
-0.008228779770433903,
-0.05740908533334732,
0.06888066232204437,
-0.021411919966340065,
0.0023000785149633884,
-0.1025356873869896,
0.01935085840523243,
-0.016911907121539116,
-0.01947585493326187,
0.004457256756722927,
0.014331724494695663,
-0.046489737927913666,
-0.012082507833838463,
0.0627148225903511,
-0.12321549654006958,
-0.021290626376867294
] | -0.000875 |
[RFC 7838][]. \* `originOrStream` {number|string|URL|Object} Either a URL string specifying the origin (or an `Object` with an `origin` property) or the numeric identifier of an active `Http2Stream` as given by the `http2stream.id` property. Submits an `ALTSVC` frame (as defined by [RFC 7838][]) to the connected client. ```mjs import { createServer } from 'node:http2'; const server = createServer(); server.on('session', (session) => { // Set altsvc for origin https://example.org:80 session.altsvc('h2=":8000"', 'https://example.org:80'); }); server.on('stream', (stream) => { // Set altsvc for a specific stream stream.session.altsvc('h2=":8000"', stream.id); }); ``` ```cjs const http2 = require('node:http2'); const server = http2.createServer(); server.on('session', (session) => { // Set altsvc for origin https://example.org:80 session.altsvc('h2=":8000"', 'https://example.org:80'); }); server.on('stream', (stream) => { // Set altsvc for a specific stream stream.session.altsvc('h2=":8000"', stream.id); }); ``` Sending an `ALTSVC` frame with a specific stream ID indicates that the alternate service is associated with the origin of the given `Http2Stream`. The `alt` and origin string \_must\_ contain only ASCII bytes and are strictly interpreted as a sequence of ASCII bytes. The special value `'clear'` may be passed to clear any previously set alternative service for a given domain. When a string is passed for the `originOrStream` argument, it will be parsed as a URL and the origin will be derived. For instance, the origin for the HTTP URL `'https://example.org/foo/bar'` is the ASCII string `'https://example.org'`. An error will be thrown if either the given string cannot be parsed as a URL or if a valid origin cannot be derived. A `URL` object, or any object with an `origin` property, may be passed as `originOrStream`, in which case the value of the `origin` property will be used. The value of the `origin` property \_must\_ be a properly serialized ASCII origin. #### Specifying alternative services The format of the `alt` parameter is strictly defined by [RFC 7838][] as an ASCII string containing a comma-delimited list of "alternative" protocols associated with a specific host and port. For example, the value `'h2="example.org:81"'` indicates that the HTTP/2 protocol is available on the host `'example.org'` on TCP/IP port 81. The host and port \_must\_ be contained within the quote (`"`) characters. Multiple alternatives may be specified, for instance: `'h2="example.org:81", h2=":82"'`. The protocol identifier (`'h2'` in the examples) may be any valid [ALPN Protocol ID][]. The syntax of these values is not validated by the Node.js implementation and are passed through as provided by the user or received from the peer. #### `serverhttp2session.origin(...origins)` \* `origins` { string | URL | Object } One or more URL Strings passed as separate arguments. Submits an `ORIGIN` frame (as defined by [RFC 8336][]) to the connected client to advertise the set of origins for which the server is capable of providing authoritative responses. ```mjs import { createSecureServer } from 'node:http2'; const options = getSecureOptionsSomehow(); const server = createSecureServer(options); server.on('stream', (stream) => { stream.respond(); stream.end('ok'); }); server.on('session', (session) => { session.origin('https://example.com', 'https://example.org'); }); ``` ```cjs const http2 = require('node:http2'); const options = getSecureOptionsSomehow(); const server = http2.createSecureServer(options); server.on('stream', (stream) => { stream.respond(); stream.end('ok'); }); server.on('session', (session) => { session.origin('https://example.com', 'https://example.org'); }); ``` When a string is passed as an `origin`, it will be parsed as a URL and the origin will be derived. For instance, the origin for the HTTP URL `'https://example.org/foo/bar'` is the ASCII string `'https://example.org'`. An error will be thrown if either the given string cannot be parsed as a URL or if a valid origin cannot be derived. A `URL` object, or any object with an `origin` property, may be passed as an `origin`, in which case the value of the `origin` property will be used. The value of the `origin` property \_must\_ be | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.007568609435111284,
0.00924795214086771,
-0.013725938275456429,
-0.05067846551537514,
-0.038788508623838425,
-0.0842919871211052,
-0.05766413360834122,
0.03460696339607239,
0.10219047963619232,
0.0057978820987045765,
-0.028121760115027428,
-0.0032871796283870935,
0.010964243672788143,
0.05185200646519661,
0.06467107683420181,
0.000882103166077286,
-0.014170775189995766,
0.01635686866939068,
0.054848562926054,
-0.05137621611356735,
0.07094002515077591,
-0.05595992133021355,
0.003959835972636938,
-0.035634610801935196,
0.011894888244569302,
-0.029273517429828644,
-0.03826659917831421,
0.06330583244562149,
0.10225758701562881,
0.0009080103482119739,
0.1076047271490097,
-0.05906235799193382,
-0.14090420305728912,
-0.05035135895013809,
-0.045728765428066254,
0.02574792690575123,
0.059994716197252274,
-0.04414631798863411,
-0.07679753005504608,
0.032838743180036545,
0.09854142367839813,
-0.004552244674414396,
-0.008224429562687874,
0.01270065177232027,
-0.020052948966622353,
0.11300262808799744,
-0.030795708298683167,
0.07611794024705887,
-0.05582421272993088,
0.019147081300616264,
-0.04600578546524048,
-0.01602907106280327,
-0.07912474870681763,
0.014074262231588364,
-0.035689160227775574,
0.006702737417072058,
-0.10012888163328171,
0.06334959715604782,
0.09235098212957382,
0.03721558675169945,
0.015336722135543823,
-0.03106183372437954,
0.05914818122982979,
-0.016649169847369194,
0.001932439859956503,
-0.04512939974665642,
-0.04811488464474678,
0.044404931366443634,
0.023867938667535782,
0.0411759652197361,
-0.0020352406427264214,
-0.016151661053299904,
-0.12280911952257156,
-0.03332933783531189,
-0.03935655951499939,
-0.07789897918701172,
-0.03667764738202095,
0.011265763081610203,
-0.04196128994226456,
0.021106518805027008,
0.07371475547552109,
-0.04732649400830269,
0.013775106519460678,
0.017004722729325294,
0.061625003814697266,
0.041717104613780975,
0.055717967450618744,
0.015052069909870625,
0.014500923454761505,
0.08003928512334824,
-0.1431923657655716,
-0.044913433492183685,
0.045846108347177505,
0.028196236118674278,
-0.00020823959494009614,
0.06469187140464783,
-0.014049767516553402,
0.07878487557172775,
-0.015661947429180145,
0.047005586326122284,
0.03649773821234703,
0.024578791111707687,
-0.01631937548518181,
0.005283002275973558,
0.07029901444911957,
-0.048228468745946884,
-0.0025898192543536425,
0.11855404824018478,
0.08680678904056549,
-0.005625604651868343,
-0.03839855268597603,
0.0857977569103241,
0.027848094701766968,
-0.016990121454000473,
-0.009424549527466297,
0.026718735694885254,
0.07756626605987549,
0.012986620888113976,
0.05582943558692932,
0.04084395244717598,
0.02763221226632595,
-0.06413885205984116,
-0.033075060695409775,
-0.013425013981759548,
0.06230151280760765,
0.0027458760887384415,
0.10841082781553268,
3.6343225368693145e-33,
0.010981502942740917,
-0.02652580849826336,
-0.03542912006378174,
0.09772681444883347,
0.023842398077249527,
0.028160788118839264,
0.02331744320690632,
0.021512527018785477,
-0.04839731380343437,
-0.02720041759312153,
-0.09062759578227997,
-0.023244688287377357,
0.02637615241110325,
0.013696776703000069,
-0.07388689368963242,
-0.017427898943424225,
0.029836300760507584,
-0.015907691791653633,
0.09489134699106216,
0.0015339204110205173,
-0.05150141566991806,
-0.0036355331540107727,
0.05501449853181839,
-0.030297603458166122,
-0.031904447823762894,
-0.04474440962076187,
-0.021745558828115463,
-0.02979264408349991,
-0.028694653883576393,
-0.024413570761680603,
0.06015700101852417,
0.007590745575726032,
-0.0006086419452913105,
-0.010992256924510002,
0.10441487282514572,
-0.06535407900810242,
0.07742511481046677,
-0.013206752017140388,
-0.1175103634595871,
-0.04014786705374718,
0.008356350474059582,
0.05929785594344139,
-0.10598482936620712,
0.032159969210624695,
-0.08537495881319046,
-0.05435512587428093,
-0.06502731144428253,
-0.02499370463192463,
0.009956116788089275,
-0.035065773874521255,
-0.061221472918987274,
0.06005188450217247,
0.00020361306087579578,
-0.015430106781423092,
0.04600759223103523,
-0.008001134730875492,
-0.0511472225189209,
0.0412263385951519,
-0.09867802262306213,
-0.044829219579696655,
-0.014978389255702496,
0.06469718366861343,
-0.035371944308280945,
-0.03876486420631409,
0.02736714668571949,
0.02038799598813057,
-0.019831659272313118,
0.025348618626594543,
-0.008246883749961853,
-0.051509927958250046,
-0.0005748563562519848,
0.026284197345376015,
0.029803121462464333,
0.04259422421455383,
-0.011984056793153286,
0.03178368881344795,
-0.030723508447408676,
0.0421895757317543,
0.07197434455156326,
0.01680780202150345,
0.008389505557715893,
0.0255783312022686,
0.004874942824244499,
0.09730890393257141,
0.014549143612384796,
-0.04447700455784798,
-0.034822896122932434,
-0.10063669830560684,
-0.006060455925762653,
0.07030321657657623,
-0.01412434596568346,
0.028026126325130463,
-0.016536779701709747,
-0.005086235702037811,
-0.027024611830711365,
-3.644185301814698e-33,
-0.03309263288974762,
0.04769296944141388,
-0.0231294184923172,
0.04976995289325714,
-0.01904246397316456,
0.03724197670817375,
0.09141898155212402,
0.006906926166266203,
-0.03819696605205536,
0.03762006387114525,
0.06521400064229965,
0.01478369440883398,
0.03425711765885353,
0.013257849030196667,
0.008166682906448841,
-0.06665123999118805,
-0.013524645008146763,
0.010675046592950821,
-0.02589564025402069,
-0.08474405854940414,
-0.04282992333173752,
0.03591052442789078,
-0.010862293653190136,
0.009990108199417591,
0.04029949754476547,
0.023793688043951988,
0.027437228709459305,
0.007489998824894428,
-0.09808040410280228,
-0.1203843280673027,
0.023333840072155,
0.054573144763708115,
-0.051469624042510986,
0.01536876242607832,
0.00847542379051447,
0.010780448094010353,
0.04599921032786369,
0.15405431389808655,
-0.029293516650795937,
-0.0018270739819854498,
0.0728074461221695,
0.0031646599527448416,
-0.04513038694858551,
0.026223573833703995,
0.06738495081663132,
0.017741940915584564,
-0.037730034440755844,
0.04909057915210724,
-0.07588793337345123,
0.01861458458006382,
-0.02791510336101055,
-0.10990507155656815,
-0.015408294275403023,
0.007517143152654171,
0.027035122737288475,
-0.02023443765938282,
0.013941037468612194,
-0.020260045304894447,
0.04569479450583458,
0.012702535837888718,
0.076594777405262,
-0.1266058385372162,
-0.04797869920730591,
0.0315234437584877,
0.03332003951072693,
-0.021814191713929176,
-0.04414825141429901,
0.052004702389240265,
0.015735886991024017,
-0.02385605126619339,
0.0019427696242928505,
-0.024444369599223137,
0.02679384872317314,
-0.01967635191977024,
0.09110769629478455,
-0.01191945094615221,
0.01001477800309658,
-0.02830781787633896,
-0.00536332605406642,
-0.004874248988926411,
-0.07274951785802841,
0.0687597319483757,
-0.05904657021164894,
0.020318491384387016,
0.0590992271900177,
0.013476463966071606,
0.03633774071931839,
0.05767301470041275,
-0.048420682549476624,
-0.05586060509085655,
0.004329581279307604,
0.11281560361385345,
-0.16128364205360413,
0.00514567643404007,
0.08280426263809204,
-5.101917821548341e-8,
-0.09519597142934799,
-0.002248623874038458,
-0.06895846873521805,
0.0034705069847404957,
-0.10093715041875839,
0.03413098677992821,
-0.0733477920293808,
-0.01823355071246624,
0.040811654180288315,
0.004695122595876455,
-0.022031785920262337,
-0.025632020086050034,
0.025071866810321808,
-0.047011278569698334,
-0.017850836738944054,
-0.03143247216939926,
0.029871799051761627,
-0.024678468704223633,
-0.0017613349482417107,
-0.03842157870531082,
0.032461803406476974,
-0.05516336113214493,
0.05563247576355934,
0.07539518177509308,
-0.036719806492328644,
-0.11075478792190552,
0.03983867168426514,
0.045865196734666824,
-0.021777983754873276,
-0.07206698507070541,
-0.05640867352485657,
0.04458529129624367,
0.022233661264181137,
-0.012951482087373734,
-0.061274684965610504,
0.02980167232453823,
-0.09480437636375427,
-0.010875598527491093,
0.004748030565679073,
-0.004998577293008566,
0.09497269988059998,
-0.0019316679099574685,
-0.03825240954756737,
0.018710944801568985,
0.05913732200860977,
0.11301792412996292,
0.018519416451454163,
0.07149601727724075,
-0.02521214820444584,
-0.030655574053525925,
0.038974322378635406,
-0.02482268214225769,
0.04876532033085823,
-0.02058510109782219,
-0.025173967704176903,
-0.054972950369119644,
-0.014977696351706982,
-0.09022802114486694,
-0.007764472626149654,
-0.04703010246157646,
0.08443743735551834,
0.09390530735254288,
-0.03462081030011177,
-0.023325849324464798
] | 0.010845 |
cannot be parsed as a URL or if a valid origin cannot be derived. A `URL` object, or any object with an `origin` property, may be passed as an `origin`, in which case the value of the `origin` property will be used. The value of the `origin` property \_must\_ be a properly serialized ASCII origin. Alternatively, the `origins` option may be used when creating a new HTTP/2 server using the `http2.createSecureServer()` method: ```mjs import { createSecureServer } from 'node:http2'; const options = getSecureOptionsSomehow(); options.origins = ['https://example.com', 'https://example.org']; const server = createSecureServer(options); server.on('stream', (stream) => { stream.respond(); stream.end('ok'); }); ``` ```cjs const http2 = require('node:http2'); const options = getSecureOptionsSomehow(); options.origins = ['https://example.com', 'https://example.org']; const server = http2.createSecureServer(options); server.on('stream', (stream) => { stream.respond(); stream.end('ok'); }); ``` ### Class: `ClientHttp2Session` \* Extends: {Http2Session} #### Event: `'altsvc'` \* `alt` {string} \* `origin` {string} \* `streamId` {number} The `'altsvc'` event is emitted whenever an `ALTSVC` frame is received by the client. The event is emitted with the `ALTSVC` value, origin, and stream ID. If no `origin` is provided in the `ALTSVC` frame, `origin` will be an empty string. ```mjs import { connect } from 'node:http2'; const client = connect('https://example.org'); client.on('altsvc', (alt, origin, streamId) => { console.log(alt); console.log(origin); console.log(streamId); }); ``` ```cjs const http2 = require('node:http2'); const client = http2.connect('https://example.org'); client.on('altsvc', (alt, origin, streamId) => { console.log(alt); console.log(origin); console.log(streamId); }); ``` #### Event: `'origin'` \* `origins` {string\[]} The `'origin'` event is emitted whenever an `ORIGIN` frame is received by the client. The event is emitted with an array of `origin` strings. The `http2session.originSet` will be updated to include the received origins. ```mjs import { connect } from 'node:http2'; const client = connect('https://example.org'); client.on('origin', (origins) => { for (let n = 0; n < origins.length; n++) console.log(origins[n]); }); ``` ```cjs const http2 = require('node:http2'); const client = http2.connect('https://example.org'); client.on('origin', (origins) => { for (let n = 0; n < origins.length; n++) console.log(origins[n]); }); ``` The `'origin'` event is only emitted when using a secure TLS connection. #### `clienthttp2session.request(headers[, options])` \* `headers` {HTTP/2 Headers Object|HTTP/2 Raw Headers} \* `options` {Object} \* `endStream` {boolean} `true` if the `Http2Stream` \_writable\_ side should be closed initially, such as when sending a `GET` request that should not expect a payload body. \* `exclusive` {boolean} When `true` and `parent` identifies a parent Stream, the created stream is made the sole direct dependency of the parent, with all other existing dependents made a dependent of the newly created stream. \*\*Default:\*\* `false`. \* `parent` {number} Specifies the numeric identifier of a stream the newly created stream is dependent on. \* `waitForTrailers` {boolean} When `true`, the `Http2Stream` will emit the `'wantTrailers'` event after the final `DATA` frame has been sent. \* `signal` {AbortSignal} An AbortSignal that may be used to abort an ongoing request. \* Returns: {ClientHttp2Stream} For HTTP/2 Client `Http2Session` instances only, the `http2session.request()` creates and returns an `Http2Stream` instance that can be used to send an HTTP/2 request to the connected server. When a `ClientHttp2Session` is first created, the socket may not yet be connected. if `clienthttp2session.request()` is called during this time, the actual request will be deferred until the socket is ready to go. If the `session` is closed before the actual request be executed, an `ERR\_HTTP2\_GOAWAY\_SESSION` is thrown. This method is only available if `http2session.type` is equal to `http2.constants.NGHTTP2\_SESSION\_CLIENT`. ```mjs import { connect, constants } from 'node:http2'; const clientSession = connect('https://localhost:1234'); const { HTTP2\_HEADER\_PATH, HTTP2\_HEADER\_STATUS, } = constants; const req = clientSession.request({ [HTTP2\_HEADER\_PATH]: '/' }); req.on('response', (headers) => { console.log(headers[HTTP2\_HEADER\_STATUS]); req.on('data', (chunk) => { /\* .. \*/ }); req.on('end', () => { /\* .. \*/ }); }); ``` ```cjs const http2 = | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.028499094769358635,
0.056048501282930374,
-0.026339735835790634,
-0.03009951300919056,
-0.0459413081407547,
-0.1186516284942627,
-0.09876808524131775,
0.03817611187696457,
0.047526054084300995,
-0.023522762581706047,
0.006021510809659958,
-0.07692398875951767,
0.021898193284869194,
0.029901085421442986,
0.06497354060411453,
0.00766402343288064,
0.02650078944861889,
0.05429408699274063,
0.028702491894364357,
-0.025499535724520683,
0.09175024926662445,
-0.06238340958952904,
0.02867543138563633,
-0.012150642462074757,
0.005141235888004303,
-0.0376259908080101,
-0.0036382998805493116,
0.13645847141742706,
0.10693255066871643,
0.03039293922483921,
0.09924616664648056,
-0.0746752992272377,
-0.1356220543384552,
-0.0066585480235517025,
-0.08536381274461746,
0.051912423223257065,
0.026561858132481575,
-0.0837409645318985,
-0.001439703512005508,
-0.043747540563344955,
0.02850557304918766,
0.062460727989673615,
0.009786208160221577,
-0.02368389628827572,
-0.006380097940564156,
0.0893651619553566,
0.03411315008997917,
0.04214491695165634,
-0.06774163991212845,
-0.037026528269052505,
-0.05512653663754463,
-0.03987118974328041,
-0.040366023778915405,
-0.03091883473098278,
-0.06971339136362076,
0.03608860820531845,
-0.10040903091430664,
0.08701587468385696,
0.028046291321516037,
0.04271068796515465,
0.04749267175793648,
-0.028983978554606438,
0.030420346185564995,
-0.004454528912901878,
0.0021296776831150055,
-0.07214076817035675,
-0.042989037930965424,
0.08732619136571884,
-0.021537544205784798,
0.05255458131432533,
-0.04570206627249718,
-0.04173314571380615,
-0.03083040937781334,
0.07161805778741837,
-0.006063321605324745,
-0.0458344966173172,
-0.05310497060418129,
-0.03448281064629555,
-0.03461243212223053,
0.05269157513976097,
0.07040885090827942,
-0.09331030398607254,
0.02991892211139202,
0.04914755001664162,
-0.027992650866508484,
0.04741501435637474,
0.015744900330901146,
0.03183753788471222,
0.054859936237335205,
0.019382469356060028,
-0.007960811257362366,
-0.010413584299385548,
0.011196194216609001,
0.019888680428266525,
0.06046854332089424,
-0.0034447014331817627,
-0.032205842435359955,
0.005832469556480646,
-0.019834069535136223,
-0.0008866019197739661,
-0.002335203578695655,
-0.04026225581765175,
0.017819255590438843,
-0.03114895522594452,
0.05710333585739136,
-0.012873061001300812,
-0.016385989263653755,
0.10449204593896866,
0.10116291046142578,
0.04100510850548744,
0.022867325693368912,
0.04699837043881416,
-0.04608694091439247,
-0.04428791627287865,
-0.03669049218297005,
0.02949497103691101,
0.054873622953891754,
-0.043773140758275986,
0.07128047943115234,
0.044553544372320175,
0.03703397884964943,
-0.053491681814193726,
-0.017689736559987068,
-0.028685733675956726,
-0.04244311526417732,
-0.059863969683647156,
0.08995310217142105,
3.630600260539039e-33,
-0.010899697430431843,
-0.0009527146467007697,
0.026703324168920517,
0.05751589313149452,
-0.014267642050981522,
-0.003787347348406911,
0.011801076121628284,
0.02077956311404705,
-0.022617464885115623,
-0.05572452023625374,
0.016573447734117508,
-0.05526406690478325,
0.0133280698210001,
-0.06420738250017166,
0.002322525717318058,
-0.0014319921610876918,
0.09862229228019714,
-0.06637856364250183,
0.14739857614040375,
0.06715697795152664,
0.02070377767086029,
0.05128322169184685,
0.11146438121795654,
-0.04919968172907829,
-0.022520234808325768,
-0.07058601826429367,
0.02693663164973259,
0.019564952701330185,
-0.06524084508419037,
-0.04819106683135033,
0.009828123264014721,
-0.019209925085306168,
-0.008115081116557121,
-0.008255667053163052,
0.09969337284564972,
-0.0454619899392128,
0.10578141361474991,
-0.013201335445046425,
-0.10102064907550812,
-0.05310655012726784,
0.06322144716978073,
0.0060517555102705956,
-0.0012569342507049441,
0.09706376492977142,
0.004597362596541643,
-0.04380989819765091,
-0.13514913618564606,
-0.039201486855745316,
0.04912484437227249,
0.026261597871780396,
-0.12179037183523178,
0.06589463353157043,
-0.0026817142497748137,
-0.036016032099723816,
-0.021702049300074577,
-0.019312169402837753,
-0.0715576559305191,
0.036369383335113525,
-0.08387789875268936,
-0.09858095645904541,
-0.07603385299444199,
0.02142881229519844,
0.019977208226919174,
-0.03170984983444214,
-0.003224457148462534,
0.002980404533445835,
-0.059669800102710724,
0.07439934462308884,
-0.017009025439620018,
0.042123593389987946,
-0.020837167277932167,
0.012619039043784142,
0.05428878962993622,
0.017563406378030777,
0.003653888823464513,
0.06517881900072098,
-0.04746507108211517,
0.03579206019639969,
0.09158461540937424,
-0.07916878163814545,
0.008984521962702274,
0.01789899729192257,
-0.005431640427559614,
0.09185479581356049,
-0.0025852075777947903,
0.021789979189634323,
-0.013621344231069088,
-0.022828875109553337,
0.058678124099969864,
0.07419268786907196,
0.018424909561872482,
-0.037623848766088486,
-0.02271375246345997,
-0.014583730138838291,
-0.0333370640873909,
-4.616776103373612e-33,
-0.04228159412741661,
0.028272107243537903,
-0.0373888835310936,
0.10830347239971161,
-0.0380624383687973,
-0.036283839493989944,
0.04468492045998573,
-0.001998186344280839,
-0.032562628388404846,
0.05580621585249901,
-0.03092159703373909,
0.005166941322386265,
0.07523446530103683,
0.044009190052747726,
0.03138117864727974,
-0.038258954882621765,
0.018085848540067673,
0.023069707676768303,
0.03172281011939049,
-0.03746667504310608,
-0.030323071405291557,
0.009249309077858925,
-0.04056590050458908,
0.0010504317469894886,
-0.029108569025993347,
0.05707375332713127,
-0.03710003197193146,
-0.0590456984937191,
-0.0522395521402359,
-0.029296420514583588,
-0.025968413800001144,
0.09930028021335602,
0.02674666978418827,
0.06771926581859589,
-0.006699831690639257,
-0.028939491137862206,
-0.008959508500993252,
0.08925855904817581,
0.06326542794704437,
-0.043193280696868896,
0.012562508694827557,
-0.0015362142585217953,
-0.016076140105724335,
0.04518844559788704,
0.02611444517970085,
-0.021102892234921455,
0.02706310525536537,
0.05794908478856087,
0.0015539597952738404,
-0.0026277087163180113,
-0.028996512293815613,
-0.07509341090917587,
-0.03973689675331116,
-0.02349277213215828,
0.008060798980295658,
-0.07985548675060272,
0.007729317992925644,
0.022241029888391495,
0.03946232423186302,
0.030100932344794273,
-0.01390332356095314,
-0.09099826961755753,
-0.06985608488321304,
-0.012488516047596931,
0.041769154369831085,
0.0478714220225811,
-0.14388659596443176,
0.046948421746492386,
0.048390943557024,
-0.015357821248471737,
-0.06400448828935623,
-0.022479787468910217,
0.008778676390647888,
-0.08939254283905029,
0.07222691923379898,
-0.008657708764076233,
0.05185043811798096,
-0.030449632555246353,
0.01979035697877407,
0.07896608114242554,
-0.044640202075242996,
0.04593876376748085,
-0.07138196378946304,
0.044510383158922195,
0.1040421649813652,
-0.051821257919073105,
-0.02797018550336361,
0.02380404807627201,
-0.05458077788352966,
-0.033595018088817596,
0.028988869860768318,
0.10139699280261993,
-0.1443580538034439,
-0.005229391157627106,
0.04159155488014221,
-5.2565585662023295e-8,
-0.05032794177532196,
-0.021194875240325928,
-0.062386248260736465,
0.024092940613627434,
-0.01066930964589119,
0.014640405774116516,
-0.03426417335867882,
-0.06884193420410156,
0.0646735206246376,
0.04276299849152565,
-0.09465046226978302,
-0.07712380588054657,
0.029994158074259758,
-0.05383448302745819,
-0.05930468067526817,
-0.0012357878731563687,
-0.014260577969253063,
-0.0010404511122033,
-0.007631739601492882,
-0.0010212239576503634,
-0.012115485966205597,
-0.08575669676065445,
-0.0002150701911887154,
0.05228852108120918,
0.02687845006585121,
-0.004552824888378382,
-0.05809836462140083,
-0.014732809737324715,
-0.02838827669620514,
0.053184933960437775,
-0.03854040056467056,
0.018143272027373314,
0.031035011634230614,
0.02155143953859806,
-0.013400805182754993,
0.019062692299485207,
-0.02115544304251671,
0.029443349689245224,
0.04680047184228897,
-0.026501672342419624,
0.11317044496536255,
0.05759349465370178,
-0.015976207330822945,
0.07418286800384521,
-0.02105533517897129,
0.01371200941503048,
0.03258078545331955,
0.05171717330813408,
0.015649685636162758,
-0.044654086232185364,
0.03858698904514313,
-0.059427499771118164,
-0.008879928849637508,
-0.00391753576695919,
-0.07598073780536652,
-0.049736566841602325,
-0.059743016958236694,
-0.041774336248636246,
0.012277263216674328,
-0.016395065933465958,
0.09243854880332947,
0.023501092568039894,
0.048908647149801254,
-0.04799916595220566
] | -0.044845 |
connect, constants } from 'node:http2'; const clientSession = connect('https://localhost:1234'); const { HTTP2\_HEADER\_PATH, HTTP2\_HEADER\_STATUS, } = constants; const req = clientSession.request({ [HTTP2\_HEADER\_PATH]: '/' }); req.on('response', (headers) => { console.log(headers[HTTP2\_HEADER\_STATUS]); req.on('data', (chunk) => { /\* .. \*/ }); req.on('end', () => { /\* .. \*/ }); }); ``` ```cjs const http2 = require('node:http2'); const clientSession = http2.connect('https://localhost:1234'); const { HTTP2\_HEADER\_PATH, HTTP2\_HEADER\_STATUS, } = http2.constants; const req = clientSession.request({ [HTTP2\_HEADER\_PATH]: '/' }); req.on('response', (headers) => { console.log(headers[HTTP2\_HEADER\_STATUS]); req.on('data', (chunk) => { /\* .. \*/ }); req.on('end', () => { /\* .. \*/ }); }); ``` When the `options.waitForTrailers` option is set, the `'wantTrailers'` event is emitted immediately after queuing the last chunk of payload data to be sent. The `http2stream.sendTrailers()` method can then be called to send trailing headers to the peer. When `options.waitForTrailers` is set, the `Http2Stream` will not automatically close when the final `DATA` frame is transmitted. User code must call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`. When `options.signal` is set with an `AbortSignal` and then `abort` on the corresponding `AbortController` is called, the request will emit an `'error'` event with an `AbortError` error. The `:method` and `:path` pseudo-headers are not specified within `headers`, they respectively default to: \* `:method` = `'GET'` \* `:path` = `/` ### Class: `Http2Stream` \* Extends: {stream.Duplex} Each instance of the `Http2Stream` class represents a bidirectional HTTP/2 communications stream over an `Http2Session` instance. Any single `Http2Session` may have up to 231-1 `Http2Stream` instances over its lifetime. User code will not construct `Http2Stream` instances directly. Rather, these are created, managed, and provided to user code through the `Http2Session` instance. On the server, `Http2Stream` instances are created either in response to an incoming HTTP request (and handed off to user code via the `'stream'` event), or in response to a call to the `http2stream.pushStream()` method. On the client, `Http2Stream` instances are created and returned when either the `http2session.request()` method is called, or in response to an incoming `'push'` event. The `Http2Stream` class is a base for the [`ServerHttp2Stream`][] and [`ClientHttp2Stream`][] classes, each of which is used specifically by either the Server or Client side, respectively. All `Http2Stream` instances are [`Duplex`][] streams. The `Writable` side of the `Duplex` is used to send data to the connected peer, while the `Readable` side is used to receive data sent by the connected peer. The default text character encoding for an `Http2Stream` is UTF-8. When using an `Http2Stream` to send text, use the `'content-type'` header to set the character encoding. ```js stream.respond({ 'content-type': 'text/html; charset=utf-8', ':status': 200, }); ``` #### `Http2Stream` Lifecycle ##### Creation On the server side, instances of [`ServerHttp2Stream`][] are created either when: \* A new HTTP/2 `HEADERS` frame with a previously unused stream ID is received; \* The `http2stream.pushStream()` method is called. On the client side, instances of [`ClientHttp2Stream`][] are created when the `http2session.request()` method is called. On the client, the `Http2Stream` instance returned by `http2session.request()` may not be immediately ready for use if the parent `Http2Session` has not yet been fully established. In such cases, operations called on the `Http2Stream` will be buffered until the `'ready'` event is emitted. User code should rarely, if ever, need to handle the `'ready'` event directly. The ready status of an `Http2Stream` can be determined by checking the value of `http2stream.id`. If the value is `undefined`, the stream is not yet ready for use. ##### Destruction All [`Http2Stream`][] instances are destroyed either when: \* An `RST\_STREAM` frame for the stream is received by the connected peer, and (for client streams only) pending data has been read. \* The `http2stream.close()` method is called, and (for client streams only) pending data has | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.051348790526390076,
0.11648184806108475,
0.02935970574617386,
-0.028192704543471336,
-0.04809582605957985,
-0.0747431218624115,
-0.05692222714424133,
0.04805576056241989,
0.03158247470855713,
-0.013308493420481682,
-0.05634220317006111,
-0.03810335323214531,
-0.041693128645420074,
-0.025832438841462135,
0.07519784569740295,
0.019727740436792374,
-0.00017351610586047173,
0.040735874325037,
-0.018158532679080963,
-0.07039667665958405,
-0.013848812319338322,
0.024257518351078033,
-0.006731363013386726,
-0.0035810861736536026,
0.012249262072145939,
0.012042274698615074,
-0.04603424668312073,
-0.03326200693845749,
0.024574605748057365,
0.03395509347319603,
0.09175466746091843,
-0.0777936801314354,
-0.17151325941085815,
0.05319647118449211,
-0.08485010266304016,
0.05380060151219368,
0.04591144248843193,
-0.10318385064601898,
-0.026977408677339554,
-0.004186471924185753,
0.03945276886224747,
0.10649919509887695,
-0.04094283655285835,
-0.03500227630138397,
0.07358615100383759,
-0.0026188339106738567,
-0.03336537629365921,
0.09340733289718628,
-0.02578994818031788,
-0.036836858838796616,
-0.008778057992458344,
-0.02755565568804741,
-0.09709934890270233,
0.01579766906797886,
0.014998896978795528,
0.019175108522176743,
-0.07563208043575287,
0.07768698036670685,
0.00966818816959858,
0.06359144300222397,
0.022907467558979988,
-0.08980758488178253,
0.054237108677625656,
-0.04017792269587517,
0.005454499740153551,
-0.07144138962030411,
-0.057731226086616516,
0.07110728323459625,
0.003641413291916251,
0.08591892570257187,
-0.046053726226091385,
0.035891879349946976,
-0.08523815870285034,
-0.03791220486164093,
-0.0319659598171711,
-0.08007403463125229,
-0.062057867646217346,
0.021471288055181503,
-0.061468422412872314,
-0.015569230541586876,
-0.03029553033411503,
-0.1016923114657402,
-0.023409198969602585,
0.01866593211889267,
0.010752386413514614,
-0.003507079789415002,
-0.014769007451832294,
0.004203187767416239,
-0.035246722400188446,
-0.08925790339708328,
-0.040961433202028275,
0.048210304230451584,
-0.013558152131736279,
-0.0037662331014871597,
0.012428652495145798,
0.0636059045791626,
0.013084734790027142,
0.01712053269147873,
0.01712293177843094,
0.027182577177882195,
0.0070676724426448345,
-0.06570084393024445,
0.0038986795116215944,
-0.008511596359312534,
0.016430046409368515,
-0.04877958819270134,
-0.06610387563705444,
0.0622234083712101,
0.013317772187292576,
0.009591568261384964,
-0.002095048315823078,
0.013004773296415806,
-0.028827492147684097,
-0.023156141862273216,
-0.01150447316467762,
0.01077945064753294,
0.07637130469083786,
-0.014517221599817276,
0.030148427933454514,
0.060296352952718735,
0.04460407420992851,
-0.07952793687582016,
-0.0021029359195381403,
-0.017773739993572235,
0.01853242516517639,
-0.10132540017366409,
0.1308145523071289,
1.129902159577172e-33,
-0.0037025189958512783,
-0.03758931905031204,
0.00832818541675806,
0.05110900476574898,
0.050335124135017395,
0.026621151715517044,
0.054686207324266434,
-0.014423847198486328,
-0.0350206196308136,
0.0054082428105175495,
-0.02382364124059677,
-0.026624605059623718,
0.004107157699763775,
-0.04815194755792618,
-0.020251039415597916,
-0.033831771463155746,
0.11163430660963058,
-0.008056173101067543,
0.09223341196775436,
0.05005424842238426,
0.02445749193429947,
0.018016429618000984,
0.05152537673711777,
0.029717111960053444,
0.0402550995349884,
-0.08676738291978836,
0.01125513855367899,
-0.00934415590018034,
-0.058196429163217545,
-0.05655919387936592,
0.0746607556939125,
0.055598560720682144,
-0.000615443626884371,
0.01674055866897106,
0.08183560520410538,
-0.03320945054292679,
0.08544924855232239,
0.028357047587633133,
-0.08430534601211548,
-0.022137196734547615,
0.05390755087137222,
0.06279418617486954,
-0.01198442094027996,
0.006573338992893696,
-0.014692895114421844,
-0.057848840951919556,
-0.08919665962457657,
-0.08455659449100494,
0.04947071522474289,
-0.054433614015579224,
-0.08687318861484528,
0.07740417867898941,
0.07081670314073563,
-0.060796987265348434,
0.03763977810740471,
-0.0007863963255658746,
-0.083293117582798,
-0.01774030365049839,
-0.08195886760950089,
-0.04036220908164978,
0.004107689019292593,
0.023818060755729675,
-0.015020252205431461,
-0.04992808401584625,
0.023635713383555412,
0.05958263576030731,
-0.011114262044429779,
0.13066506385803223,
0.01678556576371193,
0.0318819023668766,
0.012252608314156532,
0.030159618705511093,
0.08231476694345474,
-0.00978495366871357,
-0.013698320835828781,
0.03268500789999962,
-0.04606812074780464,
0.03467145189642906,
0.06316245347261429,
-0.06508993357419968,
0.04863392934203148,
-0.019305890426039696,
-0.038994163274765015,
0.10623558610677719,
0.03259702026844025,
0.013009573332965374,
-0.05183173343539238,
-0.01366866659373045,
0.02995794080197811,
0.11513672024011612,
-0.03374933823943138,
0.022869030013680458,
0.011239503510296345,
-0.07061399519443512,
-0.02367236651480198,
-3.0014361947156026e-33,
0.04006681218743324,
0.03937644511461258,
-0.030304305255413055,
0.04518366605043411,
0.03431571647524834,
0.04618057608604431,
0.015112044289708138,
-0.04213973134756088,
0.001120158238336444,
0.09561063349246979,
0.049062613397836685,
0.008351611904799938,
0.021826958283782005,
0.03014829196035862,
-0.045076750218868256,
0.05858602374792099,
-0.0425836518406868,
-0.003074666252359748,
-0.031000832095742226,
-0.07119894027709961,
-0.051560502499341965,
-0.00048523637815378606,
0.011415578424930573,
0.0005542146391235292,
-0.05899857357144356,
0.008327798917889595,
-0.036018531769514084,
-0.062330782413482666,
-0.09695567190647125,
-0.02870088629424572,
-0.06470753997564316,
0.020256174728274345,
-0.01936502940952778,
0.04298429563641548,
-0.0006057752179913223,
-0.08625783026218414,
0.03154326230287552,
0.13185112178325653,
0.029879067093133926,
-0.025490647181868553,
0.0682009607553482,
-0.00536683714017272,
-0.013479791581630707,
0.028865879401564598,
0.04050997272133827,
-0.04250666871666908,
0.036036379635334015,
0.0287191029638052,
-0.1494535356760025,
-0.025548620149493217,
0.010681729763746262,
-0.021722592413425446,
-0.05388636887073517,
0.07453905045986176,
0.01045969221740961,
-0.0205173771828413,
-0.040302928537130356,
-0.003349987557157874,
0.0233762264251709,
-0.0037962505593895912,
-0.01667161099612713,
-0.14309470355510712,
-0.024431642144918442,
0.05181022360920906,
0.041252050548791885,
-0.04209740087389946,
-0.12229376286268234,
-0.01248328946530819,
0.07085365056991577,
-0.0009544525528326631,
-0.05665706470608711,
0.01947564259171486,
0.04383314400911331,
-0.002856495091691613,
0.06868739426136017,
0.0036836799699813128,
-0.021833136677742004,
-0.085906021296978,
0.015566959977149963,
0.14540442824363708,
-0.06602897495031357,
0.02940037101507187,
-0.056830573827028275,
-0.010172940790653229,
0.07748071849346161,
-0.03147093579173088,
-0.051317837089300156,
0.09648507833480835,
-0.03822595253586769,
-0.05115397274494171,
0.028581775724887848,
0.07613224536180496,
-0.07464959472417831,
-0.07724328339099884,
-0.005683450493961573,
-4.331663205903169e-8,
-0.012024703435599804,
-0.037955425679683685,
-0.0811229944229126,
-0.008560486137866974,
-0.04970986396074295,
0.04878055304288864,
-0.010577385313808918,
0.003518664976581931,
0.021846769377589226,
0.04846687242388725,
-0.05295887589454651,
0.01918090507388115,
0.028581790626049042,
-0.05350091680884361,
-0.04406652972102165,
-0.005856732837855816,
0.01295540202409029,
-0.04638899862766266,
0.020322274416685104,
-0.025852946564555168,
0.03570426627993584,
0.012826094403862953,
0.027838390320539474,
0.08804545551538467,
0.04340938478708267,
-0.005632684100419283,
0.029709726572036743,
0.04587598890066147,
-0.06633453816175461,
0.010995490476489067,
-0.046478088945150375,
-0.006635219790041447,
0.0431375727057457,
-0.00727531872689724,
0.026465924456715584,
-0.06853298842906952,
-0.008953823707997799,
0.06297033280134201,
0.012641857378184795,
0.010512328706681728,
0.10017527639865875,
0.07433512806892395,
-0.003230488393455744,
0.08953127264976501,
0.08537039905786514,
-0.005610606633126736,
0.07202983647584915,
0.057543303817510605,
0.048128027468919754,
-0.03852104768157005,
0.01922604627907276,
-0.031266603618860245,
0.01883063279092312,
-0.03230844810605049,
-0.05668317526578903,
-0.030531903728842735,
-0.04988360404968262,
-0.019749637693166733,
-0.05953565239906311,
-0.03267933055758476,
0.07473048567771912,
0.008323365822434425,
-0.00393584044650197,
-0.013653339818120003
] | 0.003757 |
yet ready for use. ##### Destruction All [`Http2Stream`][] instances are destroyed either when: \* An `RST\_STREAM` frame for the stream is received by the connected peer, and (for client streams only) pending data has been read. \* The `http2stream.close()` method is called, and (for client streams only) pending data has been read. \* The `http2stream.destroy()` or `http2session.destroy()` methods are called. When an `Http2Stream` instance is destroyed, an attempt will be made to send an `RST\_STREAM` frame to the connected peer. When the `Http2Stream` instance is destroyed, the `'close'` event will be emitted. Because `Http2Stream` is an instance of `stream.Duplex`, the `'end'` event will also be emitted if the stream data is currently flowing. The `'error'` event may also be emitted if `http2stream.destroy()` was called with an `Error` passed as the first argument. After the `Http2Stream` has been destroyed, the `http2stream.destroyed` property will be `true` and the `http2stream.rstCode` property will specify the `RST\_STREAM` error code. The `Http2Stream` instance is no longer usable once destroyed. #### Event: `'aborted'` The `'aborted'` event is emitted whenever a `Http2Stream` instance is abnormally aborted in mid-communication. Its listener does not expect any arguments. The `'aborted'` event will only be emitted if the `Http2Stream` writable side has not been ended. #### Event: `'close'` The `'close'` event is emitted when the `Http2Stream` is destroyed. Once this event is emitted, the `Http2Stream` instance is no longer usable. The HTTP/2 error code used when closing the stream can be retrieved using the `http2stream.rstCode` property. If the code is any value other than `NGHTTP2\_NO\_ERROR` (`0`), an `'error'` event will have also been emitted. #### Event: `'error'` \* `error` {Error} The `'error'` event is emitted when an error occurs during the processing of an `Http2Stream`. #### Event: `'frameError'` \* `type` {integer} The frame type. \* `code` {integer} The error code. \* `id` {integer} The stream id (or `0` if the frame isn't associated with a stream). The `'frameError'` event is emitted when an error occurs while attempting to send a frame. When invoked, the handler function will receive an integer argument identifying the frame type, and an integer argument identifying the error code. The `Http2Stream` instance will be destroyed immediately after the `'frameError'` event is emitted. #### Event: `'ready'` The `'ready'` event is emitted when the `Http2Stream` has been opened, has been assigned an `id`, and can be used. The listener does not expect any arguments. #### Event: `'timeout'` The `'timeout'` event is emitted after no activity is received for this `Http2Stream` within the number of milliseconds set using `http2stream.setTimeout()`. Its listener does not expect any arguments. #### Event: `'trailers'` \* `headers` {HTTP/2 Headers Object} An object describing the headers \* `flags` {number} The associated numeric flags The `'trailers'` event is emitted when a block of headers associated with trailing header fields is received. The listener callback is passed the [HTTP/2 Headers Object][] and flags associated with the headers. This event might not be emitted if `http2stream.end()` is called before trailers are received and the incoming data is not being read or listened for. ```js stream.on('trailers', (headers, flags) => { console.log(headers); }); ``` #### Event: `'wantTrailers'` The `'wantTrailers'` event is emitted when the `Http2Stream` has queued the final `DATA` frame to be sent on a frame and the `Http2Stream` is ready to send trailing headers. When initiating a request or response, the `waitForTrailers` option must be set for this event to be emitted. #### `http2stream.aborted` \* Type: {boolean} Set to `true` if the `Http2Stream` instance was aborted abnormally. When set, the `'aborted'` event will have been emitted. #### `http2stream.bufferSize` \* Type: {number} This property shows the number of characters currently buffered to | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.04475579410791397,
0.025513701140880585,
-0.011526119895279408,
-0.005287699401378632,
0.017019430175423622,
-0.08040479570627213,
-0.03413419425487518,
0.03499670699238777,
0.03805893287062645,
0.006327193696051836,
-0.04789397120475769,
0.10327909886837006,
-0.015211177058517933,
0.0052934084087610245,
0.027650490403175354,
0.009350799024105072,
0.002611166564747691,
-0.03115500509738922,
-0.034022267907857895,
-0.023490365594625473,
0.058270301669836044,
-0.0005574747920036316,
-0.008417853154242039,
0.006626903545111418,
0.0027504325844347477,
0.03928758203983307,
-0.0219956673681736,
-0.030994858592748642,
0.04511513561010361,
0.020896198228001595,
0.07912608981132507,
-0.08843982219696045,
-0.1508745700120926,
-0.008371904492378235,
-0.06094072759151459,
0.039477232843637466,
0.07448342442512512,
-0.06479816138744354,
-0.07511930167675018,
0.012228031642735004,
0.0969206839799881,
-0.0004591917968355119,
-0.1503324657678604,
-0.021523794159293175,
-0.08683111518621445,
0.056300088763237,
-0.08049464225769043,
0.030393704771995544,
-0.08317693322896957,
-0.044570621103048325,
-0.08699989318847656,
0.01612991839647293,
-0.022791001945734024,
0.10874779522418976,
0.08565620332956314,
-0.08411344140768051,
-0.018884936347603798,
0.021549629047513008,
-0.04452510550618172,
0.00819422584027052,
-0.028567170724272728,
0.055768705904483795,
-0.05403396487236023,
0.044267117977142334,
0.03590944781899452,
-0.033343564718961716,
0.02639172226190567,
0.03742385655641556,
0.11662056297063828,
0.021463166922330856,
-0.058164674788713455,
0.000772839761339128,
-0.08878614008426666,
0.0019649937748908997,
0.006614278070628643,
-0.08140861243009567,
-0.03840237483382225,
0.0014964449219405651,
-0.10080362856388092,
0.003855133894830942,
0.0338825099170208,
-0.1101071834564209,
-0.02316642738878727,
-0.01992347091436386,
-0.012330100871622562,
0.0036562609020620584,
0.04100546985864639,
0.020647648721933365,
0.04715674743056297,
0.030377740040421486,
-0.08154918253421783,
0.10947670042514801,
0.07808927446603775,
0.10222256183624268,
-0.018791384994983673,
0.09288337826728821,
-0.006802364718168974,
0.014335749670863152,
-0.011029692366719246,
0.03434300050139427,
0.033942997455596924,
-0.01752747781574726,
-0.0056594666093587875,
-0.0532081164419651,
0.02087719552218914,
-0.07979560643434525,
-0.06856822967529297,
0.06413982063531876,
0.113921158015728,
-0.0653202086687088,
0.003390684723854065,
-0.03989579901099205,
-0.017890647053718567,
0.00046334293438121676,
-0.024716868996620178,
0.13965612649917603,
0.004708736203610897,
0.11847653985023499,
-0.0005313199362717569,
0.07259364426136017,
0.07397738844156265,
-0.03815359249711037,
0.01810004934668541,
-0.018140245229005814,
0.05248691514134407,
-0.024038659408688545,
0.04402024298906326,
2.160012011938232e-33,
-0.008837086148560047,
-0.0827789306640625,
-0.09661131352186203,
0.05220421776175499,
0.008174888789653778,
0.0215907022356987,
-0.008341416716575623,
0.07100926339626312,
-0.008875151164829731,
-0.06743651628494263,
0.008592580445110798,
-0.07681403309106827,
-0.006891677156090736,
0.005527561530470848,
-0.015171486884355545,
-0.05778385326266289,
0.06816442310810089,
0.021435121074318886,
0.0636233389377594,
0.05651283636689186,
0.046437159180641174,
0.05188612639904022,
0.0015297087375074625,
0.016816115006804466,
-0.0474257655441761,
-0.042130324989557266,
0.023058312013745308,
-0.008374330587685108,
-0.006906973663717508,
0.028087051585316658,
0.003188289003446698,
0.013265712186694145,
-0.08262604475021362,
0.032385777682065964,
0.035625163465738297,
-0.028901027515530586,
-0.04843107610940933,
-0.02414165809750557,
-0.05749424174427986,
-0.054292112588882446,
-0.009504719637334347,
-0.008919013664126396,
-0.11094670742750168,
0.024216100573539734,
-0.004217700567096472,
-0.16481976211071014,
-0.04959635064005852,
0.04241517558693886,
0.007180985528975725,
-0.0033777847420424223,
0.005707870703190565,
0.013968737795948982,
0.11877893656492233,
-0.0016171111492440104,
-0.02273917756974697,
0.06822352111339569,
0.046134982258081436,
0.02968381531536579,
0.002041637897491455,
0.0013521676883101463,
0.060182709246873856,
0.0032905249390751123,
-0.03189462795853615,
-0.0426814965903759,
0.013502067886292934,
0.0011772863799706101,
0.056448664516210556,
0.0030954815447330475,
0.04705432429909706,
-0.01543467864394188,
-0.04787202924489975,
0.07415599375963211,
0.033524733036756516,
-0.009302355349063873,
0.003446914255619049,
-0.02187301777303219,
0.012620409950613976,
-0.015682172030210495,
0.05955793708562851,
0.01802658662199974,
0.029144708067178726,
-0.016242174431681633,
0.06508922576904297,
0.007303833495825529,
-0.06776387244462967,
-0.008172283880412579,
0.007743405178189278,
-0.03371262922883034,
-0.050177957862615585,
0.043221667408943176,
0.00702991196885705,
0.010948550887405872,
0.014740431681275368,
-0.03790866211056709,
0.03631756082177162,
-3.882485557375223e-33,
-0.011114229448139668,
0.022763049229979515,
-0.08622539788484573,
0.060248930007219315,
-0.016748933121562004,
-0.07273416221141815,
-0.04582221433520317,
0.0720299556851387,
-0.04636508971452713,
-0.02834259904921055,
0.05434597656130791,
-0.005147624295204878,
-0.008162965066730976,
-0.022115767002105713,
0.004840537905693054,
-0.05495062470436096,
0.04391966760158539,
-0.08786512911319733,
-0.03769223019480705,
-0.041307106614112854,
-0.034336090087890625,
-0.027471888810396194,
0.020166272297501564,
-0.015862630680203438,
0.0012585098156705499,
-0.021084435284137726,
0.016234824433922768,
0.0020525562576949596,
0.009332952089607716,
-0.05570438131690025,
0.09027087688446045,
-0.016272177919745445,
-0.019931254908442497,
0.012967027723789215,
-0.010542243719100952,
0.01979255862534046,
0.05804084986448288,
0.07903864979743958,
-0.0163144301623106,
-0.02598627284169197,
0.13168014585971832,
0.06272780150175095,
-0.02498944289982319,
-0.012834081426262856,
0.10258001834154129,
-0.030175307765603065,
-0.05414070188999176,
0.06301319599151611,
-0.05148056894540787,
-0.00957730133086443,
-0.005237670615315437,
-0.024127181619405746,
0.028920939192175865,
0.03077816031873226,
0.036410171538591385,
0.00016878254245966673,
0.0844130665063858,
0.03245209902524948,
0.02750997059047222,
-0.02574864961206913,
0.0650726705789566,
-0.08384716510772705,
-0.048470236361026764,
0.10642434656620026,
-0.016902096569538116,
-0.010505462996661663,
-0.018514780327677727,
0.01671791821718216,
0.010085860267281532,
0.01661766692996025,
0.02697715535759926,
0.04332098364830017,
-0.08299236744642258,
-0.043145086616277695,
0.0349382720887661,
0.023933855816721916,
-0.02795940451323986,
-0.004159706644713879,
-0.06522461771965027,
0.03681526333093643,
-0.02280234917998314,
0.07233601063489914,
-0.07225215435028076,
-0.00955805554986,
0.05288127064704895,
-0.06080480292439461,
0.021548287943005562,
-0.012720378115773201,
-0.05131541192531586,
-0.06316626816987991,
-0.04353819042444229,
0.03979746252298355,
-0.13520057499408722,
0.036466553807258606,
0.019816497340798378,
-4.4565116041894726e-8,
-0.012985782697796822,
-0.024523785337805748,
-0.06523453444242477,
0.052854329347610474,
0.05340385437011719,
-0.03741920739412308,
-0.04499884322285652,
0.04339848831295967,
0.061455126851797104,
0.003270468208938837,
-0.06613112986087799,
-0.035450421273708344,
0.003288848092779517,
-0.03623700514435768,
0.03476530313491821,
0.005752405617386103,
0.03605550155043602,
-0.07923141866922379,
-0.023215405642986298,
-0.02363099344074726,
0.020480947569012642,
-0.1287398636341095,
0.01439877413213253,
0.10807695239782333,
-0.0240773968398571,
0.01447256188839674,
0.11196981370449066,
0.023918023332953453,
-0.046960096806287766,
-0.0817258432507515,
-0.03123411349952221,
-0.0017649490619078279,
0.04910929873585701,
0.038085147738456726,
-0.05547773838043213,
0.10790932923555374,
-0.09905186295509338,
0.013570737093687057,
0.01267273910343647,
0.06110431253910065,
0.026790428906679153,
-0.007092488929629326,
-0.017813434824347496,
0.04080747440457344,
0.13736049830913544,
0.009665660560131073,
0.039588481187820435,
0.043972525745630264,
-0.05563173443078995,
-0.00001718278508633375,
0.016622716560959816,
0.006402480415999889,
-0.06087089702486992,
-0.04456137493252754,
-0.0041362689808011055,
-0.019748423248529434,
-0.009735001251101494,
-0.0504818931221962,
-0.027035726234316826,
0.012320475652813911,
0.09050093591213226,
0.08198325335979462,
0.009971744380891323,
-0.015964308753609657
] | 0.073862 |
`waitForTrailers` option must be set for this event to be emitted. #### `http2stream.aborted` \* Type: {boolean} Set to `true` if the `Http2Stream` instance was aborted abnormally. When set, the `'aborted'` event will have been emitted. #### `http2stream.bufferSize` \* Type: {number} This property shows the number of characters currently buffered to be written. See [`net.Socket.bufferSize`][] for details. #### `http2stream.close(code[, callback])` \* `code` {number} Unsigned 32-bit integer identifying the error code. \*\*Default:\*\* `http2.constants.NGHTTP2\_NO\_ERROR` (`0x00`). \* `callback` {Function} An optional function registered to listen for the `'close'` event. Closes the `Http2Stream` instance by sending an `RST\_STREAM` frame to the connected HTTP/2 peer. #### `http2stream.closed` \* Type: {boolean} Set to `true` if the `Http2Stream` instance has been closed. #### `http2stream.destroyed` \* Type: {boolean} Set to `true` if the `Http2Stream` instance has been destroyed and is no longer usable. #### `http2stream.endAfterHeaders` \* Type: {boolean} Set to `true` if the `END\_STREAM` flag was set in the request or response HEADERS frame received, indicating that no additional data should be received and the readable side of the `Http2Stream` will be closed. #### `http2stream.id` \* Type: {number|undefined} The numeric stream identifier of this `Http2Stream` instance. Set to `undefined` if the stream identifier has not yet been assigned. #### `http2stream.pending` \* Type: {boolean} Set to `true` if the `Http2Stream` instance has not yet been assigned a numeric stream identifier. #### `http2stream.priority(options)` > Stability: 0 - Deprecated: support for priority signaling has been deprecated > in the [RFC 9113][] and is no longer supported in Node.js. Empty method, only there to maintain some backward compatibility. #### `http2stream.rstCode` \* Type: {number} Set to the `RST\_STREAM` [error code][] reported when the `Http2Stream` is destroyed after either receiving an `RST\_STREAM` frame from the connected peer, calling `http2stream.close()`, or `http2stream.destroy()`. Will be `undefined` if the `Http2Stream` has not been closed. #### `http2stream.sentHeaders` \* Type: {HTTP/2 Headers Object} An object containing the outbound headers sent for this `Http2Stream`. #### `http2stream.sentInfoHeaders` \* Type: {HTTP/2 Headers Object\[]} An array of objects containing the outbound informational (additional) headers sent for this `Http2Stream`. #### `http2stream.sentTrailers` \* Type: {HTTP/2 Headers Object} An object containing the outbound trailers sent for this `HttpStream`. #### `http2stream.session` \* Type: {Http2Session} A reference to the `Http2Session` instance that owns this `Http2Stream`. The value will be `undefined` after the `Http2Stream` instance is destroyed. #### `http2stream.setTimeout(msecs, callback)` \* `msecs` {number} \* `callback` {Function} ```mjs import { connect, constants } from 'node:http2'; const client = connect('http://example.org:8000'); const { NGHTTP2\_CANCEL } = constants; const req = client.request({ ':path': '/' }); // Cancel the stream if there's no activity after 5 seconds req.setTimeout(5000, () => req.close(NGHTTP2\_CANCEL)); ``` ```cjs const http2 = require('node:http2'); const client = http2.connect('http://example.org:8000'); const { NGHTTP2\_CANCEL } = http2.constants; const req = client.request({ ':path': '/' }); // Cancel the stream if there's no activity after 5 seconds req.setTimeout(5000, () => req.close(NGHTTP2\_CANCEL)); ``` #### `http2stream.state` Provides miscellaneous information about the current state of the `Http2Stream`. \* Type: {Object} \* `localWindowSize` {number} The number of bytes the connected peer may send for this `Http2Stream` without receiving a `WINDOW\_UPDATE`. \* `state` {number} A flag indicating the low-level current state of the `Http2Stream` as determined by `nghttp2`. \* `localClose` {number} `1` if this `Http2Stream` has been closed locally. \* `remoteClose` {number} `1` if this `Http2Stream` has been closed remotely. \* `sumDependencyWeight` {number} Legacy property, always set to `0`. \* `weight` {number} Legacy property, always set to `16`. A current state of this `Http2Stream`. #### `http2stream.sendTrailers(headers)` \* `headers` {HTTP/2 Headers Object} Sends a trailing `HEADERS` frame to the connected HTTP/2 peer. This method will cause the `Http2Stream` to be immediately closed and must only be called after the `'wantTrailers'` event has been | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.01644567959010601,
0.007619614712893963,
-0.045784931629896164,
0.01374503131955862,
0.035551272332668304,
0.003141202498227358,
-0.047420989722013474,
0.04027106985449791,
0.07981985062360764,
0.012771189212799072,
-0.03599122539162636,
0.017080780118703842,
-0.06672578305006027,
0.0004565258277580142,
0.01985464058816433,
-0.0230315662920475,
-0.0144027816131711,
-0.020389271900057793,
-0.06466693431138992,
-0.08449622988700867,
0.035507507622241974,
0.02967502921819687,
0.020671196281909943,
-0.006422115955501795,
0.008471740409731865,
0.02066412940621376,
-0.05268027260899544,
-0.039993125945329666,
0.04591735824942589,
0.01313241571187973,
0.0763169601559639,
-0.10017568618059158,
-0.15018965303897858,
-0.037532806396484375,
-0.03185533359646797,
0.03320731595158577,
0.009089103899896145,
-0.01321766059845686,
-0.06045406684279442,
0.03665144741535187,
0.1292850524187088,
-0.021550487726926804,
-0.08690773695707321,
-0.05513659492135048,
-0.05492547154426575,
0.03994692489504814,
-0.07746350020170212,
0.03905663639307022,
-0.055633094161748886,
-0.04853828623890877,
-0.05995631590485573,
0.012724311091005802,
-0.05196986347436905,
0.04781943932175636,
0.06618223339319229,
-0.12541919946670532,
-0.01646372489631176,
0.06594327837228775,
-0.04027676582336426,
0.012004544958472252,
-0.02276076376438141,
-0.028835363686084747,
0.00032880684011615813,
-0.024336887523531914,
0.00018996561993844807,
-0.015320412814617157,
-0.025965847074985504,
0.005583408288657665,
0.033390261232852936,
0.08903449773788452,
-0.016208110377192497,
0.04505881667137146,
-0.07841220498085022,
0.023553382605314255,
0.005666420329362154,
-0.0628383606672287,
-0.022786850109696388,
0.03199976682662964,
-0.10004358738660812,
0.005204395391047001,
0.02368757128715515,
-0.1539880484342575,
-0.028339808806777,
0.02106299065053463,
0.014348248951137066,
0.04006081447005272,
0.055517759174108505,
0.035292964428663254,
-0.019383423030376434,
-0.017376476898789406,
-0.06024575233459473,
0.08320826292037964,
0.07053365558385849,
0.11001525819301605,
-0.028404414653778076,
0.038074564188718796,
0.011775643564760685,
0.04060734063386917,
-0.041640277951955795,
-0.00023897216306068003,
-0.0006881110020913184,
-0.045656751841306686,
0.0038219850976020098,
-0.016009854152798653,
0.024216381832957268,
-0.048158783465623856,
0.023839734494686127,
0.07777365297079086,
0.12548033893108368,
-0.0369853712618351,
0.052329204976558685,
-0.024294650182127953,
-0.006090397946536541,
0.017362141981720924,
-0.013220838271081448,
0.08671344816684723,
-0.001248388085514307,
0.03807102516293526,
0.048361919820308685,
0.10690586268901825,
0.10171635448932648,
-0.0057015311904251575,
-0.023020384833216667,
-0.031191784888505936,
0.04548802599310875,
-0.04070758447051048,
0.1236739233136177,
3.9328022257201866e-33,
-0.023638715967535973,
-0.07166646420955658,
-0.1531887948513031,
0.08481191843748093,
0.0019011570839211345,
-0.002691731322556734,
-0.013670518063008785,
-0.0011483363341540098,
-0.029733067378401756,
-0.01887294091284275,
-0.017582159489393234,
-0.16660073399543762,
-0.006426369771361351,
0.025471951812505722,
0.030995849519968033,
-0.05668305233120918,
0.08143811672925949,
-0.01866687275469303,
0.10317346453666687,
0.06070796400308609,
0.058089349418878555,
-0.013347108848392963,
-0.0004841984191443771,
0.025940652936697006,
-0.014572866261005402,
-0.0069703334011137486,
-0.015360766090452671,
-0.044311609119176865,
-0.024633340537548065,
0.018596433103084564,
0.04907897859811783,
0.011989661492407322,
0.012815765105187893,
-0.015656903386116028,
0.04335492476820946,
-0.10139022767543793,
-0.04522499814629555,
0.0054475064389407635,
-0.05329442024230957,
-0.059500373899936676,
-0.005507222376763821,
0.002285825554281473,
-0.16867823898792267,
0.045228831470012665,
-0.0042618256993591785,
-0.1597311645746231,
-0.04156557470560074,
0.02194180153310299,
0.002336854347959161,
-0.01397317461669445,
-0.017727268859744072,
0.08430559933185577,
0.06505618989467621,
0.025304004549980164,
0.05850452184677124,
0.012769844383001328,
0.004121084697544575,
0.03811945766210556,
-0.01722744293510914,
-0.04713589698076248,
0.02536078728735447,
0.023646745830774307,
0.025536108762025833,
-0.08324383944272995,
0.052535220980644226,
0.0026048996951431036,
0.03190178796648979,
0.022941168397665024,
-0.01633642613887787,
0.018368961289525032,
-0.058984339237213135,
-0.015327117405831814,
0.07139080762863159,
0.07218337059020996,
-0.008835721760988235,
0.012699589133262634,
0.023952985182404518,
0.0018226885003969073,
0.0482160709798336,
-0.008780723437666893,
0.07472537457942963,
-0.045442063361406326,
0.0560736209154129,
-0.023606907576322556,
-0.05128050595521927,
-0.04098896309733391,
-0.00613267719745636,
-0.006921945605427027,
-0.08378374576568604,
0.06711990386247635,
-0.02481689676642418,
0.010622813366353512,
-0.017565572634339333,
-0.05211649835109711,
0.009567462839186192,
-6.199450677061201e-33,
-0.026687053963541985,
0.046517595648765564,
-0.06495959311723709,
0.06088750436902046,
-0.00583800021559,
-0.07423827797174454,
0.028417984023690224,
0.026960458606481552,
-0.012066297233104706,
0.02788432314991951,
0.051204416900873184,
0.05132969096302986,
0.0025011489633470774,
0.025268491357564926,
-0.035914551466703415,
-0.042385298758745193,
-0.00199523544870317,
-0.005510570481419563,
0.07655776292085648,
-0.03417561575770378,
0.011051390320062637,
-0.05396834388375282,
0.03339403122663498,
0.02449147216975689,
-0.024730540812015533,
0.023863401263952255,
0.05637754872441292,
-0.03770119324326515,
-0.05860172584652901,
-0.07803612947463989,
0.06273500621318817,
0.0302593857049942,
-0.02852768823504448,
0.02380458265542984,
-0.013867474161088467,
-0.0578426830470562,
0.08037152886390686,
0.03223372995853424,
-0.03729573264718056,
0.04250742122530937,
0.15068720281124115,
0.04476163536310196,
0.023473452776670456,
-0.0686517283320427,
0.05656174197793007,
-0.0012769680470228195,
-0.007060597650706768,
0.005814108531922102,
-0.09617538005113602,
-0.03660140931606293,
-0.002974004251882434,
0.055866777896881104,
0.035119637846946716,
0.10031352937221527,
0.047619182616472244,
-0.009092367254197598,
0.037746772170066833,
0.012543776072561741,
0.055221766233444214,
0.006100015714764595,
0.016129931434988976,
-0.10991224646568298,
0.007584556005895138,
0.01715315878391266,
0.013827274553477764,
-0.0036010215990245342,
-0.0722617357969284,
0.0179336778819561,
0.02931336499750614,
0.055394891649484634,
0.004349212162196636,
-0.00818003062158823,
-0.04207589849829674,
0.016378242522478104,
-0.05034328252077103,
0.025134257972240448,
-0.028138097375631332,
-0.022824261337518692,
0.01976056583225727,
0.053952306509017944,
-0.007588095963001251,
0.07943608611822128,
-0.0386049784719944,
-0.058803990483284,
0.08083771914243698,
0.00988336093723774,
-0.017352959141135216,
0.044146813452243805,
-0.061561502516269684,
-0.06684178113937378,
-0.008700456470251083,
0.02505594864487648,
-0.0956965833902359,
-0.06383758783340454,
0.029729662463068962,
-4.9559183423752984e-8,
-0.04748229309916496,
-0.027730224654078484,
-0.046668704599142075,
0.011200854554772377,
-0.016898414120078087,
-0.0392562560737133,
-0.09308154881000519,
-0.0508049800992012,
0.021347491070628166,
0.03325168788433075,
-0.044184669852256775,
-0.015452268533408642,
0.05949552357196808,
0.012397278100252151,
0.03046034835278988,
-0.05390008166432381,
0.00032918908982537687,
-0.050523847341537476,
0.035224080085754395,
-0.045665644109249115,
0.07477253675460815,
-0.07292834669351578,
-0.0004541203088592738,
0.003951920662075281,
-0.030473047867417336,
-0.02989519201219082,
0.06720565259456635,
0.038736987859010696,
-0.0899776741862297,
-0.1348489373922348,
-0.004479278810322285,
0.008355041034519672,
0.04862752556800842,
-0.003468910465016961,
-0.041419897228479385,
0.046127039939165115,
-0.0503285676240921,
-0.00018624924996402115,
0.029350370168685913,
0.027366364374756813,
0.09315112233161926,
-0.03942199423909187,
-0.0008495354559272528,
0.04740939661860466,
0.1091097891330719,
0.017752714455127716,
0.06981878727674484,
0.04722609370946884,
-0.055974580347537994,
-0.010136664845049381,
0.04775732383131981,
-0.024658741429448128,
-0.01384984515607357,
-0.03041861392557621,
0.01358846202492714,
-0.06796783208847046,
-0.01834927871823311,
-0.05242908000946045,
-0.05751389265060425,
-0.05599817633628845,
0.10256990790367126,
0.04627179726958275,
-0.017877846956253052,
-0.057003460824489594
] | 0.001671 |
Legacy property, always set to `16`. A current state of this `Http2Stream`. #### `http2stream.sendTrailers(headers)` \* `headers` {HTTP/2 Headers Object} Sends a trailing `HEADERS` frame to the connected HTTP/2 peer. This method will cause the `Http2Stream` to be immediately closed and must only be called after the `'wantTrailers'` event has been emitted. When sending a request or sending a response, the `options.waitForTrailers` option must be set in order to keep the `Http2Stream` open after the final `DATA` frame so that trailers can be sent. ```mjs import { createServer } from 'node:http2'; const server = createServer(); server.on('stream', (stream) => { stream.respond(undefined, { waitForTrailers: true }); stream.on('wantTrailers', () => { stream.sendTrailers({ xyz: 'abc' }); }); stream.end('Hello World'); }); ``` ```cjs const http2 = require('node:http2'); const server = http2.createServer(); server.on('stream', (stream) => { stream.respond(undefined, { waitForTrailers: true }); stream.on('wantTrailers', () => { stream.sendTrailers({ xyz: 'abc' }); }); stream.end('Hello World'); }); ``` The HTTP/1 specification forbids trailers from containing HTTP/2 pseudo-header fields (e.g. `':method'`, `':path'`, etc). ### Class: `ClientHttp2Stream` \* Extends {Http2Stream} The `ClientHttp2Stream` class is an extension of `Http2Stream` that is used exclusively on HTTP/2 Clients. `Http2Stream` instances on the client provide events such as `'response'` and `'push'` that are only relevant on the client. #### Event: `'continue'` Emitted when the server sends a `100 Continue` status, usually because the request contained `Expect: 100-continue`. This is an instruction that the client should send the request body. #### Event: `'headers'` \* `headers` {HTTP/2 Headers Object} \* `flags` {number} \* `rawHeaders` {HTTP/2 Raw Headers} The `'headers'` event is emitted when an additional block of headers is received for a stream, such as when a block of `1xx` informational headers is received. The listener callback is passed the [HTTP/2 Headers Object][], flags associated with the headers, and the headers in raw format (see [HTTP/2 Raw Headers][]). ```js stream.on('headers', (headers, flags) => { console.log(headers); }); ``` #### Event: `'push'` \* `headers` {HTTP/2 Headers Object} \* `flags` {number} The `'push'` event is emitted when response headers for a Server Push stream are received. The listener callback is passed the [HTTP/2 Headers Object][] and flags associated with the headers. ```js stream.on('push', (headers, flags) => { console.log(headers); }); ``` #### Event: `'response'` \* `headers` {HTTP/2 Headers Object} \* `flags` {number} \* `rawHeaders` {HTTP/2 Raw Headers} The `'response'` event is emitted when a response `HEADERS` frame has been received for this stream from the connected HTTP/2 server. The listener is invoked with three arguments: an `Object` containing the received [HTTP/2 Headers Object][], flags associated with the headers, and the headers in raw format (see [HTTP/2 Raw Headers][]). ```mjs import { connect } from 'node:http2'; const client = connect('https://localhost'); const req = client.request({ ':path': '/' }); req.on('response', (headers, flags) => { console.log(headers[':status']); }); ``` ```cjs const http2 = require('node:http2'); const client = http2.connect('https://localhost'); const req = client.request({ ':path': '/' }); req.on('response', (headers, flags) => { console.log(headers[':status']); }); ``` ### Class: `ServerHttp2Stream` \* Extends: {Http2Stream} The `ServerHttp2Stream` class is an extension of [`Http2Stream`][] that is used exclusively on HTTP/2 Servers. `Http2Stream` instances on the server provide additional methods such as `http2stream.pushStream()` and `http2stream.respond()` that are only relevant on the server. #### `http2stream.additionalHeaders(headers)` \* `headers` {HTTP/2 Headers Object} Sends an additional informational `HEADERS` frame to the connected HTTP/2 peer. #### `http2stream.headersSent` \* Type: {boolean} True if headers were sent, false otherwise (read-only). #### `http2stream.pushAllowed` \* Type: {boolean} Read-only property mapped to the `SETTINGS\_ENABLE\_PUSH` flag of the remote client's most recent `SETTINGS` frame. Will be `true` if the remote peer accepts push streams, `false` otherwise. Settings are the same for every `Http2Stream` in the same `Http2Session`. #### `http2stream.pushStream(headers[, options], callback)` \* `headers` {HTTP/2 Headers Object} \* | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.019087687134742737,
0.051265474408864975,
0.011090229265391827,
-0.00014992286742199212,
0.041630957275629044,
-0.058045994490385056,
-0.08082893490791321,
0.029225913807749748,
0.08450715243816376,
-0.003330834675580263,
-0.01758824661374092,
0.033405423164367676,
-0.06235402077436447,
0.029355086386203766,
0.05298548564314842,
-0.002074076561257243,
0.007378356996923685,
-0.031051818281412125,
-0.034703973680734634,
-0.06267465651035309,
0.05068698152899742,
-0.02573608234524727,
0.05255619063973427,
-0.024624701589345932,
-0.012763977982103825,
0.016427049413323402,
-0.0769621729850769,
-0.010670161806046963,
0.08573988825082779,
-0.001892729545943439,
0.08805561065673828,
-0.08285454660654068,
-0.18202565610408783,
-0.016756514087319374,
-0.055655065923929214,
0.031146490946412086,
0.00021648258552886546,
-0.05187106132507324,
-0.08248487114906311,
0.018704505637288094,
0.10355891287326813,
0.027931811287999153,
-0.0867871642112732,
-0.04546787589788437,
-0.04851166158914566,
0.03673974797129631,
-0.011197162792086601,
0.036459047347307205,
-0.030006209388375282,
0.01905452460050583,
-0.08311104774475098,
-0.015423405915498734,
-0.049089476466178894,
0.06771338731050491,
0.041510313749313354,
-0.01824072375893593,
-0.029226994141936302,
0.08475533872842789,
0.014024337753653526,
-0.02087206020951271,
-0.03910023346543312,
-0.07346010953187943,
0.02692745439708233,
-0.029750969260931015,
-0.007895556278526783,
-0.059691283851861954,
-0.020133716985583305,
0.10132798552513123,
0.016703736037015915,
0.07223767042160034,
0.03980369120836258,
0.01934138499200344,
-0.04393402114510536,
-0.0007060756906867027,
-0.007642032112926245,
-0.09152008593082428,
-0.03520650044083595,
0.0623936653137207,
-0.07504414767026901,
0.059903066605329514,
-0.0013077143812552094,
-0.13369245827198029,
-0.036321014165878296,
-0.022887594997882843,
-0.043221622705459595,
0.03920884430408478,
0.009782462380826473,
0.020899498835206032,
-0.029017796739935875,
0.03826076164841652,
-0.10107175260782242,
-0.004612162709236145,
0.021230053156614304,
0.08860209584236145,
-0.03813842311501503,
0.05791216343641281,
0.002104321261867881,
0.014384917914867401,
0.014088128693401814,
0.009834501892328262,
0.035895124077796936,
-0.055437780916690826,
0.018317457288503647,
0.03487036004662514,
0.03544125333428383,
-0.11457882821559906,
-0.042986657470464706,
0.11263220012187958,
0.05457346886396408,
-0.006771182641386986,
0.009118224494159222,
-0.00009132533887168393,
0.058207061141729355,
-0.00694932509213686,
-0.0548318549990654,
0.04597043618559837,
0.00027910436620004475,
0.05769844725728035,
0.06351765990257263,
0.020500410348176956,
0.08071640878915787,
-0.03285612165927887,
0.035831570625305176,
-0.05230782926082611,
0.0963958352804184,
-0.03515901044011116,
0.09827426820993423,
2.021848263033419e-33,
-0.058752115815877914,
-0.07932762056589127,
-0.12371879070997238,
0.11274751275777817,
-0.003639946458861232,
-0.0219128280878067,
0.016931110993027687,
0.04076218232512474,
-0.0707186758518219,
-0.04364996403455734,
-0.027521919459104538,
-0.10236407071352005,
-0.0010829748352989554,
0.011839817278087139,
-0.004727266263216734,
-0.09687253087759018,
0.0680299922823906,
-0.04315512999892235,
0.06857404857873917,
0.06441230326890945,
0.0002441435353830457,
0.02239205874502659,
0.01505593117326498,
-0.04782496765255928,
-0.035720545798540115,
-0.04172242805361748,
-0.03126524016261101,
-0.007866264320909977,
-0.07055497914552689,
0.003129107179120183,
0.061493899673223495,
0.010869096033275127,
0.020277703180909157,
-0.010933808982372284,
0.07050829380750656,
-0.057738665491342545,
-0.008991328999400139,
-0.010776136070489883,
-0.0816139355301857,
-0.06352808326482773,
-0.009308609180152416,
0.0261528380215168,
-0.15171445906162262,
0.03395278751850128,
-0.04934970289468765,
-0.10457085818052292,
0.006198154296725988,
-0.006775456480681896,
-0.022436875849962234,
-0.0119189927354455,
-0.014960892498493195,
0.06805646419525146,
0.056221574544906616,
-0.005865481216460466,
0.04674298316240311,
0.0703800693154335,
-0.015746183693408966,
-0.011837366968393326,
-0.07834171503782272,
-0.05306239798665047,
0.001846529426984489,
0.031859297305345535,
0.020477402955293655,
-0.08504617214202881,
0.05323178321123123,
0.004412396345287561,
0.039680544286966324,
0.0508316233754158,
0.03514012321829796,
-0.029462244361639023,
-0.03785177320241928,
0.008273251354694366,
0.0744856595993042,
0.029739022254943848,
0.017727257683873177,
0.04145444184541702,
-0.00832994095981121,
-0.0075440676882863045,
0.11034883558750153,
-0.03130009397864342,
0.08300479501485825,
-0.010724241845309734,
0.051741886883974075,
0.06881062686443329,
-0.005315771326422691,
-0.042689476162195206,
-0.033831655979156494,
-0.06491264700889587,
-0.02730540931224823,
0.1409551501274109,
-0.05591732636094093,
0.011717163026332855,
0.01061710249632597,
-0.0004554868210107088,
0.008842463605105877,
-3.747174035310085e-33,
0.009772192686796188,
0.03911006078124046,
-0.060194872319698334,
0.06099618971347809,
0.043555598706007004,
-0.009149408899247646,
0.028787169605493546,
-0.01298675499856472,
0.02215864695608616,
0.04658715799450874,
0.038961682468652725,
0.029891526326537132,
-0.019507456570863724,
0.017228133976459503,
0.013015764765441418,
-0.01502709835767746,
0.05546722561120987,
-0.05400476232171059,
0.031154192984104156,
-0.11745426058769226,
-0.03209364786744118,
-0.0501304492354393,
-0.036112938076257706,
0.008070599287748337,
0.00697143143042922,
0.016949279233813286,
-0.0060515208169817924,
0.0038375048898160458,
-0.09376204013824463,
-0.07689990848302841,
0.017862405627965927,
-0.0406152717769146,
-0.005756204482167959,
0.020851369947195053,
0.010095004923641682,
-0.02789832465350628,
0.038765937089920044,
0.09312553703784943,
-0.0029120573308318853,
0.015552314929664135,
0.11010556668043137,
0.05491067096590996,
0.0010122990934178233,
0.01161055825650692,
0.026526672765612602,
0.012468407861888409,
-0.020209480077028275,
0.028369758278131485,
-0.0478111170232296,
0.009075356647372246,
-0.038974057883024216,
0.02604556269943714,
0.027087483555078506,
0.03318992629647255,
0.04968471825122833,
-0.05629432946443558,
0.008945184759795666,
-0.0008833739557303488,
0.055643413215875626,
0.03927449882030487,
0.10072356462478638,
-0.13835358619689941,
-0.011311555281281471,
0.0375460721552372,
0.051103923469781876,
-0.029456403106451035,
-0.05532023310661316,
-0.002763263648375869,
0.020839758217334747,
0.034011296927928925,
0.01387951523065567,
-0.01296850573271513,
-0.030375560745596886,
-0.01905742660164833,
0.051883891224861145,
-0.006881398614495993,
-0.025988159701228142,
-0.06296385824680328,
0.012846912257373333,
-0.009251217357814312,
-0.04918496310710907,
0.08084364980459213,
-0.08987697958946228,
-0.024133967235684395,
0.13054372370243073,
0.014963357709348202,
0.024677474051713943,
0.0036642001941800117,
-0.034807708114385605,
-0.05571409687399864,
0.032800350338220596,
0.022157464176416397,
-0.12047093361616135,
-0.019736237823963165,
-0.012551353313028812,
-5.050848628229687e-8,
-0.10802814364433289,
-0.026019960641860962,
-0.059902921319007874,
0.015385173261165619,
-0.006953007075935602,
0.01258984673768282,
-0.03605537489056587,
0.030401675030589104,
0.051962710916996,
-0.0372522808611393,
0.010225760750472546,
-0.008534697815775871,
0.04806709662079811,
-0.02328503504395485,
0.03808213025331497,
-0.07254905998706818,
0.0037462101317942142,
-0.11695659160614014,
-0.006511343643069267,
-0.03805433213710785,
0.03150220960378647,
-0.031198635697364807,
-0.0132911903783679,
0.02965281903743744,
-0.021382026374340057,
-0.027834452688694,
0.09628134965896606,
0.021958790719509125,
-0.010616172105073929,
-0.0564458929002285,
-0.08457725495100021,
0.026248954236507416,
0.018049171194434166,
0.02951856330037117,
-0.027162527665495872,
0.023457083851099014,
-0.05203653499484062,
0.02488771267235279,
0.03900192677974701,
0.027549996972084045,
0.12166890501976013,
0.010615880601108074,
-0.019891364499926567,
0.04361632838845253,
0.05651591345667839,
0.09062442183494568,
0.06033498793840408,
0.04574542120099068,
-0.0564679317176342,
-0.009977702051401138,
0.05851033329963684,
-0.04229658097028732,
-0.035405270755290985,
0.011251311749219894,
0.04822992533445358,
-0.0880509614944458,
0.029199326410889626,
-0.06429825723171234,
-0.04430433735251427,
-0.04379585385322571,
0.07286198437213898,
0.07518602162599564,
-0.02704646624624729,
-0.009756064042448997
] | -0.017804 |
Type: {boolean} Read-only property mapped to the `SETTINGS\_ENABLE\_PUSH` flag of the remote client's most recent `SETTINGS` frame. Will be `true` if the remote peer accepts push streams, `false` otherwise. Settings are the same for every `Http2Stream` in the same `Http2Session`. #### `http2stream.pushStream(headers[, options], callback)` \* `headers` {HTTP/2 Headers Object} \* `options` {Object} \* `exclusive` {boolean} When `true` and `parent` identifies a parent Stream, the created stream is made the sole direct dependency of the parent, with all other existing dependents made a dependent of the newly created stream. \*\*Default:\*\* `false`. \* `parent` {number} Specifies the numeric identifier of a stream the newly created stream is dependent on. \* `callback` {Function} Callback that is called once the push stream has been initiated. \* `err` {Error} \* `pushStream` {ServerHttp2Stream} The returned `pushStream` object. \* `headers` {HTTP/2 Headers Object} Headers object the `pushStream` was initiated with. Initiates a push stream. The callback is invoked with the new `Http2Stream` instance created for the push stream passed as the second argument, or an `Error` passed as the first argument. ```mjs import { createServer } from 'node:http2'; const server = createServer(); server.on('stream', (stream) => { stream.respond({ ':status': 200 }); stream.pushStream({ ':path': '/' }, (err, pushStream, headers) => { if (err) throw err; pushStream.respond({ ':status': 200 }); pushStream.end('some pushed data'); }); stream.end('some data'); }); ``` ```cjs const http2 = require('node:http2'); const server = http2.createServer(); server.on('stream', (stream) => { stream.respond({ ':status': 200 }); stream.pushStream({ ':path': '/' }, (err, pushStream, headers) => { if (err) throw err; pushStream.respond({ ':status': 200 }); pushStream.end('some pushed data'); }); stream.end('some data'); }); ``` Setting the weight of a push stream is not allowed in the `HEADERS` frame. Pass a `weight` value to `http2stream.priority` with the `silent` option set to `true` to enable server-side bandwidth balancing between concurrent streams. Calling `http2stream.pushStream()` from within a pushed stream is not permitted and will throw an error. #### `http2stream.respond([headers[, options]])` \* `headers` {HTTP/2 Headers Object|HTTP/2 Raw Headers} \* `options` {Object} \* `endStream` {boolean} Set to `true` to indicate that the response will not include payload data. \* `waitForTrailers` {boolean} When `true`, the `Http2Stream` will emit the `'wantTrailers'` event after the final `DATA` frame has been sent. ```mjs import { createServer } from 'node:http2'; const server = createServer(); server.on('stream', (stream) => { stream.respond({ ':status': 200 }); stream.end('some data'); }); ``` ```cjs const http2 = require('node:http2'); const server = http2.createServer(); server.on('stream', (stream) => { stream.respond({ ':status': 200 }); stream.end('some data'); }); ``` Initiates a response. When the `options.waitForTrailers` option is set, the `'wantTrailers'` event will be emitted immediately after queuing the last chunk of payload data to be sent. The `http2stream.sendTrailers()` method can then be used to sent trailing header fields to the peer. When `options.waitForTrailers` is set, the `Http2Stream` will not automatically close when the final `DATA` frame is transmitted. User code must call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`. ```mjs import { createServer } from 'node:http2'; const server = createServer(); server.on('stream', (stream) => { stream.respond({ ':status': 200 }, { waitForTrailers: true }); stream.on('wantTrailers', () => { stream.sendTrailers({ ABC: 'some value to send' }); }); stream.end('some data'); }); ``` ```cjs const http2 = require('node:http2'); const server = http2.createServer(); server.on('stream', (stream) => { stream.respond({ ':status': 200 }, { waitForTrailers: true }); stream.on('wantTrailers', () => { stream.sendTrailers({ ABC: 'some value to send' }); }); stream.end('some data'); }); ``` #### `http2stream.respondWithFD(fd[, headers[, options]])` \* `fd` {number|FileHandle} A readable file descriptor. \* `headers` {HTTP/2 Headers Object} \* `options` {Object} \* `statCheck` {Function} \* `waitForTrailers` {boolean} When `true`, the `Http2Stream` will emit the `'wantTrailers'` event after the final `DATA` frame has been sent. \* `offset` {number} The offset position at which | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.06870731711387634,
-0.01782081462442875,
-0.016173819079995155,
0.013117121532559395,
0.03587082028388977,
-0.06280544400215149,
-0.05433914437890053,
0.033620964735746384,
0.07157520949840546,
-0.022492635995149612,
0.028490860015153885,
0.039043210446834564,
-0.019687924534082413,
0.06551939249038696,
0.056767791509628296,
0.010066122747957706,
-0.01670295186340809,
-0.061163049191236496,
-0.0362112857401371,
-0.055977705866098404,
0.04416140541434288,
-0.05124456807971001,
0.011236513033509254,
-0.029099566861987114,
-0.008340566419064999,
0.017669839784502983,
-0.046273764222860336,
-0.013671275228261948,
0.0316799096763134,
-0.007499341852962971,
0.0815063863992691,
-0.017932744696736336,
-0.14644783735275269,
-0.045530449599027634,
-0.09385945647954941,
0.046022288501262665,
0.07738274335861206,
-0.030955079942941666,
-0.027513623237609863,
0.03777804970741272,
0.11088532954454422,
-0.03111821971833706,
-0.030710183084011078,
-0.07400958985090256,
-0.06612241268157959,
0.05969708412885666,
-0.02889946848154068,
0.05080213397741318,
-0.10828682780265808,
-0.038700900971889496,
-0.044969342648983,
-0.049224503338336945,
-0.049878399819135666,
0.07328643649816513,
0.07142725586891174,
0.011668907478451729,
-0.06270860135555267,
0.10592938959598541,
0.006684321444481611,
-0.015580966137349606,
-0.05041014030575752,
-0.02255857363343239,
-0.011184300296008587,
0.012793165631592274,
0.0019416585564613342,
-0.009447788819670677,
-0.047577857971191406,
0.04904928803443909,
0.046177513897418976,
0.0623275563120842,
0.0024557230062782764,
0.05675911158323288,
-0.07323846220970154,
-0.0673413947224617,
0.017484458163380623,
-0.08469297736883163,
-0.020491404458880424,
0.02892129495739937,
-0.06854485720396042,
-0.059210531413555145,
-0.025124341249465942,
-0.12967361509799957,
-0.05306345969438553,
-0.03179559484124184,
-0.03589235991239548,
0.030720509588718414,
0.03799166530370712,
-0.010216346941888332,
0.0008640948799438775,
0.06634404510259628,
-0.08308155834674835,
-0.0160464346408844,
0.07216949015855789,
0.07199272513389587,
-0.052792988717556,
0.08264252543449402,
0.007149584591388702,
-0.056379128247499466,
-0.018851744011044502,
-0.010036422871053219,
0.003926006145775318,
-0.0458119735121727,
0.02884909324347973,
0.029907742515206337,
0.09425564855337143,
-0.14051274955272675,
-0.032496318221092224,
0.08483056724071503,
0.0438866913318634,
-0.04111814871430397,
0.03220265358686447,
0.07196573168039322,
0.07109279930591583,
-0.025936808437108994,
-0.04262760281562805,
0.047183673828840256,
0.05638450011610985,
0.03725855052471161,
0.01467273198068142,
0.002451013308018446,
0.08176496624946594,
-0.03270955756306648,
0.02920989878475666,
0.0008670308161526918,
0.038939110934734344,
-0.06734847277402878,
0.05712692067027092,
3.360405169820859e-33,
0.000436264876043424,
-0.04621277004480362,
-0.09410768747329712,
0.06084950640797615,
-0.004008098971098661,
-0.007385975681245327,
0.03418519347906113,
0.019471051171422005,
-0.05962437763810158,
-0.020394176244735718,
-0.005488087888807058,
-0.0275786891579628,
-0.009627921506762505,
0.07478596270084381,
0.003967070486396551,
-0.05357823148369789,
0.06220848858356476,
-0.00602705916389823,
0.10138766467571259,
0.05410957336425781,
0.013208712451159954,
0.05896877869963646,
-0.029976343736052513,
-0.05291007086634636,
-0.018224943429231644,
-0.0606166236102581,
-0.03514643758535385,
0.00921047292649746,
-0.05272659659385681,
0.005620807409286499,
0.060464322566986084,
-0.008709839545190334,
0.0036221903283149004,
0.03126252442598343,
0.05744553729891777,
-0.05101141333580017,
-0.058469660580158234,
-0.07546000927686691,
-0.05561937019228935,
-0.04119136184453964,
0.08130685985088348,
-0.05353342741727829,
-0.09440229833126068,
0.03124348074197769,
-0.03735239431262016,
-0.07748834788799286,
-0.06533335149288177,
-0.03136152774095535,
0.004922510124742985,
-0.026426568627357483,
-0.02995520457625389,
0.07488144934177399,
0.11720942705869675,
-0.008769209496676922,
0.023805774748325348,
-0.014759955927729607,
-0.033421218395233154,
0.03853265196084976,
-0.03670220077037811,
-0.02240675315260887,
0.04857135936617851,
0.003929040394723415,
-0.011466615833342075,
-0.03330635279417038,
0.012448388151824474,
0.052299223840236664,
0.04005349427461624,
0.015054884366691113,
0.0649784728884697,
-0.043914396315813065,
-0.06638451665639877,
0.04668188840150833,
0.01095186173915863,
0.019743742421269417,
0.03306172043085098,
-0.021733250468969345,
0.03536011651158333,
-0.010806418024003506,
0.10883893072605133,
-0.019961843267083168,
0.000297039543511346,
0.008051147684454918,
0.06001251935958862,
0.06975112855434418,
-0.04066188633441925,
0.015426027588546276,
-0.03683135285973549,
-0.0009030364453792572,
-0.04553653672337532,
0.07618148624897003,
-0.019068771973252296,
-0.017578627914190292,
-0.005304751452058554,
-0.07599464803934097,
0.05864088609814644,
-4.533856364524623e-33,
0.01104932464659214,
0.03765731677412987,
-0.011118610389530659,
0.026574470102787018,
-0.0019156639464199543,
-0.06380542367696762,
-0.0037453919649124146,
0.029892826452851295,
0.06136895716190338,
-0.04354443773627281,
0.007854965515434742,
-0.006975534372031689,
-0.036791909486055374,
-0.007746249437332153,
-0.029920732602477074,
0.03087666817009449,
-0.09595046937465668,
-0.0995744913816452,
-0.015112827531993389,
-0.08978180587291718,
0.0002030941832344979,
-0.047413479536771774,
0.000984973507001996,
0.10437677055597305,
-0.017439281567931175,
-0.021268241107463837,
-0.028521114960312843,
0.03349984064698219,
-0.01990407519042492,
-0.09054625034332275,
0.0021716286428272724,
0.03503258153796196,
-0.033650897443294525,
0.0029204045422375202,
0.0003565046936273575,
-0.05268518999218941,
0.016359321773052216,
0.1546558141708374,
-0.06278543919324875,
0.03918331116437912,
0.0734148696064949,
0.06570789217948914,
-0.019560733810067177,
0.006333705969154835,
0.049557652324438095,
0.09137634932994843,
0.04611263424158096,
0.012722848914563656,
-0.09330887347459793,
0.0014217509888112545,
-0.0014095721999183297,
0.0046498337760567665,
0.05472995340824127,
0.11210159212350845,
0.056198667734861374,
-0.04079277813434601,
0.07192946970462799,
-0.019914180040359497,
0.06936190277338028,
-0.034924350678920746,
0.08286339044570923,
-0.1319529116153717,
-0.08235245943069458,
0.038611143827438354,
-0.04837784171104431,
-0.007288979832082987,
-0.002026130212470889,
0.031552135944366455,
0.016614576801657677,
0.008782017044723034,
0.010507263243198395,
-0.11338409781455994,
-0.0030894444789737463,
-0.09244583547115326,
0.04753231629729271,
0.02766028605401516,
-0.05417181923985481,
-0.061653368175029755,
-0.030903728678822517,
0.08682696521282196,
-0.0332527831196785,
0.05119828134775162,
-0.06310728192329407,
-0.0011488464660942554,
0.080563485622406,
-0.014271103776991367,
0.03647363930940628,
-0.001154177589341998,
-0.040038738399744034,
-0.02712468057870865,
0.013264411129057407,
0.06611502170562744,
-0.12098801136016846,
-0.040753789246082306,
-0.002352097537368536,
-5.0818727004298125e-8,
-0.028038421645760536,
-0.04642125591635704,
-0.03084421716630459,
-0.002225864212960005,
-0.007036841474473476,
-0.008683331310749054,
-0.02101459726691246,
-0.004381556063890457,
-0.0013903890503570437,
-0.04831875115633011,
-0.07223771512508392,
0.008033509366214275,
0.0663393884897232,
-0.010615942999720573,
0.040483258664608,
0.013821806758642197,
-0.0008865846903063357,
-0.020821459591388702,
-0.0032492210157215595,
-0.018243420869112015,
0.05246535688638687,
-0.05831984803080559,
0.030104629695415497,
0.09695795923471451,
0.006729618646204472,
0.02766924723982811,
0.09673386812210083,
0.044775042682886124,
-0.0012796397786587477,
-0.026363525539636612,
0.017095478251576424,
0.024395013228058815,
0.07621584087610245,
0.04555940628051758,
-0.08451732248067856,
0.09131018072366714,
-0.04032161459326744,
0.028735710307955742,
-0.07535012066364288,
0.08713590353727341,
0.09956291317939758,
-0.03761785104870796,
-0.0227718036621809,
0.048934441059827805,
0.03331727162003517,
0.03950746729969978,
0.01870296150445938,
0.03789708390831947,
-0.004532337188720703,
-0.06741588562726974,
-0.018475860357284546,
0.04226360097527504,
-0.02094510942697525,
-0.0025633678305894136,
0.014027833938598633,
-0.015311389230191708,
-0.007136765867471695,
-0.03456028550863266,
-0.033192455768585205,
-0.01479496993124485,
0.10567137598991394,
0.10326918214559555,
0.05859662592411041,
-0.011467409320175648
] | -0.022621 |
#### `http2stream.respondWithFD(fd[, headers[, options]])` \* `fd` {number|FileHandle} A readable file descriptor. \* `headers` {HTTP/2 Headers Object} \* `options` {Object} \* `statCheck` {Function} \* `waitForTrailers` {boolean} When `true`, the `Http2Stream` will emit the `'wantTrailers'` event after the final `DATA` frame has been sent. \* `offset` {number} The offset position at which to begin reading. \* `length` {number} The amount of data from the fd to send. Initiates a response whose data is read from the given file descriptor. No validation is performed on the given file descriptor. If an error occurs while attempting to read data using the file descriptor, the `Http2Stream` will be closed using an `RST\_STREAM` frame using the standard `INTERNAL\_ERROR` code. When used, the `Http2Stream` object's `Duplex` interface will be closed automatically. ```mjs import { createServer } from 'node:http2'; import { openSync, fstatSync, closeSync } from 'node:fs'; const server = createServer(); server.on('stream', (stream) => { const fd = openSync('/some/file', 'r'); const stat = fstatSync(fd); const headers = { 'content-length': stat.size, 'last-modified': stat.mtime.toUTCString(), 'content-type': 'text/plain; charset=utf-8', }; stream.respondWithFD(fd, headers); stream.on('close', () => closeSync(fd)); }); ``` ```cjs const http2 = require('node:http2'); const fs = require('node:fs'); const server = http2.createServer(); server.on('stream', (stream) => { const fd = fs.openSync('/some/file', 'r'); const stat = fs.fstatSync(fd); const headers = { 'content-length': stat.size, 'last-modified': stat.mtime.toUTCString(), 'content-type': 'text/plain; charset=utf-8', }; stream.respondWithFD(fd, headers); stream.on('close', () => fs.closeSync(fd)); }); ``` The optional `options.statCheck` function may be specified to give user code an opportunity to set additional content headers based on the `fs.Stat` details of the given fd. If the `statCheck` function is provided, the `http2stream.respondWithFD()` method will perform an `fs.fstat()` call to collect details on the provided file descriptor. The `offset` and `length` options may be used to limit the response to a specific range subset. This can be used, for instance, to support HTTP Range requests. The file descriptor or `FileHandle` is not closed when the stream is closed, so it will need to be closed manually once it is no longer needed. Using the same file descriptor concurrently for multiple streams is not supported and may result in data loss. Re-using a file descriptor after a stream has finished is supported. When the `options.waitForTrailers` option is set, the `'wantTrailers'` event will be emitted immediately after queuing the last chunk of payload data to be sent. The `http2stream.sendTrailers()` method can then be used to sent trailing header fields to the peer. When `options.waitForTrailers` is set, the `Http2Stream` will not automatically close when the final `DATA` frame is transmitted. User code \_must\_ call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`. ```mjs import { createServer } from 'node:http2'; import { openSync, fstatSync, closeSync } from 'node:fs'; const server = createServer(); server.on('stream', (stream) => { const fd = openSync('/some/file', 'r'); const stat = fstatSync(fd); const headers = { 'content-length': stat.size, 'last-modified': stat.mtime.toUTCString(), 'content-type': 'text/plain; charset=utf-8', }; stream.respondWithFD(fd, headers, { waitForTrailers: true }); stream.on('wantTrailers', () => { stream.sendTrailers({ ABC: 'some value to send' }); }); stream.on('close', () => closeSync(fd)); }); ``` ```cjs const http2 = require('node:http2'); const fs = require('node:fs'); const server = http2.createServer(); server.on('stream', (stream) => { const fd = fs.openSync('/some/file', 'r'); const stat = fs.fstatSync(fd); const headers = { 'content-length': stat.size, 'last-modified': stat.mtime.toUTCString(), 'content-type': 'text/plain; charset=utf-8', }; stream.respondWithFD(fd, headers, { waitForTrailers: true }); stream.on('wantTrailers', () => { stream.sendTrailers({ ABC: 'some value to send' }); }); stream.on('close', () => fs.closeSync(fd)); }); ``` #### `http2stream.respondWithFile(path[, headers[, options]])` \* `path` {string|Buffer|URL} \* `headers` {HTTP/2 Headers Object} \* `options` {Object} \* `statCheck` {Function} \* `onError` {Function} Callback function invoked in the case of an error before send. \* `waitForTrailers` {boolean} When `true`, the `Http2Stream` will emit the `'wantTrailers'` event after the final | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.05201569199562073,
0.04325471073389053,
-0.08777808398008347,
-0.008031822741031647,
0.07449851185083389,
-0.07096303254365921,
-0.017920317128300667,
0.09831283241510391,
0.07861126959323883,
0.014255138114094734,
-0.01093224249780178,
0.012961715459823608,
-0.03795083239674568,
0.004663895815610886,
0.013768765144050121,
-0.09271469712257385,
-0.04407353699207306,
-0.03666573762893677,
-0.05004694312810898,
-0.036067284643650055,
0.03223581239581108,
0.03896749019622803,
0.031208211556077003,
-0.01987423747777939,
-0.058160845190286636,
0.04189841076731682,
-0.10224106907844543,
-0.043364573270082474,
-0.009477629326283932,
0.0017887746216729283,
0.08288728445768356,
-0.04090357571840286,
-0.16333459317684174,
-0.0031070963013917208,
-0.05102410539984703,
0.025255881249904633,
0.029599979519844055,
-0.06133966147899628,
-0.07886604219675064,
0.02241857349872589,
0.016207871958613396,
0.01081247441470623,
-0.11672300100326538,
-0.0036888078320771456,
-0.07671324163675308,
0.037426386028528214,
-0.02333066798746586,
0.0383187010884285,
-0.050775278359651566,
-0.03086697869002819,
-0.08529404550790787,
0.08677732199430466,
-0.03241264447569847,
0.05115874484181404,
0.06641920655965805,
-0.054302338510751724,
-0.00502434466034174,
0.02356746606528759,
-0.07670797407627106,
-0.001157066784799099,
-0.07553760707378387,
-0.09157230705022812,
-0.0077896215952932835,
-0.009624126367270947,
0.015383884310722351,
-0.028849365189671516,
-0.04189363121986389,
0.01679561659693718,
0.06412806361913681,
0.022755783051252365,
-0.05247030034661293,
0.042289432138204575,
-0.09877095371484756,
0.01782059669494629,
0.051469720900058746,
-0.05911766737699509,
-0.046741366386413574,
0.08366658538579941,
-0.015528158284723759,
-0.07665565609931946,
0.0035323931369930506,
-0.1128024160861969,
0.02085893414914608,
0.007195739541202784,
-0.007665444165468216,
0.02682238630950451,
0.01807030662894249,
0.07266638427972794,
-0.024135462939739227,
0.035348035395145416,
-0.05409323424100876,
0.03356994315981865,
0.026853740215301514,
0.11558730900287628,
-0.04589999094605446,
0.08421359956264496,
-0.005828392691910267,
0.053668439388275146,
0.0007187658338807523,
0.021241487935185432,
0.00476118503138423,
-0.023773804306983948,
-0.005708474665880203,
-0.00445887167006731,
0.012635305523872375,
-0.1226590946316719,
-0.01353326067328453,
0.08854171633720398,
0.0539853535592556,
-0.0884249210357666,
0.037407826632261276,
-0.02212337590754032,
0.0039817155338823795,
-0.004435822367668152,
-0.055345017462968826,
0.032802850008010864,
-0.009366202168166637,
0.039058562368154526,
0.004099184647202492,
-0.017634354531764984,
0.07421953231096268,
-0.02644369564950466,
-0.008977673016488552,
0.013839725404977798,
0.0729697197675705,
-0.07085508853197098,
0.0776069313287735,
4.768600382331926e-33,
-0.0521993488073349,
-0.07115643471479416,
-0.09537255018949509,
0.08221471309661865,
-0.06494155526161194,
-0.0425320640206337,
0.001019284245558083,
0.061438269913196564,
-0.012077944353222847,
0.0013273544609546661,
-0.015668034553527832,
-0.1051989272236824,
-0.007910634391009808,
0.04745836555957794,
0.03822360932826996,
-0.06620755791664124,
0.03849300369620323,
-0.015588139183819294,
0.07406739145517349,
0.020561041310429573,
0.09461033344268799,
-0.02647623047232628,
0.0023405079264193773,
0.0001223153667524457,
-0.013305711559951305,
0.040146902203559875,
-0.05284547060728073,
0.02375083975493908,
-0.05803220719099045,
0.004202571697533131,
0.03582630679011345,
-0.03039105050265789,
-0.0004104668623767793,
-0.014356453903019428,
0.09150023758411407,
-0.0712471529841423,
0.03153885528445244,
-0.005555529613047838,
-0.09344347566366196,
-0.034550897777080536,
0.021524107083678246,
0.01376547571271658,
-0.060981813818216324,
0.08419609814882278,
-0.045130547136068344,
-0.10721312463283539,
-0.034890323877334595,
0.015069856308400631,
-0.0032836191821843386,
0.06148331239819527,
-0.019655322656035423,
0.09057658165693283,
0.13184429705142975,
0.011343726888298988,
0.049211278557777405,
-0.0002717220922932029,
-0.02971871756017208,
-0.022673774510622025,
-0.03734015300869942,
0.0319785438477993,
0.038379013538360596,
0.027973836287856102,
0.006634141784161329,
-0.0345829576253891,
0.036020148545503616,
0.009734717197716236,
0.07974869012832642,
-0.014416780322790146,
0.04609394818544388,
0.0020580817945301533,
-0.045474905520677567,
0.0011629007058218122,
0.10517711937427521,
0.030958348885178566,
0.03561178222298622,
0.011455601081252098,
0.028188910335302353,
-0.006118784658610821,
0.05688658729195595,
-0.05596600100398064,
0.08947104215621948,
-0.025044705718755722,
0.034190308302640915,
-0.00018810803885571659,
-0.03229270130395889,
-0.01747659035027027,
-0.0397719107568264,
-0.09163904935121536,
-0.06400351971387863,
0.01341916248202324,
0.01596204750239849,
0.002219296293333173,
-0.0016384479822590947,
-0.023223526775836945,
0.05273055285215378,
-6.272240960683963e-33,
0.011616908945143223,
0.010646719485521317,
-0.03012612834572792,
0.022756312042474747,
-0.006439559627324343,
0.031853701919317245,
0.03801717981696129,
0.056465033441782,
0.07753787934780121,
0.020667752251029015,
0.018229089677333832,
-0.013878201134502888,
-0.0037508246023207903,
-0.008454447612166405,
-0.027252160012722015,
0.020651012659072876,
-0.03482517972588539,
-0.1167832762002945,
-0.04166501387953758,
-0.02950180694460869,
0.0034140958450734615,
-0.04692411422729492,
0.0025724023580551147,
0.02908763289451599,
0.0013066184474155307,
0.045199647545814514,
0.01636139117181301,
-0.044800616800785065,
-0.10119126737117767,
-0.0628821849822998,
0.03349260613322258,
-0.00565363047644496,
-0.05477149039506912,
-0.004439929034560919,
0.019384318962693214,
-0.09556318074464798,
0.0815705955028534,
0.09436459094285965,
-0.012885556556284428,
0.09317940473556519,
0.07268909364938736,
0.10489606112241745,
0.05387819930911064,
0.015051777474582195,
0.05132445693016052,
-0.01759323850274086,
-0.037858329713344574,
0.05944591015577316,
-0.03667860105633736,
-0.020315898582339287,
0.0036872546188533306,
0.05818193778395653,
0.04838947951793671,
0.049835532903671265,
0.05456046387553215,
0.001600889372639358,
0.0546921007335186,
0.00006530591781483963,
-0.007366684731096029,
0.04112659767270088,
0.06116793677210808,
-0.1066693440079689,
-0.04280851408839226,
0.03619345277547836,
0.034079354256391525,
-0.03269914165139198,
-0.023905886337161064,
-0.06804933398962021,
0.024521030485630035,
0.0490720234811306,
0.07263555377721786,
-0.08187218755483627,
-0.023135388270020485,
-0.0018412139033898711,
0.08815468847751617,
-0.015898656100034714,
-0.007820941507816315,
-0.04032658785581589,
-0.0310403723269701,
0.13953107595443726,
-0.000028494656362454407,
0.048519719392061234,
-0.0587114542722702,
0.017261721193790436,
0.06828031688928604,
-0.011264926753938198,
-0.020354805514216423,
-0.026523329317569733,
-0.0529869943857193,
-0.0921485498547554,
-0.0016144318506121635,
0.028201231732964516,
-0.03750074282288551,
0.016532326117157936,
0.03671189397573471,
-5.6141793436381704e-8,
-0.09150361269712448,
-0.07246119529008865,
-0.07081347703933716,
0.021049872040748596,
0.03114248253405094,
0.017301714047789574,
-0.11922765523195267,
-0.008384442888200283,
-0.010683867149055004,
-0.06878630071878433,
-0.002061057137325406,
0.02279132604598999,
-0.017327534034848213,
-0.045927226543426514,
0.03791482374072075,
-0.037178851664066315,
0.07415943592786789,
-0.06711576879024506,
-0.017798777669668198,
-0.027986083179712296,
0.0869462862610817,
-0.05559888482093811,
-0.03361201286315918,
0.002694174647331238,
0.02409074455499649,
0.013809891417622566,
0.09996355324983597,
0.02702224999666214,
-0.011629067361354828,
-0.06571514159440994,
-0.0292352307587862,
-0.008732049725949764,
0.05541582405567169,
0.004182413686066866,
-0.0308610200881958,
0.08959391713142395,
-0.030933819711208344,
0.009662720374763012,
-0.022067848592996597,
0.012511683627963066,
0.10696563124656677,
0.029907843098044395,
-0.036086488515138626,
0.05972931161522865,
0.04600204899907112,
-0.0011866884306073189,
0.032449956983327866,
0.017635155469179153,
-0.06981847435235977,
-0.06991016864776611,
0.04973267763853073,
-0.022778833284974098,
0.004794773645699024,
0.038525018841028214,
-0.05266543850302696,
-0.04734695330262184,
0.012190093286335468,
-0.07978031784296036,
-0.020882587879896164,
0.011443237774074078,
0.1183398887515068,
0.08094681054353714,
-0.02464359439909458,
-0.015219226479530334
] | 0.097539 |
fs.closeSync(fd)); }); ``` #### `http2stream.respondWithFile(path[, headers[, options]])` \* `path` {string|Buffer|URL} \* `headers` {HTTP/2 Headers Object} \* `options` {Object} \* `statCheck` {Function} \* `onError` {Function} Callback function invoked in the case of an error before send. \* `waitForTrailers` {boolean} When `true`, the `Http2Stream` will emit the `'wantTrailers'` event after the final `DATA` frame has been sent. \* `offset` {number} The offset position at which to begin reading. \* `length` {number} The amount of data from the fd to send. Sends a regular file as the response. The `path` must specify a regular file or an `'error'` event will be emitted on the `Http2Stream` object. When used, the `Http2Stream` object's `Duplex` interface will be closed automatically. The optional `options.statCheck` function may be specified to give user code an opportunity to set additional content headers based on the `fs.Stat` details of the given file: If an error occurs while attempting to read the file data, the `Http2Stream` will be closed using an `RST\_STREAM` frame using the standard `INTERNAL\_ERROR` code. If the `onError` callback is defined, then it will be called. Otherwise the stream will be destroyed. Example using a file path: ```mjs import { createServer } from 'node:http2'; const server = createServer(); server.on('stream', (stream) => { function statCheck(stat, headers) { headers['last-modified'] = stat.mtime.toUTCString(); } function onError(err) { // stream.respond() can throw if the stream has been destroyed by // the other side. try { if (err.code === 'ENOENT') { stream.respond({ ':status': 404 }); } else { stream.respond({ ':status': 500 }); } } catch (err) { // Perform actual error handling. console.error(err); } stream.end(); } stream.respondWithFile('/some/file', { 'content-type': 'text/plain; charset=utf-8' }, { statCheck, onError }); }); ``` ```cjs const http2 = require('node:http2'); const server = http2.createServer(); server.on('stream', (stream) => { function statCheck(stat, headers) { headers['last-modified'] = stat.mtime.toUTCString(); } function onError(err) { // stream.respond() can throw if the stream has been destroyed by // the other side. try { if (err.code === 'ENOENT') { stream.respond({ ':status': 404 }); } else { stream.respond({ ':status': 500 }); } } catch (err) { // Perform actual error handling. console.error(err); } stream.end(); } stream.respondWithFile('/some/file', { 'content-type': 'text/plain; charset=utf-8' }, { statCheck, onError }); }); ``` The `options.statCheck` function may also be used to cancel the send operation by returning `false`. For instance, a conditional request may check the stat results to determine if the file has been modified to return an appropriate `304` response: ```mjs import { createServer } from 'node:http2'; const server = createServer(); server.on('stream', (stream) => { function statCheck(stat, headers) { // Check the stat here... stream.respond({ ':status': 304 }); return false; // Cancel the send operation } stream.respondWithFile('/some/file', { 'content-type': 'text/plain; charset=utf-8' }, { statCheck }); }); ``` ```cjs const http2 = require('node:http2'); const server = http2.createServer(); server.on('stream', (stream) => { function statCheck(stat, headers) { // Check the stat here... stream.respond({ ':status': 304 }); return false; // Cancel the send operation } stream.respondWithFile('/some/file', { 'content-type': 'text/plain; charset=utf-8' }, { statCheck }); }); ``` The `content-length` header field will be automatically set. The `offset` and `length` options may be used to limit the response to a specific range subset. This can be used, for instance, to support HTTP Range requests. The `options.onError` function may also be used to handle all the errors that could happen before the delivery of the file is initiated. The default behavior is to destroy the stream. When the `options.waitForTrailers` option is set, the `'wantTrailers'` event will be emitted immediately after queuing the last chunk of payload data to be sent. The `http2stream.sendTrailers()` method can then be used to sent trailing header fields to the peer. When `options.waitForTrailers` is set, the `Http2Stream` will | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.059797823429107666,
0.04931718483567238,
-0.09640461951494217,
0.030267303809523582,
0.04769406095147133,
-0.07491867989301682,
-0.020206695422530174,
0.10893836617469788,
0.08622682839632034,
0.020096398890018463,
-0.03908626362681389,
0.019314296543598175,
-0.03718535229563713,
-0.038110002875328064,
0.00533912843093276,
-0.04538189247250557,
-0.05063764750957489,
-0.0730481892824173,
-0.06254040449857712,
-0.022531945258378983,
0.029682394117116928,
0.018553072586655617,
0.032819051295518875,
-0.021618474274873734,
-0.08451778441667557,
0.016856392845511436,
-0.0711776614189148,
-0.046333134174346924,
-0.019662383943796158,
0.00981373991817236,
0.06058322265744209,
-0.06156919524073601,
-0.16899991035461426,
-0.03503657504916191,
-0.062398381531238556,
0.05862671136856079,
0.010766342282295227,
-0.06200840324163437,
-0.08177732676267624,
0.005580295342952013,
0.02086627669632435,
0.011542570777237415,
-0.14039289951324463,
-0.027789857238531113,
-0.06671340018510818,
0.025318235158920288,
-0.021690398454666138,
0.03135368227958679,
-0.06109185889363289,
0.01353667676448822,
-0.06765144318342209,
0.0313047356903553,
-0.056212637573480606,
0.05065086856484413,
0.09461275488138199,
-0.023067865520715714,
0.00318789086304605,
0.04297376051545143,
-0.1128048524260521,
0.033716026693582535,
-0.05862810090184212,
-0.09526026248931885,
-0.05549944192171097,
0.003363601630553603,
0.03957017511129379,
-0.03155164048075676,
-0.0369703434407711,
0.007891843095421791,
0.04808179661631584,
0.006049927324056625,
-0.04998930171132088,
0.03678186610341072,
-0.08104356378316879,
0.028646115213632584,
0.06645113229751587,
-0.05398095026612282,
-0.04350588470697403,
0.08619119226932526,
-0.03034830465912819,
-0.040912870317697525,
0.012876779772341251,
-0.13680483400821686,
-0.023610442876815796,
0.003006917657330632,
-0.004540866706520319,
0.04383976384997368,
0.017731664702296257,
0.06550256907939911,
-0.003488316433504224,
0.033765390515327454,
-0.054047711193561554,
0.05117291212081909,
0.009355435147881508,
0.09965868294239044,
-0.06111537665128708,
0.07284991443157196,
-0.006438874173909426,
0.07063208520412445,
0.0055079385638237,
-0.0009835542878136039,
0.015333982184529305,
-0.0481996014714241,
0.018736127763986588,
-0.0077058132737874985,
0.02847798727452755,
-0.07838589698076248,
-0.01218071673065424,
0.08682562410831451,
0.06879057735204697,
-0.08208294957876205,
0.00462998915463686,
-0.02999231219291687,
0.032999131828546524,
0.011581131257116795,
-0.04718809202313423,
0.07034531235694885,
0.0019266587914898992,
0.03055579401552677,
0.027360741049051285,
0.0002881637483369559,
0.0847943052649498,
-0.002018297789618373,
0.02230505645275116,
-0.007131958846002817,
0.08608094602823257,
-0.0646093562245369,
0.07253578305244446,
1.193253590904816e-33,
-0.05532681941986084,
-0.09295659512281418,
-0.10485664010047913,
0.10381367057561874,
-0.02765369787812233,
-0.05907424911856651,
0.027483996003866196,
0.02724829502403736,
-0.019315550103783607,
-0.008296705782413483,
-0.024102341383695602,
-0.10643353313207626,
-0.006782153155654669,
0.019231144338846207,
0.004996605683118105,
-0.06916443258523941,
0.06648634374141693,
-0.0027438218239694834,
0.07829819619655609,
0.026018237695097923,
0.10489582270383835,
0.005034300033003092,
0.03443387150764465,
-0.006370586343109608,
0.015329998917877674,
0.018128538504242897,
0.008104804903268814,
0.02919517643749714,
-0.06761164963245392,
0.013099892996251583,
0.03637324273586273,
-0.011790074408054352,
0.004084401298314333,
0.02053147926926613,
0.0678129494190216,
-0.0420391671359539,
-0.013984295539557934,
0.016625771299004555,
-0.07953357696533203,
-0.019784804433584213,
0.0049180262722074986,
0.03947652503848076,
-0.11422900855541229,
0.09343434870243073,
-0.011807645671069622,
-0.14794988930225372,
-0.029257310554385185,
0.03572418540716171,
0.03351040929555893,
0.04862276092171669,
0.0032072372268885374,
0.030316466465592384,
0.11006671190261841,
0.028511252254247665,
0.026386739686131477,
0.04251391813158989,
-0.03361448273062706,
-0.052272550761699677,
-0.06812828034162521,
0.013736968860030174,
0.04589011147618294,
0.02237674780189991,
-0.0145249729976058,
-0.08254934847354889,
0.04032755643129349,
0.015790646895766258,
0.04445759952068329,
0.0008431847090832889,
0.020961619913578033,
0.00261978292837739,
-0.03377426415681839,
0.012145507149398327,
0.05708310753107071,
0.029745260253548622,
0.06334816664457321,
0.04611847177147865,
0.009770160540938377,
-0.04034784063696861,
0.037436194717884064,
-0.06146303191781044,
0.12372564524412155,
-0.04214239865541458,
-0.009443750604987144,
0.009151900187134743,
-0.029623158276081085,
-0.02740986831486225,
-0.025518102571368217,
-0.048809729516506195,
-0.048778265714645386,
0.0334220826625824,
-0.021253392100334167,
-0.010542391799390316,
-0.004423330072313547,
0.0043057724833488464,
0.022984547540545464,
-3.36554428418586e-33,
-0.01386748906224966,
0.0031845364719629288,
-0.03608804568648338,
0.06745875626802444,
0.01686273142695427,
0.03794681653380394,
0.04480605572462082,
0.018475061282515526,
0.04388140141963959,
0.04116823151707649,
0.017665764316916466,
0.01632874459028244,
0.00192091497592628,
-0.0005426878342404962,
-0.035533349961042404,
0.008957360871136189,
0.030800025910139084,
-0.09789930284023285,
-0.04614491015672684,
-0.03890078142285347,
-0.02245335839688778,
-0.07565278559923172,
0.0328192412853241,
0.004531328100711107,
-0.02442508190870285,
0.01631494052708149,
-0.01709735207259655,
-0.04524556174874306,
-0.06301633268594742,
-0.040557611733675,
0.056614458560943604,
-0.0207294300198555,
-0.011695372872054577,
0.001568783656693995,
0.047404222190380096,
-0.08105997741222382,
0.05827917158603668,
0.09340608865022659,
0.02800622023642063,
0.0447571836411953,
0.10981011390686035,
0.047730702906847,
0.015078605152666569,
-0.01146071869879961,
0.056870318949222565,
-0.007851997390389442,
-0.08267010003328323,
0.06276831775903702,
-0.07836729288101196,
-0.016697291284799576,
-0.021011991426348686,
0.04274744167923927,
0.036818619817495346,
0.0783618614077568,
0.040400002151727676,
0.004663560539484024,
0.0673513412475586,
0.003708231495693326,
0.012520195916295052,
0.048644937574863434,
0.07019814848899841,
-0.12351932376623154,
-0.004386269953101873,
-0.0010427676606923342,
0.049497123807668686,
-0.020606663078069687,
-0.026753557845950127,
-0.03365176543593407,
0.01626627705991268,
0.0838453620672226,
0.044301263988018036,
-0.026592638343572617,
-0.04270877316594124,
-0.005385180469602346,
0.08246780186891556,
-0.03058910369873047,
-0.017485128715634346,
-0.08047335594892502,
-0.011947160586714745,
0.12133869528770447,
0.006273522041738033,
0.04612036794424057,
-0.037074118852615356,
0.007719219662249088,
0.09723218530416489,
-0.0061049507930874825,
-0.004494151100516319,
-0.012315019965171814,
-0.027907883748412132,
-0.08078988641500473,
0.007670150604099035,
0.06154869869351387,
-0.07712414860725403,
-0.04764287546277046,
-0.0014380012871697545,
-5.3015718037841e-8,
-0.08364499360322952,
-0.03485363349318504,
-0.04824787378311157,
0.07020753622055054,
0.019157540053129196,
-0.0024226049426943064,
-0.09720247983932495,
0.006401133257895708,
0.03721194341778755,
-0.02263573929667473,
-0.03598678484559059,
0.032364893704652786,
0.02692730911076069,
-0.04400590807199478,
0.022374656051397324,
-0.0582202672958374,
0.06490037590265274,
-0.06541068851947784,
0.012884091585874557,
-0.06661198288202286,
0.059348657727241516,
-0.08150987327098846,
-0.029689377173781395,
0.01662767305970192,
0.023674549534916878,
-0.010375270619988441,
0.0950671136379242,
-0.0048076920211315155,
-0.020489484071731567,
-0.07119495421648026,
-0.03806525096297264,
-0.005236723460257053,
0.044613711535930634,
0.0037182471714913845,
-0.03950394690036774,
0.09916117042303085,
-0.02222158946096897,
0.006051972974091768,
-0.005052791442722082,
0.017397986724972725,
0.11922064423561096,
0.05612011253833771,
-0.012792203575372696,
0.042741451412439346,
0.07870346307754517,
-0.002170424209907651,
0.05950379744172096,
0.03726974502205849,
-0.05723641812801361,
-0.03710152581334114,
0.05224097892642021,
-0.03354974836111069,
-0.015938693657517433,
0.028458736836910248,
-0.039281006902456284,
-0.05483084172010422,
0.0021126330830156803,
-0.08392864465713501,
-0.006685811094939709,
0.00818616058677435,
0.0926305279135704,
0.07253282517194748,
-0.023896943777799606,
-0.03140127658843994
] | 0.084562 |
to destroy the stream. When the `options.waitForTrailers` option is set, the `'wantTrailers'` event will be emitted immediately after queuing the last chunk of payload data to be sent. The `http2stream.sendTrailers()` method can then be used to sent trailing header fields to the peer. When `options.waitForTrailers` is set, the `Http2Stream` will not automatically close when the final `DATA` frame is transmitted. User code must call either `http2stream.sendTrailers()` or `http2stream.close()` to close the `Http2Stream`. ```mjs import { createServer } from 'node:http2'; const server = createServer(); server.on('stream', (stream) => { stream.respondWithFile('/some/file', { 'content-type': 'text/plain; charset=utf-8' }, { waitForTrailers: true }); stream.on('wantTrailers', () => { stream.sendTrailers({ ABC: 'some value to send' }); }); }); ``` ```cjs const http2 = require('node:http2'); const server = http2.createServer(); server.on('stream', (stream) => { stream.respondWithFile('/some/file', { 'content-type': 'text/plain; charset=utf-8' }, { waitForTrailers: true }); stream.on('wantTrailers', () => { stream.sendTrailers({ ABC: 'some value to send' }); }); }); ``` ### Class: `Http2Server` \* Extends: {net.Server} Instances of `Http2Server` are created using the `http2.createServer()` function. The `Http2Server` class is not exported directly by the `node:http2` module. #### Event: `'checkContinue'` \* `request` {http2.Http2ServerRequest} \* `response` {http2.Http2ServerResponse} If a [`'request'`][] listener is registered or [`http2.createServer()`][] is supplied a callback function, the `'checkContinue'` event is emitted each time a request with an HTTP `Expect: 100-continue` is received. If this event is not listened for, the server will automatically respond with a status `100 Continue` as appropriate. Handling this event involves calling [`response.writeContinue()`][] if the client should continue to send the request body, or generating an appropriate HTTP response (e.g. 400 Bad Request) if the client should not continue to send the request body. When this event is emitted and handled, the [`'request'`][] event will not be emitted. #### Event: `'connection'` \* `socket` {stream.Duplex} This event is emitted when a new TCP stream is established. `socket` is typically an object of type [`net.Socket`][]. Usually users will not want to access this event. This event can also be explicitly emitted by users to inject connections into the HTTP server. In that case, any [`Duplex`][] stream can be passed. #### Event: `'request'` \* `request` {http2.Http2ServerRequest} \* `response` {http2.Http2ServerResponse} Emitted each time there is a request. There may be multiple requests per session. See the [Compatibility API][]. #### Event: `'session'` \* `session` {ServerHttp2Session} The `'session'` event is emitted when a new `Http2Session` is created by the `Http2Server`. #### Event: `'sessionError'` \* `error` {Error} \* `session` {ServerHttp2Session} The `'sessionError'` event is emitted when an `'error'` event is emitted by an `Http2Session` object associated with the `Http2Server`. #### Event: `'stream'` \* `stream` {Http2Stream} A reference to the stream \* `headers` {HTTP/2 Headers Object} An object describing the headers \* `flags` {number} The associated numeric flags \* `rawHeaders` {HTTP/2 Raw Headers} An array containing the raw headers The `'stream'` event is emitted when a `'stream'` event has been emitted by an `Http2Session` associated with the server. See also [`Http2Session`'s `'stream'` event][]. ```mjs import { createServer, constants } from 'node:http2'; const { HTTP2\_HEADER\_METHOD, HTTP2\_HEADER\_PATH, HTTP2\_HEADER\_STATUS, HTTP2\_HEADER\_CONTENT\_TYPE, } = constants; const server = createServer(); server.on('stream', (stream, headers, flags) => { const method = headers[HTTP2\_HEADER\_METHOD]; const path = headers[HTTP2\_HEADER\_PATH]; // ... stream.respond({ [HTTP2\_HEADER\_STATUS]: 200, [HTTP2\_HEADER\_CONTENT\_TYPE]: 'text/plain; charset=utf-8', }); stream.write('hello '); stream.end('world'); }); ``` ```cjs const http2 = require('node:http2'); const { HTTP2\_HEADER\_METHOD, HTTP2\_HEADER\_PATH, HTTP2\_HEADER\_STATUS, HTTP2\_HEADER\_CONTENT\_TYPE, } = http2.constants; const server = http2.createServer(); server.on('stream', (stream, headers, flags) => { const method = headers[HTTP2\_HEADER\_METHOD]; const path = headers[HTTP2\_HEADER\_PATH]; // ... stream.respond({ [HTTP2\_HEADER\_STATUS]: 200, [HTTP2\_HEADER\_CONTENT\_TYPE]: 'text/plain; charset=utf-8', }); stream.write('hello '); stream.end('world'); }); ``` #### Event: `'timeout'` The `'timeout'` event is emitted when there is no activity on the Server for a given number of milliseconds set using `http2server.setTimeout()`. \*\*Default:\*\* | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.018615033477544785,
0.08508320152759552,
0.024112097918987274,
0.013001255691051483,
0.08168710768222809,
-0.07380928099155426,
-0.04295147582888603,
0.03804207965731621,
0.10648803412914276,
0.0014374457532539964,
-0.03584858402609825,
0.043376341462135315,
-0.0431789867579937,
-0.004268738441169262,
-0.019005801528692245,
0.003339892253279686,
-0.029187878593802452,
-0.008748378604650497,
-0.01945556327700615,
-0.0683126226067543,
0.004305372014641762,
-0.026948941871523857,
0.03890832141041756,
0.01747448556125164,
-0.006228210404515266,
0.030571918934583664,
-0.039142679423093796,
-0.024578696116805077,
0.06335840374231339,
-0.0074941739439964294,
0.09077263623476028,
-0.07804491370916367,
-0.16410969197750092,
-0.006448473781347275,
-0.09354513883590698,
0.058352261781692505,
0.006096779368817806,
-0.03397873044013977,
-0.07592462003231049,
-0.015647361055016518,
0.06658313423395157,
0.025146590545773506,
-0.11292682588100433,
0.0023655416443943977,
-0.024475740268826485,
0.08267045021057129,
-0.011614163406193256,
0.015441065654158592,
-0.025121059268712997,
0.02881748043000698,
-0.10243138670921326,
0.0032393031287938356,
-0.07037154585123062,
0.0816696286201477,
0.035484470427036285,
-0.046202611178159714,
-0.057877179235219955,
0.06635431945323944,
-0.028729088604450226,
0.021745940670371056,
-0.07743305712938309,
-0.02425585873425007,
0.026306895539164543,
-0.02110377326607704,
0.06768298894166946,
-0.027147455140948296,
-0.02795218676328659,
0.09244155138731003,
0.07041308283805847,
0.061059098690748215,
0.052913811057806015,
-0.014660673215985298,
-0.08601535856723785,
-0.011143687181174755,
-0.009429458528757095,
-0.0742812380194664,
-0.051930516958236694,
0.04028630629181862,
-0.07611528784036636,
0.10305757820606232,
0.014637351036071777,
-0.1490800529718399,
-0.016915375366806984,
-0.025571106001734734,
-0.057259056717157364,
0.023995421826839447,
-0.00798919890075922,
0.013642987236380577,
0.012749186716973782,
0.0069700381718575954,
-0.12791380286216736,
0.044485222548246384,
0.04252609238028526,
0.0621439591050148,
-0.03508688509464264,
0.08656850457191467,
-0.060701075941324234,
0.01840321160852909,
0.01260497234761715,
0.004229836165904999,
0.0506562814116478,
-0.06391662359237671,
0.012740518897771835,
0.031696852296590805,
0.02393464371562004,
-0.11443176865577698,
-0.011693442240357399,
0.11659611016511917,
0.0619964562356472,
0.0043733990751206875,
-0.01162684429436922,
0.009439565241336823,
0.00294779846444726,
-0.014479454606771469,
-0.03242431581020355,
0.08000101149082184,
0.030651528388261795,
0.09413167834281921,
0.017127713188529015,
0.04663560912013054,
0.07454439997673035,
-0.046252936124801636,
-0.03916088119149208,
-0.04285360872745514,
0.07587922364473343,
-0.03746219351887703,
0.1239357739686966,
2.4873322710155367e-33,
-0.04759311303496361,
-0.07189188152551651,
-0.07560914754867554,
0.09084448218345642,
-0.007177620194852352,
-0.00699209701269865,
0.05887582525610924,
0.058531299233436584,
-0.04416577145457268,
-0.039439857006073,
-0.029417477548122406,
-0.11151005327701569,
0.03094107285141945,
0.015451767481863499,
0.0054710968397557735,
-0.11105014383792877,
0.061671748757362366,
-0.0501304529607296,
0.08376798033714294,
0.038638822734355927,
0.0401964969933033,
0.02734772488474846,
0.017913391813635826,
-0.014736565761268139,
-0.03659694641828537,
-0.013265164569020271,
-0.025229036808013916,
-0.0354868583381176,
-0.0710654929280281,
-0.008242158219218254,
0.008467777632176876,
0.028114914894104004,
-0.009342486038804054,
-0.00825885683298111,
0.0484846755862236,
-0.036092545837163925,
-0.020574171096086502,
-0.005278285127133131,
-0.058236103504896164,
-0.07621517777442932,
0.0063217212446033955,
0.02817276492714882,
-0.11782040446996689,
0.04519711807370186,
-0.05752812325954437,
-0.10132279247045517,
-0.010871914215385914,
0.007909350097179413,
-0.01838281936943531,
-0.041537366807460785,
0.024933066219091415,
0.03315909206867218,
0.06909158080816269,
0.01011131051927805,
0.013976022601127625,
0.09159059077501297,
0.002091248519718647,
-0.011160224676132202,
-0.06517832726240158,
-0.047380998730659485,
0.022186720743775368,
0.011336872354149818,
0.01696469448506832,
-0.053464800119400024,
0.051365312188863754,
-0.014327225275337696,
0.023653153330087662,
0.01673153042793274,
0.05859183892607689,
-0.03901366889476776,
-0.05524576082825661,
0.015123514458537102,
0.061845943331718445,
-0.012056037783622742,
-0.00320494850166142,
0.03665238618850708,
-0.023978156968951225,
0.010207644663751125,
0.10665787011384964,
-0.02958822436630726,
0.11245762556791306,
-0.011008589528501034,
0.045216165482997894,
0.02799132838845253,
0.020717082545161247,
-0.02359069511294365,
-0.0029114913195371628,
-0.08859256654977798,
-0.011040345765650272,
0.09160377830266953,
-0.040093015879392624,
-0.009123511612415314,
-0.005648716818541288,
0.009795782156288624,
-0.00023474128101952374,
-3.961609184155025e-33,
0.0043776556849479675,
0.021410740911960602,
-0.06962861120700836,
0.06508959829807281,
0.01899014599621296,
0.017524417489767075,
0.025407876819372177,
0.036074861884117126,
-0.012909311801195145,
0.023145755752921104,
-0.0021681999787688255,
0.004255047533661127,
0.006238238885998726,
0.017096474766731262,
-0.026536986231803894,
-0.020498545840382576,
0.038381610065698624,
-0.023875953629612923,
-0.010172577574849129,
-0.10947278141975403,
-0.09095951169729233,
-0.05779915302991867,
0.004838976077735424,
0.0030211175326257944,
0.0011862212559208274,
0.008810261264443398,
-0.0022629257291555405,
0.007770333904772997,
-0.056346409022808075,
-0.08232491463422775,
0.0396764874458313,
-0.018487293273210526,
-0.016865311190485954,
-0.030809583142399788,
0.019355308264493942,
-0.008872182108461857,
0.022340763360261917,
0.14440344274044037,
0.03057023696601391,
0.04167298972606659,
0.10594198107719421,
0.05456918105483055,
0.0011032322654500604,
-0.013792005367577076,
0.05446384474635124,
0.006749833468347788,
-0.029670068994164467,
0.05481818690896034,
-0.026265673339366913,
0.006123363506048918,
-0.04265948385000229,
-0.0022485931403934956,
0.007766558788716793,
0.02434591017663479,
0.04589604213833809,
-0.039408374577760696,
0.012557965703308582,
-0.001967944670468569,
0.07832782715559006,
-0.0173747930675745,
0.09377357363700867,
-0.09570179879665375,
-0.007201585453003645,
0.012368608266115189,
0.058360498398542404,
0.0018657399341464043,
-0.020472263917326927,
0.029954329133033752,
0.016421647742390633,
0.020711878314614296,
-0.006325020920485258,
0.007211001589894295,
-0.012874698266386986,
-0.008907600305974483,
0.09608963131904602,
0.000697057752404362,
-0.05685798451304436,
-0.07263490557670593,
-0.015691474080085754,
0.012427471578121185,
-0.003573815803974867,
0.053988680243492126,
-0.0960458368062973,
0.027092313393950462,
0.13132767379283905,
-0.0413886159658432,
-0.02173525281250477,
0.0023356634192168713,
-0.01577787660062313,
-0.07470786571502686,
0.03487779200077057,
0.0137782646343112,
-0.12463504076004028,
-0.005976291373372078,
-0.020557133480906487,
-4.6024180022641303e-8,
-0.08075159043073654,
-0.055939603596925735,
-0.07099881023168564,
0.030812175944447517,
0.017551297321915627,
-0.0019635839853435755,
-0.049102671444416046,
0.0748007595539093,
0.06918138265609741,
-0.035709917545318604,
0.010747370310127735,
-0.04659612104296684,
0.013512251898646355,
-0.03697335347533226,
0.023936858400702477,
-0.04653949290513992,
0.03247472271323204,
-0.10089626163244247,
0.005323176737874746,
-0.047223202884197235,
0.032214630395174026,
-0.06397009640932083,
-0.019566772505640984,
0.028478043153882027,
0.013788335025310516,
-0.0016521948855370283,
0.10357861965894699,
-0.001449883566237986,
-0.022458123043179512,
-0.04921254143118858,
-0.07227012515068054,
0.0008864442352205515,
0.06727069616317749,
0.04539419338107109,
-0.022082624956965446,
0.06353110074996948,
-0.028137151151895523,
0.01332162506878376,
0.015423807315528393,
0.041056547313928604,
0.08337296545505524,
0.035106804221868515,
-0.006195174530148506,
0.038238201290369034,
0.03744114562869072,
0.06105184555053711,
0.050451066344976425,
0.053085118532180786,
-0.06072879210114479,
0.014621185138821602,
0.05270564183592796,
-0.06152592971920967,
-0.03872091323137283,
0.00555047020316124,
0.022145435214042664,
-0.13330695033073425,
0.03415672108530998,
-0.07424026727676392,
-0.012868853285908699,
-0.04286257177591324,
0.08712377399206161,
0.07999232411384583,
-0.020300012081861496,
-0.019839614629745483
] | 0.005146 |
=> { const method = headers[HTTP2\_HEADER\_METHOD]; const path = headers[HTTP2\_HEADER\_PATH]; // ... stream.respond({ [HTTP2\_HEADER\_STATUS]: 200, [HTTP2\_HEADER\_CONTENT\_TYPE]: 'text/plain; charset=utf-8', }); stream.write('hello '); stream.end('world'); }); ``` #### Event: `'timeout'` The `'timeout'` event is emitted when there is no activity on the Server for a given number of milliseconds set using `http2server.setTimeout()`. \*\*Default:\*\* 0 (no timeout) #### `server.close([callback])` \* `callback` {Function} Stops the server from establishing new sessions. This does not prevent new request streams from being created due to the persistent nature of HTTP/2 sessions. To gracefully shut down the server, call [`http2session.close()`][] on all active sessions. If `callback` is provided, it is not invoked until all active sessions have been closed, although the server has already stopped allowing new sessions. See [`net.Server.close()`][] for more details. #### `server[Symbol.asyncDispose]()` Calls [`server.close()`][] and returns a promise that fulfills when the server has closed. #### `server.setTimeout([msecs][, callback])` \* `msecs` {number} \*\*Default:\*\* 0 (no timeout) \* `callback` {Function} \* Returns: {Http2Server} Used to set the timeout value for http2 server requests, and sets a callback function that is called when there is no activity on the `Http2Server` after `msecs` milliseconds. The given callback is registered as a listener on the `'timeout'` event. In case if `callback` is not a function, a new `ERR\_INVALID\_ARG\_TYPE` error will be thrown. #### `server.timeout` \* Type: {number} Timeout in milliseconds. \*\*Default:\*\* 0 (no timeout) The number of milliseconds of inactivity before a socket is presumed to have timed out. A value of `0` will disable the timeout behavior on incoming connections. The socket timeout logic is set up on connection, so changing this value only affects new connections to the server, not any existing connections. #### `server.updateSettings([settings])` \* `settings` {HTTP/2 Settings Object} Used to update the server with the provided settings. Throws `ERR\_HTTP2\_INVALID\_SETTING\_VALUE` for invalid `settings` values. Throws `ERR\_INVALID\_ARG\_TYPE` for invalid `settings` argument. ### Class: `Http2SecureServer` \* Extends: {tls.Server} Instances of `Http2SecureServer` are created using the `http2.createSecureServer()` function. The `Http2SecureServer` class is not exported directly by the `node:http2` module. #### Event: `'checkContinue'` \* `request` {http2.Http2ServerRequest} \* `response` {http2.Http2ServerResponse} If a [`'request'`][] listener is registered or [`http2.createSecureServer()`][] is supplied a callback function, the `'checkContinue'` event is emitted each time a request with an HTTP `Expect: 100-continue` is received. If this event is not listened for, the server will automatically respond with a status `100 Continue` as appropriate. Handling this event involves calling [`response.writeContinue()`][] if the client should continue to send the request body, or generating an appropriate HTTP response (e.g. 400 Bad Request) if the client should not continue to send the request body. When this event is emitted and handled, the [`'request'`][] event will not be emitted. #### Event: `'connection'` \* `socket` {stream.Duplex} This event is emitted when a new TCP stream is established, before the TLS handshake begins. `socket` is typically an object of type [`net.Socket`][]. Usually users will not want to access this event. This event can also be explicitly emitted by users to inject connections into the HTTP server. In that case, any [`Duplex`][] stream can be passed. #### Event: `'request'` \* `request` {http2.Http2ServerRequest} \* `response` {http2.Http2ServerResponse} Emitted each time there is a request. There may be multiple requests per session. See the [Compatibility API][]. #### Event: `'session'` \* `session` {ServerHttp2Session} The `'session'` event is emitted when a new `Http2Session` is created by the `Http2SecureServer`. #### Event: `'sessionError'` \* `error` {Error} \* `session` {ServerHttp2Session} The `'sessionError'` event is emitted when an `'error'` event is emitted by an `Http2Session` object associated with the `Http2SecureServer`. #### Event: `'stream'` \* `stream` {Http2Stream} A reference to the stream \* `headers` {HTTP/2 Headers Object} An object describing the headers \* `flags` {number} The | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.005255780182778835,
0.09107828885316849,
-0.006390334572643042,
0.026379529386758804,
0.02256445214152336,
-0.06016598641872406,
-0.06094897910952568,
0.056382082402706146,
0.09721320122480392,
-0.0010545168770477176,
-0.07337083667516708,
0.020420296117663383,
-0.05586262792348862,
-0.0073906369507312775,
-0.006470590829849243,
0.004689273424446583,
-0.04173662140965462,
-0.011567670851945877,
-0.04510507732629776,
-0.06091546639800072,
0.05615738406777382,
-0.00992058590054512,
0.005107428878545761,
0.05114734172821045,
-0.03190832585096359,
0.023048819974064827,
0.0001369900710415095,
-0.0851731151342392,
0.024483123794198036,
0.05296681076288223,
0.07406684756278992,
-0.09568355232477188,
-0.16275644302368164,
-0.07575739175081253,
-0.06262429058551788,
0.05008555203676224,
-0.002260531298816204,
-0.021294323727488518,
0.0013227344024926424,
-0.04288544878363609,
0.027489392086863518,
0.05750849470496178,
-0.07893824577331543,
-0.01048758439719677,
-0.0015233027515932918,
0.07868294417858124,
-0.0744018480181694,
-0.0409042164683342,
-0.05135023593902588,
0.032446328550577164,
-0.025113383308053017,
0.008312268182635307,
-0.03201877325773239,
0.03132690116763115,
0.009742922149598598,
-0.017736254259943962,
-0.0408221073448658,
0.028474895283579826,
-0.04077509045600891,
0.05431390181183815,
-0.021856362000107765,
-0.05457772687077522,
-0.03314204514026642,
0.024615734815597534,
0.0022646242287009954,
-0.013581328094005585,
0.007317437790334225,
-0.005768952425569296,
0.038112789392471313,
0.07740243524312973,
-0.028514666482806206,
0.07393305748701096,
-0.1051480621099472,
0.006815336644649506,
0.0003383734729140997,
-0.11935614794492722,
-0.012531174346804619,
-0.018707018345594406,
-0.037780843675136566,
0.01484348252415657,
0.04390985146164894,
-0.07906320691108704,
-0.014932702295482159,
0.014492833986878395,
-0.040207639336586,
0.0042944783344864845,
0.053811609745025635,
0.06533916294574738,
-0.007397765293717384,
0.002457361901178956,
-0.1327482908964157,
0.10251191258430481,
0.04796503484249115,
0.0624910444021225,
-0.0563923716545105,
0.06429044157266617,
0.015585321001708508,
0.042758774012327194,
-0.015375742688775063,
0.03136009722948074,
0.013839712366461754,
-0.00463643204420805,
-0.00713786855340004,
-0.026403548195958138,
0.02281864359974861,
-0.08184400200843811,
0.011687041260302067,
0.06197304651141167,
0.05893448367714882,
-0.030109161511063576,
0.03045564889907837,
0.018103381618857384,
0.008287210948765278,
0.034145329147577286,
-0.02411312237381935,
0.10616637021303177,
0.02954835817217827,
0.022166835144162178,
0.052775006741285324,
0.057584188878536224,
0.13501356542110443,
-0.04131220281124115,
-0.046761419624090195,
-0.09868328273296356,
0.0456431582570076,
0.003625026671215892,
0.09801462292671204,
6.687628889182889e-34,
-0.012418867088854313,
-0.06982202082872391,
-0.09814881533384323,
0.09326548129320145,
0.049872707575559616,
0.01451670378446579,
0.006759584415704012,
0.022217411547899246,
0.02803737297654152,
-0.007277091033756733,
0.01635773666203022,
-0.1144104152917862,
0.02262866497039795,
-0.005884777754545212,
0.039867300540208817,
-0.07830537110567093,
0.13390682637691498,
-0.012478917837142944,
0.12287740409374237,
-0.0006889794021844864,
0.038479432463645935,
-0.02719794027507305,
0.0230189748108387,
0.048333097249269485,
0.0026324044447392225,
-0.0024235816672444344,
0.0022840003948658705,
-0.02986486628651619,
-0.07688143104314804,
-0.006970069371163845,
0.04008777067065239,
0.03935392200946808,
-0.06585435569286346,
0.0037417630665004253,
0.08505883067846298,
-0.09885996580123901,
-0.0391140878200531,
0.020809181034564972,
-0.009157069958746433,
-0.04207330197095871,
-0.014369714073836803,
0.045975252985954285,
-0.15389293432235718,
0.04015185311436653,
-0.038163408637046814,
-0.12289594113826752,
-0.034478455781936646,
-0.057903219014406204,
0.011534228920936584,
-0.011916225776076317,
-0.04178403317928314,
0.08155718445777893,
0.0992073342204094,
0.029158499091863632,
0.009353864938020706,
0.052096009254455566,
-0.013201983645558357,
-0.009584390558302402,
-0.07909084856510162,
-0.005674642510712147,
0.09487815201282501,
-0.000030013137802598067,
-0.004111680667847395,
-0.06244310736656189,
0.020946843549609184,
0.017430314794182777,
-0.004895592108368874,
0.04886411130428314,
-0.012902776710689068,
-0.019618475809693336,
0.0009522330365143716,
0.007909788750112057,
0.05548929423093796,
-0.018146906048059464,
-0.045539114624261856,
-0.0020199837163090706,
0.04043623059988022,
0.02436564862728119,
0.008899183012545109,
-0.0021936099510639906,
0.11575312912464142,
-0.013369547203183174,
0.03423035889863968,
0.015884697437286377,
0.04659391567111015,
-0.02840999700129032,
-0.014265968464314938,
-0.03661355376243591,
-0.03493018448352814,
0.0722256600856781,
-0.10015928745269775,
-0.012895925901830196,
0.022106679156422615,
-0.05396132543683052,
-0.021768346428871155,
-3.0590824376799276e-33,
-0.008239931426942348,
0.009710493497550488,
-0.0772702619433403,
0.03764355182647705,
0.0059791733510792255,
0.009975547902286053,
-0.0024982932955026627,
0.12130092084407806,
-0.013437073677778244,
0.016334308311343193,
0.0764707550406456,
0.03890589624643326,
-0.015183835290372372,
0.03347912058234215,
-0.07278003543615341,
-0.0003330691542942077,
0.06255641579627991,
-0.029515987262129784,
-0.028093531727790833,
-0.04361163452267647,
-0.039381854236125946,
-0.022560792043805122,
-0.044797495007514954,
-0.029660893604159355,
-0.025556102395057678,
0.019063785672187805,
-0.018522044643759727,
-0.015135716646909714,
-0.06586162000894547,
-0.06139196455478668,
-0.00988776795566082,
0.027717381715774536,
0.0159772839397192,
0.041481491178274155,
0.030387649312615395,
-0.036017581820487976,
0.019223367795348167,
0.0922558531165123,
-0.03522526100277901,
0.047423575073480606,
0.13368412852287292,
0.024636249989271164,
0.02800769731402397,
-0.021013475954532623,
0.036073170602321625,
0.025693777948617935,
-0.0596708282828331,
-0.0010948219569399953,
-0.09621317684650421,
0.02397364191710949,
-0.05157829448580742,
-0.06463074684143066,
0.00810232013463974,
0.03959999978542328,
0.04432940483093262,
-0.06796272844076157,
0.03141028806567192,
-0.05067899078130722,
-0.0015762451803311706,
-0.014206752181053162,
0.042336490005254745,
-0.10581494122743607,
0.023102818056941032,
0.08386687934398651,
0.04606729373335838,
0.01638123393058777,
-0.07425472885370255,
0.0675380751490593,
0.05346811190247536,
0.022547217085957527,
0.016993608325719833,
0.007822300307452679,
-0.030136113986372948,
0.007135104853659868,
-0.010343962348997593,
0.055191341787576675,
-0.04661819338798523,
-0.11066688597202301,
-0.016736479476094246,
0.04720989242196083,
-0.014856343157589436,
0.07861706614494324,
-0.10507607460021973,
-0.03384711220860481,
0.08585843443870544,
0.0028225723654031754,
-0.09261979162693024,
0.046938247978687286,
-0.05295490846037865,
-0.02294902317225933,
0.027194742113351822,
0.04716668650507927,
-0.13714604079723358,
0.01657036691904068,
-0.028782032430171967,
-4.7948095271976854e-8,
-0.013230318203568459,
-0.03374996781349182,
0.03629409894347191,
-0.002501977840438485,
0.01068564597517252,
0.013285958208143711,
0.007947887293994427,
0.0007600004901178181,
-0.0031551907304674387,
-0.01901335082948208,
-0.03894934058189392,
-0.03227974474430084,
0.08952338248491287,
-0.04060564562678337,
-0.028982631862163544,
-0.009847384877502918,
0.024279780685901642,
-0.018656209111213684,
-0.009030506014823914,
-0.04074520617723465,
-0.024288196116685867,
-0.08958747982978821,
0.012870359234511852,
0.05393734574317932,
-0.038543276488780975,
-0.01972920075058937,
0.09782150387763977,
0.0047368272207677364,
0.0036581172607839108,
-0.1209949180483818,
-0.08095258474349976,
0.05635596439242363,
0.02522202767431736,
-0.02398395538330078,
-0.019298763945698738,
0.04361860826611519,
-0.06084880232810974,
-0.01620892807841301,
0.008005758747458458,
0.025270022451877594,
0.050035350024700165,
0.05830926448106766,
-0.013370090164244175,
0.06332509964704514,
0.08806616067886353,
0.030974671244621277,
0.030884496867656708,
0.1014309749007225,
0.011187217198312283,
-0.03713326156139374,
-0.00966734904795885,
0.023145396262407303,
-0.04373592883348465,
-0.0066627333872020245,
-0.010320612229406834,
-0.06441304832696915,
-0.0002610934025142342,
-0.07766908407211304,
-0.020417649298906326,
-0.03116495907306671,
0.10692505538463593,
0.023239748552441597,
-0.053125184029340744,
-0.01976628787815571
] | 0.090726 |
\* `error` {Error} \* `session` {ServerHttp2Session} The `'sessionError'` event is emitted when an `'error'` event is emitted by an `Http2Session` object associated with the `Http2SecureServer`. #### Event: `'stream'` \* `stream` {Http2Stream} A reference to the stream \* `headers` {HTTP/2 Headers Object} An object describing the headers \* `flags` {number} The associated numeric flags \* `rawHeaders` {HTTP/2 Raw Headers} An array containing the raw headers The `'stream'` event is emitted when a `'stream'` event has been emitted by an `Http2Session` associated with the server. See also [`Http2Session`'s `'stream'` event][]. ```mjs import { createSecureServer, constants } from 'node:http2'; const { HTTP2\_HEADER\_METHOD, HTTP2\_HEADER\_PATH, HTTP2\_HEADER\_STATUS, HTTP2\_HEADER\_CONTENT\_TYPE, } = constants; const options = getOptionsSomehow(); const server = createSecureServer(options); server.on('stream', (stream, headers, flags) => { const method = headers[HTTP2\_HEADER\_METHOD]; const path = headers[HTTP2\_HEADER\_PATH]; // ... stream.respond({ [HTTP2\_HEADER\_STATUS]: 200, [HTTP2\_HEADER\_CONTENT\_TYPE]: 'text/plain; charset=utf-8', }); stream.write('hello '); stream.end('world'); }); ``` ```cjs const http2 = require('node:http2'); const { HTTP2\_HEADER\_METHOD, HTTP2\_HEADER\_PATH, HTTP2\_HEADER\_STATUS, HTTP2\_HEADER\_CONTENT\_TYPE, } = http2.constants; const options = getOptionsSomehow(); const server = http2.createSecureServer(options); server.on('stream', (stream, headers, flags) => { const method = headers[HTTP2\_HEADER\_METHOD]; const path = headers[HTTP2\_HEADER\_PATH]; // ... stream.respond({ [HTTP2\_HEADER\_STATUS]: 200, [HTTP2\_HEADER\_CONTENT\_TYPE]: 'text/plain; charset=utf-8', }); stream.write('hello '); stream.end('world'); }); ``` #### Event: `'timeout'` The `'timeout'` event is emitted when there is no activity on the Server for a given number of milliseconds set using `http2secureServer.setTimeout()`. \*\*Default:\*\* 2 minutes. #### Event: `'unknownProtocol'` \* `socket` {stream.Duplex} The `'unknownProtocol'` event is emitted when a connecting client fails to negotiate an allowed protocol (i.e. HTTP/2 or HTTP/1.1). The event handler receives the socket for handling. If no listener is registered for this event, the connection is terminated. A timeout may be specified using the `'unknownProtocolTimeout'` option passed to [`http2.createSecureServer()`][]. In earlier versions of Node.js, this event would be emitted if `allowHTTP1` is `false` and, during the TLS handshake, the client either does not send an ALPN extension or sends an ALPN extension that does not include HTTP/2 (`h2`). Newer versions of Node.js only emit this event if `allowHTTP1` is `false` and the client does not send an ALPN extension. If the client sends an ALPN extension that does not include HTTP/2 (or HTTP/1.1 if `allowHTTP1` is `true`), the TLS handshake will fail and no secure connection will be established. See the [Compatibility API][]. #### `server.close([callback])` \* `callback` {Function} Stops the server from establishing new sessions. This does not prevent new request streams from being created due to the persistent nature of HTTP/2 sessions. To gracefully shut down the server, call [`http2session.close()`][] on all active sessions. If `callback` is provided, it is not invoked until all active sessions have been closed, although the server has already stopped allowing new sessions. See [`tls.Server.close()`][] for more details. #### `server.setTimeout([msecs][, callback])` \* `msecs` {number} \*\*Default:\*\* `120000` (2 minutes) \* `callback` {Function} \* Returns: {Http2SecureServer} Used to set the timeout value for http2 secure server requests, and sets a callback function that is called when there is no activity on the `Http2SecureServer` after `msecs` milliseconds. The given callback is registered as a listener on the `'timeout'` event. In case if `callback` is not a function, a new `ERR\_INVALID\_ARG\_TYPE` error will be thrown. #### `server.timeout` \* Type: {number} Timeout in milliseconds. \*\*Default:\*\* 0 (no timeout) The number of milliseconds of inactivity before a socket is presumed to have timed out. A value of `0` will disable the timeout behavior on incoming connections. The socket timeout logic is set up on connection, so changing this value only affects new connections to the server, not any existing connections. #### `server.updateSettings([settings])` \* `settings` {HTTP/2 Settings Object} Used to update the server with the provided settings. Throws `ERR\_HTTP2\_INVALID\_SETTING\_VALUE` for invalid `settings` values. Throws | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.0332784578204155,
0.10018618404865265,
-0.01723272167146206,
-0.009332339279353619,
0.049209270626306534,
-0.08893351256847382,
0.02343231439590454,
0.04197302088141441,
0.0315188467502594,
0.02092222310602665,
-0.027924450114369392,
-0.072065070271492,
0.019514089450240135,
0.04013259708881378,
0.053540073335170746,
-0.009964598342776299,
-0.049753472208976746,
0.00096022745128721,
-0.012223642319440842,
-0.08771707862615585,
0.004176319111138582,
0.037006013095378876,
-0.04398718476295471,
-0.01440733578056097,
-0.035212960094213486,
0.05389709770679474,
-0.046207185834646225,
0.005512121599167585,
0.02805943787097931,
-0.021238062530755997,
0.07224331051111221,
-0.04040296748280525,
-0.21400770545005798,
-0.024518510326743126,
0.0026397444307804108,
0.04530927538871765,
0.04832359403371811,
-0.07001237571239471,
-0.011506898328661919,
-0.029237175360322,
0.08425802737474442,
0.041293900460004807,
-0.06284002959728241,
-0.014349207282066345,
-0.06014242023229599,
0.06213528662919998,
-0.04224908724427223,
0.01440867967903614,
-0.08418375998735428,
-0.04107508808374405,
-0.042134661227464676,
0.02762961946427822,
-0.02714003063738346,
0.04858017712831497,
0.008706252090632915,
-0.01069480087608099,
-0.09019511193037033,
0.04258032143115997,
-0.009723455645143986,
0.01695980876684189,
-0.00799895916134119,
-0.03167513757944107,
-0.003835837822407484,
-0.007997686043381691,
0.009715464897453785,
-0.07541188597679138,
-0.03499316796660423,
0.07110004872083664,
0.041584618389606476,
0.09277554601430893,
-0.060857389122247696,
0.04554223641753197,
-0.08581308275461197,
0.007636054418981075,
0.01944790780544281,
-0.07644428312778473,
-0.027785396203398705,
-0.01900184527039528,
-0.04807858169078827,
-0.030326172709465027,
-0.03621615841984749,
-0.12300244718790054,
0.014849428087472916,
-0.006339246407151222,
-0.008124833926558495,
0.03549252077937126,
-0.05342448130249977,
0.029551725834608078,
-0.000856884173117578,
0.035602815449237823,
-0.08797498047351837,
0.034629739820957184,
0.05858718976378441,
0.06494486331939697,
0.00930051039904356,
0.07954023778438568,
0.010158252902328968,
0.042914070188999176,
0.019368167966604233,
0.057452909648418427,
-0.0032086167484521866,
-0.010139169171452522,
-0.00770221371203661,
0.01841624267399311,
0.05400814861059189,
-0.07245547324419022,
-0.019962875172495842,
0.01911749690771103,
0.06570324301719666,
-0.050132155418395996,
0.04139545559883118,
0.05558023229241371,
0.005596565548330545,
-0.03078629821538925,
0.019058838486671448,
0.04312475025653839,
0.023075450211763382,
0.0013106006663292646,
0.024275872856378555,
0.0701223760843277,
0.11068215221166611,
-0.05174834653735161,
0.007878677919507027,
0.030334969982504845,
0.015130532905459404,
-0.060153428465127945,
0.07828069478273392,
1.369976952429958e-33,
-0.009766347706317902,
-0.03232395648956299,
-0.07695229351520538,
0.08522029221057892,
0.06054568290710449,
0.05775643512606621,
0.022284261882305145,
-0.01022582408040762,
-0.022026779130101204,
0.002843304770067334,
-0.06520871073007584,
-0.05870719626545906,
0.005714793689548969,
0.008111238479614258,
0.02177356742322445,
-0.048133693635463715,
0.05469919368624687,
-0.007412151899188757,
0.07615599781274796,
0.02403692714869976,
-0.006308756768703461,
0.01495144423097372,
0.04045472294092178,
-0.007046832703053951,
-0.02841920033097267,
-0.022773224860429764,
0.015450955368578434,
-0.03678495064377785,
-0.006265354808419943,
0.007036382798105478,
0.05379853770136833,
0.017224706709384918,
0.0029204373713582754,
-0.024805856868624687,
0.11299934983253479,
-0.05379077047109604,
0.05287737399339676,
0.0065011936239898205,
-0.09463127702474594,
-0.09149760007858276,
-0.022456329315900803,
0.05615707114338875,
-0.08761095255613327,
0.025747083127498627,
-0.05256405845284462,
-0.12241186201572418,
-0.06976381689310074,
-0.022674141451716423,
0.059947166591882706,
-0.04500485584139824,
-0.09202630072832108,
0.06280295550823212,
0.13322851061820984,
0.0057629249058663845,
0.0002942510473076254,
-0.026248572394251823,
0.013313550502061844,
0.049754079431295395,
-0.03463560342788696,
-0.020476888865232468,
0.04519370198249817,
0.04433753713965416,
-0.0539538636803627,
-0.07517466694116592,
0.05752461776137352,
0.03494763374328613,
0.02018595300614834,
0.09403025358915329,
0.028031200170516968,
0.02342953346669674,
-0.027898916974663734,
0.05155294016003609,
0.07797010987997055,
0.020124077796936035,
0.003434515791013837,
-0.005097569897770882,
0.04415477067232132,
0.03880651295185089,
0.021666185930371284,
-0.02394174225628376,
0.0669349804520607,
-0.025542018935084343,
0.03495381399989128,
0.08514813333749771,
-0.06375980377197266,
-0.008487386628985405,
-0.04971475526690483,
-0.032172586768865585,
-0.060486260801553726,
0.09879215806722641,
-0.009156832471489906,
-0.011869332753121853,
0.026211442425847054,
-0.07639570534229279,
-0.0722372904419899,
-4.9075401411792744e-33,
-0.03428131714463234,
0.07788518816232681,
-0.041620753705501556,
0.015866201370954514,
0.016724372282624245,
-0.015621235594153404,
0.0429568774998188,
0.018626417964696884,
-0.0110076405107975,
-0.010280033573508263,
0.031048769131302834,
0.021596381440758705,
0.015426572412252426,
0.017855098471045494,
-0.013832924887537956,
-0.011872505769133568,
-0.0875166729092598,
-0.013144566677510738,
0.0027567388024181128,
-0.09394384175539017,
-0.026676345616579056,
0.06954236328601837,
0.004560919478535652,
0.04218444600701332,
-0.04737222567200661,
-0.007741293404251337,
0.03538444638252258,
-0.025006871670484543,
-0.07363452762365341,
-0.035875678062438965,
0.02268882654607296,
0.056136347353458405,
-0.04420124739408493,
0.09011086076498032,
0.03224604204297066,
-0.10115498304367065,
0.06375573575496674,
0.09909968078136444,
-0.020875409245491028,
0.001579910865984857,
0.07084178924560547,
0.0565054751932621,
0.022098157554864883,
-0.016394635662436485,
0.0521855428814888,
0.0034079677425324917,
-0.042160842567682266,
0.07565910369157791,
-0.05596455559134483,
-0.0034449638333171606,
-0.07126819342374802,
-0.07067521661520004,
-0.04322030022740364,
0.03857065737247467,
-0.0037666468415409327,
-0.010799532756209373,
0.005860396195203066,
-0.003623213851824403,
0.026021303609013557,
-0.01771143637597561,
0.003911321051418781,
-0.11171209812164307,
-0.045065704733133316,
0.041437745094299316,
0.02465013973414898,
-0.01368721853941679,
-0.13814592361450195,
-0.002098623663187027,
0.06394244730472565,
0.009696058928966522,
0.011329579167068005,
-0.040619492530822754,
-0.05751846358180046,
-0.04686547815799713,
0.013667800463736057,
-0.004423275589942932,
-0.01130077987909317,
-0.0677858516573906,
0.002269453601911664,
0.0772014632821083,
-0.09515635669231415,
0.047624289989471436,
-0.03447674959897995,
0.01648244634270668,
0.08770143240690231,
-0.045515816658735275,
0.020917711779475212,
0.06437934935092926,
-0.09688375145196915,
-0.08239537477493286,
0.023021411150693893,
0.03791859745979309,
-0.09131330251693726,
-0.00776976952329278,
0.014094000682234764,
-4.468428826953641e-8,
-0.06203911453485489,
-0.10769184678792953,
-0.03611919656395912,
0.02973913960158825,
0.03109734319150448,
0.016976095736026764,
-0.06361336261034012,
-0.01768549531698227,
0.00935482606291771,
-0.02615768276154995,
-0.04418870061635971,
-0.04669218137860298,
0.0293673537671566,
-0.09143078327178955,
-0.007140243425965309,
-0.01746717467904091,
-0.03255950286984444,
-0.0039998325519263744,
-0.05126917362213135,
-0.08814884722232819,
0.051783859729766846,
-0.034513264894485474,
0.025905415415763855,
0.0490691214799881,
-0.029212988913059235,
0.0036825304850935936,
0.05845305323600769,
0.05967646837234497,
-0.004382061772048473,
-0.06748472154140472,
-0.051728904247283936,
0.029598671942949295,
0.060902856290340424,
-0.054401904344558716,
-0.04243623465299606,
0.04432191699743271,
-0.026430552825331688,
-0.012355039827525616,
0.00029367441311478615,
-0.03831551596522331,
0.032463107258081436,
0.048353161662817,
0.019765673205256462,
0.11842620372772217,
0.06674569845199585,
0.027715561911463737,
-0.005318306852132082,
0.11773678660392761,
0.04653998091816902,
-0.08994384109973907,
0.029495909810066223,
0.017647625878453255,
-0.0017124947626143694,
0.033125247806310654,
-0.0585862472653389,
-0.03497201204299927,
-0.026720432564616203,
-0.07624503970146179,
-0.01716417632997036,
-0.055057916790246964,
0.1749914586544037,
0.0656595379114151,
0.010323858819901943,
-0.04864540696144104
] | 0.080991 |
on incoming connections. The socket timeout logic is set up on connection, so changing this value only affects new connections to the server, not any existing connections. #### `server.updateSettings([settings])` \* `settings` {HTTP/2 Settings Object} Used to update the server with the provided settings. Throws `ERR\_HTTP2\_INVALID\_SETTING\_VALUE` for invalid `settings` values. Throws `ERR\_INVALID\_ARG\_TYPE` for invalid `settings` argument. ### `http2.createServer([options][, onRequestHandler])` \* `options` {Object} \* `maxDeflateDynamicTableSize` {number} Sets the maximum dynamic table size for deflating header fields. \*\*Default:\*\* `4Kib`. \* `maxSettings` {number} Sets the maximum number of settings entries per `SETTINGS` frame. The minimum value allowed is `1`. \*\*Default:\*\* `32`. \* `maxSessionMemory`{number} Sets the maximum memory that the `Http2Session` is permitted to use. The value is expressed in terms of number of megabytes, e.g. `1` equal 1 megabyte. The minimum value allowed is `1`. This is a credit based limit, existing `Http2Stream`s may cause this limit to be exceeded, but new `Http2Stream` instances will be rejected while this limit is exceeded. The current number of `Http2Stream` sessions, the current memory use of the header compression tables, current data queued to be sent, and unacknowledged `PING` and `SETTINGS` frames are all counted towards the current limit. \*\*Default:\*\* `10`. \* `maxHeaderListPairs` {number} Sets the maximum number of header entries. This is similar to [`server.maxHeadersCount`][] or [`request.maxHeadersCount`][] in the `node:http` module. The minimum value is `4`. \*\*Default:\*\* `128`. \* `maxOutstandingPings` {number} Sets the maximum number of outstanding, unacknowledged pings. \*\*Default:\*\* `10`. \* `maxSendHeaderBlockLength` {number} Sets the maximum allowed size for a serialized, compressed block of headers. Attempts to send headers that exceed this limit will result in a `'frameError'` event being emitted and the stream being closed and destroyed. While this sets the maximum allowed size to the entire block of headers, `nghttp2` (the internal http2 library) has a limit of `65536` for each decompressed key/value pair. \* `paddingStrategy` {number} The strategy used for determining the amount of padding to use for `HEADERS` and `DATA` frames. \*\*Default:\*\* `http2.constants.PADDING\_STRATEGY\_NONE`. Value may be one of: \* `http2.constants.PADDING\_STRATEGY\_NONE`: No padding is applied. \* `http2.constants.PADDING\_STRATEGY\_MAX`: The maximum amount of padding, determined by the internal implementation, is applied. \* `http2.constants.PADDING\_STRATEGY\_ALIGNED`: Attempts to apply enough padding to ensure that the total frame length, including the 9-byte header, is a multiple of 8. For each frame, there is a maximum allowed number of padding bytes that is determined by current flow control state and settings. If this maximum is less than the calculated amount needed to ensure alignment, the maximum is used and the total frame length is not necessarily aligned at 8 bytes. \* `peerMaxConcurrentStreams` {number} Sets the maximum number of concurrent streams for the remote peer as if a `SETTINGS` frame had been received. Will be overridden if the remote peer sets its own value for `maxConcurrentStreams`. \*\*Default:\*\* `100`. \* `maxSessionInvalidFrames` {integer} Sets the maximum number of invalid frames that will be tolerated before the session is closed. \*\*Default:\*\* `1000`. \* `maxSessionRejectedStreams` {integer} Sets the maximum number of rejected upon creation streams that will be tolerated before the session is closed. Each rejection is associated with an `NGHTTP2\_ENHANCE\_YOUR\_CALM` error that should tell the peer to not open any more streams, continuing to open streams is therefore regarded as a sign of a misbehaving peer. \*\*Default:\*\* `100`. \* `settings` {HTTP/2 Settings Object} The initial settings to send to the remote peer upon connection. \* `streamResetBurst` {number} and `streamResetRate` {number} Sets the rate limit for the incoming stream reset (RST\\_STREAM frame). Both settings must be set to have any effect, and default to 1000 and 33 respectively. \* `remoteCustomSettings` {Array} The array of integer values determines the settings types, which are included in | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.014734916388988495,
-0.005553801078349352,
-0.0720634013414383,
0.05994318425655365,
-0.08277201652526855,
-0.06352819502353668,
-0.0575060173869133,
0.023377254605293274,
-0.025359798222780228,
0.044047001749277115,
-0.008256680332124233,
-0.0018802732229232788,
0.04745946079492569,
-0.057000547647476196,
0.046204157173633575,
0.08509159088134766,
0.0013433686690405011,
-0.06268636137247086,
-0.10350753366947174,
0.024197446182370186,
-0.011653204448521137,
-0.052828237414360046,
-0.0011606544721871614,
-0.030781595036387444,
0.019163012504577637,
0.02869773842394352,
-0.06252380460500717,
0.009135109372437,
0.02680905908346176,
-0.008519480004906654,
0.006321985740214586,
-0.023881345987319946,
-0.1311313360929489,
0.008531640283763409,
-0.010459386743605137,
0.0072915623895823956,
0.05276704952120781,
0.000738194736186415,
0.019813718274235725,
0.05914665386080742,
0.05820729583501816,
-0.012322909198701382,
0.01641159877181053,
-0.003851636778563261,
-0.0749402791261673,
0.07091159373521805,
-0.029285894706845284,
0.0010895348386839032,
-0.06611443310976028,
-0.07427379488945007,
-0.009820978157222271,
0.06353958696126938,
-0.019249171018600464,
0.022938888520002365,
0.022146645933389664,
-0.029676398262381554,
-0.025132812559604645,
0.1278708428144455,
-0.02525501325726509,
0.06941758841276169,
-0.03141752630472183,
-0.07092206925153732,
0.05226762220263481,
0.024683210998773575,
-0.06774824857711792,
-0.02484613098204136,
0.033201176673173904,
-0.08572071045637131,
-0.006583150941878557,
0.07281143963336945,
-0.07292318344116211,
0.10758673399686813,
-0.1323075145483017,
-0.028756579384207726,
0.027378078550100327,
-0.010392628610134125,
-0.061728689819574356,
0.03478262200951576,
-0.004673080053180456,
-0.04166758805513382,
0.05573049932718277,
-0.07101909816265106,
-0.04534526914358139,
-0.003323857905343175,
-0.03503522649407387,
-0.04229746013879776,
0.027865277603268623,
0.007789578754454851,
-0.016024094074964523,
0.04947593808174133,
-0.025122594088315964,
0.0009791107149794698,
0.04132493585348129,
0.04248181730508804,
-0.046324994415044785,
0.08823443949222565,
0.02202637679874897,
0.009883535094559193,
-0.055684830993413925,
0.01893223635852337,
0.03673923388123512,
-0.11826328188180923,
-0.004095686599612236,
0.08898565918207169,
0.02343318983912468,
-0.12523134052753448,
0.006131989881396294,
0.08639120310544968,
0.04086494818329811,
0.002278935629874468,
0.052210912108421326,
0.05662861838936806,
0.05512199178338051,
-0.06107756122946739,
-0.03322445973753929,
0.11238599568605423,
0.017316782847046852,
0.007589374668896198,
-0.028260285034775734,
0.04549643397331238,
0.05159847438335419,
-0.030235571786761284,
-0.018132437020540237,
-0.08727169036865234,
-0.0152878537774086,
0.0397641621530056,
0.04382546246051788,
6.886478635974857e-33,
0.005083044990897179,
-0.029614929109811783,
-0.02733992598950863,
-0.007761703804135323,
0.06852517277002335,
0.06156211718916893,
-0.006199509836733341,
0.041408292949199677,
0.05842765048146248,
-0.027854083105921745,
-0.00713163148611784,
-0.08134756237268448,
-0.016506299376487732,
0.0063447305001318455,
0.08281121402978897,
-0.016469385474920273,
0.07855387777090073,
0.03517288342118263,
0.1504185050725937,
0.018908679485321045,
0.01035045925527811,
-0.026899736374616623,
0.002977903001010418,
0.0008690781542100012,
-0.024589592590928078,
0.04934527352452278,
0.019236339256167412,
0.07209114730358124,
-0.0991838350892067,
-0.02116239257156849,
0.08230926096439362,
0.025165757164359093,
-0.05727260559797287,
0.013840433210134506,
0.06015542894601822,
-0.0648084506392479,
-0.007127111777663231,
0.001516628311946988,
-0.000018550281311036088,
-0.0016086174873635173,
0.02726479060947895,
0.029358258470892906,
-0.13260377943515778,
0.08959022164344788,
-0.04679931327700615,
-0.07874574512243271,
-0.02122078649699688,
0.015613274648785591,
-0.039242252707481384,
-0.03006124310195446,
-0.07671830803155899,
0.04053633287549019,
0.04401177540421486,
-0.003679645247757435,
0.004571526776999235,
0.0004448371473699808,
-0.029292205348610878,
0.01925782486796379,
0.014798492193222046,
0.0031896433793008327,
0.022826526314020157,
-0.06424535065889359,
-0.0004565045819617808,
-0.0005103132571093738,
0.1053595095872879,
0.0714300200343132,
0.014311571605503559,
-0.02272317372262478,
-0.03265770897269249,
0.008732286281883717,
0.014423174783587456,
0.05162703990936279,
0.023435082286596298,
0.012795502319931984,
-0.05380961671471596,
-0.06657293438911438,
0.03835165873169899,
0.043190646916627884,
-0.015205814503133297,
-0.033904075622558594,
0.06031480431556702,
0.0682976171374321,
-0.012278592213988304,
0.00917381327599287,
-0.06339021772146225,
-0.05087699741125107,
-0.03730183094739914,
0.056117624044418335,
-0.07145737111568451,
0.025501852855086327,
0.02352813258767128,
-0.021299032494425774,
0.014899743720889091,
-0.07478176802396774,
-0.006303364410996437,
-6.188827146865645e-33,
-0.007263127248734236,
-0.010506720282137394,
-0.08452288806438446,
0.06447836011648178,
0.06162148341536522,
-0.0439600795507431,
0.015505066141486168,
0.13467632234096527,
0.01960485242307186,
-0.04620823264122009,
0.07812459021806717,
0.02037772722542286,
-0.015002734959125519,
-0.09167749434709549,
-0.09176288545131683,
0.008045345544815063,
-0.08913108706474304,
-0.05251146852970123,
0.025832032784819603,
-0.025480862706899643,
0.014825785532593727,
-0.006650697905570269,
-0.020066067576408386,
0.0767684206366539,
-0.012592675164341927,
-0.0032098786905407906,
-0.07171913236379623,
-0.03810688108205795,
-0.07718176394701004,
0.0071687945164740086,
-0.02594662271440029,
0.03504135087132454,
-0.05406688526272774,
0.06905746459960938,
-0.03768255561590195,
-0.04860584810376167,
0.0363844558596611,
0.05754147842526436,
-0.008170923218131065,
0.12852966785430908,
0.06575477868318558,
0.04586123675107956,
-0.000955951283685863,
0.043736349791288376,
0.08955521881580353,
0.03621011599898338,
-0.05177273228764534,
-0.03890243172645569,
-0.08966132998466492,
-0.006892654579132795,
-0.03427499160170555,
-0.06788448244333267,
0.033441781997680664,
0.050244830548763275,
0.07590948045253754,
-0.040660109370946884,
-0.014034011401236057,
-0.029756715521216393,
0.06227950379252434,
-0.014651468023657799,
0.0313001424074173,
-0.030761338770389557,
-0.009969502687454224,
0.08039116114377975,
0.015215130522847176,
0.09816083312034607,
-0.1078244224190712,
-0.01335506234318018,
0.020829543471336365,
0.024069894105196,
-0.03163088113069534,
-0.09239575266838074,
-0.005567464511841536,
-0.004772561136633158,
0.0042123012244701385,
-0.010682256892323494,
-0.05360044538974762,
-0.04578308016061783,
0.005647480022162199,
0.11552316695451736,
-0.1176871582865715,
0.0707484558224678,
-0.053387854248285294,
-0.06690538674592972,
0.03716113045811653,
0.012582038529217243,
-0.02730553410947323,
0.11224313825368881,
-0.01837277039885521,
-0.0075170430354774,
-0.040721431374549866,
0.0035582897253334522,
-0.0950409546494484,
-0.01696697808802128,
-0.03582439199090004,
-5.343800779655794e-8,
-0.04943285882472992,
-0.005086452700197697,
-0.06315019726753235,
0.02809060923755169,
0.07092466950416565,
-0.0010102634551003575,
-0.014688280411064625,
0.03830643370747566,
0.041644852608442307,
0.012352116405963898,
-0.017335565760731697,
0.0927586629986763,
0.05552225559949875,
0.03479785844683647,
0.018484927713871002,
-0.02870234102010727,
0.0109251094982028,
-0.036060940474271774,
-0.01529222447425127,
-0.046839434653520584,
0.03337180241942406,
-0.05013636499643326,
0.035206813365221024,
0.009607592597603798,
0.08820027112960815,
-0.06555778533220291,
0.07214385271072388,
0.06691870093345642,
-0.05723566189408302,
0.025668658316135406,
-0.06487002968788147,
-0.02116919495165348,
0.03348517417907715,
0.005011221393942833,
-0.04950539767742157,
0.027391046285629272,
-0.15013514459133148,
0.00627446174621582,
-0.01807291992008686,
0.038157667964696884,
0.04088815301656723,
-0.016092795878648758,
-0.041057128459215164,
0.013685425743460655,
0.0637705847620964,
0.05199635401368141,
0.03069199249148369,
0.12495408207178116,
-0.015122737735509872,
-0.07439234852790833,
0.02819894254207611,
0.03728072717785835,
0.014908724464476109,
-0.05378854647278786,
0.012988807633519173,
0.0010779919102787971,
0.007221133913844824,
0.0064682308584451675,
-0.0037888202350586653,
-0.013855553232133389,
-0.035967323929071426,
0.03565628081560135,
-0.011939688585698605,
-0.05979945510625839
] | -0.012238 |
connection. \* `streamResetBurst` {number} and `streamResetRate` {number} Sets the rate limit for the incoming stream reset (RST\\_STREAM frame). Both settings must be set to have any effect, and default to 1000 and 33 respectively. \* `remoteCustomSettings` {Array} The array of integer values determines the settings types, which are included in the `CustomSettings`-property of the received remoteSettings. Please see the `CustomSettings`-property of the `Http2Settings` object for more information, on the allowed setting types. \* `Http1IncomingMessage` {http.IncomingMessage} Specifies the `IncomingMessage` class to used for HTTP/1 fallback. Useful for extending the original `http.IncomingMessage`. \*\*Default:\*\* `http.IncomingMessage`. \* `Http1ServerResponse` {http.ServerResponse} Specifies the `ServerResponse` class to used for HTTP/1 fallback. Useful for extending the original `http.ServerResponse`. \*\*Default:\*\* `http.ServerResponse`. \* `Http2ServerRequest` {http2.Http2ServerRequest} Specifies the `Http2ServerRequest` class to use. Useful for extending the original `Http2ServerRequest`. \*\*Default:\*\* `Http2ServerRequest`. \* `Http2ServerResponse` {http2.Http2ServerResponse} Specifies the `Http2ServerResponse` class to use. Useful for extending the original `Http2ServerResponse`. \*\*Default:\*\* `Http2ServerResponse`. \* `unknownProtocolTimeout` {number} Specifies a timeout in milliseconds that a server should wait when an [`'unknownProtocol'`][] is emitted. If the socket has not been destroyed by that time the server will destroy it. \*\*Default:\*\* `10000`. \* `strictFieldWhitespaceValidation` {boolean} If `true`, it turns on strict leading and trailing whitespace validation for HTTP/2 header field names and values as per [RFC-9113](https://www.rfc-editor.org/rfc/rfc9113.html#section-8.2.1). \*\*Default:\*\* `true`. \* `...options` {Object} Any [`net.createServer()`][] option can be provided. \* `onRequestHandler` {Function} See [Compatibility API][] \* Returns: {Http2Server} Returns a `net.Server` instance that creates and manages `Http2Session` instances. Since there are no browsers known that support [unencrypted HTTP/2][HTTP/2 Unencrypted], the use of [`http2.createSecureServer()`][] is necessary when communicating with browser clients. ```mjs import { createServer } from 'node:http2'; // Create an unencrypted HTTP/2 server. // Since there are no browsers known that support // unencrypted HTTP/2, the use of `createSecureServer()` // is necessary when communicating with browser clients. const server = createServer(); server.on('stream', (stream, headers) => { stream.respond({ 'content-type': 'text/html; charset=utf-8', ':status': 200, }); stream.end(' # Hello World '); }); server.listen(8000); ``` ```cjs const http2 = require('node:http2'); // Create an unencrypted HTTP/2 server. // Since there are no browsers known that support // unencrypted HTTP/2, the use of `http2.createSecureServer()` // is necessary when communicating with browser clients. const server = http2.createServer(); server.on('stream', (stream, headers) => { stream.respond({ 'content-type': 'text/html; charset=utf-8', ':status': 200, }); stream.end(' # Hello World '); }); server.listen(8000); ``` ### `http2.createSecureServer(options[, onRequestHandler])` \* `options` {Object} \* `allowHTTP1` {boolean} Incoming client connections that do not support HTTP/2 will be downgraded to HTTP/1.x when set to `true`. See the [`'unknownProtocol'`][] event. See [ALPN negotiation][]. \*\*Default:\*\* `false`. \* `maxDeflateDynamicTableSize` {number} Sets the maximum dynamic table size for deflating header fields. \*\*Default:\*\* `4Kib`. \* `maxSettings` {number} Sets the maximum number of settings entries per `SETTINGS` frame. The minimum value allowed is `1`. \*\*Default:\*\* `32`. \* `maxSessionMemory`{number} Sets the maximum memory that the `Http2Session` is permitted to use. The value is expressed in terms of number of megabytes, e.g. `1` equal 1 megabyte. The minimum value allowed is `1`. This is a credit based limit, existing `Http2Stream`s may cause this limit to be exceeded, but new `Http2Stream` instances will be rejected while this limit is exceeded. The current number of `Http2Stream` sessions, the current memory use of the header compression tables, current data queued to be sent, and unacknowledged `PING` and `SETTINGS` frames are all counted towards the current limit. \*\*Default:\*\* `10`. \* `maxHeaderListPairs` {number} Sets the maximum number of header entries. This is similar to [`server.maxHeadersCount`][] or [`request.maxHeadersCount`][] in the `node:http` module. The minimum value is `4`. \*\*Default:\*\* `128`. \* `maxOutstandingPings` {number} Sets the maximum number of outstanding, unacknowledged pings. \*\*Default:\*\* `10`. \* `maxSendHeaderBlockLength` {number} Sets the maximum allowed size for a serialized, compressed block of | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
0.0017873821780085564,
-0.04554499685764313,
-0.036957997828722,
0.014298363588750362,
-0.03322910889983177,
-0.017589224502444267,
-0.03399514779448509,
-0.0017549180192872882,
0.030971860513091087,
-0.000204462165129371,
-0.022760184481739998,
0.02367614582180977,
-0.010096942074596882,
0.024394726380705833,
0.07056355476379395,
-0.017459217458963394,
0.03747283294796944,
-0.06414017081260681,
-0.08443205803632736,
-0.01149128656834364,
0.03495381027460098,
-0.040114060044288635,
0.03825296461582184,
-0.03918694704771042,
0.04843886196613312,
0.014059220440685749,
-0.05091987922787666,
-0.012827916070818901,
0.0463138148188591,
0.023296738043427467,
0.04151523485779762,
-0.03125733509659767,
-0.11648616194725037,
-0.01171591691672802,
-0.06968576461076736,
-0.01994161121547222,
0.11773484200239182,
-0.01699354499578476,
-0.021280070766806602,
0.1066296175122261,
0.08583939075469971,
-0.00979144312441349,
-0.014189232140779495,
-0.026454078033566475,
-0.042883142828941345,
0.060758333653211594,
-0.06547918170690536,
0.03609617054462433,
-0.048575613647699356,
-0.04356168955564499,
-0.025653066113591194,
0.04891379922628403,
-0.04577312245965004,
0.08789387345314026,
0.005107518285512924,
-0.03642406687140465,
-0.04981003329157829,
0.1303960382938385,
-0.006397163029760122,
0.0013511332217603922,
-0.0032010036520659924,
-0.07875809818506241,
-0.02855120785534382,
-0.0012571619590744376,
-0.06887220591306686,
-0.07079356163740158,
0.013445845805108547,
-0.016763079911470413,
0.04975488409399986,
0.02280309610068798,
-0.10872889310121536,
0.06971505284309387,
-0.09253857284784317,
0.011410576291382313,
-0.00004844532668357715,
-0.041960135102272034,
-0.010844392701983452,
0.012072011828422546,
-0.05668145418167114,
-0.05257485434412956,
0.06899567693471909,
-0.09017733484506607,
-0.03501309081912041,
-0.0001856351300375536,
-0.005622359924018383,
-0.014372847974300385,
0.05802512913942337,
0.03384364768862724,
0.02402336336672306,
0.09585139155387878,
-0.04673757776618004,
0.02809339016675949,
0.037835098803043365,
0.1106301099061966,
-0.05524356663227081,
0.1179090365767479,
-0.04261365532875061,
-0.0006288544391281903,
-0.035304538905620575,
-0.013608356937766075,
0.07156525552272797,
-0.06281650066375732,
0.04838407784700394,
0.07112116366624832,
0.028248680755496025,
-0.13168789446353912,
0.0011408657301217318,
0.12153290957212448,
0.07053316384553909,
0.012412292882800102,
0.02740945853292942,
0.01446373201906681,
0.04739980772137642,
-0.012525049038231373,
-0.026686646044254303,
0.0930461436510086,
0.0029295014683157206,
0.02063404768705368,
0.010038718581199646,
-0.0032982348930090666,
0.008594143204391003,
-0.03877197578549385,
0.048891015350818634,
-0.056751687079668045,
0.055793751031160355,
-0.010325750336050987,
0.034946709871292114,
7.028110276885588e-33,
-0.005644638556987047,
-0.03233668580651283,
-0.07274369895458221,
0.012064335867762566,
0.02376336231827736,
0.0562584288418293,
-0.016304781660437584,
0.018618077039718628,
0.03874997794628143,
-0.0401235856115818,
-0.02396332286298275,
-0.06657873094081879,
-0.006546295713633299,
0.008575189858675003,
-0.04899739474058151,
-0.020311666652560234,
0.029182160273194313,
0.05663131922483444,
0.10391361266374588,
0.04914524406194687,
-0.009367811493575573,
0.009125007316470146,
0.007314713671803474,
-0.011694351211190224,
-0.007146239746361971,
-0.0023650582879781723,
0.02329045534133911,
0.0535031259059906,
-0.08973905444145203,
-0.017842549830675125,
0.06949660927057266,
0.06342452019453049,
-0.03615217283368111,
0.020217902958393097,
0.09383038431406021,
-0.051086146384477615,
0.014880063943564892,
-0.05242694541811943,
-0.01763314940035343,
0.02152165211737156,
-0.02078075148165226,
0.009833944030106068,
-0.1317053586244583,
0.03601658344268799,
-0.09495674818754196,
-0.10691963136196136,
-0.007783728651702404,
0.012425906024873257,
-0.038423411548137665,
-0.013290999457240105,
-0.0846477821469307,
0.08446294814348221,
0.042486753314733505,
-0.018559740856289864,
0.025347352027893066,
0.0020909723825752735,
0.006448476575314999,
0.05940946191549301,
-0.06104739010334015,
0.00973173975944519,
0.0032403897494077682,
-0.08229739964008331,
0.02027232013642788,
-0.08452606201171875,
0.11292822659015656,
0.04497586563229561,
0.0010847446974366903,
-0.0024408320896327496,
0.00023395380412694067,
-0.035263750702142715,
-0.011220475658774376,
0.055326882749795914,
0.04264626279473305,
0.02261139638721943,
-0.01812857575714588,
-0.015280155465006828,
0.07905451953411102,
0.05947427079081535,
0.06782814115285873,
-0.00905492901802063,
-0.03648567199707031,
0.07738453149795532,
0.04050588607788086,
0.03319980576634407,
-0.0557807981967926,
0.024177968502044678,
0.013219313696026802,
0.002672068774700165,
-0.02343698777258396,
0.038533661514520645,
-0.0006252865423448384,
0.0035441801883280277,
0.02029922418296337,
-0.03320010006427765,
0.027106761932373047,
-5.798053886401945e-33,
-0.040034811943769455,
0.060968074947595596,
-0.10413683950901031,
0.04174955561757088,
0.01760072074830532,
-0.007295260205864906,
0.05305212736129761,
0.10845276713371277,
0.016812939196825027,
-0.02801300399005413,
0.09389746189117432,
-0.027827834710478783,
-0.04579963907599449,
-0.06675531715154648,
-0.07613784074783325,
-0.04574495181441307,
0.013263534754514694,
-0.07117871940135956,
0.020011920481920242,
-0.03222757205367088,
0.01991807483136654,
-0.030230684205889702,
-0.005420793313533068,
0.04104359447956085,
0.011148431338369846,
-0.003143410896882415,
-0.025206301361322403,
-0.03427135944366455,
-0.06464570015668869,
-0.09510113298892975,
0.08521614968776703,
0.016870740801095963,
-0.027739867568016052,
0.0011584257008507848,
-0.015540032647550106,
-0.05654453858733177,
0.06931104511022568,
0.048858772963285446,
-0.0016334675019606948,
0.0794239491224289,
0.08445709198713303,
0.05315816402435303,
-0.052716027945280075,
0.02822502702474594,
0.06978403031826019,
0.011366650462150574,
-0.05134272575378418,
-0.019837932661175728,
-0.09550686180591583,
-0.005461136810481548,
-0.011358954943716526,
-0.055658355355262756,
0.03478318080306053,
0.07924642413854599,
0.06083162873983383,
-0.007872324436903,
0.05936213955283165,
0.0023827264085412025,
0.07573141902685165,
0.0063051325269043446,
0.06689604371786118,
-0.07738525420427322,
-0.06284808367490768,
0.04879342019557953,
0.01604231260716915,
0.05508149415254593,
0.015729663893580437,
0.022747281938791275,
0.05151553452014923,
0.048907238990068436,
0.006086047273129225,
-0.09436821192502975,
0.016875701025128365,
-0.06244148313999176,
0.05351506173610687,
-0.01540798507630825,
-0.029434191063046455,
-0.04118525981903076,
-0.047123152762651443,
0.08422573655843735,
-0.07669267058372498,
0.09007629752159119,
-0.09822911024093628,
-0.017705941572785378,
0.07828698307275772,
0.008392893709242344,
0.032842665910720825,
0.07775313407182693,
-0.015379431657493114,
-0.011214599944651127,
-0.0395512692630291,
0.02649793028831482,
-0.0995512381196022,
0.07111148536205292,
0.01027353759855032,
-5.0789761729674865e-8,
-0.07874658703804016,
-0.060625795274972916,
-0.08613221347332001,
0.0017000478692352772,
-0.007317033596336842,
0.0616486594080925,
-0.08701367676258087,
-0.041273318231105804,
0.01467361394315958,
-0.04221127927303314,
-0.062488965690135956,
0.002726000966504216,
0.056896768510341644,
-0.0027899506967514753,
0.06149294972419739,
-0.09277568757534027,
0.023139532655477524,
-0.041906118392944336,
-0.0031657288782298565,
-0.013599645346403122,
0.061580002307891846,
-0.06073109060525894,
-0.0020412656012922525,
0.015869705006480217,
0.030850425362586975,
0.04184235259890556,
0.07976975291967392,
0.0829714760184288,
-0.06379596143960953,
-0.03825055807828903,
-0.05401843041181564,
-0.0016550400760024786,
0.01743537187576294,
-0.05510709062218666,
-0.06983359158039093,
0.06659547239542007,
-0.12743842601776123,
-0.0260135717689991,
0.01474394928663969,
0.062355030328035355,
0.08384574949741364,
-0.05025817081332207,
-0.0310293510556221,
0.035857755690813065,
0.09860989451408386,
0.03421340882778168,
0.0028848694637417793,
0.04413263499736786,
-0.01577921025454998,
-0.04980887100100517,
-0.04006818309426308,
0.03841729834675789,
-0.003545429091900587,
-0.059842344373464584,
0.02101733535528183,
-0.03634006530046463,
0.005834310315549374,
-0.06228451803326607,
-0.019987698644399643,
0.033506110310554504,
0.020723452791571617,
0.06402385979890823,
-0.06701021641492844,
-0.03440626710653305
] | -0.021841 |
maximum number of header entries. This is similar to [`server.maxHeadersCount`][] or [`request.maxHeadersCount`][] in the `node:http` module. The minimum value is `4`. \*\*Default:\*\* `128`. \* `maxOutstandingPings` {number} Sets the maximum number of outstanding, unacknowledged pings. \*\*Default:\*\* `10`. \* `maxSendHeaderBlockLength` {number} Sets the maximum allowed size for a serialized, compressed block of headers. Attempts to send headers that exceed this limit will result in a `'frameError'` event being emitted and the stream being closed and destroyed. \* `paddingStrategy` {number} Strategy used for determining the amount of padding to use for `HEADERS` and `DATA` frames. \*\*Default:\*\* `http2.constants.PADDING\_STRATEGY\_NONE`. Value may be one of: \* `http2.constants.PADDING\_STRATEGY\_NONE`: No padding is applied. \* `http2.constants.PADDING\_STRATEGY\_MAX`: The maximum amount of padding, determined by the internal implementation, is applied. \* `http2.constants.PADDING\_STRATEGY\_ALIGNED`: Attempts to apply enough padding to ensure that the total frame length, including the 9-byte header, is a multiple of 8. For each frame, there is a maximum allowed number of padding bytes that is determined by current flow control state and settings. If this maximum is less than the calculated amount needed to ensure alignment, the maximum is used and the total frame length is not necessarily aligned at 8 bytes. \* `peerMaxConcurrentStreams` {number} Sets the maximum number of concurrent streams for the remote peer as if a `SETTINGS` frame had been received. Will be overridden if the remote peer sets its own value for `maxConcurrentStreams`. \*\*Default:\*\* `100`. \* `maxSessionInvalidFrames` {integer} Sets the maximum number of invalid frames that will be tolerated before the session is closed. \*\*Default:\*\* `1000`. \* `maxSessionRejectedStreams` {integer} Sets the maximum number of rejected upon creation streams that will be tolerated before the session is closed. Each rejection is associated with an `NGHTTP2\_ENHANCE\_YOUR\_CALM` error that should tell the peer to not open any more streams, continuing to open streams is therefore regarded as a sign of a misbehaving peer. \*\*Default:\*\* `100`. \* `settings` {HTTP/2 Settings Object} The initial settings to send to the remote peer upon connection. \* `streamResetBurst` {number} and `streamResetRate` {number} Sets the rate limit for the incoming stream reset (RST\\_STREAM frame). Both settings must be set to have any effect, and default to 1000 and 33 respectively. \* `remoteCustomSettings` {Array} The array of integer values determines the settings types, which are included in the `customSettings`-property of the received remoteSettings. Please see the `customSettings`-property of the `Http2Settings` object for more information, on the allowed setting types. \* `...options` {Object} Any [`tls.createServer()`][] options can be provided. For servers, the identity options (`pfx` or `key`/`cert`) are usually required. \* `origins` {string\[]} An array of origin strings to send within an `ORIGIN` frame immediately following creation of a new server `Http2Session`. \* `unknownProtocolTimeout` {number} Specifies a timeout in milliseconds that a server should wait when an [`'unknownProtocol'`][] event is emitted. If the socket has not been destroyed by that time the server will destroy it. \*\*Default:\*\* `10000`. \* `strictFieldWhitespaceValidation` {boolean} If `true`, it turns on strict leading and trailing whitespace validation for HTTP/2 header field names and values as per [RFC-9113](https://www.rfc-editor.org/rfc/rfc9113.html#section-8.2.1). \*\*Default:\*\* `true`. \* `onRequestHandler` {Function} See [Compatibility API][] \* Returns: {Http2SecureServer} Returns a `tls.Server` instance that creates and manages `Http2Session` instances. ```mjs import { createSecureServer } from 'node:http2'; import { readFileSync } from 'node:fs'; const options = { key: readFileSync('server-key.pem'), cert: readFileSync('server-cert.pem'), }; // Create a secure HTTP/2 server const server = createSecureServer(options); server.on('stream', (stream, headers) => { stream.respond({ 'content-type': 'text/html; charset=utf-8', ':status': 200, }); stream.end(' # Hello World '); }); server.listen(8443); ``` ```cjs const http2 = require('node:http2'); const fs = require('node:fs'); const options = { key: fs.readFileSync('server-key.pem'), cert: fs.readFileSync('server-cert.pem'), }; // Create a secure HTTP/2 server const server = http2.createSecureServer(options); server.on('stream', (stream, headers) | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.03178010880947113,
0.06725065410137177,
-0.05698516592383385,
-0.016716012731194496,
0.02677875943481922,
-0.06357879191637039,
-0.026111066341400146,
0.04048549756407738,
0.00011155766696901992,
0.019267922267317772,
-0.05759314447641373,
-0.002304906491190195,
0.037134960293769836,
-0.03684714064002037,
-0.006751848850399256,
-0.019003257155418396,
-0.008527184836566448,
-0.050132542848587036,
-0.051037389785051346,
-0.0560612715780735,
0.016974616795778275,
0.05513455346226692,
-0.007760475389659405,
0.03230039030313492,
-0.03757879137992859,
0.0674976259469986,
-0.11509785056114197,
-0.01762283220887184,
0.06874120980501175,
-0.023316144943237305,
0.06769750267267227,
-0.03981177508831024,
-0.05015774071216583,
0.02819376066327095,
0.03936329111456871,
0.03845670446753502,
-0.007339388597756624,
-0.07197627425193787,
-0.045553408563137054,
-0.01551162637770176,
0.04428353160619736,
0.03162999823689461,
-0.032412588596343994,
0.02566000446677208,
-0.045825615525245667,
0.09956234693527222,
-0.05006695166230202,
-0.0038065582048147917,
-0.05663253739476204,
-0.0388951413333416,
-0.02533094584941864,
0.04951915517449379,
0.013737281784415245,
0.06983291357755661,
0.0006292036850936711,
-0.09915682673454285,
-0.11272809654474258,
0.015498246997594833,
-0.011941245757043362,
0.09606890380382538,
-0.08079315721988678,
-0.07657531648874283,
-0.00020787579705938697,
0.010329008102416992,
0.0017735111759975553,
-0.03514949604868889,
-0.07569205015897751,
-0.00683792307972908,
0.00962394941598177,
0.10735873132944107,
-0.017237311229109764,
0.038935791701078415,
-0.16761775314807892,
0.06651315838098526,
0.046994470059871674,
-0.016039559617638588,
-0.0674944669008255,
0.015759145841002464,
-0.03330928832292557,
-0.048718780279159546,
-0.017517762258648872,
-0.09051135927438736,
0.019870679825544357,
0.019650230184197426,
-0.015058193355798721,
0.0325997918844223,
-0.05292079597711563,
0.04024108871817589,
0.021423708647489548,
0.05940390005707741,
-0.039517842233181,
0.0321149080991745,
0.039559826254844666,
0.13662214577198029,
-0.03439928963780403,
0.11388417333364487,
-0.012293288484215736,
0.01371927373111248,
-0.07321824878454208,
0.06900476664304733,
0.03989797085523605,
-0.09511086344718933,
0.011898736469447613,
0.023622313514351845,
0.011480526067316532,
-0.11720243841409683,
0.006085887551307678,
0.08655307441949844,
0.01732879877090454,
-0.029649635776877403,
0.015933575108647346,
-0.004302590154111385,
0.00894326064735651,
-0.05102452635765076,
-0.01943310536444187,
0.015081596560776234,
0.01209617406129837,
0.016889305785298347,
0.014123228378593922,
0.008957690559327602,
0.08416424691677094,
-0.051622021943330765,
-0.022277290001511574,
-0.0859963595867157,
0.01985905133187771,
-0.01107209175825119,
0.0504252165555954,
5.687654763050578e-33,
0.0312117300927639,
0.0048920996487140656,
-0.041853103786706924,
0.034661661833524704,
0.027170632034540176,
0.00927196815609932,
0.026144124567508698,
0.07887639850378036,
-0.02008414827287197,
0.030623646453022957,
-0.018509207293391228,
-0.05689435824751854,
0.06511946767568588,
0.061977412551641464,
0.05566957965493202,
-0.08100537210702896,
0.0754065290093422,
0.0656328871846199,
0.03709585219621658,
0.029733797535300255,
-0.0022438603918999434,
-0.0163609329611063,
0.01620595157146454,
0.0017225212650373578,
-0.045675817877054214,
0.07414600253105164,
-0.03479750454425812,
-0.017827965319156647,
-0.09671603888273239,
0.020370645448565483,
0.007415472529828548,
0.038831330835819244,
-0.019126364961266518,
-0.015509332530200481,
0.09842505306005478,
-0.013663309626281261,
0.02631768211722374,
-0.019864998757839203,
-0.08752232044935226,
-0.012596112675964832,
-0.04422258958220482,
-0.002129588508978486,
-0.08495105057954788,
0.036141131073236465,
-0.07396621257066727,
-0.1057334616780281,
-0.029448363929986954,
-0.038954660296440125,
-0.05648956075310707,
0.02872014231979847,
-0.01901797577738762,
0.05129512399435043,
0.11074288189411163,
0.016780486330389977,
0.031893059611320496,
-0.008504221215844154,
0.00852909591048956,
0.006667009089142084,
0.018193788826465607,
0.04331070929765701,
0.044528719037771225,
-0.041347306221723557,
0.01820775680243969,
-0.04791689291596413,
0.11658534407615662,
0.05113614350557327,
0.02670562081038952,
0.056824710220098495,
-0.004437553230673075,
0.004302796442061663,
0.030108079314231873,
0.021805834025144577,
0.045270439237356186,
0.04403075948357582,
-0.07725164294242859,
-0.0431378111243248,
0.05160381644964218,
0.015734093263745308,
0.029645081609487534,
-0.015527625568211079,
0.02559605985879898,
0.02463776431977749,
0.07364068925380707,
-0.017217935994267464,
-0.06078452616930008,
-0.03874725475907326,
-0.011976235546171665,
0.007804308086633682,
-0.04460574686527252,
0.005253045354038477,
0.004928912967443466,
-0.04562731832265854,
-0.0021629109978675842,
-0.04721430316567421,
-0.06230751797556877,
-5.6046446580733695e-33,
0.052714936435222626,
0.03287283331155777,
-0.12601710855960846,
0.011408002115786076,
0.007495885714888573,
-0.03456030413508415,
0.06552685052156448,
0.09664507955312729,
0.008852524682879448,
-0.04280702769756317,
0.07303562015295029,
0.02849511243402958,
0.003259550081565976,
0.010871815495193005,
-0.02615700662136078,
0.007868397049605846,
-0.060883741825819016,
-0.062264151871204376,
0.004416760988533497,
-0.06659922003746033,
-0.03788425400853157,
-0.028921062126755714,
-0.03534325584769249,
0.06360820680856705,
0.0024332720786333084,
0.00108251441270113,
-0.015820791944861412,
-0.044008251279592514,
-0.03640802949666977,
-0.055417630821466446,
0.04342946037650108,
-0.011553134769201279,
-0.04517094045877457,
0.006042306311428547,
0.03109986148774624,
-0.04665213078260422,
0.05039813742041588,
0.13193950057029724,
0.057302139699459076,
0.0443052276968956,
0.09396049380302429,
0.046124354004859924,
0.051702506840229034,
0.01806304231286049,
0.09407801181077957,
-0.037554048001766205,
-0.05802938714623451,
0.033222831785678864,
-0.02007949724793434,
-0.009424502961337566,
-0.01915265992283821,
-0.0504661425948143,
0.02521989494562149,
0.08025502413511276,
0.03221137449145317,
-0.022070899605751038,
-0.024681247770786285,
0.06454171985387802,
0.03094356879591942,
-0.05706297978758812,
0.05030672997236252,
-0.040948305279016495,
-0.08738198131322861,
0.09505119919776917,
0.0409424751996994,
0.015546840615570545,
-0.09145886451005936,
-0.07992883026599884,
-0.04170352220535278,
-0.009428144432604313,
0.002511576283723116,
-0.04011674225330353,
-0.054604750126600266,
0.045472387224435806,
-0.00625017611309886,
-0.022885635495185852,
0.04296800121665001,
-0.03754687309265137,
-0.02227664366364479,
0.11216194182634354,
-0.10203777253627777,
0.07910951226949692,
-0.049082010984420776,
0.010519880801439285,
0.07639271020889282,
-0.020717479288578033,
-0.024019762873649597,
0.05384248122572899,
-0.05706467479467392,
-0.0461818128824234,
0.025875315070152283,
0.011252149939537048,
-0.060083430260419846,
0.05913754552602768,
-0.04526079073548317,
-5.311384043693579e-8,
-0.08441615849733353,
-0.0461454875767231,
-0.09946954995393753,
-0.046469349414110184,
0.025944668799638748,
0.08555735647678375,
0.025577133521437645,
-0.023928606882691383,
0.045511744916439056,
-0.044430457055568695,
0.04514392465353012,
-0.015125609934329987,
-0.02069908194243908,
-0.04403200373053551,
-0.021237952634692192,
-0.03336841240525246,
-0.0425444133579731,
-0.04186241328716278,
-0.029111580923199654,
-0.08267276734113693,
-0.0025051210541278124,
-0.025714250281453133,
0.007138054817914963,
-0.04383407160639763,
-0.0006519604939967394,
-0.019269287586212158,
0.07851745188236237,
0.1290029138326645,
-0.06912311911582947,
-0.08699141442775726,
-0.07243432104587555,
0.03654615581035614,
0.02832150273025036,
-0.0958927646279335,
0.01766510307788849,
0.10657711327075958,
-0.10750789195299149,
0.007380519062280655,
0.0046264068223536015,
0.015741322189569473,
-0.013077582232654095,
-0.010317656211555004,
0.018631089478731155,
0.009708310477435589,
0.08827368170022964,
0.07160039246082306,
-0.010606496594846249,
0.10592098534107208,
-0.011613911017775536,
-0.07743991911411285,
0.05230660364031792,
0.04409350827336311,
0.016883570700883865,
0.03138825669884682,
-0.03619399294257164,
-0.007190150208771229,
-0.010809089988470078,
-0.07924655824899673,
-0.00012524779594969004,
0.027262825518846512,
0.0769280418753624,
0.07765040546655655,
0.003580847755074501,
0.02832658588886261
] | 0.12071 |
(stream, headers) => { stream.respond({ 'content-type': 'text/html; charset=utf-8', ':status': 200, }); stream.end(' # Hello World '); }); server.listen(8443); ``` ```cjs const http2 = require('node:http2'); const fs = require('node:fs'); const options = { key: fs.readFileSync('server-key.pem'), cert: fs.readFileSync('server-cert.pem'), }; // Create a secure HTTP/2 server const server = http2.createSecureServer(options); server.on('stream', (stream, headers) => { stream.respond({ 'content-type': 'text/html; charset=utf-8', ':status': 200, }); stream.end(' # Hello World '); }); server.listen(8443); ``` ### `http2.connect(authority[, options][, listener])` \* `authority` {string|URL} The remote HTTP/2 server to connect to. This must be in the form of a minimal, valid URL with the `http://` or `https://` prefix, host name, and IP port (if a non-default port is used). Userinfo (user ID and password), path, querystring, and fragment details in the URL will be ignored. \* `options` {Object} \* `maxDeflateDynamicTableSize` {number} Sets the maximum dynamic table size for deflating header fields. \*\*Default:\*\* `4Kib`. \* `maxSettings` {number} Sets the maximum number of settings entries per `SETTINGS` frame. The minimum value allowed is `1`. \*\*Default:\*\* `32`. \* `maxSessionMemory`{number} Sets the maximum memory that the `Http2Session` is permitted to use. The value is expressed in terms of number of megabytes, e.g. `1` equal 1 megabyte. The minimum value allowed is `1`. This is a credit based limit, existing `Http2Stream`s may cause this limit to be exceeded, but new `Http2Stream` instances will be rejected while this limit is exceeded. The current number of `Http2Stream` sessions, the current memory use of the header compression tables, current data queued to be sent, and unacknowledged `PING` and `SETTINGS` frames are all counted towards the current limit. \*\*Default:\*\* `10`. \* `maxHeaderListPairs` {number} Sets the maximum number of header entries. This is similar to [`server.maxHeadersCount`][] or [`request.maxHeadersCount`][] in the `node:http` module. The minimum value is `1`. \*\*Default:\*\* `128`. \* `maxOutstandingPings` {number} Sets the maximum number of outstanding, unacknowledged pings. \*\*Default:\*\* `10`. \* `maxReservedRemoteStreams` {number} Sets the maximum number of reserved push streams the client will accept at any given time. Once the current number of currently reserved push streams exceeds reaches this limit, new push streams sent by the server will be automatically rejected. The minimum allowed value is 0. The maximum allowed value is 232-1. A negative value sets this option to the maximum allowed value. \*\*Default:\*\* `200`. \* `maxSendHeaderBlockLength` {number} Sets the maximum allowed size for a serialized, compressed block of headers. Attempts to send headers that exceed this limit will result in a `'frameError'` event being emitted and the stream being closed and destroyed. \* `paddingStrategy` {number} Strategy used for determining the amount of padding to use for `HEADERS` and `DATA` frames. \*\*Default:\*\* `http2.constants.PADDING\_STRATEGY\_NONE`. Value may be one of: \* `http2.constants.PADDING\_STRATEGY\_NONE`: No padding is applied. \* `http2.constants.PADDING\_STRATEGY\_MAX`: The maximum amount of padding, determined by the internal implementation, is applied. \* `http2.constants.PADDING\_STRATEGY\_ALIGNED`: Attempts to apply enough padding to ensure that the total frame length, including the 9-byte header, is a multiple of 8. For each frame, there is a maximum allowed number of padding bytes that is determined by current flow control state and settings. If this maximum is less than the calculated amount needed to ensure alignment, the maximum is used and the total frame length is not necessarily aligned at 8 bytes. \* `peerMaxConcurrentStreams` {number} Sets the maximum number of concurrent streams for the remote peer as if a `SETTINGS` frame had been received. Will be overridden if the remote peer sets its own value for `maxConcurrentStreams`. \*\*Default:\*\* `100`. \* `protocol` {string} The protocol to connect with, if not set in the `authority`. Value may be either `'http:'` or `'https:'`. \*\*Default:\*\* `'https:'` \* `settings` {HTTP/2 Settings Object} The initial settings to send to the remote | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.02369374781847,
0.0825905054807663,
-0.07220113277435303,
-0.03398323431611061,
0.027440886944532394,
-0.08629810810089111,
-0.062014974653720856,
0.0706869587302208,
0.04354310408234596,
-0.02435043267905712,
-0.02622593753039837,
-0.02884007804095745,
-0.010339128784835339,
0.038771409541368484,
0.0473150797188282,
-0.05944211035966873,
-0.04435756430029869,
0.025366097688674927,
0.05464763939380646,
-0.07104912400245667,
-0.016303306445479393,
-0.04872550070285797,
0.050352875143289566,
-0.0007963852840475738,
-0.07889656722545624,
-0.0007511625881306827,
-0.033397357910871506,
0.08851572126150131,
0.015660598874092102,
-0.007236667908728123,
0.10975462943315506,
-0.06707500666379929,
-0.054576974362134933,
-0.022675499320030212,
-0.1485249400138855,
0.06993110477924347,
0.016817189753055573,
-0.0947493240237236,
-0.054270461201667786,
-0.04147566854953766,
0.08941818028688431,
0.06780445575714111,
-0.04776228219270706,
0.00609276769682765,
-0.0074114021845161915,
0.025790700688958168,
-0.0354498028755188,
-0.001008545164950192,
-0.042547207325696945,
-0.0064119310118258,
-0.07253928482532501,
-0.028492024168372154,
-0.06596773117780685,
0.02125832997262478,
-0.09564349800348282,
0.002355320146307349,
-0.06804173439741135,
0.05772445723414421,
0.006227624136954546,
0.03635203465819359,
0.007263699546456337,
-0.07537297904491425,
0.025281494483351707,
-0.02443988248705864,
-0.004863097332417965,
-0.0011829262366518378,
-0.03955138847231865,
0.07680554687976837,
-0.011060058139264584,
0.07975807785987854,
-0.009079581126570702,
0.012574130669236183,
-0.02749810926616192,
-0.02846233919262886,
-0.029212823137640953,
-0.12613576650619507,
-0.0253355260938406,
-0.014255720190703869,
-0.07533822953701019,
0.06974612176418304,
0.008231011219322681,
-0.10075195133686066,
-0.030626608058810234,
0.02666870877146721,
-0.043765246868133545,
0.05776296183466911,
0.022890308871865273,
-0.001205266802571714,
-0.02223007008433342,
-0.01210679579526186,
-0.0479174479842186,
0.026383331045508385,
-0.004829623736441135,
0.04835735261440277,
0.007300168741494417,
0.1002955213189125,
-0.019982049241662025,
0.02621997892856598,
-0.004777533933520317,
-0.0068685817532241344,
-0.006703910883516073,
-0.014623159542679787,
0.026611458510160446,
-0.05045975744724274,
0.021223407238721848,
-0.05038813501596451,
-0.016027839854359627,
0.14474311470985413,
0.0484524630010128,
-0.019654516130685806,
0.013639830984175205,
0.022166728973388672,
-0.023510832339525223,
-0.03193635120987892,
-0.08888974785804749,
0.07962749898433685,
0.022814961150288582,
-0.02481367066502571,
0.037924859672784805,
0.06825972348451614,
0.047365520149469376,
-0.05084938555955887,
-0.049782298505306244,
0.034742336720228195,
0.014463388361036777,
-0.06544112414121628,
0.1404094099998474,
3.559132040718967e-33,
0.013433663174510002,
-0.03145185858011246,
0.010384919121861458,
0.07111380249261856,
0.033884625881910324,
-0.011279240250587463,
0.06487474590539932,
-0.05192745104432106,
-0.05518736317753792,
-0.03659687936306,
0.000007518567599618109,
-0.030516184866428375,
0.010009676218032837,
-0.03977416455745697,
-0.02741488255560398,
-0.0647018700838089,
0.04714760184288025,
-0.0036788168363273144,
0.11104685813188553,
0.024523213505744934,
0.026528066024184227,
-0.02497384324669838,
0.03791755437850952,
-0.024126973003149033,
0.05384651944041252,
-0.005837978329509497,
0.04518868774175644,
0.010065101087093353,
-0.059514015913009644,
-0.04801620543003082,
0.08345694094896317,
0.02366875484585762,
0.008789152838289738,
-0.005880523007363081,
0.1163039430975914,
-0.06385387480258942,
0.08559636026620865,
0.05428650602698326,
-0.07478579133749008,
-0.03814423084259033,
0.10839121788740158,
-0.0026149239856749773,
-0.006301071960479021,
0.05636894702911377,
-0.04176093637943268,
-0.023606397211551666,
-0.087702676653862,
-0.05097539722919464,
0.04595271497964859,
0.01666761189699173,
-0.07023020833730698,
0.01703290455043316,
-0.0024379256647080183,
0.00427135219797492,
0.043846916407346725,
0.02071830816566944,
-0.05359674245119095,
0.007063187658786774,
-0.09112483263015747,
-0.0819871723651886,
0.039150990545749664,
0.01860727369785309,
0.006029255222529173,
-0.10594777017831802,
0.05676470696926117,
0.004476743750274181,
-0.06454138457775116,
0.05034433305263519,
0.012781962752342224,
-0.022533876821398735,
-0.03895251825451851,
0.004333075135946274,
0.06876755505800247,
0.023674407973885536,
0.02485192008316517,
0.10080775618553162,
-0.014159785583615303,
0.031102919951081276,
0.08543720096349716,
-0.029868241399526596,
0.05683371052145958,
0.014413160271942616,
0.0182263795286417,
0.10933957248926163,
0.06894370168447495,
0.01513680536299944,
-0.05281791463494301,
0.0111124562099576,
0.052948180586099625,
0.05182584747672081,
-0.05017660930752754,
0.04356032609939575,
0.054306406527757645,
-0.07249246537685394,
-0.03177467733621597,
-4.40334085941084e-33,
-0.03007306344807148,
-0.0023367588873952627,
-0.057476069778203964,
0.060433145612478256,
0.04938222095370293,
0.006014529149979353,
0.009619046002626419,
0.03259827941656113,
0.032142188400030136,
0.08271436393260956,
-0.0012891381047666073,
-0.0004202827112749219,
0.05237388610839844,
0.021296747028827667,
-0.047987040132284164,
-0.01982276141643524,
-0.05261523649096489,
0.01527902390807867,
0.00987100601196289,
-0.05236291140317917,
-0.07214445620775223,
-0.01181371696293354,
0.06035500764846802,
0.059563614428043365,
-0.016149049624800682,
0.04541692137718201,
-0.03128935396671295,
-0.0020593542139977217,
-0.10149574279785156,
-0.04995822161436081,
-0.038005538284778595,
0.06799405068159103,
0.011933867819607258,
0.06593843549489975,
-0.006232621613889933,
-0.10895705968141556,
0.03012380562722683,
0.13256098330020905,
0.04503012076020241,
0.05299367010593414,
0.04077006131410599,
-0.016939332708716393,
-0.01144084520637989,
-0.048572249710559845,
0.04143669828772545,
-0.013022190891206264,
0.06495507806539536,
0.027898916974663734,
-0.06755290180444717,
0.02241864800453186,
-0.01841520145535469,
-0.01054894458502531,
-0.026370685547590256,
-0.004270750563591719,
0.047369230538606644,
-0.04558287560939789,
0.014284621924161911,
0.021384816616773605,
0.014998477883636951,
-0.004916597157716751,
0.05395211651921272,
-0.1377357840538025,
-0.047840844839811325,
0.001668138662353158,
0.04897947609424591,
0.000057168039347743616,
-0.1130717322230339,
0.06330329924821854,
0.05399691313505173,
0.028987817466259003,
-0.06572927534580231,
-0.023724732920527458,
0.004058405291289091,
-0.04909849539399147,
0.0905727967619896,
-0.019638946279883385,
-0.018306279554963112,
-0.06199454516172409,
0.03225196152925491,
0.10145668685436249,
0.006398443132638931,
0.067518450319767,
-0.10256994515657425,
0.029642686247825623,
0.1308785378932953,
-0.00962036196142435,
-0.017343740910291672,
-0.04463664069771767,
-0.06798585504293442,
-0.04097592085599899,
0.01659342460334301,
0.0702165961265564,
-0.0844140574336052,
-0.003143720794469118,
0.06814372539520264,
-4.5389718650312716e-8,
-0.03329522907733917,
-0.012299803085625172,
-0.0857720598578453,
0.019515151157975197,
0.007561060134321451,
0.006955510005354881,
-0.035917337983846664,
-0.09831249713897705,
0.010572739876806736,
-0.0322849340736866,
-0.10177712887525558,
-0.060613833367824554,
0.04474959522485733,
-0.02679434046149254,
-0.013363752514123917,
-0.032560255378484726,
-0.0006449131760746241,
-0.015254653058946133,
0.014451174065470695,
-0.03409453108906746,
0.037957221269607544,
-0.04307828098535538,
0.014269629493355751,
0.09558504074811935,
0.003716561011970043,
0.004060312639921904,
0.05455317720770836,
-0.022547060623764992,
-0.037540387362241745,
-0.005534564144909382,
-0.06755103170871735,
-0.0070427656173706055,
-0.0036420507822185755,
-0.02620569057762623,
0.02581830509006977,
-0.018635787069797516,
-0.057293601334095,
-0.007295628078281879,
0.011808061972260475,
0.04592280089855194,
0.10778038948774338,
0.0701032355427742,
-0.012523110024631023,
0.04310418665409088,
-0.006222553085535765,
0.04173048213124275,
0.07323212176561356,
0.0019497574539855123,
0.009568946436047554,
0.013096191920340061,
0.05373094230890274,
-0.03837860748171806,
0.009557054378092289,
-0.038842059671878815,
-0.06955647468566895,
0.0077044423669576645,
0.010328558273613453,
-0.08466385304927826,
-0.05074003338813782,
-0.04130163416266441,
0.09851580113172531,
0.033953748643398285,
0.04451850801706314,
-0.01538556907325983
] | -0.039701 |
be overridden if the remote peer sets its own value for `maxConcurrentStreams`. \*\*Default:\*\* `100`. \* `protocol` {string} The protocol to connect with, if not set in the `authority`. Value may be either `'http:'` or `'https:'`. \*\*Default:\*\* `'https:'` \* `settings` {HTTP/2 Settings Object} The initial settings to send to the remote peer upon connection. \* `remoteCustomSettings` {Array} The array of integer values determines the settings types, which are included in the `CustomSettings`-property of the received remoteSettings. Please see the `CustomSettings`-property of the `Http2Settings` object for more information, on the allowed setting types. \* `createConnection` {Function} An optional callback that receives the `URL` instance passed to `connect` and the `options` object, and returns any [`Duplex`][] stream that is to be used as the connection for this session. \* `...options` {Object} Any [`net.connect()`][] or [`tls.connect()`][] options can be provided. \* `unknownProtocolTimeout` {number} Specifies a timeout in milliseconds that a server should wait when an [`'unknownProtocol'`][] event is emitted. If the socket has not been destroyed by that time the server will destroy it. \*\*Default:\*\* `10000`. \* `strictFieldWhitespaceValidation` {boolean} If `true`, it turns on strict leading and trailing whitespace validation for HTTP/2 header field names and values as per [RFC-9113](https://www.rfc-editor.org/rfc/rfc9113.html#section-8.2.1). \*\*Default:\*\* `true`. \* `listener` {Function} Will be registered as a one-time listener of the [`'connect'`][] event. \* Returns: {ClientHttp2Session} Returns a `ClientHttp2Session` instance. ```mjs import { connect } from 'node:http2'; const client = connect('https://localhost:1234'); /\* Use the client \*/ client.close(); ``` ```cjs const http2 = require('node:http2'); const client = http2.connect('https://localhost:1234'); /\* Use the client \*/ client.close(); ``` ### `http2.constants` #### Error codes for `RST\_STREAM` and `GOAWAY` | Value | Name | Constant | | ------ | ------------------- | --------------------------------------------- | | `0x00` | No Error | `http2.constants.NGHTTP2\_NO\_ERROR` | | `0x01` | Protocol Error | `http2.constants.NGHTTP2\_PROTOCOL\_ERROR` | | `0x02` | Internal Error | `http2.constants.NGHTTP2\_INTERNAL\_ERROR` | | `0x03` | Flow Control Error | `http2.constants.NGHTTP2\_FLOW\_CONTROL\_ERROR` | | `0x04` | Settings Timeout | `http2.constants.NGHTTP2\_SETTINGS\_TIMEOUT` | | `0x05` | Stream Closed | `http2.constants.NGHTTP2\_STREAM\_CLOSED` | | `0x06` | Frame Size Error | `http2.constants.NGHTTP2\_FRAME\_SIZE\_ERROR` | | `0x07` | Refused Stream | `http2.constants.NGHTTP2\_REFUSED\_STREAM` | | `0x08` | Cancel | `http2.constants.NGHTTP2\_CANCEL` | | `0x09` | Compression Error | `http2.constants.NGHTTP2\_COMPRESSION\_ERROR` | | `0x0a` | Connect Error | `http2.constants.NGHTTP2\_CONNECT\_ERROR` | | `0x0b` | Enhance Your Calm | `http2.constants.NGHTTP2\_ENHANCE\_YOUR\_CALM` | | `0x0c` | Inadequate Security | `http2.constants.NGHTTP2\_INADEQUATE\_SECURITY` | | `0x0d` | HTTP/1.1 Required | `http2.constants.NGHTTP2\_HTTP\_1\_1\_REQUIRED` | The `'timeout'` event is emitted when there is no activity on the Server for a given number of milliseconds set using `http2server.setTimeout()`. ### `http2.getDefaultSettings()` \* Returns: {HTTP/2 Settings Object} Returns an object containing the default settings for an `Http2Session` instance. This method returns a new object instance every time it is called so instances returned may be safely modified for use. ### `http2.getPackedSettings([settings])` \* `settings` {HTTP/2 Settings Object} \* Returns: {Buffer} Returns a `Buffer` instance containing serialized representation of the given HTTP/2 settings as specified in the [HTTP/2][] specification. This is intended for use with the `HTTP2-Settings` header field. ```mjs import { getPackedSettings } from 'node:http2'; const packed = getPackedSettings({ enablePush: false }); console.log(packed.toString('base64')); // Prints: AAIAAAAA ``` ```cjs const http2 = require('node:http2'); const packed = http2.getPackedSettings({ enablePush: false }); console.log(packed.toString('base64')); // Prints: AAIAAAAA ``` ### `http2.getUnpackedSettings(buf)` \* `buf` {Buffer|TypedArray} The packed settings. \* Returns: {HTTP/2 Settings Object} Returns a [HTTP/2 Settings Object][] containing the deserialized settings from the given `Buffer` as generated by `http2.getPackedSettings()`. ### `http2.performServerHandshake(socket[, options])` \* `socket` {stream.Duplex} \* `options` {Object} Any [`http2.createServer()`][] option can be provided. \* Returns: {ServerHttp2Session} Create an HTTP/2 server session from an existing socket. ### `http2.sensitiveHeaders` \* Type: {symbol} This symbol can be set as a property on the HTTP/2 headers object | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.003667504293844104,
0.0036018318496644497,
-0.05454730987548828,
0.018131976947188377,
-0.10214893519878387,
-0.026223119348287582,
-0.0283365361392498,
0.01982392929494381,
-0.037878021597862244,
0.0374903604388237,
-0.01695486530661583,
0.007200402207672596,
0.04120590537786484,
0.03944466635584831,
0.08882573992013931,
0.005694266874343157,
0.06670407950878143,
-0.048619333654642105,
-0.09738262742757797,
-0.002299089916050434,
0.053076159209012985,
-0.07179766148328781,
0.004994808230549097,
-0.04771703854203224,
-0.021252239122986794,
-0.04301369562745094,
-0.030100280418992043,
-0.00574401393532753,
0.05030244216322899,
0.013295645825564861,
-0.0021059680730104446,
0.007926629856228828,
-0.12535077333450317,
0.003216680372133851,
-0.03451240062713623,
-0.00003557516902219504,
0.10254945605993271,
-0.0779428780078888,
0.022759297862648964,
0.08440656214952469,
0.0989455059170723,
-0.03403955698013306,
-0.0482240729033947,
-0.005621518474072218,
-0.08465337008237839,
0.0429372675716877,
-0.02768676169216633,
0.019811931997537613,
-0.05606267601251602,
-0.05757179483771324,
-0.03480186685919762,
0.05450492724776268,
0.000455194094683975,
0.07809053361415863,
0.014024036005139351,
-0.022965259850025177,
-0.04090309888124466,
0.10350751131772995,
0.05552009493112564,
0.0246504507958889,
-0.052262403070926666,
-0.060159314423799515,
-0.014182818122208118,
0.008968081325292587,
-0.013710137456655502,
-0.04472346603870392,
-0.00617020670324564,
0.04022752866148949,
-0.00800815038383007,
0.023105433210730553,
-0.05750860646367073,
0.04104936867952347,
-0.059582196176052094,
-0.02843925729393959,
0.048407748341560364,
-0.0924866795539856,
-0.06093641743063927,
-0.007349413353949785,
-0.0804409459233284,
-0.07123158872127533,
0.030070360749959946,
-0.0830397680401802,
-0.009164724498987198,
0.016142647713422775,
-0.03072839044034481,
-0.025268657132983208,
0.012441376224160194,
0.03924698010087013,
0.07658720761537552,
0.09339921176433563,
-0.10206101834774017,
0.0316743366420269,
-0.04482174664735794,
0.033913616091012955,
-0.026376474648714066,
0.09670569747686386,
-0.02528906986117363,
-0.054974958300590515,
-0.026831304654479027,
-0.027243733406066895,
0.043172478675842285,
-0.07142265141010284,
0.03876650705933571,
-0.00042921039857901633,
0.022657126188278198,
-0.10451777279376984,
-0.022307515144348145,
0.06522022187709808,
0.07630089670419693,
0.0390399768948555,
0.0012856669491156936,
0.03714612126350403,
0.02906928025186062,
-0.07021477818489075,
0.0032599421683698893,
0.10919472575187683,
0.03805631399154663,
0.07433584332466125,
0.031100720167160034,
-0.0036272539291530848,
0.02730453759431839,
-0.060672253370285034,
0.06466903537511826,
0.021047404035925865,
0.04005333036184311,
0.009534195996820927,
0.06248844042420387,
3.4245754064322475e-33,
0.022888578474521637,
-0.04282727092504501,
-0.06594481319189072,
0.04555923864245415,
0.05125004053115845,
0.05668452009558678,
0.05230506509542465,
0.016993436962366104,
-0.052221886813640594,
-0.03170560672879219,
-0.018278080970048904,
0.00037312565837055445,
0.001989822369068861,
0.03033040091395378,
-0.05790445953607559,
0.008620240725576878,
0.061341285705566406,
0.05556729435920715,
0.1276833564043045,
0.08721057325601578,
0.04015536233782768,
0.022270480170845985,
0.04544799402356148,
-0.003252252470701933,
0.009028797969222069,
-0.04540310055017471,
-0.010516384616494179,
0.04674721509218216,
-0.04574868455529213,
-0.012380608357489109,
0.10533706843852997,
0.05246155336499214,
0.016324849799275398,
0.0034391223452985287,
0.0820624828338623,
-0.04091421887278557,
-0.028414921835064888,
0.007627206388860941,
-0.011033598333597183,
0.01638142019510269,
0.03629741817712784,
-0.04527491703629494,
-0.06469812989234924,
0.03432610630989075,
-0.06147124990820885,
-0.06370407342910767,
-0.010808030143380165,
-0.03373017907142639,
-0.002935599535703659,
-0.013458679430186749,
-0.10279406607151031,
0.05052373185753822,
0.016276225447654724,
-0.040978215634822845,
0.01580890640616417,
-0.05967545881867409,
-0.028459759429097176,
0.030705174431204796,
-0.05210656300187111,
-0.04638906568288803,
-0.009886976331472397,
-0.015422064810991287,
-0.015763292089104652,
-0.04324531555175781,
0.07123071700334549,
0.01957281306385994,
-0.02330571413040161,
0.01944747567176819,
0.049145665019750595,
-0.027133306488394737,
-0.06661849468946457,
0.09746582061052322,
0.0030459538102149963,
0.015105069614946842,
0.005603112746030092,
-0.01667427457869053,
0.0361383855342865,
0.04970395937561989,
0.10727493464946747,
-0.030355265364050865,
-0.011447340250015259,
0.09175989031791687,
0.03433309122920036,
0.07888402044773102,
-0.04900549352169037,
-0.025395352393388748,
-0.05105186998844147,
0.020028069615364075,
-0.058419886976480484,
0.03516577556729317,
0.008778340183198452,
-0.03611636906862259,
0.009263903833925724,
-0.026196330785751343,
0.012904483824968338,
-4.935577885498294e-33,
0.023407937958836555,
0.000316299352562055,
-0.02818829007446766,
0.0791386067867279,
0.04871740937232971,
-0.049295973032712936,
0.0365222692489624,
0.023143090307712555,
0.008801191113889217,
-0.011379972100257874,
0.09079057723283768,
-0.009695319458842278,
-0.010110478848218918,
-0.08324373513460159,
-0.02791241742670536,
-0.017355071380734444,
-0.06297919154167175,
-0.05682983994483948,
0.04215652868151665,
-0.09794017672538757,
0.0044126310385763645,
-0.06617801636457443,
0.03929402306675911,
0.1090732142329216,
0.027947239577770233,
-0.03612448275089264,
-0.04794963449239731,
-0.05529050901532173,
-0.04164301976561546,
-0.04150035232305527,
0.007095158565789461,
0.012097805738449097,
-0.06984496861696243,
0.0426473543047905,
-0.04706032946705818,
-0.0613662451505661,
0.005221064668148756,
0.12052879482507706,
-0.015035202726721764,
0.05595893785357475,
0.07579982280731201,
0.004501724615693092,
-0.10635742545127869,
0.0160240326076746,
0.07284989207983017,
-0.014645121991634369,
-0.049610335379838943,
-0.03458501771092415,
-0.09446082264184952,
0.038812264800071716,
-0.012402267195284367,
-0.04482227936387062,
0.012754441238939762,
0.05228761211037636,
0.04518560692667961,
-0.018037162721157074,
-0.014066949486732483,
0.03245128318667412,
0.1011277511715889,
-0.02902473509311676,
0.09676939249038696,
-0.09447185695171356,
-0.07471717149019241,
0.11598984897136688,
-0.05535445734858513,
0.05176934599876404,
-0.01625675894320011,
0.05505574867129326,
0.06188035383820534,
0.08228021115064621,
-0.011276467703282833,
-0.10654307156801224,
0.01611381210386753,
-0.10798465460538864,
0.014698906801640987,
-0.028368590399622917,
-0.0008782328804954886,
-0.07448039948940277,
-0.005045975558459759,
0.12610746920108795,
-0.04300834983587265,
0.09636586904525757,
-0.07598172873258591,
0.005360376089811325,
0.12361682206392288,
0.030551722273230553,
0.042671095579862595,
0.10857585817575455,
-0.0011951439082622528,
-0.022732913494110107,
-0.06313253194093704,
0.005098979454487562,
-0.08861937373876572,
-0.023128056898713112,
-0.01722060702741146,
-5.5271250687383144e-8,
-0.04004458338022232,
-0.01631372980773449,
-0.1056530773639679,
0.00347451725974679,
0.020405253395438194,
0.011525127105414867,
-0.05810736492276192,
-0.0235323254019022,
-0.02011527493596077,
0.032652225345373154,
-0.02883279323577881,
-0.0009860259015113115,
0.06138622388243675,
-0.00037463055923581123,
0.013693117536604404,
-0.0630570650100708,
0.031471312046051025,
-0.05357148125767708,
0.0059104920364916325,
-0.034858088940382004,
0.011196287348866463,
-0.09813562780618668,
0.006943150889128447,
0.07660546898841858,
0.03334185853600502,
0.02028624527156353,
0.00768347829580307,
0.07278824597597122,
-0.020867183804512024,
0.04932907223701477,
-0.005625475198030472,
-0.06580321490764618,
-0.026379037648439407,
-0.0001765263150446117,
-0.08611104637384415,
0.04576743394136429,
-0.14610467851161957,
-0.01688849739730358,
0.012860932387411594,
0.03135119006037712,
0.06248730048537254,
-0.03372818976640701,
-0.012573983520269394,
0.035112567245960236,
0.07312262058258057,
0.01753135770559311,
0.029140131548047066,
0.07444178313016891,
0.006101192906498909,
-0.012492119334638119,
-0.0034551681019365788,
0.03171694651246071,
-0.025133362039923668,
-0.012966997921466827,
0.008077562786638737,
0.009242754429578781,
-0.028900951147079468,
-0.04714953154325485,
-0.002254847902804613,
0.024329090490937233,
-0.009028486907482147,
0.037075549364089966,
-0.05441994220018387,
-0.060019947588443756
] | -0.07581 |
`Buffer` as generated by `http2.getPackedSettings()`. ### `http2.performServerHandshake(socket[, options])` \* `socket` {stream.Duplex} \* `options` {Object} Any [`http2.createServer()`][] option can be provided. \* Returns: {ServerHttp2Session} Create an HTTP/2 server session from an existing socket. ### `http2.sensitiveHeaders` \* Type: {symbol} This symbol can be set as a property on the HTTP/2 headers object with an array value in order to provide a list of headers considered sensitive. See [Sensitive headers][] for more details. ### Headers object Headers are represented as own-properties on JavaScript objects. The property keys will be serialized to lower-case. Property values should be strings (if they are not they will be coerced to strings) or an `Array` of strings (in order to send more than one value per header field). ```js const headers = { ':status': '200', 'content-type': 'text-plain', 'ABC': ['has', 'more', 'than', 'one', 'value'], }; stream.respond(headers); ``` Header objects passed to callback functions will have a `null` prototype. This means that normal JavaScript object methods such as `Object.prototype.toString()` and `Object.prototype.hasOwnProperty()` will not work. For incoming headers: \* The `:status` header is converted to `number`. \* Duplicates of `:status`, `:method`, `:authority`, `:scheme`, `:path`, `:protocol`, `age`, `authorization`, `access-control-allow-credentials`, `access-control-max-age`, `access-control-request-method`, `content-encoding`, `content-language`, `content-length`, `content-location`, `content-md5`, `content-range`, `content-type`, `date`, `dnt`, `etag`, `expires`, `from`, `host`, `if-match`, `if-modified-since`, `if-none-match`, `if-range`, `if-unmodified-since`, `last-modified`, `location`, `max-forwards`, `proxy-authorization`, `range`, `referer`,`retry-after`, `tk`, `upgrade-insecure-requests`, `user-agent` or `x-content-type-options` are discarded. \* `set-cookie` is always an array. Duplicates are added to the array. \* For duplicate `cookie` headers, the values are joined together with '; '. \* For all other headers, the values are joined together with ', '. ```mjs import { createServer } from 'node:http2'; const server = createServer(); server.on('stream', (stream, headers) => { console.log(headers[':path']); console.log(headers.ABC); }); ``` ```cjs const http2 = require('node:http2'); const server = http2.createServer(); server.on('stream', (stream, headers) => { console.log(headers[':path']); console.log(headers.ABC); }); ``` #### Raw headers In some APIs, in addition to object format, headers can also be passed or accessed as a raw flat array, preserving details of ordering and duplicate keys to match the raw transmission format. In this format the keys and values are in the same list. It is \_not\_ a list of tuples. So, the even-numbered offsets are key values, and the odd-numbered offsets are the associated values. Duplicate headers are not merged and so each key-value pair will appear separately. This can be useful for cases such as proxies, where existing headers should be exactly forwarded as received, or as a performance optimization when the headers are already available in raw format. ```js const rawHeaders = [ ':status', '404', 'content-type', 'text/plain', ]; stream.respond(rawHeaders); ``` #### Sensitive headers HTTP2 headers can be marked as sensitive, which means that the HTTP/2 header compression algorithm will never index them. This can make sense for header values with low entropy and that may be considered valuable to an attacker, for example `Cookie` or `Authorization`. To achieve this, add the header name to the `[http2.sensitiveHeaders]` property as an array: ```js const headers = { ':status': '200', 'content-type': 'text-plain', 'cookie': 'some-cookie', 'other-sensitive-header': 'very secret data', [http2.sensitiveHeaders]: ['cookie', 'other-sensitive-header'], }; stream.respond(headers); ``` For some headers, such as `Authorization` and short `Cookie` headers, this flag is set automatically. This property is also set for received headers. It will contain the names of all headers marked as sensitive, including ones marked that way automatically. For raw headers, this should still be set as a property on the array, like `rawHeadersArray[http2.sensitiveHeaders] = ['cookie']`, not as a separate key and value pair within the array itself. ### Settings object The `http2.getDefaultSettings()`, `http2.getPackedSettings()`, `http2.createServer()`, `http2.createSecureServer()`, `http2session.settings()`, `http2session.localSettings`, and `http2session.remoteSettings` APIs either return or receive as input an object that defines configuration settings for | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.042637888342142105,
0.061682119965553284,
-0.020217476412653923,
0.0255400650203228,
-0.021226517856121063,
-0.05658118426799774,
0.017103981226682663,
0.049756161868572235,
0.020401528105139732,
-0.030417369678616524,
-0.05366327241063118,
-0.014092079363763332,
0.008424866944551468,
0.03452378883957863,
0.064413882791996,
-0.03052166849374771,
0.06438178569078445,
-0.014358870685100555,
0.0018115256680175662,
-0.07238338142633438,
0.03524376451969147,
0.01754268817603588,
-0.0017687506042420864,
-0.034957073628902435,
-0.039123550057411194,
0.0341811403632164,
0.004302147775888443,
0.0006291784229688346,
0.02468867599964142,
-0.013266092166304588,
0.09277071803808212,
-0.11788135021924973,
-0.1805875450372696,
0.0109733110293746,
-0.09857141971588135,
0.029020095244050026,
0.058476708829402924,
-0.04303232952952385,
0.05065786466002464,
-0.017832743003964424,
0.050530754029750824,
0.011844344437122345,
-0.0591467060148716,
-0.022624291479587555,
-0.05314793810248375,
0.06830183416604996,
-0.02325969934463501,
0.03122386522591114,
-0.08862295001745224,
-0.08734782785177231,
-0.005545889493077993,
-0.042388442903757095,
-0.005148657131940126,
0.03812223672866821,
-0.002416701754555106,
-0.04774617776274681,
-0.105723537504673,
0.046887390315532684,
-0.05161349102854729,
0.0751706138253212,
-0.04819454625248909,
-0.0592251680791378,
0.07240362465381622,
-0.008075177669525146,
0.021245170384645462,
-0.05564798042178154,
0.023111490532755852,
0.05440257489681244,
0.007539350539445877,
0.09592370688915253,
-0.07293867319822311,
0.04977256804704666,
-0.07041511684656143,
-0.06211751699447632,
0.01776294596493244,
-0.0415228009223938,
-0.01869712956249714,
0.017555570229887962,
-0.07414847612380981,
-0.035458702594041824,
-0.03847545385360718,
-0.15411502122879028,
-0.04936698451638222,
0.06985925137996674,
-0.04509853199124336,
0.07684961706399918,
-0.017940901219844818,
0.03264587000012398,
-0.008091915398836136,
0.0183445792645216,
-0.05798320099711418,
0.012299537658691406,
0.09155061095952988,
0.07211344689130783,
-0.05980231240391731,
0.08151266723871231,
0.005791879259049892,
0.03020746074616909,
-0.012687348760664463,
0.01766192354261875,
-0.0011500727850943804,
-0.06965219229459763,
0.04029059037566185,
-0.023110544309020042,
0.013049234636127949,
-0.08066417276859283,
-0.03401755169034004,
0.020053647458553314,
0.02642686665058136,
-0.01848192699253559,
0.01970001496374607,
0.06532163172960281,
-0.014145647175610065,
-0.008499473333358765,
-0.04329436272382736,
0.06445129215717316,
0.03482906520366669,
-0.039138905704021454,
0.10435037314891815,
-0.0026743984781205654,
0.10068096220493317,
-0.04995916411280632,
-0.03368685021996498,
0.009421022608876228,
0.03344346955418587,
-0.061034612357616425,
0.037286628037691116,
5.2313631208918904e-33,
-0.02154894918203354,
-0.02216528356075287,
-0.07090485095977783,
0.09867960959672928,
-0.0181647427380085,
-0.002307511866092682,
0.02779417298734188,
-0.016010141000151634,
-0.03741178661584854,
0.02799610234797001,
0.010823605582118034,
-0.030340394005179405,
0.03285862132906914,
0.043251994997262955,
-0.02262686751782894,
-0.058248866349458694,
0.0498870313167572,
0.014716114848852158,
0.12854261696338654,
0.03351812809705734,
-0.03146819397807121,
0.05234629660844803,
-0.0016440945910289884,
0.03649701178073883,
-0.022660689428448677,
-0.009500677697360516,
0.004446267616003752,
-0.015680324286222458,
-0.08661108464002609,
-0.024410977959632874,
0.02753346972167492,
0.028711562976241112,
0.006159058306366205,
0.031171239912509918,
0.08450883626937866,
-0.03782764449715614,
0.031329646706581116,
0.03102377988398075,
-0.024939117953181267,
-0.008645822294056416,
0.10797058045864105,
0.036259353160858154,
-0.11944569647312164,
0.0735403299331665,
-0.03249922767281532,
-0.059210143983364105,
-0.10677797347307205,
-0.06317990273237228,
0.0637693703174591,
-0.034244339913129807,
-0.04653003811836243,
0.06669382005929947,
0.09979742765426636,
0.02897557243704796,
0.021122461184859276,
-0.06069106608629227,
-0.0011635260889306664,
0.027700385078787804,
-0.006730817724019289,
0.008144180290400982,
-0.018032323569059372,
0.020300546661019325,
-0.013184231705963612,
-0.0872054398059845,
0.037276968359947205,
0.009041736833751202,
0.02931693010032177,
0.07715611904859543,
-0.043498679995536804,
0.029438504949212074,
-0.022349510341882706,
0.028030119836330414,
0.07477915287017822,
0.045939408242702484,
-0.027771878987550735,
0.0011015917407348752,
0.00010767915227916092,
0.0715644359588623,
0.07488302886486053,
-0.05460828170180321,
0.06642259657382965,
0.04426543042063713,
0.02522927150130272,
0.07766007632017136,
-0.022744085639715195,
-0.0507880337536335,
-0.03604002296924591,
-0.0188901424407959,
-0.06877844780683517,
0.07431434094905853,
-0.04139994457364082,
-0.0029814564622938633,
0.046671923249959946,
-0.056385528296232224,
-0.014995959587395191,
-7.647847796370391e-33,
-0.020861899480223656,
0.03933589532971382,
-0.08509643375873566,
0.10374104231595993,
-0.009304043836891651,
-0.004266534000635147,
0.0408056303858757,
0.012971529737114906,
-0.0075846146792173386,
-0.01813676208257675,
-0.008899395354092121,
0.05068078637123108,
-0.008382749743759632,
0.01609758473932743,
-0.038664910942316055,
0.028841311112046242,
-0.09184873104095459,
-0.03203284740447998,
0.017586493864655495,
-0.08362887054681778,
-0.01885993778705597,
-0.015298000536859035,
0.043813593685626984,
0.04151134938001633,
-0.02118772454559803,
-0.0015577543526887894,
0.000942426675464958,
-0.03185071796178818,
-0.09148421138525009,
-0.010021189227700233,
-0.05967225879430771,
0.001803746446967125,
0.013847894966602325,
0.0018289054278284311,
-0.03775563836097717,
-0.10031513124704361,
0.04756680130958557,
0.08201458305120468,
-0.0038342694751918316,
0.05575912818312645,
0.0488637275993824,
0.012125890702009201,
0.0013743991730734706,
0.03728827089071274,
0.0362076461315155,
0.07562482357025146,
-0.05849738419055939,
-0.005033689551055431,
-0.08515392988920212,
-0.002396561438217759,
0.01037068385630846,
-0.014623594470322132,
-0.04427086561918259,
0.034407228231430054,
0.00026499145315028727,
-0.039614465087652206,
0.027755269780755043,
-0.022420795634388924,
0.060318950563669205,
0.04512171447277069,
0.04099244251847267,
-0.14190542697906494,
-0.04702742025256157,
0.021358488127589226,
-0.016254302114248276,
-0.03195865824818611,
-0.10002847015857697,
-0.0707312822341919,
0.012733742594718933,
0.04326729476451874,
-0.022139202803373337,
-0.0714849904179573,
0.004603361710906029,
-0.04576188698410988,
0.04451308026909828,
-0.046953145414590836,
0.003539001801982522,
-0.0771746039390564,
-0.002209619851782918,
0.1351632922887802,
-0.08643438667058945,
0.07180973142385483,
-0.036656707525253296,
-0.02281956933438778,
0.14514335989952087,
-0.005267814267426729,
-0.06699560582637787,
0.04771118611097336,
-0.047562483698129654,
-0.08457264304161072,
0.025228898972272873,
0.07011723518371582,
-0.07916202396154404,
-0.024746816605329514,
-0.009287402965128422,
-5.412127990211957e-8,
-0.022965705022215843,
-0.07094628363847733,
-0.03355871140956879,
0.0042349002324044704,
-0.045999057590961456,
0.02228940650820732,
-0.06341992318630219,
-0.0259218979626894,
0.01869308017194271,
0.019107671454548836,
-0.03189772740006447,
-0.020290466025471687,
0.039437100291252136,
-0.002280790125951171,
0.017621435225009918,
0.03900708258152008,
0.009572602808475494,
0.025868816301226616,
-0.03176744654774666,
-0.06708184629678726,
0.06643638014793396,
-0.014598812907934189,
0.0022712205536663532,
0.02714386023581028,
0.035390663892030716,
0.010871374979615211,
0.05693525820970535,
0.01703047752380371,
-0.03335099667310715,
-0.04376066476106644,
-0.07510627806186676,
-0.012195345014333725,
0.06534170359373093,
-0.05505111441016197,
0.0352201871573925,
0.029629457741975784,
-0.11990194022655487,
0.001061180722899735,
-0.005184282548725605,
0.06573834270238876,
0.043785978108644485,
0.005644410848617554,
-0.05801670625805855,
0.077000692486763,
0.0981815829873085,
0.07909011095762253,
0.040670767426490784,
0.09088455140590668,
-0.051631271839141846,
-0.048696137964725494,
0.05143806338310242,
-0.005347347818315029,
0.019604848697781563,
0.012660818174481392,
-0.0832388773560524,
-0.003154031466692686,
-0.006814226042479277,
-0.027335533872246742,
0.011569767259061337,
-0.06766237318515778,
0.09323164075613022,
0.07328950613737106,
0.0003529143868945539,
-0.026201119646430016
] | 0.047789 |
be set as a property on the array, like `rawHeadersArray[http2.sensitiveHeaders] = ['cookie']`, not as a separate key and value pair within the array itself. ### Settings object The `http2.getDefaultSettings()`, `http2.getPackedSettings()`, `http2.createServer()`, `http2.createSecureServer()`, `http2session.settings()`, `http2session.localSettings`, and `http2session.remoteSettings` APIs either return or receive as input an object that defines configuration settings for an `Http2Session` object. These objects are ordinary JavaScript objects containing the following properties. \* `headerTableSize` {number} Specifies the maximum number of bytes used for header compression. The minimum allowed value is 0. The maximum allowed value is 232-1. \*\*Default:\*\* `4096`. \* `enablePush` {boolean} Specifies `true` if HTTP/2 Push Streams are to be permitted on the `Http2Session` instances. \*\*Default:\*\* `true`. \* `initialWindowSize` {number} Specifies the \_sender's\_ initial window size in bytes for stream-level flow control. The minimum allowed value is 0. The maximum allowed value is 232-1. \*\*Default:\*\* `65535`. \* `maxFrameSize` {number} Specifies the size in bytes of the largest frame payload. The minimum allowed value is 16,384. The maximum allowed value is 224-1. \*\*Default:\*\* `16384`. \* `maxConcurrentStreams` {number} Specifies the maximum number of concurrent streams permitted on an `Http2Session`. There is no default value which implies, at least theoretically, 232-1 streams may be open concurrently at any given time in an `Http2Session`. The minimum value is 0. The maximum allowed value is 232-1. \*\*Default:\*\* `4294967295`. \* `maxHeaderListSize` {number} Specifies the maximum size (uncompressed octets) of header list that will be accepted. The minimum allowed value is 0. The maximum allowed value is 232-1. \*\*Default:\*\* `65535`. \* `maxHeaderSize` {number} Alias for `maxHeaderListSize`. \* `enableConnectProtocol`{boolean} Specifies `true` if the "Extended Connect Protocol" defined by [RFC 8441][] is to be enabled. This setting is only meaningful if sent by the server. Once the `enableConnectProtocol` setting has been enabled for a given `Http2Session`, it cannot be disabled. \*\*Default:\*\* `false`. \* `customSettings` {Object} Specifies additional settings, yet not implemented in node and the underlying libraries. The key of the object defines the numeric value of the settings type (as defined in the "HTTP/2 SETTINGS" registry established by \[RFC 7540]) and the values the actual numeric value of the settings. The settings type has to be an integer in the range from 1 to 2^16-1. It should not be a settings type already handled by node, i.e. currently it should be greater than 6, although it is not an error. The values need to be unsigned integers in the range from 0 to 2^32-1. Currently, a maximum of up 10 custom settings is supported. It is only supported for sending SETTINGS, or for receiving settings values specified in the `remoteCustomSettings` options of the server or client object. Do not mix the `customSettings`-mechanism for a settings id with interfaces for the natively handled settings, in case a setting becomes natively supported in a future node version. All additional properties on the settings object are ignored. ### Error handling There are several types of error conditions that may arise when using the `node:http2` module: Validation errors occur when an incorrect argument, option, or setting value is passed in. These will always be reported by a synchronous `throw`. State errors occur when an action is attempted at an incorrect time (for instance, attempting to send data on a stream after it has closed). These will be reported using either a synchronous `throw` or via an `'error'` event on the `Http2Stream`, `Http2Session` or HTTP/2 Server objects, depending on where and when the error occurs. Internal errors occur when an HTTP/2 session fails unexpectedly. These will be reported via an `'error'` event on the `Http2Session` or HTTP/2 Server objects. Protocol errors occur when various HTTP/2 protocol constraints are violated. These will | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.012702349573373795,
0.04079999774694443,
-0.08456536382436752,
0.029417257755994797,
-0.01636972837150097,
-0.06761538982391357,
-0.028572674840688705,
0.041119497269392014,
-0.052255865186452866,
-0.002802743576467037,
-0.03875601664185524,
-0.016639195382595062,
0.025524413213133812,
0.009629669599235058,
0.07759584486484528,
-0.010220813564956188,
-0.0033964996691793203,
-0.016871269792318344,
-0.06383209675550461,
-0.03379756584763527,
0.06821291148662567,
-0.039288479834795,
0.02693517692387104,
-0.034640371799468994,
0.007242223713546991,
0.023196622729301453,
-0.017826786264777184,
0.012454690411686897,
0.0238963533192873,
0.013065467588603497,
0.06727482378482819,
-0.0868242084980011,
-0.13800427317619324,
-0.02561931312084198,
-0.06525978446006775,
0.009051044471561909,
0.04579979553818703,
-0.011365554295480251,
0.07236266881227493,
-0.009656477719545364,
0.0031298508401960135,
0.011872200295329094,
-0.06989189237356186,
-0.01612185500562191,
-0.09206002205610275,
0.0675949677824974,
-0.024028170853853226,
0.011362312361598015,
-0.11495485156774521,
-0.0489780455827713,
0.018061188980937004,
0.02821102924644947,
-0.015758762136101723,
0.03380082920193672,
-0.06174175813794136,
-0.035266924649477005,
-0.11508668214082718,
0.0875977948307991,
0.0071455566212534904,
0.08886434137821198,
-0.04188182204961777,
-0.08669993281364441,
0.04279138892889023,
0.01884784922003746,
-0.006180144846439362,
-0.018581824377179146,
0.02960949018597603,
-0.003403600538149476,
0.0034929628018289804,
0.0055211251601576805,
-0.06743518263101578,
0.051789913326501846,
-0.0538104809820652,
-0.009637746959924698,
0.010316925123333931,
-0.05007268488407135,
-0.05995640531182289,
-0.01126715075224638,
-0.008326933719217777,
-0.04397250711917877,
-0.018381308764219284,
-0.10408920049667358,
-0.03186902776360512,
0.0805974006652832,
-0.026611512526869774,
0.02194562554359436,
-0.02542199194431305,
0.0698227509856224,
0.04042678698897362,
0.044338177889585495,
-0.06702148169279099,
0.007818540558218956,
0.06885915994644165,
0.08953160792589188,
-0.031312525272369385,
0.039640966802835464,
-0.020097000524401665,
-0.028716018423438072,
-0.02792210318148136,
0.018481139093637466,
0.013081283308565617,
-0.07913730293512344,
-0.011256221681833267,
-0.0016088612610474229,
0.044716645032167435,
-0.12787728011608124,
0.001316242036409676,
0.07098407298326492,
0.040423259139060974,
0.034210458397865295,
0.038002803921699524,
0.12099058926105499,
0.012048433534801006,
-0.05990994721651077,
-0.049270182847976685,
0.08202371746301651,
0.03510671854019165,
-0.001251607434824109,
0.0976303368806839,
-0.030843941494822502,
0.07157972455024719,
-0.03516974672675133,
0.007672702893614769,
-0.06261753290891647,
0.04814242944121361,
-0.04121745005249977,
0.032894786447286606,
4.911015196353893e-33,
0.002796270651742816,
-0.01769871637225151,
-0.012421317398548126,
0.023868966847658157,
-0.010190415196120739,
0.06759544461965561,
0.029141675680875778,
0.038702044636011124,
-0.019420145079493523,
0.024560879915952682,
0.022679630666971207,
0.03330569714307785,
0.025829052552580833,
0.04700682684779167,
0.0208356361836195,
0.009164148010313511,
0.05942663922905922,
0.046391017735004425,
0.08602398633956909,
0.021915555000305176,
-0.035356760025024414,
0.018565505743026733,
0.06293563544750214,
-0.01785697415471077,
-0.03572402521967888,
-0.016931576654314995,
0.022163186222314835,
0.04194933921098709,
-0.07883110642433167,
-0.01436822209507227,
0.05990343168377876,
0.02212461829185486,
-0.052975915372371674,
0.003258237848058343,
0.13397854566574097,
-0.03803372010588646,
-0.015708357095718384,
0.00836575124412775,
0.004717590287327766,
0.0017924229614436626,
0.07556584477424622,
-0.010291701182723045,
-0.07377494126558304,
0.02890065684914589,
-0.09274624288082123,
-0.06291744858026505,
-0.0945703387260437,
-0.049376070499420166,
0.036087844520807266,
0.012983396649360657,
-0.08418574929237366,
0.08338005095720291,
0.06071639433503151,
0.005702773109078407,
0.04062582179903984,
-0.06577970832586288,
0.005500489845871925,
0.023037446662783623,
-0.014987673610448837,
-0.044595275074243546,
0.011895728297531605,
-0.026784826070070267,
0.009332235902547836,
-0.08238393813371658,
0.022577838972210884,
0.019785786047577858,
0.03837032616138458,
0.07345020025968552,
-0.050460025668144226,
-0.05620983988046646,
0.017957808449864388,
0.02102995477616787,
0.10141907632350922,
-0.007100410759449005,
-0.04728710651397705,
-0.024282323196530342,
0.028085030615329742,
0.10881441831588745,
0.040320880711078644,
-0.04572216048836708,
0.10397562384605408,
0.07807259261608124,
-0.019844841212034225,
0.0800330638885498,
-0.05252937972545624,
-0.06212945654988289,
-0.07397761940956116,
0.016614066436886787,
-0.02844119817018509,
0.0627496987581253,
0.004849272780120373,
-0.05055481940507889,
0.010218561626970768,
-0.05442867428064346,
-0.0550876148045063,
-5.559351758710233e-33,
0.006732377223670483,
0.008577462285757065,
-0.04496769979596138,
0.05665365606546402,
-0.010760519653558731,
-0.021203000098466873,
0.04771116375923157,
0.05892122909426689,
0.00570891285315156,
-0.06898143142461777,
0.030049003660678864,
0.026582205668091774,
-0.03990337625145912,
-0.0050607346929609776,
-0.03136388584971428,
0.08216128498315811,
-0.07386293262243271,
-0.011699872091412544,
0.04196134954690933,
-0.11092707514762878,
0.005821065977215767,
0.006283180322498083,
-0.0320744588971138,
0.13712546229362488,
0.012792551890015602,
-0.053657159209251404,
-0.04616408422589302,
-0.010691030882298946,
-0.05535035580396652,
-0.056124381721019745,
-0.019816821441054344,
0.039878781884908676,
-0.031445249915122986,
0.0007075905450619757,
-0.028598573058843613,
-0.12266046553850174,
0.008104028180241585,
0.12315813452005386,
-0.045611411333084106,
0.03798738867044449,
-0.009018555283546448,
-0.012037347070872784,
0.03760511800646782,
0.043660521507263184,
0.05447584018111229,
0.011292350478470325,
-0.0016669593751430511,
0.01709788851439953,
-0.08141951262950897,
0.06699250638484955,
0.013604268431663513,
-0.07108764350414276,
-0.027224767953157425,
-0.013020290061831474,
0.014274953864514828,
-0.05059487000107765,
-0.05247225984930992,
-0.04337504878640175,
0.07582113146781921,
-0.026371516287326813,
0.029023896902799606,
-0.15012066066265106,
-0.013866377994418144,
0.10498178750276566,
-0.0354129821062088,
0.04059479013085365,
-0.06249985471367836,
-0.01723930798470974,
-0.00027541874442249537,
0.0518467053771019,
-0.03558725491166115,
-0.13366259634494781,
0.09655524045228958,
-0.03070499189198017,
0.028330964967608452,
-0.03578867018222809,
0.017907407134771347,
-0.092172771692276,
0.004570971708744764,
0.08830387890338898,
-0.028777319937944412,
0.026359381154179573,
-0.044829193502664566,
-0.03753351420164108,
0.10613047331571579,
0.050383906811475754,
-0.05276356637477875,
0.03214486315846443,
-0.05938389524817467,
-0.05880429223179817,
0.0004901713109575212,
0.07370461523532867,
-0.061647381633520126,
-0.003065657801926136,
0.008079180493950844,
-5.416875481500938e-8,
0.0013630064204335213,
-0.05161718279123306,
-0.05485415831208229,
0.008282968774437904,
-0.029383309185504913,
0.05061629042029381,
0.009781447239220142,
0.04358504340052605,
-0.0071845087222754955,
-0.024555984884500504,
0.014589774422347546,
0.026305055245757103,
0.05755000561475754,
0.0270810779184103,
-0.02971011959016323,
-0.0012613969156518579,
0.006611368153244257,
0.03448432311415672,
-0.008035152219235897,
-0.04410242289304733,
0.007975878193974495,
-0.04239097982645035,
0.05073580518364906,
0.015579846687614918,
0.11023111641407013,
0.030583586543798447,
0.034793876111507416,
0.072747141122818,
0.023065807297825813,
0.043255846947431564,
-0.05289550870656967,
-0.0021502540912479162,
0.04668189957737923,
-0.03539787977933884,
-0.061876241117715836,
0.05756570026278496,
-0.10077683627605438,
-0.017606820911169052,
-0.030811086297035217,
-0.030870407819747925,
0.08721064776182175,
0.012197018601000309,
-0.02433619275689125,
0.059200219810009,
0.0697452574968338,
0.03921540081501007,
0.04792816564440727,
0.14056433737277985,
-0.0003796631353907287,
-0.08568110316991806,
0.025398075580596924,
0.03419366851449013,
-0.004433260299265385,
0.002167729428038001,
-0.08157561719417572,
-0.037049807608127594,
-0.045489419251680374,
-0.03328811377286911,
0.08416228741407394,
0.046397093683481216,
0.0503157377243042,
0.046445176005363464,
-0.02276800386607647,
-0.022529950365424156
] | -0.038053 |
`Http2Stream`, `Http2Session` or HTTP/2 Server objects, depending on where and when the error occurs. Internal errors occur when an HTTP/2 session fails unexpectedly. These will be reported via an `'error'` event on the `Http2Session` or HTTP/2 Server objects. Protocol errors occur when various HTTP/2 protocol constraints are violated. These will be reported using either a synchronous `throw` or via an `'error'` event on the `Http2Stream`, `Http2Session` or HTTP/2 Server objects, depending on where and when the error occurs. ### Invalid character handling in header names and values The HTTP/2 implementation applies stricter handling of invalid characters in HTTP header names and values than the HTTP/1 implementation. Header field names are \_case-insensitive\_ and are transmitted over the wire strictly as lower-case strings. The API provided by Node.js allows header names to be set as mixed-case strings (e.g. `Content-Type`) but will convert those to lower-case (e.g. `content-type`) upon transmission. Header field-names \_must only\_ contain one or more of the following ASCII characters: `a`-`z`, `A`-`Z`, `0`-`9`, `!`, `#`, `$`, `%`, `&`, `'`, `\*`, `+`, `-`, `.`, `^`, `\_`, `` ` `` (backtick), `|`, and `~`. Using invalid characters within an HTTP header field name will cause the stream to be closed with a protocol error being reported. Header field values are handled with more leniency but \_should\_ not contain new-line or carriage return characters and \_should\_ be limited to US-ASCII characters, per the requirements of the HTTP specification. ### Push streams on the client To receive pushed streams on the client, set a listener for the `'stream'` event on the `ClientHttp2Session`: ```mjs import { connect } from 'node:http2'; const client = connect('http://localhost'); client.on('stream', (pushedStream, requestHeaders) => { pushedStream.on('push', (responseHeaders) => { // Process response headers }); pushedStream.on('data', (chunk) => { /\* handle pushed data \*/ }); }); const req = client.request({ ':path': '/' }); ``` ```cjs const http2 = require('node:http2'); const client = http2.connect('http://localhost'); client.on('stream', (pushedStream, requestHeaders) => { pushedStream.on('push', (responseHeaders) => { // Process response headers }); pushedStream.on('data', (chunk) => { /\* handle pushed data \*/ }); }); const req = client.request({ ':path': '/' }); ``` ### Supporting the `CONNECT` method The `CONNECT` method is used to allow an HTTP/2 server to be used as a proxy for TCP/IP connections. A simple TCP Server: ```mjs import { createServer } from 'node:net'; const server = createServer((socket) => { let name = ''; socket.setEncoding('utf8'); socket.on('data', (chunk) => name += chunk); socket.on('end', () => socket.end(`hello ${name}`)); }); server.listen(8000); ``` ```cjs const net = require('node:net'); const server = net.createServer((socket) => { let name = ''; socket.setEncoding('utf8'); socket.on('data', (chunk) => name += chunk); socket.on('end', () => socket.end(`hello ${name}`)); }); server.listen(8000); ``` An HTTP/2 CONNECT proxy: ```mjs import { createServer, constants } from 'node:http2'; const { NGHTTP2\_REFUSED\_STREAM, NGHTTP2\_CONNECT\_ERROR } = constants; import { connect } from 'node:net'; const proxy = createServer(); proxy.on('stream', (stream, headers) => { if (headers[':method'] !== 'CONNECT') { // Only accept CONNECT requests stream.close(NGHTTP2\_REFUSED\_STREAM); return; } const auth = new URL(`tcp://${headers[':authority']}`); // It's a very good idea to verify that hostname and port are // things this proxy should be connecting to. const socket = connect(auth.port, auth.hostname, () => { stream.respond(); socket.pipe(stream); stream.pipe(socket); }); socket.on('error', (error) => { stream.close(NGHTTP2\_CONNECT\_ERROR); }); }); proxy.listen(8001); ``` ```cjs const http2 = require('node:http2'); const { NGHTTP2\_REFUSED\_STREAM } = http2.constants; const net = require('node:net'); const proxy = http2.createServer(); proxy.on('stream', (stream, headers) => { if (headers[':method'] !== 'CONNECT') { // Only accept CONNECT requests stream.close(NGHTTP2\_REFUSED\_STREAM); return; } const auth = new URL(`tcp://${headers[':authority']}`); // It's a very good idea to verify that hostname and port are // things this proxy should be connecting to. const socket = net.connect(auth.port, auth.hostname, () => { stream.respond(); | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.06277062743902206,
0.04617544263601303,
0.06596513837575912,
-0.005115462467074394,
0.013293660245835781,
-0.06392432004213333,
-0.05347658321261406,
0.024399587884545326,
0.06989909708499908,
0.001208932721056044,
-0.03470894694328308,
-0.006728894077241421,
0.011609003879129887,
0.03589065372943878,
0.08549830317497253,
-0.017600683495402336,
0.03252583369612694,
0.03324807435274124,
-0.021282266825437546,
-0.002238812390714884,
0.02878791280090809,
0.015220067463815212,
-0.03714608773589134,
0.0016757049597799778,
-0.045169647783041,
0.028071194887161255,
-0.09513713419437408,
0.0031411927193403244,
0.0069468761794269085,
-0.02500971034169197,
0.01333979144692421,
-0.04367915913462639,
-0.19020450115203857,
0.008900798857212067,
-0.06157699227333069,
0.02417069487273693,
0.049666356295347214,
-0.07736141234636307,
-0.05426293611526489,
-0.03355826437473297,
0.07370727509260178,
0.013854317367076874,
-0.06775213032960892,
0.011216248385608196,
-0.03760980814695358,
0.03319327160716057,
-0.029247289523482323,
0.02189081721007824,
-0.10591410100460052,
-0.04270261898636818,
-0.04041138291358948,
0.01315897237509489,
0.019458048045635223,
0.06997473537921906,
-0.010815317742526531,
-0.01133565790951252,
-0.12565316259860992,
0.10820761322975159,
-0.0016481707571074367,
0.11242783814668655,
-0.027940740808844566,
-0.0745130181312561,
-0.008825953118503094,
-0.014661312103271484,
0.04074018821120262,
-0.03774446249008179,
0.0008776253089308739,
-0.0007650359184481204,
-0.00886510033160448,
0.06492631137371063,
0.010254322551190853,
0.0021126915235072374,
-0.14175018668174744,
0.0298979040235281,
-0.028904637321829796,
-0.006377240642905235,
-0.008688587695360184,
0.0331067219376564,
-0.019344983622431755,
-0.008715583942830563,
-0.0217469222843647,
-0.08483372628688812,
0.01434486173093319,
-0.0028439147863537073,
-0.02703232131898403,
0.06963150948286057,
-0.05246550217270851,
0.028596261516213417,
-0.036413878202438354,
0.04911826178431511,
-0.07073822617530823,
-0.007697880733758211,
0.11029624938964844,
0.06033025309443474,
0.013735445216298103,
0.05761350691318512,
0.03967474773526192,
0.06556730717420578,
0.011065811850130558,
-0.00011705057113431394,
0.028575636446475983,
-0.040563128888607025,
0.01759941130876541,
-0.04069032147526741,
0.045993223786354065,
-0.06350347399711609,
-0.002915490185841918,
0.03554914519190788,
0.06760487705469131,
-0.05138743296265602,
0.0322815366089344,
0.02444453164935112,
-0.019982997328042984,
-0.09217213839292526,
-0.04215426743030548,
0.05184559151530266,
0.023875761777162552,
-0.03052690252661705,
0.03467957675457001,
0.0555097758769989,
0.023638546466827393,
-0.09444469958543777,
0.03048607148230076,
-0.012734264135360718,
0.05418768152594566,
-0.06387056410312653,
0.06917685270309448,
2.717764061265245e-33,
-0.024663573130965233,
0.011457957327365875,
-0.030927225947380066,
0.09018603712320328,
0.014579675160348415,
-0.0024398702662438154,
-0.020434174686670303,
-0.02885626256465912,
0.022529277950525284,
-0.03982522711157799,
0.023764723911881447,
-0.09522528946399689,
0.015672747045755386,
0.007033507339656353,
0.04223450645804405,
-0.015944410115480423,
0.04700296372175217,
-0.010050098411738873,
0.09869465976953506,
0.0764898881316185,
0.04294247180223465,
0.00966192502528429,
0.02950391359627247,
0.0284071434289217,
-0.07567238807678223,
0.012787139043211937,
0.02307361178100109,
-0.028645342215895653,
-0.003488440765067935,
0.019214842468500137,
0.03719224035739899,
-0.0013853057753294706,
0.0318148173391819,
0.011123932898044586,
0.10187377780675888,
-0.018676485866308212,
0.04335203021764755,
0.014510424807667732,
-0.09176290035247803,
0.00836395937949419,
-0.0012122276239097118,
0.07600950449705124,
-0.08703156560659409,
0.07254835218191147,
-0.02284451201558113,
-0.11375676095485687,
0.0006311233155429363,
-0.07858617603778839,
0.02386780083179474,
-0.07428739219903946,
-0.08302105218172073,
0.08564351499080658,
0.14303569495677948,
0.03764516860246658,
0.05150988698005676,
0.030386224389076233,
0.010851218365132809,
-0.008192728273570538,
-0.07363060861825943,
0.018296871334314346,
0.0688270702958107,
0.041896261274814606,
-0.03217225521802902,
-0.06675779819488525,
0.02592860348522663,
0.026019440963864326,
0.017496440559625626,
0.056493863463401794,
-0.046185676008462906,
-0.006027981173247099,
0.009032857604324818,
-0.010811110958456993,
0.060402583330869675,
0.04451165348291397,
0.03007156029343605,
-0.03651304543018341,
0.021176982671022415,
0.006478642579168081,
0.06777936965227127,
-0.025271350517868996,
0.016738606616854668,
-0.029624786227941513,
0.06493189930915833,
0.11399362981319427,
-0.08294995129108429,
-0.013868638314306736,
-0.0393189936876297,
-0.006489545106887817,
-0.038881585001945496,
0.04595451056957245,
0.09809044748544693,
0.015326712280511856,
0.012213952839374542,
-0.019715210422873497,
0.005026339553296566,
-4.667317952355155e-33,
-0.04955630004405975,
0.020892305299639702,
-0.06143335998058319,
0.044593892991542816,
-0.0077382600866258144,
-0.03428202122449875,
0.02131032384932041,
0.02115379273891449,
0.04735239967703819,
0.003715008031576872,
0.021218473091721535,
0.029578758403658867,
-0.07232240587472916,
0.010750077664852142,
-0.05513157695531845,
-0.03230021893978119,
-0.07055681943893433,
-0.07616028934717178,
0.025199512019753456,
-0.072901651263237,
0.0375673733651638,
-0.04263414070010185,
-0.02810063585639,
0.030550723895430565,
0.01219015009701252,
0.010712048038840294,
-0.001120472326874733,
-0.040977880358695984,
-0.058659300208091736,
-0.041764963418245316,
0.02239193767309189,
0.05296093225479126,
-0.006637850776314735,
0.06805696338415146,
-0.0032295268028974533,
-0.09982434660196304,
0.004079837817698717,
0.09398545324802399,
0.0164339616894722,
-0.003999687265604734,
0.02372920885682106,
0.043423186987638474,
0.055356692522764206,
0.024068932980298996,
0.08875276893377304,
-0.03205283731222153,
-0.07692258059978485,
0.03229713439941406,
-0.05742041394114494,
0.007625663187354803,
-0.04732939228415489,
-0.004839604254812002,
-0.051119107753038406,
0.046029314398765564,
-0.016429994255304337,
-0.0268067866563797,
-0.0064140972681343555,
0.04992884770035744,
-0.006090289447456598,
0.040131136775016785,
0.015921831130981445,
-0.09535910934209824,
-0.062233831733465195,
0.0577055960893631,
-0.011273432523012161,
-0.020129812881350517,
-0.08481219410896301,
-0.027543388307094574,
0.08280409127473831,
-0.009345483034849167,
-0.01769494265317917,
-0.06564611941576004,
-0.032120268791913986,
-0.028545701876282692,
0.04279447719454765,
-0.022258102893829346,
-0.008980793878436089,
-0.056842152029275894,
0.0009201165521517396,
0.06736113876104355,
-0.05733959749341011,
0.08431009948253632,
-0.06360748410224915,
0.04956575483083725,
0.10113325715065002,
-0.002704496029764414,
-0.0071417768485844135,
0.056169092655181885,
-0.11037962883710861,
-0.08321815729141235,
0.043338432908058167,
0.05415597930550575,
-0.1414809226989746,
0.027395635843276978,
-0.031070837751030922,
-5.112423551167922e-8,
-0.07560492306947708,
-0.06215880066156387,
-0.07190806418657303,
-0.04638006165623665,
0.00019797333516180515,
0.022423135116696358,
-0.07005690783262253,
-0.0164233036339283,
0.0996585488319397,
0.028506115078926086,
-0.09357989579439163,
0.019352156668901443,
-0.013285142369568348,
-0.11485637724399567,
0.015215663239359856,
0.0021872709039598703,
0.027371659874916077,
0.02397596463561058,
-0.03562208637595177,
-0.03329369053244591,
0.030164053663611412,
-0.012821419164538383,
-0.044228870421648026,
0.010231259278953075,
-0.05113087221980095,
-0.003346124431118369,
0.04710227996110916,
0.09283648431301117,
-0.023806333541870117,
-0.03936942666769028,
-0.06593582034111023,
0.059439003467559814,
0.05979803577065468,
-0.06104201823472977,
-0.019825348630547523,
0.05398713797330856,
-0.014949169009923935,
-0.00473039411008358,
-0.013256403617560863,
-0.011403475888073444,
0.08376477658748627,
0.018639853224158287,
0.03906947746872902,
0.04526351019740105,
0.06999681144952774,
0.03595612570643425,
0.07144436240196228,
0.10240263491868973,
0.022164423018693924,
-0.06132417172193527,
0.05627775192260742,
-0.00390676548704505,
-0.06332188099622726,
0.005793769843876362,
-0.039969153702259064,
-0.022618504241108894,
-0.034646958112716675,
-0.10723133385181427,
0.004439471755176783,
-0.06338662654161453,
0.1379917860031128,
0.05459039285778999,
0.03291547670960426,
-0.022357195615768433
] | 0.050771 |
=> { if (headers[':method'] !== 'CONNECT') { // Only accept CONNECT requests stream.close(NGHTTP2\_REFUSED\_STREAM); return; } const auth = new URL(`tcp://${headers[':authority']}`); // It's a very good idea to verify that hostname and port are // things this proxy should be connecting to. const socket = net.connect(auth.port, auth.hostname, () => { stream.respond(); socket.pipe(stream); stream.pipe(socket); }); socket.on('error', (error) => { stream.close(http2.constants.NGHTTP2\_CONNECT\_ERROR); }); }); proxy.listen(8001); ``` An HTTP/2 CONNECT client: ```mjs import { connect, constants } from 'node:http2'; const client = connect('http://localhost:8001'); // Must not specify the ':path' and ':scheme' headers // for CONNECT requests or an error will be thrown. const req = client.request({ ':method': 'CONNECT', ':authority': 'localhost:8000', }); req.on('response', (headers) => { console.log(headers[constants.HTTP2\_HEADER\_STATUS]); }); let data = ''; req.setEncoding('utf8'); req.on('data', (chunk) => data += chunk); req.on('end', () => { console.log(`The server says: ${data}`); client.close(); }); req.end('Jane'); ``` ```cjs const http2 = require('node:http2'); const client = http2.connect('http://localhost:8001'); // Must not specify the ':path' and ':scheme' headers // for CONNECT requests or an error will be thrown. const req = client.request({ ':method': 'CONNECT', ':authority': 'localhost:8000', }); req.on('response', (headers) => { console.log(headers[http2.constants.HTTP2\_HEADER\_STATUS]); }); let data = ''; req.setEncoding('utf8'); req.on('data', (chunk) => data += chunk); req.on('end', () => { console.log(`The server says: ${data}`); client.close(); }); req.end('Jane'); ``` ### The extended `CONNECT` protocol [RFC 8441][] defines an "Extended CONNECT Protocol" extension to HTTP/2 that may be used to bootstrap the use of an `Http2Stream` using the `CONNECT` method as a tunnel for other communication protocols (such as WebSockets). The use of the Extended CONNECT Protocol is enabled by HTTP/2 servers by using the `enableConnectProtocol` setting: ```mjs import { createServer } from 'node:http2'; const settings = { enableConnectProtocol: true }; const server = createServer({ settings }); ``` ```cjs const http2 = require('node:http2'); const settings = { enableConnectProtocol: true }; const server = http2.createServer({ settings }); ``` Once the client receives the `SETTINGS` frame from the server indicating that the extended CONNECT may be used, it may send `CONNECT` requests that use the `':protocol'` HTTP/2 pseudo-header: ```mjs import { connect } from 'node:http2'; const client = connect('http://localhost:8080'); client.on('remoteSettings', (settings) => { if (settings.enableConnectProtocol) { const req = client.request({ ':method': 'CONNECT', ':protocol': 'foo' }); // ... } }); ``` ```cjs const http2 = require('node:http2'); const client = http2.connect('http://localhost:8080'); client.on('remoteSettings', (settings) => { if (settings.enableConnectProtocol) { const req = client.request({ ':method': 'CONNECT', ':protocol': 'foo' }); // ... } }); ``` ## Compatibility API The Compatibility API has the goal of providing a similar developer experience of HTTP/1 when using HTTP/2, making it possible to develop applications that support both [HTTP/1][] and HTTP/2. This API targets only the \*\*public API\*\* of the [HTTP/1][]. However many modules use internal methods or state, and those \_are not supported\_ as it is a completely different implementation. The following example creates an HTTP/2 server using the compatibility API: ```mjs import { createServer } from 'node:http2'; const server = createServer((req, res) => { res.setHeader('Content-Type', 'text/html'); res.setHeader('X-Foo', 'bar'); res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); res.end('ok'); }); ``` ```cjs const http2 = require('node:http2'); const server = http2.createServer((req, res) => { res.setHeader('Content-Type', 'text/html'); res.setHeader('X-Foo', 'bar'); res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); res.end('ok'); }); ``` In order to create a mixed [HTTPS][] and HTTP/2 server, refer to the [ALPN negotiation][] section. Upgrading from non-tls HTTP/1 servers is not supported. The HTTP/2 compatibility API is composed of [`Http2ServerRequest`][] and [`Http2ServerResponse`][]. They aim at API compatibility with HTTP/1, but they do not hide the differences between the protocols. As an example, the status message for HTTP codes is ignored. ### ALPN negotiation ALPN negotiation allows supporting both [HTTPS][] and HTTP/2 over the same socket. The `req` and `res` objects can be either HTTP/1 | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.05605156719684601,
0.09035155177116394,
0.015349277295172215,
-0.027198759838938713,
-0.03469831496477127,
-0.043681930750608444,
-0.024706924334168434,
0.017015673220157623,
0.012918863445520401,
-0.005088462959975004,
-0.06961548328399658,
-0.023071499541401863,
0.015375490300357342,
0.014062566682696342,
0.0017809817800298333,
0.042681604623794556,
0.029164202511310577,
0.04645766317844391,
0.07677647471427917,
-0.07839030027389526,
-0.043876245617866516,
-0.04410590976476669,
-0.012564530596137047,
0.0031924492213875055,
-0.02770073525607586,
0.014247286133468151,
-0.04275728017091751,
-0.027356108650565147,
0.0589456707239151,
0.051353901624679565,
0.05480422079563141,
-0.03964761644601822,
-0.1658981591463089,
0.0315590463578701,
-0.12518909573554993,
-0.011872895993292332,
0.05260229483246803,
0.025633366778492928,
-0.08117390424013138,
-0.021002385765314102,
0.041694559156894684,
0.05401477962732315,
0.02248322404921055,
-0.09487036615610123,
0.07282555103302002,
0.050740163773298264,
0.006639914587140083,
0.04548237845301628,
-0.04764997214078903,
-0.032915227115154266,
-0.07577231526374817,
-0.015038973651826382,
-0.06743734329938889,
0.03415605053305626,
0.03161785379052162,
-0.08021386712789536,
-0.022209040820598602,
0.039477281272411346,
0.002314660232514143,
0.005556150805205107,
0.0057316794991493225,
-0.06049929931759834,
0.01829785294830799,
-0.010847263038158417,
-0.026926815509796143,
-0.04607030004262924,
-0.10778486728668213,
0.08281724154949188,
0.003959451802074909,
0.10629267990589142,
-0.018396181985735893,
0.024407215416431427,
-0.06454098224639893,
-0.024003412574529648,
0.031071146950125694,
-0.06611619144678116,
-0.049887679517269135,
-0.008318301290273666,
-0.08658987283706665,
0.03794171288609505,
0.007463855668902397,
-0.08541958034038544,
-0.062404733151197433,
0.06149755418300629,
-0.0476798340678215,
0.07232191413640976,
0.025785665959119797,
-0.015519794076681137,
-0.03168667107820511,
-0.03208959475159645,
-0.00633572693914175,
0.08428921550512314,
-0.019120510667562485,
0.02433798834681511,
0.07775108516216278,
0.06431543827056885,
-0.0028234231285750866,
0.03504292294383049,
-0.027197647839784622,
0.025790084153413773,
0.011550545692443848,
-0.07831250876188278,
-0.002457976806908846,
-0.04069032520055771,
0.01068501453846693,
-0.0763760581612587,
0.034578386694192886,
-0.004494394175708294,
0.11163490265607834,
0.026492731645703316,
-0.0025592856109142303,
-0.04483195021748543,
-0.006944282446056604,
0.007219381630420685,
-0.027649136260151863,
0.01237776130437851,
0.06939790397882462,
-0.0114468764513731,
0.027568437159061432,
0.050932809710502625,
0.024113280698657036,
-0.06249269098043442,
-0.023136524483561516,
-0.004042273387312889,
0.07007618993520737,
0.012833841145038605,
0.11333934217691422,
2.003562162709432e-33,
0.03966115042567253,
0.0289324801415205,
-0.004879844840615988,
0.051738105714321136,
0.031167177483439445,
0.0033593259286135435,
0.07888247072696686,
-0.025794973596930504,
0.006514304783195257,
0.03856408968567848,
-0.025543833151459694,
-0.07637863606214523,
0.026003248989582062,
-0.017890041694045067,
0.004163885023444891,
-0.014629579149186611,
0.052005868405103683,
-0.04986453801393509,
0.1245686337351799,
0.033901747316122055,
-0.0191095732152462,
-0.03713318705558777,
0.024922912940382957,
0.016339011490345,
0.009735709987580776,
-0.08772079646587372,
-0.05925948545336723,
-0.038078393787145615,
-0.06022690609097481,
-0.033694155514240265,
0.08542206883430481,
0.0314878411591053,
0.02024032548069954,
-0.019543416798114777,
0.035967934876680374,
-0.11797014623880386,
0.08216212689876556,
0.01922832615673542,
-0.04022947698831558,
-0.0751861110329628,
-0.010092447511851788,
-0.01157285738736391,
-0.09300296008586884,
0.03587828576564789,
0.016197627410292625,
-0.07772303372621536,
-0.05816267058253288,
-0.06920116394758224,
0.09229709208011627,
-0.03568330034613609,
-0.008309565484523773,
0.016402574256062508,
0.04359918087720871,
-0.015841543674468994,
0.02941971644759178,
0.06348293274641037,
-0.07259614765644073,
0.0661219134926796,
-0.08679883182048798,
-0.06950707733631134,
0.025906521826982498,
-0.01964990608394146,
-0.020767608657479286,
-0.034445006400346756,
0.06193016469478607,
0.057942043989896774,
-0.06322113424539566,
0.08143167197704315,
0.06619644910097122,
0.03588568791747093,
-0.009319107979536057,
-0.07921679317951202,
-0.019251158460974693,
0.058853670954704285,
-0.0392046682536602,
0.047387342900037766,
0.07817775011062622,
0.057079996913671494,
0.12546879053115845,
-0.004090523812919855,
0.01730121299624443,
-0.0017588349292054772,
0.014252850785851479,
0.05426444485783577,
-0.011396379210054874,
-0.004136293660849333,
-0.017420630902051926,
-0.01523520890623331,
0.06545868515968323,
0.03848220407962799,
-0.05397410690784454,
0.054579295217990875,
0.046455588191747665,
-0.009763525798916817,
0.004548506811261177,
-3.8310165372244694e-33,
-0.010816306807100773,
0.08784253895282745,
-0.009920244105160236,
0.012037320993840694,
0.01863008923828602,
-0.032326437532901764,
0.00648966571316123,
-0.05819767713546753,
0.04568067565560341,
0.06714935600757599,
0.09020452946424484,
0.03133554384112358,
0.08850628137588501,
0.05924415588378906,
-0.0672476515173912,
-0.08271986246109009,
-0.01631363295018673,
-0.00001841248740674928,
-0.01719500683248043,
0.0035855467431247234,
-0.07792147248983383,
0.002326043788343668,
0.06950563937425613,
-0.04988168552517891,
-0.08390940725803375,
0.02278122864663601,
0.011722193099558353,
-0.036667171865701675,
-0.1039966493844986,
-0.054360292851924896,
0.029942724853754044,
0.04765450581908226,
0.010463599115610123,
0.044181667268276215,
-0.03082546591758728,
-0.0678459033370018,
0.014763008803129196,
0.11964155733585358,
0.022347522899508476,
-0.024921534582972527,
0.09205559641122818,
0.010649424977600574,
0.032636284828186035,
-0.0287204310297966,
0.048248130828142166,
-0.006939251907169819,
0.003682836191728711,
0.011894413270056248,
-0.08032852411270142,
-0.03570457175374031,
-0.02140107750892639,
0.04413485527038574,
0.03278990089893341,
0.04444773122668266,
0.034335438162088394,
0.01541072130203247,
0.07289344072341919,
-0.019655294716358185,
0.13466747105121613,
0.0014607872581109405,
0.0056310310028493404,
-0.13987629115581512,
-0.046720415353775024,
0.059472400695085526,
0.021326731890439987,
0.05322716012597084,
-0.11450248956680298,
0.04170941933989525,
0.02967384085059166,
0.0287142563611269,
-0.035832636058330536,
-0.01696188375353813,
-0.00201951852068305,
0.03146222233772278,
-0.011455929838120937,
0.00917617604136467,
-0.03592291101813316,
-0.009412197396159172,
0.009470775723457336,
0.05858765169978142,
0.01583276502788067,
0.03450373187661171,
-0.06002480536699295,
-0.08494333922863007,
0.024007007479667664,
0.009309433400630951,
-0.039216380566358566,
-0.007104360498487949,
0.0035123128909617662,
-0.020072821527719498,
-0.014557145535945892,
0.02495686709880829,
-0.07397117465734482,
-0.08074905723333359,
0.033812712877988815,
-4.95092074004333e-8,
-0.008763531222939491,
-0.05325652286410332,
0.02496417984366417,
-0.017949597910046577,
-0.08915256708860397,
0.015697412192821503,
-0.0817972719669342,
-0.0782548189163208,
0.026987949386239052,
0.056137003004550934,
-0.06068183481693268,
-0.013507016003131866,
0.0058012050576508045,
-0.00026823178632184863,
0.024780990555882454,
-0.008050686679780483,
-0.018825259059667587,
-0.04505704343318939,
0.025937840342521667,
-0.007438909728080034,
-0.03225326910614967,
-0.05760541558265686,
0.024699818342924118,
0.0973493754863739,
-0.08152934908866882,
-0.04205116629600525,
0.02779574505984783,
-0.04067020118236542,
-0.051809851080179214,
-0.022178709506988525,
-0.05110650137066841,
0.0212844368070364,
0.05235766991972923,
-0.021457811817526817,
-0.038848627358675,
0.039224155247211456,
-0.08904816955327988,
0.04494882747530937,
-0.02023818902671337,
0.012628396041691303,
0.08218072354793549,
0.02406010776758194,
0.019596416503190994,
0.0040953136049211025,
0.025936832651495934,
0.061153583228588104,
0.11708487570285797,
0.00796100776642561,
-0.018830018118023872,
-0.030937522649765015,
0.08268224447965622,
-0.03445110842585564,
0.0172638688236475,
-0.0652533695101738,
-0.015903225168585777,
-0.012596026994287968,
-0.08765118569135666,
-0.019808078184723854,
-0.1297076940536499,
-0.07946714758872986,
0.06649995595216751,
0.1066955029964447,
0.015944235026836395,
-0.028010908514261246
] | 0.004873 |
at API compatibility with HTTP/1, but they do not hide the differences between the protocols. As an example, the status message for HTTP codes is ignored. ### ALPN negotiation ALPN negotiation allows supporting both [HTTPS][] and HTTP/2 over the same socket. The `req` and `res` objects can be either HTTP/1 or HTTP/2, and an application \*\*must\*\* restrict itself to the public API of [HTTP/1][], and detect if it is possible to use the more advanced features of HTTP/2. The following example creates a server that supports both protocols: ```mjs import { createSecureServer } from 'node:http2'; import { readFileSync } from 'node:fs'; const cert = readFileSync('./cert.pem'); const key = readFileSync('./key.pem'); const server = createSecureServer( { cert, key, allowHTTP1: true }, onRequest, ).listen(8000); function onRequest(req, res) { // Detects if it is a HTTPS request or HTTP/2 const { socket: { alpnProtocol } } = req.httpVersion === '2.0' ? req.stream.session : req; res.writeHead(200, { 'content-type': 'application/json' }); res.end(JSON.stringify({ alpnProtocol, httpVersion: req.httpVersion, })); } ``` ```cjs const { createSecureServer } = require('node:http2'); const { readFileSync } = require('node:fs'); const cert = readFileSync('./cert.pem'); const key = readFileSync('./key.pem'); const server = createSecureServer( { cert, key, allowHTTP1: true }, onRequest, ).listen(4443); function onRequest(req, res) { // Detects if it is a HTTPS request or HTTP/2 const { socket: { alpnProtocol } } = req.httpVersion === '2.0' ? req.stream.session : req; res.writeHead(200, { 'content-type': 'application/json' }); res.end(JSON.stringify({ alpnProtocol, httpVersion: req.httpVersion, })); } ``` The `'request'` event works identically on both [HTTPS][] and HTTP/2. ### Class: `http2.Http2ServerRequest` \* Extends: {stream.Readable} A `Http2ServerRequest` object is created by [`http2.Server`][] or [`http2.SecureServer`][] and passed as the first argument to the [`'request'`][] event. It may be used to access a request status, headers, and data. #### Event: `'aborted'` The `'aborted'` event is emitted whenever a `Http2ServerRequest` instance is abnormally aborted in mid-communication. The `'aborted'` event will only be emitted if the `Http2ServerRequest` writable side has not been ended. #### Event: `'close'` Indicates that the underlying [`Http2Stream`][] was closed. Just like `'end'`, this event occurs only once per response. #### `request.aborted` \* Type: {boolean} The `request.aborted` property will be `true` if the request has been aborted. #### `request.authority` \* Type: {string} The request authority pseudo header field. Because HTTP/2 allows requests to set either `:authority` or `host`, this value is derived from `req.headers[':authority']` if present. Otherwise, it is derived from `req.headers['host']`. #### `request.complete` \* Type: {boolean} The `request.complete` property will be `true` if the request has been completed, aborted, or destroyed. #### `request.connection` > Stability: 0 - Deprecated. Use [`request.socket`][]. \* Type: {net.Socket|tls.TLSSocket} See [`request.socket`][]. #### `request.destroy([error])` \* `error` {Error} Calls `destroy()` on the [`Http2Stream`][] that received the [`Http2ServerRequest`][]. If `error` is provided, an `'error'` event is emitted and `error` is passed as an argument to any listeners on the event. It does nothing if the stream was already destroyed. #### `request.headers` \* Type: {Object} The request/response headers object. Key-value pairs of header names and values. Header names are lower-cased. ```js // Prints something like: // // { 'user-agent': 'curl/7.22.0', // host: '127.0.0.1:8000', // accept: '\*/\*' } console.log(request.headers); ``` See [HTTP/2 Headers Object][]. In HTTP/2, the request path, host name, protocol, and method are represented as special headers prefixed with the `:` character (e.g. `':path'`). These special headers will be included in the `request.headers` object. Care must be taken not to inadvertently modify these special headers or errors may occur. For instance, removing all headers from the request will cause errors to occur: ```js removeAllHeaders(request.headers); assert(request.url); // Fails because the :path header has been removed ``` #### `request.httpVersion` \* Type: {string} In case of server request, the HTTP version sent by the client. | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.10878286510705948,
0.030391814187169075,
0.0013390076346695423,
0.013548774644732475,
-0.011900081299245358,
-0.08312838524580002,
-0.1328212320804596,
0.011634385213255882,
0.03390007093548775,
-0.06494419276714325,
-0.030542809516191483,
0.008867369964718819,
0.01851803995668888,
-0.002726893639191985,
0.08338416367769241,
0.00638349074870348,
0.07994843274354935,
0.003566105617210269,
0.0450439453125,
0.00507190078496933,
0.04733613505959511,
-0.025689953938126564,
0.03973784297704697,
-0.01692338101565838,
-0.05874057859182358,
-0.033531416207551956,
-0.04921019449830055,
0.062485966831445694,
0.02414064295589924,
0.00421665795147419,
0.10540259629487991,
-0.05760752782225609,
-0.1458466649055481,
0.06315568089485168,
-0.12686748802661896,
0.035170625895261765,
0.05228346958756447,
-0.09467530250549316,
-0.07140740007162094,
-0.008687296882271767,
0.0324871651828289,
0.0493336021900177,
-0.06354032456874847,
-0.0813964456319809,
-0.0002645424392540008,
-0.008321746252477169,
-0.029621940106153488,
0.07886994630098343,
-0.13375689089298248,
-0.0014322567731142044,
0.004002982750535011,
-0.013235360383987427,
-0.07285891473293304,
0.06905145198106766,
0.022402960807085037,
-0.030235406011343002,
-0.11984890699386597,
0.10829850286245346,
-0.008470708504319191,
0.1058562695980072,
0.02116009034216404,
-0.06154536455869675,
0.022483929991722107,
0.0027913530357182026,
0.03989384323358536,
-0.041191037744283676,
0.004743914119899273,
-0.056937988847494125,
-0.00842253677546978,
-0.0032644474413245916,
-0.06990645825862885,
-0.033158574253320694,
-0.02297247014939785,
0.00908004678785801,
0.04770299419760704,
-0.04627951234579086,
-0.061618342995643616,
0.011032061651349068,
-0.05087347328662872,
0.03531717509031296,
0.012077231891453266,
-0.09895075857639313,
-0.045747581869363785,
0.04523292928934097,
-0.04822066053748131,
0.006923478562384844,
0.005540069192647934,
0.047778595238924026,
0.0045898547396063805,
-0.0809454470872879,
0.024744441732764244,
-0.004820692352950573,
-0.006017060950398445,
0.04827149957418442,
0.07435441762208939,
0.03763757646083832,
-0.017491433769464493,
0.06271051615476608,
-0.01795000396668911,
-0.0032242154702544212,
-0.031999439001083374,
-0.059756677597761154,
0.01382327638566494,
-0.03242058306932449,
0.037517204880714417,
0.01781195029616356,
-0.008324912749230862,
-0.015214773826301098,
0.04189684987068176,
0.008268286474049091,
0.02429194748401642,
-0.04994022846221924,
0.02945759892463684,
-0.024253517389297485,
-0.10899544507265091,
0.0716012567281723,
0.012875230982899666,
-0.0437503308057785,
0.05123909190297127,
0.0390307642519474,
-0.013997483067214489,
-0.06941283494234085,
0.023194652050733566,
0.004043288063257933,
0.04020320996642113,
-0.06292902678251266,
0.0319780670106411,
5.587445706352901e-33,
-0.0284024178981781,
-0.05185158550739288,
-0.036560315638780594,
0.002832290716469288,
0.0630834698677063,
-0.013372693210840225,
0.07508372515439987,
-0.0026149468030780554,
-0.03069504350423813,
-0.0907723605632782,
0.02033737115561962,
0.027599569410085678,
0.03513699769973755,
-0.04781292378902435,
0.037348031997680664,
-0.018823137506842613,
0.06411375105381012,
-0.04227965325117111,
0.1492227166891098,
0.09093986451625824,
-0.023213917389512062,
0.01318240538239479,
0.049225784838199615,
0.03186017647385597,
0.018451401963829994,
-0.03760698437690735,
0.032151203602552414,
0.01475152000784874,
-0.05329180508852005,
-0.040041908621788025,
0.008799619972705841,
0.024774374440312386,
-0.028731761500239372,
-0.014070295728743076,
0.040512461215257645,
0.0026637353003025055,
0.03558127209544182,
0.0019169157603755593,
-0.06417132169008255,
-0.03637465462088585,
-0.0016019284958019853,
0.07933050394058228,
-0.04725109040737152,
0.0496041476726532,
0.011243402026593685,
-0.07569196075201035,
-0.10657806694507599,
-0.048857226967811584,
0.04323066025972366,
-0.020764222368597984,
-0.055653441697359085,
0.05974965542554855,
0.05389954522252083,
-0.084982730448246,
0.05201228708028793,
-0.044068727642297745,
0.03233180195093155,
0.019041728228330612,
-0.11391041427850723,
-0.015346509404480457,
-0.02979632467031479,
-0.05486111715435982,
0.04014178737998009,
-0.09957654774188995,
-0.0317360945045948,
0.042719777673482895,
-0.09504836797714233,
0.0852971002459526,
0.013914976269006729,
0.05912843346595764,
0.00551684619858861,
0.07259362190961838,
0.03501616790890694,
0.044021982699632645,
-0.0009808394825085998,
0.06132567673921585,
0.04376162961125374,
0.0677109807729721,
0.10096807032823563,
-0.012255465611815453,
0.012052268721163273,
0.05207103490829468,
0.04410852864384651,
0.1228778213262558,
-0.04265718162059784,
-0.041384950280189514,
-0.021128861233592033,
0.015683379024267197,
0.07340973615646362,
0.058488570153713226,
-0.0021467607002705336,
0.03959362208843231,
0.016697049140930176,
-0.03620864450931549,
0.040412165224552155,
-6.0942678098916074e-33,
-0.01818632148206234,
0.05027753859758377,
-0.03724908083677292,
0.09361342340707779,
-0.05013629421591759,
0.006687690503895283,
0.016292089596390724,
-0.04350478947162628,
0.015946168452501297,
0.062223516404628754,
0.08070877194404602,
0.00020630563085433096,
0.062200214713811874,
-0.04688180610537529,
0.0016136574558913708,
-0.04183964058756828,
-0.06096478924155235,
-0.013327708467841148,
0.04218398779630661,
-0.010207629762589931,
-0.031685009598731995,
0.023456713184714317,
-0.011996868066489697,
0.013246661983430386,
-0.07109443843364716,
0.00720796687528491,
-0.04473302140831947,
-0.04909016564488411,
-0.034634724259376526,
-0.05870276689529419,
-0.028032982721924782,
-0.01929387077689171,
0.012234089896082878,
0.028382403776049614,
0.012507868930697441,
-0.019763397052884102,
-0.018538571894168854,
0.09521351754665375,
0.06978804618120193,
-0.02753618359565735,
0.07584236562252045,
-0.022998986765742302,
-0.02636708877980709,
0.057604894042015076,
0.034638870507478714,
-0.01829194650053978,
0.021335801109671593,
0.012827552855014801,
-0.057742878794670105,
-0.07833985984325409,
-0.011675456538796425,
0.05127856880426407,
-0.0004978376091457903,
-0.00647265650331974,
0.01348100882023573,
0.0065820361487567425,
0.01959121786057949,
0.03338270261883736,
-0.0071142688393592834,
0.081154964864254,
0.06865403056144714,
-0.08999980241060257,
-0.004823722410947084,
0.022872040048241615,
0.01930553838610649,
-0.00028346930048428476,
-0.13045412302017212,
-0.004042955115437508,
0.05485258623957634,
0.0873548835515976,
0.014883647672832012,
-0.03348715603351593,
-0.002707140985876322,
-0.027022480964660645,
0.08391404151916504,
0.0014271573163568974,
-0.025691410526633263,
-0.05271200090646744,
-0.022419145330786705,
0.09929241985082626,
-0.08320377767086029,
0.0860709697008133,
-0.08476735651493073,
0.013582073152065277,
0.08847310394048691,
0.06681522727012634,
-0.01067015528678894,
-0.020573103800415993,
-0.047530610114336014,
-0.04327476769685745,
0.010306294076144695,
0.07063551992177963,
-0.12008036673069,
-0.05046874284744263,
-0.009115471504628658,
-5.2669335559585306e-8,
-0.008783427067101002,
0.005360411945730448,
-0.029512537643313408,
-0.015896636992692947,
-0.019138319417834282,
0.04781109467148781,
-0.050881728529930115,
-0.052494313567876816,
0.02480948530137539,
0.11377977579832077,
-0.09626343101263046,
0.002614144701510668,
-0.03400687873363495,
-0.027820775285363197,
0.03942219913005829,
0.057843491435050964,
-0.006895339582115412,
-0.025559375062584877,
-0.0035042327363044024,
-0.0023049581795930862,
-0.01993938535451889,
-0.027119209989905357,
-0.013619708828628063,
0.05459654703736305,
-0.033218927681446075,
0.0033243754878640175,
0.03206908330321312,
0.04240572825074196,
-0.060929037630558014,
0.0017494572093710303,
-0.0725487619638443,
-0.03660004213452339,
0.02307761460542679,
-0.027712900191545486,
0.03450970724225044,
-0.015327268280088902,
-0.057832151651382446,
0.06922733783721924,
0.013019275851547718,
0.019208405166864395,
0.0683479756116867,
0.011436199769377708,
-0.016918379813432693,
0.06847632676362991,
0.061286184936761856,
0.05205345153808594,
0.11720184981822968,
-0.0008567850454710424,
-0.05799569934606552,
0.02033376879990101,
0.05787026137113571,
-0.06125101074576378,
0.010409574024379253,
-0.08369721472263336,
-0.07790147513151169,
-0.002392199821770191,
-0.05337126553058624,
-0.060686834156513214,
0.017740566283464432,
-0.004091346636414528,
0.07170244306325912,
0.05397157743573189,
0.08449820429086685,
-0.00029408614500425756
] | 0.016886 |
these special headers or errors may occur. For instance, removing all headers from the request will cause errors to occur: ```js removeAllHeaders(request.headers); assert(request.url); // Fails because the :path header has been removed ``` #### `request.httpVersion` \* Type: {string} In case of server request, the HTTP version sent by the client. In the case of client response, the HTTP version of the connected-to server. Returns `'2.0'`. Also `message.httpVersionMajor` is the first integer and `message.httpVersionMinor` is the second. #### `request.method` \* Type: {string} The request method as a string. Read-only. Examples: `'GET'`, `'DELETE'`. #### `request.rawHeaders` \* Type: {HTTP/2 Raw Headers} The raw request/response headers list exactly as they were received. ```js // Prints something like: // // [ 'user-agent', // 'this is invalid because there can be only one', // 'User-Agent', // 'curl/7.22.0', // 'Host', // '127.0.0.1:8000', // 'ACCEPT', // '\*/\*' ] console.log(request.rawHeaders); ``` #### `request.rawTrailers` \* Type: {string\[]} The raw request/response trailer keys and values exactly as they were received. Only populated at the `'end'` event. #### `request.scheme` \* Type: {string} The request scheme pseudo header field indicating the scheme portion of the target URL. #### `request.setTimeout(msecs, callback)` \* `msecs` {number} \* `callback` {Function} \* Returns: {http2.Http2ServerRequest} Sets the [`Http2Stream`][]'s timeout value to `msecs`. If a callback is provided, then it is added as a listener on the `'timeout'` event on the response object. If no `'timeout'` listener is added to the request, the response, or the server, then [`Http2Stream`][]s are destroyed when they time out. If a handler is assigned to the request, the response, or the server's `'timeout'` events, timed out sockets must be handled explicitly. #### `request.socket` \* Type: {net.Socket|tls.TLSSocket} Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but applies getters, setters, and methods based on HTTP/2 logic. `destroyed`, `readable`, and `writable` properties will be retrieved from and set on `request.stream`. `destroy`, `emit`, `end`, `on` and `once` methods will be called on `request.stream`. `setTimeout` method will be called on `request.stream.session`. `pause`, `read`, `resume`, and `write` will throw an error with code `ERR\_HTTP2\_NO\_SOCKET\_MANIPULATION`. See [`Http2Session` and Sockets][] for more information. All other interactions will be routed directly to the socket. With TLS support, use [`request.socket.getPeerCertificate()`][] to obtain the client's authentication details. #### `request.stream` \* Type: {Http2Stream} The [`Http2Stream`][] object backing the request. #### `request.trailers` \* Type: {Object} The request/response trailers object. Only populated at the `'end'` event. #### `request.url` \* Type: {string} Request URL string. This contains only the URL that is present in the actual HTTP request. If the request is: ```http GET /status?name=ryan HTTP/1.1 Accept: text/plain ``` Then `request.url` will be: ```js '/status?name=ryan' ``` To parse the url into its parts, `new URL()` can be used: ```console $ node > new URL('/status?name=ryan', 'http://example.com') URL { href: 'http://example.com/status?name=ryan', origin: 'http://example.com', protocol: 'http:', username: '', password: '', host: 'example.com', hostname: 'example.com', port: '', pathname: '/status', search: '?name=ryan', searchParams: URLSearchParams { 'name' => 'ryan' }, hash: '' } ``` ### Class: `http2.Http2ServerResponse` \* Extends: {Stream} This object is created internally by an HTTP server, not by the user. It is passed as the second parameter to the [`'request'`][] event. #### Event: `'close'` Indicates that the underlying [`Http2Stream`][] was terminated before [`response.end()`][] was called or able to flush. #### Event: `'finish'` Emitted when the response has been sent. More specifically, this event is emitted when the last segment of the response headers and body have been handed off to the HTTP/2 multiplexing for transmission over the network. It does not imply that the client has received anything yet. After this event, no more events will be emitted on the response object. #### `response.addTrailers(headers)` \* `headers` {Object} This method | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.07725471258163452,
0.0851176306605339,
0.030386202037334442,
0.027331385761499405,
0.03555930405855179,
-0.06823159754276276,
-0.06838476657867432,
0.011231091804802418,
0.041010163724422455,
0.04321019724011421,
-0.016199776902794838,
0.021439911797642708,
0.01798827387392521,
0.057769618928432465,
0.05759371817111969,
-0.038174819201231,
0.022071849554777145,
-0.013262159191071987,
-0.004055491648614407,
0.00013683331781066954,
0.005331261083483696,
0.05221152305603027,
0.005245096981525421,
0.02308056876063347,
0.029641762375831604,
-0.031098144128918648,
-0.04890289530158043,
-0.0226459838449955,
0.003408962395042181,
-0.022690393030643463,
0.050138700753450394,
-0.07619079947471619,
-0.11266487091779709,
0.003962992690503597,
-0.019736668094992638,
0.1016191840171814,
0.04769832640886307,
-0.059974268078804016,
0.010632392019033432,
0.019047539681196213,
0.018288608640432358,
0.06241857260465622,
-0.07798544317483902,
-0.0390545129776001,
-0.03472242131829262,
0.012180588208138943,
-0.06729579716920853,
0.0056166150607168674,
-0.11984752863645554,
-0.03595806658267975,
-0.02004181034862995,
-0.0034169508144259453,
-0.0044639031402766705,
0.03389124572277069,
0.009947793558239937,
-0.073292575776577,
-0.10721718519926071,
0.08323121070861816,
-0.03258329629898071,
0.05849834904074669,
-0.06112596020102501,
-0.11018726974725723,
0.02660358138382435,
-0.08776254206895828,
-0.008853254839777946,
-0.04991815611720085,
-0.0005610227235592902,
-0.008359061554074287,
0.029373764991760254,
0.02393941394984722,
-0.005791142117232084,
-0.014834902249276638,
-0.1502910703420639,
-0.05602066591382027,
-0.032829150557518005,
0.017189981415867805,
0.0011264189379289746,
0.04202696681022644,
-0.016425451263785362,
-0.022750090807676315,
-0.036388229578733444,
-0.09494142979383469,
-0.018356451764702797,
0.07683614641427994,
-0.02508316934108734,
0.020009977743029594,
-0.046221211552619934,
0.016668707132339478,
0.022907325997948647,
0.07403241842985153,
-0.0060021644458174706,
-0.022904207929968834,
0.046758417040109634,
0.10713692009449005,
0.041440024971961975,
0.09729283303022385,
-0.013007380068302155,
0.042520031332969666,
0.0055504776537418365,
0.057420507073402405,
0.04857534170150757,
-0.06080601364374161,
0.051540959626436234,
-0.04986690729856491,
0.04255172982811928,
-0.008838683366775513,
0.011115830391645432,
0.02408134751021862,
-0.01049293763935566,
-0.045612871646881104,
-0.009257418103516102,
-0.03896499425172806,
-0.08366085588932037,
-0.009509879164397717,
-0.06199241057038307,
-0.028712768107652664,
0.07901548594236374,
0.020851101726293564,
-0.07181503623723984,
0.003949382342398167,
0.06573422253131866,
-0.10230179131031036,
0.03431250900030136,
-0.008075634017586708,
0.033758342266082764,
-0.03644834831357002,
0.07642309367656708,
3.7860222868948385e-33,
-0.02094501629471779,
0.014043191447854042,
-0.026947833597660065,
0.05614351108670235,
0.03230173513293266,
0.02168322168290615,
0.02435307763516903,
0.02975538745522499,
-0.021419327706098557,
-0.020943766459822655,
0.0033845941070467234,
-0.029298290610313416,
0.036660511046648026,
-0.007558120414614677,
0.012497391551733017,
0.014967355877161026,
0.09592841565608978,
-0.031170036643743515,
0.017875464633107185,
0.0453445166349411,
0.04057522490620613,
0.0076454714871943,
0.013533010147511959,
0.006074358709156513,
-0.06971710920333862,
0.0111545380204916,
0.005770986434072256,
-0.0003981150803156197,
-0.09852701425552368,
-0.021175207570195198,
0.017871754243969917,
0.0013698405819013715,
-0.03710934519767761,
0.024889836087822914,
0.06423264741897583,
-0.008467157371342182,
0.062341298907995224,
0.024631740525364876,
-0.1348109394311905,
-0.022554857656359673,
0.0022214394994080067,
0.008688892237842083,
-0.10904020071029663,
0.05361584946513176,
0.0025522334035485983,
-0.07613582909107208,
-0.0988454669713974,
-0.021846210584044456,
0.04816228523850441,
0.04294026643037796,
-0.10025743395090103,
0.08308599889278412,
0.16236351430416107,
-0.03202975168824196,
0.04588036984205246,
-0.000500996713526547,
-0.018290366977453232,
0.01638108305633068,
0.0022486019879579544,
-0.054470255970954895,
0.10046575963497162,
0.01205393299460411,
-0.001855631940998137,
-0.05623609945178032,
0.056796204298734665,
0.023031186312437057,
-0.006642158143222332,
0.07239355891942978,
-0.0395376943051815,
0.004777493886649609,
-0.014571476727724075,
0.02876785770058632,
0.04000679776072502,
0.08677501231431961,
-0.04538881406188011,
-0.08712001889944077,
-0.011340795084834099,
0.06973537057638168,
0.12708771228790283,
-0.04904257506132126,
0.04698904603719711,
0.011904962360858917,
0.014470466412603855,
0.08388040214776993,
-0.04207468405365944,
0.034436024725437164,
-0.026039844378829002,
-0.007160840556025505,
0.0901760533452034,
0.009533124044537544,
0.03205059468746185,
0.007216132711619139,
-0.03184066712856293,
-0.030260272324085236,
-0.06675581634044647,
-6.025951384299678e-33,
0.034524932503700256,
0.0029447805136442184,
-0.08662483096122742,
0.034093331545591354,
-0.05021548643708229,
-0.0365305095911026,
0.02329416573047638,
0.08804118633270264,
-0.022191982716321945,
-0.020313488319516182,
0.03183547407388687,
0.022681795060634613,
-0.022154897451400757,
0.023386819288134575,
-0.013644915074110031,
0.013607658445835114,
-0.09233708679676056,
-0.08767135441303253,
-0.01121349073946476,
-0.06636656075716019,
-0.00035097109503112733,
0.02785387448966503,
0.013951582834124565,
0.02307909168303013,
-0.04721049219369888,
-0.014252753928303719,
-0.013789156451821327,
-0.02373613230884075,
-0.07744874805212021,
-0.016449080780148506,
0.029887519776821136,
0.015486394986510277,
-0.00043879824806936085,
-0.0076066600158810616,
0.019415512681007385,
-0.04998081922531128,
0.006404187995940447,
0.14430226385593414,
-0.02727244235575199,
0.01256745308637619,
0.0654466301202774,
-0.01136330422013998,
0.06698884069919586,
0.02774573676288128,
0.08973444998264313,
-0.006630299612879753,
-0.027405712753534317,
0.023831194266676903,
-0.06429526954889297,
0.0038795911241322756,
0.04385330528020859,
0.005806200206279755,
-0.007715624291449785,
0.026996402069926262,
0.02558346837759018,
-0.015436136163771152,
-0.03882981836795807,
0.01788092590868473,
-0.00696319667622447,
0.006751702167093754,
0.015508638694882393,
-0.06903886795043945,
-0.0692625567317009,
0.0790146216750145,
-0.004665009677410126,
-0.03721627965569496,
-0.057951632887125015,
-0.09009279310703278,
0.05910754203796387,
-0.045019134879112244,
-0.004623857326805592,
-0.08046963065862656,
-0.03528362885117531,
-0.020179081708192825,
0.12571635842323303,
-0.04415295645594597,
-0.06122538819909096,
-0.05226154625415802,
0.007565539330244064,
0.08280854672193527,
-0.032770395278930664,
0.019582847133278847,
-0.05333217978477478,
0.02976258099079132,
0.07727497071027756,
-0.07471168786287308,
-0.09509693831205368,
0.04295249283313751,
-0.07070212811231613,
-0.03403044864535332,
0.07872219383716583,
-0.006801259703934193,
-0.05139414221048355,
0.06057392433285713,
-0.006554252002388239,
-5.749815201738784e-8,
-0.020837821066379547,
-0.027447285130620003,
-0.07978315651416779,
-0.0402054637670517,
0.03192757070064545,
0.021622151136398315,
-0.047605086117982864,
-0.038450516760349274,
0.05566324666142464,
0.032402217388153076,
-0.04489653930068016,
0.008415203541517258,
-0.0331621952354908,
-0.045470479875802994,
0.0008463753038085997,
-0.008163404650986195,
-0.014521732926368713,
0.06329463422298431,
-0.03994185850024223,
-0.07584399729967117,
-0.019167179241776466,
-0.016311965882778168,
0.006889966782182455,
-0.012550532817840576,
0.06687118113040924,
0.010834711603820324,
0.06930236518383026,
0.11903966963291168,
-0.09376436471939087,
-0.0733063668012619,
-0.05449504405260086,
0.035761758685112,
0.08732160925865173,
-0.03129969909787178,
-0.016812866553664207,
0.08703631907701492,
-0.03540615364909172,
0.027479160577058792,
0.03234107419848442,
0.008802643977105618,
-0.0036067808978259563,
0.024914825335144997,
0.0020622278098016977,
0.04828130826354027,
0.0243906881660223,
-0.00987220648676157,
0.05174749717116356,
0.0746847614645958,
-0.013404815457761288,
-0.054906658828258514,
-0.018209349364042282,
0.01835734024643898,
-0.08483562618494034,
0.026113195344805717,
-0.06376247107982635,
0.014064175076782703,
0.019991986453533173,
-0.10961654037237167,
-0.022475143894553185,
-0.05329027399420738,
0.1894332319498062,
0.07783015072345734,
0.013730334118008614,
-0.05091121420264244
] | 0.044573 |
of the response headers and body have been handed off to the HTTP/2 multiplexing for transmission over the network. It does not imply that the client has received anything yet. After this event, no more events will be emitted on the response object. #### `response.addTrailers(headers)` \* `headers` {Object} This method adds HTTP trailing headers (a header but at the end of the message) to the response. Attempting to set a header field name or value that contains invalid characters will result in a [`TypeError`][] being thrown. #### `response.appendHeader(name, value)` \* `name` {string} \* `value` {string|string\[]} Append a single header value to the header object. If the value is an array, this is equivalent to calling this method multiple times. If there were no previous values for the header, this is equivalent to calling [`response.setHeader()`][]. Attempting to set a header field name or value that contains invalid characters will result in a [`TypeError`][] being thrown. ```js // Returns headers including "set-cookie: a" and "set-cookie: b" const server = http2.createServer((req, res) => { res.setHeader('set-cookie', 'a'); res.appendHeader('set-cookie', 'b'); res.writeHead(200); res.end('ok'); }); ``` #### `response.connection` > Stability: 0 - Deprecated. Use [`response.socket`][]. \* Type: {net.Socket|tls.TLSSocket} See [`response.socket`][]. #### `response.createPushResponse(headers, callback)` \* `headers` {HTTP/2 Headers Object} An object describing the headers \* `callback` {Function} Called once `http2stream.pushStream()` is finished, or either when the attempt to create the pushed `Http2Stream` has failed or has been rejected, or the state of `Http2ServerRequest` is closed prior to calling the `http2stream.pushStream()` method \* `err` {Error} \* `res` {http2.Http2ServerResponse} The newly-created `Http2ServerResponse` object Call [`http2stream.pushStream()`][] with the given headers, and wrap the given [`Http2Stream`][] on a newly created `Http2ServerResponse` as the callback parameter if successful. When `Http2ServerRequest` is closed, the callback is called with an error `ERR\_HTTP2\_INVALID\_STREAM`. #### `response.end([data[, encoding]][, callback])` \* `data` {string|Buffer|Uint8Array} \* `encoding` {string} \* `callback` {Function} \* Returns: {this} This method signals to the server that all of the response headers and body have been sent; that server should consider this message complete. The method, `response.end()`, MUST be called on each response. If `data` is specified, it is equivalent to calling [`response.write(data, encoding)`][] followed by `response.end(callback)`. If `callback` is specified, it will be called when the response stream is finished. #### `response.finished` > Stability: 0 - Deprecated. Use [`response.writableEnded`][]. \* Type: {boolean} Boolean value that indicates whether the response has completed. Starts as `false`. After [`response.end()`][] executes, the value will be `true`. #### `response.getHeader(name)` \* `name` {string} \* Returns: {string} Reads out a header that has already been queued but not sent to the client. The name is case-insensitive. ```js const contentType = response.getHeader('content-type'); ``` #### `response.getHeaderNames()` \* Returns: {string\[]} Returns an array containing the unique names of the current outgoing headers. All header names are lowercase. ```js response.setHeader('Foo', 'bar'); response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); const headerNames = response.getHeaderNames(); // headerNames === ['foo', 'set-cookie'] ``` #### `response.getHeaders()` \* Returns: {Object} Returns a shallow copy of the current outgoing headers. Since a shallow copy is used, array values may be mutated without additional calls to various header-related http module methods. The keys of the returned object are the header names and the values are the respective header values. All header names are lowercase. The object returned by the `response.getHeaders()` method \_does not\_ prototypically inherit from the JavaScript `Object`. This means that typical `Object` methods such as `obj.toString()`, `obj.hasOwnProperty()`, and others are not defined and \_will not work\_. ```js response.setHeader('Foo', 'bar'); response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); const headers = response.getHeaders(); // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] } ``` #### `response.hasHeader(name)` \* `name` {string} \* Returns: {boolean} Returns `true` if the header identified by `name` is currently set in the | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.07658631354570389,
0.09049095213413239,
0.01636469177901745,
0.03604678064584732,
-0.07342638820409775,
-0.0782475471496582,
-0.00011299041943857446,
0.030210934579372406,
0.005487230606377125,
0.0029202161822468042,
-0.06885433942079544,
-0.0087966900318861,
0.056988589465618134,
0.009287740103900433,
0.05054064840078354,
-0.02033950574696064,
0.014403148554265499,
-0.03220827132463455,
-0.00617686053737998,
-0.025662090629339218,
0.01463073305785656,
0.06375008076429367,
0.002699818229302764,
0.02756975032389164,
0.005408765282481909,
0.0002859203959815204,
-0.045877233147621155,
-0.0057869404554367065,
-0.0016952722799032927,
0.018947003409266472,
0.07723059505224228,
-0.025690658017992973,
-0.1347254365682602,
0.06681618094444275,
-0.09199889749288559,
0.08880329132080078,
0.06516846269369125,
-0.04539096727967262,
-0.0002157450799131766,
0.02482656203210354,
0.04533350095152855,
-0.006026282440871,
-0.09541243314743042,
0.01383803877979517,
-0.040879130363464355,
-0.0013793825637549162,
-0.026211373507976532,
-0.01303798332810402,
-0.027180559933185577,
-0.07037552446126938,
0.06565534323453903,
0.049865394830703735,
0.0382184237241745,
0.08500104397535324,
0.01849447935819626,
-0.05651003494858742,
-0.087270587682724,
0.03911730274558067,
-0.0241791270673275,
0.03136149048805237,
-0.0568823479115963,
-0.0777592733502388,
0.0029696186538785696,
0.0197416003793478,
0.004627653397619724,
-0.04603760689496994,
-0.03923160582780838,
0.020646750926971436,
-0.002716465387493372,
0.07194411009550095,
0.03151432424783707,
-0.009904716163873672,
-0.12268538028001785,
0.026092063635587692,
0.03142120689153671,
-0.00810789130628109,
0.02075287699699402,
-0.008382660336792469,
-0.02879258617758751,
0.009884259663522243,
-0.013365275226533413,
-0.09817014634609222,
-0.0037137495819479227,
0.09024769067764282,
-0.006228653714060783,
-0.009421151131391525,
-0.07058002054691315,
0.09839050471782684,
-0.07267123460769653,
0.025061462074518204,
-0.03680035099387169,
-0.03979715332388878,
0.08841344714164734,
0.07585916668176651,
-0.004799255169928074,
0.061214007437229156,
0.012264344841241837,
-0.06702540814876556,
-0.04571165889501572,
0.01675238646566868,
0.03183616325259209,
-0.12651881575584412,
-0.013625413179397583,
-0.009541978128254414,
0.02460673451423645,
-0.05972552299499512,
-0.010325202718377113,
-0.0016384725458920002,
-0.0009640943026170135,
-0.016846247017383575,
0.0003177063481416553,
0.015485668554902077,
-0.020451845601201057,
-0.02665846422314644,
-0.07771331816911697,
0.05298059061169624,
-0.02023250050842762,
0.048357777297496796,
0.002516665495932102,
-0.03925948217511177,
0.05155698210000992,
-0.05252891778945923,
0.03810290992259979,
-0.034149203449487686,
0.055635079741477966,
-0.0659596174955368,
0.060268335044384,
2.6950977751165066e-33,
-0.028953367844223976,
0.03591829165816307,
-0.04361779987812042,
0.02998526394367218,
-0.014623673632740974,
0.07245466113090515,
0.05437496677041054,
0.038887809962034225,
0.05532607063651085,
-0.0455152802169323,
-0.03235717490315437,
-0.01500488631427288,
0.06054320186376572,
0.021959997713565826,
-0.01313357800245285,
-0.0013593626208603382,
0.028797117993235588,
0.029878677800297737,
0.04551658034324646,
0.10048144310712814,
0.009184145368635654,
-0.003961029462516308,
0.02611399255692959,
-0.004789436236023903,
-0.0917150229215622,
0.029884835705161095,
-0.0319780558347702,
-0.0206186193972826,
-0.08550988137722015,
-0.003392550628632307,
-0.009387454949319363,
0.04027609899640083,
-0.013272480107843876,
0.01120485458523035,
0.07804321497678757,
-0.07069358229637146,
0.04806840792298317,
0.012842068448662758,
-0.09889846295118332,
-0.03897465392947197,
-0.025505874305963516,
0.009152594022452831,
-0.0954991951584816,
0.01910299062728882,
-0.052491385489702225,
-0.06560177356004715,
-0.06627341359853745,
-0.046174485236406326,
0.003380788955837488,
0.010668518021702766,
-0.0035589535254985094,
0.07096964865922928,
0.1353931427001953,
-0.022350985556840897,
-0.029047628864645958,
0.025232790037989616,
-0.02313384972512722,
0.027981596067547798,
0.004642981570214033,
-0.058393288403749466,
0.09196991473436356,
0.022578153759241104,
-0.028285259380936623,
-0.03319139406085014,
0.06581565737724304,
0.027830949053168297,
0.09901709854602814,
0.033913396298885345,
-0.04114441201090813,
0.04060988873243332,
0.010011479258537292,
0.05591446906328201,
-0.01885366253554821,
0.00405803881585598,
-0.028109634295105934,
-0.009569201618432999,
-0.016693878918886185,
0.02543027698993683,
0.042652081698179245,
-0.013709713704884052,
0.08563471585512161,
0.016378875821828842,
0.02467094361782074,
0.049257807433605194,
-0.04348520189523697,
0.052489425987005234,
0.01205467153340578,
-0.024962473660707474,
-0.06772851198911667,
0.05024764686822891,
0.011217474937438965,
-0.05422968789935112,
-0.01194093469530344,
-0.018198462203145027,
-0.0295034758746624,
-4.436192987780446e-33,
0.0519583635032177,
0.0038933621253818274,
-0.08131255209445953,
0.006044860929250717,
-0.03789711371064186,
-0.0590466745197773,
0.08678550273180008,
0.08724858611822128,
0.01611533761024475,
-0.040271300822496414,
0.08212015777826309,
0.012163950130343437,
-0.03127400204539299,
0.01829531416296959,
0.006282946094870567,
0.0335945263504982,
-0.08686208724975586,
-0.02964407205581665,
0.025818660855293274,
-0.10558553040027618,
-0.02245028130710125,
-0.028114983811974525,
-0.06018799915909767,
-0.026083342730998993,
-0.06005986034870148,
-0.01224778313189745,
-0.015328802168369293,
-0.03447520360350609,
-0.04767519608139992,
-0.03016809932887554,
0.02284550480544567,
0.037782907485961914,
0.03684965893626213,
0.021701881662011147,
0.021371640264987946,
-0.01417463831603527,
0.1075189858675003,
0.08773844689130783,
0.01286328211426735,
-0.0034783801529556513,
0.1220419779419899,
0.027899151667952538,
0.050046831369400024,
0.09168653190135956,
0.12342257797718048,
-0.05573128163814545,
-0.11582066118717194,
0.06290854513645172,
-0.043503809720277786,
0.029028095304965973,
0.007640297990292311,
-0.029935400933027267,
-0.04000679403543472,
0.012767435051500797,
0.009558364748954773,
-0.03505437821149826,
0.030794505029916763,
0.007131529506295919,
0.07142812758684158,
-0.030074262991547585,
-0.057597748935222626,
-0.07109704613685608,
-0.012775762937963009,
0.08070273697376251,
0.028250666335225105,
0.055988699197769165,
-0.09934134781360626,
-0.17521801590919495,
0.04486241936683655,
-0.023981278762221336,
0.0373503714799881,
-0.03861558064818382,
-0.04183034598827362,
-0.022919267416000366,
0.072853222489357,
0.03427007049322128,
-0.06763937324285507,
-0.05138532444834709,
-0.038355156779289246,
0.09378169476985931,
-0.05589405447244644,
0.005039703566581011,
-0.0455554723739624,
0.07169435918331146,
0.06350421160459518,
-0.05754050984978676,
-0.019800398498773575,
0.1086006760597229,
-0.04304443299770355,
-0.09674183279275894,
0.03895455598831177,
0.03285284712910652,
-0.046001605689525604,
0.06874129176139832,
-0.04256177321076393,
-5.504150735191615e-8,
-0.051328036934137344,
-0.028747793287038803,
-0.08716072142124176,
0.01189155038446188,
-0.03288089856505394,
0.0942191332578659,
-0.04281359538435936,
-0.10118094831705093,
0.061630573123693466,
-0.05906835198402405,
-0.027727384120225906,
-0.009267306886613369,
0.012205260805785656,
0.0037767216563224792,
0.01907944492995739,
-0.00016957148909568787,
-0.010924422182142735,
-0.020225636661052704,
-0.04236046224832535,
-0.07939861714839935,
0.05778351426124573,
-0.011535810306668282,
-0.009389948099851608,
-0.03960024192929268,
0.028571221977472305,
0.04784726724028587,
0.03770912066102028,
0.09675095230340958,
-0.05444978177547455,
-0.07972697913646698,
-0.002712760353460908,
0.021887877956032753,
0.025938665494322777,
-0.006064706947654486,
-0.026979463174939156,
0.07446832954883575,
-0.008775494992733002,
-0.006447487510740757,
0.09089969843626022,
0.04209049418568611,
0.019769052043557167,
0.03132735565304756,
-0.04577163606882095,
0.032166413962841034,
0.07155992835760117,
0.032500263303518295,
-0.013355954550206661,
0.1054844781756401,
0.04742274060845375,
-0.047311101108789444,
0.02926984615623951,
-0.03396923094987869,
-0.06037619709968567,
-0.009128164499998093,
-0.057307012379169464,
-0.05641195550560951,
-0.016225667670369148,
-0.1315685659646988,
0.042406730353832245,
-0.024299433454871178,
0.10439848154783249,
0.01189718209207058,
-0.01745016872882843,
-0.015487582422792912
] | 0.032282 |
others are not defined and \_will not work\_. ```js response.setHeader('Foo', 'bar'); response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); const headers = response.getHeaders(); // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] } ``` #### `response.hasHeader(name)` \* `name` {string} \* Returns: {boolean} Returns `true` if the header identified by `name` is currently set in the outgoing headers. The header name matching is case-insensitive. ```js const hasContentType = response.hasHeader('content-type'); ``` #### `response.headersSent` \* Type: {boolean} True if headers were sent, false otherwise (read-only). #### `response.removeHeader(name)` \* `name` {string} Removes a header that has been queued for implicit sending. ```js response.removeHeader('Content-Encoding'); ``` #### `response.req` \* Type: {http2.Http2ServerRequest} A reference to the original HTTP2 `request` object. #### `response.sendDate` \* Type: {boolean} When true, the Date header will be automatically generated and sent in the response if it is not already present in the headers. Defaults to true. This should only be disabled for testing; HTTP requires the Date header in responses. #### `response.setHeader(name, value)` \* `name` {string} \* `value` {string|string\[]} Sets a single header value for implicit headers. If this header already exists in the to-be-sent headers, its value will be replaced. Use an array of strings here to send multiple headers with the same name. ```js response.setHeader('Content-Type', 'text/html; charset=utf-8'); ``` or ```js response.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']); ``` Attempting to set a header field name or value that contains invalid characters will result in a [`TypeError`][] being thrown. When headers have been set with [`response.setHeader()`][], they will be merged with any headers passed to [`response.writeHead()`][], with the headers passed to [`response.writeHead()`][] given precedence. ```js // Returns content-type = text/plain const server = http2.createServer((req, res) => { res.setHeader('Content-Type', 'text/html; charset=utf-8'); res.setHeader('X-Foo', 'bar'); res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); res.end('ok'); }); ``` #### `response.setTimeout(msecs[, callback])` \* `msecs` {number} \* `callback` {Function} \* Returns: {http2.Http2ServerResponse} Sets the [`Http2Stream`][]'s timeout value to `msecs`. If a callback is provided, then it is added as a listener on the `'timeout'` event on the response object. If no `'timeout'` listener is added to the request, the response, or the server, then [`Http2Stream`][]s are destroyed when they time out. If a handler is assigned to the request, the response, or the server's `'timeout'` events, timed out sockets must be handled explicitly. #### `response.socket` \* Type: {net.Socket|tls.TLSSocket} Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but applies getters, setters, and methods based on HTTP/2 logic. `destroyed`, `readable`, and `writable` properties will be retrieved from and set on `response.stream`. `destroy`, `emit`, `end`, `on` and `once` methods will be called on `response.stream`. `setTimeout` method will be called on `response.stream.session`. `pause`, `read`, `resume`, and `write` will throw an error with code `ERR\_HTTP2\_NO\_SOCKET\_MANIPULATION`. See [`Http2Session` and Sockets][] for more information. All other interactions will be routed directly to the socket. ```mjs import { createServer } from 'node:http2'; const server = createServer((req, res) => { const ip = req.socket.remoteAddress; const port = req.socket.remotePort; res.end(`Your IP address is ${ip} and your source port is ${port}.`); }).listen(3000); ``` ```cjs const http2 = require('node:http2'); const server = http2.createServer((req, res) => { const ip = req.socket.remoteAddress; const port = req.socket.remotePort; res.end(`Your IP address is ${ip} and your source port is ${port}.`); }).listen(3000); ``` #### `response.statusCode` \* Type: {number} When using implicit headers (not calling [`response.writeHead()`][] explicitly), this property controls the status code that will be sent to the client when the headers get flushed. ```js response.statusCode = 404; ``` After response header was sent to the client, this property indicates the status code which was sent out. #### `response.statusMessage` \* Type: {string} Status message is not supported by HTTP/2 (RFC 7540 8.1.2.4). It returns an empty string. #### `response.stream` \* Type: {Http2Stream} The [`Http2Stream`][] | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.10822892189025879,
0.08833302557468414,
0.02244855836033821,
0.0006406234460882843,
-0.002984271151944995,
-0.04056147113442421,
0.07904529571533203,
0.05034014582633972,
0.006496051792055368,
-0.035319432616233826,
-0.04278925061225891,
-0.04909690096974373,
0.007661613170057535,
0.015573432669043541,
0.048315685242414474,
-0.04048333689570427,
0.028263449668884277,
-0.00785787869244814,
-0.016066445037722588,
-0.04873435199260712,
-0.0014372238656505942,
0.03374865651130676,
0.030651727691292763,
0.010287328623235226,
-0.017682816833257675,
0.0019939765334129333,
0.02893858216702938,
-0.06939485669136047,
-0.0737966001033783,
-0.028064444661140442,
0.11079233139753342,
-0.030140701681375504,
-0.09904597699642181,
-0.03795903921127319,
-0.08109565824270248,
0.06049535050988197,
0.028810445219278336,
-0.08225992321968079,
0.05154360085725784,
-0.0619676448404789,
-0.0523531436920166,
0.06831535696983337,
-0.11648418754339218,
0.004320718813687563,
-0.012820503674447536,
0.027885962277650833,
-0.008145908825099468,
0.04386138170957565,
-0.07314261049032211,
-0.022917365655303,
0.05733290687203407,
0.007857396267354488,
-0.004129739943891764,
0.026463769376277924,
-0.03551337495446205,
0.015692157670855522,
-0.10737818479537964,
0.023832930251955986,
-0.01764245331287384,
0.025354910641908646,
-0.09712789207696915,
-0.10355328768491745,
0.05139380320906639,
-0.015201757661998272,
0.006286857184022665,
-0.04695029556751251,
-0.020797647535800934,
0.06309951841831207,
-0.029361935332417488,
0.06396722048521042,
0.006183994002640247,
0.02860085293650627,
-0.021091192960739136,
0.02584264613687992,
0.010692653246223927,
-0.04121559485793114,
0.031741444021463394,
0.028165802359580994,
0.011630537919700146,
0.007840113714337349,
-0.08521181344985962,
-0.11154209077358246,
-0.028667302802205086,
0.05766070634126663,
0.004019964952021837,
0.024928268045186996,
-0.09965717792510986,
0.05069982632994652,
-0.031450625509023666,
0.02112484723329544,
-0.046333834528923035,
-0.06347885727882385,
0.05044180899858475,
0.05089162662625313,
0.013414655812084675,
0.03126480057835579,
-0.0003481448220554739,
0.01566791906952858,
0.023240206763148308,
0.05749305337667465,
0.0262466873973608,
-0.023237837478518486,
0.07526423037052155,
-0.022768482565879822,
0.017806874588131905,
-0.01814388670027256,
-0.0001029014601954259,
-0.0014430556911975145,
-0.009916190057992935,
-0.0255481768399477,
0.036066167056560516,
0.037993352860212326,
0.013446359895169735,
-0.061306584626436234,
-0.08299566805362701,
-0.04307054728269577,
0.06392426788806915,
-0.006043300032615662,
0.039281345903873444,
-0.04797874391078949,
0.0909084677696228,
-0.00611832644790411,
0.0008937215316109359,
-0.01538009475916624,
-0.002906129229813814,
-0.034001968801021576,
0.018287891522049904,
3.140167486986672e-33,
-0.028377512469887733,
-0.015606594271957874,
-0.08228965848684311,
0.044490739703178406,
-0.03291409835219383,
0.04456328973174095,
-0.013512535952031612,
0.08395185321569443,
-0.015900466591119766,
0.07214980572462082,
0.00778075959533453,
-0.013007896952331066,
0.06100177392363548,
0.00994203146547079,
-0.05782783776521683,
0.0853164792060852,
0.019179893657565117,
-0.03231115639209747,
0.025794586166739464,
-0.004771489184349775,
-0.027648650109767914,
0.02199135720729828,
0.007106406148523092,
-0.008899045176804066,
-0.018019070848822594,
-0.055261656641960144,
0.03318020701408386,
-0.03809010237455368,
-0.0732729509472847,
-0.03834989666938782,
0.08675163984298706,
-0.05381617322564125,
0.02680026926100254,
0.008507288992404938,
0.11158441007137299,
0.017862822860479355,
-0.009903384372591972,
0.044337403029203415,
-0.10557204484939575,
-0.0780809298157692,
0.0574394054710865,
0.0238490030169487,
-0.07487446814775467,
0.03809123858809471,
-0.07787148654460907,
-0.029715532436966896,
-0.08066657185554504,
-0.028745073825120926,
0.01907011680305004,
-0.02212929166853428,
-0.02186860516667366,
0.08978975564241409,
0.08580116182565689,
-0.0010352341923862696,
-0.008566328324377537,
-0.008758658543229103,
-0.04968990013003349,
0.05504531413316727,
-0.03444591164588928,
-0.05852508172392845,
0.07349828630685806,
0.025242438539862633,
0.010803202167153358,
-0.0339067280292511,
0.021147897467017174,
0.03201884776353836,
0.07860149443149567,
0.11586540192365646,
-0.007565641775727272,
-0.036261431872844696,
-0.00023361787316389382,
-0.034302569925785065,
0.023355823010206223,
0.045923031866550446,
-0.020818645134568214,
-0.05327973514795303,
-0.046080950647592545,
0.03273991867899895,
0.02564849518239498,
-0.03714211285114288,
0.09081053733825684,
0.031153425574302673,
-0.0684499740600586,
0.11269742995500565,
-0.0053742751479148865,
0.04802848771214485,
-0.020886855199933052,
-0.06288152188062668,
-0.007574791554361582,
0.029129551723599434,
0.009514681063592434,
-0.05223305895924568,
-0.028726350516080856,
-0.004133956041187048,
-0.06520850956439972,
-6.063394552793214e-33,
0.03589628264307976,
-0.0013705466408282518,
-0.048756081610918045,
-0.02597418613731861,
-0.06494251638650894,
-0.016065072268247604,
0.14300867915153503,
0.06921124458312988,
0.021998049691319466,
-0.04202023893594742,
0.028256645426154137,
0.03869685158133507,
0.005466304253786802,
0.040397997945547104,
0.01196015439927578,
0.10564986616373062,
-0.12271890044212341,
-0.054157692939043045,
-0.012480035424232483,
-0.11530196666717529,
-0.02309945598244667,
0.015855049714446068,
-0.013785277493298054,
0.025676608085632324,
-0.06469503045082092,
-0.025741830468177795,
-0.019648877903819084,
0.0048758662305772305,
-0.04229787737131119,
0.002557994332164526,
-0.009152674116194248,
0.04609564691781998,
-0.02629629708826542,
0.026615554466843605,
-0.03973396122455597,
-0.07136688381433487,
0.04478618875145912,
0.121194988489151,
-0.06470198184251785,
0.033678121864795685,
0.01491007674485445,
0.009847001172602177,
0.05617228150367737,
0.029455209150910378,
0.026422686874866486,
0.03866864740848541,
-0.0037145763635635376,
0.0271491426974535,
0.02221669815480709,
0.029116688296198845,
0.0024402786511927843,
-0.07445259392261505,
-0.04304584860801697,
-0.01936505362391472,
0.05381028354167938,
-0.0449821911752224,
-0.07410928606987,
-0.05014047026634216,
-0.013148508965969086,
-0.0146150141954422,
-0.012586337514221668,
-0.13513019680976868,
0.00892761629074812,
0.07064414769411087,
-0.0033483251463621855,
-0.04306361451745033,
-0.07690350711345673,
-0.07031527161598206,
0.13944345712661743,
-0.053401343524456024,
-0.01065094955265522,
-0.03977704420685768,
0.07538677752017975,
-0.0177350752055645,
0.07314769923686981,
0.06446275115013123,
0.054601531475782394,
-0.09826075285673141,
-0.00795870739966631,
0.07463344186544418,
-0.03715812787413597,
-0.04232603311538696,
-0.07060147821903229,
0.03140536695718765,
0.08806059509515762,
0.005531756207346916,
-0.06687818467617035,
0.08605019003152847,
-0.07309674471616745,
-0.06446246802806854,
0.08509207516908646,
0.052542299032211304,
-0.01361167524009943,
-0.011051513254642487,
-0.08004412055015564,
-5.253059143228711e-8,
-0.005626002326607704,
-0.0920778140425682,
-0.04583293944597244,
-0.012742958962917328,
-0.03305814415216446,
0.09945215284824371,
0.03367891162633896,
-0.055494215339422226,
-0.07774186879396439,
-0.06242622062563896,
-0.04002483934164047,
0.07558406889438629,
0.007304783444851637,
-0.011882985942065716,
-0.05568642541766167,
-0.015749672427773476,
-0.06027786061167717,
0.054306916892528534,
-0.03952934592962265,
-0.048782896250486374,
-0.0035595078952610493,
0.017023341730237007,
0.008657344616949558,
0.014206070452928543,
0.10152242332696915,
0.026121124625205994,
0.004219259601086378,
-0.00570024223998189,
-0.016707677394151688,
0.004679684992879629,
0.005293064285069704,
0.0807526558637619,
0.027220947667956352,
-0.09361208975315094,
0.04751552641391754,
0.02968044951558113,
0.019165003672242165,
0.026633350178599358,
0.06333015859127045,
0.019403045997023582,
0.030129382386803627,
0.05544082447886467,
-0.030428333207964897,
0.07485806941986084,
-0.02486165426671505,
-0.020750023424625397,
0.036781828850507736,
0.13578973710536957,
0.06704490631818771,
-0.024518700316548347,
0.005124074872583151,
0.022085169330239296,
-0.047961462289094925,
0.0069826459512114525,
-0.061205651611089706,
-0.06836749613285065,
0.018128737807273865,
-0.03606213629245758,
0.04901771992444992,
-0.038430992513895035,
0.12765194475650787,
-0.03091719187796116,
0.010508926585316658,
-0.060003336519002914
] | 0.01855 |
```js response.statusCode = 404; ``` After response header was sent to the client, this property indicates the status code which was sent out. #### `response.statusMessage` \* Type: {string} Status message is not supported by HTTP/2 (RFC 7540 8.1.2.4). It returns an empty string. #### `response.stream` \* Type: {Http2Stream} The [`Http2Stream`][] object backing the response. #### `response.writableEnded` \* Type: {boolean} Is `true` after [`response.end()`][] has been called. This property does not indicate whether the data has been flushed, for this use [`writable.writableFinished`][] instead. #### `response.write(chunk[, encoding][, callback])` \* `chunk` {string|Buffer|Uint8Array} \* `encoding` {string} \* `callback` {Function} \* Returns: {boolean} If this method is called and [`response.writeHead()`][] has not been called, it will switch to implicit header mode and flush the implicit headers. This sends a chunk of the response body. This method may be called multiple times to provide successive parts of the body. In the `node:http` module, the response body is omitted when the request is a HEAD request. Similarly, the `204` and `304` responses \_must not\_ include a message body. `chunk` can be a string or a buffer. If `chunk` is a string, the second parameter specifies how to encode it into a byte stream. By default the `encoding` is `'utf8'`. `callback` will be called when this chunk of data is flushed. This is the raw HTTP body and has nothing to do with higher-level multi-part body encodings that may be used. The first time [`response.write()`][] is called, it will send the buffered header information and the first chunk of the body to the client. The second time [`response.write()`][] is called, Node.js assumes data will be streamed, and sends the new data separately. That is, the response is buffered up to the first chunk of the body. Returns `true` if the entire data was flushed successfully to the kernel buffer. Returns `false` if all or part of the data was queued in user memory. `'drain'` will be emitted when the buffer is free again. #### `response.writeContinue()` Sends a status `100 Continue` to the client, indicating that the request body should be sent. See the [`'checkContinue'`][] event on `Http2Server` and `Http2SecureServer`. #### `response.writeEarlyHints(hints)` \* `hints` {Object} Sends a status `103 Early Hints` to the client with a Link header, indicating that the user agent can preload/preconnect the linked resources. The `hints` is an object containing the values of headers to be sent with early hints message. \*\*Example\*\* ```js const earlyHintsLink = '; rel=preload; as=style'; response.writeEarlyHints({ 'link': earlyHintsLink, }); const earlyHintsLinks = [ '; rel=preload; as=style', '; rel=preload; as=script', ]; response.writeEarlyHints({ 'link': earlyHintsLinks, }); ``` #### `response.writeHead(statusCode[, statusMessage][, headers])` \* `statusCode` {number} \* `statusMessage` {string} \* `headers` {HTTP/2 Headers Object|HTTP/2 Raw Headers} \* Returns: {http2.Http2ServerResponse} Sends a response header to the request. The status code is a 3-digit HTTP status code, like `404`. The last argument, `headers`, are the response headers. Returns a reference to the `Http2ServerResponse`, so that calls can be chained. For compatibility with [HTTP/1][], a human-readable `statusMessage` may be passed as the second argument. However, because the `statusMessage` has no meaning within HTTP/2, the argument will have no effect and a process warning will be emitted. ```js const body = 'hello world'; response.writeHead(200, { 'Content-Length': Buffer.byteLength(body), 'Content-Type': 'text/plain; charset=utf-8', }); ``` `Content-Length` is given in bytes not characters. The `Buffer.byteLength()` API may be used to determine the number of bytes in a given encoding. On outbound messages, Node.js does not check if Content-Length and the length of the body being transmitted are equal or not. However, when receiving messages, Node.js will automatically reject messages when the `Content-Length` does not match the actual payload size. This method may be | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.055352289229631424,
0.0725262314081192,
0.04207507148385048,
0.03194984421133995,
-0.010411090217530727,
-0.10050645470619202,
-0.07969553023576736,
0.015745261684060097,
0.03698377683758736,
0.0003843498125206679,
-0.03700428828597069,
0.05534523352980614,
-0.04016272351145744,
0.03271898254752159,
0.06453872472047806,
-0.027656812220811844,
0.04432479292154312,
-0.0586547777056694,
-0.04839148372411728,
-0.06395295262336731,
0.06828442215919495,
0.0900101438164711,
0.0050105322152376175,
0.02670159749686718,
0.04596003144979477,
0.07168763875961304,
-0.06347616761922836,
-0.056571561843156815,
-0.00019883664208464324,
-0.006508908700197935,
0.034989044070243835,
-0.06949716061353683,
-0.10251829773187637,
-0.01792246662080288,
-0.045938584953546524,
0.07837797701358795,
0.067024365067482,
-0.0944291353225708,
-0.026278063654899597,
-0.019129294902086258,
0.046458106487989426,
0.05449090525507927,
-0.06679785996675491,
-0.010497977957129478,
-0.011528710834681988,
0.040571246296167374,
-0.030925646424293518,
-0.006475867237895727,
-0.11876566708087921,
-0.018840137869119644,
0.010238728486001492,
0.015297947451472282,
-0.028019675984978676,
0.044945623725652695,
0.041767433285713196,
-0.05316874384880066,
-0.0933956578373909,
0.042377591133117676,
-0.02416374348104,
0.03558047488331795,
0.005196807906031609,
-0.06428602337837219,
0.03315390646457672,
-0.026931054890155792,
-0.006177419796586037,
-0.05964362621307373,
-0.015305638313293457,
-0.003018762683495879,
-0.005878031253814697,
0.011438362300395966,
-0.0028898012824356556,
0.0119094243273139,
-0.09000205248594284,
0.004168434534221888,
0.033512912690639496,
-0.028694435954093933,
0.03332799673080444,
0.03724147751927376,
-0.014082899317145348,
0.009060780517756939,
-0.000113555601274129,
-0.13476546108722687,
0.015720322728157043,
0.09077142179012299,
-0.02932046540081501,
0.0015371856279671192,
-0.009952865540981293,
0.10558139532804489,
0.01893715187907219,
0.02765757218003273,
-0.02361363358795643,
0.02891610935330391,
0.09211251139640808,
0.050802502781152725,
-0.06385353207588196,
0.04777531325817108,
0.006571488920599222,
0.034054696559906006,
-0.06704738736152649,
0.023810336366295815,
0.05358963832259178,
-0.04056933522224426,
0.011339220218360424,
-0.0675325095653534,
0.08008080720901489,
-0.029099470004439354,
-0.0018304099794477224,
0.030831055715680122,
0.063599593937397,
-0.018279291689395905,
-0.026929281651973724,
0.004215340595692396,
-0.007051106076687574,
-0.006939180660992861,
-0.021670127287507057,
0.012640136294066906,
-0.012463848106563091,
0.016335997730493546,
-0.026574106886982918,
0.028599092736840248,
0.08052338659763336,
-0.04241572320461273,
0.010537694208323956,
-0.03011109121143818,
0.07441975176334381,
-0.05632190778851509,
0.0795665830373764,
4.5275671024057394e-33,
-0.02187340334057808,
0.00882651749998331,
-0.03246314451098442,
0.04838159680366516,
0.04457501694560051,
-0.036935675889253616,
0.015364623628556728,
-0.02677997201681137,
-0.013380363583564758,
-0.06449385732412338,
-0.00005914418215979822,
-0.053069762885570526,
0.0073337918147444725,
0.04233638569712639,
-0.029491612687706947,
0.005646515637636185,
0.09108544141054153,
-0.021549956873059273,
0.05967466160655022,
0.07952089607715607,
0.021635165438055992,
0.04840175062417984,
0.020372426137328148,
0.02126472070813179,
-0.041438378393650055,
-0.010682337917387486,
0.008103017695248127,
-0.06254386901855469,
-0.06901939958333969,
-0.002882975386455655,
-0.02234448865056038,
-0.013451531529426575,
0.0031104472000151873,
-0.031286951154470444,
0.0734550952911377,
-0.09105050563812256,
0.022370532155036926,
-0.0022955695167183876,
-0.1132935956120491,
-0.00899235624819994,
0.030589966103434563,
0.04198048263788223,
-0.1404464989900589,
0.03459739312529564,
-0.038146015256643295,
-0.08809998631477356,
-0.0684586763381958,
-0.008567330427467823,
0.06467611342668533,
0.014687594026327133,
-0.05362573638558388,
0.09115809202194214,
0.12395213544368744,
-0.026157891377806664,
0.005149198696017265,
0.011961008422076702,
0.006936389487236738,
0.0006145534571260214,
-0.02233876846730709,
-0.08477985858917236,
0.07637582719326019,
0.02456710673868656,
0.01003013364970684,
-0.09913910925388336,
0.027723710983991623,
0.032516587525606155,
-0.018250413239002228,
0.08224266767501831,
-0.028526626527309418,
0.012516085058450699,
-0.021635759621858597,
0.0032538699451833963,
0.02830161713063717,
0.09266797453165054,
-0.029601337388157845,
-0.05224582925438881,
-0.005473556462675333,
-0.030516846105456352,
0.06602899730205536,
-0.028299646452069283,
0.05196494236588478,
-0.05062666907906532,
-0.01025430578738451,
0.06262403726577759,
0.010667398571968079,
0.00863614957779646,
0.0027458914555609226,
-0.014873369596898556,
-0.014749769121408463,
0.07481249421834946,
-0.04998989403247833,
-0.018751690164208412,
-0.026343999430537224,
-0.06774136424064636,
-0.007212163880467415,
-6.542159442887716e-33,
0.016705917194485664,
-0.003976498730480671,
-0.141196146607399,
0.03894691541790962,
-0.053076229989528656,
-0.04364613816142082,
0.04153177887201309,
0.11009228229522705,
0.04010878875851631,
0.007964604534208775,
0.04674224555492401,
0.009492112323641777,
-0.004314233083277941,
0.02976245805621147,
-0.05813562870025635,
0.00676425127312541,
-0.0813504084944725,
-0.05547892674803734,
0.00793461687862873,
-0.07141519337892532,
0.007309739012271166,
-0.06889726966619492,
0.041331879794597626,
0.07701980322599411,
-0.05125780776143074,
0.0037583925295621157,
0.019174817949533463,
-0.03520175814628601,
-0.04297422990202904,
-0.0649210661649704,
0.027625393122434616,
0.024034922942519188,
0.00021243382070679218,
0.010177292861044407,
-0.0011092338245362043,
-0.09842877835035324,
0.04442446306347847,
0.0641753077507019,
-0.04819110035896301,
-0.006563240196555853,
0.09682600200176239,
0.01734795980155468,
0.01662873849272728,
0.04269728064537048,
0.07080526649951935,
0.02453230321407318,
0.00655519962310791,
0.012257506139576435,
-0.061149712651968,
-0.0011599777499213815,
0.07496687024831772,
-0.005972292739897966,
0.036364562809467316,
0.12900346517562866,
0.01676534302532673,
-0.059125229716300964,
-0.005856615025550127,
-0.05472179874777794,
0.015877848491072655,
0.013856930658221245,
-0.023250674828886986,
-0.1058618575334549,
-0.03912517428398132,
0.009299986064434052,
0.05010119453072548,
-0.013901712372899055,
-0.03167727589607239,
-0.024586325511336327,
0.028723059222102165,
-0.022291241213679314,
0.02471473067998886,
-0.10554749518632889,
-0.011595548130571842,
-0.013706923462450504,
0.11699124425649643,
0.03357549384236336,
-0.06867703795433044,
-0.05784659460186958,
-0.005142644979059696,
0.12949848175048828,
-0.05660722032189369,
0.05348077043890953,
-0.04880282282829285,
0.04231293126940727,
0.1297387033700943,
-0.08000310510396957,
-0.022677522152662277,
0.058053333312273026,
-0.04581831395626068,
-0.04559068754315376,
0.06691309809684753,
0.04361820966005325,
-0.11022557318210602,
0.03306010365486145,
0.016621094197034836,
-5.443766326607147e-8,
-0.08708232641220093,
-0.03897830843925476,
-0.08827253431081772,
0.0010280351852998137,
0.010987397283315659,
0.033349134027957916,
-0.01895453967154026,
-0.052050355821847916,
0.05788877606391907,
-0.002146762562915683,
-0.06624279916286469,
-0.033419232815504074,
-0.013642517849802971,
-0.0227117408066988,
0.022510381415486336,
-0.024727409705519676,
-0.001182086649350822,
0.014781881123781204,
-0.010413622483611107,
-0.05479835346341133,
0.044275447726249695,
-0.09121846407651901,
-0.019019782543182373,
-0.016718607395887375,
0.015868118032813072,
0.01934816874563694,
0.030075622722506523,
0.0339701883494854,
-0.09430213272571564,
-0.07652316242456436,
-0.02479610964655876,
0.029530728235840797,
0.07849130034446716,
-0.02848624810576439,
-0.024097179993987083,
0.006653463467955589,
0.029873786494135857,
0.023544853553175926,
0.024096684530377388,
-0.0022202772088348866,
0.0703614354133606,
0.05021221190690994,
-0.039554331451654434,
0.03954761102795601,
0.10781297087669373,
0.012650049291551113,
0.07908779382705688,
0.061213795095682144,
-0.007992049679160118,
-0.06891360878944397,
0.02950861118733883,
-0.014218977652490139,
-0.026993464678525925,
-0.002667989581823349,
-0.060915783047676086,
-0.04911911115050316,
-0.025507980957627296,
-0.07447238266468048,
-0.010856349021196365,
-0.08897958695888519,
0.20678158104419708,
-0.011154134757816792,
0.020055575296282768,
-0.02532990835607052
] | 0.029242 |
of bytes in a given encoding. On outbound messages, Node.js does not check if Content-Length and the length of the body being transmitted are equal or not. However, when receiving messages, Node.js will automatically reject messages when the `Content-Length` does not match the actual payload size. This method may be called at most one time on a message before [`response.end()`][] is called. If [`response.write()`][] or [`response.end()`][] are called before calling this, the implicit/mutable headers will be calculated and call this function. When headers have been set with [`response.setHeader()`][], they will be merged with any headers passed to [`response.writeHead()`][], with the headers passed to [`response.writeHead()`][] given precedence. ```js // Returns content-type = text/plain const server = http2.createServer((req, res) => { res.setHeader('Content-Type', 'text/html; charset=utf-8'); res.setHeader('X-Foo', 'bar'); res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); res.end('ok'); }); ``` Attempting to set a header field name or value that contains invalid characters will result in a [`TypeError`][] being thrown. ## Collecting HTTP/2 performance metrics The [Performance Observer][] API can be used to collect basic performance metrics for each `Http2Session` and `Http2Stream` instance. ```mjs import { PerformanceObserver } from 'node:perf\_hooks'; const obs = new PerformanceObserver((items) => { const entry = items.getEntries()[0]; console.log(entry.entryType); // prints 'http2' if (entry.name === 'Http2Session') { // Entry contains statistics about the Http2Session } else if (entry.name === 'Http2Stream') { // Entry contains statistics about the Http2Stream } }); obs.observe({ entryTypes: ['http2'] }); ``` ```cjs const { PerformanceObserver } = require('node:perf\_hooks'); const obs = new PerformanceObserver((items) => { const entry = items.getEntries()[0]; console.log(entry.entryType); // prints 'http2' if (entry.name === 'Http2Session') { // Entry contains statistics about the Http2Session } else if (entry.name === 'Http2Stream') { // Entry contains statistics about the Http2Stream } }); obs.observe({ entryTypes: ['http2'] }); ``` The `entryType` property of the `PerformanceEntry` will be equal to `'http2'`. The `name` property of the `PerformanceEntry` will be equal to either `'Http2Stream'` or `'Http2Session'`. If `name` is equal to `Http2Stream`, the `PerformanceEntry` will contain the following additional properties: \* `bytesRead` {number} The number of `DATA` frame bytes received for this `Http2Stream`. \* `bytesWritten` {number} The number of `DATA` frame bytes sent for this `Http2Stream`. \* `id` {number} The identifier of the associated `Http2Stream` \* `timeToFirstByte` {number} The number of milliseconds elapsed between the `PerformanceEntry` `startTime` and the reception of the first `DATA` frame. \* `timeToFirstByteSent` {number} The number of milliseconds elapsed between the `PerformanceEntry` `startTime` and sending of the first `DATA` frame. \* `timeToFirstHeader` {number} The number of milliseconds elapsed between the `PerformanceEntry` `startTime` and the reception of the first header. If `name` is equal to `Http2Session`, the `PerformanceEntry` will contain the following additional properties: \* `bytesRead` {number} The number of bytes received for this `Http2Session`. \* `bytesWritten` {number} The number of bytes sent for this `Http2Session`. \* `framesReceived` {number} The number of HTTP/2 frames received by the `Http2Session`. \* `framesSent` {number} The number of HTTP/2 frames sent by the `Http2Session`. \* `maxConcurrentStreams` {number} The maximum number of streams concurrently open during the lifetime of the `Http2Session`. \* `pingRTT` {number} The number of milliseconds elapsed since the transmission of a `PING` frame and the reception of its acknowledgment. Only present if a `PING` frame has been sent on the `Http2Session`. \* `streamAverageDuration` {number} The average duration (in milliseconds) for all `Http2Stream` instances. \* `streamCount` {number} The number of `Http2Stream` instances processed by the `Http2Session`. \* `type` {string} Either `'server'` or `'client'` to identify the type of `Http2Session`. ## Note on `:authority` and `host` HTTP/2 requires requests to have either the `:authority` pseudo-header or the `host` header. Prefer `:authority` when constructing an HTTP/2 request directly, and `host` when converting from HTTP/1 (in proxies, for | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.021137749776244164,
0.07310450077056885,
0.06336551904678345,
0.04878523200750351,
0.04482189565896988,
-0.1044631153345108,
-0.0395178347826004,
0.06139860302209854,
0.0770406723022461,
-0.027160674333572388,
-0.06595473736524582,
0.03692570701241493,
0.022357024252414703,
-0.022367386147379875,
-0.02136841043829918,
-0.04633410647511482,
0.05525799095630646,
0.017278077080845833,
-0.031932275742292404,
-0.02294263429939747,
0.045787617564201355,
0.02218773402273655,
0.07101916521787643,
-0.0003266826970502734,
0.0013098107883706689,
0.030107883736491203,
-0.08456861227750778,
0.0008766964892856777,
-0.00941042136400938,
-0.04618251696228981,
0.05905063822865486,
-0.037155721336603165,
-0.0483647882938385,
0.06912626326084137,
-0.09572005271911621,
0.12068096548318863,
0.043757785111665726,
-0.11268305778503418,
-0.007719861343502998,
-0.015826551243662834,
-0.003312455490231514,
0.07389258593320847,
-0.05346699059009552,
0.022048931568861008,
0.05085759609937668,
0.03338455781340599,
-0.09117452800273895,
0.03882702812552452,
-0.09754050523042679,
-0.06540393829345703,
0.029808951541781425,
0.039905302226543427,
-0.03526733070611954,
0.0947352796792984,
0.002349125687032938,
-0.04280451685190201,
-0.11599735170602798,
0.0362342968583107,
-0.02867584116756916,
0.07920993864536285,
-0.09676821529865265,
-0.10732878744602203,
0.06258979439735413,
-0.009923027828335762,
0.02432715892791748,
-0.01967877522110939,
-0.014350351877510548,
-0.011021208018064499,
-0.07731037586927414,
0.0549909844994545,
0.021265646442770958,
0.00001623483512958046,
-0.13926111161708832,
0.09633903205394745,
-0.002842062385752797,
-0.054784610867500305,
0.026748742908239365,
0.043082233518362045,
-0.07789107412099838,
0.04790444299578667,
-0.06923271715641022,
-0.08233951032161713,
0.0074073635041713715,
0.051724862307310104,
-0.048210129141807556,
0.0270022451877594,
-0.023132573813199997,
0.07110853493213654,
-0.02008742466568947,
0.006556887179613113,
-0.03810630738735199,
-0.07633047550916672,
-0.005999044980853796,
0.12438318878412247,
-0.0562744215130806,
0.04713111370801926,
-0.012871825136244297,
0.014131004922091961,
-0.02930467762053013,
0.00917853508144617,
0.020646551623940468,
-0.04725981503725052,
0.0405101478099823,
-0.03947823494672775,
0.01270331535488367,
-0.052508994936943054,
0.002473121974617243,
0.0307786725461483,
0.009638004004955292,
-0.0032075128983706236,
0.0427369587123394,
0.04193234443664551,
-0.0017499994719401002,
0.018799688667058945,
-0.027356984093785286,
-0.008589797653257847,
0.038372572511434555,
-0.034214820712804794,
0.0017696977593004704,
0.01224192138761282,
0.08617271482944489,
-0.007709347177296877,
-0.03299517557024956,
-0.023789025843143463,
0.001779138226993382,
-0.046141330152750015,
0.07089273631572723,
4.046950441366708e-33,
-0.11274781823158264,
0.010765132494270802,
0.05527283996343613,
0.0898263081908226,
-0.004289304371923208,
0.06168108060956001,
0.002465313533321023,
0.0004999160883016884,
-0.039295412600040436,
-0.020263539627194405,
-0.06499555706977844,
0.003494028002023697,
0.06261914223432541,
0.012540871277451515,
0.01579986698925495,
0.007380959112197161,
0.0581195242702961,
0.01718287356197834,
0.050664205104112625,
0.05282890051603317,
-0.011359998025000095,
-0.024733005091547966,
0.05144193768501282,
0.060115404427051544,
-0.018612347543239594,
-0.09618142247200012,
-0.042208123952150345,
-0.04969560354948044,
-0.10243920981884003,
-0.04983650520443916,
-0.06608399003744125,
0.039546046406030655,
0.004743555560708046,
0.02587590366601944,
0.08383446931838989,
-0.06432103365659714,
0.022390270605683327,
0.03330952674150467,
-0.14058555662631989,
-0.0021867353934794664,
0.04727363958954811,
0.03713804855942726,
-0.06392232328653336,
0.01848117634654045,
-0.07531867921352386,
-0.07347510010004044,
-0.005835902877151966,
-0.09100358188152313,
-0.007760665379464626,
0.0032890394795686007,
0.024035729467868805,
0.055121805518865585,
0.11230412125587463,
0.010255551896989346,
0.05463561415672302,
0.018364684656262398,
0.03465886414051056,
-0.04251531511545181,
-0.016283348202705383,
0.05738593265414238,
0.07930035889148712,
-0.04128864407539368,
0.027616238221526146,
-0.035096097737550735,
0.05868031084537506,
0.04940149560570717,
-0.05056412145495415,
0.024190818890929222,
-0.009388656355440617,
-0.008645374327898026,
0.048252955079078674,
0.013561549596488476,
0.0605180598795414,
0.07611758261919022,
-0.066159687936306,
-0.03971514478325844,
-0.055540990084409714,
-0.04230201244354248,
0.08532637357711792,
0.0057886638678610325,
0.0592857301235199,
0.018157698214054108,
0.015166978351771832,
0.01780187524855137,
-0.02677595429122448,
-0.010819443501532078,
-0.024626946076750755,
-0.05024627968668938,
0.014712748117744923,
0.04814378544688225,
-0.04178236424922943,
-0.014631280675530434,
-0.02171051874756813,
-0.095525361597538,
-0.020978951826691628,
-5.0845100810116005e-33,
-0.02181863784790039,
0.02298923209309578,
-0.11048769950866699,
0.084760382771492,
-0.0569034181535244,
0.0009096033754758537,
0.018048856407403946,
0.10293633490800858,
0.06002494692802429,
0.005232766270637512,
0.027628451585769653,
-0.012562577612698078,
0.001286628539673984,
-0.002238430082798004,
-0.023286696523427963,
0.04811902344226837,
-0.04646085575222969,
-0.07304247468709946,
0.01973217912018299,
-0.0561346560716629,
0.023709958419203758,
-0.04051971808075905,
0.0026698103174567223,
0.013189917430281639,
-0.025287926197052002,
0.01333114318549633,
-0.0200802031904459,
-0.01926051639020443,
-0.050324175506830215,
-0.07017283141613007,
-0.03457661718130112,
-0.011971315369009972,
-0.029930582270026207,
0.012393457815051079,
0.023798970505595207,
-0.1193390041589737,
0.05335283651947975,
0.1235586479306221,
0.05294452980160713,
0.05210241675376892,
0.07335004955530167,
0.015677396208047867,
-0.0029179020784795284,
0.056373853236436844,
0.02796737477183342,
-0.030878251418471336,
-0.01518581435084343,
0.023856429383158684,
0.015341226942837238,
-0.02975578047335148,
-0.011666227132081985,
-0.019865406677126884,
0.026226503774523735,
0.04835495725274086,
0.012360204011201859,
-0.08216097205877304,
-0.05732780322432518,
0.01749064400792122,
0.10479341447353363,
-0.03437057510018349,
-0.0056867147795856,
-0.09543435275554657,
-0.0345582477748394,
-0.01880895346403122,
0.0111395800486207,
-0.014443076215684414,
-0.04531306400895119,
-0.047588884830474854,
0.039638593792915344,
0.050527289509773254,
-0.009111786261200905,
-0.02484602853655815,
0.006059401202946901,
0.0017258127918466926,
0.056247323751449585,
0.01785225421190262,
-0.06026557460427284,
-0.0961650013923645,
0.004795307293534279,
0.06003948301076889,
-0.042702704668045044,
0.08569406718015671,
-0.06546851992607117,
0.0634865015745163,
0.10959269106388092,
0.00857089925557375,
-0.015254100784659386,
0.035539913922548294,
-0.05773821845650673,
-0.0026420296635478735,
0.05605729669332504,
0.06078730523586273,
-0.047326914966106415,
0.012844858691096306,
-0.06321500986814499,
-5.481830811504551e-8,
-0.04359595477581024,
-0.10057605057954788,
-0.12620872259140015,
0.010851934552192688,
0.010623341426253319,
0.07728541642427444,
0.015075371600687504,
-0.03178449720144272,
0.017145300284028053,
0.014889208599925041,
-0.0036336854100227356,
-0.0029013792518526316,
0.024379469454288483,
-0.041734930127859116,
0.03502668812870979,
0.0037106380332261324,
0.014899552799761295,
-0.05724108964204788,
-0.02364964783191681,
-0.05146941542625427,
0.04209437966346741,
0.03711618483066559,
-0.07555138319730759,
0.043788887560367584,
0.0256611630320549,
-0.018077295273542404,
0.015203024260699749,
0.0588214173913002,
-0.10811854153871536,
-0.07879345118999481,
-0.005346713587641716,
0.01613684743642807,
-0.002216786378994584,
-0.014626046642661095,
0.03129256144165993,
-0.02415299601852894,
-0.0010983907850459218,
-0.0008704430074431002,
0.05656857043504715,
0.06979548931121826,
0.05628914013504982,
0.037963565438985825,
-0.014703922905027866,
0.01284876186400652,
0.009224463254213333,
0.04731767624616623,
0.02775372378528118,
0.04981045052409172,
0.012610964477062225,
-0.004070847295224667,
0.16087308526039124,
-0.06428259611129761,
-0.1002640351653099,
0.005699662026017904,
-0.03574731945991516,
-0.07448199391365051,
-0.005319671705365181,
-0.058023449033498764,
-0.014841124415397644,
0.000644099316559732,
0.06298674643039703,
0.062177784740924835,
0.022588931024074554,
-0.07318735122680664
] | 0.032629 |
`Http2Session`. \* `type` {string} Either `'server'` or `'client'` to identify the type of `Http2Session`. ## Note on `:authority` and `host` HTTP/2 requires requests to have either the `:authority` pseudo-header or the `host` header. Prefer `:authority` when constructing an HTTP/2 request directly, and `host` when converting from HTTP/1 (in proxies, for instance). The compatibility API falls back to `host` if `:authority` is not present. See [`request.authority`][] for more information. However, if you don't use the compatibility API (or use `req.headers` directly), you need to implement any fall-back behavior yourself. [ALPN Protocol ID]: https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids [ALPN negotiation]: #alpn-negotiation [Compatibility API]: #compatibility-api [HTTP/1]: http.md [HTTP/2]: https://tools.ietf.org/html/rfc7540 [HTTP/2 Headers Object]: #headers-object [HTTP/2 Raw Headers]: #raw-headers [HTTP/2 Settings Object]: #settings-object [HTTP/2 Unencrypted]: https://http2.github.io/faq/#does-http2-require-encryption [HTTPS]: https.md [Performance Observer]: perf\_hooks.md [RFC 7838]: https://tools.ietf.org/html/rfc7838 [RFC 8336]: https://tools.ietf.org/html/rfc8336 [RFC 8441]: https://tools.ietf.org/html/rfc8441 [RFC 9113]: https://datatracker.ietf.org/doc/html/rfc9113#section-5.3.1 [Sensitive headers]: #sensitive-headers [`'checkContinue'`]: #event-checkcontinue [`'connect'`]: #event-connect [`'request'`]: #event-request [`'unknownProtocol'`]: #event-unknownprotocol [`ClientHttp2Stream`]: #class-clienthttp2stream [`Duplex`]: stream.md#class-streamduplex [`Http2ServerRequest`]: #class-http2http2serverrequest [`Http2ServerResponse`]: #class-http2http2serverresponse [`Http2Session` and Sockets]: #http2session-and-sockets [`Http2Session`'s `'stream'` event]: #event-stream [`Http2Stream`]: #class-http2stream [`ServerHttp2Stream`]: #class-serverhttp2stream [`TypeError`]: errors.md#class-typeerror [`http2.SecureServer`]: #class-http2secureserver [`http2.Server`]: #class-http2server [`http2.createSecureServer()`]: #http2createsecureserveroptions-onrequesthandler [`http2.createServer()`]: #http2createserveroptions-onrequesthandler [`http2session.close()`]: #http2sessionclosecallback [`http2stream.pushStream()`]: #http2streampushstreamheaders-options-callback [`import()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import [`net.Server.close()`]: net.md#serverclosecallback [`net.Socket.bufferSize`]: net.md#socketbuffersize [`net.Socket.prototype.ref()`]: net.md#socketref [`net.Socket.prototype.unref()`]: net.md#socketunref [`net.Socket`]: net.md#class-netsocket [`net.connect()`]: net.md#netconnect [`net.createServer()`]: net.md#netcreateserveroptions-connectionlistener [`request.authority`]: #requestauthority [`request.maxHeadersCount`]: http.md#requestmaxheaderscount [`request.socket.getPeerCertificate()`]: tls.md#tlssocketgetpeercertificatedetailed [`request.socket`]: #requestsocket [`response.end()`]: #responseenddata-encoding-callback [`response.setHeader()`]: #responsesetheadername-value [`response.socket`]: #responsesocket [`response.writableEnded`]: #responsewritableended [`response.write()`]: #responsewritechunk-encoding-callback [`response.write(data, encoding)`]: http.md#responsewritechunk-encoding-callback [`response.writeContinue()`]: #responsewritecontinue [`response.writeHead()`]: #responsewriteheadstatuscode-statusmessage-headers [`server.close()`]: #serverclosecallback [`server.maxHeadersCount`]: http.md#servermaxheaderscount [`tls.Server.close()`]: tls.md#serverclosecallback [`tls.TLSSocket`]: tls.md#class-tlstlssocket [`tls.connect()`]: tls.md#tlsconnectoptions-callback [`tls.createServer()`]: tls.md#tlscreateserveroptions-secureconnectionlistener [`writable.writableFinished`]: stream.md#writablewritablefinished [error code]: #error-codes-for-rst\_stream-and-goaway | https://github.com/nodejs/node/blob/main//doc/api/http2.md | main | nodejs | [
-0.05925843492150307,
0.06142953038215637,
0.004521187394857407,
-0.019218267872929573,
-0.0546908862888813,
-0.10679490864276886,
-0.07272809743881226,
-0.05017707869410515,
0.027916813269257545,
-0.016539685428142548,
-0.01653333194553852,
-0.0723867267370224,
0.004265814553946257,
0.06937744468450546,
0.08773983269929886,
0.08244828879833221,
0.08765047788619995,
-0.0423039086163044,
0.02797786518931389,
0.032984696328639984,
0.02420264109969139,
0.04443100839853287,
0.04132874310016632,
0.043346960097551346,
-0.08601304888725281,
-0.042159922420978546,
-0.1015794575214386,
0.028260741382837296,
0.03931000828742981,
-0.012675711885094643,
0.08614592254161835,
-0.01134062185883522,
-0.2177552729845047,
-0.011305478401482105,
0.012898708693683147,
0.029341649264097214,
0.12491396069526672,
0.004063278902322054,
-0.0020837115589529276,
0.02506267838180065,
0.12788541615009308,
0.024933818727731705,
-0.03872232884168625,
-0.01911473274230957,
-0.029858648777008057,
-0.00041526718996465206,
0.02926725521683693,
0.0930335521697998,
-0.12527070939540863,
0.027165569365024567,
0.03243965283036232,
-0.04142709821462631,
-0.028959257528185844,
0.04424510896205902,
0.015642132610082626,
0.022028272971510887,
-0.14126156270503998,
0.13196025788784027,
0.00028185456176288426,
0.07463468611240387,
-0.017215145751833916,
-0.006530280690640211,
-0.0306401364505291,
0.0011674064444378018,
-0.056375984102487564,
-0.022506652399897575,
-0.004956279415637255,
-0.0710718035697937,
-0.021810704842209816,
0.01079455018043518,
-0.03954535722732544,
-0.0616600327193737,
-0.08830372989177704,
-0.03332855552434921,
0.05807686597108841,
-0.012660576961934566,
-0.02808988280594349,
-0.014191703870892525,
-0.05918575078248978,
-0.09960456192493439,
0.03089039772748947,
-0.06684949994087219,
-0.0320846363902092,
0.08628416806459427,
0.02589012309908867,
-0.07714010030031204,
-0.02266048826277256,
0.009517070837318897,
0.030282247811555862,
0.056369926780462265,
0.028778936713933945,
-0.03268449008464813,
0.029630210250616074,
0.008999199606478214,
0.10395234823226929,
0.07064104080200195,
0.013934548012912273,
0.036111511290073395,
-0.04602266848087311,
0.08471529930830002,
-0.017181959003210068,
-0.089912049472332,
-0.0029564707074314356,
-0.027446897700428963,
0.03809792548418045,
0.006037021521478891,
0.01933501474559307,
0.03468594327569008,
0.11551825702190399,
-0.025924084708094597,
-0.006793723441660404,
-0.0022927066311240196,
-0.02892792969942093,
-0.04997730627655983,
-0.008342097513377666,
0.05671351030468941,
-0.012277329340577126,
-0.032230399549007416,
0.0003467338683549315,
-0.06782617419958115,
-0.024547843262553215,
-0.10014255344867706,
0.020599346607923508,
-0.00828493945300579,
0.03894740715622902,
-0.03915620222687721,
0.04342513531446457,
2.3024606214227847e-33,
0.01675964705646038,
0.01875096559524536,
-0.027962859719991684,
0.07206802815198898,
0.031069355085492134,
0.006492588669061661,
0.035993438214063644,
-0.012183047831058502,
-0.0033829142339527607,
-0.0501362681388855,
0.0012919256696477532,
-0.024719273671507835,
-0.02743484452366829,
-0.06759662181138992,
0.06692326068878174,
0.018118346109986305,
0.050152070820331573,
-0.017846141010522842,
0.14196468889713287,
0.1262793391942978,
-0.03230249136686325,
0.037516042590141296,
-0.02524561993777752,
0.039046481251716614,
-0.02504945732653141,
0.03180290758609772,
0.009400843642652035,
-0.055768974125385284,
-0.009128112345933914,
-0.013464538380503654,
0.08103591203689575,
-0.03091231919825077,
-0.021533992141485214,
-0.04059522598981857,
0.03048287332057953,
0.00947507843375206,
0.03118307515978813,
0.000725631951354444,
-0.058593329042196274,
-0.09864862263202667,
-0.005881227552890778,
0.058084990829229355,
-0.03275913745164871,
0.05624965578317642,
-0.01104546245187521,
-0.10920886695384979,
-0.09024807810783386,
-0.030599886551499367,
0.03701528161764145,
-0.01800694316625595,
-0.008966006338596344,
-0.0005843493272550404,
0.06287571787834167,
-0.0560036301612854,
0.02706678956747055,
-0.02943134494125843,
-0.051609452813863754,
0.1166844591498375,
-0.0248285960406065,
-0.011399083770811558,
0.03408306464552879,
-0.07389611005783081,
-0.034169942140579224,
-0.062415916472673416,
0.01541287824511528,
0.04388097673654556,
-0.05027821287512779,
0.03678862378001213,
0.00223410758189857,
0.012187575921416283,
0.011082622222602367,
0.0586521290242672,
0.010792518965899944,
0.09969338029623032,
0.022479357197880745,
-0.02849479205906391,
0.035453911870718,
0.01307485532015562,
0.11676288396120071,
0.00995088741183281,
0.019644487649202347,
0.03409671038389206,
0.06685764342546463,
0.0362241305410862,
-0.0890173688530922,
-0.06954352557659149,
0.0059506855905056,
-0.01928793638944626,
0.04092308506369591,
0.025594236329197884,
-0.00018223033112008125,
0.010647278279066086,
0.010729867964982986,
0.02012658305466175,
0.02710726112127304,
-3.839832010171667e-33,
0.016851723194122314,
-0.04861678555607796,
-0.04228473827242851,
-0.00010762165766209364,
-0.03917374089360237,
-0.013760344125330448,
0.01819481886923313,
-0.0009693254833109677,
0.0034485321957618,
-0.0035837620962411165,
0.11944542825222015,
0.0155497957020998,
0.0521545484662056,
-0.0168469101190567,
0.008483098819851875,
-0.03197084367275238,
-0.09676433354616165,
-0.040800172835588455,
0.04627472534775734,
-0.04243401065468788,
-0.02943367324769497,
0.045742012560367584,
0.013903675600886345,
0.04179004579782486,
-0.018344255164265633,
0.0064622084610164165,
-0.030085602775216103,
0.030342597514390945,
-0.009949649684131145,
-0.03852849081158638,
-0.023048026487231255,
-0.019170375540852547,
-0.04823930561542511,
0.02992442436516285,
-0.03518686071038246,
0.008289975114166737,
-0.052708931267261505,
0.11335180699825287,
-0.03834736719727516,
-0.043451450765132904,
0.09194168448448181,
0.007693336810916662,
-0.012220954522490501,
0.07684612274169922,
0.020758260041475296,
0.028260597959160805,
-0.0039568208158016205,
0.030921172350645065,
-0.02462686039507389,
-0.022257445380091667,
0.022199157625436783,
0.03934831917285919,
0.02868381328880787,
0.02986890822649002,
0.031549159437417984,
0.07261420786380768,
0.018122192472219467,
0.034411605447530746,
-0.029460975900292397,
-0.008002354763448238,
0.025262773036956787,
-0.09050118923187256,
0.00261784833855927,
0.044374383985996246,
-0.025085099041461945,
-0.025127550587058067,
-0.08886095881462097,
-0.03601079806685448,
0.040482837706804276,
0.013257043436169624,
0.002208034973591566,
-0.0861004889011383,
-0.05047282576560974,
-0.020905937999486923,
0.09096076339483261,
-0.05500299856066704,
0.05087408795952797,
-0.047784674912691116,
0.0035193406511098146,
0.015357582829892635,
-0.08016838878393173,
0.04760618135333061,
-0.03283614665269852,
-0.02306285873055458,
0.06937213242053986,
0.00187111331615597,
0.0414281040430069,
0.0770898312330246,
-0.076062873005867,
-0.006669641938060522,
0.0524081252515316,
0.02001148834824562,
-0.1113339513540268,
-0.01396412868052721,
0.014662914909422398,
-5.523957824493664e-8,
-0.05237717181444168,
0.025996528565883636,
-0.012771171517670155,
-0.013933827169239521,
0.01770690269768238,
0.08530673384666443,
-0.06988723576068878,
-0.0655306801199913,
0.022378532215952873,
0.0035111058969050646,
-0.060279861092567444,
-0.020967768505215645,
-0.0026507654692977667,
-0.03307550027966499,
-0.0186033733189106,
0.007907041348516941,
0.004955383948981762,
-0.014463777653872967,
-0.025113556534051895,
-0.07275035232305527,
-0.09047257155179977,
-0.08597388118505478,
-0.008698243647813797,
-0.03737618774175644,
-0.05133333057165146,
0.018135743215680122,
-0.02047586627304554,
0.038737859576940536,
-0.008660729043185711,
0.03504156693816185,
-0.04612339287996292,
0.004913007840514183,
0.003659331938251853,
-0.09440666437149048,
-0.004936384502798319,
0.04408631846308708,
-0.098442442715168,
0.015311473049223423,
0.010101730935275555,
-0.07443065196275711,
0.04436447471380234,
0.03899882361292839,
0.050888050347566605,
0.0394078828394413,
0.08718178421258926,
0.017232874408364296,
0.12304799258708954,
0.06688495725393295,
0.06554679572582245,
-0.014802639372646809,
0.04030377045273781,
-0.07393641769886017,
0.027219172567129135,
-0.03991048410534859,
-0.06962953507900238,
-0.012321023270487785,
-0.0496310256421566,
-0.04438178241252899,
-0.01828734204173088,
-0.0380355566740036,
0.12305363267660141,
0.0012496249983087182,
0.053860072046518326,
0.0033620332833379507
] | -0.056716 |
# Inspector > Stability: 2 - Stable The `node:inspector` module provides an API for interacting with the V8 inspector. It can be accessed using: ```mjs import \* as inspector from 'node:inspector/promises'; ``` ```cjs const inspector = require('node:inspector/promises'); ``` or ```mjs import \* as inspector from 'node:inspector'; ``` ```cjs const inspector = require('node:inspector'); ``` ## Promises API > Stability: 1 - Experimental ### Class: `inspector.Session` \* Extends: {EventEmitter} The `inspector.Session` is used for dispatching messages to the V8 inspector back-end and receiving message responses and notifications. #### `new inspector.Session()` Create a new instance of the `inspector.Session` class. The inspector session needs to be connected through [`session.connect()`][] before the messages can be dispatched to the inspector backend. When using `Session`, the object outputted by the console API will not be released, unless we performed manually `Runtime.DiscardConsoleEntries` command. #### Event: `'inspectorNotification'` \* Type: {Object} The notification message object Emitted when any notification from the V8 Inspector is received. ```js session.on('inspectorNotification', (message) => console.log(message.method)); // Debugger.paused // Debugger.resumed ``` > \*\*Caveat\*\* Breakpoints with same-thread session is not recommended, see > [support of breakpoints][]. It is also possible to subscribe only to notifications with specific method: #### Event: `` \* Type: {Object} The notification message object Emitted when an inspector notification is received that has its method field set to the `` value. The following snippet installs a listener on the [`'Debugger.paused'`][] event, and prints the reason for program suspension whenever program execution is suspended (through breakpoints, for example): ```js session.on('Debugger.paused', ({ params }) => { console.log(params.hitBreakpoints); }); // [ '/the/file/that/has/the/breakpoint.js:11:0' ] ``` > \*\*Caveat\*\* Breakpoints with same-thread session is not recommended, see > [support of breakpoints][]. #### `session.connect()` Connects a session to the inspector back-end. #### `session.connectToMainThread()` Connects a session to the main thread inspector back-end. An exception will be thrown if this API was not called on a Worker thread. #### `session.disconnect()` Immediately close the session. All pending message callbacks will be called with an error. [`session.connect()`][] will need to be called to be able to send messages again. Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints. #### `session.post(method[, params])` \* `method` {string} \* `params` {Object} \* Returns: {Promise} Posts a message to the inspector back-end. ```mjs import { Session } from 'node:inspector/promises'; try { const session = new Session(); session.connect(); const result = await session.post('Runtime.evaluate', { expression: '2 + 2' }); console.log(result); } catch (error) { console.error(error); } // Output: { result: { type: 'number', value: 4, description: '4' } } ``` The latest version of the V8 inspector protocol is published on the [Chrome DevTools Protocol Viewer][]. Node.js inspector supports all the Chrome DevTools Protocol domains declared by V8. Chrome DevTools Protocol domain provides an interface for interacting with one of the runtime agents used to inspect the application state and listen to the run-time events. #### Example usage Apart from the debugger, various V8 Profilers are available through the DevTools protocol. ##### CPU profiler Here's an example showing how to use the [CPU Profiler][]: ```mjs import { Session } from 'node:inspector/promises'; import fs from 'node:fs'; const session = new Session(); session.connect(); await session.post('Profiler.enable'); await session.post('Profiler.start'); // Invoke business logic under measurement here... // some time later... const { profile } = await session.post('Profiler.stop'); // Write profile to disk, upload, etc. fs.writeFileSync('./profile.cpuprofile', JSON.stringify(profile)); ``` ##### Heap profiler Here's an example showing how to use the [Heap Profiler][]: ```mjs import { Session } from 'node:inspector/promises'; import fs from 'node:fs'; const session = new Session(); const fd = fs.openSync('profile.heapsnapshot', 'w'); session.connect(); session.on('HeapProfiler.addHeapSnapshotChunk', (m) => { fs.writeSync(fd, m.params.chunk); }); const result = await session.post('HeapProfiler.takeHeapSnapshot', null); console.log('HeapProfiler.takeHeapSnapshot done:', result); | https://github.com/nodejs/node/blob/main//doc/api/inspector.md | main | nodejs | [
-0.07545801252126694,
0.0744994580745697,
0.0031651011668145657,
0.0945446640253067,
0.03218141198158264,
-0.03473132848739624,
-0.0407848060131073,
0.07156937569379807,
0.016785917803645134,
-0.0027341824024915695,
-0.08014799654483795,
0.004744864068925381,
-0.011524456553161144,
-0.03597278892993927,
0.01718544214963913,
0.006972976494580507,
0.04142900928854942,
-0.03594573214650154,
-0.0170725230127573,
0.000981573248282075,
0.0159959364682436,
-0.013049822300672531,
0.013432595878839493,
-0.024124661460518837,
-0.07831808179616928,
-0.027237823233008385,
-0.045419659465551376,
-0.020565016195178032,
0.07546506077051163,
-0.022994209080934525,
-0.05770806595683098,
-0.02973066084086895,
-0.10078433156013489,
-0.007400394883006811,
-0.08231381326913834,
0.07509935647249222,
0.04398941621184349,
-0.0794476717710495,
0.003457761835306883,
-0.0632144883275032,
0.019607197493314743,
0.09261389076709747,
-0.11714977771043777,
-0.05911663919687271,
0.057153232395648956,
-0.09116634726524353,
-0.05802495777606964,
-0.014408682473003864,
-0.0768188014626503,
0.01858830638229847,
-0.029505832120776176,
0.025661304593086243,
0.0025495532900094986,
0.02183167263865471,
-0.015428702346980572,
0.07314443588256836,
-0.010968198999762535,
0.028682760894298553,
0.014391014352440834,
0.08097334206104279,
0.011137102730572224,
0.01051377970725298,
0.06024155020713806,
-0.018703442066907883,
0.023499516770243645,
-0.008576417341828346,
0.0034959225449711084,
0.04387728124856949,
0.03486260399222374,
-0.030532483011484146,
0.004053602460771799,
-0.03977678716182709,
-0.04800206795334816,
-0.0441284105181694,
-0.034047722816467285,
-0.05613554269075394,
-0.04908077046275139,
-0.02316543273627758,
-0.002162896329537034,
0.0035763413179665804,
-0.0049581341445446014,
-0.05505639314651489,
0.021738972514867783,
0.023896312341094017,
-0.01247960515320301,
0.07471998035907745,
0.006068516988307238,
0.0006217810441739857,
0.003711109748110175,
0.05327364429831505,
-0.012700307182967663,
-0.040672630071640015,
-0.022411230951547623,
0.07825853675603867,
0.007254643365740776,
-0.0008947132155299187,
0.04175616428256035,
0.07271096855401993,
-0.027196675539016724,
0.0749710351228714,
0.004358520265668631,
0.005903717130422592,
0.028125742450356483,
0.06790328025817871,
-0.0067249322310090065,
0.012120965868234634,
-0.06503675132989883,
-0.12646302580833435,
-0.05463556572794914,
-0.008958540856838226,
0.006492367945611477,
0.057030316442251205,
-0.0030929928179830313,
0.006078226957470179,
0.04117706045508385,
0.03748965635895729,
-0.01279044896364212,
0.017276694998145103,
0.05988660082221031,
0.14689362049102783,
0.13699737191200256,
0.02183995582163334,
0.0007299149292521179,
0.021444596350193024,
0.11052733659744263,
-0.011225908994674683,
0.08752606809139252,
-2.8007498872331565e-35,
0.025484485551714897,
-0.039193280041217804,
-0.04339274764060974,
0.0928175151348114,
0.06831975281238556,
0.05373908951878548,
0.05684366449713707,
0.06977039575576782,
-0.09495685249567032,
0.01185115147382021,
-0.057610154151916504,
0.08667244762182236,
-0.007805975154042244,
-0.05924766883254051,
0.014536124654114246,
0.04617555812001228,
-0.00238734669983387,
0.02511477842926979,
0.026114072650671005,
0.04451647028326988,
0.008530153892934322,
-0.10759442299604416,
0.0038651907816529274,
0.03939485922455788,
0.09515142440795898,
0.048112720251083374,
0.013804825954139233,
0.056846946477890015,
-0.024983713403344154,
0.01932845264673233,
0.023696476593613625,
0.09025679528713226,
0.045501235872507095,
0.01661570928990841,
-0.007048789877444506,
-0.07801394164562225,
-0.08664428442716599,
-0.007908512838184834,
-0.08982470631599426,
-0.04049425572156906,
-0.013040746562182903,
0.03115592710673809,
-0.059314340353012085,
-0.06355995684862137,
-0.0734376534819603,
-0.1055736243724823,
-0.05650433897972107,
-0.007154231891036034,
0.0661439299583435,
-0.05395150184631348,
-0.05539044365286827,
0.0598323754966259,
0.011075145564973354,
0.04066643491387367,
0.028995122760534286,
0.03314914181828499,
0.06667892634868622,
0.004437601659446955,
-0.04517204686999321,
0.005431097466498613,
0.004246076103299856,
0.003815750125795603,
-0.04701794683933258,
0.03231934458017349,
-0.00864728819578886,
0.049369972199201584,
-0.0987238883972168,
0.05811093747615814,
0.025966409593820572,
-0.0164157934486866,
-0.030577074736356735,
0.02068200521171093,
-0.014835591427981853,
-0.02667522244155407,
0.036117639392614365,
0.00006810428749304265,
-0.12410405278205872,
0.0359160490334034,
-0.012038267217576504,
-0.055752404034137726,
0.04814813286066055,
-0.038062933832407,
-0.029308367520570755,
0.08037139475345612,
0.06821755319833755,
-0.02473788522183895,
-0.05383476987481117,
0.021133728325366974,
0.04481319338083267,
0.06290373206138611,
-0.013825730420649052,
-0.042922381311655045,
0.03065064363181591,
-0.0062030283734202385,
-0.10647347569465637,
-3.2388766863610966e-33,
-0.0005428988952189684,
0.006452011875808239,
-0.10393333435058594,
0.08370045572519302,
-0.07146023213863373,
0.01335715502500534,
-0.005209287162870169,
-0.019102226942777634,
-0.02586304396390915,
0.010344876907765865,
-0.027125542983412743,
0.0698673278093338,
0.029466845095157623,
0.06768128275871277,
0.013354386202991009,
0.0667070522904396,
-0.09168156236410141,
-0.06499382108449936,
-0.002199008595198393,
-0.046069931238889694,
0.03507881611585617,
-0.056566234678030014,
0.03605129197239876,
-0.01952507719397545,
-0.07605577260255814,
-0.035021502524614334,
0.026631096377968788,
-0.031763412058353424,
0.017659777775406837,
-0.03451378270983696,
-0.04051141068339348,
0.002076533157378435,
-0.06484328955411911,
0.03502248600125313,
0.043464627116918564,
-0.06317000091075897,
0.04870860278606415,
-0.012931056320667267,
-0.013730070553719997,
-0.03227435424923897,
0.09247325360774994,
0.06150725856423378,
-0.028699427843093872,
0.026913104578852654,
0.00277247978374362,
-0.004442708566784859,
-0.0323905386030674,
0.006020775996148586,
-0.003983865026384592,
-0.019391285255551338,
-0.05175461247563362,
-0.07015462964773178,
-0.001557856216095388,
-0.008556926622986794,
-0.0993049144744873,
-0.04109353572130203,
0.007064761593937874,
-0.014337586238980293,
-0.03679626062512398,
0.1114395335316658,
0.0057335710152983665,
-0.06863272935152054,
-0.036451976746320724,
0.01667970046401024,
-0.02972598560154438,
-0.052290502935647964,
-0.08154359459877014,
0.028894595801830292,
0.14977236092090607,
-0.007614043075591326,
0.04358759894967079,
-0.022377390414476395,
0.03932444006204605,
-0.039039675146341324,
-0.0004633295175153762,
0.03955856338143349,
0.009954183362424374,
-0.220828577876091,
0.04577231779694557,
0.009769256226718426,
-0.06608844548463821,
0.03697172924876213,
0.026581307873129845,
-0.0006973561248742044,
-0.003006007056683302,
-0.02006278559565544,
0.014472801238298416,
0.10770472884178162,
0.026543384417891502,
0.030550608411431313,
-0.013486526906490326,
0.09085572510957718,
-0.09080839157104492,
-0.0875735953450203,
0.035435985773801804,
-4.742940973301302e-8,
-0.02354615181684494,
-0.00195029703900218,
-0.04144642502069473,
0.05208363011479378,
0.0137921879068017,
-0.07137487828731537,
-0.03670749440789223,
0.03557465225458145,
-0.005051421467214823,
0.01998874358832836,
-0.011512436904013157,
-0.05250108242034912,
0.012073485180735588,
-0.05131874606013298,
0.008891680277884007,
-0.004236496053636074,
-0.0029832629952579737,
0.015484676696360111,
-0.0450935885310173,
-0.06792353093624115,
-0.0021989813540130854,
0.01556505635380745,
0.06554453819990158,
0.06300222873687744,
-0.02725098468363285,
-0.1032390296459198,
0.04500286281108856,
0.04872903972864151,
-0.054349448531866074,
0.02461988292634487,
-0.09229687601327896,
0.07115354388952255,
0.0471983402967453,
0.025609003379940987,
-0.03412924334406853,
0.0008491537300869823,
0.020682010799646378,
-0.02460923232138157,
0.09422384202480316,
-0.05677067115902901,
0.06995783001184464,
-0.0396408885717392,
-0.05684538185596466,
-0.017279652878642082,
0.03852031007409096,
0.007914944551885128,
-0.020795714110136032,
-0.013825958594679832,
0.09446446597576141,
0.012454194948077202,
-0.026335833594202995,
-0.029914921149611473,
-0.09808341413736343,
0.033623017370700836,
0.039208944886922836,
-0.010051392018795013,
0.01126124244183302,
-0.07666972279548645,
0.031062008813023567,
-0.06658703088760376,
0.02765478938817978,
-0.019652850925922394,
0.0520365908741951,
-0.10117917507886887
] | 0.120868 |
Heap profiler Here's an example showing how to use the [Heap Profiler][]: ```mjs import { Session } from 'node:inspector/promises'; import fs from 'node:fs'; const session = new Session(); const fd = fs.openSync('profile.heapsnapshot', 'w'); session.connect(); session.on('HeapProfiler.addHeapSnapshotChunk', (m) => { fs.writeSync(fd, m.params.chunk); }); const result = await session.post('HeapProfiler.takeHeapSnapshot', null); console.log('HeapProfiler.takeHeapSnapshot done:', result); session.disconnect(); fs.closeSync(fd); ``` ## Callback API ### Class: `inspector.Session` \* Extends: {EventEmitter} The `inspector.Session` is used for dispatching messages to the V8 inspector back-end and receiving message responses and notifications. #### `new inspector.Session()` Create a new instance of the `inspector.Session` class. The inspector session needs to be connected through [`session.connect()`][] before the messages can be dispatched to the inspector backend. When using `Session`, the object outputted by the console API will not be released, unless we performed manually `Runtime.DiscardConsoleEntries` command. #### Event: `'inspectorNotification'` \* Type: {Object} The notification message object Emitted when any notification from the V8 Inspector is received. ```js session.on('inspectorNotification', (message) => console.log(message.method)); // Debugger.paused // Debugger.resumed ``` > \*\*Caveat\*\* Breakpoints with same-thread session is not recommended, see > [support of breakpoints][]. It is also possible to subscribe only to notifications with specific method: #### Event: ``; \* Type: {Object} The notification message object Emitted when an inspector notification is received that has its method field set to the `` value. The following snippet installs a listener on the [`'Debugger.paused'`][] event, and prints the reason for program suspension whenever program execution is suspended (through breakpoints, for example): ```js session.on('Debugger.paused', ({ params }) => { console.log(params.hitBreakpoints); }); // [ '/the/file/that/has/the/breakpoint.js:11:0' ] ``` > \*\*Caveat\*\* Breakpoints with same-thread session is not recommended, see > [support of breakpoints][]. #### `session.connect()` Connects a session to the inspector back-end. #### `session.connectToMainThread()` Connects a session to the main thread inspector back-end. An exception will be thrown if this API was not called on a Worker thread. #### `session.disconnect()` Immediately close the session. All pending message callbacks will be called with an error. [`session.connect()`][] will need to be called to be able to send messages again. Reconnected session will lose all inspector state, such as enabled agents or configured breakpoints. #### `session.post(method[, params][, callback])` \* `method` {string} \* `params` {Object} \* `callback` {Function} Posts a message to the inspector back-end. `callback` will be notified when a response is received. `callback` is a function that accepts two optional arguments: error and message-specific result. ```js session.post('Runtime.evaluate', { expression: '2 + 2' }, (error, { result }) => console.log(result)); // Output: { type: 'number', value: 4, description: '4' } ``` The latest version of the V8 inspector protocol is published on the [Chrome DevTools Protocol Viewer][]. Node.js inspector supports all the Chrome DevTools Protocol domains declared by V8. Chrome DevTools Protocol domain provides an interface for interacting with one of the runtime agents used to inspect the application state and listen to the run-time events. You can not set `reportProgress` to `true` when sending a `HeapProfiler.takeHeapSnapshot` or `HeapProfiler.stopTrackingHeapObjects` command to V8. #### Example usage Apart from the debugger, various V8 Profilers are available through the DevTools protocol. ##### CPU profiler Here's an example showing how to use the [CPU Profiler][]: ```js const inspector = require('node:inspector'); const fs = require('node:fs'); const session = new inspector.Session(); session.connect(); session.post('Profiler.enable', () => { session.post('Profiler.start', () => { // Invoke business logic under measurement here... // some time later... session.post('Profiler.stop', (err, { profile }) => { // Write profile to disk, upload, etc. if (!err) { fs.writeFileSync('./profile.cpuprofile', JSON.stringify(profile)); } }); }); }); ``` ##### Heap profiler Here's an example showing how to use the [Heap Profiler][]: ```js const inspector = require('node:inspector'); const fs = require('node:fs'); const session = new inspector.Session(); const fd = | https://github.com/nodejs/node/blob/main//doc/api/inspector.md | main | nodejs | [
-0.03694363310933113,
0.10639353841543198,
-0.09413424879312515,
0.06534653902053833,
0.01802961342036724,
-0.062234167009592056,
-0.004650276154279709,
0.1296946406364441,
0.0034400303848087788,
-0.010336137376725674,
-0.0618625171482563,
-0.028212035074830055,
-0.003130135126411915,
0.012159989215433598,
-0.012784191407263279,
-0.04651147127151489,
-0.01577060855925083,
0.014961902983486652,
0.03135296329855919,
-0.04225931316614151,
-0.002375646959990263,
-0.004865655209869146,
0.044032249599695206,
-0.03387422487139702,
-0.0016293328953906894,
-0.012952371500432491,
-0.07330521941184998,
-0.019030870869755745,
0.03207753971219063,
-0.011754137463867664,
0.05934597924351692,
0.01243201456964016,
-0.07896542549133301,
-0.06682191789150238,
0.010046634823083878,
0.1538839340209961,
-0.06448928266763687,
-0.07604730874300003,
-0.02177601121366024,
-0.047700751572847366,
0.05696072801947594,
0.07396542280912399,
-0.0827489122748375,
0.044706616550683975,
-0.010603050701320171,
-0.026515396311879158,
-0.06391390413045883,
0.04388800263404846,
-0.027467582374811172,
-0.017563844099640846,
0.01747080869972706,
0.025616219267249107,
-0.01382311899214983,
0.05185728520154953,
-0.03647990524768829,
0.08909507095813751,
0.043846964836120605,
-0.009750756435096264,
-0.08194214105606079,
0.06223139539361,
-0.0708102211356163,
-0.04087207466363907,
0.02040555328130722,
-0.06215447932481766,
0.10074717551469803,
0.043824441730976105,
0.05422564968466759,
0.04600891098380089,
0.02725369855761528,
-0.02173990197479725,
0.011555287055671215,
0.06575896590948105,
-0.03728070110082626,
-0.014471686445176601,
-0.0349992960691452,
-0.06666561961174011,
-0.03654615208506584,
0.019336488097906113,
-0.06419723480939865,
-0.013488417491316795,
-0.016994861885905266,
-0.0959620475769043,
0.017572930082678795,
-0.05275923013687134,
-0.02275925874710083,
0.04978395625948906,
0.004324748180806637,
0.016267329454421997,
0.034038662910461426,
0.042347948998212814,
-0.06615668535232544,
0.004118886310607195,
-0.14136233925819397,
0.037063710391521454,
-0.004029297735542059,
0.029391391202807426,
-0.018103396520018578,
0.09742521494626999,
-0.0027311004232615232,
0.03415510803461075,
0.012420869432389736,
0.034566730260849,
0.014159741811454296,
0.05516351759433746,
0.03603445738554001,
-0.026509840041399002,
-0.06799348443746567,
-0.030208220705389977,
-0.09975600987672806,
-0.025395909324288368,
0.011302848346531391,
0.07650411874055862,
0.04389366880059242,
0.039393868297338486,
0.07347317039966583,
-0.013476245105266571,
0.01288788765668869,
-0.04611049219965935,
-0.01836075820028782,
0.0547565221786499,
0.17322438955307007,
0.029792707413434982,
-0.041817039251327515,
-0.027910562232136726,
0.02139950357377529,
-0.019143572077155113,
0.04114357382059097,
3.043834255568847e-33,
0.029877351596951485,
-0.0490410141646862,
0.039957817643880844,
0.04581712558865547,
0.035823479294776917,
0.042521439492702484,
0.02179715968668461,
0.043071262538433075,
-0.009885318577289581,
-0.008202572353184223,
-0.10107262432575226,
-0.011399996466934681,
-0.01074922364205122,
-0.04282153397798538,
0.0012334901839494705,
-0.04962913319468498,
-0.015039511024951935,
0.03587305173277855,
0.007485974580049515,
0.014526274055242538,
-0.010867970995604992,
0.001071713399142027,
-0.03838309645652771,
-0.0011431280290707946,
0.03232600539922714,
0.05289726331830025,
0.055965643376111984,
0.010438989847898483,
-0.012198176234960556,
-0.0047873747535049915,
0.038073405623435974,
0.04153246060013771,
-0.07449971139431,
0.013254991732537746,
0.11821193993091583,
-0.06071505695581436,
-0.10406988859176636,
0.011509416624903679,
-0.10250768810510635,
-0.08301042765378952,
-0.00005915952715440653,
0.053188078105449677,
-0.0823233351111412,
-0.02030007913708687,
-0.16913707554340363,
-0.0822494849562645,
-0.044994987547397614,
-0.029197698459029198,
0.06267794966697693,
-0.012341635301709175,
0.03675193712115288,
-0.004056419711560011,
0.002972762566059828,
0.04332171753048897,
0.02690458670258522,
0.026475559920072556,
0.07487376034259796,
-0.0738995298743248,
-0.044695332646369934,
0.09566588699817657,
0.06323183327913284,
0.004333863500505686,
-0.06381649523973465,
-0.022993670776486397,
-0.06236571446061134,
0.02936379984021187,
-0.039022497832775116,
0.07369890064001083,
0.017423588782548904,
0.003008193802088499,
0.019386691972613335,
0.039958029985427856,
0.021090107038617134,
0.04134228825569153,
0.01347664836794138,
0.04409094154834747,
-0.021946584805846214,
0.033079300075769424,
-0.09256526827812195,
-0.05775657296180725,
0.0686657503247261,
-0.046044643968343735,
-0.08511576056480408,
-0.012952284887433052,
0.01203435193747282,
-0.01669188030064106,
-0.03755848854780197,
-0.03108903393149376,
0.07434982061386108,
0.03171969950199127,
-0.04130003973841667,
-0.0521760955452919,
0.00883252639323473,
-0.04157818853855133,
-0.13342070579528809,
-4.6264394016213406e-33,
-0.02226729318499565,
-0.02112841047346592,
-0.04546942189335823,
0.05545582249760628,
0.016293464228510857,
0.045194488018751144,
0.05142483487725258,
0.03824704885482788,
0.0020677330903708935,
0.03388158977031708,
-0.11382978409528732,
0.06660472601652145,
0.018964294344186783,
-0.00481225922703743,
0.006523560266941786,
0.04586784169077873,
-0.05368565768003464,
-0.06288356333971024,
-0.02093145251274109,
-0.03195036202669144,
0.004254742059856653,
-0.02048971876502037,
0.04083556309342384,
0.00504806125536561,
-0.04996015504002571,
-0.028929453343153,
-0.00045345022226683795,
-0.021626459434628487,
0.01707720011472702,
-0.08663802593946457,
-0.004282989539206028,
-0.05637418478727341,
-0.05565468221902847,
-0.01923953928053379,
0.06572730094194412,
-0.05046861991286278,
0.11162656545639038,
0.06290402263402939,
-0.049343209713697433,
0.0006974103162065148,
0.10103952139616013,
0.012298199348151684,
-0.05217176675796509,
0.02118910849094391,
0.006465027574449778,
0.023810947313904762,
-0.09807229787111282,
-0.031214674934744835,
0.04152913764119148,
0.02136007510125637,
-0.008300636895000935,
-0.04123071953654289,
-0.014588133431971073,
0.02826089784502983,
-0.00908447615802288,
-0.07349167764186859,
0.024180008098483086,
-0.08206486701965332,
0.07810534536838531,
0.027251075953245163,
0.06455118209123611,
-0.10891874879598618,
-0.034771762788295746,
-0.047717880457639694,
-0.017867732793092728,
-0.08047682046890259,
-0.036536235362291336,
-0.04390086233615875,
-0.05023448169231415,
0.1382962316274643,
-0.04037027060985565,
0.0016723802546039224,
0.06236239895224571,
0.0063951765187084675,
0.022285200655460358,
-0.01846073567867279,
-0.02964341826736927,
-0.11032310873270035,
0.06380172818899155,
-0.009310848079621792,
-0.04035203903913498,
0.02917800471186638,
0.012693251483142376,
0.00939500518143177,
0.008729351684451103,
-0.021049626171588898,
0.020081931725144386,
0.03480703383684158,
0.0036202233750373125,
-0.06379395723342896,
0.029078662395477295,
0.04483053833246231,
-0.09152894467115402,
0.030402733013033867,
0.01887347176671028,
-5.0988322897183025e-8,
-0.04603042080998421,
-0.06169945001602173,
-0.020514018833637238,
0.07355105876922607,
0.025867493823170662,
-0.056449104100465775,
0.004735980648547411,
0.09806320071220398,
0.05435459315776825,
0.007747221738100052,
0.04587436467409134,
-0.011919405311346054,
0.030062586069107056,
-0.04736597090959549,
0.011453096754848957,
-0.04705725610256195,
0.028569325804710388,
0.007586613763123751,
-0.02173474058508873,
-0.05271416902542114,
0.0051531074568629265,
0.023337461054325104,
0.018273206427693367,
0.06015686318278313,
0.03808284178376198,
-0.05471496284008026,
0.09104277193546295,
0.08974989503622055,
0.006835772655904293,
-0.09392266720533371,
-0.054424721747636795,
0.08762284368276596,
0.050881143659353256,
-0.053196605294942856,
-0.04278154671192169,
0.05896170437335968,
-0.008599814958870411,
0.046551093459129333,
0.06708723306655884,
0.08596441149711609,
-0.023825474083423615,
0.032073281705379486,
0.016773641109466553,
0.04267456382513046,
0.03536982089281082,
0.018256263807415962,
-0.07471262663602829,
0.09113992005586624,
0.006773304659873247,
-0.012514525093138218,
-0.022087307646870613,
-0.02043243497610092,
-0.02714940346777439,
0.08438408374786377,
-0.03122781589627266,
-0.00721507566049695,
-0.01289275474846363,
-0.08927644789218903,
0.05683246627449989,
0.014715373516082764,
0.03814398869872093,
-0.02357771247625351,
0.02708037942647934,
0.024767456576228142
] | 0.110373 |
}) => { // Write profile to disk, upload, etc. if (!err) { fs.writeFileSync('./profile.cpuprofile', JSON.stringify(profile)); } }); }); }); ``` ##### Heap profiler Here's an example showing how to use the [Heap Profiler][]: ```js const inspector = require('node:inspector'); const fs = require('node:fs'); const session = new inspector.Session(); const fd = fs.openSync('profile.heapsnapshot', 'w'); session.connect(); session.on('HeapProfiler.addHeapSnapshotChunk', (m) => { fs.writeSync(fd, m.params.chunk); }); session.post('HeapProfiler.takeHeapSnapshot', null, (err, r) => { console.log('HeapProfiler.takeHeapSnapshot done:', err, r); session.disconnect(); fs.closeSync(fd); }); ``` ## Common Objects ### `inspector.close()` Attempts to close all remaining connections, blocking the event loop until all are closed. Once all connections are closed, deactivates the inspector. ### `inspector.console` \* Type: {Object} An object to send messages to the remote inspector console. ```js require('node:inspector').console.log('a message'); ``` The inspector console does not have API parity with Node.js console. ### `inspector.open([port[, host[, wait]]])` \* `port` {number} Port to listen on for inspector connections. Optional. \*\*Default:\*\* what was specified on the CLI. \* `host` {string} Host to listen on for inspector connections. Optional. \*\*Default:\*\* what was specified on the CLI. \* `wait` {boolean} Block until a client has connected. Optional. \*\*Default:\*\* `false`. \* Returns: {Disposable} A Disposable that calls [`inspector.close()`][]. Activate inspector on host and port. Equivalent to `node --inspect=[[host:]port]`, but can be done programmatically after node has started. If wait is `true`, will block until a client has connected to the inspect port and flow control has been passed to the debugger client. See the [security warning][] regarding the `host` parameter usage. ### `inspector.url()` \* Returns: {string|undefined} Return the URL of the active inspector, or `undefined` if there is none. ```console $ node --inspect -p 'inspector.url()' Debugger listening on ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34 For help, see: https://nodejs.org/en/docs/inspector ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34 $ node --inspect=localhost:3000 -p 'inspector.url()' Debugger listening on ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a For help, see: https://nodejs.org/en/docs/inspector ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a $ node -p 'inspector.url()' undefined ``` ### `inspector.waitForDebugger()` Blocks until a client (existing or connected later) has sent `Runtime.runIfWaitingForDebugger` command. An exception will be thrown if there is no active inspector. ## Integration with DevTools > Stability: 1.1 - Active development The `node:inspector` module provides an API for integrating with devtools that support Chrome DevTools Protocol. DevTools frontends connected to a running Node.js instance can capture protocol events emitted from the instance and display them accordingly to facilitate debugging. The following methods broadcast a protocol event to all connected frontends. The `params` passed to the methods can be optional, depending on the protocol. ```js // The `Network.requestWillBeSent` event will be fired. inspector.Network.requestWillBeSent({ requestId: 'request-id-1', timestamp: Date.now() / 1000, wallTime: Date.now(), request: { url: 'https://nodejs.org/en', method: 'GET', }, }); ``` ### `inspector.Network.dataReceived([params])` \* `params` {Object} This feature is only available with the `--experimental-network-inspection` flag enabled. Broadcasts the `Network.dataReceived` event to connected frontends, or buffers the data if `Network.streamResourceContent` command was not invoked for the given request yet. Also enables `Network.getResponseBody` command to retrieve the response data. ### `inspector.Network.dataSent([params])` \* `params` {Object} This feature is only available with the `--experimental-network-inspection` flag enabled. Enables `Network.getRequestPostData` command to retrieve the request data. ### `inspector.Network.requestWillBeSent([params])` \* `params` {Object} This feature is only available with the `--experimental-network-inspection` flag enabled. Broadcasts the `Network.requestWillBeSent` event to connected frontends. This event indicates that the application is about to send an HTTP request. ### `inspector.Network.responseReceived([params])` \* `params` {Object} This feature is only available with the `--experimental-network-inspection` flag enabled. Broadcasts the `Network.responseReceived` event to connected frontends. This event indicates that HTTP response is available. ### `inspector.Network.loadingFinished([params])` \* `params` {Object} This feature is only available with the `--experimental-network-inspection` flag enabled. Broadcasts the `Network.loadingFinished` event to connected frontends. This event indicates that HTTP request has finished loading. ### `inspector.Network.loadingFailed([params])` \* `params` {Object} This feature is only available with the `--experimental-network-inspection` flag enabled. | https://github.com/nodejs/node/blob/main//doc/api/inspector.md | main | nodejs | [
-0.024382082745432854,
0.08362389355897903,
-0.12502779066562653,
0.053336579352617264,
0.03474847599864006,
-0.0748770534992218,
-0.00866182241588831,
0.16626174747943878,
-0.026390504091978073,
-0.006568955723196268,
-0.035240817815065384,
-0.02061671018600464,
0.013798737898468971,
-0.0250003132969141,
-0.013383782468736172,
-0.06725654751062393,
-0.06445400416851044,
0.006551201455295086,
0.017504094168543816,
-0.0581933967769146,
0.003467380767688155,
-0.03555697947740555,
0.05693129450082779,
-0.047847285866737366,
0.0013792074751108885,
-0.03438610956072807,
-0.058403003960847855,
0.004992764443159103,
-0.019419709220528603,
-0.0027631495613604784,
0.07169843465089798,
-0.026047687977552414,
-0.054835982620716095,
-0.06073955446481705,
0.03756573423743248,
0.13879506289958954,
-0.033032532781362534,
-0.13119985163211823,
-0.03234144672751427,
-0.07495987415313721,
0.07171206176280975,
0.0836610496044159,
-0.09878828376531601,
0.046288587152957916,
-0.009607262909412384,
-0.048719413578510284,
-0.02922390028834343,
0.022305672988295555,
-0.021112162619829178,
-0.0008538868278264999,
-0.01971089281141758,
0.009626959450542927,
0.003967841621488333,
-0.003600314725190401,
-0.04906980320811272,
0.09090085327625275,
0.06607126444578171,
-0.01906486228108406,
-0.05480242148041725,
0.06278393417596817,
-0.033527158200740814,
-0.05557023361325264,
0.012884017080068588,
-0.05212247744202614,
0.08071178197860718,
0.021770929917693138,
0.012223930098116398,
0.05028223618865013,
-0.023796606808900833,
0.03680600970983505,
0.03774739056825638,
0.07887342572212219,
-0.07922790944576263,
-0.004169548396021128,
-0.019696954637765884,
-0.06275961548089981,
-0.025135787203907967,
0.03758101910352707,
-0.05089302361011505,
-0.030410775914788246,
-0.019944708794355392,
-0.10108253359794617,
-0.010437799617648125,
-0.0442044623196125,
-0.029458455741405487,
0.06125609949231148,
0.021172279492020607,
0.015683405101299286,
0.006662654224783182,
0.023930208757519722,
-0.04299768805503845,
0.041090160608291626,
-0.09202531725168228,
-0.018559081479907036,
-0.00013034598669037223,
0.054723527282476425,
-0.02236497402191162,
0.07374432682991028,
-0.016092773526906967,
0.04851791635155678,
-0.04176223278045654,
-0.009379815310239792,
0.055438004434108734,
0.10055876523256302,
0.025190021842718124,
-0.010640887543559074,
-0.026988280937075615,
0.027686407789587975,
-0.1138361394405365,
-0.01915927603840828,
0.0359886959195137,
0.08668202906847,
0.023121677339076996,
0.04823625087738037,
0.04902554303407669,
-0.012382791377604008,
0.04453422129154205,
-0.02882096916437149,
-0.04113975167274475,
0.08070332556962967,
0.19712510704994202,
-0.015547279268503189,
-0.05754723399877548,
0.012973143719136715,
0.007851403206586838,
-0.05600607022643089,
0.04880376532673836,
2.9273317451428194e-33,
0.0713014304637909,
-0.04045918583869934,
0.06824818253517151,
0.04541470482945442,
0.01326027512550354,
-0.022684242576360703,
0.028142813593149185,
0.027739083394408226,
-0.020965417847037315,
-0.0007436074665747583,
-0.07123252004384995,
-0.01043556910008192,
0.013648264110088348,
0.00598997762426734,
-0.04286744445562363,
-0.08686361461877823,
0.022169580683112144,
0.0411352775990963,
0.042143046855926514,
-0.025554107502102852,
0.05020689591765404,
-0.02795400097966194,
-0.08003755658864975,
0.008673926815390587,
0.02050022780895233,
0.012448332272469997,
0.017449991777539253,
-0.004036345984786749,
-0.02001809887588024,
-0.013493380509316921,
0.10243965685367584,
0.006941544823348522,
-0.047134071588516235,
0.04602421075105667,
0.07114250957965851,
-0.05375334247946739,
-0.08172252774238586,
0.03164201229810715,
-0.08881773799657822,
-0.07229110598564148,
0.0652623251080513,
0.022899091243743896,
-0.05766476318240166,
-0.004458359442651272,
-0.15956611931324005,
-0.021857542917132378,
-0.039594076573848724,
-0.03386375308036804,
0.05103617161512375,
-0.004014846868813038,
0.026467038318514824,
0.0166530329734087,
0.008421726524829865,
0.03572562709450722,
0.0696016326546669,
0.049506399780511856,
0.03692762553691864,
-0.08614230901002884,
-0.021631376817822456,
0.06689231842756271,
0.06440052390098572,
0.02915903553366661,
-0.05346257612109184,
-0.03020414710044861,
-0.03967081382870674,
-0.0030061991419643164,
-0.0220357533544302,
0.05564563348889351,
0.03068953938782215,
0.0248152744024992,
-0.02638038992881775,
0.05074518918991089,
0.0313786081969738,
0.028703762218356133,
0.00014238937001209706,
0.045424189418554306,
-0.05736905708909035,
-0.014003782533109188,
-0.1449207216501236,
-0.05290985107421875,
0.025558168068528175,
-0.03554302453994751,
-0.09297080338001251,
-0.00951660331338644,
0.036159638315439224,
-0.03538563475012779,
-0.0677165687084198,
0.03487638011574745,
0.055440470576286316,
0.027569761499762535,
0.026481689885258675,
-0.03377208858728409,
0.03305063396692276,
-0.07941427081823349,
-0.12572264671325684,
-4.295417621035892e-33,
-0.05053658038377762,
-0.04795301333069801,
-0.0001264981838176027,
0.02180127613246441,
0.055749401450157166,
0.017990438267588615,
0.03273891285061836,
0.02915543131530285,
0.01347815990447998,
0.05441655218601227,
-0.12896443903446198,
0.022426607087254524,
-0.03123709186911583,
-0.058310508728027344,
-0.002565173665061593,
0.049168385565280914,
-0.1020861268043518,
-0.05871271342039108,
0.024259692057967186,
-0.02343849651515484,
-0.022833257913589478,
0.020585227757692337,
0.10282809287309647,
0.02697516418993473,
-0.01059596985578537,
-0.038548845797777176,
-0.04271279647946358,
0.017900517210364342,
-0.04165990278124809,
-0.0529259629547596,
-0.03194660320878029,
-0.019588978961110115,
-0.06151498109102249,
-0.0064834426157176495,
0.07258999347686768,
-0.07088209688663483,
0.06899403035640717,
0.0694606602191925,
-0.02520650252699852,
0.03591521829366684,
0.08761972188949585,
0.015021104365587234,
-0.02288975939154625,
-0.0073312618769705296,
0.04464771971106529,
0.01998359151184559,
-0.045823730528354645,
-0.016595447435975075,
0.017527485266327858,
0.0016796751879155636,
0.004017011262476444,
-0.01397357601672411,
0.004765179939568043,
0.028364067897200584,
0.05231497809290886,
-0.034439098089933395,
0.0505547970533371,
-0.0747758150100708,
0.035445112735033035,
0.02939215861260891,
0.039336733520030975,
-0.16058361530303955,
0.0053246235474944115,
-0.036728180944919586,
-0.018996212631464005,
-0.13151484727859497,
0.006338316015899181,
-0.007298613432794809,
-0.04441253840923309,
0.10089480131864548,
-0.067601278424263,
0.030805638059973717,
0.06831429153680801,
0.022228244692087173,
0.02310210093855858,
-0.040946267545223236,
-0.012452756986021996,
-0.07339619100093842,
0.03428475186228752,
0.04226243495941162,
-0.032224301248788834,
0.07787454128265381,
-0.0441945344209671,
0.00048511926434002817,
0.037974145263433456,
-0.007231574505567551,
0.008065951056778431,
0.02877975068986416,
-0.0045647574588656425,
-0.05575408414006233,
0.004433005582541227,
0.04783998057246208,
-0.039797037839889526,
0.000502725422848016,
-0.008909464813768864,
-4.673144715638955e-8,
-0.03443426266312599,
-0.04220719635486603,
-0.053123198449611664,
0.08988648653030396,
0.021858418360352516,
-0.0340314544737339,
0.014886857941746712,
0.005257162265479565,
0.09112599492073059,
-0.01781608536839485,
0.04816581308841705,
0.010336046107113361,
0.027177998796105385,
-0.04506097733974457,
-0.019181543961167336,
-0.0783618614077568,
0.04273845627903938,
0.0463438481092453,
-0.013419287279248238,
-0.03175140544772148,
0.017608096823096275,
0.0286322683095932,
-0.01722957193851471,
0.05753025785088539,
0.05947776138782501,
-0.05724990367889404,
0.08568322658538818,
-0.00017386201943736523,
-0.016835717484354973,
-0.03740712255239487,
-0.063320592045784,
0.053506284952163696,
0.04257674515247345,
-0.05903142690658569,
-0.029828742146492004,
0.004444601479917765,
0.021472331136465073,
0.058056797832250595,
0.028017254546284676,
0.11095857620239258,
0.049506597220897675,
0.0883486419916153,
0.007259714882820845,
0.02614845149219036,
0.032227810472249985,
-0.012851119041442871,
-0.052319593727588654,
0.10313110053539276,
0.024149298667907715,
-0.0009726194548420608,
-0.03513038903474808,
-0.04503748193383217,
-0.00014289881801232696,
0.043838489800691605,
-0.03635492920875549,
-0.02624552883207798,
-0.010092689655721188,
-0.021748730912804604,
0.032031625509262085,
0.02640482597053051,
0.07033530622720718,
-0.009512873366475105,
0.04689331725239754,
0.009066613391041756
] | 0.086405 |
HTTP response is available. ### `inspector.Network.loadingFinished([params])` \* `params` {Object} This feature is only available with the `--experimental-network-inspection` flag enabled. Broadcasts the `Network.loadingFinished` event to connected frontends. This event indicates that HTTP request has finished loading. ### `inspector.Network.loadingFailed([params])` \* `params` {Object} This feature is only available with the `--experimental-network-inspection` flag enabled. Broadcasts the `Network.loadingFailed` event to connected frontends. This event indicates that HTTP request has failed to load. ### `inspector.Network.webSocketCreated([params])` \* `params` {Object} This feature is only available with the `--experimental-network-inspection` flag enabled. Broadcasts the `Network.webSocketCreated` event to connected frontends. This event indicates that a WebSocket connection has been initiated. ### `inspector.Network.webSocketHandshakeResponseReceived([params])` \* `params` {Object} This feature is only available with the `--experimental-network-inspection` flag enabled. Broadcasts the `Network.webSocketHandshakeResponseReceived` event to connected frontends. This event indicates that the WebSocket handshake response has been received. ### `inspector.Network.webSocketClosed([params])` \* `params` {Object} This feature is only available with the `--experimental-network-inspection` flag enabled. Broadcasts the `Network.webSocketClosed` event to connected frontends. This event indicates that a WebSocket connection has been closed. ### `inspector.NetworkResources.put` > Stability: 1.1 - Active Development This feature is only available with the `--experimental-inspector-network-resource` flag enabled. The inspector.NetworkResources.put method is used to provide a response for a loadNetworkResource request issued via the Chrome DevTools Protocol (CDP). This is typically triggered when a source map is specified by URL, and a DevTools frontend—such as Chrome—requests the resource to retrieve the source map. This method allows developers to predefine the resource content to be served in response to such CDP requests. ```js const inspector = require('node:inspector'); // By preemptively calling put to register the resource, a source map can be resolved when // a loadNetworkResource request is made from the frontend. async function setNetworkResources() { const mapUrl = 'http://localhost:3000/dist/app.js.map'; const tsUrl = 'http://localhost:3000/src/app.ts'; const distAppJsMap = await fetch(mapUrl).then((res) => res.text()); const srcAppTs = await fetch(tsUrl).then((res) => res.text()); inspector.NetworkResources.put(mapUrl, distAppJsMap); inspector.NetworkResources.put(tsUrl, srcAppTs); }; setNetworkResources().then(() => { require('./dist/app'); }); ``` For more details, see the official CDP documentation: [Network.loadNetworkResource](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-loadNetworkResource) ### `inspector.DOMStorage.domStorageItemAdded` \* `params` {Object} \* `storageId` {Object} \* `securityOrigin` {string} \* `storageKey` {string} \* `isLocalStorage` {boolean} \* `key` {string} \* `newValue` {string} This feature is only available with the `--experimental-storage-inspection` flag enabled. Broadcasts the `DOMStorage.domStorageItemAdded` event to connected frontends. This event indicates that a new item has been added to the storage. ### `inspector.DOMStorage.domStorageItemRemoved` \* `params` {Object} \* `storageId` {Object} \* `securityOrigin` {string} \* `storageKey` {string} \* `isLocalStorage` {boolean} \* `key` {string} This feature is only available with the `--experimental-storage-inspection` flag enabled. Broadcasts the `DOMStorage.domStorageItemRemoved` event to connected frontends. This event indicates that an item has been removed from the storage. ### `inspector.DOMStorage.domStorageItemUpdated` \* `params` {Object} \* `storageId` {Object} \* `securityOrigin` {string} \* `storageKey` {string} \* `isLocalStorage` {boolean} \* `key` {string} \* `oldValue` {string} \* `newValue` {string} This feature is only available with the `--experimental-storage-inspection` flag enabled. Broadcasts the `DOMStorage.domStorageItemUpdated` event to connected frontends. This event indicates that a storage item has been updated. ### `inspector.DOMStorage.domStorageItemsCleared` \* `params` {Object} \* `storageId` {Object} \* `securityOrigin` {string} \* `storageKey` {string} \* `isLocalStorage` {boolean} This feature is only available with the `--experimental-storage-inspection` flag enabled. Broadcasts the `DOMStorage.domStorageItemsCleared` event to connected frontends. This event indicates that all items have been cleared from the storage. ### `inspector.DOMStorage.registerStorage` \* `params` {Object} \* `isLocalStorage` {boolean} \* `storageMap` {Object} This feature is only available with the `--experimental-storage-inspection` flag enabled. ## Support of breakpoints The Chrome DevTools Protocol [`Debugger` domain][] allows an `inspector.Session` to attach to a program and set breakpoints to step through the codes. However, setting breakpoints with a same-thread `inspector.Session`, which is connected by [`session.connect()`][], should be avoided as the program being attached and paused is exactly the debugger itself. Instead, try connect to | https://github.com/nodejs/node/blob/main//doc/api/inspector.md | main | nodejs | [
-0.07379576563835144,
0.02791115641593933,
0.014204000122845173,
0.0592854768037796,
0.02736625261604786,
-0.05455499142408371,
-0.05889683589339256,
-0.020115433260798454,
-0.019495200365781784,
-0.003930865321308374,
-0.08078861236572266,
0.006011581979691982,
-0.0774778351187706,
-0.0052484506741166115,
0.06154661625623703,
-0.00619047274813056,
0.11854789406061172,
-0.12219806015491486,
0.005159804597496986,
0.004459374584257603,
0.03182274475693703,
-0.018088679760694504,
-0.020102698355913162,
-0.09381358325481415,
0.010614493861794472,
0.00045823995606042445,
-0.06523457169532776,
-0.05577801540493965,
0.03965626657009125,
0.06580265611410141,
-0.020706741139292717,
-0.07960166037082672,
-0.07833487540483475,
-0.02369121089577675,
-0.041961632668972015,
-0.01636805199086666,
0.0672566369175911,
-0.06671161949634552,
0.00014999356062617153,
0.03476102650165558,
0.08450189977884293,
0.0455794483423233,
-0.04573136195540428,
-0.0017457768553867936,
0.021854747086763382,
-0.06440876424312592,
-0.020335325971245766,
0.00553145119920373,
-0.08944230526685715,
-0.019069597125053406,
-0.0038939155638217926,
-0.004787838086485863,
-0.015077617950737476,
0.099882110953331,
0.0159194003790617,
-0.03844447806477547,
0.020163262262940407,
0.009415071457624435,
0.007804600987583399,
0.016573596745729446,
0.026279566809535027,
-0.033733535557985306,
0.030475860461592674,
-0.03868087753653526,
-0.05151836574077606,
0.022107869386672974,
0.01603604108095169,
0.0008198010036721826,
0.04863240197300911,
-0.018214771524071693,
-0.013664121739566326,
0.02563662827014923,
-0.07901142537593842,
-0.00836707092821598,
0.07229720801115036,
-0.03913652151823044,
0.03956814855337143,
0.014140641316771507,
-0.01385811623185873,
-0.09383205324411392,
-0.0065452405251562595,
-0.11247635632753372,
0.041944749653339386,
0.10623388737440109,
0.01731369085609913,
-0.007009485736489296,
-0.039846498519182205,
-0.03312258422374725,
-0.013049032539129257,
0.04630409553647041,
-0.01173551008105278,
-0.011112677864730358,
-0.07133974134922028,
0.052411071956157684,
-0.004789378028362989,
0.02169058844447136,
0.0032723068725317717,
0.03327905014157295,
-0.06803348660469055,
0.045068949460983276,
0.058600034564733505,
-0.0673196017742157,
0.05279000103473663,
0.03663716837763786,
0.029887214303016663,
-0.016693243756890297,
0.01237486768513918,
0.01573486067354679,
0.04310797527432442,
0.05268938094377518,
-0.011776743456721306,
0.002975170500576496,
0.07572558522224426,
-0.04944435507059097,
0.015188035555183887,
0.014159014448523521,
-0.03531450405716896,
0.03409665450453758,
0.017676083371043205,
0.02614245004951954,
0.08523547649383545,
-0.02725967764854431,
0.017835358157753944,
-0.06609589606523514,
0.1421099603176117,
-0.03689345344901085,
0.0328964926302433,
3.320512197631812e-33,
0.04446893557906151,
-0.007554328069090843,
-0.02798999845981598,
0.02903837524354458,
0.035474322736263275,
-0.009391818195581436,
0.10960820317268372,
0.007323825731873512,
0.01665964350104332,
-0.0017441633390262723,
-0.04622138291597366,
0.045858655124902725,
0.004670856520533562,
-0.05112253129482269,
0.0054092672653496265,
0.03759102150797844,
0.025296902284026146,
-0.009318479336798191,
0.07435758411884308,
0.0692850723862648,
0.016498826444149017,
-0.144597589969635,
0.05533173680305481,
0.0059722671285271645,
-0.024726502597332,
0.004395328927785158,
-0.014461829327046871,
0.06797710806131363,
-0.08169646561145782,
0.04057416692376137,
0.050108879804611206,
0.006856301333755255,
0.06295771151781082,
0.01727759838104248,
-0.013140419498085976,
-0.10938961058855057,
0.03077690117061138,
-0.019901946187019348,
-0.08397841453552246,
-0.029899191111326218,
0.04496348276734352,
-0.008595653809607029,
-0.08647431433200836,
-0.014304493553936481,
-0.07272874563932419,
-0.1475183665752411,
-0.10087044537067413,
0.03347261622548103,
0.10426726937294006,
0.031794581562280655,
-0.09044129401445389,
-0.02192498743534088,
0.10303505510091782,
-0.052033983170986176,
-0.017310678958892822,
0.05918549373745918,
0.0032610255293548107,
0.03625200316309929,
-0.05285634472966194,
-0.05505640059709549,
0.039167191833257675,
-0.034281957894563675,
-0.019504839554429054,
-0.03888370841741562,
0.0794159397482872,
0.04938243702054024,
-0.006452416535466909,
0.0490797758102417,
-0.04716010019183159,
-0.019684847444295883,
-0.04761715233325958,
-0.02117667719721794,
0.016750933602452278,
0.011987539008259773,
-0.006946273613721132,
-0.026586510241031647,
-0.03621048852801323,
0.02352522686123848,
0.004110379610210657,
0.006371374242007732,
0.03687455132603645,
-0.03054068051278591,
0.05091238394379616,
-0.0031291181221604347,
-0.0340830534696579,
0.04578375071287155,
-0.0021953070536255836,
-0.06552014499902725,
0.004306612070649862,
0.05056968331336975,
0.0028120912611484528,
0.0039701745845377445,
0.0059063914231956005,
0.06135014444589615,
-0.07252582162618637,
-4.3487795544334544e-33,
-0.023202048614621162,
0.027356844395399094,
-0.09950915724039078,
0.01653234101831913,
-0.01834758184850216,
-0.034231528639793396,
0.040493421256542206,
0.023297900334000587,
-0.007307528983801603,
0.006964529398828745,
0.14168047904968262,
-0.05080230161547661,
-0.027483494952321053,
0.03007468767464161,
-0.044597167521715164,
0.10019460320472717,
-0.0399116575717926,
-0.0798138827085495,
0.04318619146943092,
-0.010522701777517796,
-0.02040836028754711,
-0.05674123018980026,
0.01935436576604843,
-0.012582233175635338,
-0.09970524907112122,
-0.021954599767923355,
0.052809424698352814,
-0.0689314678311348,
-0.049289803951978683,
-0.05715745687484741,
0.02736644633114338,
0.06406053155660629,
-0.03144476190209389,
0.05659814924001694,
-0.020641250535845757,
0.07239466905593872,
0.08338801562786102,
-0.022026486694812775,
-0.00531197153031826,
-0.05266530439257622,
0.11838095635175705,
0.019382821395993233,
0.00896275695413351,
0.07083702087402344,
0.06539105623960495,
0.004799317568540573,
-0.044228218495845795,
0.041455551981925964,
-0.07784491032361984,
-0.008588266558945179,
0.06764499843120575,
0.01203854288905859,
0.03515437990427017,
0.04510270431637764,
-0.02975228801369667,
0.0802510529756546,
0.04859955608844757,
-0.014837252907454967,
-0.011723008006811142,
0.028748784214258194,
-0.003605030244216323,
-0.04704257845878601,
-0.05934273451566696,
0.016178574413061142,
0.042940299957990646,
0.05766177922487259,
-0.03706716373562813,
0.023108908906579018,
0.06363339722156525,
-0.04435650631785393,
-0.04048767313361168,
0.004381178412586451,
0.018403466790914536,
-0.03791285306215286,
0.04537420719861984,
0.03779951483011246,
0.005162602290511131,
-0.06585239619016647,
-0.04510058835148811,
0.018313171342015266,
-0.02094188891351223,
0.030824972316622734,
-0.07430003583431244,
-0.09059009701013565,
0.03797003999352455,
0.0021656963508576155,
-0.029659025371074677,
0.16627930104732513,
-0.0127305518835783,
-0.001096380758099258,
-0.016073348000645638,
-0.013458644039928913,
-0.021376824006438255,
-0.0048800562508404255,
0.08847583085298538,
-5.197554031610707e-8,
-0.061753034591674805,
0.10152313858270645,
-0.03782128170132637,
-0.046667858958244324,
0.02976728416979313,
0.08580389618873596,
0.024132132530212402,
-0.0591459646821022,
0.001427269191481173,
0.00850464217364788,
-0.10074283927679062,
0.05177565664052963,
-0.024951227009296417,
0.011701284907758236,
0.037418268620967865,
-0.08818932622671127,
-0.04319010302424431,
0.03947122395038605,
-0.019222745671868324,
-0.06994161009788513,
0.07014371454715729,
-0.0777360200881958,
-0.0025280446279793978,
0.05269472673535347,
0.09301058202981949,
-0.03503761067986488,
-0.015235458500683308,
-0.01786057837307453,
-0.07688838988542557,
0.03928223252296448,
-0.10853840410709381,
0.016215693205595016,
-0.019926903769373894,
-0.06024527549743652,
-0.023023687303066254,
0.09833614528179169,
-0.048037346452474594,
-0.0075459592044353485,
0.0542440339922905,
-0.01897125504910946,
0.0740794762969017,
0.0046746083535254,
-0.03044046461582184,
0.010550584644079208,
0.057952411472797394,
0.04085949435830116,
-0.06982937455177307,
0.053546227514743805,
0.06842071563005447,
-0.05775022134184837,
0.0035559392999857664,
-0.09620147198438644,
-0.03849444538354874,
-0.07126951217651367,
-0.06016948074102402,
0.03031173162162304,
0.032296642661094666,
-0.0881204828619957,
-0.03177642449736595,
0.00043607884435914457,
0.13740216195583344,
0.018187832087278366,
-0.015344148501753807,
-0.03478040173649788
] | 0.039782 |
Protocol [`Debugger` domain][] allows an `inspector.Session` to attach to a program and set breakpoints to step through the codes. However, setting breakpoints with a same-thread `inspector.Session`, which is connected by [`session.connect()`][], should be avoided as the program being attached and paused is exactly the debugger itself. Instead, try connect to the main thread by [`session.connectToMainThread()`][] and set breakpoints in a worker thread, or connect with a [Debugger][] program over WebSocket connection. [CPU Profiler]: https://chromedevtools.github.io/devtools-protocol/v8/Profiler [Chrome DevTools Protocol Viewer]: https://chromedevtools.github.io/devtools-protocol/v8/ [Debugger]: debugger.md [Heap Profiler]: https://chromedevtools.github.io/devtools-protocol/v8/HeapProfiler [`'Debugger.paused'`]: https://chromedevtools.github.io/devtools-protocol/v8/Debugger#event-paused [`Debugger` domain]: https://chromedevtools.github.io/devtools-protocol/v8/Debugger [`inspector.close()`]: #inspectorclose [`session.connect()`]: #sessionconnect [`session.connectToMainThread()`]: #sessionconnecttomainthread [security warning]: cli.md#warning-binding-inspector-to-a-public-ipport-combination-is-insecure [support of breakpoints]: #support-of-breakpoints | https://github.com/nodejs/node/blob/main//doc/api/inspector.md | main | nodejs | [
-0.09921132028102875,
-0.027406912297010422,
-0.013815119862556458,
-0.0032797963358461857,
0.03325892239809036,
-0.04346752166748047,
-0.03672221302986145,
0.014313187450170517,
-0.022707944735884666,
-0.01276798639446497,
-0.02247721515595913,
-0.0594458132982254,
-0.09465602040290833,
-0.042925335466861725,
0.025601165369153023,
0.017390210181474686,
0.06038789078593254,
-0.0819120779633522,
0.060626015067100525,
0.022211695089936256,
-0.019273072481155396,
-0.049370840191841125,
-0.03160684555768967,
0.03786731883883476,
0.0020337530877441168,
0.039363861083984375,
0.00155650672968477,
-0.033889904618263245,
0.044914379715919495,
-0.005988860037177801,
0.015060181729495525,
-0.1038329005241394,
-0.08100120723247528,
0.007575202267616987,
0.003964278381317854,
0.05278993025422096,
0.021358540281653404,
0.019029099494218826,
-0.08141922950744629,
0.0225154347717762,
0.03933173418045044,
0.0563255175948143,
-0.07980837672948837,
-0.04344087094068527,
0.0022434901911765337,
-0.07311622053384781,
-0.03942080959677696,
0.02571846731007099,
-0.016640326008200645,
-0.02754152938723564,
-0.005610767286270857,
0.10425697267055511,
0.050130680203437805,
0.05616265907883644,
0.023782173171639442,
0.043990977108478546,
0.05863642320036888,
0.03759383037686348,
0.05734775587916374,
0.09519639611244202,
-0.04799400269985199,
0.051259007304906845,
-0.0024078614078462124,
-0.012303194962441921,
0.05458112806081772,
0.10233543813228607,
0.08539730310440063,
0.004953999537974596,
0.029086630791425705,
-0.00631828373298049,
-0.05346140265464783,
0.029712984338402748,
-0.0459023080766201,
-0.025438837707042694,
0.009781142696738243,
-0.004546618554741144,
-0.05877009779214859,
-0.03342089802026749,
-0.05350267142057419,
-0.0926765650510788,
-0.006967870518565178,
-0.08018302917480469,
0.08124691992998123,
0.06656187772750854,
0.05305376276373863,
0.02968638576567173,
0.01864437386393547,
-0.04089345782995224,
0.008423984982073307,
0.0760522335767746,
-0.06313343346118927,
0.024908989667892456,
-0.09528470784425735,
0.023214256390929222,
0.08164268732070923,
0.014322469010949135,
0.029840819537639618,
0.08257131278514862,
-0.0517323799431324,
0.03423624113202095,
0.004805623088032007,
0.0013366994680836797,
0.01068808976560831,
0.031087081879377365,
0.01832173950970173,
-0.026217138394713402,
-0.017507227137684822,
-0.016428109258413315,
0.016485776752233505,
-0.017320500686764717,
0.040433645248413086,
0.04772290214896202,
0.027236418798565865,
0.041736945509910583,
0.02909194491803646,
0.06988856941461563,
-0.008471923880279064,
0.007889010943472385,
0.06576433777809143,
0.07118164002895355,
0.13957780599594116,
0.03274469077587128,
-0.06619026511907578,
-0.02889891341328621,
0.0538586862385273,
-0.02562575414776802,
0.009901254437863827,
1.5052995865901312e-33,
0.03771110996603966,
-0.09682559221982956,
-0.023583194240927696,
0.002998242387548089,
0.04498738422989845,
0.012861814349889755,
-0.046389512717723846,
0.0863657221198082,
-0.03574153035879135,
0.01567986235022545,
0.014171469025313854,
-0.03545204922556877,
0.028601976111531258,
-0.025206172838807106,
0.02956787683069706,
0.004846407100558281,
0.00846142414957285,
0.03083573281764984,
-0.041250620037317276,
0.05665326863527298,
0.018140267580747604,
-0.13768869638442993,
-0.06859945505857468,
0.054696012288331985,
0.012858765199780464,
0.12375376373529434,
-0.0809440091252327,
0.05438251420855522,
-0.03589533641934395,
0.05322326719760895,
-0.047384753823280334,
0.000054395644838223234,
0.010669670067727566,
0.06227466091513634,
0.024128945544362068,
-0.15143001079559326,
-0.028049107640981674,
0.0028241451364010572,
-0.0185870174318552,
-0.0363609604537487,
-0.05176278576254845,
-0.06142377853393555,
-0.1032203733921051,
-0.039591412991285324,
-0.06575211882591248,
-0.12652359902858734,
-0.06935913115739822,
0.0013086297549307346,
0.0063405768014490604,
0.010351684875786304,
-0.0040692975744605064,
0.024086354300379753,
0.006188986822962761,
-0.04935305193066597,
-0.008932468481361866,
-0.039394911378622055,
0.06273948401212692,
0.0035024499520659447,
-0.033360809087753296,
0.07600048929452896,
-0.03033614717423916,
0.06265363842248917,
-0.08308502286672592,
-0.027574284002184868,
-0.0020983514841645956,
-0.03880452737212181,
-0.09010234475135803,
0.0877249613404274,
-0.0037258430384099483,
-0.035190749913454056,
-0.1041792631149292,
0.05039142072200775,
0.04201948642730713,
0.02567325532436371,
-0.04587334394454956,
0.033195238560438156,
-0.008085601963102818,
0.07731601595878601,
-0.027860362082719803,
0.006776222959160805,
0.070582315325737,
-0.0214090533554554,
0.01791185513138771,
-0.11814265698194504,
-0.005835802759975195,
0.039470843970775604,
-0.01386411115527153,
-0.06546366214752197,
-0.031846851110458374,
0.03604939579963684,
-0.030265072360634804,
0.0333939790725708,
0.016665596514940262,
0.0044110557064414024,
-0.028577540069818497,
-3.6355762750628634e-33,
-0.04029243066906929,
-0.03201525658369064,
-0.059631846845149994,
0.06987284123897552,
0.013951792381703854,
0.030517255887389183,
0.01983468607068062,
-0.00959700532257557,
0.029264088720083237,
-0.0016912758583202958,
0.017645716667175293,
-0.039539046585559845,
-0.10576373338699341,
0.06041675806045532,
0.03853832930326462,
0.0632995069026947,
-0.013594139367341995,
-0.03647490590810776,
0.03520360589027405,
-0.0396299883723259,
0.04134911671280861,
-0.005167274735867977,
0.0567203052341938,
-0.05387827008962631,
0.044013313949108124,
-0.02627561427652836,
0.024110112339258194,
-0.043671585619449615,
0.04915992170572281,
-0.028341427445411682,
0.0005753758596256375,
0.09869083017110825,
-0.0070289988070726395,
0.023244615644216537,
0.03683099150657654,
0.06720634549856186,
0.018273700028657913,
-0.0150937894359231,
-0.00004261040157871321,
-0.05022725090384483,
0.12868118286132812,
0.0058807567693293095,
0.010459693148732185,
0.06107458472251892,
0.07623952627182007,
0.07576276361942291,
-0.07467957586050034,
-0.014201413840055466,
-0.1188502237200737,
0.020914578810334206,
0.028798963874578476,
-0.005567609332501888,
0.044377245008945465,
0.01072743535041809,
-0.097244493663311,
-0.022465692833065987,
0.032596033066511154,
-0.057683300226926804,
-0.041830457746982574,
-0.052805881947278976,
0.06648503243923187,
-0.04925313964486122,
-0.019759075716137886,
0.07142503559589386,
0.03341162949800491,
-0.032891321927309036,
-0.027222424745559692,
0.0735665112733841,
-0.0028490140102803707,
0.016924291849136353,
-0.027828974649310112,
-0.03208036720752716,
0.008756688795983791,
-0.0059964838437736034,
-0.08470888435840607,
0.04495345056056976,
0.0028554238379001617,
-0.1284923404455185,
-0.020806705579161644,
0.011715639382600784,
-0.007013652008026838,
0.03715513274073601,
0.017265576869249344,
-0.07651086896657944,
0.007424421142786741,
0.03892262279987335,
-0.1048201322555542,
0.164811372756958,
0.03103034198284149,
-0.03835896775126457,
-0.08413755893707275,
0.03205278888344765,
-0.06437920033931732,
-0.025289315730333328,
0.031191039830446243,
-4.802887687560542e-8,
0.0631028488278389,
-0.011704258620738983,
-0.10010207444429398,
0.03679497912526131,
-0.018085278570652008,
-0.009021062403917313,
-0.06601997464895248,
-0.00689563388004899,
-0.016952039673924446,
0.09252393990755081,
0.00028854713309556246,
0.034734103828668594,
0.010778671130537987,
0.04223576933145523,
-0.01234718319028616,
-0.06859799474477768,
0.0166820976883173,
0.04202946648001671,
0.0013487315736711025,
-0.08089523017406464,
0.04473409801721573,
-0.030787233263254166,
-0.0005765213863924146,
0.03708818182349205,
-0.027072906494140625,
-0.08896735310554504,
0.055070679634809494,
0.045592863112688065,
-0.0534307137131691,
-0.07010592520236969,
-0.12085330486297607,
0.06737740337848663,
-0.0520767979323864,
-0.008142626844346523,
0.02864312380552292,
0.05889993906021118,
-0.05914390832185745,
0.01538527850061655,
0.07170966267585754,
-0.026033295318484306,
0.03570231795310974,
0.026048118248581886,
-0.07012977451086044,
-0.0031104173976927996,
0.0353182889521122,
0.050840266048908234,
-0.018880264833569527,
0.11240807920694351,
0.0695047527551651,
0.022130070254206657,
-0.07237090915441513,
-0.014878721907734871,
0.005847720894962549,
-0.010332578793168068,
-0.023565318435430527,
0.05177530646324158,
-0.010441988706588745,
-0.10523953288793564,
0.03014407679438591,
-0.026313625276088715,
-0.019102199003100395,
-0.02064625360071659,
0.008631770499050617,
0.011542177759110928
] | 0.05268 |
# OS > Stability: 2 - Stable The `node:os` module provides operating system-related utility methods and properties. It can be accessed using: ```mjs import os from 'node:os'; ``` ```cjs const os = require('node:os'); ``` ## `os.EOL` \* Type: {string} The operating system-specific end-of-line marker. \* `\n` on POSIX \* `\r\n` on Windows ## `os.availableParallelism()` \* Returns: {integer} Returns an estimate of the default amount of parallelism a program should use. Always returns a value greater than zero. This function is a small wrapper about libuv's [`uv\_available\_parallelism()`][]. ## `os.arch()` \* Returns: {string} Returns the operating system CPU architecture for which the Node.js binary was compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`, `'mipsel'`, `'ppc64'`, `'riscv64'`, `'s390x'`, and `'x64'`. The return value is equivalent to [`process.arch`][]. ## `os.constants` \* Type: {Object} Contains commonly used operating system-specific constants for error codes, process signals, and so on. The specific constants defined are described in [OS constants](#os-constants). ## `os.cpus()` \* Returns: {Object\[]} Returns an array of objects containing information about each logical CPU core. The array will be empty if no CPU information is available, such as if the `/proc` file system is unavailable. The properties included on each object include: \* `model` {string} \* `speed` {number} (in MHz) \* `times` {Object} \* `user` {number} The number of milliseconds the CPU has spent in user mode. \* `nice` {number} The number of milliseconds the CPU has spent in nice mode. \* `sys` {number} The number of milliseconds the CPU has spent in sys mode. \* `idle` {number} The number of milliseconds the CPU has spent in idle mode. \* `irq` {number} The number of milliseconds the CPU has spent in irq mode. ```js [ { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', speed: 2926, times: { user: 252020, nice: 0, sys: 30340, idle: 1070356870, irq: 0, }, }, { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', speed: 2926, times: { user: 306960, nice: 0, sys: 26980, idle: 1071569080, irq: 0, }, }, { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', speed: 2926, times: { user: 248450, nice: 0, sys: 21750, idle: 1070919370, irq: 0, }, }, { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', speed: 2926, times: { user: 256880, nice: 0, sys: 19430, idle: 1070905480, irq: 20, }, }, ] ``` `nice` values are POSIX-only. On Windows, the `nice` values of all processors are always 0. `os.cpus().length` should not be used to calculate the amount of parallelism available to an application. Use [`os.availableParallelism()`](#osavailableparallelism) for this purpose. ## `os.devNull` \* Type: {string} The platform-specific file path of the null device. \* `\\.\nul` on Windows \* `/dev/null` on POSIX ## `os.endianness()` \* Returns: {string} Returns a string identifying the endianness of the CPU for which the Node.js binary was compiled. Possible values are `'BE'` for big endian and `'LE'` for little endian. ## `os.freemem()` \* Returns: {integer} Returns the amount of free system memory in bytes as an integer. ## `os.getPriority([pid])` \* `pid` {integer} The process ID to retrieve scheduling priority for. \*\*Default:\*\* `0`. \* Returns: {integer} Returns the scheduling priority for the process specified by `pid`. If `pid` is not provided or is `0`, the priority of the current process is returned. ## `os.homedir()` \* Returns: {string} Returns the string path of the current user's home directory. On POSIX, it uses the `$HOME` environment variable if defined. Otherwise it uses the [effective UID][EUID] to look up the user's home directory. On Windows, it uses the `USERPROFILE` environment variable if defined. Otherwise it uses the path to the profile directory of the current user. ## `os.hostname()` \* Returns: {string} Returns the | https://github.com/nodejs/node/blob/main//doc/api/os.md | main | nodejs | [
-0.06944876909255981,
0.034948475658893585,
-0.0744757279753685,
0.04817887023091316,
0.03129344806075096,
-0.09097681939601898,
-0.07604732364416122,
0.11268089711666107,
-0.0409562774002552,
-0.016855409368872643,
-0.02465282753109932,
-0.010734410025179386,
-0.020384853705763817,
-0.10717170685529709,
0.04131464287638664,
0.0019376903073862195,
-0.018636975437402725,
0.0030578861478716135,
0.01459179725497961,
-0.07004166394472122,
0.04240577667951584,
0.004175493493676186,
0.024780308827757835,
-0.0006403201259672642,
0.01723158173263073,
-0.020866915583610535,
-0.07970735430717468,
0.0007197430240921676,
0.07120789587497711,
-0.012564489617943764,
0.0211856197565794,
-0.021395213901996613,
-0.016512302681803703,
0.0514325350522995,
0.034053146839141846,
0.11015088111162186,
0.02091594971716404,
-0.16352295875549316,
-0.10233064740896225,
0.028538957238197327,
-0.002081839833408594,
0.0861019566655159,
-0.03117378056049347,
-0.026678264141082764,
0.019683022052049637,
-0.003496460849419236,
-0.05243542417883873,
0.009018415585160255,
-0.07038652896881104,
0.02439267747104168,
-0.02891332097351551,
-0.055567000061273575,
-0.005234541837126017,
-0.008858183398842812,
0.011881517246365547,
0.003405301133170724,
-0.006972047500312328,
-0.025499437004327774,
-0.01866239681839943,
0.07699109613895416,
0.01535813044756651,
-0.04022109508514404,
-0.01054976787418127,
0.006664013955742121,
0.0776224434375763,
0.021502140909433365,
0.004221608862280846,
-0.07222668826580048,
0.004559999797493219,
-0.008074949495494366,
-0.0027947446797043085,
-0.04140252619981766,
-0.022158486768603325,
0.013936521485447884,
-0.07439307868480682,
-0.04731272533535957,
0.07160031050443649,
0.006085037719458342,
-0.028205571696162224,
0.022062260657548904,
-0.030260249972343445,
-0.03696078062057495,
-0.09176905453205109,
0.043787963688373566,
-0.026915686205029488,
0.017020005732774734,
-0.048279792070388794,
0.03996583819389343,
0.07924716174602509,
0.05593566596508026,
-0.03361125662922859,
0.017944609746336937,
-0.010389004833996296,
0.0484469011425972,
0.027242321521043777,
0.09543716162443161,
0.041680555790662766,
0.028626108542084694,
-0.05499362200498581,
0.045010752975940704,
-0.019743137061595917,
-0.013523312285542488,
0.13782966136932373,
0.014061527326703072,
0.030778054147958755,
-0.005883170757442713,
0.054258327931165695,
0.017366431653499603,
-0.04781772196292877,
-0.0397903174161911,
0.08072876930236816,
0.05914349853992462,
0.0008269838872365654,
0.034501414746046066,
0.016398392617702484,
-0.040696900337934494,
0.06566013395786285,
-0.046082716435194016,
0.05694716423749924,
0.1033109650015831,
0.05326734483242035,
0.005859942175447941,
0.036781538277864456,
-0.04491811990737915,
-0.00867987796664238,
-0.013974172994494438,
0.03181493654847145,
5.583977263334006e-33,
-0.03903529793024063,
-0.07549088448286057,
0.07193654030561447,
-0.01073214691132307,
0.027280118316411972,
-0.007983559742569923,
-0.05156790837645531,
-0.036353252828121185,
-0.1710686981678009,
0.0449676550924778,
-0.047203272581100464,
0.049187857657670975,
-0.012343174777925014,
0.05975542962551117,
0.021677957847714424,
-0.07688985019922256,
0.12715016305446625,
-0.031895387917757034,
0.06112394481897354,
0.031832654029130936,
0.08478804677724838,
-0.04420098289847374,
-0.08306269347667694,
-0.004136086441576481,
0.02910403534770012,
-0.022006947547197342,
0.020487019792199135,
-0.08336939662694931,
-0.021338053047657013,
0.014216003939509392,
-0.020314160734415054,
0.05567946285009384,
-0.047548502683639526,
-0.024684855714440346,
-0.005827832035720348,
-0.025998909026384354,
-0.061569441109895706,
0.0237220898270607,
-0.059378672391176224,
-0.043602485209703445,
-0.03355282545089722,
0.07264715433120728,
-0.0012497617863118649,
-0.04220866784453392,
0.026022279635071754,
-0.1009189635515213,
-0.07079003006219864,
-0.027446795254945755,
-0.03545866161584854,
0.01919608563184738,
0.017726784572005272,
0.07534462213516235,
-0.023251017555594444,
0.018026025965809822,
0.04016488790512085,
-0.015252705663442612,
0.03301750868558884,
0.05073891580104828,
-0.007182285189628601,
0.09800328314304352,
0.01533044595271349,
-0.01963823288679123,
0.0027062727604061365,
-0.006450621411204338,
-0.012155461125075817,
-0.01772545650601387,
-0.047795142978429794,
-0.0007201318512670696,
-0.032704271376132965,
0.15077173709869385,
-0.08152460306882858,
-0.0038657679688185453,
0.0010142349638044834,
0.0349283292889595,
-0.013408043421804905,
-0.009486821480095387,
-0.03966529667377472,
-0.08047744631767273,
-0.08410364389419556,
-0.027933983132243156,
-0.021681364625692368,
0.017632100731134415,
0.018583623692393303,
-0.013045274652540684,
0.047023143619298935,
-0.04737396165728569,
-0.03468677029013634,
0.011158320121467113,
0.004623837303370237,
-0.03735242784023285,
0.03994305804371834,
-0.03463881090283394,
-0.005176594480872154,
-0.010099394246935844,
-0.17038594186306,
-7.961030348156157e-33,
-0.026456503197550774,
-0.021621152758598328,
-0.04422256723046303,
0.09085104614496231,
-0.03365986794233322,
-0.04388296604156494,
-0.03999920189380646,
-0.024242650717496872,
-0.07533971965312958,
-0.03819011151790619,
-0.007966045290231705,
0.04058238863945007,
0.05237993970513344,
0.05174286663532257,
0.10304148495197296,
0.05239979922771454,
-0.027301890775561333,
-0.010665330104529858,
0.07527998089790344,
0.0006532596307806671,
-0.048112981021404266,
0.0155421681702137,
0.09872936457395554,
0.007417252287268639,
-0.003528736298903823,
-0.03445694223046303,
-0.042943075299263,
-0.0700719803571701,
-0.02320917136967182,
-0.05811500921845436,
-0.0451507568359375,
-0.007254002150148153,
-0.04823390021920204,
0.020600665360689163,
0.0520128570497036,
-0.02621268667280674,
-0.01713683269917965,
0.00025404864572919905,
0.025824353098869324,
0.032573919743299484,
0.10477567464113235,
0.004813842009752989,
-0.04556730017066002,
-0.02064715139567852,
0.03247687593102455,
0.071548692882061,
-0.04544221609830856,
0.0018364035058766603,
0.002922109328210354,
-0.038247015327215195,
0.0334571935236454,
-0.023862700909376144,
0.053156089037656784,
0.1258566677570343,
0.040797602385282516,
-0.07855444401502609,
-0.04473061487078667,
0.038615770637989044,
0.05224720388650894,
-0.015484249219298363,
-0.012315352447330952,
-0.11966042965650558,
-0.052034176886081696,
-0.02497415617108345,
0.013505598530173302,
0.007291809655725956,
-0.11411841213703156,
-0.06400980800390244,
0.013830775395035744,
0.0218383576720953,
0.027723200619220734,
0.06317713856697083,
0.008038272149860859,
0.05604628100991249,
-0.09539284557104111,
0.004863602574914694,
0.03675223886966705,
-0.07889654487371445,
-0.02204248122870922,
0.06863811612129211,
-0.03731807321310043,
0.11336156725883484,
0.004126889631152153,
0.01461007259786129,
-0.04766543582081795,
-0.060289423912763596,
0.030236762017011642,
0.01992761343717575,
-0.00551851699128747,
-0.008939990773797035,
-0.001807788503356278,
0.06758926808834076,
-0.16037753224372864,
-0.0378158837556839,
-0.027716754004359245,
-5.7384635709922804e-8,
0.03600476682186127,
-0.04347147420048714,
-0.07323501259088516,
0.01808272860944271,
0.04909452795982361,
0.037887997925281525,
0.0014671814860776067,
-0.07869162410497665,
0.039577603340148926,
0.07489442825317383,
0.11370319128036499,
-0.05909698083996773,
0.014530929736793041,
-0.023970944806933403,
0.022613516077399254,
0.09378913789987564,
-0.008335405960679054,
0.052918821573257446,
-0.00103406747803092,
-0.0035149327013641596,
0.006478589493781328,
0.014823184348642826,
0.02257515862584114,
0.07977830618619919,
-0.07029082626104355,
-0.06291233748197556,
0.07060607522726059,
0.023237604647874832,
-0.027738984674215317,
-0.017686642706394196,
-0.09218065440654755,
0.0022977760527282953,
0.005630878731608391,
-0.011915191076695919,
-0.006313221529126167,
0.026223506778478622,
-0.02098955772817135,
0.07060355693101883,
0.15987750887870789,
0.06230290234088898,
-0.03421344235539436,
0.03271796554327011,
-0.005758787039667368,
0.031055284664034843,
0.03159158676862717,
0.00353748956695199,
-0.0413266122341156,
0.034230686724185944,
-0.022501565515995026,
-0.05304809659719467,
0.018952101469039917,
-0.017170967534184456,
-0.02721686102449894,
0.055904485285282135,
-0.0636347308754921,
0.01043685246258974,
-0.03833562508225441,
-0.08585765957832336,
-0.04676847532391548,
-0.043475449085235596,
0.04388946667313576,
-0.02103106863796711,
0.021433904767036438,
-0.037673674523830414
] | 0.127645 |
uses the `$HOME` environment variable if defined. Otherwise it uses the [effective UID][EUID] to look up the user's home directory. On Windows, it uses the `USERPROFILE` environment variable if defined. Otherwise it uses the path to the profile directory of the current user. ## `os.hostname()` \* Returns: {string} Returns the host name of the operating system as a string. ## `os.loadavg()` \* Returns: {number\[]} Returns an array containing the 1, 5, and 15 minute load averages. The load average is a measure of system activity calculated by the operating system and expressed as a fractional number. The load average is a Unix-specific concept. On Windows, the return value is always `[0, 0, 0]`. ## `os.machine()` \* Returns: {string} Returns the machine type as a string, such as `arm`, `arm64`, `aarch64`, `mips`, `mips64`, `ppc64`, `ppc64le`, `s390x`, `i386`, `i686`, `x86\_64`. On POSIX systems, the machine type is determined by calling [`uname(3)`][]. On Windows, `RtlGetVersion()` is used, and if it is not available, `GetVersionExW()` will be used. See for more information. ## `os.networkInterfaces()` \* Returns: {Object} Returns an object containing network interfaces that have been assigned a network address. Each key on the returned object identifies a network interface. The associated value is an array of objects that each describe an assigned network address. The properties available on the assigned network address object include: \* `address` {string} The assigned IPv4 or IPv6 address \* `netmask` {string} The IPv4 or IPv6 network mask \* `family` {string} Either `IPv4` or `IPv6` \* `mac` {string} The MAC address of the network interface \* `internal` {boolean} `true` if the network interface is a loopback or similar interface that is not remotely accessible; otherwise `false` \* `scopeid` {number} The numeric IPv6 scope ID (only specified when `family` is `IPv6`) \* `cidr` {string} The assigned IPv4 or IPv6 address with the routing prefix in CIDR notation. If the `netmask` is invalid, this property is set to `null`. ```js { lo: [ { address: '127.0.0.1', netmask: '255.0.0.0', family: 'IPv4', mac: '00:00:00:00:00:00', internal: true, cidr: '127.0.0.1/8' }, { address: '::1', netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', family: 'IPv6', mac: '00:00:00:00:00:00', scopeid: 0, internal: true, cidr: '::1/128' } ], eth0: [ { address: '192.168.1.108', netmask: '255.255.255.0', family: 'IPv4', mac: '01:02:03:0a:0b:0c', internal: false, cidr: '192.168.1.108/24' }, { address: 'fe80::a00:27ff:fe4e:66a1', netmask: 'ffff:ffff:ffff:ffff::', family: 'IPv6', mac: '01:02:03:0a:0b:0c', scopeid: 1, internal: false, cidr: 'fe80::a00:27ff:fe4e:66a1/64' } ] } ``` ## `os.platform()` \* Returns: {string} Returns a string identifying the operating system platform for which the Node.js binary was compiled. The value is set at compile time. Possible values are `'aix'`, `'darwin'`, `'freebsd'`,`'linux'`, `'openbsd'`, `'sunos'`, and `'win32'`. The return value is equivalent to [`process.platform`][]. The value `'android'` may also be returned if Node.js is built on the Android operating system. [Android support is experimental][Android building]. ## `os.release()` \* Returns: {string} Returns the operating system as a string. On POSIX systems, the operating system release is determined by calling [`uname(3)`][]. On Windows, `GetVersionExW()` is used. See for more information. ## `os.setPriority([pid, ]priority)` \* `pid` {integer} The process ID to set scheduling priority for. \*\*Default:\*\* `0`. \* `priority` {integer} The scheduling priority to assign to the process. Attempts to set the scheduling priority for the process specified by `pid`. If `pid` is not provided or is `0`, the process ID of the current process is used. The `priority` input must be an integer between `-20` (high priority) and `19` (low priority). Due to differences between Unix priority levels and Windows priority classes, `priority` is mapped to one of six priority constants in `os.constants.priority`. When retrieving a process priority level, this range mapping may cause the return value to be slightly different on Windows. To | https://github.com/nodejs/node/blob/main//doc/api/os.md | main | nodejs | [
-0.022153886035084724,
0.019951285794377327,
-0.04191833734512329,
0.0685989037156105,
-0.022648876532912254,
-0.10935431718826294,
0.04525003582239151,
0.11779043078422546,
0.017663458362221718,
-0.03663129359483719,
-0.07386639714241028,
0.022537169978022575,
-0.01087418757379055,
-0.033570703119039536,
-0.010603636503219604,
-0.05439785122871399,
-0.011179150082170963,
-0.07467338442802429,
0.014499494805932045,
-0.02567794732749462,
0.09667108207941055,
0.03470740094780922,
0.005773025564849377,
-0.0347188375890255,
0.10181358456611633,
-0.06687632948160172,
-0.030752064660191536,
0.0310839731246233,
0.029848163947463036,
0.09475487470626831,
-0.0006702886312268674,
0.0036451097112149,
0.04004373773932457,
-0.035071779042482376,
-0.014149085618555546,
0.017757833003997803,
0.04701865464448929,
-0.0711359977722168,
-0.10540531575679779,
-0.04038291424512863,
0.0702156275510788,
0.027653798460960388,
0.005730892531573772,
0.06965219974517822,
-0.06281106173992157,
0.04171828180551529,
-0.05702302232384682,
0.01977362483739853,
-0.07465232908725739,
0.07896887511014938,
0.041720498353242874,
0.046761102974414825,
0.0063944729045033455,
0.04117922857403755,
0.03505849465727806,
0.029321370646357536,
0.04938676953315735,
-0.02876967564225197,
0.030737904831767082,
0.022079642862081528,
-0.045416004955768585,
-0.0174470916390419,
-0.03780762851238251,
0.04092361405491829,
0.13111285865306854,
-0.03365616500377655,
-0.05113502964377403,
-0.030397405847907066,
-0.004558314103633165,
-0.09613914787769318,
-0.093175508081913,
-0.05799421668052673,
-0.05363472178578377,
-0.020402902737259865,
0.029231401160359383,
-0.06933262944221497,
0.0014747363748028874,
-0.0015837060054764152,
0.03000650554895401,
-0.05287284404039383,
0.006693500559777021,
-0.012699124403297901,
-0.014896593056619167,
0.044071096926927567,
0.03710891678929329,
0.027355041354894638,
0.04870796203613281,
-0.00020833905728068203,
0.03696880862116814,
0.06131406128406525,
0.027458863332867622,
0.009059468284249306,
-0.04096200689673424,
0.028672227635979652,
0.025899894535541534,
0.0792338028550148,
0.018656812608242035,
0.02845250442624092,
-0.05864972993731499,
0.03206922486424446,
-0.028333773836493492,
0.012602567672729492,
0.11643514782190323,
0.03729283809661865,
0.020302874967455864,
-0.045682087540626526,
0.02447669580578804,
0.06158852577209473,
-0.012666091322898865,
-0.0361974872648716,
-0.018157321959733963,
-0.03919423744082451,
-0.032751020044088364,
-0.02565177157521248,
0.0978657454252243,
-0.06420387327671051,
0.043513063341379166,
0.07794218510389328,
-0.0003191088035237044,
0.03868275135755539,
0.027563516050577164,
-0.06456964462995529,
0.03618936613202095,
-0.08567283302545547,
0.046704526990652084,
0.060243405401706696,
0.013323087245225906,
1.6114144922102323e-33,
0.019666677340865135,
-0.09822514653205872,
0.060128211975097656,
0.0001815587020246312,
-0.04702485352754593,
-0.005710090510547161,
-0.037369467318058014,
0.03464807942509651,
0.050110816955566406,
0.044181883335113525,
-0.015482379123568535,
0.11444053053855896,
-0.0060355630703270435,
0.06536278873682022,
0.0401017852127552,
0.09381970018148422,
0.015329895541071892,
0.009620905853807926,
0.06042751297354698,
0.04165543243288994,
0.08854817599058151,
-0.011493809521198273,
-0.03204195573925972,
-0.0036312201991677284,
0.05423075333237648,
-0.05494154989719391,
0.014432977885007858,
0.01053004339337349,
0.0016607497818768024,
0.004977208096534014,
0.0422392375767231,
-0.020774370059370995,
-0.05765208974480629,
-0.0652393326163292,
-0.015710070729255676,
-0.026591146364808083,
0.0462646484375,
0.01673368364572525,
-0.05409586802124977,
-0.029604770243167877,
0.014796203933656216,
0.007270284928381443,
0.07985904067754745,
-0.02749672904610634,
-0.09192328155040741,
-0.1049080565571785,
-0.03454100713133812,
-0.0034813997335731983,
0.0023450523149222136,
0.07602909207344055,
-0.022816689684987068,
0.0018069531070068479,
0.06065056845545769,
0.07762584835290909,
-0.022703973576426506,
0.003680000314489007,
0.0128209562972188,
-0.010470766574144363,
-0.003080100053921342,
0.0026626817416399717,
0.056257933378219604,
-0.015070025809109211,
0.057175107300281525,
0.030988121405243874,
0.020853037014603615,
-0.056278981268405914,
0.07568984478712082,
-0.0009942860342562199,
-0.05066842585802078,
0.1837267428636551,
-0.006089258473366499,
0.0005834996118210256,
-0.020723095163702965,
0.0006197617040015757,
0.013281185179948807,
-0.04358673095703125,
-0.022625671699643135,
-0.03814944997429848,
-0.1443316787481308,
0.07766294479370117,
0.013253327459096909,
0.005116881802678108,
-0.018669696524739265,
-0.04994361847639084,
-0.0052689239382743835,
0.01991031877696514,
-0.021970024332404137,
-0.06872133910655975,
-0.033869434148073196,
-0.06865927577018738,
0.06777781248092651,
-0.03328009694814682,
-0.010168926790356636,
0.0808940902352333,
-0.16953659057617188,
-2.0694712126050762e-33,
-0.024075768887996674,
-0.013236068189144135,
0.047174375504255295,
-0.021699009463191032,
-0.0113458801060915,
-0.007064353208988905,
0.021737992763519287,
0.03400611877441406,
-0.01747051626443863,
-0.0172742810100317,
-0.0033959359861910343,
-0.0004748328065034002,
-0.008517228998243809,
0.022869030013680458,
0.13704276084899902,
0.06716158986091614,
-0.04728611931204796,
-0.07796214520931244,
0.01518072560429573,
-0.009008530527353287,
-0.057010307908058167,
0.02496463805437088,
0.011874374933540821,
-0.009615671820938587,
-0.019226297736167908,
-0.05245837941765785,
-0.017607320100069046,
-0.05320719629526138,
-0.05592292919754982,
-0.03782372176647186,
-0.002696867100894451,
-0.032279085367918015,
-0.08590386807918549,
0.028422357514500618,
-0.07871684432029724,
0.024945460259914398,
0.004525681957602501,
0.054258979856967926,
-0.026390645653009415,
0.027643876150250435,
0.062039751559495926,
0.008437903597950935,
-0.027414677664637566,
0.018313691020011902,
0.018826914951205254,
0.09619196504354477,
-0.06798259168863297,
-0.012578659690916538,
-0.06508877128362656,
-0.008275086991488934,
0.15540510416030884,
0.028034573420882225,
-0.001941181719303131,
0.08503425866365433,
0.024921534582972527,
-0.027792276814579964,
0.010563370771706104,
-0.039175789803266525,
0.002664277795702219,
-0.0003450403455644846,
0.047023482620716095,
-0.039795950055122375,
-0.03238099440932274,
0.004802096169441938,
-0.16601653397083282,
0.04408310726284981,
0.005646859295666218,
-0.015397660434246063,
-0.05685054510831833,
-0.040579672902822495,
-0.037958044558763504,
-0.05007565766572952,
0.0070669762790203094,
-0.02903508022427559,
-0.09379157423973083,
-0.0006022521411068738,
0.07378438115119934,
-0.0461266003549099,
-0.03415267914533615,
0.06682056188583374,
0.012760498560965061,
0.023886477574706078,
-0.09295956045389175,
-0.048385217785835266,
-0.08359785377979279,
-0.11994599550962448,
0.02051224559545517,
0.06752845644950867,
0.0008743139333091676,
0.061414092779159546,
-0.029985781759023666,
0.07983781397342682,
-0.11656360328197479,
0.026392998173832893,
-0.05863850563764572,
-5.55783401523513e-8,
0.016587933525443077,
-0.0059402999468147755,
0.05569462478160858,
-0.013992217369377613,
-0.040801264345645905,
0.08082468807697296,
0.05148875340819359,
-0.031733546406030655,
-0.00455935625359416,
0.05643849819898605,
0.09788262099027634,
-0.07432735711336136,
0.016317196190357208,
-0.023302190005779266,
0.01877353899180889,
0.04158703610301018,
0.007104231510311365,
0.07588924467563629,
-0.05041194334626198,
0.009352730587124825,
0.025664018467068672,
0.00999909546226263,
-0.03396032378077507,
0.0013922543730586767,
0.010781689547002316,
0.012957185506820679,
0.03786048665642738,
0.008283491246402264,
-0.08173371106386185,
-0.0028554159216582775,
-0.050320930778980255,
0.03394322842359543,
-0.018937768414616585,
-0.00336323375813663,
-0.0332266129553318,
0.1436745971441269,
-0.061143890023231506,
0.005189434625208378,
0.049050454050302505,
0.08985716849565506,
-0.009367961436510086,
-0.03776615113019943,
0.029386868700385094,
-0.01372565422207117,
0.0328725166618824,
-0.012864992022514343,
-0.1062183678150177,
0.0526764877140522,
0.043528493493795395,
-0.07840839773416519,
0.02556704171001911,
-0.05846955254673958,
-0.025049792602658272,
0.03990143537521362,
-0.0038169065956026316,
-0.02486596070230007,
-0.0066256751306355,
-0.05697426199913025,
0.009501705877482891,
0.027360545471310616,
0.004508547019213438,
0.06783419102430344,
-0.04941118136048317,
0.017945069819688797
] | 0.115305 |
`-20` (high priority) and `19` (low priority). Due to differences between Unix priority levels and Windows priority classes, `priority` is mapped to one of six priority constants in `os.constants.priority`. When retrieving a process priority level, this range mapping may cause the return value to be slightly different on Windows. To avoid confusion, set `priority` to one of the priority constants. On Windows, setting priority to `PRIORITY\_HIGHEST` requires elevated user privileges. Otherwise the set priority will be silently reduced to `PRIORITY\_HIGH`. ## `os.tmpdir()` \* Returns: {string} Returns the operating system's default directory for temporary files as a string. On Windows, the result can be overridden by `TEMP` and `TMP` environment variables, and `TEMP` takes precedence over `TMP`. If neither is set, it defaults to `%SystemRoot%\temp` or `%windir%\temp`. On non-Windows platforms, `TMPDIR`, `TMP` and `TEMP` environment variables will be checked to override the result of this method, in the described order. If none of them is set, it defaults to `/tmp`. Some operating system distributions would either configure `TMPDIR` (non-Windows) or `TEMP` and `TMP` (Windows) by default without additional configurations by the system administrators. The result of `os.tmpdir()` typically reflects the system preference unless it's explicitly overridden by the users. ## `os.totalmem()` \* Returns: {integer} Returns the total amount of system memory in bytes as an integer. ## `os.type()` \* Returns: {string} Returns the operating system name as returned by [`uname(3)`][]. For example, it returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows\_NT'` on Windows. See for additional information about the output of running [`uname(3)`][] on various operating systems. ## `os.uptime()` \* Returns: {integer} Returns the system uptime in number of seconds. ## `os.userInfo([options])` \* `options` {Object} \* `encoding` {string} Character encoding used to interpret resulting strings. If `encoding` is set to `'buffer'`, the `username`, `shell`, and `homedir` values will be `Buffer` instances. \*\*Default:\*\* `'utf8'`. \* Returns: {Object} Returns information about the currently effective user. On POSIX platforms, this is typically a subset of the password file. The returned object includes the `username`, `uid`, `gid`, `shell`, and `homedir`. On Windows, the `uid` and `gid` fields are `-1`, and `shell` is `null`. The value of `homedir` returned by `os.userInfo()` is provided by the operating system. This differs from the result of `os.homedir()`, which queries environment variables for the home directory before falling back to the operating system response. Throws a [`SystemError`][] if a user has no `username` or `homedir`. ## `os.version()` \* Returns: {string} Returns a string identifying the kernel version. On POSIX systems, the operating system release is determined by calling [`uname(3)`][]. On Windows, `RtlGetVersion()` is used, and if it is not available, `GetVersionExW()` will be used. See for more information. ## OS constants The following constants are exported by `os.constants`. Not all constants will be available on every operating system. ### Signal constants The following signal constants are exported by `os.constants.signals`. | Constant | Description | | --- | --- | | `SIGHUP` | Sent to indicate when a controlling terminal is closed or a parent process exits. | | `SIGINT` | Sent to indicate when a user wishes to interrupt a process (`Ctrl`+`C`). | | `SIGQUIT` | Sent to indicate when a user wishes to terminate a process and perform a core dump. | | `SIGILL` | Sent to a process to notify that it has attempted to perform an illegal, malformed, unknown, or privileged instruction. | | `SIGTRAP` | Sent to a process when an exception has occurred. | | `SIGABRT` | Sent to a process to request that it abort. | | `SIGIOT` | Synonym for `SIGABRT` | | `SIGBUS` | Sent to a process to notify that | https://github.com/nodejs/node/blob/main//doc/api/os.md | main | nodejs | [
-0.04009396582841873,
0.02018028497695923,
-0.05614427104592323,
0.002351585542783141,
0.028904719278216362,
-0.1243855431675911,
0.018147936090826988,
0.1172775849699974,
0.04737216979265213,
0.03970983624458313,
0.06718048453330994,
0.007063900586217642,
-0.016642723232507706,
0.04711946099996567,
-0.021494140848517418,
-0.05161416158080101,
0.03916698694229126,
-0.0801582783460617,
-0.06798526644706726,
-0.027349190786480904,
-0.014922923408448696,
0.03693436458706856,
0.020955068990588188,
-0.013295380398631096,
-0.00666159950196743,
-0.07404203712940216,
-0.10282938927412033,
0.026152487844228745,
0.04393649846315384,
0.04509126394987106,
-0.012936991639435291,
0.0622115395963192,
0.047969963401556015,
-0.045269209891557693,
0.040871623903512955,
0.1097337007522583,
-0.01027990784496069,
-0.09090845286846161,
-0.08729605376720428,
-0.022526178508996964,
-0.014593514613807201,
0.0392025001347065,
-0.05717964842915535,
0.02765130251646042,
-0.05410262197256088,
0.022527575492858887,
0.08419404923915863,
-0.000336585973855108,
-0.12093006819486618,
0.022660354152321815,
-0.04588388651609421,
0.08842626214027405,
-0.031247353181242943,
-0.012903808616101742,
0.03711478412151337,
0.0774986743927002,
0.06623540818691254,
0.03944918140769005,
-0.04895584285259247,
0.01291955541819334,
-0.08623440563678741,
-0.00346482009626925,
-0.0385596826672554,
-0.020813394337892532,
0.07876607775688171,
-0.019901078194379807,
-0.02008538693189621,
-0.018222002312541008,
-0.016399390995502472,
-0.04676784202456474,
-0.021960224956274033,
0.02639196813106537,
-0.006756617687642574,
-0.014605370350182056,
0.010374906472861767,
0.0080881267786026,
0.018953777849674225,
0.03697500005364418,
-0.038892701268196106,
-0.10934661328792572,
0.01632010191679001,
-0.09817911684513092,
-0.04531377553939819,
-0.05578688159584999,
0.006176195107400417,
-0.06279435753822327,
-0.03668216988444328,
0.027042191475629807,
0.13722263276576996,
0.08667651563882828,
0.0351865328848362,
-0.057193733751773834,
0.005425727926194668,
0.04256801679730415,
-0.01390147116035223,
0.07103496044874191,
0.006798554677516222,
0.11765878647565842,
-0.058136966079473495,
-0.030340982601046562,
-0.0755094364285469,
-0.04641195014119148,
-0.0019034092547371984,
0.0631396695971489,
0.08533766865730286,
-0.015409151092171669,
0.005739871878176928,
0.017924604937434196,
0.03613271191716194,
-0.08499143272638321,
-0.023982780054211617,
-0.029383212327957153,
0.033510494977235794,
0.001747584086842835,
0.02616073749959469,
-0.0046170358546078205,
0.025900255888700485,
0.06117258593440056,
-0.01834215223789215,
0.04717252030968666,
-0.025507215410470963,
-0.025982566177845,
0.008799947798252106,
-0.0326535739004612,
0.02411484159529209,
0.04389465972781181,
0.03761555626988411,
3.5888364156222615e-33,
0.053998563438653946,
-0.06910396367311478,
0.05222052335739136,
0.000610114075243473,
0.012640145607292652,
-0.012629352509975433,
-0.010959314182400703,
-0.005155892577022314,
-0.015712719410657883,
0.05006767436861992,
-0.016634801402688026,
0.04551084339618683,
-0.01915869675576687,
0.00009604723891243339,
0.0023871532175689936,
-0.014993543736636639,
0.02204100973904133,
0.014371627941727638,
-0.020700333639979362,
0.01061038114130497,
0.012002496980130672,
0.12654592096805573,
-0.1325288712978363,
-0.08680557459592819,
0.02612249180674553,
0.0021100768353790045,
0.02237984724342823,
-0.03963112831115723,
0.0004155001661274582,
0.005869349930435419,
-0.03367369994521141,
-0.015832575038075447,
-0.018406448885798454,
0.01702358014881611,
0.028439907357096672,
0.06595787405967712,
-0.05277778580784798,
0.08689497411251068,
-0.03260721638798714,
-0.049448296427726746,
0.040621317923069,
0.004480358213186264,
0.008423360995948315,
0.03459214046597481,
0.048299696296453476,
-0.07292156666517258,
-0.025668717920780182,
-0.005429322365671396,
-0.045119840651750565,
0.047765303403139114,
0.031161818653345108,
0.05010610818862915,
0.06988734006881714,
0.0407099649310112,
-0.10358303785324097,
-0.05623199790716171,
0.018894854933023453,
-0.04980815201997757,
-0.006149597931653261,
0.03550355136394501,
0.00019100483041256666,
0.004359508864581585,
-0.0017807948170229793,
-0.005455744918435812,
-0.002500508213415742,
-0.09442253410816193,
0.06849156320095062,
-0.04853685945272446,
0.009169918484985828,
0.11677370220422745,
-0.07754524052143097,
0.04695839434862137,
0.012610794976353645,
0.02480560727417469,
-0.0055108522064983845,
0.05813151225447655,
0.07603029906749725,
-0.06921100616455078,
-0.04964461922645569,
-0.10724668204784393,
-0.07367996126413345,
0.051140621304512024,
0.008663936518132687,
-0.07349104434251785,
0.0009644210804253817,
-0.08207296580076218,
-0.09945321083068848,
0.015077207237482071,
0.03243701159954071,
-0.03198515623807907,
0.07376965880393982,
-0.02192848175764084,
0.015920553356409073,
0.0890449807047844,
-0.05841899290680885,
-4.639723589811586e-33,
0.03402384743094444,
-0.05394148454070091,
0.04885799065232277,
-0.01587415114045143,
-0.07670768350362778,
0.040925487875938416,
-0.01693565398454666,
-0.10125723481178284,
-0.036852724850177765,
-0.04091481491923332,
-0.030501345172524452,
-0.023540083318948746,
0.04760705307126045,
-0.05573355033993721,
0.10221271216869354,
0.04202474653720856,
-0.00210517062805593,
0.019248060882091522,
0.007022795733064413,
-0.0619363971054554,
-0.027418557554483414,
0.06108595058321953,
0.0008967199246399105,
0.07262548059225082,
-0.0599142462015152,
0.011990182101726532,
-0.05300237238407135,
-0.021480558440089226,
0.031628601253032684,
0.03713315725326538,
-0.02710062637925148,
-0.017884941771626472,
-0.05921007692813873,
0.0032977371010929346,
-0.012652324512600899,
0.0012565398355945945,
-0.04487089067697525,
-0.04440368711948395,
0.07491648197174072,
0.08929857611656189,
0.08148420602083206,
-0.02545265294611454,
0.02010864019393921,
0.047739047557115555,
-0.0389452800154686,
0.1309007853269577,
-0.004599762614816427,
-0.12532630562782288,
-0.015370303764939308,
-0.03707803413271904,
0.13616833090782166,
-0.01894359663128853,
0.05603472888469696,
0.06597451120615005,
0.07384616881608963,
-0.008170985616743565,
-0.06675184518098831,
-0.057147782295942307,
-0.06341839581727982,
0.014859058894217014,
0.16100311279296875,
-0.019271699711680412,
-0.06036681309342384,
-0.10345810651779175,
-0.13194967806339264,
0.032867543399333954,
-0.03153730928897858,
-0.019272085279226303,
0.01630265638232231,
-0.038985878229141235,
0.009337945841252804,
-0.0018691333243623376,
-0.028928671032190323,
-0.010664833709597588,
-0.044118814170360565,
0.005520367529243231,
0.07713621109724045,
-0.004705248866230249,
-0.003953632898628712,
0.04203178733587265,
-0.04002615809440613,
0.10698465257883072,
-0.09263712167739868,
-0.0013732489896938205,
-0.06470517814159393,
-0.05182203650474548,
0.0023052245378494263,
0.007307050283998251,
0.04616990685462952,
-0.006073213182389736,
0.003234253730624914,
0.03951461613178253,
-0.0012497460702434182,
0.06774107366800308,
-0.03249417990446091,
-4.959560229167437e-8,
-0.01477003749459982,
-0.08514603227376938,
-0.01021797489374876,
0.07977991551160812,
0.06119341030716896,
0.03096870705485344,
-0.0017655863193795085,
0.04973183199763298,
0.019495610147714615,
0.03731280192732811,
0.07583026587963104,
-0.045507483184337616,
-0.022023452445864677,
-0.08929771184921265,
0.02927420102059841,
-0.02888711355626583,
-0.031779251992702484,
-0.0429861843585968,
-0.024894030764698982,
-0.053406212478876114,
0.028660956770181656,
-0.006292146630585194,
-0.0009451270452700555,
-0.0003846611944027245,
-0.0019032320706173778,
0.006065336521714926,
0.11271388828754425,
0.04161645844578743,
0.003934348002076149,
0.014941619709134102,
-0.051614586263895035,
-0.04523158818483353,
-0.037345606833696365,
0.03435204550623894,
-0.014551466330885887,
0.017431136220693588,
0.011143016628921032,
0.04801604524254799,
0.035073645412921906,
0.029633276164531708,
-0.01221555471420288,
0.02525186911225319,
-0.01956862024962902,
0.029705064371228218,
-0.055803414434194565,
-0.03939957916736603,
-0.07730847597122192,
0.056007515639066696,
-0.005992289632558823,
-0.06006211042404175,
-0.04885023832321167,
0.03507401421666145,
-0.027162978425621986,
0.11371910572052002,
-0.022395789623260498,
0.03203142061829567,
-0.013306593522429466,
-0.015172666870057583,
-0.030225954949855804,
-0.003476963145658374,
0.052644893527030945,
0.04783080145716667,
-0.05106665566563606,
0.0030524854082614183
] | 0.045253 |
illegal, malformed, unknown, or privileged instruction. | | `SIGTRAP` | Sent to a process when an exception has occurred. | | `SIGABRT` | Sent to a process to request that it abort. | | `SIGIOT` | Synonym for `SIGABRT` | | `SIGBUS` | Sent to a process to notify that it has caused a bus error. | | `SIGFPE` | Sent to a process to notify that it has performed an illegal arithmetic operation. | | `SIGKILL` | Sent to a process to terminate it immediately. | | `SIGUSR1` `SIGUSR2` | Sent to a process to identify user-defined conditions. | | `SIGSEGV` | Sent to a process to notify of a segmentation fault. | | `SIGPIPE` | Sent to a process when it has attempted to write to a disconnected pipe. | | `SIGALRM` | Sent to a process when a system timer elapses. | | `SIGTERM` | Sent to a process to request termination. | | `SIGCHLD` | Sent to a process when a child process terminates. | | `SIGSTKFLT` | Sent to a process to indicate a stack fault on a coprocessor. | | `SIGCONT` | Sent to instruct the operating system to continue a paused process. | | `SIGSTOP` | Sent to instruct the operating system to halt a process. | | `SIGTSTP` | Sent to a process to request it to stop. | | `SIGBREAK` | Sent to indicate when a user wishes to interrupt a process. | | `SIGTTIN` | Sent to a process when it reads from the TTY while in the background. | | `SIGTTOU` | Sent to a process when it writes to the TTY while in the background. | | `SIGURG` | Sent to a process when a socket has urgent data to read. | | `SIGXCPU` | Sent to a process when it has exceeded its limit on CPU usage. | | `SIGXFSZ` | Sent to a process when it grows a file larger than the maximum allowed. | | `SIGVTALRM` | Sent to a process when a virtual timer has elapsed. | | `SIGPROF` | Sent to a process when a system timer has elapsed. | | `SIGWINCH` | Sent to a process when the controlling terminal has changed its size. | | `SIGIO` | Sent to a process when I/O is available. | | `SIGPOLL` | Synonym for `SIGIO` | | `SIGLOST` | Sent to a process when a file lock has been lost. | | `SIGPWR` | Sent to a process to notify of a power failure. | | `SIGINFO` | Synonym for `SIGPWR` | | `SIGSYS` | Sent to a process to notify of a bad argument. | | `SIGUNUSED` | Synonym for `SIGSYS` | ### Error constants The following error constants are exported by `os.constants.errno`. #### POSIX error constants | Constant | Description | | --- | --- | | `E2BIG` | Indicates that the list of arguments is longer than expected. | | `EACCES` | Indicates that the operation did not have sufficient permissions. | | `EADDRINUSE` | Indicates that the network address is already in use. | | `EADDRNOTAVAIL` | Indicates that the network address is currently unavailable for use. | | `EAFNOSUPPORT` | Indicates that the network address family is not supported. | | `EAGAIN` | Indicates that there is no data available and to try the operation again later. | | `EALREADY` | Indicates that the socket already has a pending connection in progress. | | `EBADF` | Indicates that a file descriptor is not valid. | | `EBADMSG` | Indicates an invalid data message. | | `EBUSY` | Indicates that | https://github.com/nodejs/node/blob/main//doc/api/os.md | main | nodejs | [
-0.031091224402189255,
-0.0025990097783505917,
0.009514248929917812,
-0.029819246381521225,
-0.02957586757838726,
-0.0910307988524437,
0.0804525688290596,
0.12214506417512894,
0.07173173129558563,
-0.013947970233857632,
0.03523105010390282,
-0.031761959195137024,
-0.00944618321955204,
-0.0419493205845356,
-0.04699384421110153,
-0.04613545909523964,
-0.02787279710173607,
0.014126977883279324,
-0.04541841521859169,
-0.03505350649356842,
0.07789002358913422,
0.03286345303058624,
-0.08001931756734848,
0.05887932330369949,
-0.020991824567317963,
-0.07295186817646027,
-0.06630447506904602,
0.003798558609560132,
0.045714203268289566,
-0.029226787388324738,
-0.009385411627590656,
0.07494178414344788,
0.030669203028082848,
0.010800177231431007,
0.08566111326217651,
0.08231222629547119,
0.0016985366819426417,
-0.08291357010602951,
-0.13894419372081757,
-0.06621184200048447,
0.035462636500597,
-0.05107136070728302,
-0.07642523944377899,
0.0459703654050827,
-0.035154830664396286,
-0.010127536021173,
-0.06251515448093414,
-0.019015245139598846,
-0.15081903338432312,
0.014627042226493359,
-0.09710132330656052,
0.018597859889268875,
0.001531122368760407,
0.09962336719036102,
0.018091989681124687,
-0.09491491317749023,
0.03922038897871971,
0.02484704740345478,
0.009679796174168587,
0.06649067997932434,
-0.025147441774606705,
0.05839269980788231,
-0.030739419162273407,
-0.02927987091243267,
-0.029055969789624214,
0.08607159554958344,
0.0742127001285553,
-0.0446992851793766,
0.050469718873500824,
0.07587439566850662,
-0.03540757670998573,
-0.04243466258049011,
-0.1390746533870697,
0.09209807217121124,
-0.04315105453133583,
-0.00870189443230629,
-0.0028220280073583126,
-0.032392218708992004,
-0.004687669221311808,
-0.12216281145811081,
-0.08108779788017273,
0.03136251121759415,
0.016712907701730728,
-0.09603670984506607,
0.038403499871492386,
0.03338491544127464,
-0.09516744315624237,
0.04136795923113823,
0.14356771111488342,
-0.06469456106424332,
-0.04127781093120575,
0.01856854185461998,
0.019768446683883667,
0.0332183912396431,
0.0887075811624527,
-0.002735755406320095,
0.03140142560005188,
-0.09288633614778519,
-0.026887746527791023,
0.004403011407703161,
0.0015284405089914799,
0.07166335731744766,
-0.025607163086533546,
0.012704960070550442,
0.032086100429296494,
0.0448172353208065,
-0.01344628632068634,
0.029721811413764954,
-0.019003793597221375,
-0.08665023744106293,
-0.0034493408165872097,
0.0029098910745233297,
0.0832957774400711,
-0.02930215187370777,
0.01900617592036724,
0.037634894251823425,
0.01889968290925026,
0.0485946387052536,
0.06470062583684921,
0.030329817906022072,
-0.01593755930662155,
-0.035091955214738846,
-0.06238279491662979,
-0.009592157788574696,
-0.022446313872933388,
-0.017927153035998344,
-0.008559894748032093,
5.43928878609816e-34,
-0.018441347405314445,
-0.01293251570314169,
-0.0647672563791275,
-0.0075013902969658375,
-0.004402239341288805,
0.008824317716062069,
-0.04655022174119949,
0.0015890842769294977,
-0.018803795799613,
0.04381769150495529,
-0.017431655898690224,
-0.09320296347141266,
-0.017942504957318306,
0.051439955830574036,
0.13490912318229675,
-0.018796587362885475,
0.08726230263710022,
0.0030231827404350042,
0.009155101142823696,
-0.016258761286735535,
0.062323883175849915,
0.049329083412885666,
-0.06690163910388947,
0.013365835882723331,
0.09832481294870377,
0.08288024365901947,
-0.0796545147895813,
0.02133803255856037,
0.04734383150935173,
0.02816213108599186,
0.0006031775265000761,
-0.02777826599776745,
-0.004296623170375824,
0.024344615638256073,
0.01361845899373293,
-0.09610473364591599,
0.003188865724951029,
0.01171098928898573,
0.0022278819233179092,
-0.04331960529088974,
-0.029176611453294754,
0.01845625229179859,
-0.023098552599549294,
-0.02764979563653469,
0.07128990441560745,
-0.05776600167155266,
-0.05542438477277756,
0.01003379374742508,
0.0967501699924469,
-0.06639241427183151,
0.03424239158630371,
0.007000576239079237,
0.05328860133886337,
0.01989929750561714,
0.004734217654913664,
0.05205482617020607,
0.006600441411137581,
-0.0006241090013645589,
-0.01053224503993988,
0.04970327764749527,
0.03501308336853981,
0.01973913609981537,
0.053817667067050934,
0.01927207224071026,
0.032824624329805374,
-0.08599524945020676,
-0.016396859660744667,
0.054978206753730774,
-0.02975776605308056,
-0.0026726271025836468,
-0.1376168429851532,
0.0398888923227787,
-0.001194540411233902,
0.050978485494852066,
-0.036490991711616516,
-0.08060247451066971,
0.0009997048182412982,
-0.04639206826686859,
-0.02589685469865799,
-0.008608289062976837,
-0.006198613904416561,
0.0013677719980478287,
-0.029611356556415558,
-0.07791715115308762,
-0.028534337878227234,
-0.010920585133135319,
-0.0259238351136446,
0.015342800877988338,
-0.08068377524614334,
0.04195330664515495,
-0.03159016743302345,
0.020589351654052734,
-0.00570093747228384,
0.07911083847284317,
-0.1158561035990715,
-3.385595279075011e-33,
-0.04099268466234207,
0.06533287465572357,
0.0048228297382593155,
0.043560732156038284,
-0.06427846848964691,
-0.004626666195690632,
0.015776513144373894,
-0.09097760170698166,
-0.01956077665090561,
-0.04163742437958717,
-0.042492471635341644,
0.0038545457646250725,
-0.03349796310067177,
-0.04774283245205879,
-0.020255832001566887,
-0.03929515182971954,
0.014227572828531265,
-0.011113114655017853,
-0.0646655336022377,
0.05701466649770737,
-0.03386029973626137,
0.012674340046942234,
-0.04248369485139847,
-0.0006048291106708348,
-0.03927446901798248,
0.021958624944090843,
-0.006046527996659279,
0.03366270288825035,
-0.0764722153544426,
0.053115714341402054,
0.06756029278039932,
-0.01894467882812023,
-0.031263578683137894,
0.00534131471067667,
0.008555577136576176,
-0.09379192441701889,
0.08945710957050323,
0.04486774280667305,
0.005587270483374596,
-0.0759502425789833,
0.10659550130367279,
0.03335785120725632,
0.05597468465566635,
0.08331466466188431,
-0.01823428086936474,
0.03851770982146263,
0.06126202642917633,
-0.07398927211761475,
-0.03350990265607834,
-0.017747586593031883,
0.015066863968968391,
-0.06702983379364014,
0.008442124351859093,
0.07048842310905457,
-0.039287783205509186,
-0.01277545839548111,
0.04600507766008377,
-0.03568234667181969,
-0.12998901307582855,
-0.040935661643743515,
0.006932113319635391,
-0.06852521002292633,
0.05328098312020302,
-0.021006828173995018,
0.06913024187088013,
0.035705894231796265,
-0.0051851882599294186,
0.020473100244998932,
0.09689248353242874,
-0.053125590085983276,
0.1014261320233345,
0.07174929231405258,
-0.0521911084651947,
0.010190090164542198,
-0.025120943784713745,
-0.015697350725531578,
-0.07151255011558533,
-0.03595414757728577,
-0.028565313667058945,
-0.052568890154361725,
0.013186587020754814,
-0.003357889363542199,
-0.0032012462615966797,
0.029079534113407135,
-0.03826572000980377,
-0.04687229171395302,
0.004798082169145346,
0.09067820757627487,
0.0665321871638298,
-0.06217046454548836,
-0.04966479539871216,
0.038468729704618454,
-0.0012217883486300707,
0.01641853339970112,
0.004469357896596193,
-4.752992666112732e-8,
0.011129590682685375,
-0.04569801688194275,
-0.05609077215194702,
-0.043950289487838745,
0.04582139104604721,
-0.030986756086349487,
-0.07953540980815887,
-0.024502597749233246,
-0.02297941967844963,
0.026676783338189125,
-0.06799288094043732,
0.03239474818110466,
-0.10994382202625275,
-0.060169365257024765,
0.09095249325037003,
-0.052652519196271896,
0.03448551148176193,
0.010591755621135235,
-0.022077031433582306,
-0.02684871293604374,
0.01501100230962038,
0.0341033935546875,
-0.0038787920493632555,
-0.003945506643503904,
-0.023492923006415367,
-0.042917534708976746,
0.007698665838688612,
0.05240783467888832,
0.02394329383969307,
0.02593200094997883,
0.039080359041690826,
-0.0094566335901618,
0.03420725092291832,
0.05029599741101265,
0.02077186293900013,
0.07430408149957657,
0.002809061435982585,
-0.005933653563261032,
0.056019507348537445,
-0.04376966133713722,
0.06383728235960007,
0.07780035585165024,
-0.01846456341445446,
0.025264674797654152,
0.037045918405056,
-0.004571584518998861,
-0.051310569047927856,
-0.03829866275191307,
0.005576050840318203,
0.024395685642957687,
-0.008468642830848694,
-0.024164944887161255,
-0.024648450314998627,
0.13432028889656067,
-0.024253051728010178,
-0.01827390305697918,
-0.03286350890994072,
-0.033830758184194565,
0.030645867809653282,
0.05197775736451149,
0.11712878197431564,
0.026278384029865265,
0.025703225284814835,
0.005577565170824528
] | 0.278651 |
available and to try the operation again later. | | `EALREADY` | Indicates that the socket already has a pending connection in progress. | | `EBADF` | Indicates that a file descriptor is not valid. | | `EBADMSG` | Indicates an invalid data message. | | `EBUSY` | Indicates that a device or resource is busy. | | `ECANCELED` | Indicates that an operation was canceled. | | `ECHILD` | Indicates that there are no child processes. | | `ECONNABORTED` | Indicates that the network connection has been aborted. | | `ECONNREFUSED` | Indicates that the network connection has been refused. | | `ECONNRESET` | Indicates that the network connection has been reset. | | `EDEADLK` | Indicates that a resource deadlock has been avoided. | | `EDESTADDRREQ` | Indicates that a destination address is required. | | `EDOM` | Indicates that an argument is out of the domain of the function. | | `EDQUOT` | Indicates that the disk quota has been exceeded. | | `EEXIST` | Indicates that the file already exists. | | `EFAULT` | Indicates an invalid pointer address. | | `EFBIG` | Indicates that the file is too large. | | `EHOSTUNREACH` | Indicates that the host is unreachable. | | `EIDRM` | Indicates that the identifier has been removed. | | `EILSEQ` | Indicates an illegal byte sequence. | | `EINPROGRESS` | Indicates that an operation is already in progress. | | `EINTR` | Indicates that a function call was interrupted. | | `EINVAL` | Indicates that an invalid argument was provided. | | `EIO` | Indicates an otherwise unspecified I/O error. | | `EISCONN` | Indicates that the socket is connected. | | `EISDIR` | Indicates that the path is a directory. | | `ELOOP` | Indicates too many levels of symbolic links in a path. | | `EMFILE` | Indicates that there are too many open files. | | `EMLINK` | Indicates that there are too many hard links to a file. | | `EMSGSIZE` | Indicates that the provided message is too long. | | `EMULTIHOP` | Indicates that a multihop was attempted. | | `ENAMETOOLONG` | Indicates that the filename is too long. | | `ENETDOWN` | Indicates that the network is down. | | `ENETRESET` | Indicates that the connection has been aborted by the network. | | `ENETUNREACH` | Indicates that the network is unreachable. | | `ENFILE` | Indicates too many open files in the system. | | `ENOBUFS` | Indicates that no buffer space is available. | | `ENODATA` | Indicates that no message is available on the stream head read queue. | | `ENODEV` | Indicates that there is no such device. | | `ENOENT` | Indicates that there is no such file or directory. | | `ENOEXEC` | Indicates an exec format error. | | `ENOLCK` | Indicates that there are no locks available. | | `ENOLINK` | Indications that a link has been severed. | | `ENOMEM` | Indicates that there is not enough space. | | `ENOMSG` | Indicates that there is no message of the desired type. | | `ENOPROTOOPT` | Indicates that a given protocol is not available. | | `ENOSPC` | Indicates that there is no space available on the device. | | `ENOSR` | Indicates that there are no stream resources available. | | `ENOSTR` | Indicates that a given resource is not a stream. | | `ENOSYS` | Indicates that a function has not been implemented. | | `ENOTCONN` | Indicates that the socket is not connected. | | `ENOTDIR` | Indicates that the path is not | https://github.com/nodejs/node/blob/main//doc/api/os.md | main | nodejs | [
-0.03864537551999092,
0.021541927009820938,
-0.024918900802731514,
-0.024302083998918533,
0.03678833320736885,
-0.04017334431409836,
-0.011898941360414028,
0.06848274916410446,
-0.005148033145815134,
-0.007871756330132484,
0.09032177180051804,
-0.04595666006207466,
0.0028787555638700724,
-0.07313625514507294,
-0.01396894920617342,
-0.039718713611364365,
-0.008968519978225231,
-0.0837743803858757,
-0.03802625089883804,
-0.04845210164785385,
0.046718206256628036,
-0.0075925057753920555,
-0.03174209222197533,
-0.05747244134545326,
-0.012124924920499325,
-0.004452652297914028,
0.00868563074618578,
0.017106778919696808,
-0.02190585248172283,
-0.052088625729084015,
0.02702781930565834,
-0.03860311210155487,
-0.028174469247460365,
0.0015233317390084267,
0.06580620259046555,
0.03356112167239189,
0.09230253100395203,
-0.02959555573761463,
-0.09678421169519424,
-0.06067973002791405,
0.022124160081148148,
-0.0034549557603895664,
-0.1138366088271141,
-0.003487867070361972,
0.021364260464906693,
-0.02322256565093994,
-0.08733978867530823,
-0.03155653923749924,
-0.06753485649824142,
-0.036188703030347824,
0.0037700559478253126,
0.00928059034049511,
0.011561818420886993,
0.09757397323846817,
0.12982983887195587,
-0.00955317821353674,
0.006409221328794956,
-0.007885534316301346,
-0.003048593644052744,
-0.001482294057495892,
0.030306465923786163,
0.0010362756438553333,
0.003241098253056407,
0.030086297541856766,
-0.029186556115746498,
0.06165177747607231,
0.04259480908513069,
-0.027035672217607498,
-0.03556447848677635,
0.034961432218551636,
-0.058683887124061584,
-0.04606826230883598,
-0.11763841658830643,
0.10094106197357178,
0.03563892841339111,
0.0747680813074112,
0.017792263999581337,
-0.022141674533486366,
0.01950942352414131,
-0.07600157707929611,
-0.08781847357749939,
-0.03301435708999634,
0.012287920340895653,
-0.016050102189183235,
-0.014157186262309551,
0.06303929537534714,
-0.03978968411684036,
-0.033608876168727875,
0.08390329033136368,
0.032140232622623444,
0.06241016462445259,
0.02680005319416523,
-0.003935146611183882,
0.08855737000703812,
0.06251887232065201,
0.0366649255156517,
0.05912536755204201,
0.04974522441625595,
-0.0689517930150032,
0.04784588888287544,
0.008127627894282341,
0.10122093558311462,
-0.05173053592443466,
-0.09058700501918793,
-0.05931971222162247,
-0.023621417582035065,
0.037663862109184265,
0.021935099735856056,
-0.0027710257563740015,
-0.07141800969839096,
-0.02097538486123085,
-0.13763147592544556,
0.0666121318936348,
-0.02591015212237835,
-0.03652811795473099,
0.023056097328662872,
-0.05583895370364189,
0.003793203504756093,
0.009127920493483543,
0.016662001609802246,
0.04589752480387688,
-0.00836677011102438,
0.012300563976168633,
-0.007578169461339712,
0.01105124969035387,
-0.025999262928962708,
0.06271429359912872,
5.526886808792429e-33,
0.046162914484739304,
-0.07560055702924728,
-0.11419574916362762,
0.028389431536197662,
0.04038110375404358,
0.06075843796133995,
-0.04090682044625282,
0.05558081343770027,
-0.07468349486589432,
-0.004051192197948694,
-0.03662430867552757,
0.0015386521117761731,
-0.006712154485285282,
0.00015799151151441038,
0.0024177166633307934,
-0.05983620509505272,
0.07554227113723755,
0.011352388188242912,
-0.015375240705907345,
0.0811057984828949,
0.05947010591626167,
-0.05336396396160126,
-0.0117815425619483,
0.007657848764210939,
0.06663589924573898,
0.026746533811092377,
-0.01785387098789215,
0.03627770394086838,
0.11025053262710571,
0.05569722130894661,
-0.021516526117920876,
-0.09130403399467468,
-0.037119004875421524,
-0.019963158294558525,
-0.007007975596934557,
-0.014351139776408672,
-0.006785201374441385,
-0.00009979950118577108,
-0.05213188752532005,
-0.06901941448450089,
-0.01944354921579361,
-0.027621394023299217,
-0.07233880460262299,
0.008637627586722374,
0.011389190331101418,
-0.05468554422259331,
-0.01656339503824711,
-0.024323826655745506,
0.06455832719802856,
0.07004702091217041,
-0.020569486543536186,
-0.024517880752682686,
0.015479330904781818,
-0.02369062788784504,
0.03891143575310707,
0.05044931545853615,
-0.04607224091887474,
0.06655300408601761,
0.041129570454359055,
-0.0035692062228918076,
0.03879815340042114,
0.09486918896436691,
-0.007904148660600185,
-0.06506185978651047,
0.015569687820971012,
0.04718514531850815,
0.007943502627313137,
-0.06428556889295578,
-0.07490186393260956,
-0.036392565816640854,
-0.09248528629541397,
-0.036961160600185394,
0.07653822749853134,
0.08405394107103348,
-0.043919965624809265,
-0.011432456783950329,
-0.0769919827580452,
-0.00840440858155489,
-0.0948479175567627,
-0.01073339581489563,
-0.07751251012086868,
-0.027140043675899506,
-0.06586096435785294,
-0.03202857822179794,
-0.039527684450149536,
-0.027523642405867577,
-0.039676178246736526,
0.05655551701784134,
-0.05469208210706711,
0.02476816065609455,
0.03503398597240448,
0.025376340374350548,
-0.012975648045539856,
0.02620522491633892,
0.003770091338083148,
-6.829781604698821e-33,
-0.0048580835573375225,
0.05034059286117554,
-0.07025114446878433,
-0.0017912756884470582,
0.002733360743150115,
-0.012016053311526775,
-0.04397820681333542,
0.0758633241057396,
0.031018268316984177,
-0.0716618001461029,
0.008767976425588131,
0.033817850053310394,
0.030713297426700592,
-0.05823773145675659,
-0.032047420740127563,
0.02644190937280655,
-0.05490506440401077,
-0.0007364156190305948,
-0.03272038325667381,
0.08580420166254044,
-0.04257996380329132,
-0.01167292706668377,
0.019544394686818123,
0.03892184793949127,
0.0016061122296378016,
0.14159318804740906,
0.0467696338891983,
-0.0061364565044641495,
-0.08185987174510956,
-0.06882505118846893,
0.08477939665317535,
0.008595706894993782,
-0.06959331780672073,
0.13303746283054352,
-0.043330639600753784,
0.032448917627334595,
0.10298949480056763,
-0.05355505272746086,
-0.0082698380574584,
-0.04440752789378166,
0.13345038890838623,
0.0776548832654953,
-0.05614936351776123,
-0.017109710723161697,
0.0007487056427635252,
0.06757530570030212,
-0.019885296002030373,
-0.015658322721719742,
0.0026729428209364414,
-0.006013724487274885,
0.0780547559261322,
-0.0030008202884346247,
0.024463579058647156,
0.07880183309316635,
0.04715228080749512,
0.010812577791512012,
0.08416082710027695,
-0.004074983298778534,
-0.048830386251211166,
-0.01715451292693615,
0.015593286603689194,
-0.06061612814664841,
0.027345268055796623,
0.03789303079247475,
0.0011131418868899345,
-0.05118250474333763,
-0.020448816940188408,
0.03555548936128616,
0.06349005550146103,
-0.02846759743988514,
0.05365123227238655,
-0.003521511796861887,
-0.016411062330007553,
-0.024418801069259644,
0.03804565593600273,
0.04500025138258934,
-0.0859198346734047,
-0.07889391481876373,
-0.051662806421518326,
0.09469112008810043,
-0.028497524559497833,
0.05152774229645729,
-0.02983972430229187,
0.07595551759004593,
-0.007597056683152914,
0.005148411262780428,
-0.03500905632972717,
0.037325188517570496,
0.04020637273788452,
-0.046210166066884995,
-0.06917306035757065,
-0.013402286916971207,
-0.04714043065905571,
0.10238391160964966,
0.06113810837268829,
-5.2295884955810834e-8,
-0.020922787487506866,
-0.09296819567680359,
0.041247978806495667,
-0.037695109844207764,
0.0947609543800354,
-0.11229254305362701,
-0.03545324504375458,
-0.010389410890638828,
-0.03179921954870224,
0.016668712720274925,
0.046347614377737045,
0.0036974900867789984,
-0.1354191154241562,
-0.03636228293180466,
0.07470537722110748,
-0.032102372497320175,
0.031850073486566544,
0.029924999922513962,
-0.0025693720672279596,
-0.030503269284963608,
0.027435028925538063,
-0.056962013244628906,
-0.02012101747095585,
0.01825379766523838,
0.022763945162296295,
-0.04825291410088539,
0.11366087943315506,
0.03766775503754616,
-0.11461323499679565,
-0.03855055570602417,
-0.08154790103435516,
0.0008377902559004724,
0.06531788408756256,
-0.036480262875556946,
-0.09126034379005432,
0.061714839190244675,
-0.01738833263516426,
0.025646237656474113,
-0.016406269744038582,
0.06063630059361458,
0.010988911613821983,
-0.004861431661993265,
0.0015490768710151315,
-0.018306748941540718,
0.05038457363843918,
0.02193845808506012,
0.01761532947421074,
0.06629382073879242,
-0.009632464498281479,
-0.11618177592754364,
-0.03715210780501366,
-0.06118922680616379,
0.006901110056787729,
0.045339424163103104,
-0.08055084198713303,
-0.025398394092917442,
-0.05659404397010803,
-0.02513743005692959,
0.029767045751214027,
0.05888201296329498,
0.039091724902391434,
0.06595462560653687,
0.04113275930285454,
-0.016361014917492867
] | 0.164476 |
no stream resources available. | | `ENOSTR` | Indicates that a given resource is not a stream. | | `ENOSYS` | Indicates that a function has not been implemented. | | `ENOTCONN` | Indicates that the socket is not connected. | | `ENOTDIR` | Indicates that the path is not a directory. | | `ENOTEMPTY` | Indicates that the directory is not empty. | | `ENOTSOCK` | Indicates that the given item is not a socket. | | `ENOTSUP` | Indicates that a given operation is not supported. | | `ENOTTY` | Indicates an inappropriate I/O control operation. | | `ENXIO` | Indicates no such device or address. | | `EOPNOTSUPP` | Indicates that an operation is not supported on the socket. Although `ENOTSUP` and `EOPNOTSUPP` have the same value on Linux, according to POSIX.1 these error values should be distinct.) | | `EOVERFLOW` | Indicates that a value is too large to be stored in a given data type. | | `EPERM` | Indicates that the operation is not permitted. | | `EPIPE` | Indicates a broken pipe. | | `EPROTO` | Indicates a protocol error. | | `EPROTONOSUPPORT` | Indicates that a protocol is not supported. | | `EPROTOTYPE` | Indicates the wrong type of protocol for a socket. | | `ERANGE` | Indicates that the results are too large. | | `EROFS` | Indicates that the file system is read only. | | `ESPIPE` | Indicates an invalid seek operation. | | `ESRCH` | Indicates that there is no such process. | | `ESTALE` | Indicates that the file handle is stale. | | `ETIME` | Indicates an expired timer. | | `ETIMEDOUT` | Indicates that the connection timed out. | | `ETXTBSY` | Indicates that a text file is busy. | | `EWOULDBLOCK` | Indicates that the operation would block. | | `EXDEV` | Indicates an improper link. | #### Windows-specific error constants The following error codes are specific to the Windows operating system. | Constant | Description | | --- | --- | | `WSAEINTR` | Indicates an interrupted function call. | | `WSAEBADF` | Indicates an invalid file handle. | | `WSAEACCES` | Indicates insufficient permissions to complete the operation. | | `WSAEFAULT` | Indicates an invalid pointer address. | | `WSAEINVAL` | Indicates that an invalid argument was passed. | | `WSAEMFILE` | Indicates that there are too many open files. | | `WSAEWOULDBLOCK` | Indicates that a resource is temporarily unavailable. | | `WSAEINPROGRESS` | Indicates that an operation is currently in progress. | | `WSAEALREADY` | Indicates that an operation is already in progress. | | `WSAENOTSOCK` | Indicates that the resource is not a socket. | | `WSAEDESTADDRREQ` | Indicates that a destination address is required. | | `WSAEMSGSIZE` | Indicates that the message size is too long. | | `WSAEPROTOTYPE` | Indicates the wrong protocol type for the socket. | | `WSAENOPROTOOPT` | Indicates a bad protocol option. | | `WSAEPROTONOSUPPORT` | Indicates that the protocol is not supported. | | `WSAESOCKTNOSUPPORT` | Indicates that the socket type is not supported. | | `WSAEOPNOTSUPP` | Indicates that the operation is not supported. | | `WSAEPFNOSUPPORT` | Indicates that the protocol family is not supported. | | `WSAEAFNOSUPPORT` | Indicates that the address family is not supported. | | `WSAEADDRINUSE` | Indicates that the network address is already in use. | | `WSAEADDRNOTAVAIL` | Indicates that the network address is not available. | | `WSAENETDOWN` | Indicates that the network is down. | | `WSAENETUNREACH` | Indicates that the network is unreachable. | | `WSAENETRESET` | Indicates that the network | https://github.com/nodejs/node/blob/main//doc/api/os.md | main | nodejs | [
-0.022975552827119827,
-0.019924702122807503,
-0.08686262369155884,
-0.04931429401040077,
0.03965503349900246,
-0.07211847603321075,
0.00856994092464447,
0.06991676241159439,
-0.021769434213638306,
0.00557927880436182,
0.08794321864843369,
-0.029990578070282936,
-0.00902879424393177,
-0.054309092462062836,
0.02754780277609825,
0.015828296542167664,
0.03339741751551628,
-0.08257487416267395,
0.007396240718662739,
-0.04250418394804001,
0.05085497349500656,
-0.03760136663913727,
-0.045286793261766434,
0.01998317986726761,
-0.009629196487367153,
0.000659088313113898,
-0.01932886242866516,
0.017700301483273506,
-0.02873891033232212,
-0.057000160217285156,
-0.02300381474196911,
0.03287554159760475,
-0.06398185342550278,
0.028756307438015938,
0.06140163540840149,
0.08982560783624649,
0.08025216311216354,
-0.009522547014057636,
-0.13820120692253113,
-0.05400580167770386,
0.02921050414443016,
-0.018543008714914322,
-0.08807887881994247,
0.009194758720695972,
-0.05188614875078201,
0.010187615640461445,
-0.06654224544763565,
0.0005094879306852818,
-0.11717933416366577,
-0.03501756489276886,
0.005637260153889656,
0.06271102279424667,
-0.02664899453520775,
0.09959742426872253,
0.06912852823734283,
-0.02590535581111908,
-0.07199078053236008,
0.004504015669226646,
-0.024074969813227654,
0.023997634649276733,
0.038372330367565155,
-0.03156139329075813,
-0.004331585951149464,
0.02794620394706726,
-0.027930570766329765,
0.006563947536051273,
0.07263989746570587,
0.021571986377239227,
-0.046511899679899216,
0.018115676939487457,
-0.03219560533761978,
-0.03923425450921059,
-0.11509918421506882,
0.10575319826602936,
-0.016840144991874695,
0.021282149478793144,
0.056650545448064804,
0.007915087975561619,
-0.0775432363152504,
-0.06274059414863586,
-0.024120820686221123,
0.050040606409311295,
-0.05681183934211731,
-0.05057874321937561,
0.015320825390517712,
0.08975706249475479,
-0.04030367359519005,
0.0010672238422557712,
0.04643759876489639,
0.05493849515914917,
-0.0018685978138819337,
-0.028033575043082237,
-0.016532354056835175,
0.052657995373010635,
0.11113116890192032,
0.07710163295269012,
-0.00444146990776062,
0.04053270444273949,
-0.05191997066140175,
0.01259275060147047,
-0.010152784176170826,
0.044318050146102905,
-0.0048754564486444,
-0.027087576687335968,
-0.0036335024051368237,
-0.042773984372615814,
0.048099108040332794,
0.05019419267773628,
-0.008501588366925716,
-0.05157032981514931,
-0.07477841526269913,
-0.1026405617594719,
0.08294981718063354,
-0.011647256091237068,
-0.005825882777571678,
0.008757200092077255,
-0.053341951221227646,
0.011566669680178165,
-0.029069848358631134,
0.06674735993146896,
0.04030667245388031,
-0.02583490125834942,
0.008354934863746166,
0.03018077090382576,
-0.006502730771899223,
-0.0032751308754086494,
0.03228437155485153,
7.344739231171171e-33,
0.02727445587515831,
-0.07391741126775742,
-0.040515314787626266,
0.013639053329825401,
0.04416419565677643,
0.07820196449756622,
0.01421397179365158,
0.035642072558403015,
-0.08145540207624435,
0.025974566116929054,
-0.056910157203674316,
0.04556676000356674,
0.015034858137369156,
0.012006741017103195,
0.06087679788470268,
-0.04466986656188965,
0.02908063679933548,
0.06792167574167252,
0.021436993032693863,
0.030508460476994514,
0.03464468941092491,
-0.022190112620592117,
-0.07974369078874588,
-0.03220486268401146,
0.005771985277533531,
0.01952948048710823,
-0.01615404710173607,
-0.048856765031814575,
0.06961503624916077,
0.012193355709314346,
0.031790874898433685,
-0.03390401229262352,
0.01010377611964941,
-0.03724753484129906,
0.05043712630867958,
-0.06678970903158188,
0.02427874505519867,
-0.018858974799513817,
-0.0484602116048336,
-0.08441413193941116,
-0.017889343202114105,
0.055883072316646576,
-0.08123431354761124,
0.008212749846279621,
-0.015623084269464016,
-0.11378734558820724,
-0.04650578647851944,
-0.007152075879275799,
0.026774249970912933,
-0.03968890756368637,
0.07333043217658997,
-0.006548114586621523,
-0.0030606924556195736,
-0.00540370075032115,
0.08356636017560959,
0.03303778916597366,
-0.006900126114487648,
0.07580095529556274,
-0.0014147121692076325,
0.03919796273112297,
-0.031152233481407166,
0.0760679841041565,
0.04134755954146385,
-0.1205873116850853,
0.047948334366083145,
-0.005664740689098835,
-0.048296622931957245,
-0.04660732299089432,
-0.012713829055428505,
0.025399835780262947,
-0.0861678272485733,
-0.01609114743769169,
0.014933409169316292,
0.14072754979133606,
0.01874450594186783,
0.015176627784967422,
-0.0791647732257843,
-0.03741588816046715,
-0.1020074412226677,
0.028287600725889206,
-0.044210392981767654,
-0.01164503488689661,
-0.02909720689058304,
0.05374132841825485,
0.03347966447472572,
-0.04717985913157463,
-0.06437079608440399,
-0.011044584214687347,
-0.038140133023262024,
0.031060360372066498,
0.060376591980457306,
0.06781066954135895,
0.05808863416314125,
-0.02186361700296402,
-0.052036769688129425,
-8.025050709237816e-33,
-0.011735617183148861,
0.05189204588532448,
-0.04291496425867081,
-0.021482912823557854,
-0.012330879457294941,
0.06803374737501144,
-0.0070298234932124615,
0.0011255800491198897,
0.02863670513033867,
-0.05883265659213066,
-0.03589433804154396,
0.02707129903137684,
0.08638479560613632,
-0.05641481652855873,
0.018639005720615387,
-0.01359427347779274,
-0.0702769011259079,
-0.05358664318919182,
-0.00817229226231575,
-0.000974974303971976,
-0.07940603047609329,
0.008065463043749332,
0.06858772784471512,
-0.0043055093847215176,
-0.02396918460726738,
0.1197381392121315,
0.005843509454280138,
0.017126183956861496,
-0.10949016362428665,
-0.03606564179062843,
0.049693092703819275,
-0.06266120821237564,
-0.06605252623558044,
0.10986921191215515,
-0.0474337562918663,
0.032520078122615814,
0.037424348294734955,
-0.009232668206095695,
-0.014349425211548805,
-0.05856848880648613,
0.10489465296268463,
0.09871123731136322,
-0.004545820876955986,
-0.030443686991930008,
-0.0353749580681324,
-0.00402807304635644,
-0.051498234272003174,
-0.021725138649344444,
-0.03638436272740364,
-0.0026219584979116917,
0.066400445997715,
-0.024732710793614388,
-0.0239204540848732,
0.057799965143203735,
0.0618245005607605,
-0.007614527363330126,
0.014787218533456326,
0.012669784016907215,
-0.07371882349252701,
-0.03113129734992981,
0.07447387278079987,
-0.08392171561717987,
-0.03993445262312889,
0.05076763406395912,
-0.02148330956697464,
-0.0416707843542099,
-0.0122552290558815,
0.018732942640781403,
0.017266826704144478,
-0.09247767180204391,
0.06243061274290085,
-0.05387543886899948,
-0.007217953447252512,
-0.0019019204191863537,
0.06358201801776886,
0.06024934723973274,
-0.06353410333395004,
-0.09649801254272461,
-0.03656793013215065,
0.05308251455426216,
-0.1367236226797104,
0.10209430754184723,
-0.08765347301959991,
0.10416354238986969,
-0.0015854870434850454,
0.0016566615086048841,
-0.02633015438914299,
0.014302870258688927,
0.041210439056158066,
-0.052779991179704666,
0.014987125061452389,
0.041532035917043686,
-0.062008731067180634,
0.1359991580247879,
0.0666414275765419,
-5.471550679203574e-8,
0.01576446369290352,
-0.11971420049667358,
0.003831571899354458,
-0.006916526705026627,
0.012345702387392521,
-0.08961863815784454,
0.018771173432469368,
-0.037180617451667786,
0.028078436851501465,
0.010199056938290596,
0.04148459434509277,
-0.023510878905653954,
-0.05777360498905182,
-0.02992742508649826,
0.13510066270828247,
-0.06006636470556259,
0.07078764587640762,
0.03675161302089691,
-0.03629910573363304,
-0.06164572015404701,
0.011751228012144566,
-0.029690081253647804,
-0.046578217297792435,
0.05805320665240288,
-0.005144590511918068,
-0.052680034190416336,
0.11739833652973175,
0.013274415396153927,
-0.06457296013832092,
-0.008294353261590004,
-0.0025325368624180555,
-0.03568661957979202,
0.06943292170763016,
0.02064247615635395,
-0.012726014479994774,
0.0816381499171257,
-0.04613082483410835,
0.07506559789180756,
-0.02633882686495781,
0.08040934801101685,
0.004112846218049526,
-0.00030464711016975343,
-0.02538929507136345,
-0.008429786190390587,
0.010879899375140667,
0.035440195351839066,
0.012925221584737301,
0.05677271634340286,
-0.05733611062169075,
-0.020426787436008453,
-0.03803551569581032,
-0.010359671898186207,
0.0488215796649456,
0.03258772939443588,
-0.009843888692557812,
-0.020862415432929993,
-0.05567817762494087,
-0.028709188103675842,
0.04934399574995041,
0.01568359136581421,
-0.0005620429292321205,
0.09612239897251129,
0.015061571262776852,
0.027439909055829048
] | 0.240742 |
| Indicates that the network address is already in use. | | `WSAEADDRNOTAVAIL` | Indicates that the network address is not available. | | `WSAENETDOWN` | Indicates that the network is down. | | `WSAENETUNREACH` | Indicates that the network is unreachable. | | `WSAENETRESET` | Indicates that the network connection has been reset. | | `WSAECONNABORTED` | Indicates that the connection has been aborted. | | `WSAECONNRESET` | Indicates that the connection has been reset by the peer. | | `WSAENOBUFS` | Indicates that there is no buffer space available. | | `WSAEISCONN` | Indicates that the socket is already connected. | | `WSAENOTCONN` | Indicates that the socket is not connected. | | `WSAESHUTDOWN` | Indicates that data cannot be sent after the socket has been shutdown. | | `WSAETOOMANYREFS` | Indicates that there are too many references. | | `WSAETIMEDOUT` | Indicates that the connection has timed out. | | `WSAECONNREFUSED` | Indicates that the connection has been refused. | | `WSAELOOP` | Indicates that a name cannot be translated. | | `WSAENAMETOOLONG` | Indicates that a name was too long. | | `WSAEHOSTDOWN` | Indicates that a network host is down. | | `WSAEHOSTUNREACH` | Indicates that there is no route to a network host. | | `WSAENOTEMPTY` | Indicates that the directory is not empty. | | `WSAEPROCLIM` | Indicates that there are too many processes. | | `WSAEUSERS` | Indicates that the user quota has been exceeded. | | `WSAEDQUOT` | Indicates that the disk quota has been exceeded. | | `WSAESTALE` | Indicates a stale file handle reference. | | `WSAEREMOTE` | Indicates that the item is remote. | | `WSASYSNOTREADY` | Indicates that the network subsystem is not ready. | | `WSAVERNOTSUPPORTED` | Indicates that the `winsock.dll` version is out of range. | | `WSANOTINITIALISED` | Indicates that successful WSAStartup has not yet been performed. | | `WSAEDISCON` | Indicates that a graceful shutdown is in progress. | | `WSAENOMORE` | Indicates that there are no more results. | | `WSAECANCELLED` | Indicates that an operation has been canceled. | | `WSAEINVALIDPROCTABLE` | Indicates that the procedure call table is invalid. | | `WSAEINVALIDPROVIDER` | Indicates an invalid service provider. | | `WSAEPROVIDERFAILEDINIT` | Indicates that the service provider failed to initialized. | | `WSASYSCALLFAILURE` | Indicates a system call failure. | | `WSASERVICE_NOT_FOUND` | Indicates that a service was not found. | | `WSATYPE_NOT_FOUND` | Indicates that a class type was not found. | | `WSA_E_NO_MORE` | Indicates that there are no more results. | | `WSA_E_CANCELLED` | Indicates that the call was canceled. | | `WSAEREFUSED` | Indicates that a database query was refused. | ### dlopen constants If available on the operating system, the following constants are exported in `os.constants.dlopen`. See dlopen(3) for detailed information. | Constant | Description | | --- | --- | | `RTLD_LAZY` | Perform lazy binding. Node.js sets this flag by default. | | `RTLD_NOW` | Resolve all undefined symbols in the library before dlopen(3) returns. | | `RTLD_GLOBAL` | Symbols defined by the library will be made available for symbol resolution of subsequently loaded libraries. | | `RTLD_LOCAL` | The converse of `RTLD_GLOBAL`. This is the default behavior if neither flag is specified. | | `RTLD_DEEPBIND` | Make a self-contained library use its own symbols in preference to symbols from previously loaded libraries. | ### Priority constants The following process scheduling constants are exported by `os.constants.priority`. | Constant | Description | | --- | --- | | `PRIORITY_LOW` | The lowest process scheduling priority. This corresponds to `IDLE_PRIORITY_CLASS` on Windows, and a nice | https://github.com/nodejs/node/blob/main//doc/api/os.md | main | nodejs | [
-0.026838045567274094,
-0.021602991968393326,
-0.08626232296228409,
0.02059750445187092,
0.006497100926935673,
0.010377111844718456,
-0.0004563596157822758,
0.001214147312566638,
0.010473402217030525,
-0.020810022950172424,
0.08738818019628525,
0.006481061689555645,
-0.018481485545635223,
-0.05618425831198692,
-0.05621086806058884,
0.03291783854365349,
-0.014114621095359325,
-0.07409761846065521,
-0.013824710622429848,
-0.021742509678006172,
0.06323722749948502,
-0.0012709222501143813,
-0.0018155702855437994,
-0.03126927837729454,
0.02915738895535469,
0.014087158255279064,
-0.011664112098515034,
0.01393214799463749,
0.0051266103982925415,
0.11076684296131134,
-0.06051041558384895,
-0.01029506977647543,
-0.048852190375328064,
-0.020011750981211662,
0.08863865584135056,
0.02742690220475197,
0.10304723680019379,
0.06074666976928711,
-0.057720690965652466,
-0.04615210369229317,
0.026796244084835052,
-0.019626401364803314,
-0.05132747069001198,
0.06569978594779968,
-0.05442477762699127,
0.017279695719480515,
-0.10579917579889297,
0.02858644723892212,
-0.08791327476501465,
0.004841105546802282,
0.0008366395486518741,
-0.017355984076857567,
-0.014704103581607342,
0.12824581563472748,
0.08242814242839813,
-0.02242635376751423,
-0.02932986244559288,
0.016841167584061623,
0.027471216395497322,
-0.020267048850655556,
-0.014850815758109093,
-0.04161255806684494,
0.00006045435293344781,
-0.013010849244892597,
-0.006759014446288347,
0.0559394508600235,
-0.027667975053191185,
0.027301913127303123,
0.014188231900334358,
0.015398279763758183,
-0.09816897660493851,
0.05323607847094536,
-0.07821346074342728,
0.026767296716570854,
-0.04150715470314026,
0.05831151455640793,
0.07711800932884216,
0.010335950180888176,
0.0010935177560895681,
-0.11488374322652817,
-0.017256785184144974,
-0.026499420404434204,
-0.002625020919367671,
0.0552619993686676,
-0.002539578592404723,
0.06564918905496597,
-0.07988487929105759,
-0.049569327384233475,
0.0516132153570652,
0.03192666172981262,
-0.012418818660080433,
0.027383092790842056,
-0.005189075600355864,
0.028092049062252045,
0.005472199525684118,
0.017822472378611565,
0.08427048474550247,
0.050205688923597336,
-0.0795845314860344,
0.07221672683954239,
0.008028817363083363,
-0.027862710878252983,
0.04178285971283913,
-0.06753387302160263,
-0.05931492894887924,
-0.02065345086157322,
-0.010750079527497292,
-0.00902640726417303,
0.01162315346300602,
-0.06340736895799637,
-0.03134671598672867,
0.008939549326896667,
0.03928455710411072,
-0.0003655933542177081,
0.0050507900305092335,
0.015909727662801743,
-0.013645549304783344,
-0.009226900525391102,
-0.011670774780213833,
-0.03619863837957382,
0.02348680980503559,
0.002205575816333294,
0.05124184116721153,
-0.13988527655601501,
-0.01675059273838997,
-0.014449047856032848,
0.07801440358161926,
6.007199310668185e-33,
0.11457864940166473,
-0.013443666510283947,
-0.08713863044977188,
0.08754509687423706,
0.07166813313961029,
0.008022408932447433,
-0.03682795539498329,
0.002957980614155531,
-0.02652372047305107,
0.01672201044857502,
-0.03320341184735298,
-0.04226080700755119,
-0.0188086349517107,
-0.05433318763971329,
0.016319703310728073,
-0.02666790783405304,
0.11899913102388382,
0.010456175543367863,
0.02958216331899166,
0.09005830436944962,
0.04102485999464989,
-0.023930203169584274,
-0.0010109326103702188,
0.04053598642349243,
0.08631490170955658,
0.042226966470479965,
-0.04369073733687401,
0.041725870221853256,
-0.020935647189617157,
0.025725500658154488,
-0.022655675187706947,
-0.04422733932733536,
-0.03543967008590698,
-0.10259077697992325,
0.004650009796023369,
-0.00893360935151577,
-0.04520651698112488,
-0.08012998104095459,
-0.024597899988293648,
-0.12651072442531586,
-0.06777975708246231,
-0.09527672827243805,
-0.06600137054920197,
0.014590082690119743,
0.09694742411375046,
-0.09686235338449478,
-0.0004394760762806982,
-0.05472339317202568,
0.030807577073574066,
0.11826825886964798,
-0.014311276376247406,
0.021054696291685104,
0.010356536135077477,
0.0024533704854547977,
0.011694202199578285,
0.02268534153699875,
0.011201830580830574,
0.04890977218747139,
0.011418354697525501,
0.034653764218091965,
0.021670717746019363,
0.0020385661628097296,
-0.017212780192494392,
-0.0687001645565033,
0.04958251491189003,
0.02632291242480278,
-0.02949114516377449,
-0.022212401032447815,
-0.06999020278453827,
0.03428404778242111,
-0.054953575134277344,
0.013846125453710556,
0.01067360583692789,
0.10795070230960846,
-0.07616394758224487,
0.009850102476775646,
-0.04216757416725159,
0.013608500361442566,
-0.10552623122930527,
-0.0047616418451070786,
0.008865230716764927,
0.04044720157980919,
0.0015353779308497906,
-0.04262123256921768,
-0.040564920753240585,
0.006769715808331966,
-0.01229685265570879,
-0.08306225389242172,
-0.12305846810340881,
0.00011982061550952494,
0.020973552018404007,
0.06303729861974716,
0.031562287360429764,
-0.01518934965133667,
-0.015295053832232952,
-7.285884433077407e-33,
-0.017244597896933556,
0.06521127372980118,
-0.008337770588696003,
-0.06172961741685867,
-0.07027632743120193,
-0.03732447698712349,
-0.09445416182279587,
0.02766134962439537,
-0.03558345511555672,
-0.08752387017011642,
0.07336178421974182,
-0.018255561590194702,
-0.04054646193981171,
-0.0554802305996418,
-0.03767044097185135,
0.03501258045434952,
-0.000016006142686819658,
-0.038920532912015915,
0.01006667222827673,
0.06484384834766388,
0.07373826205730438,
-0.024842027574777603,
0.029124552384018898,
-0.033421874046325684,
-0.046109624207019806,
0.0217732023447752,
0.07913186401128769,
0.026419557631015778,
-0.05979510024189949,
-0.041956059634685516,
0.08470691740512848,
-0.011061642318964005,
0.020745085552334785,
0.08956559002399445,
0.02795279584825039,
0.01370937842875719,
0.03534231334924698,
-0.06997252255678177,
-0.027153318747878075,
-0.026583759114146233,
0.1716044396162033,
0.08092750608921051,
-0.06840922683477402,
-0.02812257781624794,
-0.043204642832279205,
0.04738252982497215,
-0.043355006724596024,
-0.07444417476654053,
-0.04400445893406868,
0.012706344947218895,
0.11298590153455734,
-0.05262976139783859,
0.009318441152572632,
0.09442098438739777,
0.03273069113492966,
0.026856720447540283,
0.038936030119657516,
0.007087769918143749,
0.00945682730525732,
-0.048455629497766495,
0.03444131836295128,
-0.10507183521986008,
-0.02040884830057621,
0.13666225969791412,
0.0361451618373394,
-0.028991026803851128,
-0.0054811518639326096,
0.042045123875141144,
-0.0001858699251897633,
-0.015524459071457386,
-0.0065492307767271996,
-0.03570333868265152,
0.00796639733016491,
-0.011281459592282772,
0.035053007304668427,
0.00944541860371828,
-0.01270891260355711,
-0.06773882359266281,
-0.08095047622919083,
0.054163701832294464,
-0.05618715658783913,
0.062241967767477036,
-0.01771530508995056,
0.0160738043487072,
0.020161094143986702,
0.034187447279691696,
-0.06463179737329483,
0.09163745492696762,
0.017553461715579033,
0.00931220781058073,
-0.0853290855884552,
0.06645913422107697,
-0.006235727574676275,
0.05057935789227486,
0.019629284739494324,
-4.5300804885073376e-8,
-0.07384557276964188,
-0.021736856549978256,
-0.023444823920726776,
-0.07381702214479446,
-0.00722292996942997,
-0.04022267088294029,
-0.039461761713027954,
-0.07681186497211456,
-0.090607188642025,
0.01727336272597313,
0.000286436959868297,
0.03421451151371002,
-0.11708805710077286,
-0.06230093166232109,
0.06681855022907257,
-0.033821139484643936,
-0.06919930130243301,
-0.012114637531340122,
0.02544155903160572,
-0.0030805482529103756,
0.02349662594497204,
-0.009413538500666618,
0.006985681597143412,
0.07442656904459,
0.03841783106327057,
-0.02035333774983883,
0.08445241302251816,
0.05878154933452606,
-0.07688383758068085,
-0.0013100475771352649,
-0.011029811576008797,
0.02066907472908497,
0.10028320550918579,
-0.011877184733748436,
-0.05815689265727997,
0.10091735422611237,
-0.07984327524900436,
-0.0010209456086158752,
0.0032532955519855022,
0.10601489245891571,
0.03088654950261116,
0.003035246627405286,
-0.04512248560786247,
0.012715295888483524,
0.03606657311320305,
0.03188282251358032,
-0.0009648315608501434,
0.09507817029953003,
-0.011982904747128487,
-0.07348556816577911,
-0.08151800185441971,
-0.02423074282705784,
0.04781799390912056,
0.022134074941277504,
-0.10150223225355148,
-0.014718363992869854,
0.030554816126823425,
0.009653141722083092,
0.0010862412163987756,
-0.005333274137228727,
0.026917867362499237,
0.04290798306465149,
-0.008369486778974533,
-0.02587144263088703
] | 0.069546 |
own symbols in preference to symbols from previously loaded libraries. | ### Priority constants The following process scheduling constants are exported by `os.constants.priority`. | Constant | Description | | --- | --- | | `PRIORITY_LOW` | The lowest process scheduling priority. This corresponds to `IDLE_PRIORITY_CLASS` on Windows, and a nice value of `19` on all other platforms. | | `PRIORITY_BELOW_NORMAL` | The process scheduling priority above `PRIORITY_LOW` and below `PRIORITY_NORMAL`. This corresponds to `BELOW_NORMAL_PRIORITY_CLASS` on Windows, and a nice value of `10` on all other platforms. | | `PRIORITY_NORMAL` | The default process scheduling priority. This corresponds to `NORMAL_PRIORITY_CLASS` on Windows, and a nice value of `0` on all other platforms. | | `PRIORITY_ABOVE_NORMAL` | The process scheduling priority above `PRIORITY_NORMAL` and below `PRIORITY_HIGH`. This corresponds to `ABOVE_NORMAL_PRIORITY_CLASS` on Windows, and a nice value of `-7` on all other platforms. | | `PRIORITY_HIGH` | The process scheduling priority above `PRIORITY_ABOVE_NORMAL` and below `PRIORITY_HIGHEST`. This corresponds to `HIGH_PRIORITY_CLASS` on Windows, and a nice value of `-14` on all other platforms. | | `PRIORITY_HIGHEST` | The highest process scheduling priority. This corresponds to `REALTIME_PRIORITY_CLASS` on Windows, and a nice value of `-20` on all other platforms. | ### libuv constants | Constant | Description | | --- | --- | | `UV_UDP_REUSEADDR` | | [Android building]: https://github.com/nodejs/node/blob/HEAD/BUILDING.md#android [EUID]: https://en.wikipedia.org/wiki/User\_identifier#Effective\_user\_ID [`SystemError`]: errors.md#class-systemerror [`process.arch`]: process.md#processarch [`process.platform`]: process.md#processplatform [`uname(3)`]: https://linux.die.net/man/3/uname [`uv\_available\_parallelism()`]: https://docs.libuv.org/en/v1.x/misc.html#c.uv\_available\_parallelism | https://github.com/nodejs/node/blob/main//doc/api/os.md | main | nodejs | [
-0.04196013882756233,
0.007208376657217741,
-0.03087007999420166,
0.014578118920326233,
0.0017766961827874184,
-0.050104450434446335,
-0.013233030214905739,
0.06568776816129684,
-0.0367121621966362,
-0.02790777198970318,
0.041874613612890244,
0.03302967548370361,
-0.025579115375876427,
0.02632482349872589,
-0.008892891928553581,
-0.014157094061374664,
0.06851879507303238,
-0.12854138016700745,
-0.13652858138084412,
-0.007465844973921776,
0.08005367964506149,
-0.0066487290896475315,
-0.03221225365996361,
-0.018381865695118904,
0.007808302529156208,
-0.06401342153549194,
-0.059671878814697266,
0.040300436317920685,
0.12552426755428314,
0.027139969170093536,
-0.08300474286079407,
0.01736391894519329,
0.1070966050028801,
-0.004314635414630175,
0.02922211028635502,
0.07599256187677383,
0.013557813130319118,
-0.10768039524555206,
-0.06324654817581177,
-0.021495729684829712,
-0.003959852270781994,
0.0008509426843374968,
-0.049286626279354095,
0.04300582408905029,
-0.07954689860343933,
0.05911083519458771,
-0.022022832185029984,
-0.042458586394786835,
-0.12441448122262955,
-0.023095108568668365,
-0.0061636632308363914,
0.008318125270307064,
-0.06889661401510239,
0.0026753421407192945,
0.06284073740243912,
0.058989267796278,
0.035163942724466324,
-0.04664754122495651,
0.017899679020047188,
0.010492421686649323,
-0.14811453223228455,
0.01528165116906166,
-0.04035208001732826,
0.010679958388209343,
0.010199190117418766,
0.027222374454140663,
-0.012036253698170185,
-0.01166969258338213,
0.019696759060025215,
0.054334819316864014,
-0.0838107094168663,
-0.04110421985387802,
-0.025057513266801834,
-0.04102172330021858,
0.010810328647494316,
0.02220781147480011,
-0.005762571934610605,
0.006349280476570129,
-0.10512875765562057,
-0.13812771439552307,
-0.04459388926625252,
-0.06405124813318253,
-0.024326231330633163,
-0.012096380814909935,
0.07274389266967773,
0.0007965006516315043,
0.009430170059204102,
0.0009606766398064792,
0.12816891074180603,
0.10949075222015381,
0.008756466209888458,
-0.005043484270572662,
0.01471332274377346,
0.07025085389614105,
0.017327938228845596,
0.09078370034694672,
0.06564118713140488,
0.06287702918052673,
-0.08894510567188263,
0.025913001969456673,
-0.02020166628062725,
-0.04344303905963898,
0.08579027652740479,
0.046048860996961594,
0.03036537580192089,
-0.02722405456006527,
-0.014054332859814167,
0.01595057174563408,
-0.023237736895680428,
-0.05600718781352043,
0.012353758327662945,
-0.033932335674762726,
0.010628283955156803,
-0.07240984588861465,
-0.05150773376226425,
0.045211438089609146,
0.04674902558326721,
-0.02086072415113449,
-0.0034144558012485504,
-0.027279719710350037,
-0.03271535784006119,
-0.03116089105606079,
0.0016882236814126372,
-0.047151971608400345,
-0.026649944484233856,
0.02563001960515976,
-0.03819642961025238,
6.6018848414850575e-34,
0.04435485601425171,
-0.06551743298768997,
-0.010505708865821362,
-0.05400753766298294,
-0.03409402072429657,
-0.012633916921913624,
-0.04450732469558716,
-0.0011245403438806534,
-0.00331661244854331,
0.031754232943058014,
0.05488438904285431,
0.060261886566877365,
-0.03826223686337471,
0.01684904471039772,
-0.0033730485010892153,
-0.04467395320534706,
0.11631505191326141,
-0.003795138793066144,
-0.002828705357387662,
0.029318232089281082,
0.033073846250772476,
0.03371595963835716,
-0.11850152164697647,
-0.052053600549697876,
0.07858467102050781,
0.07192045450210571,
0.01828688010573387,
-0.08425966650247574,
0.012806779704988003,
0.002538528060540557,
0.012483865953981876,
-0.012911476194858551,
0.00017631838272791356,
0.005342110060155392,
0.037010904401540756,
0.022376297041773796,
-0.024364151060581207,
0.04619834944605827,
0.026296278461813927,
-0.019568676128983498,
0.007519636768847704,
0.011926939710974693,
-0.02940344251692295,
-0.03121611848473549,
0.08671712130308151,
-0.03807007148861885,
0.006251662503927946,
0.011427551507949829,
0.012826211750507355,
-0.01469770260155201,
-0.007700842805206776,
0.05338318273425102,
0.06717260926961899,
0.03028242662549019,
-0.04293040558695793,
-0.10047884285449982,
0.0724625289440155,
0.021628135815262794,
-0.003698979038745165,
0.06096464395523071,
0.01596718654036522,
0.005359702277928591,
0.01862162910401821,
0.015541918575763702,
0.015577147714793682,
0.017461655661463737,
-0.06634446978569031,
-0.02700202912092209,
0.026328595355153084,
0.08035022765398026,
-0.07235930114984512,
0.02144460566341877,
0.029452208429574966,
0.05915533006191254,
0.035384222865104675,
0.062031351029872894,
0.021967481821775436,
-0.07987435907125473,
-0.06716108322143555,
-0.023651989176869392,
-0.059801746159791946,
0.1400265097618103,
-0.04812418296933174,
-0.08749662339687347,
-0.03849581256508827,
-0.08011635392904282,
-0.04884699359536171,
0.0015749033773317933,
-0.03118632547557354,
-0.028142767027020454,
0.03848174214363098,
-0.010824505239725113,
-0.0072062392719089985,
0.08043453842401505,
-0.10192921757698059,
-1.9601954210427132e-33,
0.06311774253845215,
-0.008822912350296974,
0.02259518764913082,
0.07661257684230804,
-0.028985893353819847,
0.02496357634663582,
0.0067779612727463245,
-0.0704725980758667,
0.010321549139916897,
0.032533712685108185,
-0.0052153426222503185,
0.002314196201041341,
0.05640469491481781,
-0.04207374528050423,
0.051648858934640884,
0.025628583505749702,
-0.06253957748413086,
0.028659895062446594,
0.022869015112519264,
-0.007383446209132671,
-0.02290542982518673,
0.07086378335952759,
-0.03358583524823189,
0.07336609810590744,
0.03141704201698303,
0.021054746583104134,
-0.02922796458005905,
0.014923450537025928,
0.01554760243743658,
-0.019502414390444756,
-0.05347670987248421,
-0.01992768794298172,
-0.027333451434969902,
0.0007483079098165035,
-0.06121987849473953,
-0.039267562329769135,
-0.01780126802623272,
0.010777902789413929,
0.004824398551136255,
0.07586204260587692,
0.07460898160934448,
-0.007173859514296055,
-0.002741726813837886,
0.07809998840093613,
-0.04356267675757408,
0.10144747793674469,
-0.00871332362294197,
-0.16132555902004242,
-0.054204098880290985,
-0.10383088886737823,
0.07471039146184921,
-0.03522839397192001,
0.012531382963061333,
0.07650064677000046,
0.046926096081733704,
0.02236197702586651,
-0.031993184238672256,
0.03968389704823494,
-0.0030008943285793066,
0.019546229392290115,
0.13414360582828522,
-0.0280213113874197,
-0.034597817808389664,
-0.06659882515668869,
-0.06602562218904495,
0.05459580942988396,
-0.016049368306994438,
-0.03453649580478668,
-0.014308067038655281,
-0.0489913634955883,
-0.005397215019911528,
0.02452963963150978,
-0.039525654166936874,
0.00266569503583014,
-0.0941036120057106,
0.010185927152633667,
0.1792629212141037,
0.0280953086912632,
-0.015225492417812347,
0.054546236991882324,
-0.054370928555727005,
0.0543949194252491,
-0.02504543773829937,
0.038741666823625565,
-0.12295202165842056,
-0.007310055661946535,
0.03350204601883888,
0.051218483597040176,
-0.002160061849281192,
-0.011998859234154224,
-0.03820190578699112,
0.041591014713048935,
-0.033160965889692307,
0.09869761765003204,
-0.025457601994276047,
-4.1894761437788475e-8,
-0.0136002441868186,
-0.11714296042919159,
-0.021618677303195,
-0.044457681477069855,
0.057764120399951935,
0.01091944519430399,
0.001676606829278171,
-0.0199752114713192,
-0.017870936542749405,
0.07965351641178131,
0.05427153781056404,
-0.019203366711735725,
-0.045567866414785385,
-0.07868265360593796,
0.045691702514886856,
0.003096875036135316,
-0.026277964934706688,
0.04377928003668785,
-0.018554342910647392,
-0.049949802458286285,
0.021654421463608742,
0.019937045872211456,
-0.007645687088370323,
-0.011174171231687069,
-0.03451366350054741,
-0.02307782880961895,
0.11142632365226746,
0.08241041749715805,
0.015427577309310436,
0.03214999660849571,
-0.035177454352378845,
0.002729809610173106,
0.03454048931598663,
-0.030193397775292397,
-0.023510321974754333,
0.03511618450284004,
-0.06203373521566391,
0.02766043320298195,
0.05757658928632736,
0.07863438874483109,
0.027310295030474663,
-0.078647680580616,
-0.051271554082632065,
0.026896590366959572,
0.028832001611590385,
0.016473663970828056,
-0.09640396386384964,
0.010932675562798977,
-0.02227124199271202,
-0.04211807996034622,
0.00431382330134511,
0.03171253576874733,
0.0026529368478804827,
0.07499399781227112,
-0.04285053536295891,
0.024356506764888763,
0.015676384791731834,
-0.07062147557735443,
-0.03172849863767624,
-0.045008584856987,
0.10356783866882324,
0.022042984142899513,
-0.014040166512131691,
0.028645893558859825
] | 0.092942 |
# SQLite > Stability: 1.1 - Active development. The `node:sqlite` module facilitates working with SQLite databases. To access it: ```mjs import sqlite from 'node:sqlite'; ``` ```cjs const sqlite = require('node:sqlite'); ``` This module is only available under the `node:` scheme. The following example shows the basic usage of the `node:sqlite` module to open an in-memory database, write data to the database, and then read the data back. ```mjs import { DatabaseSync } from 'node:sqlite'; const database = new DatabaseSync(':memory:'); // Execute SQL statements from strings. database.exec(` CREATE TABLE data( key INTEGER PRIMARY KEY, value TEXT ) STRICT `); // Create a prepared statement to insert data into the database. const insert = database.prepare('INSERT INTO data (key, value) VALUES (?, ?)'); // Execute the prepared statement with bound values. insert.run(1, 'hello'); insert.run(2, 'world'); // Create a prepared statement to read data from the database. const query = database.prepare('SELECT \* FROM data ORDER BY key'); // Execute the prepared statement and log the result set. console.log(query.all()); // Prints: [ { key: 1, value: 'hello' }, { key: 2, value: 'world' } ] ``` ```cjs 'use strict'; const { DatabaseSync } = require('node:sqlite'); const database = new DatabaseSync(':memory:'); // Execute SQL statements from strings. database.exec(` CREATE TABLE data( key INTEGER PRIMARY KEY, value TEXT ) STRICT `); // Create a prepared statement to insert data into the database. const insert = database.prepare('INSERT INTO data (key, value) VALUES (?, ?)'); // Execute the prepared statement with bound values. insert.run(1, 'hello'); insert.run(2, 'world'); // Create a prepared statement to read data from the database. const query = database.prepare('SELECT \* FROM data ORDER BY key'); // Execute the prepared statement and log the result set. console.log(query.all()); // Prints: [ { key: 1, value: 'hello' }, { key: 2, value: 'world' } ] ``` ## Class: `DatabaseSync` This class represents a single [connection][] to a SQLite database. All APIs exposed by this class execute synchronously. ### `new DatabaseSync(path[, options])` \* `path` {string | Buffer | URL} The path of the database. A SQLite database can be stored in a file or completely [in memory][]. To use a file-backed database, the path should be a file path. To use an in-memory database, the path should be the special name `':memory:'`. \* `options` {Object} Configuration options for the database connection. The following options are supported: \* `open` {boolean} If `true`, the database is opened by the constructor. When this value is `false`, the database must be opened via the `open()` method. \*\*Default:\*\* `true`. \* `readOnly` {boolean} If `true`, the database is opened in read-only mode. If the database does not exist, opening it will fail. \*\*Default:\*\* `false`. \* `enableForeignKeyConstraints` {boolean} If `true`, foreign key constraints are enabled. This is recommended but can be disabled for compatibility with legacy database schemas. The enforcement of foreign key constraints can be enabled and disabled after opening the database using [`PRAGMA foreign\_keys`][]. \*\*Default:\*\* `true`. \* `enableDoubleQuotedStringLiterals` {boolean} If `true`, SQLite will accept [double-quoted string literals][]. This is not recommended but can be enabled for compatibility with legacy database schemas. \*\*Default:\*\* `false`. \* `allowExtension` {boolean} If `true`, the `loadExtension` SQL function and the `loadExtension()` method are enabled. You can call `enableLoadExtension(false)` later to disable this feature. \*\*Default:\*\* `false`. \* `timeout` {number} The [busy timeout][] in milliseconds. This is the maximum amount of time that SQLite will wait for a database lock to be released before returning an error. \*\*Default:\*\* `0`. \* `readBigInts` {boolean} If `true`, integer fields are read as JavaScript `BigInt` values. If `false`, integer fields are read as JavaScript numbers. \*\*Default:\*\* `false`. \* `returnArrays` {boolean} If `true`, query results are returned as | https://github.com/nodejs/node/blob/main//doc/api/sqlite.md | main | nodejs | [
-0.0019124503014609218,
-0.025738809257745743,
-0.07063732296228409,
0.08803065866231918,
-0.038978591561317444,
-0.04132763296365738,
0.000793804822023958,
0.11040512472391129,
-0.04973659664392471,
0.0159646887332201,
-0.006878864020109177,
0.021800849586725235,
0.049289118498563766,
-0.09590404480695724,
0.004809644538909197,
0.08463743329048157,
-0.040646638721227646,
0.05230013281106949,
0.0023130786139518023,
0.061256859451532364,
-0.03255185857415199,
-0.02656320109963417,
0.09564194828271866,
0.03739484027028084,
0.037554942071437836,
-0.00999370962381363,
0.005822957959026098,
0.04375085607171059,
0.0015764995478093624,
0.025030791759490967,
-0.001698238542303443,
-0.04451210796833038,
-0.06933348625898361,
0.14707587659358978,
-0.04231938347220421,
0.08597566932439804,
-0.0267023928463459,
-0.10880029201507568,
-0.10830341279506683,
-0.05470934510231018,
0.04908328503370285,
0.06208746135234833,
-0.13253946602344513,
0.026473598554730415,
0.06315336376428604,
-0.0442831851541996,
-0.11833889782428741,
0.013266727328300476,
-0.05458654835820198,
0.018229715526103973,
-0.048957955092191696,
0.013895975425839424,
-0.04887176305055618,
-0.005689489655196667,
0.003508717752993107,
0.12731105089187622,
0.034060265868902206,
0.045430462807416916,
-0.0017381565412506461,
0.08273506164550781,
0.03706362098455429,
-0.045666441321372986,
0.09224828332662582,
-0.054210346192121506,
0.04916256666183472,
-0.04521990567445755,
0.0013679758412763476,
0.04816604405641556,
0.061148349195718765,
-0.0649150013923645,
0.00241070706397295,
0.0017732444684952497,
-0.12323461472988129,
0.0058167786337435246,
-0.11112947016954422,
-0.040185388177633286,
0.023954447358846664,
-0.006565019953995943,
-0.030055399984121323,
0.08338563144207001,
-0.0538347028195858,
-0.046905383467674255,
-0.05307435616850853,
-0.005314696114510298,
0.05555473640561104,
0.01785191334784031,
0.059298623353242874,
0.06403981894254684,
-0.013843405060470104,
0.026642905548214912,
-0.010606790892779827,
0.019452271983027458,
-0.08819974213838577,
0.022785170003771782,
-0.014872224070131779,
-0.00577144417911768,
0.11431912332773209,
0.04908953979611397,
0.031671177595853806,
-0.014469128102064133,
0.04923608899116516,
0.04282549396157265,
-0.06558258086442947,
0.06486774981021881,
-0.0012333709746599197,
-0.0974292904138565,
0.10009872913360596,
-0.10903896391391754,
-0.07311935722827911,
-0.03458666428923607,
-0.0008287918171845376,
0.081545390188694,
-0.02167423814535141,
-0.015615898184478283,
-0.03151273354887962,
-0.013043420389294624,
-0.013928411528468132,
-0.019869863986968994,
0.07034586369991302,
0.08226744085550308,
0.04654647782444954,
0.07248181849718094,
-0.058843206614255905,
-0.03324078768491745,
0.015192334540188313,
-0.03236432373523712,
0.026523929089307785,
4.334723213391512e-33,
0.01579875312745571,
-0.02952144481241703,
0.05826064571738243,
0.01823122426867485,
0.017420610412955284,
0.06317730247974396,
-0.009023838676512241,
0.03961425647139549,
-0.10378861427307129,
0.013579820282757282,
-0.020970473065972328,
-0.010779071599245071,
-0.005728090647608042,
-0.03723328933119774,
0.005677907727658749,
-0.023205025121569633,
0.057271964848041534,
-0.0621299222111702,
0.12196438759565353,
0.041376419365406036,
0.01316769327968359,
0.012444034218788147,
0.015342478640377522,
0.04533150792121887,
0.020003294572234154,
-0.029836777597665787,
-0.012498565949499607,
0.07701197266578674,
-0.002971201902255416,
-0.0034446269273757935,
-0.024162279441952705,
0.01704029180109501,
-0.07497327774763107,
-0.015462114475667477,
0.024904966354370117,
0.008421100676059723,
-0.06372310221195221,
-0.009464830160140991,
-0.08175352960824966,
-0.0729501023888588,
-0.012055432423949242,
0.010869910940527916,
-0.024479921907186508,
0.022076206281781197,
-0.11648312956094742,
-0.02595086209475994,
-0.007925285026431084,
-0.0019831315148621798,
0.042082931846380234,
-0.1215742900967598,
-0.08102113753557205,
0.030817387625575066,
-0.060789044946432114,
0.004092485643923283,
0.026791108772158623,
0.05254606530070305,
0.011995681561529636,
-0.07508861273527145,
-0.0063306898809969425,
-0.0034369691275060177,
-0.025944026187062263,
-0.006272861734032631,
0.006928554270416498,
0.012508468702435493,
0.04431411996483803,
0.05943122133612633,
-0.07055707275867462,
-0.0008628113428130746,
0.06836111098527908,
-0.013208175078034401,
0.027207311242818832,
-0.007730393670499325,
0.035826072096824646,
-0.03620312362909317,
-0.03682326152920723,
0.06332924216985703,
-0.07570774853229523,
-0.05527910590171814,
-0.05937958508729935,
-0.007008034735918045,
0.11758098751306534,
-0.06409160792827606,
-0.08340370655059814,
0.02194148674607277,
-0.0004779635928571224,
0.03530677407979965,
-0.04745034500956535,
-0.03878885507583618,
0.033184073865413666,
0.036642637103796005,
0.04355001449584961,
-0.018188130110502243,
0.06358058005571365,
-0.10552380234003067,
-0.07299543917179108,
-6.109300178586717e-33,
0.02135610021650791,
-0.0008492858032695949,
-0.04667847231030464,
0.06745222955942154,
-0.006236387882381678,
-0.03492036461830139,
-0.06567984074354172,
0.011664769612252712,
-0.06927759200334549,
-0.049564868211746216,
-0.03231218829751015,
0.010846651159226894,
0.04443040490150452,
-0.023588716983795166,
0.020752286538481712,
0.08816782385110855,
-0.0329570509493351,
-0.007831727154552937,
0.03587380424141884,
-0.03422798216342926,
-0.01929633878171444,
0.05535850301384926,
0.028163844719529152,
0.00829551462084055,
-0.08015500009059906,
-0.030846238136291504,
-0.06012514606118202,
-0.05170634388923645,
-0.04226372763514519,
-0.06832542270421982,
-0.014087961055338383,
0.004141892306506634,
-0.009121818467974663,
0.03508418798446655,
0.014773611910641193,
-0.09300029277801514,
0.02332133799791336,
0.0010232452768832445,
0.04787975922226906,
0.010849258862435818,
0.03039196878671646,
0.03393087908625603,
0.007194642908871174,
-0.025404898449778557,
0.01318986713886261,
-0.024088356643915176,
-0.04871318116784096,
0.09803283214569092,
0.012000876478850842,
-0.004704185761511326,
-0.01271425373852253,
-0.07677508890628815,
-0.020848648622632027,
-0.045143384486436844,
0.0943111851811409,
-0.017577245831489563,
-0.012445719912648201,
-0.083909772336483,
0.06884248554706573,
-0.023142775520682335,
-0.013675783760845661,
-0.04461415112018585,
-0.03866996988654137,
-0.03735356405377388,
-0.02785089984536171,
-0.026090627536177635,
-0.07978455722332001,
-0.0002744128869380802,
0.04986626282334328,
-0.030178792774677277,
-0.046103838831186295,
0.05223254859447479,
0.13330498337745667,
0.06621620804071426,
0.04611610621213913,
0.026555122807621956,
-0.10504639893770218,
-0.02874077297747135,
0.022452447563409805,
0.04607130214571953,
0.050020139664411545,
0.08229459077119827,
0.02651377022266388,
-0.00704748323187232,
-0.02742595598101616,
-0.05562659725546837,
-0.015654774382710457,
-0.014416723512113094,
-0.07064415514469147,
-0.011150975711643696,
-0.032456036657094955,
-0.0059630488976836205,
-0.08581531047821045,
0.010887452401220798,
0.0024553167168051004,
-5.1161535452592943e-8,
-0.03892900049686432,
-0.03295015171170235,
-0.041505083441734314,
-0.03002677857875824,
0.08709003776311874,
-0.10325746983289719,
0.03833471238613129,
0.09587223827838898,
0.11311487853527069,
0.04813830554485321,
-0.006651707459241152,
0.014716659672558308,
0.0003376019012648612,
-0.02157672867178917,
-0.01924685761332512,
0.051942385733127594,
0.08074980974197388,
-0.07468297332525253,
0.0013018021127209067,
0.030055897310376167,
-0.010477714240550995,
0.019741564989089966,
-0.023952018469572067,
0.05512954667210579,
0.04677387699484825,
0.01895710825920105,
-0.012132097966969013,
0.0857478454709053,
-0.041621968150138855,
-0.005983178969472647,
-0.02220214158296585,
-0.028925808146595955,
0.12541361153125763,
0.023345714434981346,
-0.015373052097856998,
0.03492465615272522,
0.07725261896848679,
-0.015060328878462315,
0.06932888180017471,
-0.028011441230773926,
-0.0009390712948516011,
-0.031576886773109436,
-0.010096710175275803,
0.028487399220466614,
-0.0769307091832161,
-0.0590781643986702,
-0.020877068862318993,
0.07969222217798233,
0.012206723913550377,
0.051361341029405594,
0.026784747838974,
-0.003459269879385829,
-0.0050156633369624615,
-0.0004976671771146357,
0.017544955015182495,
0.03390074521303177,
0.00606799079105258,
-0.02718055620789528,
0.02207672782242298,
0.012822228483855724,
0.011865679174661636,
-0.027819860726594925,
0.060770418494939804,
-0.06934182345867157
] | 0.038464 |
SQLite will wait for a database lock to be released before returning an error. \*\*Default:\*\* `0`. \* `readBigInts` {boolean} If `true`, integer fields are read as JavaScript `BigInt` values. If `false`, integer fields are read as JavaScript numbers. \*\*Default:\*\* `false`. \* `returnArrays` {boolean} If `true`, query results are returned as arrays instead of objects. \*\*Default:\*\* `false`. \* `allowBareNamedParameters` {boolean} If `true`, allows binding named parameters without the prefix character (e.g., `foo` instead of `:foo`). \*\*Default:\*\* `true`. \* `allowUnknownNamedParameters` {boolean} If `true`, unknown named parameters are ignored when binding. If `false`, an exception is thrown for unknown named parameters. \*\*Default:\*\* `false`. \* `defensive` {boolean} If `true`, enables the defensive flag. When the defensive flag is enabled, language features that allow ordinary SQL to deliberately corrupt the database file are disabled. The defensive flag can also be set using `enableDefensive()`. \*\*Default:\*\* `true`. Constructs a new `DatabaseSync` instance. ### `database.aggregate(name, options)` Registers a new aggregate function with the SQLite database. This method is a wrapper around [`sqlite3\_create\_window\_function()`][]. \* `name` {string} The name of the SQLite function to create. \* `options` {Object} Function configuration settings. \* `deterministic` {boolean} If `true`, the [`SQLITE\_DETERMINISTIC`][] flag is set on the created function. \*\*Default:\*\* `false`. \* `directOnly` {boolean} If `true`, the [`SQLITE\_DIRECTONLY`][] flag is set on the created function. \*\*Default:\*\* `false`. \* `useBigIntArguments` {boolean} If `true`, integer arguments to `options.step` and `options.inverse` are converted to `BigInt`s. If `false`, integer arguments are passed as JavaScript numbers. \*\*Default:\*\* `false`. \* `varargs` {boolean} If `true`, `options.step` and `options.inverse` may be invoked with any number of arguments (between zero and [`SQLITE\_MAX\_FUNCTION\_ARG`][]). If `false`, `inverse` and `step` must be invoked with exactly `length` arguments. \*\*Default:\*\* `false`. \* `start` {number | string | null | Array | Object | Function} The identity value for the aggregation function. This value is used when the aggregation function is initialized. When a {Function} is passed the identity will be its return value. \* `step` {Function} The function to call for each row in the aggregation. The function receives the current state and the row value. The return value of this function should be the new state. \* `result` {Function} The function to call to get the result of the aggregation. The function receives the final state and should return the result of the aggregation. \* `inverse` {Function} When this function is provided, the `aggregate` method will work as a window function. The function receives the current state and the dropped row value. The return value of this function should be the new state. When used as a window function, the `result` function will be called multiple times. ```cjs const { DatabaseSync } = require('node:sqlite'); const db = new DatabaseSync(':memory:'); db.exec(` CREATE TABLE t3(x, y); INSERT INTO t3 VALUES ('a', 4), ('b', 5), ('c', 3), ('d', 8), ('e', 1); `); db.aggregate('sumint', { start: 0, step: (acc, value) => acc + value, }); db.prepare('SELECT sumint(y) as total FROM t3').get(); // { total: 21 } ``` ```mjs import { DatabaseSync } from 'node:sqlite'; const db = new DatabaseSync(':memory:'); db.exec(` CREATE TABLE t3(x, y); INSERT INTO t3 VALUES ('a', 4), ('b', 5), ('c', 3), ('d', 8), ('e', 1); `); db.aggregate('sumint', { start: 0, step: (acc, value) => acc + value, }); db.prepare('SELECT sumint(y) as total FROM t3').get(); // { total: 21 } ``` ### `database.close()` Closes the database connection. An exception is thrown if the database is not open. This method is a wrapper around [`sqlite3\_close\_v2()`][]. ### `database.loadExtension(path)` \* `path` {string} The path to the shared library to load. Loads a shared library into the database connection. This method is a wrapper around [`sqlite3\_load\_extension()`][]. It is required to enable the `allowExtension` | https://github.com/nodejs/node/blob/main//doc/api/sqlite.md | main | nodejs | [
-0.03056951053440571,
-0.03431385010480881,
-0.05536261573433876,
0.079672671854496,
-0.0749335065484047,
-0.011914178729057312,
0.07745084166526794,
-0.03476012870669365,
-0.031795382499694824,
0.03767562285065651,
0.011145919561386108,
-0.019192596897482872,
0.014777184464037418,
-0.08602170646190643,
-0.03305092826485634,
0.07543857395648956,
-0.013868765905499458,
0.010807236656546593,
-0.11181414127349854,
0.12192120403051376,
0.01924506388604641,
0.022904356941580772,
0.028804028406739235,
0.041051674634218216,
-0.018951663747429848,
-0.007006829604506493,
-0.013268167153000832,
0.00004136236748308875,
-0.0418507345020771,
0.012148150242865086,
-0.07076232135295868,
-0.06978951394557953,
-0.039793338626623154,
0.11919187009334564,
0.0061182198114693165,
0.0259086973965168,
0.007694333791732788,
-0.03753998503088951,
-0.0967416986823082,
-0.006605830974876881,
-0.033172182738780975,
-0.020652679726481438,
-0.12842269241809845,
0.043501656502485275,
0.029622716829180717,
-0.03841891139745712,
-0.07559739798307419,
0.00017267890507355332,
-0.060308583080768585,
-0.017221765592694283,
-0.07134147733449936,
0.053719162940979004,
-0.01334884762763977,
-0.0011681077303364873,
0.06912403553724289,
0.04785268381237984,
0.01432760525494814,
0.04872075095772743,
-0.036618828773498535,
0.09143583476543427,
0.009619799442589283,
-0.06245230883359909,
-0.006890584249049425,
0.0025546844117343426,
0.07074416428804398,
-0.04090004041790962,
-0.030582889914512634,
-0.06401446461677551,
0.08537795394659042,
0.009087116457521915,
-0.01598905585706234,
0.03006804548203945,
-0.10933514684438705,
0.01094051357358694,
-0.011307606473565102,
0.07319990545511246,
0.03559247776865959,
-0.02978917770087719,
-0.0026111984625458717,
-0.01583540067076683,
-0.040591686964035034,
-0.09377112239599228,
-0.08080390840768814,
-0.015124817378818989,
0.0781681165099144,
-0.0021374027710407972,
0.02436847798526287,
0.06181518733501434,
0.06387051194906235,
0.06853105127811432,
-0.007362899370491505,
-0.008231337182223797,
0.00848393328487873,
0.06451772898435593,
0.035638585686683655,
0.011662912555038929,
0.10508036613464355,
-0.04243011772632599,
-0.023131560534238815,
-0.00851951353251934,
0.07122676819562912,
-0.01950671151280403,
-0.04450567439198494,
-0.013042156584560871,
0.03314034640789032,
-0.07207506150007248,
0.13446274399757385,
-0.16010120511054993,
-0.06040867790579796,
-0.00909484550356865,
0.02180846780538559,
0.08439396321773529,
0.06252329051494598,
-0.05848606303334236,
-0.11439680308103561,
0.06864675134420395,
0.0016185250133275986,
0.011894049122929573,
0.02401648461818695,
0.001285127131268382,
0.029064854606986046,
0.09708597511053085,
-0.018691811710596085,
-0.009182371199131012,
0.03696806728839874,
0.025351552292704582,
-0.04435635730624199,
8.447950964993458e-33,
0.006787699647247791,
-0.029752161353826523,
-0.008701586164534092,
-0.04172593355178833,
-0.052562691271305084,
0.07932870835065842,
-0.044968340545892715,
0.0998569205403328,
-0.0448240265250206,
0.06263082474470139,
0.041892971843481064,
-0.054053906351327896,
-0.013071395456790924,
-0.03527039289474487,
0.05109875649213791,
0.032450251281261444,
0.06910998374223709,
-0.004356193821877241,
0.0792003870010376,
0.032724443823099136,
0.028118059039115906,
-0.08826041221618652,
-0.02702699601650238,
0.06582050770521164,
-0.020011117681860924,
-0.08836369961500168,
-0.032862983644008636,
-0.0008450415334664285,
0.010676744394004345,
0.018771693110466003,
-0.048672810196876526,
-0.04643113166093826,
-0.016647571697831154,
0.008308772929012775,
0.005978072062134743,
0.04295607656240463,
-0.03494037687778473,
-0.019504765048623085,
-0.022553924471139908,
-0.046163663268089294,
-0.12979045510292053,
-0.038330722600221634,
-0.08924679458141327,
0.06294344365596771,
-0.020807841792702675,
-0.1279754787683487,
-0.07244309782981873,
0.017130063846707344,
0.00925702415406704,
-0.09135784208774567,
-0.06893851608037949,
0.07216881215572357,
0.0076716928742825985,
-0.011462174355983734,
0.02394085004925728,
0.004006668459624052,
-0.01586155593395233,
0.018120286986231804,
-0.004835247993469238,
-0.0003344272554386407,
-0.0048433286137878895,
0.010940300300717354,
0.053929783403873444,
-0.017988061532378197,
0.006322445347905159,
0.05508978292346001,
0.040651049464941025,
-0.028267866000533104,
0.059593793004751205,
-0.03656163811683655,
-0.0034372119698673487,
-0.01617223024368286,
0.010164299048483372,
0.007282063364982605,
-0.0702187567949295,
0.015346297062933445,
-0.023906897753477097,
-0.043619927018880844,
0.00794066209346056,
-0.04489945247769356,
0.10661149024963379,
-0.03042215295135975,
-0.05976998060941696,
0.10962995886802673,
-0.037168364971876144,
0.018449816852808,
-0.021334948018193245,
-0.0030347444117069244,
-0.037234846502542496,
0.012778173200786114,
0.08248300850391388,
-0.015266033820807934,
0.027660973370075226,
-0.09105806052684784,
0.02749376744031906,
-9.418501549169726e-33,
0.051233988255262375,
-0.03755795583128929,
-0.051263321191072464,
0.041596755385398865,
-0.020915988832712173,
-0.07584227621555328,
-0.10503031313419342,
0.02685949206352234,
-0.036362409591674805,
-0.11099711060523987,
0.03478725627064705,
-0.004063148982822895,
-0.001452790223993361,
-0.026139453053474426,
0.023465881124138832,
0.06872188299894333,
-0.05706963315606117,
-0.02971033751964569,
0.022549299523234367,
0.01796700432896614,
0.07219402492046356,
0.03707197308540344,
-0.05347834527492523,
0.0730922594666481,
-0.09796183556318283,
-0.062228914350271225,
-0.0590665265917778,
-0.061306439340114594,
-0.050062503665685654,
0.05100823566317558,
-0.0014692802214995027,
0.0017705722711980343,
-0.06339426338672638,
0.003958184737712145,
0.032604850828647614,
-0.13659444451332092,
0.024310603737831116,
-0.0018942340975627303,
0.010347327217459679,
0.04668156057596207,
-0.002933328039944172,
0.0050566173158586025,
0.049448784440755844,
-0.0238583292812109,
-0.021733082830905914,
-0.03497365862131119,
0.021588364616036415,
0.029906289651989937,
0.019745241850614548,
-0.013192128390073776,
0.029198409989476204,
-0.05721259117126465,
-0.03350091725587845,
0.004052010830491781,
0.11318105459213257,
-0.028070878237485886,
-0.08165042102336884,
-0.09413191676139832,
0.006486915983259678,
0.017121732234954834,
-0.03750006482005119,
0.004708981607109308,
-0.015194956213235855,
-0.030104221776127815,
-0.02576063573360443,
-0.03302913159132004,
-0.04144113510847092,
0.04215589538216591,
0.046490926295518875,
-0.06215205043554306,
0.060735661536455154,
-0.02332429401576519,
0.09010280668735504,
0.08963101357221603,
0.0020292040426284075,
0.08623290807008743,
-0.030773811042308807,
-0.000014623246897826903,
0.00014024235133547336,
0.13863441348075867,
0.07518357038497925,
0.061018187552690506,
0.04222672060132027,
0.02112702466547489,
-0.017458802089095116,
-0.014047602191567421,
-0.010922908782958984,
0.015586147084832191,
-0.12845781445503235,
0.06755194813013077,
0.018051762133836746,
0.0011652910616248846,
-0.07784708589315414,
0.034392956644296646,
-0.026111025363206863,
-6.083659087607884e-8,
0.014996549114584923,
0.018635008484125137,
-0.024291347712278366,
-0.05317658931016922,
0.03926219791173935,
-0.025580236688256264,
0.016444655135273933,
0.03711584582924843,
0.010593502782285213,
-0.04641571268439293,
0.005744544789195061,
0.0821758434176445,
0.03192366287112236,
0.03844582289457321,
-0.018446454778313637,
-0.046148981899023056,
0.0047406889498233795,
-0.05795542895793915,
-0.04098391905426979,
-0.014906766824424267,
-0.010147825814783573,
-0.0025473732966929674,
-0.04846976324915886,
-0.0005668971571139991,
0.04238634556531906,
0.04407808557152748,
-0.015515441074967384,
0.0176833588629961,
-0.010754904709756374,
0.07683438807725906,
0.025343289598822594,
-0.013111015781760216,
0.11167225986719131,
0.015867847949266434,
-0.04656209051609039,
0.13179649412631989,
0.04057454690337181,
-0.033187732100486755,
0.04373377561569214,
0.0018827641615644097,
0.05005696788430214,
-0.04994204640388489,
0.01641652174293995,
0.023662058636546135,
-0.0688774436712265,
-0.05402747914195061,
0.010040845721960068,
0.10208817571401596,
0.027056436985731125,
0.01093797292560339,
-0.013791477307677269,
0.04242100566625595,
0.008151832967996597,
0.057849347591400146,
0.041356589645147324,
0.05400843545794487,
0.012317483313381672,
-0.0017178072594106197,
0.04666116088628769,
0.038260772824287415,
0.04382196068763733,
-0.06802578270435333,
0.012909451499581337,
-0.01597096398472786
] | 0.051106 |
is thrown if the database is not open. This method is a wrapper around [`sqlite3\_close\_v2()`][]. ### `database.loadExtension(path)` \* `path` {string} The path to the shared library to load. Loads a shared library into the database connection. This method is a wrapper around [`sqlite3\_load\_extension()`][]. It is required to enable the `allowExtension` option when constructing the `DatabaseSync` instance. ### `database.enableLoadExtension(allow)` \* `allow` {boolean} Whether to allow loading extensions. Enables or disables the `loadExtension` SQL function, and the `loadExtension()` method. When `allowExtension` is `false` when constructing, you cannot enable loading extensions for security reasons. ### `database.enableDefensive(active)` \* `active` {boolean} Whether to set the defensive flag. Enables or disables the defensive flag. When the defensive flag is active, language features that allow ordinary SQL to deliberately corrupt the database file are disabled. See [`SQLITE\_DBCONFIG\_DEFENSIVE`][] in the SQLite documentation for details. ### `database.location([dbName])` \* `dbName` {string} Name of the database. This can be `'main'` (the default primary database) or any other database that has been added with [`ATTACH DATABASE`][] \*\*Default:\*\* `'main'`. \* Returns: {string | null} The location of the database file. When using an in-memory database, this method returns null. This method is a wrapper around [`sqlite3\_db\_filename()`][] ### `database.exec(sql)` \* `sql` {string} A SQL string to execute. This method allows one or more SQL statements to be executed without returning any results. This method is useful when executing SQL statements read from a file. This method is a wrapper around [`sqlite3\_exec()`][]. ### `database.function(name[, options], function)` \* `name` {string} The name of the SQLite function to create. \* `options` {Object} Optional configuration settings for the function. The following properties are supported: \* `deterministic` {boolean} If `true`, the [`SQLITE\_DETERMINISTIC`][] flag is set on the created function. \*\*Default:\*\* `false`. \* `directOnly` {boolean} If `true`, the [`SQLITE\_DIRECTONLY`][] flag is set on the created function. \*\*Default:\*\* `false`. \* `useBigIntArguments` {boolean} If `true`, integer arguments to `function` are converted to `BigInt`s. If `false`, integer arguments are passed as JavaScript numbers. \*\*Default:\*\* `false`. \* `varargs` {boolean} If `true`, `function` may be invoked with any number of arguments (between zero and [`SQLITE\_MAX\_FUNCTION\_ARG`][]). If `false`, `function` must be invoked with exactly `function.length` arguments. \*\*Default:\*\* `false`. \* `function` {Function} The JavaScript function to call when the SQLite function is invoked. The return value of this function should be a valid SQLite data type: see [Type conversion between JavaScript and SQLite][]. The result defaults to `NULL` if the return value is `undefined`. This method is used to create SQLite user-defined functions. This method is a wrapper around [`sqlite3\_create\_function\_v2()`][]. ### `database.setAuthorizer(callback)` \* `callback` {Function|null} The authorizer function to set, or `null` to clear the current authorizer. Sets an authorizer callback that SQLite will invoke whenever it attempts to access data or modify the database schema through prepared statements. This can be used to implement security policies, audit access, or restrict certain operations. This method is a wrapper around [`sqlite3\_set\_authorizer()`][]. When invoked, the callback receives five arguments: \* `actionCode` {number} The type of operation being performed (e.g., `SQLITE\_INSERT`, `SQLITE\_UPDATE`, `SQLITE\_SELECT`). \* `arg1` {string|null} The first argument (context-dependent, often a table name). \* `arg2` {string|null} The second argument (context-dependent, often a column name). \* `dbName` {string|null} The name of the database. \* `triggerOrView` {string|null} The name of the trigger or view causing the access. The callback must return one of the following constants: \* `SQLITE\_OK` - Allow the operation. \* `SQLITE\_DENY` - Deny the operation (causes an error). \* `SQLITE\_IGNORE` - Ignore the operation (silently skip). ```cjs const { DatabaseSync, constants } = require('node:sqlite'); const db = new DatabaseSync(':memory:'); // Set up an authorizer that denies all table creation db.setAuthorizer((actionCode) => { if (actionCode === constants.SQLITE\_CREATE\_TABLE) { return | https://github.com/nodejs/node/blob/main//doc/api/sqlite.md | main | nodejs | [
0.0038141135592013597,
-0.061592910438776016,
-0.14136964082717896,
0.026780463755130768,
0.038430292159318924,
-0.031596165150403976,
0.051577430218458176,
-0.018697062507271767,
-0.09713715314865112,
-0.02391515113413334,
0.02316810004413128,
-0.0030354156624525785,
0.0504758283495903,
-0.024552561342716217,
0.012009202502667904,
0.09213806688785553,
0.025063470005989075,
-0.050319015979766846,
-0.09108239412307739,
0.14766991138458252,
0.01891634613275528,
-0.04297953471541405,
0.012164369225502014,
0.07516395300626755,
0.021684089675545692,
-0.05530758202075958,
-0.02105959691107273,
0.02231932431459427,
0.040602222084999084,
0.0718764215707779,
-0.03693973273038864,
-0.0649866983294487,
-0.11185864359140396,
0.08929242938756943,
0.011106248013675213,
0.02453213930130005,
0.03905550017952919,
-0.05650300532579422,
-0.12589547038078308,
-0.0340794175863266,
0.020350273698568344,
-0.03332039341330528,
-0.16505374014377594,
0.06862503290176392,
-0.09507682174444199,
0.012165130116045475,
-0.0542265847325325,
-0.023462554439902306,
-0.055456068366765976,
-0.04902593046426773,
0.018338052555918694,
0.030899181962013245,
-0.026112135499715805,
-0.00440471526235342,
0.0491284616291523,
0.07417700439691544,
0.04794944077730179,
0.11768598854541779,
-0.04780281335115433,
0.10672517120838165,
-0.0004985619452781975,
0.01088910922408104,
-0.023207081481814384,
0.017740946263074875,
0.018221644684672356,
-0.03763067349791527,
0.007935170084238052,
-0.048875242471694946,
0.07115215808153152,
-0.0285477451980114,
-0.03432705998420715,
-0.0036671964917331934,
-0.08533936738967896,
0.008989629335701466,
0.022858642041683197,
0.04960324615240097,
0.09712949395179749,
-0.016670700162649155,
-0.052337396889925,
-0.07472293823957443,
-0.052146513015031815,
-0.05614810064435005,
-0.027412164956331253,
0.02538464218378067,
0.0444246307015419,
-0.019834943115711212,
-0.002848863136023283,
-0.05866513028740883,
0.06886911392211914,
0.1278364658355713,
0.07894787192344666,
0.026116324588656425,
-0.022547833621501923,
0.03373624011874199,
0.046028751879930496,
-0.020292727276682854,
0.014371356926858425,
-0.02578146383166313,
-0.014146793633699417,
0.02639457769691944,
-0.006435035262256861,
-0.009190814569592476,
-0.009528850205242634,
0.020049357786774635,
0.03510206937789917,
-0.10267887264490128,
0.055734384804964066,
-0.10668027400970459,
-0.09230782836675644,
-0.008545935153961182,
0.04919976368546486,
0.005337768234312534,
0.0446120984852314,
-0.11344002187252045,
-0.04518132284283638,
0.09602650254964828,
-0.0317268893122673,
0.012175247073173523,
0.04384598881006241,
-0.04025096446275711,
0.05093027651309967,
0.04252547770738602,
0.03569504991173744,
-0.06155935674905777,
0.011511996388435364,
-0.038847923278808594,
-0.04500214383006096,
1.5287175462749228e-33,
0.01074223406612873,
-0.10130366683006287,
0.026114637032151222,
0.041455164551734924,
-0.046856626868247986,
0.05151042714715004,
-0.0407990925014019,
0.059523582458496094,
-0.07378224283456802,
0.008077406324446201,
0.02084614522755146,
0.01673443242907524,
-0.010839552618563175,
-0.008453321643173695,
0.09515564888715744,
0.05292065441608429,
0.06977297365665436,
-0.0267714262008667,
0.048697154968976974,
0.11385718733072281,
0.053358353674411774,
-0.019483212381601334,
0.0018161273328587413,
0.01831549033522606,
-0.060743678361177444,
-0.06852557510137558,
-0.03232220932841301,
0.0020484328269958496,
0.040362998843193054,
0.04608168452978134,
-0.07331825792789459,
-0.09472186863422394,
-0.060671113431453705,
0.05875406786799431,
0.0022380335722118616,
0.01156825851649046,
-0.052553411573171616,
-0.027189049869775772,
-0.05092243477702141,
0.006005231756716967,
0.019905127584934235,
-0.01649612747132778,
-0.020089972764253616,
0.011983540840446949,
0.029920658096671104,
-0.046630967408418655,
-0.03365413472056389,
0.03354005143046379,
-0.060682062059640884,
-0.0402129665017128,
0.03149116411805153,
0.0033700515050441027,
0.0588444359600544,
0.042162295430898666,
0.019641028717160225,
-0.00663042301312089,
-0.03618205711245537,
-0.017087236046791077,
0.03778945654630661,
-0.057438526302576065,
0.016316687688231468,
-0.04186936467885971,
0.012195674702525139,
0.028659895062446594,
0.09535875171422958,
0.0668204203248024,
-0.0421939380466938,
-0.021838422864675522,
0.07122417539358139,
-0.046151649206876755,
-0.06132848933339119,
0.004723585210740566,
0.0221903994679451,
-0.028157098218798637,
-0.01130433939397335,
-0.011351803317666054,
-0.037709616124629974,
-0.024204500019550323,
0.03321804478764534,
0.019864773377776146,
0.03855856508016586,
-0.041278015822172165,
-0.014054611325263977,
0.008952750824391842,
-0.1186116561293602,
0.00419193459674716,
-0.07989568263292313,
-0.04440438002347946,
-0.025774035602808,
0.0020120556000620127,
0.04174577072262764,
-0.022060474380850792,
0.028452567756175995,
-0.007123906631022692,
-0.011411630548536777,
-4.392376435853545e-33,
0.0898871123790741,
-0.029432788491249084,
-0.04919426515698433,
-0.03681135177612305,
-0.035400696098804474,
-0.010117552243173122,
-0.06687482446432114,
-0.0543142594397068,
-0.062053147703409195,
-0.07247582823038101,
0.03246342018246651,
-0.030996089801192284,
0.044663794338703156,
-0.04561718553304672,
0.0077799526043236256,
0.021418089047074318,
-0.007934288121759892,
-0.016912557184696198,
-0.0364973284304142,
0.07699944078922272,
0.020558318123221397,
0.0820380300283432,
0.032507043331861496,
0.047259021550416946,
-0.027247600257396698,
-0.08938514441251755,
-0.10773029178380966,
-0.08024680614471436,
0.035012342035770416,
-0.0012170786503702402,
0.023248400539159775,
0.049814458936452866,
-0.016354599967598915,
-0.005522910039871931,
-0.04797621816396713,
-0.022610049694776535,
0.006418916862457991,
0.0027557609137147665,
0.03988067805767059,
-0.006125663872808218,
0.020526384934782982,
0.08660764247179031,
0.02967085875570774,
0.003438119078055024,
0.00551729928702116,
0.016460763290524483,
-0.01724354177713394,
0.0019427440129220486,
-0.0242682583630085,
-0.00024314298934768885,
0.05230357497930527,
-0.08804871886968613,
0.0601835735142231,
0.0632171705365181,
0.09426169842481613,
-0.010765034705400467,
0.027947070077061653,
-0.052064068615436554,
0.023554407060146332,
0.001049150014296174,
0.03589664399623871,
0.007705835159868002,
-0.08478692919015884,
-0.0694245770573616,
-0.0967535600066185,
0.00563767971470952,
-0.05946554243564606,
0.08368469029664993,
0.08071231096982956,
-0.04876873269677162,
-0.03323301300406456,
0.023194851353764534,
0.07112801820039749,
-0.0017639491707086563,
-0.03011339157819748,
0.09130959957838058,
-0.024784071370959282,
-0.015255061909556389,
-0.029726266860961914,
0.09499344229698181,
-0.004450658336281776,
-0.0223001129925251,
0.013879847712814808,
0.025288915261626244,
-0.03443659096956253,
-0.05841189995408058,
-0.01130753755569458,
0.010283495299518108,
-0.07820907235145569,
-0.022119352594017982,
0.009101181291043758,
-0.005312064662575722,
-0.1176442801952362,
0.09257888793945312,
0.006131717935204506,
-5.05332842237749e-8,
0.003954707644879818,
-0.017316406592726707,
-0.023440325632691383,
-0.08040264993906021,
0.11616375297307968,
-0.012254660949110985,
0.06996267288923264,
0.045796699821949005,
0.016726015135645866,
0.03638089820742607,
-0.015372819267213345,
0.03460767865180969,
0.0228860042989254,
-0.014214741997420788,
-0.030086999759078026,
0.022612571716308594,
0.04544471576809883,
-0.042134691029787064,
-0.03908061608672142,
-0.00026914404588751495,
-0.040140971541404724,
-0.05839443951845169,
-0.09431115537881851,
0.03973953798413277,
-0.02856423333287239,
0.04760929197072983,
-0.020400429144501686,
-0.015079238452017307,
-0.01962258480489254,
0.01711130701005459,
0.044163256883621216,
0.0181419774889946,
0.02795339748263359,
-0.01542189996689558,
-0.07395279407501221,
0.16547399759292603,
0.06820231676101685,
0.017641065642237663,
0.0285872183740139,
0.02418174408376217,
0.0129791758954525,
0.025629861280322075,
0.025067469105124474,
0.019270317628979683,
-0.014003931544721127,
-0.05637562647461891,
-0.03827205300331116,
0.0771186500787735,
-0.03997877240180969,
0.043773673474788666,
0.03713125362992287,
0.05346694588661194,
-0.036120206117630005,
0.09469500184059143,
0.0026341828051954508,
0.030573733150959015,
-0.047367122024297714,
0.002188554499298334,
-0.007606953382492065,
0.05939798057079315,
0.013389291241765022,
-0.04761182516813278,
0.10933054238557816,
-0.02188497595489025
] | 0.025716 |
operation. \* `SQLITE\_DENY` - Deny the operation (causes an error). \* `SQLITE\_IGNORE` - Ignore the operation (silently skip). ```cjs const { DatabaseSync, constants } = require('node:sqlite'); const db = new DatabaseSync(':memory:'); // Set up an authorizer that denies all table creation db.setAuthorizer((actionCode) => { if (actionCode === constants.SQLITE\_CREATE\_TABLE) { return constants.SQLITE\_DENY; } return constants.SQLITE\_OK; }); // This will work db.prepare('SELECT 1').get(); // This will throw an error due to authorization denial try { db.exec('CREATE TABLE blocked (id INTEGER)'); } catch (err) { console.log('Operation blocked:', err.message); } ``` ```mjs import { DatabaseSync, constants } from 'node:sqlite'; const db = new DatabaseSync(':memory:'); // Set up an authorizer that denies all table creation db.setAuthorizer((actionCode) => { if (actionCode === constants.SQLITE\_CREATE\_TABLE) { return constants.SQLITE\_DENY; } return constants.SQLITE\_OK; }); // This will work db.prepare('SELECT 1').get(); // This will throw an error due to authorization denial try { db.exec('CREATE TABLE blocked (id INTEGER)'); } catch (err) { console.log('Operation blocked:', err.message); } ``` ### `database.isOpen` \* Type: {boolean} Whether the database is currently open or not. ### `database.isTransaction` \* Type: {boolean} Whether the database is currently within a transaction. This method is a wrapper around [`sqlite3\_get\_autocommit()`][]. ### `database.open()` Opens the database specified in the `path` argument of the `DatabaseSync` constructor. This method should only be used when the database is not opened via the constructor. An exception is thrown if the database is already open. ### `database.prepare(sql[, options])` \* `sql` {string} A SQL string to compile to a prepared statement. \* `options` {Object} Optional configuration for the prepared statement. \* `readBigInts` {boolean} If `true`, integer fields are read as `BigInt`s. \*\*Default:\*\* inherited from database options or `false`. \* `returnArrays` {boolean} If `true`, results are returned as arrays. \*\*Default:\*\* inherited from database options or `false`. \* `allowBareNamedParameters` {boolean} If `true`, allows binding named parameters without the prefix character. \*\*Default:\*\* inherited from database options or `true`. \* `allowUnknownNamedParameters` {boolean} If `true`, unknown named parameters are ignored. \*\*Default:\*\* inherited from database options or `false`. \* Returns: {StatementSync} The prepared statement. Compiles a SQL statement into a [prepared statement][]. This method is a wrapper around [`sqlite3\_prepare\_v2()`][]. ### `database.createTagStore([maxSize])` \* `maxSize` {integer} The maximum number of prepared statements to cache. \*\*Default:\*\* `1000`. \* Returns: {SQLTagStore} A new SQL tag store for caching prepared statements. Creates a new [`SQLTagStore`][], which is a Least Recently Used (LRU) cache for storing prepared statements. This allows for the efficient reuse of prepared statements by tagging them with a unique identifier. When a tagged SQL literal is executed, the `SQLTagStore` checks if a prepared statement for the corresponding SQL query string already exists in the cache. If it does, the cached statement is used. If not, a new prepared statement is created, executed, and then stored in the cache for future use. This mechanism helps to avoid the overhead of repeatedly parsing and preparing the same SQL statements. Tagged statements bind the placeholder values from the template literal as parameters to the underlying prepared statement. For example: ```js sqlTagStore.get`SELECT ${value}`; ``` is equivalent to: ```js db.prepare('SELECT ?').get(value); ``` However, in the first example, the tag store will cache the underlying prepared statement for future use. > \*\*Note:\*\* The `${value}` syntax in tagged statements \_binds\_ a parameter to > the prepared statement. This differs from its behavior in \_untagged\_ template > literals, where it performs string interpolation. > > ```js > // This a safe example of binding a parameter to a tagged statement. > sqlTagStore.run`INSERT INTO t1 (id) VALUES (${id})`; > > // This is an \*unsafe\* example of an untagged template string. > // `id` is interpolated into the query text as a string. > // | https://github.com/nodejs/node/blob/main//doc/api/sqlite.md | main | nodejs | [
-0.03249634429812431,
0.05463976413011551,
-0.04622252658009529,
0.06539177894592285,
-0.017131883651018143,
-0.07024458050727844,
0.05140379071235657,
0.031975261867046356,
-0.03426150977611542,
0.039206378161907196,
0.017052922397851944,
-0.048376839607954025,
0.047790851444005966,
-0.05951492860913277,
-0.07077737152576447,
0.057552989572286606,
-0.0038591574411839247,
0.04244380444288254,
-0.012835707515478134,
0.05567575618624687,
0.002759882714599371,
-0.01489728968590498,
0.08589070290327072,
0.053828850388526917,
0.024428797885775566,
-0.08783265203237534,
-0.0008635923149995506,
-0.02418975718319416,
0.012794417329132557,
-0.001155709382146597,
-0.01612376607954502,
-0.12263455986976624,
-0.057855281978845596,
0.11251182854175568,
-0.03744587302207947,
-0.01151606161147356,
0.03978997841477394,
-0.07773313671350479,
-0.047284528613090515,
-0.027763545513153076,
0.017353929579257965,
0.024478551000356674,
-0.1354072391986847,
0.0015861577121540904,
0.043419577181339264,
-0.06794385612010956,
-0.08981429040431976,
0.038433514535427094,
-0.05230049416422844,
0.003264728933572769,
-0.032534752041101456,
0.04185551404953003,
-0.016481470316648483,
-0.10014400631189346,
0.008666315115988255,
0.07267694920301437,
0.006753104273229837,
0.036241721361875534,
0.038848377764225006,
0.046328552067279816,
0.004786903504282236,
-0.05650581419467926,
0.06313187628984451,
-0.06080718711018562,
-0.012307625263929367,
-0.006412706337869167,
-0.03750520944595337,
0.026184046640992165,
0.06642045825719833,
0.05832771584391594,
0.03868758678436279,
0.019103124737739563,
-0.10878174006938934,
0.03749185428023338,
-0.034764084964990616,
-0.0581301674246788,
0.004021938424557447,
0.007488888688385487,
-0.06894522160291672,
0.04230356588959694,
-0.04957394301891327,
-0.052537258714437485,
-0.009907766245305538,
-0.04582218825817108,
-0.013180093839764595,
0.04442274197936058,
0.06982783228158951,
0.062006644904613495,
0.03266112878918648,
-0.01772613450884819,
-0.01833072304725647,
0.001541205681860447,
-0.02725367061793804,
0.02394670434296131,
0.07005441933870316,
0.024439575150609016,
0.08174256980419159,
-0.04182123392820358,
-0.022887088358402252,
0.0012030184734612703,
0.0036995606496930122,
-0.05546528473496437,
-0.0694136843085289,
0.07007141411304474,
0.03624884784221649,
-0.09725785255432129,
0.054646287113428116,
-0.1572214514017105,
-0.10559751093387604,
0.018382985144853592,
-0.007693638559430838,
0.09314654767513275,
-0.036029256880283356,
-0.016198456287384033,
-0.06151334568858147,
0.08080621063709259,
0.06520996987819672,
-0.018216939643025398,
0.041784338653087616,
0.017130669206380844,
0.08050499856472015,
0.06892408430576324,
0.01624339260160923,
0.03258434683084488,
0.03459387272596359,
-0.017937835305929184,
0.0036975271068513393,
-5.591227400249191e-34,
0.05455584079027176,
-0.009285226464271545,
0.02121971920132637,
0.008999848738312721,
0.041715700179338455,
0.10410556197166443,
0.036529406905174255,
0.07926982641220093,
-0.04903232306241989,
0.06707391142845154,
-0.0346619114279747,
-0.0892675444483757,
0.0031239257659763098,
-0.06358842551708221,
0.056906428188085556,
0.031751327216625214,
0.08758692443370819,
-0.0897464007139206,
0.13770528137683868,
0.04717842489480972,
0.0017619059653952718,
-0.0026331343688070774,
-0.004342896863818169,
0.10046201199293137,
-0.02345004864037037,
-0.11492794007062912,
-0.11295551061630249,
0.04189402982592583,
0.05278293788433075,
-0.0010993327014148235,
0.016857406124472618,
-0.0043855877593159676,
-0.03561415523290634,
0.02716553397476673,
0.017880085855722427,
0.017298493534326553,
-0.05583801120519638,
0.0442027784883976,
-0.01666243188083172,
-0.07188510149717331,
-0.008171633817255497,
0.012257404625415802,
-0.106113962829113,
0.021620705723762512,
-0.04482906311750412,
0.004575829487293959,
-0.02589074894785881,
-0.051144279539585114,
0.025079084560275078,
-0.042424388229846954,
-0.05852295458316803,
0.05942956730723381,
-0.013207603245973587,
-0.006078209728002548,
0.05607670173048973,
-0.0333675891160965,
-0.06855210661888123,
-0.03817552328109741,
0.04965004697442055,
-0.06191244721412659,
0.03327955678105354,
-0.02804923802614212,
-0.015579499304294586,
0.07211361080408096,
-0.058225397020578384,
-0.006437748204916716,
-0.08618343621492386,
0.0001459414343116805,
0.013335189782083035,
-0.07744201272726059,
-0.03219429776072502,
-0.03699610382318497,
0.04042341932654381,
0.0010358333820477128,
-0.04179694131016731,
-0.02760143391788006,
-0.022819334641098976,
-0.024325422942638397,
-0.015451326034963131,
-0.05082111060619354,
0.0935973972082138,
-0.0364401638507843,
-0.10756588727235794,
-0.018313856795430183,
-0.03548465669155121,
0.04620544984936714,
-0.0876818522810936,
0.04592740908265114,
0.07898358255624771,
0.009283888153731823,
0.035907529294490814,
-0.028281256556510925,
0.02833768166601658,
-0.06973081082105637,
-0.041777197271585464,
-2.462901090301634e-33,
0.07416166365146637,
-0.005509919486939907,
0.005553217139095068,
-0.017362086102366447,
0.024921655654907227,
-0.008995060808956623,
-0.05572602525353432,
-0.0624287985265255,
-0.03911479935050011,
-0.07547617703676224,
0.04167769476771355,
0.03350478783249855,
0.04869500920176506,
0.009416474029421806,
-0.0025244306307286024,
-0.00679762102663517,
-0.06136838719248772,
0.018339963629841805,
-0.04957941547036171,
0.02992972545325756,
-0.01358131505548954,
0.028335291892290115,
0.047007232904434204,
0.03506993502378464,
-0.04496978595852852,
-0.027844613417983055,
-0.08038714528083801,
0.012373887933790684,
0.0011083601275458932,
-0.023253081366419792,
-0.03295937925577164,
0.06008811667561531,
-0.02694270946085453,
0.027634676545858383,
0.009693363681435585,
-0.12126658111810684,
-0.02109634503722191,
0.1832813173532486,
0.01952536404132843,
0.030195171013474464,
0.019937099888920784,
-0.022968683391809464,
0.007132592611014843,
0.02280411496758461,
0.008391684852540493,
-0.012301558628678322,
0.088841512799263,
-0.01990695670247078,
-0.02521953359246254,
0.012309955433011055,
0.0042741261422634125,
-0.05143860727548599,
0.04580884799361229,
-0.017377035692334175,
0.07931838184595108,
-0.045107051730155945,
0.022562488913536072,
-0.045244745910167694,
0.06951627135276794,
0.04009859636425972,
0.01864202879369259,
-0.006625586189329624,
-0.00624498026445508,
0.015801630914211273,
-0.01950567588210106,
-0.06197240576148033,
-0.07895123213529587,
0.1451401263475418,
0.10470156371593475,
0.048586416989564896,
-0.0197804793715477,
0.05430401861667633,
0.06665424257516861,
0.08679946511983871,
0.06464292854070663,
-0.007621359080076218,
-0.09928333759307861,
-0.0799894630908966,
0.013367232866585255,
0.08162447810173035,
0.03632780537009239,
0.031909454613924026,
0.056747160851955414,
-0.013207467272877693,
-0.05132421851158142,
-0.07530125230550766,
-0.02460641972720623,
-0.027391504496335983,
-0.05420368164777756,
0.04860967770218849,
0.014275889843702316,
-0.061532165855169296,
-0.11686144769191742,
0.004381281789392233,
0.02136744000017643,
-4.1213091606095986e-8,
0.018602941185235977,
-0.05278264731168747,
-0.020303035154938698,
-0.07174178212881088,
0.031153900548815727,
-0.11094324290752411,
-0.0024134665727615356,
-0.008674876764416695,
0.02399556152522564,
-0.06600633263587952,
-0.0007049268460832536,
0.07760293781757355,
0.07529022544622421,
-0.007879880256950855,
-0.039931658655405045,
-0.009465833194553852,
0.05864139646291733,
-0.05565163865685463,
-0.004872648511081934,
0.028424367308616638,
-0.05504655838012695,
-0.0032091366592794657,
-0.017907341942191124,
0.01964806579053402,
0.037514422088861465,
-0.013194606639444828,
-0.012341931462287903,
-0.011523909866809845,
-0.052924178540706635,
0.04476621001958847,
-0.04080423340201378,
-0.035737570375204086,
0.08348158746957779,
0.036799583584070206,
-0.024414831772446632,
0.0421425998210907,
0.009078306145966053,
-0.03396138176321983,
0.01059846580028534,
-0.01579294353723526,
0.006928527262061834,
0.027497444301843643,
0.04291689023375511,
0.026300892233848572,
-0.061296552419662476,
-0.026135196909308434,
-0.010136033408343792,
0.025986213237047195,
0.07670179754495621,
0.018069248646497726,
0.032153695821762085,
0.0628337562084198,
0.008938197046518326,
0.06516218185424805,
-0.013890904374420643,
0.05314869061112404,
-0.01792597770690918,
0.01723998412489891,
-0.001579894102178514,
0.019912023097276688,
0.057359665632247925,
-0.038855601102113724,
0.06417746096849442,
-0.015498999506235123
] | -0.018983 |
> ```js > // This a safe example of binding a parameter to a tagged statement. > sqlTagStore.run`INSERT INTO t1 (id) VALUES (${id})`; > > // This is an \*unsafe\* example of an untagged template string. > // `id` is interpolated into the query text as a string. > // This can lead to SQL injection and data corruption. > db.run(`INSERT INTO t1 (id) VALUES (${id})`); > ``` The tag store will match a statement from the cache if the query strings (including the positions of any bound placeholders) are identical. ```js // The following statements will match in the cache: sqlTagStore.get`SELECT \* FROM t1 WHERE id = ${id} AND active = 1`; sqlTagStore.get`SELECT \* FROM t1 WHERE id = ${12345} AND active = 1`; // The following statements will not match, as the query strings // and bound placeholders differ: sqlTagStore.get`SELECT \* FROM t1 WHERE id = ${id} AND active = 1`; sqlTagStore.get`SELECT \* FROM t1 WHERE id = 12345 AND active = 1`; // The following statements will not match, as matches are case-sensitive: sqlTagStore.get`SELECT \* FROM t1 WHERE id = ${id} AND active = 1`; sqlTagStore.get`select \* from t1 where id = ${id} and active = 1`; ``` The only way of binding parameters in tagged statements is with the `${value}` syntax. Do not add parameter binding placeholders (`?` etc.) to the SQL query string itself. ```mjs import { DatabaseSync } from 'node:sqlite'; const db = new DatabaseSync(':memory:'); const sql = db.createTagStore(); db.exec('CREATE TABLE users (id INT, name TEXT)'); // Using the 'run' method to insert data. // The tagged literal is used to identify the prepared statement. sql.run`INSERT INTO users VALUES (1, 'Alice')`; sql.run`INSERT INTO users VALUES (2, 'Bob')`; // Using the 'get' method to retrieve a single row. const name = 'Alice'; const user = sql.get`SELECT \* FROM users WHERE name = ${name}`; console.log(user); // { id: 1, name: 'Alice' } // Using the 'all' method to retrieve all rows. const allUsers = sql.all`SELECT \* FROM users ORDER BY id`; console.log(allUsers); // [ // { id: 1, name: 'Alice' }, // { id: 2, name: 'Bob' } // ] ``` ```cjs const { DatabaseSync } = require('node:sqlite'); const db = new DatabaseSync(':memory:'); const sql = db.createTagStore(); db.exec('CREATE TABLE users (id INT, name TEXT)'); // Using the 'run' method to insert data. // The tagged literal is used to identify the prepared statement. sql.run`INSERT INTO users VALUES (1, 'Alice')`; sql.run`INSERT INTO users VALUES (2, 'Bob')`; // Using the 'get' method to retrieve a single row. const name = 'Alice'; const user = sql.get`SELECT \* FROM users WHERE name = ${name}`; console.log(user); // { id: 1, name: 'Alice' } // Using the 'all' method to retrieve all rows. const allUsers = sql.all`SELECT \* FROM users ORDER BY id`; console.log(allUsers); // [ // { id: 1, name: 'Alice' }, // { id: 2, name: 'Bob' } // ] ``` ### `database.createSession([options])` \* `options` {Object} The configuration options for the session. \* `table` {string} A specific table to track changes for. By default, changes to all tables are tracked. \* `db` {string} Name of the database to track. This is useful when multiple databases have been added using [`ATTACH DATABASE`][]. \*\*Default\*\*: `'main'`. \* Returns: {Session} A session handle. Creates and attaches a session to the database. This method is a wrapper around [`sqlite3session\_create()`][] and [`sqlite3session\_attach()`][]. ### `database.applyChangeset(changeset[, options])` \* `changeset` {Uint8Array} A binary changeset or patchset. \* `options` {Object} The configuration options for how the changes will be applied. \* `filter` {Function} Skip changes that, when targeted table name is supplied to this function, return a truthy value. By | https://github.com/nodejs/node/blob/main//doc/api/sqlite.md | main | nodejs | [
-0.022394772619009018,
0.025984570384025574,
-0.051052700728178024,
0.0453273169696331,
-0.018373684957623482,
-0.026688730344176292,
0.07359281182289124,
0.04180581867694855,
-0.00007463490328518674,
-0.0660121962428093,
0.009594862349331379,
0.040304429829120636,
0.08765939623117447,
-0.06341025978326797,
0.04134109243750572,
0.021862836554646492,
0.03680748492479324,
-0.04276414215564728,
-0.08175305277109146,
0.07011957466602325,
0.04243344068527222,
-0.01834930293262005,
-0.01219362672418356,
0.022233089432120323,
-0.006197479087859392,
-0.015239732339978218,
-0.017385177314281464,
0.02060358226299286,
0.04030795022845268,
0.0188631322234869,
-0.02131137065589428,
-0.06133932247757912,
-0.14773119986057281,
0.02340983971953392,
0.032894622534513474,
0.0527794174849987,
-0.0003083792980760336,
-0.0663643479347229,
0.0016547517152503133,
-0.052130889147520065,
0.05482696369290352,
0.024322908371686935,
-0.13603314757347107,
0.05108203738927841,
0.049781907349824905,
0.005635612178593874,
-0.05238159000873566,
0.05215888470411301,
-0.1841668039560318,
-0.04029170796275139,
-0.022922173142433167,
-0.0691768154501915,
0.004679495003074408,
0.017743460834026337,
-0.02540583908557892,
0.11855555325746536,
-0.05113031342625618,
-0.047312069684267044,
-0.00577385863289237,
0.047982897609472275,
0.03275855630636215,
-0.007905272766947746,
0.025676922872662544,
0.05184726417064667,
0.02415413036942482,
-0.1139991357922554,
0.07326094806194305,
0.0017928807064890862,
0.04458682984113693,
0.005100985057651997,
-0.033398859202861786,
0.003974609542638063,
-0.05089331418275833,
0.04194732755422592,
0.016932327300310135,
0.03954669088125229,
0.0007433279533870518,
-0.029616165906190872,
-0.012122584506869316,
-0.034357428550720215,
0.006450706627219915,
-0.0755561962723732,
-0.03147396445274353,
-0.043533679097890854,
0.03755326196551323,
0.0046856943517923355,
0.026547212153673172,
-0.03200780227780342,
0.13768424093723297,
0.045249100774526596,
-0.014156011864542961,
0.02617994323372841,
0.0166803989559412,
-0.01589544117450714,
0.019701916724443436,
0.02357877604663372,
0.03597467020153999,
0.127817302942276,
0.06274399161338806,
0.038102004677057266,
0.02964247390627861,
0.05320645123720169,
-0.017199290916323662,
0.021284976974129677,
0.02624976821243763,
-0.018416112288832664,
-0.006424854509532452,
-0.04984313249588013,
-0.03073296695947647,
-0.024996375665068626,
-0.022205263376235962,
0.11799836903810501,
0.0676570013165474,
-0.0445605143904686,
-0.05004080384969711,
-0.013903937302529812,
0.09545724093914032,
-0.03478002920746803,
-0.016356203705072403,
0.03643881157040596,
0.020776310935616493,
0.010737882927060127,
-0.05121372267603874,
-0.022336386144161224,
-0.060930121690034866,
0.032963428646326065,
-0.03843172639608383,
1.6086566722606078e-33,
0.06897881627082825,
-0.04861140996217728,
-0.0345371849834919,
0.027393531054258347,
-0.02603597566485405,
0.08107290416955948,
-0.08459307998418808,
0.0197757538408041,
-0.03814229741692543,
0.13530287146568298,
0.08035233616828918,
-0.10203662514686584,
-0.03941330313682556,
0.029924841597676277,
0.00552742974832654,
0.05827357620000839,
0.048431169241666794,
0.03105420432984829,
-0.018765363842248917,
0.02722507156431675,
0.04827859625220299,
-0.0009755244245752692,
-0.053962718695402145,
-0.003337379079312086,
0.025935031473636627,
0.09675872325897217,
-0.06549137830734253,
0.02343660406768322,
0.024840814992785454,
-0.009453562088310719,
0.03153914213180542,
-0.07965503633022308,
-0.09049119800329208,
0.06132800504565239,
0.08520607650279999,
0.04318264499306679,
-0.01448559109121561,
-0.04746529459953308,
-0.026043089106678963,
-0.05124522000551224,
0.019910737872123718,
0.008047823794186115,
0.02816958539187908,
0.005809077061712742,
0.005150146782398224,
-0.05743434280157089,
-0.059862710535526276,
0.009609756991267204,
-0.015557907521724701,
-0.04534417390823364,
-0.07388144731521606,
0.03179645538330078,
0.047652918845415115,
0.029444020241498947,
0.0012968435185030103,
-0.017246855422854424,
-0.02721334621310234,
-0.05791117250919342,
0.031809814274311066,
0.05279502272605896,
-0.12756940722465515,
-0.05176174268126488,
-0.005431156139820814,
-0.02030809409916401,
0.07651194930076599,
0.023605093359947205,
0.0981842651963234,
-0.013915701769292355,
0.03237190097570419,
-0.04939604550600052,
0.026965947821736336,
-0.04407227411866188,
-0.005989548750221729,
0.0444672591984272,
-0.02178122103214264,
-0.06287511438131332,
-0.08178666234016418,
-0.01567554473876953,
-0.01820412278175354,
0.018202587962150574,
0.018166078254580498,
-0.057225391268730164,
-0.11035112291574478,
0.14609317481517792,
-0.04996262490749359,
-0.014864923432469368,
0.006514543201774359,
-0.05225327983498573,
0.0891534686088562,
0.020261861383914948,
0.10798154026269913,
0.012201347388327122,
0.01041144784539938,
-0.08987423777580261,
0.005095858592540026,
-3.0796006915735306e-33,
0.06135882809758186,
-0.05344771966338158,
-0.05989823117852211,
0.051594965159893036,
-0.04881051927804947,
-0.08062031120061874,
-0.017826631665229797,
0.0011017234064638615,
-0.002873201621696353,
-0.09862176328897476,
-0.04233160987496376,
0.010277694091200829,
-0.07756684720516205,
0.017974767833948135,
0.04683324322104454,
0.11692941933870316,
-0.0405183807015419,
-0.0643334835767746,
-0.008415738120675087,
0.01201758161187172,
0.06430801749229431,
-0.0007149217999540269,
-0.011167388409376144,
0.1390358954668045,
-0.012375608086585999,
0.00613382738083601,
-0.021870965138077736,
0.002634054981172085,
-0.08014974743127823,
0.01001620665192604,
-0.0051560127176344395,
-0.00036898464895784855,
0.010372745804488659,
0.024417882785201073,
-0.02687671035528183,
-0.10944731533527374,
0.03824529051780701,
0.052957456558942795,
0.04852203652262688,
0.026089565828442574,
0.010800114832818508,
0.06129836291074753,
0.0340646356344223,
0.0906648263335228,
-0.016528243198990822,
-0.0011252991389483213,
-0.04444940760731697,
0.01733236201107502,
0.09053348749876022,
-0.024978669360280037,
-0.0359034538269043,
-0.06739849597215652,
-0.04538142681121826,
-0.020037813112139702,
0.042062900960445404,
-0.09629933536052704,
-0.03647332638502121,
-0.05667060241103172,
-0.04406542703509331,
-0.0059486376121640205,
0.024092864245176315,
0.06161990016698837,
0.020233778282999992,
-0.04184700548648834,
-0.0706174224615097,
-0.05173163488507271,
-0.05174429714679718,
-0.04858073964715004,
0.0005308612599037588,
-0.05613010749220848,
-0.010066628456115723,
-0.07045253366231918,
0.021083123981952667,
-0.032074641436338425,
0.03276237100362778,
-0.026352841407060623,
0.07730813324451447,
0.002655996009707451,
0.05049873888492584,
0.025174761191010475,
0.009784982539713383,
-0.01455906592309475,
0.008161066100001335,
-0.014927773736417294,
-0.03863683342933655,
-0.01929336041212082,
-0.013988055288791656,
-0.0009790603071451187,
-0.1189565360546112,
-0.06589674949645996,
0.002761732554063201,
0.02888789214193821,
-0.0797773003578186,
0.02270190790295601,
0.003140275366604328,
-4.665933062142358e-8,
-0.031412918120622635,
0.02668907307088375,
-0.03137216717004776,
-0.02741595171391964,
-0.008729270659387112,
-0.06180008500814438,
0.027258319780230522,
0.06278074532747269,
-0.011740203015506268,
0.017630014568567276,
0.05253450199961662,
0.06620465219020844,
0.014347875490784645,
-0.05555035173892975,
-0.02352362498641014,
-0.03981105983257294,
-0.0537332184612751,
-0.05011559650301933,
-0.07389423251152039,
0.05639347434043884,
-0.06156698241829872,
0.1305544376373291,
-0.060016509145498276,
-0.045453157275915146,
0.10428594052791595,
0.012737945653498173,
0.034476980566978455,
0.03329030051827431,
0.031222650781273842,
0.044974371790885925,
0.038376618176698685,
0.03484521061182022,
0.06292136013507843,
0.010182448662817478,
0.01361546479165554,
0.029048636555671692,
0.05316883698105812,
-0.02504611760377884,
0.0030156434513628483,
-0.01200228650122881,
0.07360830157995224,
-0.016903741285204887,
0.04144539311528206,
-0.01362147368490696,
-0.042818453162908554,
-0.0186168160289526,
0.03895905241370201,
0.05349273234605789,
0.08146528154611588,
0.003385211108252406,
-0.02632211148738861,
-0.019058095291256905,
-0.0004311875090934336,
-0.029002461582422256,
-0.05220935866236687,
-0.04369211941957474,
0.0005290970439091325,
0.001461882726289332,
0.12618549168109894,
0.03206586837768555,
0.04498157650232315,
-0.08312234282493591,
0.026372166350483894,
-0.05402730405330658
] | 0.033496 |
a wrapper around [`sqlite3session\_create()`][] and [`sqlite3session\_attach()`][]. ### `database.applyChangeset(changeset[, options])` \* `changeset` {Uint8Array} A binary changeset or patchset. \* `options` {Object} The configuration options for how the changes will be applied. \* `filter` {Function} Skip changes that, when targeted table name is supplied to this function, return a truthy value. By default, all changes are attempted. \* `onConflict` {Function} A function that determines how to handle conflicts. The function receives one argument, which can be one of the following values: \* `SQLITE\_CHANGESET\_DATA`: A `DELETE` or `UPDATE` change does not contain the expected "before" values. \* `SQLITE\_CHANGESET\_NOTFOUND`: A row matching the primary key of the `DELETE` or `UPDATE` change does not exist. \* `SQLITE\_CHANGESET\_CONFLICT`: An `INSERT` change results in a duplicate primary key. \* `SQLITE\_CHANGESET\_FOREIGN\_KEY`: Applying a change would result in a foreign key violation. \* `SQLITE\_CHANGESET\_CONSTRAINT`: Applying a change results in a `UNIQUE`, `CHECK`, or `NOT NULL` constraint violation. The function should return one of the following values: \* `SQLITE\_CHANGESET\_OMIT`: Omit conflicting changes. \* `SQLITE\_CHANGESET\_REPLACE`: Replace existing values with conflicting changes (only valid with `SQLITE\_CHANGESET\_DATA` or `SQLITE\_CHANGESET\_CONFLICT` conflicts). \* `SQLITE\_CHANGESET\_ABORT`: Abort on conflict and roll back the database. When an error is thrown in the conflict handler or when any other value is returned from the handler, applying the changeset is aborted and the database is rolled back. \*\*Default\*\*: A function that returns `SQLITE\_CHANGESET\_ABORT`. \* Returns: {boolean} Whether the changeset was applied successfully without being aborted. An exception is thrown if the database is not open. This method is a wrapper around [`sqlite3changeset\_apply()`][]. ```mjs import { DatabaseSync } from 'node:sqlite'; const sourceDb = new DatabaseSync(':memory:'); const targetDb = new DatabaseSync(':memory:'); sourceDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)'); targetDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)'); const session = sourceDb.createSession(); const insert = sourceDb.prepare('INSERT INTO data (key, value) VALUES (?, ?)'); insert.run(1, 'hello'); insert.run(2, 'world'); const changeset = session.changeset(); targetDb.applyChangeset(changeset); // Now that the changeset has been applied, targetDb contains the same data as sourceDb. ``` ```cjs const { DatabaseSync } = require('node:sqlite'); const sourceDb = new DatabaseSync(':memory:'); const targetDb = new DatabaseSync(':memory:'); sourceDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)'); targetDb.exec('CREATE TABLE data(key INTEGER PRIMARY KEY, value TEXT)'); const session = sourceDb.createSession(); const insert = sourceDb.prepare('INSERT INTO data (key, value) VALUES (?, ?)'); insert.run(1, 'hello'); insert.run(2, 'world'); const changeset = session.changeset(); targetDb.applyChangeset(changeset); // Now that the changeset has been applied, targetDb contains the same data as sourceDb. ``` ### `database[Symbol.dispose]()` Closes the database connection. If the database connection is already closed then this is a no-op. ## Class: `Session` ### `session.changeset()` \* Returns: {Uint8Array} Binary changeset that can be applied to other databases. Retrieves a changeset containing all changes since the changeset was created. Can be called multiple times. An exception is thrown if the database or the session is not open. This method is a wrapper around [`sqlite3session\_changeset()`][]. ### `session.patchset()` \* Returns: {Uint8Array} Binary patchset that can be applied to other databases. Similar to the method above, but generates a more compact patchset. See [Changesets and Patchsets][] in the documentation of SQLite. An exception is thrown if the database or the session is not open. This method is a wrapper around [`sqlite3session\_patchset()`][]. ### `session.close()` Closes the session. An exception is thrown if the database or the session is not open. This method is a wrapper around [`sqlite3session\_delete()`][]. ### `session[Symbol.dispose]()` Closes the session. If the session is already closed, does nothing. ## Class: `StatementSync` This class represents a single [prepared statement][]. This class cannot be instantiated via its constructor. Instead, instances are created via the `database.prepare()` method. All APIs exposed by this class execute synchronously. A prepared statement is an | https://github.com/nodejs/node/blob/main//doc/api/sqlite.md | main | nodejs | [
-0.039970915764570236,
-0.01008595060557127,
-0.03319171071052551,
-0.0038633784279227257,
-0.03792829066514969,
-0.051763322204351425,
0.09160365164279938,
-0.029655050486326218,
-0.040653761476278305,
0.050817880779504776,
0.032724104821681976,
-0.07140123844146729,
-0.009838932193815708,
-0.07903368026018143,
-0.028855925425887108,
0.09016719460487366,
-0.08928729593753815,
0.021544385701417923,
-0.09254907071590424,
0.09972669929265976,
-0.02349250577390194,
0.06021450087428093,
0.016664890572428703,
0.06685087084770203,
0.023922747001051903,
-0.035650886595249176,
0.038724590092897415,
0.022951943799853325,
-0.04277666658163071,
-0.004245769698172808,
-0.03482931852340698,
0.02503228932619095,
-0.06116839870810509,
0.09780552983283997,
0.0225613322108984,
0.03945326805114746,
0.007238970138132572,
0.0013514633756130934,
-0.025545580312609673,
-0.01697382517158985,
0.014641170389950275,
-0.03546396642923355,
-0.06595193594694138,
0.0021226948592811823,
-0.049820076674222946,
0.007571032736450434,
-0.06549456715583801,
-0.025403844192624092,
-0.0823315978050232,
0.0007873648428358138,
-0.027201035991311073,
0.0452071949839592,
0.00044390727998688817,
0.03038516826927662,
0.08946686238050461,
0.05258104205131531,
0.05313444882631302,
0.06647028774023056,
-0.014453242532908916,
0.04580242186784744,
-0.0030227042734622955,
-0.04135080426931381,
0.01560022309422493,
-0.012031080201268196,
0.028214702382683754,
0.024784088134765625,
-0.021620161831378937,
-0.02116076461970806,
0.025784635916352272,
0.009418393485248089,
-0.06284122169017792,
0.07305889576673508,
-0.1179027184844017,
-0.009085304103791714,
0.008474606089293957,
0.0847713053226471,
0.05146333575248718,
0.06865523755550385,
-0.041965287178754807,
-0.06489135324954987,
0.014529750682413578,
-0.027311868965625763,
-0.020315047353506088,
-0.0016445225337520242,
0.07514631748199463,
-0.024016689509153366,
-0.05614547058939934,
-0.005758250132203102,
0.06926322728395462,
0.021209262311458588,
-0.03327617794275284,
0.0060857548378407955,
0.08392585068941116,
-0.041993316262960434,
0.029979942366480827,
0.03191866725683212,
0.07204397767782211,
-0.00514547573402524,
0.02674795500934124,
0.05457213148474693,
-0.0024558044970035553,
-0.021247131749987602,
-0.0995534360408783,
0.02180396392941475,
0.01310750748962164,
-0.07061458379030228,
0.008518355898559093,
-0.15951436758041382,
-0.06681952625513077,
-0.029715968295931816,
-0.036487702280282974,
0.02361234463751316,
0.04540279507637024,
-0.11897321045398712,
-0.07993718981742859,
0.019605834037065506,
0.03842412680387497,
0.02373349852859974,
0.023161230608820915,
-0.01702289842069149,
0.09681271016597748,
0.06915047764778137,
-0.02952737733721733,
0.019682131707668304,
-0.08182137459516525,
0.020062092691659927,
-0.0469093844294548,
2.4006281750408694e-33,
0.016603583469986916,
-0.05841094255447388,
-0.0238854568451643,
-0.01709606684744358,
0.03370508924126625,
0.05394790321588516,
-0.017582206055521965,
0.03286939486861229,
0.006646067835390568,
0.02515586093068123,
0.0022107381373643875,
0.025432925671339035,
-0.021974338218569756,
-0.029129721224308014,
0.038767267018556595,
0.0044331480748951435,
0.00425108103081584,
-0.011174126528203487,
0.053112056106328964,
0.029451973736286163,
-0.016086667776107788,
0.03274998441338539,
-0.08910270035266876,
-0.0018963030306622386,
-0.024106094613671303,
-0.03744536265730858,
-0.04843745008111,
0.0013021520571783185,
0.030717410147190094,
-0.02159455418586731,
-0.034860577434301376,
0.01736663095653057,
0.013359521515667439,
0.005962550174444914,
-0.013360075652599335,
-0.014610263518989086,
-0.07524677366018295,
-0.06936539709568024,
-0.0402766652405262,
0.0030680643394589424,
0.016489142552018166,
0.010977192781865597,
-0.10260014981031418,
0.0414719320833683,
0.03326821327209473,
-0.07722530514001846,
0.026027631014585495,
0.07847300916910172,
0.04636891931295395,
-0.1322540044784546,
0.07070018351078033,
0.056528568267822266,
0.016072070226073265,
-0.011124664917588234,
-0.04278171434998512,
-0.008328625001013279,
-0.08088061958551407,
-0.029045643284916878,
0.07284574210643768,
0.016427839174866676,
0.020771460607647896,
-0.05659174546599388,
0.03290370851755142,
0.05834805220365524,
0.03228854387998581,
0.11919701844453812,
0.031173210591077805,
-0.02422174997627735,
0.015513756312429905,
-0.043762050569057465,
-0.056669700890779495,
0.04414968937635422,
-0.03040320798754692,
0.004464565776288509,
-0.03942359983921051,
-0.018457358703017235,
-0.10253860056400299,
-0.024868322536349297,
-0.03278316557407379,
-0.00916501134634018,
0.0361391045153141,
-0.007684250827878714,
-0.07418736815452576,
0.005685633514076471,
-0.05773317441344261,
-0.0691535621881485,
-0.04112410545349121,
-0.033464059233665466,
-0.07407551258802414,
-0.035789333283901215,
0.057917069643735886,
-0.033611562103033066,
-0.014235169626772404,
-0.06291661411523819,
0.13919475674629211,
-5.169272774597488e-33,
0.07543434947729111,
-0.03227609023451805,
-0.026040269061923027,
0.000516007246915251,
-0.0022437761072069407,
-0.07312791794538498,
-0.0019131508888676763,
0.02935963124036789,
0.03297150880098343,
-0.09435012191534042,
0.021330727264285088,
-0.04422244802117348,
0.028409646824002266,
-0.13762395083904266,
-0.04795412719249725,
0.12985090911388397,
-0.10275667160749435,
-0.029223553836345673,
-0.03173627331852913,
-0.009252267889678478,
0.07270189374685287,
0.06684375554323196,
0.03841365873813629,
0.0813874825835228,
-0.04586202651262283,
-0.07921101152896881,
0.0007950420258566737,
-0.05162438750267029,
0.05690574273467064,
-0.04154627025127411,
-0.04090789332985878,
0.06592763960361481,
-0.06913360208272934,
0.032814547419548035,
0.04761608690023422,
-0.038934849202632904,
0.056052692234516144,
-0.03907313570380211,
0.018895018845796585,
0.009712901897728443,
0.003447866765782237,
0.04674408584833145,
0.05301361531019211,
0.07664718478918076,
0.02312154322862625,
0.07019880414009094,
-0.03065377101302147,
0.02672182396054268,
0.009896545670926571,
-0.05510803684592247,
0.028600310906767845,
-0.09017133712768555,
-0.042650897055864334,
0.027469860389828682,
0.14001800119876862,
0.0029688754584640265,
0.042538125067949295,
-0.1171429231762886,
-0.01963190920650959,
0.008248943835496902,
-0.015895701944828033,
0.01777251437306404,
0.0068906270898878574,
-0.00841065775603056,
0.0009001049329526722,
0.024210790172219276,
-0.09571121633052826,
0.015477139502763748,
0.06600376963615417,
0.03136033937335014,
0.041475724428892136,
-0.06133897975087166,
0.026764333248138428,
-0.009608946740627289,
-0.008840717375278473,
0.03835185617208481,
-0.035828202962875366,
-0.057968441396951675,
-0.004958656150847673,
0.11352413892745972,
-0.019543707370758057,
0.042753443121910095,
0.06583989411592484,
0.01563630811870098,
-0.12114452570676804,
0.005457278806716204,
-0.0075521222315728664,
0.10104981064796448,
-0.06971629709005356,
0.012082292698323727,
-0.03783349692821503,
-0.0443217009305954,
-0.04125858098268509,
0.027703111991286278,
-0.07153340429067612,
-5.336020336699221e-8,
0.03487783670425415,
-0.04601151496171951,
-0.0610550232231617,
-0.02443726547062397,
0.020825644955039024,
-0.04878406599164009,
-0.02929689548909664,
0.08359850943088531,
-0.044391922652721405,
-0.09564466774463654,
0.005293982103466988,
0.0800112634897232,
0.04696827009320259,
-0.005206706002354622,
-0.025144638493657112,
-0.08752670884132385,
0.015554980374872684,
0.0008625100599601865,
-0.017549268901348114,
0.015286608599126339,
-0.030416328459978104,
0.03805956989526749,
-0.0093879085034132,
-0.03723026439547539,
0.08176705986261368,
0.008056145161390305,
-0.04163281247019768,
0.04545094817876816,
-0.016367608681321144,
0.03759462758898735,
0.12179704010486603,
-0.06621068716049194,
0.08991523087024689,
0.057194143533706665,
-0.04951177164912224,
0.07096683979034424,
0.034781601279973984,
-0.01925296150147915,
0.031245466321706772,
0.011880007572472095,
0.03815222904086113,
0.027615413069725037,
-0.07534965872764587,
0.03202129527926445,
-0.07339083403348923,
-0.08031889796257019,
-0.049350377172231674,
0.007537250407040119,
0.018170200288295746,
-0.012626283802092075,
-0.0042365435510873795,
0.07953308522701263,
0.030981838703155518,
0.08546879142522812,
0.040350109338760376,
0.020710837095975876,
0.010994936339557171,
0.013472788035869598,
0.08444777131080627,
0.0062047820538282394,
0.04603475704789162,
-0.053055014461278915,
0.06809718906879425,
0.03430783748626709
] | 0.089903 |
Closes the session. If the session is already closed, does nothing. ## Class: `StatementSync` This class represents a single [prepared statement][]. This class cannot be instantiated via its constructor. Instead, instances are created via the `database.prepare()` method. All APIs exposed by this class execute synchronously. A prepared statement is an efficient binary representation of the SQL used to create it. Prepared statements are parameterizable, and can be invoked multiple times with different bound values. Parameters also offer protection against [SQL injection][] attacks. For these reasons, prepared statements are preferred over hand-crafted SQL strings when handling user input. ### `statement.all([namedParameters][, ...anonymousParameters])` \* `namedParameters` {Object} An optional object used to bind named parameters. The keys of this object are used to configure the mapping. \* `...anonymousParameters` {null|number|bigint|string|Buffer|TypedArray|DataView} Zero or more values to bind to anonymous parameters. \* Returns: {Array} An array of objects. Each object corresponds to a row returned by executing the prepared statement. The keys and values of each object correspond to the column names and values of the row. This method executes a prepared statement and returns all results as an array of objects. If the prepared statement does not return any results, this method returns an empty array. The prepared statement [parameters are bound][] using the values in `namedParameters` and `anonymousParameters`. ### `statement.columns()` \* Returns: {Array} An array of objects. Each object corresponds to a column in the prepared statement, and contains the following properties: \* `column` {string|null} The unaliased name of the column in the origin table, or `null` if the column is the result of an expression or subquery. This property is the result of [`sqlite3\_column\_origin\_name()`][]. \* `database` {string|null} The unaliased name of the origin database, or `null` if the column is the result of an expression or subquery. This property is the result of [`sqlite3\_column\_database\_name()`][]. \* `name` {string} The name assigned to the column in the result set of a `SELECT` statement. This property is the result of [`sqlite3\_column\_name()`][]. \* `table` {string|null} The unaliased name of the origin table, or `null` if the column is the result of an expression or subquery. This property is the result of [`sqlite3\_column\_table\_name()`][]. \* `type` {string|null} The declared data type of the column, or `null` if the column is the result of an expression or subquery. This property is the result of [`sqlite3\_column\_decltype()`][]. This method is used to retrieve information about the columns returned by the prepared statement. ### `statement.expandedSQL` \* Type: {string} The source SQL expanded to include parameter values. The source SQL text of the prepared statement with parameter placeholders replaced by the values that were used during the most recent execution of this prepared statement. This property is a wrapper around [`sqlite3\_expanded\_sql()`][]. ### `statement.get([namedParameters][, ...anonymousParameters])` \* `namedParameters` {Object} An optional object used to bind named parameters. The keys of this object are used to configure the mapping. \* `...anonymousParameters` {null|number|bigint|string|Buffer|TypedArray|DataView} Zero or more values to bind to anonymous parameters. \* Returns: {Object|undefined} An object corresponding to the first row returned by executing the prepared statement. The keys and values of the object correspond to the column names and values of the row. If no rows were returned from the database then this method returns `undefined`. This method executes a prepared statement and returns the first result as an object. If the prepared statement does not return any results, this method returns `undefined`. The prepared statement [parameters are bound][] using the values in `namedParameters` and `anonymousParameters`. ### `statement.iterate([namedParameters][, ...anonymousParameters])` \* `namedParameters` {Object} An optional object used to bind named parameters. The keys of this object are used to configure the mapping. \* `...anonymousParameters` {null|number|bigint|string|Buffer|TypedArray|DataView} Zero or more | https://github.com/nodejs/node/blob/main//doc/api/sqlite.md | main | nodejs | [
-0.028547154739499092,
0.018828896805644035,
-0.0851740688085556,
0.11510530114173889,
-0.10299402475357056,
-0.022850461304187775,
0.07428120076656342,
0.022194167599081993,
-0.012182718142867088,
0.01958400197327137,
-0.029995199292898178,
-0.0073176040314137936,
0.06295865774154663,
-0.12227687239646912,
0.034848589450120926,
0.08835778385400772,
0.006850032135844231,
-0.12701597809791565,
-0.053574949502944946,
0.061983298510313034,
0.04103802889585495,
0.037459440529346466,
-0.010586508549749851,
0.04445144534111023,
-0.03722738102078438,
-0.015813054516911507,
0.04653904587030411,
-0.02712017484009266,
0.04597901552915573,
0.043426159769296646,
-0.0624028742313385,
-0.02835763804614544,
-0.15637969970703125,
0.04760255664587021,
-0.011283579282462597,
0.019434982910752296,
0.0235537588596344,
0.03162418678402901,
0.004342351574450731,
-0.05287671461701393,
0.018886033445596695,
-0.03285706043243408,
-0.12859496474266052,
0.05663362517952919,
-0.013316057622432709,
-0.00342555926181376,
-0.10412999987602234,
-0.0009387292666360736,
-0.1220453605055809,
-0.031279582530260086,
-0.08003473281860352,
-0.023216035217046738,
-0.012000148184597492,
-0.02758857235312462,
-0.01472883764654398,
0.0010536552872508764,
0.007997896522283554,
0.028918636962771416,
-0.057829517871141434,
0.04767286777496338,
-0.043655332177877426,
-0.026661410927772522,
0.0078070457093417645,
0.10171207785606384,
0.06355377286672592,
-0.041865814477205276,
0.07207418978214264,
-0.0712716206908226,
0.15386097133159637,
-0.0716172382235527,
-0.06602679193019867,
0.020087677985429764,
-0.01825663074851036,
-0.0000033234289276151685,
-0.028497740626335144,
0.008671930059790611,
0.07358201593160629,
-0.03620733320713043,
-0.03427320346236229,
0.010597947984933853,
0.036719437688589096,
-0.0014730409020558,
-0.06301577389240265,
-0.015342672355473042,
0.006292300298810005,
-0.0176004059612751,
0.06633441150188446,
0.01217145100235939,
0.024709273129701614,
0.05422017350792885,
-0.021833816543221474,
-0.022038863971829414,
-0.04996967315673828,
0.038373541086912155,
0.006396467797458172,
0.011924820020794868,
-0.020619716495275497,
0.03779306635260582,
0.006254442036151886,
-0.0003548123058862984,
0.0304866936057806,
0.01447276957333088,
-0.05195968970656395,
-0.023398686200380325,
-0.06873608380556107,
-0.04827757552266121,
0.06529618799686432,
-0.12889264523983002,
0.010964026674628258,
0.04371187463402748,
0.019986426457762718,
0.05148754268884659,
-0.007718469947576523,
0.018378352746367455,
-0.05087351053953171,
0.02212475799024105,
0.01615847460925579,
0.012167821638286114,
0.01657557114958763,
0.035079553723335266,
0.0796186774969101,
0.03612827509641647,
-0.051260873675346375,
-0.050664834678173065,
0.004704989027231932,
-0.0090841855853796,
-0.009417036548256874,
4.5968713105943445e-33,
0.06218859180808067,
-0.09599104523658752,
-0.014089219272136688,
0.057598523795604706,
0.019525842741131783,
0.12104559689760208,
0.05754312872886658,
0.057515066117048264,
-0.012873790226876736,
0.049833379685878754,
-0.08401685953140259,
-0.08057835698127747,
0.019637705758213997,
0.019505411386489868,
-0.001373796840198338,
0.05989614874124527,
0.016740255057811737,
0.06837272644042969,
-0.0241964403539896,
0.05967336148023605,
0.04137260839343071,
0.06951221078634262,
0.03318114951252937,
0.034413501620292664,
0.015560390427708626,
0.062156565487384796,
-0.019007256254553795,
0.05208937078714371,
-0.050102297216653824,
0.00749574089422822,
-0.04061459004878998,
-0.08449142426252365,
-0.05274355039000511,
0.10420247167348862,
0.051399242132902145,
0.04059852287173271,
-0.024236854165792465,
0.026383984833955765,
0.02800816297531128,
-0.025281738489866257,
-0.04917263612151146,
-0.007378553505986929,
-0.03668399527668953,
0.08715004473924637,
-0.061896730214357376,
-0.14231382310390472,
-0.07846098393201828,
0.07880046963691711,
-0.04383030906319618,
-0.026311242952942848,
-0.11292801797389984,
-0.00016552521265111864,
-0.02209116518497467,
0.0086358692497015,
0.022186193615198135,
-0.0022948465775698423,
0.0013328634668141603,
-0.03704488277435303,
-0.05806375667452812,
0.03475204110145569,
-0.07726988941431046,
-0.02411365695297718,
-0.06932929158210754,
-0.07800295948982239,
0.02414080873131752,
-0.013030818663537502,
0.03241736441850662,
-0.055873628705739975,
0.01403343677520752,
-0.12422541528940201,
-0.012121557258069515,
0.011162669397890568,
-0.030400492250919342,
-0.020169377326965332,
0.00307419802993536,
-0.016888275742530823,
-0.00534945260733366,
0.029023224487900734,
0.04966934770345688,
0.015299716033041477,
0.12979274988174438,
-0.03456256166100502,
-0.08417237550020218,
0.10497316718101501,
-0.06540554016828537,
0.04469268023967743,
-0.03318588808178902,
0.019691526889801025,
0.012656545266509056,
0.0038119726814329624,
-0.002593186916783452,
-0.03778427839279175,
0.00589970825240016,
-0.06255209445953369,
-0.014087225310504436,
-6.564847953226524e-33,
0.08016742765903473,
0.006455905269831419,
-0.10753824561834335,
0.06728467345237732,
-0.014649450778961182,
-0.026639524847269058,
0.020221304148435593,
-0.026945073157548904,
-0.10809816420078278,
-0.12543271481990814,
0.0016483634244650602,
0.04702296853065491,
0.07128258049488068,
-0.03349587693810463,
-0.0036277715116739273,
0.03139932453632355,
-0.006023121532052755,
-0.0004901978536508977,
-0.014220691286027431,
0.0012775227660313249,
0.046776581555604935,
0.02490095980465412,
-0.006609584670513868,
0.006571052595973015,
-0.03283008188009262,
-0.09909511357545853,
-0.04908079281449318,
-0.012416882440447807,
0.008138026110827923,
0.08567078411579132,
0.058122217655181885,
-0.06611113995313644,
-0.00016514687740709633,
-0.035223398357629776,
-0.039924878627061844,
-0.054050613194704056,
0.08583962917327881,
-0.028542103245854378,
-0.028387339785695076,
0.05461506545543671,
0.03378048911690712,
0.019120147451758385,
0.014765270985662937,
-0.005901700351387262,
0.0222932081669569,
-0.016718178987503052,
-0.05379241332411766,
0.07464847713708878,
-0.02388077974319458,
0.023793654516339302,
-0.03804368898272514,
-0.09008251130580902,
-0.032807838171720505,
0.010359954088926315,
0.016329096630215645,
-0.0722087025642395,
-0.02731248363852501,
-0.05607408285140991,
0.051681648939847946,
-0.03495495021343231,
0.0015714472392573953,
0.03286740928888321,
0.03604910150170326,
0.011874645948410034,
-0.03953825309872627,
0.009872605092823505,
-0.04565579071640968,
0.03177144378423691,
0.023995939642190933,
0.02163894847035408,
-0.023437419906258583,
-0.03690303489565849,
0.03496864438056946,
0.011425905860960484,
0.047537848353385925,
0.031163290143013,
-0.02259235456585884,
-0.051925625652074814,
0.07763168960809708,
0.06582924723625183,
0.05744894593954086,
-0.00872540008276701,
0.05548456683754921,
0.04432014375925064,
0.0630992203950882,
0.055545590817928314,
0.07384374737739563,
0.08819910883903503,
-0.07528329640626907,
0.06618494540452957,
-0.0031505045481026173,
0.028025155887007713,
-0.0800318643450737,
0.06997599452733994,
0.022571947425603867,
-6.181852540976251e-8,
0.02016964554786682,
0.013478078879415989,
0.032806966453790665,
0.01915907859802246,
0.023786457255482674,
-0.05086524412035942,
0.01846977323293686,
0.05994316190481186,
0.029634451493620872,
0.057451434433460236,
0.03766823187470436,
0.06714092195034027,
0.07661498337984085,
-0.040887683629989624,
-0.016665125265717506,
0.0035222740843892097,
0.02267898991703987,
-0.06326919049024582,
-0.022216517478227615,
-0.05778710916638374,
-0.018321361392736435,
-0.09074996411800385,
-0.09591127932071686,
-0.0031286936718970537,
0.1314033567905426,
0.024915317073464394,
0.07834240794181824,
0.031120818108320236,
-0.08303855359554291,
0.004267849028110504,
-0.04112255573272705,
0.03290492296218872,
0.038373470306396484,
-0.027036789804697037,
-0.02893194556236267,
0.07750790566205978,
0.027622511610388756,
0.038772471249103546,
0.09448116272687912,
0.01825629360973835,
-0.07013846933841705,
0.0242321640253067,
0.03742286562919617,
0.01251946296542883,
0.022243738174438477,
-0.003559286007657647,
0.008725936524569988,
0.058513298630714417,
-0.014603722840547562,
0.012391516007483006,
-0.05916179344058037,
-0.002703546080738306,
-0.015458657406270504,
0.06061535328626633,
-0.013790023513138294,
-0.00827082246541977,
-0.02919171378016472,
-0.0014228238724172115,
0.05586305260658264,
0.012984076514840126,
-0.027575133368372917,
-0.007588425185531378,
-0.012509544380009174,
-0.09313451498746872
] | 0.084152 |
any results, this method returns `undefined`. The prepared statement [parameters are bound][] using the values in `namedParameters` and `anonymousParameters`. ### `statement.iterate([namedParameters][, ...anonymousParameters])` \* `namedParameters` {Object} An optional object used to bind named parameters. The keys of this object are used to configure the mapping. \* `...anonymousParameters` {null|number|bigint|string|Buffer|TypedArray|DataView} Zero or more values to bind to anonymous parameters. \* Returns: {Iterator} An iterable iterator of objects. Each object corresponds to a row returned by executing the prepared statement. The keys and values of each object correspond to the column names and values of the row. This method executes a prepared statement and returns an iterator of objects. If the prepared statement does not return any results, this method returns an empty iterator. The prepared statement [parameters are bound][] using the values in `namedParameters` and `anonymousParameters`. ### `statement.run([namedParameters][, ...anonymousParameters])` \* `namedParameters` {Object} An optional object used to bind named parameters. The keys of this object are used to configure the mapping. \* `...anonymousParameters` {null|number|bigint|string|Buffer|TypedArray|DataView} Zero or more values to bind to anonymous parameters. \* Returns: {Object} \* `changes` {number|bigint} The number of rows modified, inserted, or deleted by the most recently completed `INSERT`, `UPDATE`, or `DELETE` statement. This field is either a number or a `BigInt` depending on the prepared statement's configuration. This property is the result of [`sqlite3\_changes64()`][]. \* `lastInsertRowid` {number|bigint} The most recently inserted rowid. This field is either a number or a `BigInt` depending on the prepared statement's configuration. This property is the result of [`sqlite3\_last\_insert\_rowid()`][]. This method executes a prepared statement and returns an object summarizing the resulting changes. The prepared statement [parameters are bound][] using the values in `namedParameters` and `anonymousParameters`. ### `statement.setAllowBareNamedParameters(enabled)` \* `enabled` {boolean} Enables or disables support for binding named parameters without the prefix character. The names of SQLite parameters begin with a prefix character. By default, `node:sqlite` requires that this prefix character is present when binding parameters. However, with the exception of dollar sign character, these prefix characters also require extra quoting when used in object keys. To improve ergonomics, this method can be used to also allow bare named parameters, which do not require the prefix character in JavaScript code. There are several caveats to be aware of when enabling bare named parameters: \* The prefix character is still required in SQL. \* The prefix character is still allowed in JavaScript. In fact, prefixed names will have slightly better binding performance. \* Using ambiguous named parameters, such as `$k` and `@k`, in the same prepared statement will result in an exception as it cannot be determined how to bind a bare name. ### `statement.setAllowUnknownNamedParameters(enabled)` \* `enabled` {boolean} Enables or disables support for unknown named parameters. By default, if an unknown name is encountered while binding parameters, an exception is thrown. This method allows unknown named parameters to be ignored. ### `statement.setReturnArrays(enabled)` \* `enabled` {boolean} Enables or disables the return of query results as arrays. When enabled, query results returned by the `all()`, `get()`, and `iterate()` methods will be returned as arrays instead of objects. ### `statement.setReadBigInts(enabled)` \* `enabled` {boolean} Enables or disables the use of `BigInt`s when reading `INTEGER` fields from the database. When reading from the database, SQLite `INTEGER`s are mapped to JavaScript numbers by default. However, SQLite `INTEGER`s can store values larger than JavaScript numbers are capable of representing. In such cases, this method can be used to read `INTEGER` data using JavaScript `BigInt`s. This method has no impact on database write operations where numbers and `BigInt`s are both supported at all times. ### `statement.sourceSQL` \* Type: {string} The source SQL used to create this prepared statement. The source SQL text | https://github.com/nodejs/node/blob/main//doc/api/sqlite.md | main | nodejs | [
-0.016823040321469307,
0.02907014824450016,
-0.09811455756425858,
0.05144574120640755,
-0.11922727525234222,
-0.07106947153806686,
0.003878807881847024,
0.04171907156705856,
-0.04553864896297455,
-0.0440797433257103,
0.027840813621878624,
-0.044333316385746,
0.0354759581387043,
-0.11061637103557587,
-0.011200468055903912,
0.0690312385559082,
-0.010494252666831017,
-0.11834415048360825,
-0.04990866035223007,
-0.020093446597456932,
0.029683630913496017,
0.05577488988637924,
-0.05596689134836197,
-0.039548199623823166,
-0.009870232082903385,
0.06454658508300781,
-0.009381469339132309,
-0.06652999669313431,
0.05650020390748978,
0.005036260932683945,
-0.01844830811023712,
-0.037256523966789246,
-0.09664856642484665,
0.12322763353586197,
0.0017991287168115377,
0.021688034757971764,
0.030110416933894157,
-0.014170429669320583,
-0.005178018007427454,
0.01050285529345274,
0.03972321376204491,
0.051528338342905045,
-0.09472770988941193,
-0.007637724746018648,
0.017734818160533905,
0.051606230437755585,
-0.06577526777982712,
-0.029292214661836624,
-0.11468039453029633,
-0.06792834401130676,
-0.07916682213544846,
0.02789568156003952,
0.010214850306510925,
-0.03228810057044029,
-0.0021796992514282465,
-0.07397816330194473,
-0.06925264000892639,
-0.05845291540026665,
-0.013250925578176975,
0.01758708246052265,
-0.011409098282456398,
-0.0583222433924675,
0.016786783933639526,
0.07365017384290695,
0.05440009757876396,
-0.07817390561103821,
0.0902632474899292,
-0.03203469514846802,
0.11276666074991226,
-0.048131946474313736,
-0.09866572171449661,
0.055625881999731064,
0.030822496861219406,
0.03534868359565735,
0.012021007016301155,
0.008323836140334606,
0.08031648397445679,
-0.060626786202192307,
0.04911606013774872,
-0.046917542815208435,
0.01814998686313629,
-0.004211118910461664,
-0.08296161144971848,
0.006535612978041172,
-0.00325385807082057,
0.016089776530861855,
-0.04446857050061226,
0.04881443455815315,
0.05537187680602074,
0.07588685303926468,
-0.05221770703792572,
-0.05786982178688049,
-0.06488148868083954,
0.06434867531061172,
0.007704391144216061,
0.01597539521753788,
0.06709340214729309,
-0.011897474527359009,
-0.044302280992269516,
-0.0055374628864228725,
-0.015565394423902035,
0.01386482547968626,
0.011674444191157818,
-0.06958945840597153,
-0.11165551841259003,
-0.05990443006157875,
0.06790095567703247,
-0.1326303333044052,
-0.032216619700193405,
0.06644926220178604,
0.020707672461867332,
0.057324107736349106,
0.006188077852129936,
-0.03032883070409298,
-0.05838896334171295,
-0.03818690776824951,
-0.05183880776166916,
0.0016383595066145062,
0.04683008790016174,
-0.018556153401732445,
0.04458538815379143,
0.0026029779110103846,
-0.043052446097135544,
0.00630994513630867,
-0.0557471327483654,
0.07576700299978256,
-0.047979481518268585,
4.003810533375499e-33,
0.050253406167030334,
-0.032917797565460205,
0.03257383778691292,
0.034366242587566376,
-0.02995479665696621,
0.05199231207370758,
0.06963707506656647,
0.0461135134100914,
-0.004228522535413504,
0.07894247025251389,
-0.04865278676152229,
-0.012235828675329685,
0.00863940455019474,
0.06260303407907486,
0.002766561461612582,
0.0691310465335846,
0.08696059137582779,
0.02841848134994507,
-0.05881567299365997,
-0.013029874302446842,
0.08421074599027634,
0.07064802199602127,
-0.032700613141059875,
0.0189472995698452,
0.02195732109248638,
0.013470351696014404,
-0.0061667850241065025,
0.017994839698076248,
-0.0720723494887352,
0.004869411699473858,
-0.015740223228931427,
-0.046639334410429,
-0.04738934710621834,
0.04638471081852913,
0.12138371914625168,
-0.016218209639191628,
0.029604602605104446,
0.005349180195480585,
-0.014255001209676266,
-0.016849469393491745,
-0.038443125784397125,
-0.036364808678627014,
0.008534012362360954,
0.04105132818222046,
-0.030655691400170326,
-0.13217651844024658,
-0.057615384459495544,
0.08399394154548645,
-0.034401677548885345,
-0.0024615186266601086,
-0.09244202077388763,
0.018881404772400856,
-0.021890640258789062,
-0.00025840839953161776,
0.03341016545891762,
0.0033454294316470623,
-0.004240573383867741,
0.0033638551831245422,
-0.007261256687343121,
0.05413272604346275,
-0.10906878113746643,
0.030212340876460075,
-0.08128485828638077,
-0.0025887887459248304,
0.027770381420850754,
0.04669642075896263,
0.05286191403865814,
-0.0658399909734726,
0.04093283787369728,
-0.00953714456409216,
-0.010566572658717632,
0.004007612355053425,
-0.02775953896343708,
-0.008696738630533218,
0.0303069856017828,
-0.04483303427696228,
-0.042941030114889145,
-0.06509223580360413,
0.014175924472510815,
-0.06505922228097916,
0.066776804625988,
-0.002017346443608403,
-0.006640739738941193,
0.08440186828374863,
-0.019667020067572594,
0.01883227378129959,
-0.021810753270983696,
-0.011300626210868359,
0.0441097654402256,
-0.04841401427984238,
-0.014409379102289677,
-0.020103855058550835,
-0.062281958758831024,
-0.09117185324430466,
0.022512977942824364,
-6.859049944666357e-33,
0.07885396480560303,
0.013849168084561825,
-0.09355121850967407,
0.06297415494918823,
-0.020691528916358948,
-0.05655386671423912,
0.0193425714969635,
0.00853284914046526,
-0.00014629594807047397,
-0.10037519037723541,
-0.050509825348854065,
0.03402777761220932,
0.0773906260728836,
-0.037170253694057465,
0.08492836356163025,
0.061154723167419434,
-0.0935659408569336,
-0.03343924880027771,
-0.0396195612847805,
-0.021643340587615967,
0.016491489484906197,
0.010561158880591393,
0.04565415903925896,
0.02729763649404049,
-0.08367787301540375,
-0.04603933170437813,
0.014149867929518223,
0.024081004783511162,
0.023641511797904968,
0.045987144112586975,
0.08364202827215195,
-0.07017993927001953,
0.009103083051741123,
-0.0368465781211853,
-0.03056350164115429,
-0.04231803119182587,
0.12421385198831558,
-0.00843486376106739,
-0.013395844027400017,
0.03218333050608635,
-0.01861034892499447,
0.029411492869257927,
0.04677823185920715,
-0.017106354236602783,
-0.01380208507180214,
-0.007174152415245771,
-0.0010132202878594398,
0.07598038762807846,
0.030765704810619354,
-0.023798564448952675,
0.04161921143531799,
-0.05761856213212013,
-0.04254663735628128,
0.045986004173755646,
0.046449050307273865,
-0.028467580676078796,
-0.014399778097867966,
-0.0709773451089859,
0.06577620655298233,
0.008562161587178707,
-0.05063311383128166,
-0.03835497051477432,
0.06504934281110764,
0.05257825925946236,
-0.024038124829530716,
-0.008275474421679974,
-0.07677313685417175,
-0.06717457622289658,
0.012232094071805477,
0.027061831206083298,
0.005983815528452396,
-0.07204803824424744,
0.02775472216308117,
-0.0605955645442009,
0.02976227179169655,
0.057114262133836746,
-0.04726312309503555,
-0.007786779198795557,
0.06907599419355392,
0.03551774099469185,
0.0573001503944397,
-0.023113885894417763,
0.10097549855709076,
0.040226031094789505,
0.09975681453943253,
0.01945979706943035,
0.1176852211356163,
0.08570811152458191,
-0.07965254783630371,
0.03244372457265854,
0.06647752970457077,
0.03538573160767555,
-0.045787204056978226,
0.08076254278421402,
0.02898477576673031,
-5.679542880443478e-8,
-0.019466089084744453,
-0.036827344447374344,
-0.03146844357252121,
-0.012297923676669598,
-0.00491997878998518,
-0.022625502198934555,
0.06334926187992096,
0.03809618204832077,
0.041159313172101974,
0.005592175293713808,
0.06078304350376129,
-0.006551465485244989,
0.004834095947444439,
-0.030993927270174026,
0.09736298024654388,
-0.017809618264436722,
0.0322316512465477,
-0.009761115536093712,
-0.07274971157312393,
0.00365173676982522,
-0.020545287057757378,
-0.07668060809373856,
-0.09472473710775375,
-0.07691000401973724,
0.1529628038406372,
0.0158929992467165,
0.01451429445296526,
0.03293530270457268,
0.014133184216916561,
0.052011169493198395,
-0.0070415339432656765,
0.03392678499221802,
0.06948653608560562,
-0.03272172808647156,
-0.057332780212163925,
0.059846166521310806,
0.045752547681331635,
0.025989769026637077,
0.06619356572628021,
0.03260664641857147,
-0.038486696779727936,
0.052574269473552704,
-0.01604434661567211,
0.01851157285273075,
0.0011403727112337947,
-0.00423508882522583,
0.026064034551382065,
0.04179232940077782,
0.011494065634906292,
-0.016044581308960915,
-0.11885949969291687,
0.006587098352611065,
-0.016845818608999252,
0.03930799290537834,
-0.0761653408408165,
-0.015512325800955296,
-0.053446851670742035,
0.01979488506913185,
0.055937089025974274,
0.027803542092442513,
0.017747286707162857,
-0.019571561366319656,
-0.04692572355270386,
0.021237118169665337
] | 0.104503 |
cases, this method can be used to read `INTEGER` data using JavaScript `BigInt`s. This method has no impact on database write operations where numbers and `BigInt`s are both supported at all times. ### `statement.sourceSQL` \* Type: {string} The source SQL used to create this prepared statement. The source SQL text of the prepared statement. This property is a wrapper around [`sqlite3\_sql()`][]. ## Class: `SQLTagStore` This class represents a single LRU (Least Recently Used) cache for storing prepared statements. Instances of this class are created via the [`database.createTagStore()`][] method, not by using a constructor. The store caches prepared statements based on the provided SQL query string. When the same query is seen again, the store retrieves the cached statement and safely applies the new values through parameter binding, thereby preventing attacks like SQL injection. The cache has a maxSize that defaults to 1000 statements, but a custom size can be provided (e.g., `database.createTagStore(100)`). All APIs exposed by this class execute synchronously. ### `sqlTagStore.all(stringElements[, ...boundParameters])` \* `stringElements` {string\[]} Template literal elements containing the SQL query. \* `...boundParameters` {null|number|bigint|string|Buffer|TypedArray|DataView} Parameter values to be bound to placeholders in the template string. \* Returns: {Array} An array of objects representing the rows returned by the query. Executes the given SQL query and returns all resulting rows as an array of objects. This function is intended to be used as a template literal tag, not to be called directly. ### `sqlTagStore.get(stringElements[, ...boundParameters])` \* `stringElements` {string\[]} Template literal elements containing the SQL query. \* `...boundParameters` {null|number|bigint|string|Buffer|TypedArray|DataView} Parameter values to be bound to placeholders in the template string. \* Returns: {Object | undefined} An object representing the first row returned by the query, or `undefined` if no rows are returned. Executes the given SQL query and returns the first resulting row as an object. This function is intended to be used as a template literal tag, not to be called directly. ### `sqlTagStore.iterate(stringElements[, ...boundParameters])` \* `stringElements` {string\[]} Template literal elements containing the SQL query. \* `...boundParameters` {null|number|bigint|string|Buffer|TypedArray|DataView} Parameter values to be bound to placeholders in the template string. \* Returns: {Iterator} An iterator that yields objects representing the rows returned by the query. Executes the given SQL query and returns an iterator over the resulting rows. This function is intended to be used as a template literal tag, not to be called directly. ### `sqlTagStore.run(stringElements[, ...boundParameters])` \* `stringElements` {string\[]} Template literal elements containing the SQL query. \* `...boundParameters` {null|number|bigint|string|Buffer|TypedArray|DataView} Parameter values to be bound to placeholders in the template string. \* Returns: {Object} An object containing information about the execution, including `changes` and `lastInsertRowid`. Executes the given SQL query, which is expected to not return any rows (e.g., INSERT, UPDATE, DELETE). This function is intended to be used as a template literal tag, not to be called directly. ### `sqlTagStore.size` \* Type: {integer} A read-only property that returns the number of prepared statements currently in the cache. ### `sqlTagStore.capacity` \* Type: {integer} A read-only property that returns the maximum number of prepared statements the cache can hold. ### `sqlTagStore.db` \* Type: {DatabaseSync} A read-only property that returns the `DatabaseSync` object associated with this `SQLTagStore`. ### `sqlTagStore.clear()` Resets the LRU cache, clearing all stored prepared statements. ### Type conversion between JavaScript and SQLite When Node.js writes to or reads from SQLite it is necessary to convert between JavaScript data types and SQLite's [data types][]. Because JavaScript supports more data types than SQLite, only a subset of JavaScript types are supported. Attempting to write an unsupported data type to SQLite will result in an exception. | SQLite | JavaScript | | --------- | -------------------------- | | `NULL` | {null} | | https://github.com/nodejs/node/blob/main//doc/api/sqlite.md | main | nodejs | [
0.015429427847266197,
0.04542509466409683,
-0.06581849604845047,
0.07421404868364334,
-0.039420273154973984,
-0.05576293542981148,
0.08486148715019226,
0.06694275885820389,
-0.03035668097436428,
0.00631808303296566,
-0.046225253492593765,
0.050343092530965805,
0.05357811599969864,
-0.09013552218675613,
-0.02432539500296116,
0.016435952857136726,
0.008750474080443382,
-0.008919890969991684,
-0.10726577788591385,
0.02836780436336994,
0.052104461938142776,
-0.01651947759091854,
0.028744041919708252,
0.06803839653730392,
0.013698137365281582,
-0.04408369958400726,
-0.04559130221605301,
0.015308615751564503,
0.11543884128332138,
0.05280116945505142,
-0.03238959610462189,
-0.019738774746656418,
-0.04671984165906906,
0.03232599422335625,
-0.026248237118124962,
0.01316404901444912,
-0.025693949311971664,
-0.013495240360498428,
-0.023214183747768402,
0.02377578243613243,
0.05391477420926094,
0.015439501963555813,
-0.06884677708148956,
0.06728508323431015,
0.03333795815706253,
-0.02561783418059349,
-0.06761317700147629,
0.007787690032273531,
-0.12836657464504242,
0.00665313983336091,
-0.04173918440937996,
0.030203595757484436,
-0.020581521093845367,
-0.0013960045762360096,
-0.0017123633297160268,
-0.0030020831618458033,
-0.05965769663453102,
-0.005565278697758913,
-0.06778490543365479,
0.08695227652788162,
-0.021343452855944633,
-0.0008081762352958322,
0.06612901389598846,
-0.03387826681137085,
-0.00485966494306922,
-0.05011916533112526,
0.05000470578670502,
-0.027352647855877876,
0.10463382303714752,
-0.06153491511940956,
0.035159990191459656,
0.03149297460913658,
-0.02286217175424099,
0.041389670222997665,
0.033463526517152786,
0.010739653371274471,
-0.002497786656022072,
0.0041169580072164536,
-0.005153785925358534,
0.028445418924093246,
-0.02454470843076706,
-0.12137513607740402,
-0.04490768536925316,
-0.03700777515769005,
0.02807193621993065,
-0.04507307708263397,
0.11704038828611374,
0.03998129442334175,
0.1136796772480011,
0.05343405902385712,
-0.0018180783372372389,
0.03319821134209633,
-0.021613843739032745,
0.027491653338074684,
-0.02089320495724678,
0.025416715070605278,
0.008469262160360813,
0.030217157676815987,
0.04762529209256172,
0.02487787790596485,
0.04958368092775345,
0.0217231884598732,
-0.04698101803660393,
0.009582450613379478,
-0.05120320990681648,
-0.10968998819589615,
0.09843502938747406,
-0.019039947539567947,
-0.04461153969168663,
-0.03574630245566368,
0.03212495520710945,
0.09573140740394592,
0.026849132031202316,
-0.04072735458612442,
-0.01706409826874733,
0.04808890447020531,
-0.015639465302228928,
-0.03897939622402191,
0.047851838171482086,
0.0017529285978525877,
0.12549984455108643,
0.0815126821398735,
-0.047157738357782364,
-0.05997076630592346,
-0.05434940382838249,
0.04717305302619934,
0.006117549259215593,
4.5997387821263816e-33,
0.028563663363456726,
-0.02178848162293434,
0.04430802911520004,
0.0026961700059473515,
-0.04024927690625191,
0.1154877096414566,
-0.04074496775865555,
0.02561883069574833,
-0.07526277005672455,
0.04411163926124573,
0.005632959306240082,
-0.04152790084481239,
-0.050010062754154205,
0.029492584988474846,
0.07347430288791656,
0.0766216367483139,
0.02272438257932663,
0.05182209238409996,
0.07345438748598099,
-0.034395672380924225,
0.08812680840492249,
-0.02716768905520439,
-0.018849562853574753,
0.02711501717567444,
0.028931165114045143,
0.08500892668962479,
0.0038834179285913706,
0.056930724531412125,
-0.03264376521110535,
0.015206432901322842,
-0.050032805651426315,
-0.051442380994558334,
-0.11047617346048355,
0.023186832666397095,
0.06999015063047409,
-0.010938095860183239,
-0.052361782640218735,
-0.00022916088346391916,
0.00040329189505428076,
0.008124140091240406,
-0.02739684283733368,
0.014074322767555714,
0.02256147377192974,
0.006839381065219641,
-0.039636582136154175,
-0.0169199388474226,
-0.03993450850248337,
0.07822183519601822,
-0.031144723296165466,
-0.08191080391407013,
-0.0701540857553482,
0.01480557955801487,
0.01098095066845417,
-0.002406887011602521,
0.06406064331531525,
-0.011697767302393913,
0.0709603801369667,
-0.014171347953379154,
0.038096461445093155,
0.014589592814445496,
-0.09116390347480774,
0.0016967256087809801,
0.04294997453689575,
0.016688967123627663,
-0.02190842106938362,
0.07582142949104309,
0.02408077009022236,
-0.03168947249650955,
0.04113487899303436,
-0.004797056782990694,
0.029883408918976784,
0.024867041036486626,
-0.03384189307689667,
-0.018592339009046555,
-0.040978044271469116,
-0.07726634293794632,
-0.0033113884273916483,
0.05625453591346741,
-0.018815211951732635,
-0.0011218289146199822,
0.04461599886417389,
-0.042869482189416885,
-0.04359149560332298,
0.13354437053203583,
-0.06755579262971878,
-0.04853828251361847,
-0.05028236284852028,
-0.01731918938457966,
0.07740239799022675,
-0.02002132125198841,
0.05575054883956909,
-0.046476248651742935,
0.048480939120054245,
-0.11636342108249664,
-0.05747014284133911,
-4.7620576542436464e-33,
-0.03531734272837639,
-0.04661982133984566,
-0.05470292642712593,
0.03655782341957092,
-0.09276244789361954,
-0.09814390540122986,
-0.0179496668279171,
0.048315104097127914,
0.012634659186005592,
-0.07487939298152924,
0.022651204839348793,
0.03476160764694214,
0.012618305161595345,
-0.021178504452109337,
0.026105806231498718,
0.047405753284692764,
-0.022427594289183617,
-0.09384294599294662,
0.03977992385625839,
-0.010910892859101295,
0.050203837454319,
0.009059891104698181,
-0.002189238555729389,
0.10579502582550049,
0.005537537857890129,
-0.03257105499505997,
-0.0484866127371788,
-0.021612633019685745,
-0.021066920831799507,
-0.02551000751554966,
-0.031520504504442215,
-0.09470144659280777,
-0.009144967421889305,
-0.024341771379113197,
-0.039705369621515274,
-0.12510046362876892,
0.08150631189346313,
-0.044106677174568176,
-0.006373148877173662,
0.0513455793261528,
-0.0675642341375351,
0.0015564269851893187,
0.056309401988983154,
0.03931642696261406,
0.01584656722843647,
-0.015330365858972073,
-0.001803859369829297,
0.029020145535469055,
0.059369247406721115,
-0.046622198075056076,
0.039760250598192215,
-0.07809466868638992,
-0.045797184109687805,
0.0031218514777719975,
0.08434813469648361,
-0.05693142116069794,
-0.07844922691583633,
-0.0016313603846356273,
0.0048319874331355095,
-0.0398821160197258,
-0.0030414711218327284,
-0.018232546746730804,
0.0021252634469419718,
-0.016158519312739372,
-0.07265587151050568,
-0.026018746197223663,
-0.09125418961048126,
-0.06532003730535507,
-0.04509769752621651,
-0.004467105958610773,
0.05823616683483124,
-0.07569558173418045,
0.08932219445705414,
0.029503008350729942,
-0.10030727833509445,
0.013165024109184742,
0.008624492213129997,
0.059298645704984665,
0.038041241466999054,
0.07667181640863419,
0.013400069437921047,
0.06115579977631569,
0.08636537194252014,
-0.01022935938090086,
-0.014356357976794243,
-0.07484458386898041,
0.02519586682319641,
0.05752316862344742,
-0.0836932361125946,
0.01796567067503929,
-0.034615591168403625,
0.029017049819231033,
-0.11634133011102676,
0.0696844607591629,
0.016195140779018402,
-5.2268955386125526e-8,
-0.046026378870010376,
-0.0026867890264838934,
-0.10681455582380295,
-0.059387728571891785,
0.06475687772035599,
-0.059315793216228485,
-0.04227922856807709,
0.09078110009431839,
0.06583795696496964,
0.054378803819417953,
0.05128898099064827,
0.07535579055547714,
0.02001062221825123,
-0.056409720331430435,
0.02415386214852333,
-0.01805131882429123,
0.02142801694571972,
-0.1251058578491211,
-0.06475815922021866,
-0.04279032349586487,
-0.02601739391684532,
0.048210568726062775,
-0.028710002079606056,
-0.0699603259563446,
0.13707686960697174,
0.0005034388159401715,
0.04815198481082916,
0.0640292838215828,
-0.010244062170386314,
-0.01409166119992733,
0.033671580255031586,
0.01348932832479477,
0.025610066950321198,
0.007701588328927755,
0.02700999565422535,
0.07822888344526291,
0.023174865171313286,
0.027213532477617264,
0.08414191752672195,
-0.0358646921813488,
0.02027428150177002,
-0.07948287576436996,
-0.034503381699323654,
0.029997600242495537,
-0.02525959722697735,
-0.04715884476900101,
-0.05825934559106827,
0.06606274098157883,
0.0403253547847271,
0.05045517534017563,
-0.0414055660367012,
-0.024679480120539665,
0.018146490678191185,
0.020181411877274513,
-0.026463257148861885,
-0.022677036002278328,
-0.04828863590955734,
-0.021187465637922287,
0.03826185315847397,
-0.03622019663453102,
0.07330960035324097,
-0.03746277466416359,
0.061968546360731125,
-0.00906502828001976
] | 0.089072 |
types and SQLite's [data types][]. Because JavaScript supports more data types than SQLite, only a subset of JavaScript types are supported. Attempting to write an unsupported data type to SQLite will result in an exception. | SQLite | JavaScript | | --------- | -------------------------- | | `NULL` | {null} | | `INTEGER` | {number} or {bigint} | | `REAL` | {number} | | `TEXT` | {string} | | `BLOB` | {TypedArray} or {DataView} | ## `sqlite.backup(sourceDb, path[, options])` \* `sourceDb` {DatabaseSync} The database to backup. The source database must be open. \* `path` {string | Buffer | URL} The path where the backup will be created. If the file already exists, the contents will be overwritten. \* `options` {Object} Optional configuration for the backup. The following properties are supported: \* `source` {string} Name of the source database. This can be `'main'` (the default primary database) or any other database that have been added with [`ATTACH DATABASE`][] \*\*Default:\*\* `'main'`. \* `target` {string} Name of the target database. This can be `'main'` (the default primary database) or any other database that have been added with [`ATTACH DATABASE`][] \*\*Default:\*\* `'main'`. \* `rate` {number} Number of pages to be transmitted in each batch of the backup. \*\*Default:\*\* `100`. \* `progress` {Function} An optional callback function that will be called after each backup step. The argument passed to this callback is an {Object} with `remainingPages` and `totalPages` properties, describing the current progress of the backup operation. \* Returns: {Promise} A promise that fulfills with the total number of backed-up pages upon completion, or rejects if an error occurs. This method makes a database backup. This method abstracts the [`sqlite3\_backup\_init()`][], [`sqlite3\_backup\_step()`][] and [`sqlite3\_backup\_finish()`][] functions. The backed-up database can be used normally during the backup process. Mutations coming from the same connection - same {DatabaseSync} - object will be reflected in the backup right away. However, mutations from other connections will cause the backup process to restart. ```cjs const { backup, DatabaseSync } = require('node:sqlite'); (async () => { const sourceDb = new DatabaseSync('source.db'); const totalPagesTransferred = await backup(sourceDb, 'backup.db', { rate: 1, // Copy one page at a time. progress: ({ totalPages, remainingPages }) => { console.log('Backup in progress', { totalPages, remainingPages }); }, }); console.log('Backup completed', totalPagesTransferred); })(); ``` ```mjs import { backup, DatabaseSync } from 'node:sqlite'; const sourceDb = new DatabaseSync('source.db'); const totalPagesTransferred = await backup(sourceDb, 'backup.db', { rate: 1, // Copy one page at a time. progress: ({ totalPages, remainingPages }) => { console.log('Backup in progress', { totalPages, remainingPages }); }, }); console.log('Backup completed', totalPagesTransferred); ``` ## `sqlite.constants` \* Type: {Object} An object containing commonly used constants for SQLite operations. ### SQLite constants The following constants are exported by the `sqlite.constants` object. #### Conflict resolution constants One of the following constants is available as an argument to the `onConflict` conflict resolution handler passed to [`database.applyChangeset()`][]. See also [Constants Passed To The Conflict Handler][] in the SQLite documentation. | Constant | Description | | --- | --- | | `SQLITE_CHANGESET_DATA` | The conflict handler is invoked with this constant when processing a DELETE or UPDATE change if a row with the required PRIMARY KEY fields is present in the database, but one or more other (non primary-key) fields modified by the update do not contain the expected "before" values. | | `SQLITE_CHANGESET_NOTFOUND` | The conflict handler is invoked with this constant when processing a DELETE or UPDATE change if a row with the required PRIMARY KEY fields is not present in the database. | | `SQLITE_CHANGESET_CONFLICT` | This constant is passed to the conflict handler while processing an INSERT change if the operation would | https://github.com/nodejs/node/blob/main//doc/api/sqlite.md | main | nodejs | [
-0.06992650032043457,
-0.07683559507131577,
-0.002104907063767314,
0.053792160004377365,
-0.015402266755700111,
0.0005475017242133617,
0.05038776993751526,
0.06549470126628876,
-0.07232136279344559,
-0.03597605228424072,
-0.05356431379914284,
0.016202785074710846,
0.0502476692199707,
-0.07712441682815552,
-0.04868634417653084,
0.08890704810619354,
-0.10324036329984665,
-0.01674753800034523,
-0.05008265748620033,
0.10733753442764282,
-0.023083560168743134,
0.003619699738919735,
0.07825823128223419,
0.01900600641965866,
0.0926581397652626,
0.0554811954498291,
0.07054699957370758,
-0.023089058697223663,
-0.050164081156253815,
0.051305629312992096,
-0.04703506454825401,
-0.0782967060804367,
-0.03324892744421959,
0.0626928061246872,
-0.0022646260913461447,
0.05887698382139206,
-0.024662120267748833,
0.02569408342242241,
-0.06528030335903168,
0.005425944924354553,
-0.01938663236796856,
0.030915025621652603,
-0.05233191326260567,
0.01070829015225172,
-0.08054328709840775,
-0.08960562944412231,
-0.0856245756149292,
-0.04941681772470474,
-0.06467334181070328,
0.013621058315038681,
-0.023610956966876984,
0.044676970690488815,
-0.08503563702106476,
0.007808207534253597,
0.05198872834444046,
0.02502298727631569,
-0.0514361634850502,
0.060685329139232635,
-0.03831937164068222,
0.08249935507774353,
0.05403023958206177,
-0.03252033516764641,
0.03982771933078766,
-0.07502420991659164,
0.06966228038072586,
0.01902974769473076,
-0.06829380244016647,
0.041249874979257584,
0.030698493123054504,
-0.05045168474316597,
-0.012878439389169216,
0.03248768299818039,
-0.12290047109127045,
0.05849219486117363,
-0.034633271396160126,
-0.05803776532411575,
0.07537993043661118,
0.04823075607419014,
-0.03943604975938797,
-0.01159604825079441,
-0.038032371550798416,
-0.10693272948265076,
-0.07929862290620804,
0.06658080220222473,
0.028710011392831802,
-0.023975849151611328,
0.0035178279504179955,
0.13943640887737274,
0.027444379404187202,
0.018507709726691246,
-0.027995049953460693,
0.038582999259233475,
0.02690475434064865,
0.049288343638181686,
0.07455836981534958,
0.029862405732274055,
-0.00924728624522686,
0.037934087216854095,
0.09700408577919006,
-0.028576083481311798,
-0.021879123523831367,
-0.011557012796401978,
-0.0004612231277860701,
0.04065237566828728,
0.0021829837933182716,
-0.08567706495523453,
0.11129419505596161,
-0.09821430593729019,
0.005149473436176777,
-0.003721771528944373,
-0.0065840608440339565,
0.06234050542116165,
-0.008974669501185417,
-0.005626281723380089,
-0.020457802340388298,
-0.05750617757439613,
-0.0471329428255558,
-0.029939057305455208,
-0.005239433608949184,
0.031913939863443375,
0.049184925854206085,
0.08719368278980255,
0.032000888139009476,
-0.05897996574640274,
0.037056416273117065,
-0.006989748682826757,
0.02566477470099926,
3.0862806218930706e-33,
0.00411334028467536,
-0.004752027802169323,
0.08163554966449738,
-0.023927954956889153,
0.029626762494444847,
0.05854658782482147,
-0.03437037765979767,
0.08138632774353027,
-0.04117489606142044,
0.009661916643381119,
-0.04446753114461899,
-0.0005880369571968913,
-0.045481037348508835,
-0.010584256611764431,
0.015287134796380997,
0.014483626931905746,
0.061672139912843704,
0.0004814369895029813,
0.05716418847441673,
-0.003377228043973446,
0.060818862169981,
0.058754757046699524,
-0.032052312046289444,
0.010402532294392586,
-0.09303285926580429,
-0.06756935268640518,
0.05108797177672386,
0.059322379529476166,
-0.00993914995342493,
-0.0168191809207201,
-0.020571013912558556,
-0.0727219358086586,
-0.02754400111734867,
-0.011137151159346104,
0.039864879101514816,
0.02848060056567192,
-0.1109313890337944,
0.012585736811161041,
-0.06962742656469345,
0.03878745436668396,
-0.0040644146502017975,
0.016296938061714172,
-0.10567091405391693,
0.050242628902196884,
0.023364780470728874,
-0.062455058097839355,
0.03888128697872162,
-0.02114434540271759,
-0.048869919031858444,
-0.04825271666049957,
-0.10963978618383408,
0.002112810732796788,
0.0025244387798011303,
-0.038171909749507904,
0.012647576630115509,
-0.01401440054178238,
0.006766964681446552,
-0.020085111260414124,
0.019190017133951187,
-0.01786762848496437,
0.04788442328572273,
0.059676025062799454,
0.029431333765387535,
-0.026255810633301735,
-0.00009273921750718728,
0.004506404045969248,
-0.007719462271779776,
-0.05169789120554924,
0.016962805762887,
-0.03520531207323074,
0.06349015980958939,
0.01136025134474039,
-0.012686328031122684,
-0.014050489291548729,
-0.02975797839462757,
-0.009330951608717442,
-0.06149422377347946,
0.012751803733408451,
-0.02941969595849514,
-0.010546688921749592,
-0.035220906138420105,
-0.11175202578306198,
-0.04088062047958374,
-0.06208522990345955,
0.017093107104301453,
0.06255950778722763,
-0.061794113367795944,
-0.07478465884923935,
0.062447741627693176,
0.004750083200633526,
0.002763309283182025,
-0.050572607666254044,
-0.040551070123910904,
-0.15429583191871643,
0.04446206986904144,
-5.138248172601426e-33,
0.04151942953467369,
-0.04266725480556488,
-0.025114906951785088,
0.03501838073134422,
-0.014634083956480026,
0.020175935700535774,
-0.049147773534059525,
0.03333715721964836,
0.006188035476952791,
-0.025343207642436028,
-0.02889060415327549,
0.03839351236820221,
0.045963309705257416,
-0.09067520499229431,
-0.009983432479202747,
0.02093925140798092,
-0.041220586746931076,
-0.061069585382938385,
-0.03996216505765915,
-0.0495322048664093,
0.039194170385599136,
0.03037075884640217,
0.023290300741791725,
0.12262817472219467,
-0.007989201694726944,
-0.03373115137219429,
-0.037852611392736435,
0.024060383439064026,
0.001727354247123003,
-0.04934315010905266,
-0.006515558809041977,
0.00151813926640898,
0.02512693591415882,
0.04214856028556824,
-0.011421790346503258,
-0.07209093123674393,
-0.0076636443845927715,
0.03633273392915726,
0.0142579460516572,
0.05145525559782982,
-0.06984308362007141,
-0.04696507006883621,
0.05585130304098129,
-0.02074810303747654,
-0.0017080522375181317,
0.014692984521389008,
0.002711344975978136,
0.08671073615550995,
0.025065235793590546,
-0.051762595772743225,
0.09151037037372589,
-0.07251020520925522,
-0.06077589467167854,
-0.007270225323736668,
0.14475946128368378,
0.017731716856360435,
0.004307058174163103,
-0.07009413838386536,
0.03465103358030319,
0.032943569123744965,
0.0020113943610340357,
-0.07214681059122086,
0.04907282069325447,
-0.04575096070766449,
-0.07655927538871765,
-0.08298438787460327,
-0.04957333579659462,
0.022869043052196503,
-0.02643442340195179,
-0.03402905911207199,
-0.02587178163230419,
-0.0002105797902913764,
0.11280641704797745,
0.077520452439785,
0.015947282314300537,
0.05213892087340355,
-0.03956841304898262,
-0.001840385957621038,
0.05133857950568199,
0.0624418631196022,
0.07466471195220947,
0.052102066576480865,
0.05829824134707451,
0.007287229411303997,
0.05757367983460426,
-0.019153302535414696,
-0.0647580474615097,
-0.0319928340613842,
-0.08098816126585007,
-0.018461203202605247,
-0.023080743849277496,
0.00030484877061098814,
-0.057517897337675095,
0.04586132988333702,
0.007739117834717035,
-5.152689297460711e-8,
-0.04616318270564079,
0.015676375478506088,
-0.09457165747880936,
-0.03805198892951012,
0.014721661806106567,
-0.12213515490293503,
-0.0024689624551683664,
-0.01098483707755804,
0.11392965912818909,
-0.005379055626690388,
-0.005642748903483152,
-0.00009308782318839803,
0.009427020326256752,
0.05833058804273605,
-0.02580973505973816,
-0.057555023580789566,
0.09352987259626389,
-0.0936107411980629,
0.019118424504995346,
0.06817976385354996,
-0.0003671981394290924,
-0.07780124992132187,
-0.042625244706869125,
0.00022055668523535132,
0.09074326604604721,
0.03829497471451759,
-0.030323754996061325,
0.03485512360930443,
-0.008766865357756615,
0.03135361894965172,
0.04422937333583832,
0.012464102357625961,
0.06342831254005432,
-0.00116911088116467,
-0.04279312491416931,
0.07998348027467728,
0.140431210398674,
-0.012833040207624435,
-0.004763821605592966,
-0.018196294084191322,
0.09848374128341675,
-0.036763813346624374,
-0.012459133751690388,
0.007209260482341051,
0.014351509511470795,
-0.06470344215631485,
-0.010806748643517494,
0.07764085382223129,
-0.05779002234339714,
0.010576684959232807,
0.005155384540557861,
-0.0075163166038692,
0.06278268992900848,
0.06274037808179855,
0.043633922934532166,
0.04480068385601044,
-0.02992478758096695,
-0.005634017288684845,
0.023037968203425407,
0.029804114252328873,
0.08955854922533035,
-0.02227388136088848,
0.047520481050014496,
-0.044960442930459976
] | -0.01412 |
conflict handler is invoked with this constant when processing a DELETE or UPDATE change if a row with the required PRIMARY KEY fields is not present in the database. | | `SQLITE_CHANGESET_CONFLICT` | This constant is passed to the conflict handler while processing an INSERT change if the operation would result in duplicate primary key values. | | `SQLITE_CHANGESET_CONSTRAINT` | If foreign key handling is enabled, and applying a changeset leaves the database in a state containing foreign key violations, the conflict handler is invoked with this constant exactly once before the changeset is committed. If the conflict handler returns `SQLITE_CHANGESET_OMIT`, the changes, including those that caused the foreign key constraint violation, are committed. Or, if it returns `SQLITE_CHANGESET_ABORT`, the changeset is rolled back. | | `SQLITE_CHANGESET_FOREIGN_KEY` | If any other constraint violation occurs while applying a change (i.e. a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is invoked with this constant. | One of the following constants must be returned from the `onConflict` conflict resolution handler passed to [`database.applyChangeset()`][]. See also [Constants Returned From The Conflict Handler][] in the SQLite documentation. | Constant | Description | | --- | --- | | `SQLITE_CHANGESET_OMIT` | Conflicting changes are omitted. | | `SQLITE_CHANGESET_REPLACE` | Conflicting changes replace existing values. Note that this value can only be returned when the type of conflict is either `SQLITE_CHANGESET_DATA` or `SQLITE_CHANGESET_CONFLICT`. | | `SQLITE_CHANGESET_ABORT` | Abort when a change encounters a conflict and roll back database. | #### Authorization constants The following constants are used with the [`database.setAuthorizer()`][] method. ##### Authorization result codes One of the following constants must be returned from the authorizer callback function passed to [`database.setAuthorizer()`][]. | Constant | Description | | --- | --- | | `SQLITE_OK` | Allow the operation to proceed normally. | | `SQLITE_DENY` | Deny the operation and cause an error to be returned. | | `SQLITE_IGNORE` | Ignore the operation and continue as if it had never been requested. | ##### Authorization action codes The following constants are passed as the first argument to the authorizer callback function to indicate what type of operation is being authorized. | Constant | Description | | --- | --- | | `SQLITE_CREATE_INDEX` | Create an index | | `SQLITE_CREATE_TABLE` | Create a table | | `SQLITE_CREATE_TEMP_INDEX` | Create a temporary index | | `SQLITE_CREATE_TEMP_TABLE` | Create a temporary table | | `SQLITE_CREATE_TEMP_TRIGGER` | Create a temporary trigger | | `SQLITE_CREATE_TEMP_VIEW` | Create a temporary view | | `SQLITE_CREATE_TRIGGER` | Create a trigger | | `SQLITE_CREATE_VIEW` | Create a view | | `SQLITE_DELETE` | Delete from a table | | `SQLITE_DROP_INDEX` | Drop an index | | `SQLITE_DROP_TABLE` | Drop a table | | `SQLITE_DROP_TEMP_INDEX` | Drop a temporary index | | `SQLITE_DROP_TEMP_TABLE` | Drop a temporary table | | `SQLITE_DROP_TEMP_TRIGGER` | Drop a temporary trigger | | `SQLITE_DROP_TEMP_VIEW` | Drop a temporary view | | `SQLITE_DROP_TRIGGER` | Drop a trigger | | `SQLITE_DROP_VIEW` | Drop a view | | `SQLITE_INSERT` | Insert into a table | | `SQLITE_PRAGMA` | Execute a PRAGMA statement | | `SQLITE_READ` | Read from a table | | `SQLITE_SELECT` | Execute a SELECT statement | | `SQLITE_TRANSACTION` | Begin, commit, or rollback a transaction | | `SQLITE_UPDATE` | Update a table | | `SQLITE_ATTACH` | Attach a database | | `SQLITE_DETACH` | Detach a database | | `SQLITE_ALTER_TABLE` | Alter a table | | `SQLITE_REINDEX` | Reindex | | `SQLITE_ANALYZE` | Analyze the database | | `SQLITE_CREATE_VTABLE` | Create a virtual table | | `SQLITE_DROP_VTABLE` | Drop a virtual table | | `SQLITE_FUNCTION` | Use a function | | `SQLITE_SAVEPOINT` | Create, | https://github.com/nodejs/node/blob/main//doc/api/sqlite.md | main | nodejs | [
-0.050636425614356995,
-0.014323849231004715,
0.006252311170101166,
-0.0029784187208861113,
0.012938302010297775,
-0.025083905085921288,
0.034633323550224304,
-0.024526264518499374,
0.021543867886066437,
0.04203406348824501,
0.04160754010081291,
-0.0021252355072647333,
0.017378633841872215,
-0.08249939978122711,
-0.06900858879089355,
0.02826549857854843,
-0.04391605034470558,
-0.0029025839176028967,
-0.15081441402435303,
0.07858458161354065,
-0.016601258888840675,
-0.023724595084786415,
0.03571490943431854,
0.07059690356254578,
-0.07143281400203705,
-0.06484879553318024,
0.08567822724580765,
0.014380129054188728,
0.01150855515152216,
-0.007128789089620113,
-0.06646088510751724,
0.024237392470240593,
-0.06984177231788635,
0.054218705743551254,
0.004735075868666172,
0.04175703227519989,
0.037776146084070206,
-0.06478822231292725,
-0.03515896573662758,
-0.033043429255485535,
0.01891106180846691,
0.017518851906061172,
-0.030261149629950523,
0.03348880261182785,
0.00924939475953579,
0.003233813215047121,
-0.07449642568826675,
0.04257133603096008,
-0.10370554774999619,
-0.013646273873746395,
-0.03266027197241783,
0.07575641572475433,
-0.020138215273618698,
0.05113590136170387,
0.05873652175068855,
0.044003717601299286,
0.11417552083730698,
0.04917465150356293,
-0.048232197761535645,
0.05555648356676102,
-0.02165447548031807,
0.02707448974251747,
-0.041318900883197784,
-0.041027896106243134,
-0.003122040070593357,
0.014208447188138962,
0.028365064412355423,
-0.08332820236682892,
0.03369346633553505,
-0.01054109912365675,
-0.05607949197292328,
0.015556120313704014,
-0.10971276462078094,
-0.016194697469472885,
0.00498952204361558,
0.053966693580150604,
0.025212811306118965,
0.04947560280561447,
-0.005062945652753115,
-0.07642020285129547,
-0.007077134680002928,
0.006070292089134455,
-0.01672184281051159,
-0.06625629961490631,
0.10096748173236847,
-0.1297600269317627,
0.014318367466330528,
-0.019790634512901306,
0.14282603561878204,
0.07255015522241592,
0.0035509197041392326,
-0.030306175351142883,
0.08637537807226181,
0.001643167226575315,
0.059148840606212616,
0.06668686866760254,
0.08512338250875473,
0.05758388340473175,
-0.02625095285475254,
-0.003328916849568486,
0.06225837394595146,
-0.03553890064358711,
-0.08947515487670898,
0.03282849118113518,
0.03712686896324158,
-0.033186618238687515,
-0.0031170761212706566,
-0.11616162210702896,
-0.08623051643371582,
-0.05493636429309845,
0.029610348865389824,
0.034617289900779724,
0.04371587932109833,
-0.025791523978114128,
-0.06364188343286514,
0.05990976095199585,
0.0701908990740776,
0.029702484607696533,
0.024383706972002983,
-0.049410391598939896,
0.04187062382698059,
-0.013082587160170078,
-0.022683976218104362,
-0.020796429365873337,
-0.11537276953458786,
-0.03275611251592636,
-0.0724313035607338,
2.426523029892538e-33,
0.040376439690589905,
-0.06127163767814636,
-0.04349731653928757,
-0.040468014776706696,
-0.04081882908940315,
0.07713525742292404,
-0.07955506443977356,
0.026541562750935555,
-0.042567431926727295,
-0.015190573409199715,
-0.005292315501719713,
0.012516338378190994,
-0.03951147198677063,
-0.049602050334215164,
0.05596865713596344,
-0.010175257921218872,
0.05027179419994354,
0.04281683266162872,
0.042507536709308624,
0.05550454929471016,
0.041706740856170654,
-0.0041397251188755035,
-0.09059380739927292,
0.02025928907096386,
-0.0016005623620003462,
0.02851054072380066,
-0.07636325061321259,
-0.0011178214335814118,
-0.01522123534232378,
-0.012156585231423378,
-0.04741008207201958,
0.032849233597517014,
0.009408417157828808,
0.0726657509803772,
-0.0017248980002477765,
0.009075818583369255,
-0.011007856577634811,
-0.060931555926799774,
-0.05683356150984764,
-0.08891968429088593,
-0.04137345775961876,
0.02726009488105774,
-0.04093150794506073,
0.04538356140255928,
0.005782153457403183,
-0.11954522877931595,
0.029573947191238403,
0.09438485652208328,
0.038219813257455826,
-0.030064696446061134,
0.04053204879164696,
0.06487021595239639,
0.07392607629299164,
-0.02242879569530487,
-0.021060137078166008,
-0.005091418977826834,
0.0205470472574234,
-0.06342867016792297,
0.05641975626349449,
0.042611535638570786,
0.045799482613801956,
-0.05234435945749283,
0.01324306521564722,
0.0705956518650055,
0.10212928801774979,
0.10863068699836731,
0.011194435879588127,
0.0033611455000936985,
-0.015410603024065495,
-0.0599483959376812,
-0.0675022229552269,
0.038580961525440216,
0.00598130514845252,
-0.016278905794024467,
-0.05024278536438942,
-0.0005744565860368311,
-0.041502147912979126,
-0.020806333050131798,
-0.006878955289721489,
-0.009257993660867214,
-0.04520426318049431,
0.08544448018074036,
-0.0023962664417922497,
0.026308730244636536,
-0.1344522386789322,
-0.008994245901703835,
-0.03262344002723694,
0.048773396760225296,
-0.029029740020632744,
0.021170197054743767,
0.10344155877828598,
0.009478641673922539,
0.04328344389796257,
0.0332956537604332,
0.13562346994876862,
-3.2464274008552066e-33,
0.004701917991042137,
-0.08510451018810272,
-0.039198264479637146,
-0.026469092816114426,
0.013893801718950272,
-0.029508493840694427,
-0.005993141792714596,
-0.010602212511003017,
-0.010683550499379635,
-0.14754970371723175,
0.006768038496375084,
-0.0868830531835556,
0.03527895733714104,
0.027368053793907166,
-0.021857716143131256,
0.028704646974802017,
-0.07716257870197296,
0.02729860506951809,
0.014663901180028915,
0.04016371816396713,
0.09228846430778503,
0.041357289999723434,
-0.009250745177268982,
0.06638751924037933,
-0.060597870498895645,
-0.017665091902017593,
-0.04745102301239967,
-0.021720707416534424,
-0.04709944501519203,
-0.00948339607566595,
0.038715772330760956,
0.007603028789162636,
-0.05712590739130974,
0.04696376249194145,
0.05084455385804176,
-0.0872436910867691,
-0.01827148348093033,
-0.04962232708930969,
-0.007444694172590971,
0.048951175063848495,
0.0021382966078817844,
0.03674129769206047,
0.050856154412031174,
0.11290139704942703,
0.045221857726573944,
0.012234116904437542,
-0.056412484496831894,
0.015478983521461487,
0.029972326010465622,
-0.0788368359208107,
0.03928098455071449,
-0.06307710707187653,
-0.007524179760366678,
0.035423122346401215,
0.08573558181524277,
0.03234575316309929,
-0.0009494453552179039,
-0.013113859109580517,
-0.015872448682785034,
-0.04303240776062012,
-0.016251180320978165,
0.03456880524754524,
-0.048350729048252106,
0.04743978753685951,
0.024534203112125397,
0.052562590688467026,
-0.04060543701052666,
-0.04006259888410568,
0.11917916685342789,
0.017890019342303276,
0.06173145771026611,
0.003861974459141493,
0.007486485410481691,
-0.0188401211053133,
0.02814675122499466,
0.01908956654369831,
-0.027936594560742378,
-0.08287888020277023,
-0.008130740374326706,
0.07589352130889893,
-0.02326003834605217,
0.025436243042349815,
0.0270195584744215,
0.005163963418453932,
-0.18141016364097595,
0.04673908278346062,
0.010325545445084572,
0.07516007125377655,
-0.018411122262477875,
0.05284406617283821,
-0.031597819179296494,
-0.0467117540538311,
-0.13614042103290558,
-0.022944530472159386,
-0.041156187653541565,
-4.3973400920549466e-8,
-0.019227756187319756,
0.05906003341078758,
-0.08448094874620438,
-0.0378195196390152,
0.04867938905954361,
-0.041284918785095215,
0.03329361975193024,
-0.006749236490577459,
-0.005438829306513071,
-0.018895722925662994,
-0.014533783309161663,
0.029217833653092384,
0.036445800215005875,
-0.02038729563355446,
-0.009061905555427074,
-0.038874804973602295,
0.03416330739855766,
-0.02135845646262169,
-0.039079926908016205,
0.006487501785159111,
-0.009145241230726242,
0.01649404875934124,
0.002641052473336458,
0.0074587054550647736,
0.017967455089092255,
-0.029049504548311234,
0.07203703373670578,
0.10223473608493805,
0.004948569927364588,
-0.017184387892484665,
0.06540446728467941,
-0.0783219113945961,
0.09038591384887695,
0.01664919964969158,
-0.05771564319729805,
0.09260954707860947,
-0.00758725218474865,
-0.04212009534239769,
0.04455829784274101,
0.05021563544869423,
0.027839308604598045,
0.022231020033359528,
-0.061968665570020676,
0.05220482870936394,
-0.07602439820766449,
-0.0000381145000574179,
-0.030323384329676628,
0.014154979027807713,
-0.03867927938699722,
0.03484572842717171,
-0.04545700177550316,
0.0373738631606102,
-0.025392945855855942,
0.03412417322397232,
0.01222007442265749,
0.027708325535058975,
0.038217805325984955,
0.033468734472990036,
0.0907546654343605,
0.01835031807422638,
0.05169259384274483,
-0.04597798362374306,
0.024513693526387215,
0.009392011910676956
] | 0.088907 |
Detach a database | | `SQLITE_ALTER_TABLE` | Alter a table | | `SQLITE_REINDEX` | Reindex | | `SQLITE_ANALYZE` | Analyze the database | | `SQLITE_CREATE_VTABLE` | Create a virtual table | | `SQLITE_DROP_VTABLE` | Drop a virtual table | | `SQLITE_FUNCTION` | Use a function | | `SQLITE_SAVEPOINT` | Create, release, or rollback a savepoint | | `SQLITE_COPY` | Copy data (legacy) | | `SQLITE_RECURSIVE` | Recursive query | [Changesets and Patchsets]: https://www.sqlite.org/sessionintro.html#changesets\_and\_patchsets [Constants Passed To The Conflict Handler]: https://www.sqlite.org/session/c\_changeset\_conflict.html [Constants Returned From The Conflict Handler]: https://www.sqlite.org/session/c\_changeset\_abort.html [SQL injection]: https://en.wikipedia.org/wiki/SQL\_injection [Type conversion between JavaScript and SQLite]: #type-conversion-between-javascript-and-sqlite [`ATTACH DATABASE`]: https://www.sqlite.org/lang\_attach.html [`PRAGMA foreign\_keys`]: https://www.sqlite.org/pragma.html#pragma\_foreign\_keys [`SQLITE\_DBCONFIG\_DEFENSIVE`]: https://www.sqlite.org/c3ref/c\_dbconfig\_defensive.html#sqlitedbconfigdefensive [`SQLITE\_DETERMINISTIC`]: https://www.sqlite.org/c3ref/c\_deterministic.html [`SQLITE\_DIRECTONLY`]: https://www.sqlite.org/c3ref/c\_deterministic.html [`SQLITE\_MAX\_FUNCTION\_ARG`]: https://www.sqlite.org/limits.html#max\_function\_arg [`SQLTagStore`]: #class-sqltagstore [`database.applyChangeset()`]: #databaseapplychangesetchangeset-options [`database.createTagStore()`]: #databasecreatetagstoremaxsize [`database.setAuthorizer()`]: #databasesetauthorizercallback [`sqlite3\_backup\_finish()`]: https://www.sqlite.org/c3ref/backup\_finish.html#sqlite3backupfinish [`sqlite3\_backup\_init()`]: https://www.sqlite.org/c3ref/backup\_finish.html#sqlite3backupinit [`sqlite3\_backup\_step()`]: https://www.sqlite.org/c3ref/backup\_finish.html#sqlite3backupstep [`sqlite3\_changes64()`]: https://www.sqlite.org/c3ref/changes.html [`sqlite3\_close\_v2()`]: https://www.sqlite.org/c3ref/close.html [`sqlite3\_column\_database\_name()`]: https://www.sqlite.org/c3ref/column\_database\_name.html [`sqlite3\_column\_decltype()`]: https://www.sqlite.org/c3ref/column\_decltype.html [`sqlite3\_column\_name()`]: https://www.sqlite.org/c3ref/column\_name.html [`sqlite3\_column\_origin\_name()`]: https://www.sqlite.org/c3ref/column\_database\_name.html [`sqlite3\_column\_table\_name()`]: https://www.sqlite.org/c3ref/column\_database\_name.html [`sqlite3\_create\_function\_v2()`]: https://www.sqlite.org/c3ref/create\_function.html [`sqlite3\_create\_window\_function()`]: https://www.sqlite.org/c3ref/create\_function.html [`sqlite3\_db\_filename()`]: https://sqlite.org/c3ref/db\_filename.html [`sqlite3\_exec()`]: https://www.sqlite.org/c3ref/exec.html [`sqlite3\_expanded\_sql()`]: https://www.sqlite.org/c3ref/expanded\_sql.html [`sqlite3\_get\_autocommit()`]: https://sqlite.org/c3ref/get\_autocommit.html [`sqlite3\_last\_insert\_rowid()`]: https://www.sqlite.org/c3ref/last\_insert\_rowid.html [`sqlite3\_load\_extension()`]: https://www.sqlite.org/c3ref/load\_extension.html [`sqlite3\_prepare\_v2()`]: https://www.sqlite.org/c3ref/prepare.html [`sqlite3\_set\_authorizer()`]: https://sqlite.org/c3ref/set\_authorizer.html [`sqlite3\_sql()`]: https://www.sqlite.org/c3ref/expanded\_sql.html [`sqlite3changeset\_apply()`]: https://www.sqlite.org/session/sqlite3changeset\_apply.html [`sqlite3session\_attach()`]: https://www.sqlite.org/session/sqlite3session\_attach.html [`sqlite3session\_changeset()`]: https://www.sqlite.org/session/sqlite3session\_changeset.html [`sqlite3session\_create()`]: https://www.sqlite.org/session/sqlite3session\_create.html [`sqlite3session\_delete()`]: https://www.sqlite.org/session/sqlite3session\_delete.html [`sqlite3session\_patchset()`]: https://www.sqlite.org/session/sqlite3session\_patchset.html [busy timeout]: https://sqlite.org/c3ref/busy\_timeout.html [connection]: https://www.sqlite.org/c3ref/sqlite3.html [data types]: https://www.sqlite.org/datatype3.html [double-quoted string literals]: https://www.sqlite.org/quirks.html#dblquote [in memory]: https://www.sqlite.org/inmemorydb.html [parameters are bound]: https://www.sqlite.org/c3ref/bind\_blob.html [prepared statement]: https://www.sqlite.org/c3ref/stmt.html | https://github.com/nodejs/node/blob/main//doc/api/sqlite.md | main | nodejs | [
-0.04076353833079338,
-0.024604573845863342,
-0.02727835439145565,
0.004772953689098358,
-0.031373120844364166,
-0.049127139151096344,
0.03168819099664688,
-0.023652199655771255,
-0.061321940273046494,
0.0966162458062172,
0.08335219323635101,
-0.01931982859969139,
-0.0202992781996727,
-0.1010642871260643,
-0.05922842025756836,
0.046415362507104874,
-0.0689525455236435,
0.10579224675893784,
-0.039936456829309464,
0.14144200086593628,
-0.01604710891842842,
0.029599634930491447,
0.007486463990062475,
0.05337081849575043,
0.04085557162761688,
0.009090767242014408,
-0.0205472894012928,
0.003548274515196681,
-0.03409799188375473,
-0.06809420883655548,
-0.062284231185913086,
0.03783798590302467,
-0.07441296428442001,
0.10236157476902008,
0.03675171732902527,
0.046847544610500336,
0.055464453995227814,
0.011730704456567764,
-0.02860174886882305,
-0.024280816316604614,
-0.021500281989574432,
0.004729907959699631,
-0.09791485965251923,
0.026591744273900986,
-0.029379695653915405,
-0.006153675727546215,
-0.08263515681028366,
-0.033631715923547745,
-0.037758927792310715,
0.028369497507810593,
-0.019890237599611282,
0.05958383530378342,
-0.04018425568938255,
0.07211567461490631,
0.07207798212766647,
0.054703716188669205,
0.06812599301338196,
0.06349675357341766,
-0.03540724143385887,
0.0766153335571289,
0.042415130883455276,
0.02101847715675831,
-0.022930188104510307,
-0.08843155205249786,
-0.012573816813528538,
0.008007315918803215,
0.03240946680307388,
-0.026317277923226357,
0.05842703580856323,
-0.06662589311599731,
-0.0757489949464798,
0.05742441862821579,
-0.17416924238204956,
-0.029370421543717384,
0.010910101234912872,
0.07575985044240952,
0.02674778550863266,
0.028827643021941185,
-0.08496451377868652,
-0.08223097026348114,
-0.009181714616715908,
0.04377564787864685,
-0.007831664755940437,
-0.055546168237924576,
0.06615541875362396,
-0.050162408500909805,
0.05204503610730171,
0.0064217327162623405,
0.1472170352935791,
0.0016966069815680385,
-0.009860088117420673,
0.06935971975326538,
0.09069839119911194,
-0.029117301106452942,
0.03339505195617676,
0.013416137546300888,
0.12967464327812195,
0.005577939096838236,
0.07928424328565598,
0.060711417347192764,
0.04866582900285721,
-0.0003853266825899482,
-0.12757541239261627,
-0.0028397173155099154,
-0.03342282772064209,
-0.07942493259906769,
0.031411852687597275,
-0.1287541687488556,
-0.08076798915863037,
-0.06685906648635864,
-0.040479306131601334,
0.06684203445911407,
0.0014552539214491844,
-0.08568299561738968,
-0.0004087274137418717,
-0.001967289485037327,
-0.043551381677389145,
0.018039025366306305,
0.04653225839138031,
-0.008264067582786083,
0.09814879298210144,
0.06816598027944565,
0.017336172983050346,
0.03559120371937752,
-0.04760763421654701,
-0.009135057218372822,
-0.018750980496406555,
1.0933193060116439e-33,
0.038464006036520004,
-0.0007171479519456625,
0.02188917249441147,
0.018607955425977707,
0.05425335839390755,
0.08141269534826279,
0.02436201646924019,
0.09997756779193878,
-0.0234760120511055,
-0.02492438815534115,
0.018775027245283127,
-0.017523009330034256,
-0.04310254380106926,
0.00874657928943634,
0.07357648760080338,
-0.040153272449970245,
0.012359830550849438,
-0.00829826109111309,
0.06516573578119278,
0.02740970440208912,
0.028538811951875687,
-0.019824977964162827,
-0.08607053011655807,
0.038155000656843185,
-0.00659547746181488,
0.004585728980600834,
-0.07345261424779892,
0.03944319486618042,
0.019705431535840034,
0.0108523303642869,
-0.04856031388044357,
0.0350734144449234,
-0.02199847437441349,
-0.009697110392153263,
-0.015590909868478775,
0.027105137705802917,
-0.0409054309129715,
-0.026683172211050987,
-0.05131110921502113,
-0.05870719626545906,
-0.027004865929484367,
-0.003024814883247018,
-0.07624169439077377,
0.03368102386593819,
0.043121036142110825,
-0.1309312880039215,
-0.04612691327929497,
0.01906595565378666,
0.012076318264007568,
-0.1247706338763237,
-0.010420731268823147,
0.03471650183200836,
-0.006867885123938322,
-0.04160316661000252,
-0.07389286905527115,
-0.008199479430913925,
-0.055038489401340485,
-0.02724369615316391,
0.035514846444129944,
0.07611031830310822,
0.04511851444840431,
0.02878723107278347,
0.01692446880042553,
0.03755442425608635,
0.008602901361882687,
0.06521505862474442,
-0.02951190248131752,
-0.048839420080184937,
0.06872080266475677,
-0.008427179418504238,
-0.04475032910704613,
0.02095344290137291,
0.0004035776946693659,
-0.05340476706624031,
-0.057936836034059525,
-0.029669463634490967,
-0.061264995485544205,
-0.01289812196046114,
-0.03813233599066734,
-0.013211925514042377,
-0.001325721386820078,
-0.0060630361549556255,
-0.05851846933364868,
-0.07591809332370758,
-0.06286114454269409,
-0.11178111284971237,
-0.017040081322193146,
-0.03445784002542496,
-0.02771114557981491,
-0.007193063385784626,
0.03154530003666878,
-0.012654910795390606,
0.02503548562526703,
-0.09089712053537369,
0.09653973579406738,
-4.056990265148684e-33,
0.043433353304862976,
-0.02780427224934101,
-0.04053830727934837,
0.03937098756432533,
-0.03125813975930214,
-0.03899150714278221,
-0.06284027546644211,
0.026516078040003777,
-0.04140323027968407,
-0.07978856563568115,
-0.07953484356403351,
-0.021483127027750015,
0.02093285135924816,
-0.0634641945362091,
-0.0578717403113842,
0.11172587424516678,
-0.04294648766517639,
-0.046862635761499405,
-0.0066188303753733635,
0.019604871049523354,
0.013004233129322529,
0.10786237567663193,
0.04835186526179314,
0.07033797353506088,
-0.004733864217996597,
-0.07378199696540833,
-0.05576855689287186,
-0.00036469934275373816,
0.025531459599733353,
-0.029191451147198677,
0.017685482278466225,
0.005907766055315733,
-0.035757340490818024,
0.0006774389185011387,
0.050819940865039825,
-0.03191870450973511,
0.006467918399721384,
-0.04161316901445389,
-0.009838465601205826,
0.050286710262298584,
0.03477659448981285,
0.005679239984601736,
0.056033119559288025,
0.04414539411664009,
0.04223547503352165,
0.024969354271888733,
-0.05562783405184746,
0.03028126060962677,
0.018196361139416695,
-0.021171966567635536,
0.07905732095241547,
-0.05848584696650505,
-0.047269079834222794,
-0.03191539645195007,
0.10848544538021088,
0.0065363990142941475,
-0.002677860902622342,
-0.04010188579559326,
-0.03963124752044678,
-0.010135413147509098,
0.01740608550608158,
0.02804516814649105,
-0.04985859617590904,
0.013549800962209702,
0.025395013391971588,
-0.05685120448470116,
-0.07972659915685654,
0.014484541490674019,
0.0051008486188948154,
0.01159555371850729,
0.021961847320199013,
0.01977595128118992,
0.06592577695846558,
-0.026683855801820755,
0.013197978027164936,
0.025950757786631584,
-0.041035089641809464,
-0.015697181224822998,
-0.043799545615911484,
0.05326530337333679,
-0.03700841963291168,
0.015365221537649632,
0.05809424817562103,
-0.023889265954494476,
-0.10208079218864441,
-0.008115969598293304,
-0.017869146540760994,
0.04538712650537491,
-0.05904453247785568,
0.011038699187338352,
-0.0716307982802391,
-0.08985058218240738,
-0.05424690246582031,
0.03080795891582966,
0.012180613353848457,
-4.701480449398332e-8,
0.01671796292066574,
-0.02616860158741474,
-0.032816264778375626,
-0.0029989450704306364,
0.0939936414361,
-0.05893271416425705,
-0.012264721095561981,
0.1127268373966217,
-0.03400276601314545,
-0.07536619901657104,
-0.025450684130191803,
0.039519280195236206,
0.06377525627613068,
0.04131068289279938,
0.004165235906839371,
-0.03192511945962906,
0.055341050028800964,
-0.03636439889669418,
-0.040935251861810684,
0.0191566813737154,
-0.04491604119539261,
0.06289558112621307,
-0.0018836688250303268,
-0.03291955590248108,
0.021876418963074684,
-0.003005203790962696,
0.05909568443894386,
0.042205508798360825,
-0.009449617937207222,
-0.034341055899858475,
0.09104155749082565,
-0.047921665012836456,
0.08966172486543655,
0.03944965451955795,
-0.016770808026194572,
0.0783567726612091,
0.018037475645542145,
0.02404024638235569,
-0.0011161371367052197,
-0.011122317053377628,
0.009748627431690693,
-0.006415444426238537,
-0.05952116474509239,
0.044759832322597504,
-0.04274069145321846,
-0.08872712403535843,
-0.07924848049879074,
0.032681237906217575,
0.020334463566541672,
-0.013236317783594131,
-0.02998918481171131,
0.07710225880146027,
0.027599768713116646,
0.04434838145971298,
0.018238041549921036,
0.07942751049995422,
0.03926939144730568,
0.029017312452197075,
0.0981912910938263,
0.03437262400984764,
0.0338575541973114,
-0.05112692713737488,
0.05977853760123253,
0.0565381720662117
] | 0.102918 |
# Stream > Stability: 2 - Stable A stream is an abstract interface for working with streaming data in Node.js. The `node:stream` module provides an API for implementing the stream interface. There are many stream objects provided by Node.js. For instance, a [request to an HTTP server][http-incoming-message] and [`process.stdout`][] are both stream instances. Streams can be readable, writable, or both. All streams are instances of [`EventEmitter`][]. To access the `node:stream` module: ```js const stream = require('node:stream'); ``` The `node:stream` module is useful for creating new types of stream instances. It is usually not necessary to use the `node:stream` module to consume streams. ## Organization of this document This document contains two primary sections and a third section for notes. The first section explains how to use existing streams within an application. The second section explains how to create new types of streams. ## Types of streams There are four fundamental stream types within Node.js: \* [`Writable`][]: streams to which data can be written (for example, [`fs.createWriteStream()`][]). \* [`Readable`][]: streams from which data can be read (for example, [`fs.createReadStream()`][]). \* [`Duplex`][]: streams that are both `Readable` and `Writable` (for example, [`net.Socket`][]). \* [`Transform`][]: `Duplex` streams that can modify or transform the data as it is written and read (for example, [`zlib.createDeflate()`][]). Additionally, this module includes the utility functions [`stream.duplexPair()`][], [`stream.pipeline()`][], [`stream.finished()`][] [`stream.Readable.from()`][], and [`stream.addAbortSignal()`][]. ### Streams Promises API The `stream/promises` API provides an alternative set of asynchronous utility functions for streams that return `Promise` objects rather than using callbacks. The API is accessible via `require('node:stream/promises')` or `require('node:stream').promises`. ### `stream.pipeline(streams[, options])` ### `stream.pipeline(source[, ...transforms], destination[, options])` \* `streams` {Stream\[]|Iterable\[]|AsyncIterable\[]|Function\[]} \* `source` {Stream|Iterable|AsyncIterable|Function} \* Returns: {Promise|AsyncIterable} \* `...transforms` {Stream|Function} \* `source` {AsyncIterable} \* Returns: {Promise|AsyncIterable} \* `destination` {Stream|Function} \* `source` {AsyncIterable} \* Returns: {Promise|AsyncIterable} \* `options` {Object} Pipeline options \* `signal` {AbortSignal} \* `end` {boolean} End the destination stream when the source stream ends. Transform streams are always ended, even if this value is `false`. \*\*Default:\*\* `true`. \* Returns: {Promise} Fulfills when the pipeline is complete. ```cjs const { pipeline } = require('node:stream/promises'); const fs = require('node:fs'); const zlib = require('node:zlib'); async function run() { await pipeline( fs.createReadStream('archive.tar'), zlib.createGzip(), fs.createWriteStream('archive.tar.gz'), ); console.log('Pipeline succeeded.'); } run().catch(console.error); ``` ```mjs import { pipeline } from 'node:stream/promises'; import { createReadStream, createWriteStream } from 'node:fs'; import { createGzip } from 'node:zlib'; await pipeline( createReadStream('archive.tar'), createGzip(), createWriteStream('archive.tar.gz'), ); console.log('Pipeline succeeded.'); ``` To use an `AbortSignal`, pass it inside an options object, as the last argument. When the signal is aborted, `destroy` will be called on the underlying pipeline, with an `AbortError`. ```cjs const { pipeline } = require('node:stream/promises'); const fs = require('node:fs'); const zlib = require('node:zlib'); async function run() { const ac = new AbortController(); const signal = ac.signal; setImmediate(() => ac.abort()); await pipeline( fs.createReadStream('archive.tar'), zlib.createGzip(), fs.createWriteStream('archive.tar.gz'), { signal }, ); } run().catch(console.error); // AbortError ``` ```mjs import { pipeline } from 'node:stream/promises'; import { createReadStream, createWriteStream } from 'node:fs'; import { createGzip } from 'node:zlib'; const ac = new AbortController(); const { signal } = ac; setImmediate(() => ac.abort()); try { await pipeline( createReadStream('archive.tar'), createGzip(), createWriteStream('archive.tar.gz'), { signal }, ); } catch (err) { console.error(err); // AbortError } ``` The `pipeline` API also supports async generators: ```cjs const { pipeline } = require('node:stream/promises'); const fs = require('node:fs'); async function run() { await pipeline( fs.createReadStream('lowercase.txt'), async function\* (source, { signal }) { source.setEncoding('utf8'); // Work with strings rather than `Buffer`s. for await (const chunk of source) { yield await processChunk(chunk, { signal }); } }, fs.createWriteStream('uppercase.txt'), ); console.log('Pipeline succeeded.'); } run().catch(console.error); ``` ```mjs import { pipeline } from 'node:stream/promises'; import { createReadStream, createWriteStream } from 'node:fs'; await pipeline( createReadStream('lowercase.txt'), | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.04832777753472328,
-0.02461600862443447,
0.01245670486241579,
0.027663903310894966,
0.06049765273928642,
-0.02142409048974514,
-0.0185977965593338,
0.050491828471422195,
0.039725787937641144,
-0.042334698140621185,
-0.0737425908446312,
0.05312336981296539,
-0.08163343369960785,
0.012114027515053749,
0.03584592044353485,
-0.019601456820964813,
0.019687967374920845,
0.014570876024663448,
0.006851430516690016,
-0.05740983784198761,
0.056300073862075806,
-0.07966586202383041,
-0.014893414452672005,
-0.017174001783132553,
-0.037273235619068146,
0.037647295743227005,
-0.03900160640478134,
0.00939294882118702,
0.08789079636335373,
-0.004994440823793411,
0.026853209361433983,
-0.04492440074682236,
-0.09888676553964615,
-0.010368517599999905,
-0.12861673533916473,
0.07616615295410156,
0.027027437463402748,
-0.11145715415477753,
-0.06940694898366928,
-0.013193665072321892,
0.1275940090417862,
0.06850333511829376,
-0.08487120270729065,
-0.05358723923563957,
-0.01706959307193756,
0.039967384189367294,
-0.0906008929014206,
-0.009996811859309673,
-0.09851354360580444,
0.05061796307563782,
-0.03382444754242897,
-0.033188335597515106,
-0.06850728392601013,
0.05318285897374153,
-0.0025489339604973793,
0.020559297874569893,
-0.031007692217826843,
-0.00984644889831543,
0.011995586566627026,
0.009166273288428783,
0.008294359780848026,
-0.04178237169981003,
0.015299293212592602,
-0.019047362729907036,
0.038041483610868454,
-0.012199834920465946,
-0.05681522935628891,
0.09598297625780106,
0.10542163252830505,
0.002199334790930152,
-0.04224783182144165,
0.062061600387096405,
-0.04338913783431053,
-0.02408026158809662,
-0.06912693381309509,
-0.1653234362602234,
0.004832313861697912,
0.004072451498359442,
-0.05595700442790985,
0.0848580002784729,
0.003085056319832802,
-0.027208048850297928,
-0.002524391282349825,
0.008358708582818508,
-0.04353269562125206,
0.08240395039319992,
-0.022315064445137978,
-0.030369581654667854,
-0.00024478178238496184,
0.05647183954715729,
-0.11481648683547974,
0.022038865834474564,
0.03935934603214264,
0.05384252965450287,
-0.0007972521707415581,
0.09887513518333435,
0.021814605221152306,
0.033803682774305344,
0.005807260517030954,
-0.033760786056518555,
0.019048798829317093,
0.05454864725470543,
0.06556573510169983,
0.018613122403621674,
0.05230971425771713,
-0.10085440427064896,
-0.037466127425432205,
0.052368853241205215,
-0.02267475798726082,
-0.022256705909967422,
-0.018149929121136665,
0.04606408625841141,
-0.020110413432121277,
-0.03358396515250206,
-0.043186724185943604,
0.025813626125454903,
-0.04044131562113762,
-0.010651260614395142,
0.0634622722864151,
0.1554078459739685,
0.09049438685178757,
0.02219388261437416,
-0.0049704862758517265,
-0.006333928555250168,
0.10423633456230164,
-0.025048496201634407,
0.05797409638762474,
2.7271814240542624e-33,
-0.001713734702207148,
-0.06439719349145889,
-0.03521077707409859,
0.10027637332677841,
0.017693860456347466,
0.04126615822315216,
-0.006460834760218859,
-0.028954507783055305,
-0.0760582983493805,
-0.040995366871356964,
-0.020711204037070274,
0.027809731662273407,
-0.045463789254426956,
0.004253003746271133,
0.03872724622488022,
-0.06542608886957169,
0.0367310531437397,
-0.0018840852426365018,
0.06657924503087997,
0.036054790019989014,
0.0213753841817379,
0.025933509692549706,
-0.018027817830443382,
0.0178618673235178,
0.047323018312454224,
-0.0058136917650699615,
0.010410444810986519,
0.0026096818037331104,
-0.036139342933893204,
0.01050818245857954,
0.02812849171459675,
0.05054711177945137,
-0.021088335663080215,
-0.018297770991921425,
0.07445410639047623,
-0.04999441280961037,
-0.022511238232254982,
-0.011492014862596989,
-0.09611808508634567,
-0.053159452974796295,
-0.006335243117064238,
0.05794879421591759,
-0.07678069919347763,
-0.05154929682612419,
-0.05659804120659828,
-0.06609691679477692,
-0.03220376744866371,
-0.03244936093688011,
0.031111111864447594,
-0.0711284875869751,
-0.022896170616149902,
0.04999110475182533,
0.05633458122611046,
0.027157476171851158,
0.07076667994260788,
0.019230833277106285,
0.038408149033784866,
-0.00945326965302229,
-0.061413686722517014,
0.026065582409501076,
0.057417355477809906,
0.035170141607522964,
0.0017335382290184498,
-0.013238340616226196,
0.007882044650614262,
0.056438591331243515,
-0.03767674043774605,
-0.02488277107477188,
0.07468760013580322,
-0.04066282883286476,
-0.04678637161850929,
0.01332843117415905,
-0.007534862495958805,
0.032463427633047104,
-0.014459656551480293,
0.03304896503686905,
-0.03220397233963013,
-0.052539002150297165,
-0.006610536947846413,
0.0328001007437706,
-0.0005797912017442286,
-0.05054682120680809,
0.013358868658542633,
0.13389569520950317,
0.016139565035700798,
0.003853238420560956,
-0.044894736260175705,
-0.033769164234399796,
0.051487408578395844,
0.02814950980246067,
-0.010172407142817974,
0.03489968180656433,
0.05230015143752098,
-0.11311665177345276,
-0.06345236301422119,
-4.909406238461205e-33,
-0.040295641869306564,
0.01683215983211994,
-0.13169407844543457,
0.0810636579990387,
-0.019058093428611755,
-0.004813391715288162,
-0.030972391366958618,
-0.004601468797773123,
0.0745973289012909,
0.007280795834958553,
-0.07323119044303894,
0.04406648501753807,
-0.0843234434723854,
0.00766014214605093,
-0.030719319358468056,
0.024819666519761086,
-0.09251850098371506,
-0.06637683510780334,
0.03876865282654762,
-0.0625092089176178,
-0.087732695043087,
-0.01868843287229538,
0.07104524970054626,
-0.0110592320561409,
-0.009373395703732967,
0.01241781935095787,
-0.003733794204890728,
-0.018998753279447556,
-0.030827036127448082,
-0.07783980667591095,
-0.03420894593000412,
-0.005444718524813652,
0.0027126839850097895,
0.012285750359296799,
0.03184109181165695,
-0.08137191832065582,
0.06064372509717941,
0.07131641358137131,
0.05444292351603508,
-0.05335686355829239,
0.09029491990804672,
0.04539571702480316,
0.0392548032104969,
-0.06761062145233154,
0.03049726039171219,
0.048403263092041016,
-0.02191002666950226,
0.03225048631429672,
-0.05570270121097565,
0.0004256962856743485,
-0.033330708742141724,
-0.05807042121887207,
-0.032657913863658905,
0.05636465176939964,
-0.008891936391592026,
-0.07019456475973129,
0.07559502869844437,
0.011612952686846256,
0.038291461765766144,
0.01147653628140688,
0.016595283523201942,
-0.09724567830562592,
-0.04229624941945076,
0.01520546618849039,
0.015387825667858124,
-0.036129869520664215,
-0.06834430247545242,
-0.034312907606363297,
0.04804633930325508,
-0.024044737219810486,
-0.011475538834929466,
-0.0360310897231102,
-0.0007870509871281683,
-0.011655142530798912,
0.010132326744496822,
0.0031445473432540894,
-0.004505360033363104,
-0.0582355372607708,
0.020999794825911522,
0.026539739221334457,
-0.07237809896469116,
0.15014365315437317,
-0.06720313429832458,
0.029710691422224045,
0.0957740992307663,
0.03652193397283554,
0.044471148401498795,
-0.05048155412077904,
-0.02858726494014263,
-0.01097631361335516,
0.025530345737934113,
0.027240773662924767,
-0.1703324019908905,
-0.0032443911768496037,
-0.043006882071495056,
-4.5903899348331834e-8,
-0.0715014636516571,
-0.019226398319005966,
-0.11318400502204895,
0.008486010134220123,
0.015189293771982193,
0.0023483717814087868,
0.02442583441734314,
0.035867929458618164,
0.0906151682138443,
0.019532620906829834,
-0.0014772850554436445,
-0.03139315918087959,
0.014827343635261059,
-0.08489768952131271,
0.07399897277355194,
0.011439969763159752,
0.03606303408741951,
0.002528988756239414,
-0.032541219145059586,
-0.014265278354287148,
0.047056328505277634,
0.025463087484240532,
-0.043466344475746155,
0.08325585722923279,
-0.023394159972667694,
-0.021337587386369705,
0.10888885706663132,
0.03380190581083298,
-0.02075168862938881,
-0.07930842787027359,
-0.050446655601263046,
0.07817799597978592,
0.07332325726747513,
0.010394050739705563,
0.013558677397668362,
0.011256800964474678,
-0.042961396276950836,
-0.00625699432566762,
0.01751529425382614,
0.05454908683896065,
0.055917736142873764,
0.04131104797124863,
-0.024368446320295334,
0.031116198748350143,
0.016010712832212448,
0.050113312900066376,
0.039882972836494446,
0.005149406380951405,
0.017687296494841576,
0.08680582046508789,
-0.02290419489145279,
0.004449113737791777,
-0.029469776898622513,
0.025352289900183678,
-0.004019888583570719,
0.006866194773465395,
0.0025951603893190622,
-0.13132993876934052,
-0.0335710346698761,
-0.03830789029598236,
0.10303515195846558,
0.06797932833433151,
0.04160263389348984,
-0.005532129667699337
] | 0.138117 |
signal }) { source.setEncoding('utf8'); // Work with strings rather than `Buffer`s. for await (const chunk of source) { yield await processChunk(chunk, { signal }); } }, fs.createWriteStream('uppercase.txt'), ); console.log('Pipeline succeeded.'); } run().catch(console.error); ``` ```mjs import { pipeline } from 'node:stream/promises'; import { createReadStream, createWriteStream } from 'node:fs'; await pipeline( createReadStream('lowercase.txt'), async function\* (source, { signal }) { source.setEncoding('utf8'); // Work with strings rather than `Buffer`s. for await (const chunk of source) { yield await processChunk(chunk, { signal }); } }, createWriteStream('uppercase.txt'), ); console.log('Pipeline succeeded.'); ``` Remember to handle the `signal` argument passed into the async generator. Especially in the case where the async generator is the source for the pipeline (i.e. first argument) or the pipeline will never complete. ```cjs const { pipeline } = require('node:stream/promises'); const fs = require('node:fs'); async function run() { await pipeline( async function\* ({ signal }) { await someLongRunningfn({ signal }); yield 'asd'; }, fs.createWriteStream('uppercase.txt'), ); console.log('Pipeline succeeded.'); } run().catch(console.error); ``` ```mjs import { pipeline } from 'node:stream/promises'; import fs from 'node:fs'; await pipeline( async function\* ({ signal }) { await someLongRunningfn({ signal }); yield 'asd'; }, fs.createWriteStream('uppercase.txt'), ); console.log('Pipeline succeeded.'); ``` The `pipeline` API provides [callback version][stream-pipeline]: ### `stream.finished(stream[, options])` \* `stream` {Stream|ReadableStream|WritableStream} A readable and/or writable stream/webstream. \* `options` {Object} \* `error` {boolean|undefined} \* `readable` {boolean|undefined} \* `writable` {boolean|undefined} \* `signal` {AbortSignal|undefined} \* `cleanup` {boolean|undefined} If `true`, removes the listeners registered by this function before the promise is fulfilled. \*\*Default:\*\* `false`. \* Returns: {Promise} Fulfills when the stream is no longer readable or writable. ```cjs const { finished } = require('node:stream/promises'); const fs = require('node:fs'); const rs = fs.createReadStream('archive.tar'); async function run() { await finished(rs); console.log('Stream is done reading.'); } run().catch(console.error); rs.resume(); // Drain the stream. ``` ```mjs import { finished } from 'node:stream/promises'; import { createReadStream } from 'node:fs'; const rs = createReadStream('archive.tar'); async function run() { await finished(rs); console.log('Stream is done reading.'); } run().catch(console.error); rs.resume(); // Drain the stream. ``` The `finished` API also provides a [callback version][stream-finished]. `stream.finished()` leaves dangling event listeners (in particular `'error'`, `'end'`, `'finish'` and `'close'`) after the returned promise is resolved or rejected. The reason for this is so that unexpected `'error'` events (due to incorrect stream implementations) do not cause unexpected crashes. If this is unwanted behavior then `options.cleanup` should be set to `true`: ```mjs await finished(rs, { cleanup: true }); ``` ### Object mode All streams created by Node.js APIs operate exclusively on strings, {Buffer}, {TypedArray} and {DataView} objects: \* `Strings` and `Buffers` are the most common types used with streams. \* `TypedArray` and `DataView` lets you handle binary data with types like `Int32Array` or `Uint8Array`. When you write a TypedArray or DataView to a stream, Node.js processes the raw bytes. It is possible, however, for stream implementations to work with other types of JavaScript values (with the exception of `null`, which serves a special purpose within streams). Such streams are considered to operate in "object mode". Stream instances are switched into object mode using the `objectMode` option when the stream is created. Attempting to switch an existing stream into object mode is not safe. ### Buffering Both [`Writable`][] and [`Readable`][] streams will store data in an internal buffer. The amount of data potentially buffered depends on the `highWaterMark` option passed into the stream's constructor. For normal streams, the `highWaterMark` option specifies a [total number of bytes][hwm-gotcha]. For streams operating in object mode, the `highWaterMark` specifies a total number of objects. For streams operating on (but not decoding) strings, the `highWaterMark` specifies a total number of UTF-16 code units. Data is buffered in `Readable` streams when the implementation calls [`stream.push(chunk)`][stream-push]. If the consumer of | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.024190671741962433,
0.02352224476635456,
0.01818167418241501,
-0.024721240624785423,
-0.07658626139163971,
-0.03280533477663994,
-0.025139017030596733,
0.12643231451511383,
0.020538287237286568,
-0.055035416036844254,
-0.05080673098564148,
-0.020890163257718086,
-0.0024402036797255278,
-0.0007334152469411492,
0.025451861321926117,
-0.009173737838864326,
-0.03440959006547928,
0.042032208293676376,
-0.002372122136875987,
-0.08705577254295349,
0.05488809198141098,
0.03141946718096733,
0.06248365342617035,
-0.02770114876329899,
0.04040713235735893,
-0.0006247365963645279,
-0.005810538772493601,
-0.07242284715175629,
0.002573097823187709,
0.007530659902840853,
0.05867791548371315,
-0.03390705585479736,
-0.03488673269748688,
-0.029511334374547005,
0.008044539019465446,
0.10051540285348892,
-0.035952936857938766,
-0.08678659796714783,
0.0246021319180727,
0.007650271523743868,
0.05263286828994751,
-0.035168278962373734,
-0.019676880910992622,
0.025526292622089386,
0.06218466907739639,
-0.022725271061062813,
-0.014214674942195415,
0.007975662127137184,
0.0037993649020791054,
0.024340294301509857,
-0.04634081944823265,
-0.04844323545694351,
-0.10627363622188568,
0.07736028730869293,
0.022512659430503845,
-0.0270952470600605,
0.01551776472479105,
0.05897624045610428,
-0.022757984697818756,
-0.09560763835906982,
-0.04276120290160179,
-0.07489930093288422,
0.09046227484941483,
-0.02567429468035698,
0.06241036579012871,
0.03286013379693031,
-0.014736490324139595,
0.08756927400827408,
0.02853822149336338,
0.05754277855157852,
0.022489676252007484,
0.02596125192940235,
-0.09372126311063766,
0.03993736952543259,
-0.08065268397331238,
0.0013358358992263675,
0.023250801488757133,
0.04977655038237572,
-0.005954692140221596,
0.03999975323677063,
0.011342336423695087,
-0.08047718554735184,
-0.009266714565455914,
-0.0475781187415123,
-0.04666898027062416,
0.12685880064964294,
-0.014590470120310783,
0.01027881633490324,
-0.01609920524060726,
-0.009002512320876122,
-0.12972182035446167,
-0.06948311626911163,
-0.029652805998921394,
0.062291502952575684,
-0.06756947189569473,
-0.013821382075548172,
-0.0009352825582027435,
0.11225783079862595,
-0.010213272646069527,
-0.0033877596724778414,
0.012212168425321579,
0.04589544236660004,
0.0472213514149189,
0.012952686287462711,
-0.051472608000040054,
-0.005735038314014673,
0.011759581044316292,
0.0154202776029706,
-0.031024817377328873,
-0.10136286914348602,
0.017046308144927025,
-0.01863636076450348,
0.012516552582383156,
-0.02351478859782219,
0.037513818591833115,
-0.024068476632237434,
0.0411115400493145,
-0.037583909928798676,
0.005405717995017767,
0.12293508648872375,
0.048600565642118454,
0.03208538889884949,
-0.06270653754472733,
0.03263472393155098,
0.0491461306810379,
-0.010849377140402794,
0.026467185467481613,
9.714112664462607e-34,
-0.010032420046627522,
-0.014495423063635826,
0.00037667457945644855,
0.039464402943849564,
0.04888676851987839,
-0.015239459462463856,
0.05490785837173462,
-0.027468379586935043,
-0.1175202801823616,
0.0007346720085479319,
-0.06209474429488182,
-0.10696177929639816,
-0.011109146289527416,
-0.07328587025403976,
-0.08924353867769241,
-0.08393702656030655,
0.09715703129768372,
-0.0877704992890358,
0.02854667603969574,
0.02147802524268627,
0.02678614668548107,
0.03467424213886261,
-0.031243793666362762,
-0.042189810425043106,
-0.08404900878667831,
-0.08461574465036392,
0.005712851881980896,
-0.036377742886543274,
-0.01013197097927332,
-0.024367840960621834,
-0.024799611419439316,
-0.0008613088866695762,
0.0038477834314107895,
-0.008477929048240185,
0.04332789033651352,
-0.07703638821840286,
0.04396583512425423,
0.021947888657450676,
-0.07718314975500107,
-0.017918411642313004,
-0.012828824110329151,
0.05704430863261223,
-0.0023983013816177845,
-0.01255598571151495,
-0.022895043715834618,
-0.053479358553886414,
-0.06227407604455948,
-0.05232729762792587,
0.023454565554857254,
-0.051009807735681534,
0.1134677454829216,
0.03941362723708153,
0.05214337632060051,
0.029737599194049835,
0.042840633541345596,
-0.019321827217936516,
0.017099488526582718,
-0.029747115448117256,
-0.016029180958867073,
0.057294152677059174,
0.007721599657088518,
-0.001980692381039262,
0.033365800976753235,
0.06618691980838776,
0.037302400916814804,
-0.004196465481072664,
0.012510551139712334,
0.0072412737645208836,
-0.003301063785329461,
0.0497739277780056,
-0.05349034070968628,
-0.032565850764513016,
-0.009637718088924885,
0.03976454585790634,
0.012348849326372147,
0.03357110172510147,
-0.07730698585510254,
-0.025035416707396507,
-0.06060332804918289,
-0.061552245169878006,
0.0448920913040638,
0.019529292359948158,
-0.06448696553707123,
0.011763295158743858,
0.011110636405646801,
0.06113230437040329,
-0.029548630118370056,
-0.12124853581190109,
0.08404909819364548,
-0.03848924860358238,
-0.08114197105169296,
-0.006150887347757816,
0.0281020887196064,
-0.033857524394989014,
0.02616056799888611,
-3.1357325672062103e-33,
0.06394858658313751,
0.02423287369310856,
-0.050061386078596115,
0.04645397141575813,
0.007299178745597601,
-0.03155984356999397,
0.10198725014925003,
0.014851482585072517,
0.010434945113956928,
0.03770393505692482,
-0.07233254611492157,
0.010437794961035252,
0.0063882567919790745,
0.024568939581513405,
0.003482262371107936,
-0.05740965157747269,
0.04406619444489479,
-0.04147246479988098,
0.0933760330080986,
-0.03490905091166496,
-0.042460039258003235,
-0.06837210059165955,
-0.04072035476565361,
0.05882047116756439,
-0.00919459480792284,
0.02432202361524105,
-0.04421531409025192,
0.012005828320980072,
-0.021055566146969795,
-0.05589021369814873,
-0.10336218774318695,
0.016292715445160866,
-0.05450005084276199,
0.04740367457270622,
-0.06663043051958084,
0.0044684140011668205,
0.062430016696453094,
0.12272220849990845,
0.04211277514696121,
0.003157894592732191,
0.05210074409842491,
0.044022344052791595,
-0.014451202005147934,
0.02465289831161499,
0.024960383772850037,
-0.0006191409775055945,
0.018498819321393967,
0.013630101457238197,
-0.04794374480843544,
-0.003483037231490016,
0.02749115414917469,
0.0216123815625906,
-0.0522734597325325,
0.04470459744334221,
0.007518090773373842,
-0.02409037947654724,
0.026275968179106712,
-0.05160963907837868,
0.04055681824684143,
-0.02727026678621769,
-0.022731831297278404,
-0.056757815182209015,
0.03920474275946617,
-0.10894543677568436,
0.09658065438270569,
-0.013807316310703754,
-0.053449250757694244,
0.005384824238717556,
0.08497978001832962,
-0.026225455105304718,
0.029308924451470375,
-0.0028300536796450615,
-0.0394468680024147,
0.06480628252029419,
0.03924161195755005,
-0.03953097388148308,
-0.07004699856042862,
-0.08047710359096527,
0.0198496226221323,
0.13041754066944122,
-0.024392837658524513,
0.03619428724050522,
-0.024252600967884064,
0.11962931603193283,
0.09658253937959671,
0.07135656476020813,
0.030199697241187096,
0.010939860716462135,
-0.019937794655561447,
-0.07105918228626251,
0.03480605408549309,
0.11471355706453323,
-0.06385920941829681,
-0.007954658940434456,
-0.019013211131095886,
-4.9930331869063593e-8,
-0.06683653593063354,
-0.07414210587739944,
-0.15212178230285645,
0.0653754398226738,
0.0008469719905406237,
-0.019998200237751007,
-0.09024028480052948,
-0.05213804543018341,
0.08120725303888321,
-0.037939999252557755,
-0.08461171388626099,
-0.056761484593153,
-0.04412283003330231,
-0.02482442930340767,
-0.009710139594972134,
-0.0008057823870331049,
0.009290037676692009,
0.08867920935153961,
-0.011354359798133373,
-0.03271893784403801,
0.0597924180328846,
0.056754592806100845,
-0.04991990327835083,
0.018528906628489494,
-0.002519640838727355,
-0.04353724792599678,
0.09298042953014374,
0.027665669098496437,
-0.033421438187360764,
-0.004083017352968454,
-0.0258093923330307,
-0.024261418730020523,
0.01730429194867611,
-0.05875009298324585,
0.0353303998708725,
-0.00904535036534071,
0.07307694107294083,
-0.030063113197684288,
0.044985923916101456,
0.11568999290466309,
0.08035565167665482,
0.04095745086669922,
0.002310213167220354,
0.014377971179783344,
-0.0549200065433979,
-0.04243428260087967,
-0.012964718975126743,
0.043135661631822586,
0.041856858879327774,
0.03432895243167877,
0.10393302887678146,
-0.05626031756401062,
-0.00972055271267891,
-0.009413499385118484,
0.060424838215112686,
-0.04258546605706215,
0.037411823868751526,
-0.06285618245601654,
-0.04647783562541008,
-0.007146114483475685,
0.0966893807053566,
0.019312739372253418,
0.09694116562604904,
-0.07394403219223022
] | 0.04724 |
number of bytes][hwm-gotcha]. For streams operating in object mode, the `highWaterMark` specifies a total number of objects. For streams operating on (but not decoding) strings, the `highWaterMark` specifies a total number of UTF-16 code units. Data is buffered in `Readable` streams when the implementation calls [`stream.push(chunk)`][stream-push]. If the consumer of the Stream does not call [`stream.read()`][stream-read], the data will sit in the internal queue until it is consumed. Once the total size of the internal read buffer reaches the threshold specified by `highWaterMark`, the stream will temporarily stop reading data from the underlying resource until the data currently buffered can be consumed (that is, the stream will stop calling the internal [`readable.\_read()`][] method that is used to fill the read buffer). Data is buffered in `Writable` streams when the [`writable.write(chunk)`][stream-write] method is called repeatedly. While the total size of the internal write buffer is below the threshold set by `highWaterMark`, calls to `writable.write()` will return `true`. Once the size of the internal buffer reaches or exceeds the `highWaterMark`, `false` will be returned. A key goal of the `stream` API, particularly the [`stream.pipe()`][] method, is to limit the buffering of data to acceptable levels such that sources and destinations of differing speeds will not overwhelm the available memory. The `highWaterMark` option is a threshold, not a limit: it dictates the amount of data that a stream buffers before it stops asking for more data. It does not enforce a strict memory limitation in general. Specific stream implementations may choose to enforce stricter limits but doing so is optional. Because [`Duplex`][] and [`Transform`][] streams are both `Readable` and `Writable`, each maintains \_two\_ separate internal buffers used for reading and writing, allowing each side to operate independently of the other while maintaining an appropriate and efficient flow of data. For example, [`net.Socket`][] instances are [`Duplex`][] streams whose `Readable` side allows consumption of data received \_from\_ the socket and whose `Writable` side allows writing data \_to\_ the socket. Because data may be written to the socket at a faster or slower rate than data is received, each side should operate (and buffer) independently of the other. The mechanics of the internal buffering are an internal implementation detail and may be changed at any time. However, for certain advanced implementations, the internal buffers can be retrieved using `writable.writableBuffer` or `readable.readableBuffer`. Use of these undocumented properties is discouraged. ## API for stream consumers Almost all Node.js applications, no matter how simple, use streams in some manner. The following is an example of using streams in a Node.js application that implements an HTTP server: ```js const http = require('node:http'); const server = http.createServer((req, res) => { // `req` is an http.IncomingMessage, which is a readable stream. // `res` is an http.ServerResponse, which is a writable stream. let body = ''; // Get the data as utf8 strings. // If an encoding is not set, Buffer objects will be received. req.setEncoding('utf8'); // Readable streams emit 'data' events once a listener is added. req.on('data', (chunk) => { body += chunk; }); // The 'end' event indicates that the entire body has been received. req.on('end', () => { try { const data = JSON.parse(body); // Write back something interesting to the user: res.write(typeof data); res.end(); } catch (er) { // uh oh! bad json! res.statusCode = 400; return res.end(`error: ${er.message}`); } }); }); server.listen(1337); // $ curl localhost:1337 -d "{}" // object // $ curl localhost:1337 -d "\"foo\"" // string // $ curl localhost:1337 -d "not json" // error: Unexpected token 'o', "not json" is not valid JSON ``` [`Writable`][] streams (such as `res` in the example) expose methods such | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.009721480309963226,
-0.00295035052113235,
-0.04504572972655296,
-0.006387977860867977,
-0.01903548836708069,
-0.11710165441036224,
0.04680173471570015,
0.027804570272564888,
-0.010395410470664501,
-0.03790624067187309,
-0.05415889993309975,
0.04629207402467728,
-0.017115173861384392,
-0.06092067435383797,
-0.04779493063688278,
-0.04196450114250183,
0.025274015963077545,
-0.043100882321596146,
-0.04917313531041145,
-0.049966488033533096,
0.11417359113693237,
-0.03832629695534706,
-0.019689472392201424,
0.006633867509663105,
-0.045671820640563965,
0.059984661638736725,
-0.03320390358567238,
0.022114690393209457,
0.05998624861240387,
-0.006545521318912506,
0.010898682288825512,
-0.013657216913998127,
0.016809606924653053,
-0.023479808121919632,
0.0028540953062474728,
0.04544222354888916,
0.04395892843604088,
-0.11786484718322754,
-0.06731966137886047,
0.011843012645840645,
0.07745086401700974,
0.029023446142673492,
-0.09468017518520355,
0.09114257246255875,
-0.020270036533474922,
0.06117478013038635,
-0.008827200159430504,
0.015533055178821087,
-0.11775916814804077,
-0.0025818292051553726,
-0.06307011842727661,
0.05966860428452492,
-0.05482688546180725,
0.11574290692806244,
0.005833513103425503,
-0.06843259930610657,
0.011083284392952919,
0.026933372020721436,
-0.06285945326089859,
0.021425064653158188,
-0.10643133521080017,
-0.005832034163177013,
0.008283671922981739,
0.007976354099810123,
0.05423760786652565,
-0.027498759329319,
0.008596722967922688,
0.031008534133434296,
0.08253376930952072,
-0.06210292875766754,
-0.03486024588346481,
0.032276615500450134,
-0.07029630243778229,
0.013499611057341099,
-0.005536076612770557,
-0.06289920955896378,
0.018458405509591103,
0.0284056905657053,
-0.0001938764180522412,
-0.04892802610993385,
0.030315261334180832,
-0.06289346516132355,
0.08641703426837921,
0.002891597105190158,
0.026733610779047012,
-0.0029620355926454067,
0.004191813990473747,
0.02706046961247921,
-0.014793009497225285,
0.04710272699594498,
-0.05466654151678085,
-0.022669125348329544,
0.05805903673171997,
0.10611530393362045,
-0.03701336309313774,
0.07669641822576523,
0.058204419910907745,
0.03470425680279732,
-0.03186968341469765,
0.005903757177293301,
0.03624730557203293,
0.005387503188103437,
0.016672462224960327,
0.004663554485887289,
0.04166870564222336,
-0.08854018151760101,
0.04363587498664856,
0.16266915202140808,
0.05801161751151085,
-0.04173239320516586,
0.0314638689160347,
-0.020812667906284332,
0.01569334976375103,
-0.0030680897179991007,
-0.000813413702417165,
0.03514554724097252,
-0.030318375676870346,
-0.021184904500842094,
-0.021367019042372704,
0.06719375401735306,
0.0014445791020989418,
-0.04626496508717537,
-0.04676040634512901,
-0.09703545272350311,
0.0546579509973526,
0.016494320705533028,
0.04138123616576195,
3.604858770965954e-33,
-0.0002677905431482941,
-0.0808422788977623,
-0.04546583071351051,
-0.0006565237417817116,
-0.059371139854192734,
-0.009256894700229168,
0.031240761280059814,
0.04837716743350029,
-0.030029214918613434,
-0.05032411962747574,
-0.019701963290572166,
-0.030097028240561485,
-0.032198600471019745,
0.09553924202919006,
0.01272341888397932,
-0.06748783588409424,
0.04074694216251373,
-0.014001828618347645,
-0.01199419517070055,
0.048801567405462265,
0.05931326746940613,
0.03632728382945061,
-0.04093792662024498,
-0.06591548025608063,
-0.028001923114061356,
0.006863571237772703,
-0.031726133078336716,
-0.043370552361011505,
-0.03467044606804848,
0.052800849080085754,
-0.03428534045815468,
-0.018888309597969055,
-0.02333771251142025,
-0.02506575733423233,
0.047918323427438736,
-0.045931264758110046,
-0.011439877562224865,
-0.025066709145903587,
-0.035215698182582855,
-0.07130776345729828,
0.023523947224020958,
0.00530979223549366,
0.0233744028955698,
-0.013035355135798454,
-0.10964076966047287,
-0.08168652653694153,
-0.05737333372235298,
-0.02289338782429695,
-0.0768335834145546,
0.03283655643463135,
0.039882857352495193,
0.052387166768312454,
0.03285990655422211,
0.08189477026462555,
-0.01502216886729002,
-0.007588142529129982,
0.06241140514612198,
-0.003370789811015129,
0.05137914791703224,
0.09178918600082397,
-0.01952633261680603,
0.0565839558839798,
0.03906731680035591,
0.0731009915471077,
0.034589290618896484,
0.05826840177178383,
0.05144524201750755,
-0.030415009707212448,
0.03612331673502922,
-0.025850731879472733,
-0.05365636199712753,
0.0046694641932845116,
0.06425467878580093,
0.043971821665763855,
-0.08873988687992096,
0.01979900896549225,
0.03527860343456268,
-0.09077851474285126,
-0.027731020003557205,
0.012536508962512016,
0.005786548368632793,
-0.004949584137648344,
0.07116345316171646,
-0.012450102716684341,
-0.08266561478376389,
-0.0038820405025035143,
0.011666971258819103,
-0.11903702467679977,
-0.03544192388653755,
-0.04905993118882179,
0.021837742999196053,
-0.02017842046916485,
0.09723011404275894,
-0.1267455816268921,
-0.024131622165441513,
-3.2075699657208374e-33,
0.02899928204715252,
0.004975465126335621,
-0.09657225012779236,
0.07618293911218643,
-0.07015563547611237,
-0.029766259714961052,
-0.007019848562777042,
0.1078256219625473,
0.01359320618212223,
-0.03298157826066017,
-0.017309824004769325,
0.016377277672290802,
-0.03293131664395332,
0.010905618779361248,
0.022562889382243156,
-0.08039496093988419,
0.057610269635915756,
-0.01864282228052616,
0.03889830410480499,
-0.018584631383419037,
-0.001710796495899558,
-0.08972342312335968,
0.02582036331295967,
0.07036414742469788,
-0.039365872740745544,
0.007388350088149309,
-0.04376698657870293,
-0.026623615995049477,
0.005773619282990694,
-0.02281007543206215,
0.01324137207120657,
-0.03130834922194481,
0.0017067322041839361,
-0.03674706071615219,
-0.038294266909360886,
-0.047687847167253494,
0.05753476545214653,
0.05216522514820099,
-0.010908324271440506,
0.02203267253935337,
0.1289944052696228,
-0.012562218122184277,
0.035812925547361374,
-0.0400284081697464,
0.0299506988376379,
0.04090907797217369,
-0.08178383111953735,
-0.00797959603369236,
-0.04090329632163048,
0.010388941504061222,
0.06539925932884216,
-0.013053404167294502,
0.03267587721347809,
0.09129056334495544,
0.03133130818605423,
0.003526498796418309,
0.05377718433737755,
0.017342787235975266,
-0.0225997157394886,
-0.02070329152047634,
0.05001228675246239,
-0.012409521266818047,
-0.06797914206981659,
-0.003493161639198661,
0.011031877249479294,
0.04126463085412979,
0.01684621348977089,
-0.07901228219270706,
0.001051982631906867,
-0.06488107144832611,
0.0574156753718853,
-0.02606990374624729,
0.010763314552605152,
0.05362105742096901,
0.023807844147086143,
-0.0003881732700392604,
-0.06124136969447136,
-0.03415323421359062,
-0.037309739738702774,
0.05602483078837395,
-0.03423932567238808,
0.08752453327178955,
-0.06646333634853363,
0.0956486165523529,
0.06526140868663788,
-0.051621221005916595,
-0.029349137097597122,
-0.07023272663354874,
-0.04713336005806923,
-0.046025052666664124,
0.01411265879869461,
0.058645498007535934,
-0.13480141758918762,
0.027112344279885292,
-0.03103620931506157,
-4.955222721036989e-8,
-0.028833923861384392,
-0.09093599021434784,
-0.03971061110496521,
0.054778117686510086,
0.005515560507774353,
0.021003765985369682,
-0.013922483660280704,
0.03368416056036949,
0.09704399853944778,
0.011806042864918709,
0.08975912630558014,
-0.06089809164404869,
-0.07675907015800476,
-0.11015088111162186,
0.040295399725437164,
0.02560049667954445,
0.05342976003885269,
-0.048625264316797256,
-0.048663247376680374,
-0.010077145881950855,
0.02375117875635624,
-0.02090972103178501,
-0.042656026780605316,
0.05541594699025154,
0.019685670733451843,
0.02226238325238228,
0.14067761600017548,
0.08762165904045105,
-0.02527811750769615,
-0.06331325322389603,
0.0187770314514637,
0.04132367670536041,
0.03310796990990639,
0.08212735503911972,
0.03058222308754921,
0.0637134462594986,
-0.029499487951397896,
0.06692353636026382,
0.0007638821261934936,
0.10748820006847382,
0.056481290608644485,
-0.026411473751068115,
0.008822794072329998,
0.00548527343198657,
0.07503321021795273,
-0.013867625966668129,
-0.09071523696184158,
0.08171681314706802,
-0.02368883602321148,
-0.021122338250279427,
0.04988710582256317,
0.04606042429804802,
-0.010732131078839302,
0.04763277620077133,
-0.0023541187401860952,
-0.03892120346426964,
-0.007787412032485008,
-0.07930751889944077,
-0.027645712718367577,
0.03134848549962044,
0.14530649781227112,
0.06841865181922913,
0.017507726326584816,
0.03750293701887131
] | 0.096119 |
} }); }); server.listen(1337); // $ curl localhost:1337 -d "{}" // object // $ curl localhost:1337 -d "\"foo\"" // string // $ curl localhost:1337 -d "not json" // error: Unexpected token 'o', "not json" is not valid JSON ``` [`Writable`][] streams (such as `res` in the example) expose methods such as `write()` and `end()` that are used to write data onto the stream. [`Readable`][] streams use the [`EventEmitter`][] API for notifying application code when data is available to be read off the stream. That available data can be read from the stream in multiple ways. Both [`Writable`][] and [`Readable`][] streams use the [`EventEmitter`][] API in various ways to communicate the current state of the stream. [`Duplex`][] and [`Transform`][] streams are both [`Writable`][] and [`Readable`][]. Applications that are either writing data to or consuming data from a stream are not required to implement the stream interfaces directly and will generally have no reason to call `require('node:stream')`. Developers wishing to implement new types of streams should refer to the section [API for stream implementers][]. ### Writable streams Writable streams are an abstraction for a \_destination\_ to which data is written. Examples of [`Writable`][] streams include: \* [HTTP requests, on the client][] \* [HTTP responses, on the server][] \* [fs write streams][] \* [zlib streams][zlib] \* [crypto streams][crypto] \* [TCP sockets][] \* [child process stdin][] \* [`process.stdout`][], [`process.stderr`][] Some of these examples are actually [`Duplex`][] streams that implement the [`Writable`][] interface. All [`Writable`][] streams implement the interface defined by the `stream.Writable` class. While specific instances of [`Writable`][] streams may differ in various ways, all `Writable` streams follow the same fundamental usage pattern as illustrated in the example below: ```js const myStream = getWritableStreamSomehow(); myStream.write('some data'); myStream.write('some more data'); myStream.end('done writing data'); ``` #### Class: `stream.Writable` ##### Event: `'close'` The `'close'` event is emitted when the stream and any of its underlying resources (a file descriptor, for example) have been closed. The event indicates that no more events will be emitted, and no further computation will occur. A [`Writable`][] stream will always emit the `'close'` event if it is created with the `emitClose` option. ##### Event: `'drain'` If a call to [`stream.write(chunk)`][stream-write] returns `false`, the `'drain'` event will be emitted when it is appropriate to resume writing data to the stream. ```js // Write the data to the supplied writable stream one million times. // Be attentive to back-pressure. function writeOneMillionTimes(writer, data, encoding, callback) { let i = 1000000; write(); function write() { let ok = true; do { i--; if (i === 0) { // Last time! writer.write(data, encoding, callback); } else { // See if we should continue, or wait. // Don't pass the callback, because we're not done yet. ok = writer.write(data, encoding); } } while (i > 0 && ok); if (i > 0) { // Had to stop early! // Write some more once it drains. writer.once('drain', write); } } } ``` ##### Event: `'error'` \* Type: {Error} The `'error'` event is emitted if an error occurred while writing or piping data. The listener callback is passed a single `Error` argument when called. The stream is closed when the `'error'` event is emitted unless the [`autoDestroy`][writable-new] option was set to `false` when creating the stream. After `'error'`, no further events other than `'close'` \_should\_ be emitted (including `'error'` events). ##### Event: `'finish'` The `'finish'` event is emitted after the [`stream.end()`][stream-end] method has been called, and all data has been flushed to the underlying system. ```js const writer = getWritableStreamSomehow(); for (let i = 0; i < 100; i++) { writer.write(`hello, #${i}!\n`); } writer.on('finish', () => { console.log('All writes are | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.03161061182618141,
0.03862990066409111,
-0.057846687734127045,
-0.03788752853870392,
-0.06035851314663887,
-0.04973224923014641,
-0.026640189811587334,
0.016435813158750534,
0.09979028254747391,
-0.02864585444331169,
-0.008799812756478786,
0.027337070554494858,
-0.03777959197759628,
0.002140939934179187,
0.06633500009775162,
0.008132905699312687,
-0.012124975211918354,
0.04001469910144806,
-0.06440405547618866,
-0.08661044389009476,
0.03587930276989937,
0.022238818928599358,
-0.06724491715431213,
-0.0003844542952720076,
-0.04659163951873779,
0.03240559622645378,
-0.00117343885358423,
0.05933336168527603,
0.06638843566179276,
0.033045694231987,
0.019930435344576836,
-0.01619924232363701,
-0.12013912200927734,
-0.005472124088555574,
-0.02313549444079399,
0.07628831267356873,
0.09304685145616531,
-0.10491915047168732,
-0.03792386129498482,
-0.022684721276164055,
0.13364116847515106,
0.003031268250197172,
-0.03894221782684326,
-0.039418239146471024,
-0.0802735984325409,
0.010035022161900997,
-0.07535262405872345,
-0.00022142477973829955,
-0.15973275899887085,
0.04052865505218506,
-0.04484298825263977,
-0.015615484677255154,
-0.016329245641827583,
0.12887346744537354,
0.01993614248931408,
-0.029613861814141273,
-0.1185322254896164,
0.08010567724704742,
-0.011303262785077095,
-0.03127383440732956,
-0.02464289404451847,
0.0000069114912548684515,
-0.04490995779633522,
0.02837354503571987,
-0.08109458535909653,
-0.11635308712720871,
-0.08919715136289597,
0.023771418258547783,
0.04297766834497452,
-0.030319031327962875,
-0.017433026805520058,
-0.013821473345160484,
-0.11057578027248383,
-0.039646994322538376,
0.028747273609042168,
-0.03857526555657387,
0.047933243215084076,
-0.02672508731484413,
-0.06942983716726303,
-0.003237508935853839,
-0.0035051493905484676,
-0.040044352412223816,
-0.031122427433729172,
0.03652208298444748,
-0.049279190599918365,
0.08422490209341049,
0.010495105758309364,
0.026142993941903114,
0.03568543121218681,
0.017758391797542572,
-0.04838970676064491,
0.02128385752439499,
-0.0005993625381961465,
0.04034723341464996,
0.06044836714863777,
0.054062217473983765,
0.04690760374069214,
0.01285592745989561,
-0.03137385845184326,
0.06380484998226166,
0.04614555463194847,
0.050984133034944534,
0.03835747018456459,
0.05782264471054077,
0.013091810047626495,
-0.06590145826339722,
-0.0698869451880455,
0.018813040107488632,
0.0037086002994328737,
0.0008439087541773915,
-0.0016184718115255237,
0.003480346640571952,
0.012608596123754978,
-0.023087238892912865,
-0.058702386915683746,
0.06422045826911926,
-0.014451057650148869,
-0.00014185949112288654,
-0.02746199630200863,
0.1089366003870964,
0.07476698607206345,
-0.07064641267061234,
-0.05863939970731735,
0.02588803879916668,
0.09381677210330963,
-0.04415921866893768,
0.06542900949716568,
6.945032305476719e-34,
0.048315227031707764,
-0.02163650467991829,
-0.041064873337745667,
0.01122227031737566,
0.016009250655770302,
-0.0009702641400508583,
0.046093735843896866,
0.031007511541247368,
-0.025199800729751587,
0.012299974448978901,
-0.031087098643183708,
0.07873949408531189,
0.0013081497745588422,
0.01830127090215683,
-0.05545303225517273,
0.014907905831933022,
0.10107547044754028,
0.013313299044966698,
0.07268152385950089,
0.0566265732049942,
0.044442690908908844,
0.04332401230931282,
-0.0009249036083929241,
0.020861245691776276,
0.0039401850663125515,
0.007462147623300552,
0.009138057939708233,
-0.0008941473206505179,
-0.039651889353990555,
0.01575753092765808,
0.06735700368881226,
-0.03141285106539726,
0.005447208881378174,
-0.046856753528118134,
0.08358762413263321,
-0.041458860039711,
0.07054394483566284,
-0.04248477518558502,
-0.0746837928891182,
-0.0053991153836250305,
0.02163616009056568,
-0.014034774154424667,
-0.08306025713682175,
-0.029250971972942352,
0.010159657336771488,
-0.06294825673103333,
-0.07918301969766617,
-0.0653156191110611,
0.012610556557774544,
-0.009577404707670212,
-0.02623806893825531,
0.07654301822185516,
0.05550802871584892,
0.0161222405731678,
0.08771730959415436,
-0.0361228808760643,
0.013513737358152866,
-0.0051107099279761314,
-0.0641290470957756,
0.0003132786077912897,
-0.006415063980966806,
0.057891931384801865,
0.015396337024867535,
-0.028075184673070908,
0.07923827320337296,
0.006174903362989426,
-0.012481802143156528,
0.0368838906288147,
0.07809311896562576,
-0.0030996594578027725,
-0.06889242678880692,
0.05628722906112671,
-0.025861050933599472,
0.05593866482377052,
-0.05541735514998436,
-0.013819736428558826,
0.018350020051002502,
-0.03689703717827797,
0.10793256759643555,
0.028270268812775612,
0.03817836567759514,
0.038772083818912506,
-0.03850896283984184,
0.08325234800577164,
-0.08071168512105942,
0.04606139287352562,
-0.056785669177770615,
-0.021677663549780846,
-0.02818259783089161,
-0.016888689249753952,
-0.02305942215025425,
0.08824127912521362,
0.06743162870407104,
-0.13667899370193481,
-0.0697803869843483,
-3.708315130807777e-33,
-0.0033489030320197344,
-0.05167577415704727,
-0.08492723852396011,
0.06748118996620178,
-0.033789925277233124,
-0.06484628468751907,
0.00036318611819297075,
0.023574279621243477,
0.02890932746231556,
-0.011481375433504581,
-0.03442138060927391,
-0.01919429935514927,
-0.05624701827764511,
-0.00065947650000453,
0.014690661802887917,
-0.03782142698764801,
-0.08374392986297607,
-0.12983955442905426,
0.013164356350898743,
-0.017161430791020393,
-0.07230935990810394,
0.042964521795511246,
0.044657714664936066,
0.048095427453517914,
-0.07831353694200516,
-0.049873579293489456,
-0.009559595957398415,
-0.06255925446748734,
-0.06462354958057404,
-0.03169688954949379,
0.005353916902095079,
-0.03774140030145645,
-0.02709592692553997,
0.04986678808927536,
-0.027022380381822586,
-0.0019445540383458138,
0.06341825425624847,
0.12898202240467072,
-0.003038762602955103,
-0.02454737387597561,
0.07560960203409195,
0.009234809316694736,
-0.0013352027162909508,
-0.053790029138326645,
-0.00004940154394716956,
-0.014623365364968777,
-0.03368997201323509,
0.034942496567964554,
-0.04146311804652214,
-0.012031342834234238,
0.05059059336781502,
-0.03869808465242386,
-0.008706558495759964,
0.08216710388660431,
0.0486595556139946,
0.0063885655254125595,
0.08167774975299835,
-0.038155991584062576,
-0.03475875034928322,
-0.002274487866088748,
0.04706592112779617,
-0.10989070683717728,
-0.05012696608901024,
0.05735811963677406,
-0.029795605689287186,
0.0014398825587704778,
-0.03155045211315155,
-0.05324866250157356,
0.013419500552117825,
-0.021105296909809113,
-0.015631169080734253,
0.0006941620376892388,
-0.0699680894613266,
-0.03999977931380272,
0.028790054842829704,
0.007474520709365606,
-0.01993195340037346,
-0.016795702278614044,
0.02686340920627117,
0.10592585802078247,
-0.08669133484363556,
0.04777044430375099,
-0.08007465302944183,
0.0319347009062767,
0.08731629699468613,
0.03745802864432335,
-0.006068084388971329,
-0.06560533493757248,
-0.023912183940410614,
-0.057425353676080704,
0.01766929216682911,
0.08198309689760208,
-0.11128846555948257,
0.038645289838314056,
-0.011859406717121601,
-4.912077500307532e-8,
-0.048203952610492706,
-0.09576483070850372,
-0.11213235557079315,
0.029059629887342453,
-0.049288101494312286,
-0.0079165268689394,
0.006459289696067572,
-0.05822258070111275,
0.04221322387456894,
0.05402489751577377,
-0.0014463490806519985,
-0.04083182290196419,
-0.012824902310967445,
-0.04860023036599159,
0.06299848854541779,
-0.0065082525834441185,
0.02128036879003048,
0.022081943228840828,
-0.01549253985285759,
-0.044176485389471054,
0.023945052176713943,
0.027345435693860054,
-0.020161358639597893,
-0.04965744912624359,
0.0012206321116536856,
-0.026235580444335938,
0.08103625476360321,
0.07107045501470566,
-0.0889449194073677,
-0.04755161702632904,
0.014185299165546894,
0.017936784774065018,
0.10444612801074982,
-0.033752184361219406,
-0.0011565288295969367,
-0.021871650591492653,
-0.010716860182583332,
0.03156356140971184,
-0.034710515290498734,
0.05699080228805542,
0.11400501430034637,
0.03064042329788208,
-0.07707259058952332,
0.03381016477942467,
0.044457536190748215,
-0.0086010517552495,
0.07649537920951843,
0.05484713986515999,
0.014780026860535145,
-0.0019167711725458503,
-0.02597701922059059,
0.009237974882125854,
0.05430563911795616,
0.003715497674420476,
0.02376575581729412,
0.05564673990011215,
-0.01261433120816946,
-0.0788501501083374,
-0.0191884133964777,
0.040135458111763,
0.0874604657292366,
0.07614265382289886,
0.0024683603551238775,
-0.007994200102984905
] | 0.15733 |
##### Event: `'finish'` The `'finish'` event is emitted after the [`stream.end()`][stream-end] method has been called, and all data has been flushed to the underlying system. ```js const writer = getWritableStreamSomehow(); for (let i = 0; i < 100; i++) { writer.write(`hello, #${i}!\n`); } writer.on('finish', () => { console.log('All writes are now complete.'); }); writer.end('This is the end\n'); ``` ##### Event: `'pipe'` \* `src` {stream.Readable} source stream that is piping to this writable The `'pipe'` event is emitted when the [`stream.pipe()`][] method is called on a readable stream, adding this writable to its set of destinations. ```js const writer = getWritableStreamSomehow(); const reader = getReadableStreamSomehow(); writer.on('pipe', (src) => { console.log('Something is piping into the writer.'); assert.equal(src, reader); }); reader.pipe(writer); ``` ##### Event: `'unpipe'` \* `src` {stream.Readable} The source stream that [unpiped][`stream.unpipe()`] this writable The `'unpipe'` event is emitted when the [`stream.unpipe()`][] method is called on a [`Readable`][] stream, removing this [`Writable`][] from its set of destinations. This is also emitted in case this [`Writable`][] stream emits an error when a [`Readable`][] stream pipes into it. ```js const writer = getWritableStreamSomehow(); const reader = getReadableStreamSomehow(); writer.on('unpipe', (src) => { console.log('Something has stopped piping into the writer.'); assert.equal(src, reader); }); reader.pipe(writer); reader.unpipe(writer); ``` ##### `writable.cork()` The `writable.cork()` method forces all written data to be buffered in memory. The buffered data will be flushed when either the [`stream.uncork()`][] or [`stream.end()`][stream-end] methods are called. The primary intent of `writable.cork()` is to accommodate a situation in which several small chunks are written to the stream in rapid succession. Instead of immediately forwarding them to the underlying destination, `writable.cork()` buffers all the chunks until `writable.uncork()` is called, which will pass them all to `writable.\_writev()`, if present. This prevents a head-of-line blocking situation where data is being buffered while waiting for the first small chunk to be processed. However, use of `writable.cork()` without implementing `writable.\_writev()` may have an adverse effect on throughput. See also: [`writable.uncork()`][], [`writable.\_writev()`][stream-\_writev]. ##### `writable.destroy([error])` \* `error` {Error} Optional, an error to emit with `'error'` event. \* Returns: {this} Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` event (unless `emitClose` is set to `false`). After this call, the writable stream has ended and subsequent calls to `write()` or `end()` will result in an `ERR\_STREAM\_DESTROYED` error. This is a destructive and immediate way to destroy a stream. Previous calls to `write()` may not have drained, and may trigger an `ERR\_STREAM\_DESTROYED` error. Use `end()` instead of destroy if data should flush before close, or wait for the `'drain'` event before destroying the stream. ```cjs const { Writable } = require('node:stream'); const myStream = new Writable(); const fooErr = new Error('foo error'); myStream.destroy(fooErr); myStream.on('error', (fooErr) => console.error(fooErr.message)); // foo error ``` ```cjs const { Writable } = require('node:stream'); const myStream = new Writable(); myStream.destroy(); myStream.on('error', function wontHappen() {}); ``` ```cjs const { Writable } = require('node:stream'); const myStream = new Writable(); myStream.destroy(); myStream.write('foo', (error) => console.error(error.code)); // ERR\_STREAM\_DESTROYED ``` Once `destroy()` has been called any further calls will be a no-op and no further errors except from `\_destroy()` may be emitted as `'error'`. Implementors should not override this method, but instead implement [`writable.\_destroy()`][writable-\_destroy]. ##### `writable.closed` \* Type: {boolean} Is `true` after `'close'` has been emitted. ##### `writable.destroyed` \* Type: {boolean} Is `true` after [`writable.destroy()`][writable-destroy] has been called. ```cjs const { Writable } = require('node:stream'); const myStream = new Writable(); console.log(myStream.destroyed); // false myStream.destroy(); console.log(myStream.destroyed); // true ``` ##### `writable.end([chunk[, encoding]][, callback])` \* `chunk` {string|Buffer|TypedArray|DataView|any} Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer}, {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.004100474528968334,
0.002939383964985609,
0.02394012361764908,
0.028934171423316002,
0.030154773965477943,
-0.028101468458771706,
-0.00994904711842537,
0.013063862919807434,
0.07927650213241577,
-0.0014711848925799131,
-0.03744921088218689,
0.06626342982053757,
-0.11402423679828644,
-0.004847987089306116,
-0.07666242867708206,
-0.030507152900099754,
-0.08623608201742172,
-0.004307842347770929,
-0.0443001389503479,
-0.14486443996429443,
0.06160366162657738,
0.016780739650130272,
0.011544579640030861,
0.00789621751755476,
-0.009386937133967876,
0.07656148821115494,
-0.02678971365094185,
-0.07609005272388458,
0.04686233773827553,
-0.014225360937416553,
0.003982364200055599,
-0.09656064212322235,
-0.08680493384599686,
-0.05202365666627884,
-0.03463089466094971,
0.09394942969083786,
-0.011787363328039646,
-0.05595570430159569,
-0.016760582104325294,
-0.04451647773385048,
0.09266284108161926,
0.008483557030558586,
-0.08555629104375839,
0.023597266525030136,
-0.0011589638888835907,
-0.009871775284409523,
-0.10234944522380829,
-0.07483542710542679,
-0.05824694037437439,
0.09066742658615112,
-0.06784746795892715,
-0.015041854232549667,
-0.02186346799135208,
0.04970207065343857,
0.06391903758049011,
-0.004249089863151312,
0.016732096672058105,
-0.025541193783283234,
0.005781009327620268,
-0.043625280261039734,
-0.034220464527606964,
-0.011584040708839893,
-0.0714661180973053,
0.017630498856306076,
0.09889920055866241,
-0.05053873732686043,
-0.0063738697208464146,
0.10413137823343277,
0.02529831789433956,
0.04096556454896927,
-0.025485461577773094,
0.06663651019334793,
-0.07244480401277542,
-0.006280327215790749,
-0.02792370319366455,
-0.11339877545833588,
-0.020540526136755943,
0.04759037494659424,
-0.07861635833978653,
0.04974483326077461,
-0.01682857610285282,
-0.09122053533792496,
0.031027480959892273,
0.002652551978826523,
-0.04455627501010895,
0.12157244235277176,
-0.022992318496108055,
0.024889608845114708,
0.06884283572435379,
-0.004523580893874168,
-0.17153970897197723,
-0.004815997090190649,
0.033104658126831055,
0.10153036564588547,
-0.04509788006544113,
0.0811326652765274,
0.06288640201091766,
0.044161390513181686,
0.0221246425062418,
0.01958145946264267,
0.02046913467347622,
0.06765072792768478,
0.00822305679321289,
-0.029525628313422203,
0.0653211697936058,
-0.0629371628165245,
-0.017809582874178886,
0.04824410751461983,
-0.0691947415471077,
-0.02860698290169239,
0.015575372613966465,
0.02638162299990654,
0.017085125669836998,
0.006295712199062109,
0.002899946877732873,
0.024895798414945602,
-0.019081441685557365,
0.011935201473534107,
-0.00490303710103035,
0.1362752467393875,
0.11755720525979996,
0.035043660551309586,
-0.08021930605173111,
0.018060406669974327,
0.04877660423517227,
-0.04112418740987778,
0.12960092723369598,
3.853226768299287e-33,
0.0403369665145874,
-0.10247661918401718,
-0.03059575706720352,
0.0688459649682045,
0.06778565049171448,
0.04922241345047951,
0.01434791274368763,
0.017543379217386246,
-0.06992372870445251,
0.018545949831604958,
-0.008233527652919292,
-0.015272082760930061,
-0.04110528528690338,
-0.009582960046827793,
-0.023617209866642952,
-0.0769643560051918,
0.08199535310268402,
-0.008361594751477242,
0.001081440132111311,
0.05645512044429779,
0.07778333872556686,
-0.005410403944551945,
-0.02784368023276329,
0.002865983173251152,
-0.02127562090754509,
0.014275914989411831,
-0.04636695235967636,
0.03787459433078766,
-0.07595346122980118,
0.014074360951781273,
0.02416137047111988,
0.018538210541009903,
-0.03171231597661972,
-0.008279198780655861,
0.0037731253542006016,
-0.07200191915035248,
-0.007555712945759296,
-0.02041126973927021,
-0.0653800442814827,
-0.0281980037689209,
0.015227208845317364,
0.004583263304084539,
-0.1229286938905716,
-0.03248503804206848,
-0.05742615833878517,
-0.09285914897918701,
-0.06954510509967804,
0.013149075210094452,
0.02797902747988701,
0.04102332144975662,
0.00030940372380428016,
0.09009391814470291,
0.044507864862680435,
-0.023067548871040344,
0.06888061761856079,
0.007532533258199692,
-0.009204791858792305,
-0.009045923128724098,
-0.02123577520251274,
0.05542794242501259,
0.02984449453651905,
0.10568315535783768,
-0.013782411813735962,
0.028843136504292488,
-0.010381335392594337,
0.03116665408015251,
0.0011042485712096095,
-0.020835384726524353,
0.11203228682279587,
-0.06713129580020905,
-0.10762502998113632,
-0.021724237129092216,
0.00797371193766594,
0.06584482640028,
0.029073582962155342,
0.020627785474061966,
-0.08227166533470154,
-0.059211671352386475,
-0.014754773117601871,
-0.008213728666305542,
0.012342274188995361,
-0.02990509755909443,
-0.03352930396795273,
0.03448177129030228,
0.08366835862398148,
0.054304081946611404,
-0.08345262706279755,
-0.05464628338813782,
-0.05791890248656273,
0.04914332926273346,
-0.01478546392172575,
0.021206848323345184,
0.07436642795801163,
-0.10231798142194748,
-0.04099392145872116,
-5.886793424313458e-33,
0.06832770258188248,
0.004815185442566872,
-0.10985603928565979,
0.07815330475568771,
-0.02492513321340084,
-0.040826890617609024,
0.0010677969548851252,
0.013623622246086597,
0.03868059441447258,
0.03276519849896431,
-0.045536600053310394,
0.058029863983392715,
-0.028228238224983215,
0.04854068532586098,
-0.02891990728676319,
0.031179558485746384,
0.01996357925236225,
-0.10007195919752121,
0.04084664583206177,
-0.06486830860376358,
-0.004209037870168686,
-0.026766980066895485,
0.087253138422966,
0.0006760483956895769,
-0.02260827086865902,
0.018162328749895096,
0.010486599989235401,
-0.0013317341217771173,
-0.07360231876373291,
-0.045991234481334686,
0.023071449249982834,
-0.042401157319545746,
-0.010603250935673714,
0.029041042551398277,
-0.012366990558803082,
-0.03968760371208191,
0.022841311991214752,
0.11876565217971802,
0.033076200634241104,
-0.024326059967279434,
0.1412295401096344,
-0.041681982576847076,
0.0005507685127668083,
-0.0434347540140152,
-0.0015700324438512325,
0.023915870115160942,
-0.04748131334781647,
0.017855655401945114,
0.022419093176722527,
-0.00015233275189530104,
0.0009333995403721929,
-0.04854058101773262,
-0.000722452241461724,
0.06056879088282585,
0.06148804724216461,
-0.05509475618600845,
0.05150504782795906,
-0.05916421115398407,
-0.012343560345470905,
0.008149473927915096,
-0.002513670828193426,
-0.050925564020872116,
0.06116875633597374,
-0.0277402400970459,
0.0636129379272461,
-0.05945756286382675,
-0.0328487902879715,
0.014812367036938667,
0.053146377205848694,
-0.03385065868496895,
0.021441083401441574,
0.028505323454737663,
-0.034476786851882935,
-0.004323415923863649,
0.029513143002986908,
0.016916511580348015,
-0.02901986986398697,
-0.08967877179384232,
0.01431767363101244,
0.04971349611878395,
-0.07018691301345825,
0.0866682231426239,
-0.05849549546837807,
0.012026778422296047,
0.1134948879480362,
-0.03249824047088623,
-0.01707489788532257,
-0.02690180018544197,
0.005556091200560331,
-0.020585371181368828,
0.031387366354465485,
0.07862213999032974,
-0.06005721166729927,
-0.03172901272773743,
-0.015465273521840572,
-5.1780908449927665e-8,
-0.07954182475805283,
-0.07972472161054611,
-0.07787168025970459,
0.021463925018906593,
0.03127497807145119,
-0.02712744101881981,
0.003196647157892585,
0.02199671044945717,
0.023086294531822205,
-0.044006988406181335,
0.03465399518609047,
0.013868538662791252,
0.08564215898513794,
-0.003082812996581197,
0.019928598776459694,
-0.04378228262066841,
0.09023230522871017,
-0.031410519033670425,
-0.05147034674882889,
-0.03477668762207031,
0.015862543135881424,
-0.04434633255004883,
-0.08244982361793518,
0.008754664100706577,
-0.0029531498439610004,
-0.01503529492765665,
0.06910199671983719,
0.030843935906887054,
-0.015376389026641846,
-0.07046214491128922,
-0.008980575948953629,
-0.0057231225073337555,
0.06707717478275299,
0.03556527942419052,
-0.00009036545088747516,
-0.004008108284324408,
0.049964647740125656,
-0.015413489192724228,
0.030445359647274017,
0.029642656445503235,
0.09201119095087051,
0.00910067930817604,
0.00025179763906635344,
0.049296047538518906,
-0.007287745364010334,
-0.02163561061024666,
-0.02539334073662758,
0.03391478583216667,
0.015413890592753887,
0.034784700721502304,
-0.036730144172906876,
-0.005808490328490734,
-0.014093931764364243,
0.00921658519655466,
0.04938247427344322,
-0.05766695737838745,
0.04024312645196915,
-0.0612940639257431,
-0.04130438342690468,
0.010050003416836262,
0.09933950752019882,
0.035015590488910675,
-0.01725694350898266,
-0.020065443590283394
] | 0.128252 |
const myStream = new Writable(); console.log(myStream.destroyed); // false myStream.destroy(); console.log(myStream.destroyed); // true ``` ##### `writable.end([chunk[, encoding]][, callback])` \* `chunk` {string|Buffer|TypedArray|DataView|any} Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer}, {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`. \* `encoding` {string} The encoding if `chunk` is a string \* `callback` {Function} Callback for when the stream is finished. \* Returns: {this} Calling the `writable.end()` method signals that no more data will be written to the [`Writable`][]. The optional `chunk` and `encoding` arguments allow one final additional chunk of data to be written immediately before closing the stream. Calling the [`stream.write()`][stream-write] method after calling [`stream.end()`][stream-end] will raise an error. ```js // Write 'hello, ' and then end with 'world!'. const fs = require('node:fs'); const file = fs.createWriteStream('example.txt'); file.write('hello, '); file.end('world!'); // Writing more now is not allowed! ``` ##### `writable.setDefaultEncoding(encoding)` \* `encoding` {string} The new default encoding \* Returns: {this} The `writable.setDefaultEncoding()` method sets the default `encoding` for a [`Writable`][] stream. ##### `writable.uncork()` The `writable.uncork()` method flushes all data buffered since [`stream.cork()`][] was called. When using [`writable.cork()`][] and `writable.uncork()` to manage the buffering of writes to a stream, defer calls to `writable.uncork()` using `process.nextTick()`. Doing so allows batching of all `writable.write()` calls that occur within a given Node.js event loop phase. ```js stream.cork(); stream.write('some '); stream.write('data '); process.nextTick(() => stream.uncork()); ``` If the [`writable.cork()`][] method is called multiple times on a stream, the same number of calls to `writable.uncork()` must be called to flush the buffered data. ```js stream.cork(); stream.write('some '); stream.cork(); stream.write('data '); process.nextTick(() => { stream.uncork(); // The data will not be flushed until uncork() is called a second time. stream.uncork(); }); ``` See also: [`writable.cork()`][]. ##### `writable.writable` \* Type: {boolean} Is `true` if it is safe to call [`writable.write()`][stream-write], which means the stream has not been destroyed, errored, or ended. ##### `writable.writableAborted` \* Type: {boolean} Returns whether the stream was destroyed or errored before emitting `'finish'`. ##### `writable.writableEnded` \* Type: {boolean} Is `true` after [`writable.end()`][] has been called. This property does not indicate whether the data has been flushed, for this use [`writable.writableFinished`][] instead. ##### `writable.writableCorked` \* Type: {integer} Number of times [`writable.uncork()`][stream-uncork] needs to be called in order to fully uncork the stream. ##### `writable.errored` \* Type: {Error} Returns error if the stream has been destroyed with an error. ##### `writable.writableFinished` \* Type: {boolean} Is set to `true` immediately before the [`'finish'`][] event is emitted. ##### `writable.writableHighWaterMark` \* Type: {number} Return the value of `highWaterMark` passed when creating this `Writable`. ##### `writable.writableLength` \* Type: {number} This property contains the number of bytes (or objects) in the queue ready to be written. The value provides introspection data regarding the status of the `highWaterMark`. ##### `writable.writableNeedDrain` \* Type: {boolean} Is `true` if the stream's buffer has been full and stream will emit `'drain'`. ##### `writable.writableObjectMode` \* Type: {boolean} Getter for the property `objectMode` of a given `Writable` stream. ##### `writable[Symbol.asyncDispose]()` Calls [`writable.destroy()`][writable-destroy] with an `AbortError` and returns a promise that fulfills when the stream is finished. ##### `writable.write(chunk[, encoding][, callback])` \* `chunk` {string|Buffer|TypedArray|DataView|any} Optional data to write. For streams not operating in object mode, `chunk` must be a {string}, {Buffer}, {TypedArray} or {DataView}. For object mode streams, `chunk` may be any JavaScript value other than `null`. \* `encoding` {string|null} The encoding, if `chunk` is a string. \*\*Default:\*\* `'utf8'` \* `callback` {Function} Callback for when this chunk of data is flushed. \* Returns: {boolean} `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.010923793539404869,
-0.005884394980967045,
0.007172592915594578,
0.041352663189172745,
-0.015510724857449532,
-0.04911837726831436,
-0.012078933417797089,
0.024655308574438095,
0.024104265496134758,
-0.046101413667201996,
-0.09989546239376068,
0.09373729676008224,
-0.11610795557498932,
0.029410265386104584,
-0.034761395305395126,
-0.04248540848493576,
-0.0581483393907547,
-0.04085399582982063,
-0.0641261413693428,
-0.026595668867230415,
0.1257987767457962,
-0.021925361827015877,
-0.02519569918513298,
0.006144058424979448,
0.09374924004077911,
0.08783493936061859,
0.03293619304895401,
-0.05884971469640732,
0.04354400187730789,
-0.004436718299984932,
0.013928942382335663,
-0.09426095336675644,
-0.04498200863599777,
-0.026955755427479744,
-0.07403835654258728,
0.07026229053735733,
-0.008544277399778366,
-0.08632590621709824,
-0.05903255566954613,
-0.056142475455999374,
0.08162055164575577,
0.09019040316343307,
-0.1280364841222763,
0.026812518015503883,
-0.04151308536529541,
0.04771147295832634,
-0.07657790184020996,
-0.045364875346422195,
-0.08386518061161041,
0.03909258916974068,
-0.07040709257125854,
0.04122170805931091,
-0.06503349542617798,
0.09796483814716339,
0.05330807343125343,
-0.05290438234806061,
-0.04114262014627457,
-0.010966206900775433,
-0.04448496550321579,
0.03198852017521858,
-0.019215025007724762,
0.015522255562245846,
0.03208772465586662,
0.02909989282488823,
0.0868229791522026,
-0.03953048586845398,
0.0020122991409152746,
0.08403746783733368,
0.04353553056716919,
0.010005059652030468,
-0.029175512492656708,
0.039796195924282074,
-0.03805539384484291,
0.005978460423648357,
-0.0484314002096653,
-0.10615918785333633,
0.030102750286459923,
-0.010728739202022552,
-0.023851733654737473,
0.05695341154932976,
-0.05373131483793259,
-0.06551802903413773,
-0.0056198714300990105,
0.014000034891068935,
-0.028617054224014282,
0.060249317437410355,
0.003963598981499672,
0.07393614947795868,
0.0206469614058733,
0.06293536722660065,
-0.11719011515378952,
0.05281750485301018,
0.07071446627378464,
0.07351968437433243,
-0.015812775120139122,
0.051316238939762115,
0.050714023411273956,
0.008404056541621685,
-0.007274596020579338,
-0.021220991387963295,
0.0025246082805097103,
0.06923653185367584,
0.0450931191444397,
-0.008140206336975098,
0.02713407203555107,
-0.10472619533538818,
0.013391786254942417,
0.03501179814338684,
-0.034783512353897095,
0.02308429591357708,
-0.012942204251885414,
0.08355668932199478,
0.01710144430398941,
-0.014711881056427956,
-0.010348581708967686,
0.04224499687552452,
-0.061265163123607635,
0.01637868396937847,
0.024219896644353867,
0.14183329045772552,
0.06304904818534851,
-0.05533786490559578,
-0.06757499277591705,
-0.0046817646361887455,
0.08677170425653458,
-0.01981247588992119,
0.0593261756002903,
-1.618026303550497e-34,
0.043203242123126984,
-0.06703218072652817,
-0.03953232616186142,
0.05944831669330597,
0.028543666005134583,
0.03572218865156174,
0.0007083482341840863,
0.055417198687791824,
-0.043235231190919876,
-0.027413642033934593,
-0.021689588204026222,
-0.03584808483719826,
-0.011889149434864521,
0.08413384109735489,
0.008993656374514103,
-0.038147617131471634,
0.06795472651720047,
-0.006132396869361401,
-0.01203569583594799,
0.0558898039162159,
0.0402647890150547,
0.045241259038448334,
-0.03785015270113945,
-0.008483626879751682,
-0.04216255247592926,
-0.0392959900200367,
-0.035283010452985764,
-0.013776624575257301,
-0.08469513803720474,
0.00304643833078444,
-0.005340980365872383,
-0.03703591972589493,
-0.04116339609026909,
-0.00034260444226674736,
0.07060620188713074,
-0.06745540350675583,
-0.0484403520822525,
-0.016888197511434555,
-0.07759390026330948,
-0.013564909808337688,
0.042223136872053146,
0.017257414758205414,
-0.07930858433246613,
-0.02822389081120491,
-0.07478468865156174,
-0.07298894226551056,
-0.04855087026953697,
0.030046258121728897,
-0.04040125012397766,
-0.019254742190241814,
0.007844080217182636,
0.06666366755962372,
0.056802500039339066,
0.015667766332626343,
0.012620095163583755,
0.018532006070017815,
0.006824968848377466,
-0.06098655238747597,
0.001952292281202972,
0.010798106901347637,
0.031656600534915924,
0.08488527685403824,
0.02654031477868557,
0.023276671767234802,
-0.03059006668627262,
0.017579806968569756,
0.029016049578785896,
0.00829714722931385,
0.04916655272245407,
-0.1165405884385109,
-0.08062126487493515,
-0.02504921332001686,
0.004805993754416704,
0.02571849524974823,
-0.024550363421440125,
0.01064861286431551,
-0.03279965743422508,
-0.08006510138511658,
-0.019251583144068718,
-0.01612013950943947,
0.03302082419395447,
-0.05524252727627754,
0.023850521072745323,
0.030406516045331955,
0.031250424683094025,
0.0290406234562397,
-0.038859039545059204,
-0.11022884398698807,
0.026186062023043633,
0.03739997744560242,
-0.04300195723772049,
-0.05847558379173279,
0.03832751885056496,
-0.14856985211372375,
-0.01779462769627571,
-2.8506590240844818e-33,
0.04091260954737663,
-0.04850337654352188,
-0.08753273636102676,
0.027059974148869514,
-0.026637757197022438,
-0.016812698915600777,
-0.0213107168674469,
0.1301455795764923,
0.03856702521443367,
-0.04281378909945488,
-0.06352420896291733,
0.04238005355000496,
-0.03028913587331772,
0.028335649520158768,
-0.05945378169417381,
-0.01980436220765114,
-0.045410241931676865,
-0.0683717206120491,
0.013539508916437626,
-0.09445152431726456,
-0.008136061951518059,
-0.0599193349480629,
0.0887923464179039,
0.04386639595031738,
0.020130719989538193,
0.01032875943928957,
-0.011803315952420235,
0.005787134636193514,
-0.0007159360102377832,
-0.05127071589231491,
0.035169199109077454,
-0.0069159031845629215,
-0.003496223594993353,
0.0003997520834673196,
0.025445127859711647,
-0.03275369480252266,
0.056977529078722,
0.0674959048628807,
-0.021838024258613586,
-0.014150572940707207,
0.10945691168308258,
0.029989948496222496,
0.0009493538527749479,
0.0023707766085863113,
0.06266019493341446,
-0.027729857712984085,
-0.01067787129431963,
0.04658159241080284,
0.007507347036153078,
0.00018427382747177035,
0.035528965294361115,
-0.03404943645000458,
0.0029793018475174904,
0.06889072805643082,
0.046432092785835266,
-0.05773799121379852,
0.08012481778860092,
-0.09838829934597015,
0.025518644601106644,
0.009357529692351818,
-0.04078606516122818,
-0.090975321829319,
0.01923299767076969,
-0.00898556225001812,
0.008620637468993664,
-0.04746026545763016,
0.014866583049297333,
0.010353180579841137,
0.034548114985227585,
-0.013353904709219933,
0.02231389470398426,
-0.007716463878750801,
0.016149306669831276,
0.02053484134376049,
0.05269218236207962,
0.0056242854334414005,
-0.08085636794567108,
-0.041451096534729004,
-0.001577358110807836,
0.07457828521728516,
0.05617688596248627,
0.05105504021048546,
-0.051316507160663605,
0.046047598123550415,
0.11401906609535217,
-0.0009618173353374004,
-0.006305080372840166,
-0.034407809376716614,
-0.057092007249593735,
-0.047274213284254074,
-0.004959546960890293,
0.0671285018324852,
-0.14235635101795197,
0.008424228988587856,
-0.04799944907426834,
-4.3426712892369324e-8,
-0.043898116797208786,
-0.060089513659477234,
-0.1228683665394783,
0.027745850384235382,
0.012652857229113579,
-0.060478873550891876,
-0.011680489405989647,
-0.007420565467327833,
0.08735179901123047,
-0.0454159639775753,
0.04245917871594429,
-0.036810267716646194,
-0.008231609128415585,
-0.050974041223526,
-0.00037716719089075923,
-0.04554576426744461,
0.0714360848069191,
-0.050281450152397156,
-0.01652129739522934,
0.017408223822712898,
0.016249777749180794,
-0.0574679933488369,
-0.06897584348917007,
0.046141427010297775,
0.04306790977716446,
0.0120773920789361,
0.09555097669363022,
0.04386341571807861,
0.009070660918951035,
-0.02606528252363205,
-0.005322888493537903,
0.0849824771285057,
0.11298208683729172,
0.08697360754013062,
-0.023059671744704247,
0.019716180860996246,
0.04646622762084007,
0.026219287887215614,
-0.002804204123094678,
0.05522743612527847,
0.11403051018714905,
0.049391891807317734,
0.024290569126605988,
0.016493692994117737,
0.033961184322834015,
-0.025063779205083847,
-0.01585295982658863,
0.037597447633743286,
0.02626635506749153,
-0.006217975169420242,
-0.005482770502567291,
0.06781329214572906,
-0.056412700563669205,
0.05390558019280434,
-0.032619547098875046,
-0.0863567367196083,
-0.014172527939081192,
-0.03327507898211479,
-0.02840164303779602,
-0.01798357628285885,
0.12523196637630463,
0.03946685418486595,
0.01921500451862812,
-0.021230477839708328
] | 0.0818 |
than `null`. \* `encoding` {string|null} The encoding, if `chunk` is a string. \*\*Default:\*\* `'utf8'` \* `callback` {Function} Callback for when this chunk of data is flushed. \* Returns: {boolean} `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. The `writable.write()` method writes some data to the stream, and calls the supplied `callback` once the data has been fully handled. If an error occurs, the `callback` will be called with the error as its first argument. The `callback` is called asynchronously and before `'error'` is emitted. The return value is `true` if the internal buffer is less than the `highWaterMark` configured when the stream was created after admitting `chunk`. If `false` is returned, further attempts to write data to the stream should stop until the [`'drain'`][] event is emitted. While a stream is not draining, calls to `write()` will buffer `chunk`, and return false. Once all currently buffered chunks are drained (accepted for delivery by the operating system), the `'drain'` event will be emitted. Once `write()` returns false, do not write more chunks until the `'drain'` event is emitted. While calling `write()` on a stream that is not draining is allowed, Node.js will buffer all written chunks until maximum memory usage occurs, at which point it will abort unconditionally. Even before it aborts, high memory usage will cause poor garbage collector performance and high RSS (which is not typically released back to the system, even after the memory is no longer required). Since TCP sockets may never drain if the remote peer does not read the data, writing a socket that is not draining may lead to a remotely exploitable vulnerability. Writing data while the stream is not draining is particularly problematic for a [`Transform`][], because the `Transform` streams are paused by default until they are piped or a `'data'` or `'readable'` event handler is added. If the data to be written can be generated or fetched on demand, it is recommended to encapsulate the logic into a [`Readable`][] and use [`stream.pipe()`][]. However, if calling `write()` is preferred, it is possible to respect backpressure and avoid memory issues using the [`'drain'`][] event: ```js function write(data, cb) { if (!stream.write(data)) { stream.once('drain', cb); } else { process.nextTick(cb); } } // Wait for cb to be called before doing any other write. write('hello', () => { console.log('Write completed, do more writes now.'); }); ``` A `Writable` stream in object mode will always ignore the `encoding` argument. ### Readable streams Readable streams are an abstraction for a \_source\_ from which data is consumed. Examples of `Readable` streams include: \* [HTTP responses, on the client][http-incoming-message] \* [HTTP requests, on the server][http-incoming-message] \* [fs read streams][] \* [zlib streams][zlib] \* [crypto streams][crypto] \* [TCP sockets][] \* [child process stdout and stderr][] \* [`process.stdin`][] All [`Readable`][] streams implement the interface defined by the `stream.Readable` class. #### Two reading modes `Readable` streams effectively operate in one of two modes: flowing and paused. These modes are separate from [object mode][object-mode]. A [`Readable`][] stream can be in object mode or not, regardless of whether it is in flowing mode or paused mode. \* In flowing mode, data is read from the underlying system automatically and provided to an application as quickly as possible using events via the [`EventEmitter`][] interface. \* In paused mode, the [`stream.read()`][stream-read] method must be called explicitly to read chunks of data from the stream. All [`Readable`][] streams begin in paused mode but can be switched to flowing mode in one of the following ways: \* Adding a [`'data'`][] event | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.07431057095527649,
0.026633616536855698,
-0.035783346742391586,
0.07837475091218948,
-0.0695832148194313,
-0.09784012287855148,
-0.0116482675075531,
0.030281325802206993,
0.01656041108071804,
-0.04055172950029373,
-0.052515722811222076,
0.031001197174191475,
-0.010043509304523468,
-0.05717954412102699,
-0.05420584976673126,
-0.02915284037590027,
-0.042930323630571365,
-0.06135402247309685,
-0.07349525392055511,
-0.07697936147451401,
0.09468252956867218,
0.0003629830025602132,
-0.02567857876420021,
0.032493576407432556,
0.04276808723807335,
0.021760620176792145,
-0.020786331966519356,
-0.06390150636434555,
0.06517259031534195,
0.002211351878941059,
-0.029354307800531387,
-0.0433042086660862,
-0.043922848999500275,
-0.08978751301765442,
0.018375368788838387,
0.11610909551382065,
0.02754140831530094,
-0.07748497277498245,
-0.10454306751489639,
0.00965719111263752,
0.05944173038005829,
0.0017888867296278477,
-0.10726090520620346,
0.025809675455093384,
-0.06472054868936539,
0.04394124448299408,
-0.031766463071107864,
-0.000567128648981452,
-0.10329501330852509,
0.015609866008162498,
0.007292008958756924,
0.09017424285411835,
-0.0676954835653305,
0.05557892471551895,
0.06741219013929367,
-0.04671410098671913,
-0.0017769919941201806,
-0.02239200845360756,
-0.03887373208999634,
-0.003968348726630211,
-0.01681249774992466,
-0.017330875620245934,
-0.010847371071577072,
0.024116670712828636,
0.0933464840054512,
-0.06149406358599663,
-0.022703954949975014,
-0.03217039629817009,
0.01947091333568096,
-0.04058412089943886,
-0.053186994045972824,
0.0491706021130085,
-0.10515807569026947,
0.06248556450009346,
0.015440087765455246,
-0.06013323366641998,
0.05029968172311783,
0.0009561406914144754,
-0.04483115300536156,
0.012794448994100094,
0.042222484946250916,
-0.08914187550544739,
-0.01972910575568676,
0.020130161195993423,
0.05658959224820137,
-0.0010865266667678952,
-0.02034955471754074,
0.056736089289188385,
0.01945776492357254,
0.05919434130191803,
-0.05370017886161804,
-0.026200728490948677,
0.03557071462273598,
0.07505704462528229,
-0.04649050161242485,
0.057641126215457916,
0.07448474317789078,
0.021706050261855125,
-0.034181248396635056,
-0.010500851087272167,
0.01541772112250328,
-0.03033503144979477,
0.007565102074295282,
-0.012648089788854122,
0.12556737661361694,
-0.058012597262859344,
0.04547059163451195,
-0.005069208797067404,
0.01939491368830204,
-0.05083734914660454,
0.000006576468422281323,
-0.026862328872084618,
0.03939219191670418,
0.00794968381524086,
-0.05261630937457085,
0.029570531100034714,
-0.030170565471053123,
-0.009534808807075024,
-0.01285121962428093,
0.05354660376906395,
0.040893275290727615,
-0.01588778756558895,
-0.024036338552832603,
-0.009022749960422516,
0.04224986955523491,
-0.048352714627981186,
0.054980937391519547,
-6.288957913802847e-35,
0.03324728086590767,
-0.025863289833068848,
-0.03269759193062782,
0.0004058034101035446,
-0.034871216863393784,
0.002640495775267482,
0.0018411981873214245,
0.010403119027614594,
0.0023859047796577215,
-0.031411312520504,
0.012432177551090717,
-0.06402803957462311,
0.0033295496832579374,
0.08882926404476166,
-0.014429736882448196,
-0.02095346339046955,
0.08281807601451874,
-0.04358147829771042,
-0.02041351981461048,
0.047861434519290924,
0.0758647546172142,
0.04946417734026909,
-0.05741758644580841,
-0.015604453161358833,
-0.02409004047513008,
-0.008876468054950237,
-0.047334104776382446,
-0.04818236827850342,
-0.058708641678094864,
0.03595832735300064,
-0.06266770511865616,
-0.05454018712043762,
0.016765667125582695,
-0.012196822091937065,
0.05724148079752922,
0.010772611945867538,
-0.035274818539619446,
-0.0547720231115818,
-0.08309963345527649,
-0.014742828905582428,
-0.03834099695086479,
0.026764947921037674,
-0.11562119424343109,
-0.001075503183528781,
-0.002133716130629182,
-0.11001890897750854,
-0.06949015706777573,
0.030445026233792305,
0.032718077301979065,
0.00422262167558074,
0.025662029162049294,
0.09512872248888016,
0.0522892065346241,
0.09140225499868393,
0.006580595392733812,
0.01411384716629982,
0.04626288637518883,
-0.09107944369316101,
-0.005803598091006279,
0.05769089236855507,
0.036270298063755035,
0.043153032660484314,
-0.026158589869737625,
-0.02634340710937977,
-0.03287235274910927,
0.08669266104698181,
0.09494748711585999,
0.026602132245898247,
0.008200651966035366,
-0.07660728693008423,
-0.07195666432380676,
-0.009518281556665897,
-0.012485272251069546,
0.09670513868331909,
-0.08596467226743698,
0.03755519539117813,
-0.004445413593202829,
-0.09138793498277664,
-0.0114961639046669,
-0.023669403046369553,
0.01741579733788967,
-0.03924526646733284,
-0.01756046898663044,
0.027805307880043983,
-0.04673226177692413,
0.03253856301307678,
0.01639879122376442,
-0.07521909475326538,
0.006312964484095573,
-0.005952729377895594,
0.019479157403111458,
-0.051559220999479294,
0.06727667897939682,
-0.1115260124206543,
-0.05308312922716141,
-2.9524509573939378e-33,
0.013295781798660755,
-0.022026540711522102,
-0.08505719155073166,
0.07210573554039001,
-0.06767655909061432,
-0.06556328386068344,
0.05237792432308197,
0.08702556043863297,
0.0377282053232193,
-0.0025229782331734896,
-0.09656288474798203,
0.018789106979966164,
-0.031678926199674606,
-0.0016526782419532537,
0.031912703067064285,
0.003328485181555152,
-0.008165924809873104,
-0.05381167680025101,
0.0006704943953081965,
-0.04243879020214081,
0.029769957065582275,
-0.03597592934966087,
0.04740971699357033,
0.06615906953811646,
-0.04000645503401756,
-0.0008392891031689942,
-0.010202549397945404,
-0.02812136337161064,
-0.023968417197465897,
-0.019659841433167458,
-0.0013364646583795547,
0.005554616451263428,
0.0023098341189324856,
0.009809582494199276,
-0.0009953398257493973,
-0.05270989611744881,
0.05178947374224663,
0.06412188708782196,
-0.014634025283157825,
-0.015251191332936287,
0.1840355545282364,
0.0275343619287014,
0.045709867030382156,
0.01897512935101986,
0.0394844226539135,
0.030773555859923363,
-0.07015566527843475,
0.012744883075356483,
0.014644806273281574,
0.02278943359851837,
0.07207481563091278,
-0.039012257009744644,
0.04539448395371437,
0.16694986820220947,
0.001610149396583438,
-0.024814477190375328,
0.04977332055568695,
-0.02026871033012867,
-0.0003677390341181308,
0.014993900433182716,
-0.03750910609960556,
-0.05599873885512352,
0.033359743654727936,
-0.008444893173873425,
-0.01612170971930027,
0.008314494974911213,
0.022328736260533333,
-0.006949177477508783,
0.058400511741638184,
-0.07013899087905884,
0.04067489132285118,
-0.045900121331214905,
0.02408115565776825,
-0.002387912943959236,
0.029752984642982483,
0.036013223230838776,
-0.08262863010168076,
-0.0586451031267643,
-0.006916391663253307,
0.08058091998100281,
-0.03351741284132004,
0.10064025223255157,
-0.015707748010754585,
0.10156764090061188,
0.07733771950006485,
-0.017738068476319313,
-0.006722570396959782,
-0.013979903422296047,
-0.024809759110212326,
-0.03785370662808418,
0.001789904315955937,
0.07978948205709457,
-0.13988952338695526,
0.006989345420151949,
-0.02017606422305107,
-5.2396526228903895e-8,
-0.03035321645438671,
-0.062300652265548706,
-0.061014655977487564,
0.05094590410590172,
-0.004839095287024975,
-0.07088498026132584,
0.02351067215204239,
-0.06588464975357056,
0.0669713243842125,
-0.0391390398144722,
0.02081320807337761,
-0.03015543706715107,
-0.006727042142301798,
-0.119644895195961,
0.025019168853759766,
0.034916505217552185,
0.028837524354457855,
-0.0388534739613533,
-0.025653643533587456,
-0.010828444734215736,
0.009433962404727936,
-0.033483680337667465,
-0.08206672966480255,
0.05255752429366112,
-0.005217148456722498,
0.032449252903461456,
0.09136223793029785,
0.09536565840244293,
-0.03304555267095566,
-0.07480309903621674,
0.06250718981027603,
0.05662740394473076,
0.047057490795850754,
0.07360824942588806,
-0.04844300076365471,
0.05203680321574211,
0.09457042068243027,
0.0070351362228393555,
0.014074889943003654,
0.10028383880853653,
0.039555057883262634,
0.05409957095980644,
-0.002525591989979148,
-0.02035435475409031,
0.032599058002233505,
0.008497091010212898,
-0.055598024278879166,
0.042746059596538544,
-0.0008530906052328646,
-0.031067490577697754,
-0.026609456166625023,
0.035002853721380234,
-0.02624872699379921,
0.06601900607347488,
0.026091285049915314,
-0.0889734998345375,
-0.05215957388281822,
-0.04112851619720459,
0.007315133232623339,
0.011601148173213005,
0.13871701061725616,
0.03765830397605896,
0.11274849623441696,
-0.010400441475212574
] | 0.08789 |
using events via the [`EventEmitter`][] interface. \* In paused mode, the [`stream.read()`][stream-read] method must be called explicitly to read chunks of data from the stream. All [`Readable`][] streams begin in paused mode but can be switched to flowing mode in one of the following ways: \* Adding a [`'data'`][] event handler. \* Calling the [`stream.resume()`][stream-resume] method. \* Calling the [`stream.pipe()`][] method to send the data to a [`Writable`][]. The `Readable` can switch back to paused mode using one of the following: \* If there are no pipe destinations, by calling the [`stream.pause()`][stream-pause] method. \* If there are pipe destinations, by removing all pipe destinations. Multiple pipe destinations may be removed by calling the [`stream.unpipe()`][] method. The important concept to remember is that a `Readable` will not generate data until a mechanism for either consuming or ignoring that data is provided. If the consuming mechanism is disabled or taken away, the `Readable` will \_attempt\_ to stop generating the data. For backward compatibility reasons, removing [`'data'`][] event handlers will \*\*not\*\* automatically pause the stream. Also, if there are piped destinations, then calling [`stream.pause()`][stream-pause] will not guarantee that the stream will \_remain\_ paused once those destinations drain and ask for more data. If a [`Readable`][] is switched into flowing mode and there are no consumers available to handle the data, that data will be lost. This can occur, for instance, when the `readable.resume()` method is called without a listener attached to the `'data'` event, or when a `'data'` event handler is removed from the stream. Adding a [`'readable'`][] event handler automatically makes the stream stop flowing, and the data has to be consumed via [`readable.read()`][stream-read]. If the [`'readable'`][] event handler is removed, then the stream will start flowing again if there is a [`'data'`][] event handler. #### Three states The "two modes" of operation for a `Readable` stream are a simplified abstraction for the more complicated internal state management that is happening within the `Readable` stream implementation. Specifically, at any given point in time, every `Readable` is in one of three possible states: \* `readable.readableFlowing === null` \* `readable.readableFlowing === false` \* `readable.readableFlowing === true` When `readable.readableFlowing` is `null`, no mechanism for consuming the stream's data is provided. Therefore, the stream will not generate data. While in this state, attaching a listener for the `'data'` event, calling the `readable.pipe()` method, or calling the `readable.resume()` method will switch `readable.readableFlowing` to `true`, causing the `Readable` to begin actively emitting events as data is generated. Calling `readable.pause()`, `readable.unpipe()`, or receiving backpressure will cause the `readable.readableFlowing` to be set as `false`, temporarily halting the flowing of events but \_not\_ halting the generation of data. While in this state, attaching a listener for the `'data'` event will not switch `readable.readableFlowing` to `true`. ```js const { PassThrough, Writable } = require('node:stream'); const pass = new PassThrough(); const writable = new Writable(); pass.pipe(writable); pass.unpipe(writable); // readableFlowing is now false. pass.on('data', (chunk) => { console.log(chunk.toString()); }); // readableFlowing is still false. pass.write('ok'); // Will not emit 'data'. pass.resume(); // Must be called to make stream emit 'data'. // readableFlowing is now true. ``` While `readable.readableFlowing` is `false`, data may be accumulating within the stream's internal buffer. #### Choose one API style The `Readable` stream API evolved across multiple Node.js versions and provides multiple methods of consuming stream data. In general, developers should choose \_one\_ of the methods of consuming data and \_should never\_ use multiple methods to consume data from a single stream. Specifically, using a combination of `on('data')`, `on('readable')`, `pipe()`, or async iterators could lead to unintuitive behavior. #### Class: `stream.Readable` ##### Event: `'close'` The `'close'` event is emitted when | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.014044057577848434,
-0.025417018681764603,
-0.044573940336704254,
0.011224008165299892,
-0.005502968095242977,
-0.03716408461332321,
-0.004655390977859497,
0.02759215421974659,
-0.04015040770173073,
-0.014685924164950848,
-0.04952896758913994,
0.06227264553308487,
-0.08279132097959518,
-0.006586803589016199,
-0.0649208351969719,
-0.06343928724527359,
-0.02382059022784233,
0.018939366564154625,
-0.0030254838056862354,
-0.0817682221531868,
0.051461927592754364,
0.046894751489162445,
0.011518718674778938,
-0.008254815824329853,
-0.01909210905432701,
0.046869587153196335,
-0.011057334952056408,
-0.026717808097600937,
0.046193677932024,
0.03886432945728302,
-0.00492823263630271,
-0.05191284045577049,
-0.07599993795156479,
-0.04026370123028755,
0.010392208583652973,
0.04464446008205414,
0.04341864585876465,
-0.028320731595158577,
-0.09073705971240997,
-0.01835518889129162,
0.1367260217666626,
-0.05873977392911911,
-0.1075936108827591,
-0.013924059458076954,
-0.06750565767288208,
-0.02834302932024002,
-0.04361996427178383,
-0.03621184453368187,
-0.043933384120464325,
0.08795595914125443,
-0.05434046685695648,
0.008084507659077644,
-0.038512617349624634,
0.06385627388954163,
0.056916121393442154,
-0.00022018242452759296,
0.04711286723613739,
-0.016021687537431717,
-0.008722000755369663,
-0.08144858479499817,
-0.06912332773208618,
-0.025737280026078224,
-0.06343302875757217,
0.04736761003732681,
-0.022614412009716034,
0.08819849044084549,
-0.029219238087534904,
0.04938187822699547,
0.10388880223035812,
-0.04975338652729988,
-0.03887943550944328,
0.09452755004167557,
-0.12483803182840347,
0.010763800702989101,
-0.020113537088036537,
-0.1054491400718689,
0.019483018666505814,
0.0030940843280404806,
-0.05553954839706421,
0.022710531949996948,
-0.00019448823877610266,
-0.11147530376911163,
0.0227357167750597,
0.051250021904706955,
-0.03341783955693245,
0.05564139783382416,
-0.006617431528866291,
0.04564966633915901,
0.0087500074878335,
0.0130307050421834,
-0.12295623868703842,
0.03889867290854454,
0.05625081807374954,
0.0737282782793045,
-0.019401120021939278,
0.07349716126918793,
0.01085744146257639,
0.004654293414205313,
-0.00503750192001462,
-0.0011652677785605192,
0.030929120257496834,
0.05154460668563843,
-0.045663055032491684,
0.020157016813755035,
0.052621398121118546,
-0.12288204580545425,
0.019935254007577896,
-0.013676280155777931,
-0.04415283352136612,
-0.012800098396837711,
0.02679358422756195,
0.008771712891757488,
0.009536933153867722,
-0.004433240741491318,
0.013214454054832458,
0.09219761192798615,
-0.08384508639574051,
0.05414215102791786,
-0.033151984214782715,
0.07368583232164383,
0.05956263095140457,
0.005647097714245319,
-0.029331620782613754,
-0.0523269921541214,
0.12849071621894836,
-0.011063356883823872,
0.1006714403629303,
1.3036818261084656e-33,
-0.03577525541186333,
-0.09119716286659241,
-0.03297882899641991,
0.06706821918487549,
0.07082618027925491,
0.034472666680812836,
0.028727024793624878,
0.007405904587358236,
-0.016423823311924934,
-0.03360341861844063,
-0.047642018646001816,
0.023881159722805023,
-0.02791234292089939,
-0.051481254398822784,
0.022585410624742508,
-0.05238282307982445,
0.04483850672841072,
0.051518362015485764,
0.023627735674381256,
0.06253508478403091,
0.07332983613014221,
-0.06365630030632019,
-0.022783739492297173,
0.017553457990288734,
-0.018906373530626297,
-0.006032843142747879,
-0.06439764052629471,
0.06728560477495193,
0.018078356981277466,
0.043062057346105576,
-0.03531677648425102,
-0.009155022911727428,
-0.0008089921902865171,
-0.017131224274635315,
-0.0057044867426157,
-0.0995812937617302,
-0.029832633212208748,
-0.035122670233249664,
-0.022334713488817215,
0.013534210622310638,
-0.025830576196312904,
-0.04464054852724075,
-0.07929806411266327,
-0.04074632748961449,
-0.10685286670923233,
-0.14538560807704926,
-0.06338387727737427,
-0.004606570117175579,
-0.0028176463674753904,
0.036749739199876785,
0.08686615526676178,
0.058568935841321945,
0.04493773356080055,
-0.055408116430044174,
0.01474082376807928,
-0.039047691971063614,
-0.020456625148653984,
0.080673947930336,
0.000298539933282882,
0.024196811020374298,
0.027817852795124054,
0.10665901005268097,
0.06835027039051056,
0.017406040802598,
0.0604519359767437,
0.06432939320802689,
0.007234108168631792,
-0.023709995672106743,
0.01962071657180786,
-0.09078498929738998,
-0.08641042560338974,
0.0027901313733309507,
-0.00008771163265919313,
-0.006408064626157284,
0.009231499396264553,
0.03850023075938225,
-0.04439695551991463,
-0.03619377687573433,
-0.029139036312699318,
0.051113538444042206,
0.0690348818898201,
-0.019268982112407684,
-0.0052007404156029224,
-0.00262017035856843,
0.01753864996135235,
-0.03152230381965637,
-0.07317125797271729,
-0.031607139855623245,
-0.048643793910741806,
-0.02973867766559124,
-0.03733927756547928,
0.03824125602841377,
0.05373844504356384,
-0.07967087626457214,
0.008780638687312603,
-2.746906035590068e-33,
0.06636390835046768,
-0.01131477952003479,
-0.07578273117542267,
0.042916592210531235,
-0.012805840000510216,
-0.0034927702508866787,
0.0467865876853466,
0.029301289469003677,
0.005568142514675856,
-0.04158950597047806,
-0.016301216557621956,
0.052138835191726685,
-0.06788098812103271,
-0.023694857954978943,
0.008211390115320683,
-0.007669719401746988,
0.03106829524040222,
-0.04329470172524452,
-0.006061662454158068,
-0.012612493708729744,
-0.04007124900817871,
-0.08790035545825958,
-0.020824458450078964,
-0.006045915186405182,
-0.09293714165687561,
0.04264332354068756,
-0.03216296806931496,
-0.03506846725940704,
-0.01007939875125885,
-0.04203897714614868,
0.006240659859031439,
0.04482617974281311,
-0.010286614298820496,
-0.04091357812285423,
0.014466571621596813,
-0.015354892238974571,
0.031803857535123825,
0.08987627178430557,
0.026578791439533234,
0.03100971132516861,
0.1959616243839264,
0.04457088187336922,
-0.011832945980131626,
-0.029561221599578857,
0.0679602175951004,
0.02990386262536049,
-0.011274999938905239,
0.02168082632124424,
-0.06591486930847168,
0.05200720205903053,
0.005465375725179911,
0.012702669948339462,
0.0198080912232399,
0.06602997332811356,
0.07910256832838058,
0.04369209706783295,
0.07807415723800659,
-0.061175595968961716,
-0.058798566460609436,
-0.056191615760326385,
0.03299087658524513,
-0.10549461096525192,
-0.019573204219341278,
0.005477102939039469,
0.08605345338582993,
0.01839233562350273,
0.027763493359088898,
-0.03206142038106918,
-0.02006426453590393,
-0.06670863181352615,
0.06832531094551086,
-0.04283607751131058,
0.009987324476242065,
0.030459193512797356,
0.07044651359319687,
0.03589353710412979,
-0.038467682898044586,
-0.006881664972752333,
-0.031971704214811325,
0.05122629553079605,
0.0012697158381342888,
0.1070314422249794,
-0.034445762634277344,
0.050010643899440765,
0.08962923288345337,
0.023765970021486282,
-0.06542905420064926,
-0.05345859006047249,
0.08095584064722061,
-0.03423313423991203,
-0.061436548829078674,
0.05099998787045479,
-0.05041670799255371,
0.04925408214330673,
0.02465905249118805,
-4.815005283376195e-8,
-0.06473813951015472,
-0.025681305676698685,
-0.03574933111667633,
0.07254725694656372,
-0.011875331401824951,
-0.023495161905884743,
-0.07972092926502228,
-0.03322137892246246,
0.07391372323036194,
-0.007816264405846596,
-0.009176683612167835,
-0.01858518086373806,
0.04741700738668442,
-0.0005661141476593912,
0.023979559540748596,
0.02545291744172573,
0.0810302272439003,
-0.05259650945663452,
-0.019714292138814926,
-0.03565962612628937,
0.06406734883785248,
-0.05327966809272766,
-0.04914320632815361,
0.03867828845977783,
-0.009678343310952187,
-0.0045855422504246235,
0.08446706086397171,
0.007247254718095064,
0.003451300784945488,
-0.10095836967229843,
-0.048081327229738235,
-0.0216832235455513,
0.030508896335959435,
0.08400752395391464,
-0.011507821269333363,
0.019085830077528954,
0.009033099748194218,
-0.008226477541029453,
0.04380251467227936,
-0.011914988048374653,
0.11034704744815826,
-0.033337511122226715,
-0.01995059661567211,
0.011627782136201859,
0.0320897176861763,
0.03345007821917534,
-0.013585573993623257,
0.08690838515758514,
0.02000599540770054,
0.09894094616174698,
-0.0888979509472847,
0.02872026525437832,
0.026619145646691322,
0.03763403743505478,
0.021243911236524582,
-0.006509483326226473,
0.016917873173952103,
-0.09442827105522156,
-0.01671719178557396,
0.03331778571009636,
0.08257962763309479,
0.06753118336200714,
-0.09137701988220215,
-0.027968794107437134
] | 0.065025 |
should choose \_one\_ of the methods of consuming data and \_should never\_ use multiple methods to consume data from a single stream. Specifically, using a combination of `on('data')`, `on('readable')`, `pipe()`, or async iterators could lead to unintuitive behavior. #### Class: `stream.Readable` ##### Event: `'close'` The `'close'` event is emitted when the stream and any of its underlying resources (a file descriptor, for example) have been closed. The event indicates that no more events will be emitted, and no further computation will occur. A [`Readable`][] stream will always emit the `'close'` event if it is created with the `emitClose` option. ##### Event: `'data'` \* `chunk` {Buffer|string|any} The chunk of data. For streams that are not operating in object mode, the chunk will be either a string or `Buffer`. For streams that are in object mode, the chunk can be any JavaScript value other than `null`. The `'data'` event is emitted whenever the stream is relinquishing ownership of a chunk of data to a consumer. This may occur whenever the stream is switched in flowing mode by calling `readable.pipe()`, `readable.resume()`, or by attaching a listener callback to the `'data'` event. The `'data'` event will also be emitted whenever the `readable.read()` method is called and a chunk of data is available to be returned. Attaching a `'data'` event listener to a stream that has not been explicitly paused will switch the stream into flowing mode. Data will then be passed as soon as it is available. The listener callback will be passed the chunk of data as a string if a default encoding has been specified for the stream using the `readable.setEncoding()` method; otherwise the data will be passed as a `Buffer`. ```js const readable = getReadableStreamSomehow(); readable.on('data', (chunk) => { console.log(`Received ${chunk.length} bytes of data.`); }); ``` ##### Event: `'end'` The `'end'` event is emitted when there is no more data to be consumed from the stream. The `'end'` event \*\*will not be emitted\*\* unless the data is completely consumed. This can be accomplished by switching the stream into flowing mode, or by calling [`stream.read()`][stream-read] repeatedly until all data has been consumed. ```js const readable = getReadableStreamSomehow(); readable.on('data', (chunk) => { console.log(`Received ${chunk.length} bytes of data.`); }); readable.on('end', () => { console.log('There will be no more data.'); }); ``` ##### Event: `'error'` \* Type: {Error} The `'error'` event may be emitted by a `Readable` implementation at any time. Typically, this may occur if the underlying stream is unable to generate data due to an underlying internal failure, or when a stream implementation attempts to push an invalid chunk of data. The listener callback will be passed a single `Error` object. ##### Event: `'pause'` The `'pause'` event is emitted when [`stream.pause()`][stream-pause] is called and `readableFlowing` is not `false`. ##### Event: `'readable'` The `'readable'` event is emitted when there is data available to be read from the stream, up to the configured high water mark (`state.highWaterMark`). Effectively, it indicates that the stream has new information within the buffer. If data is available within this buffer, [`stream.read()`][stream-read] can be called to retrieve that data. Additionally, the `'readable'` event may also be emitted when the end of the stream has been reached. ```js const readable = getReadableStreamSomehow(); readable.on('readable', function() { // There is some data to read now. let data; while ((data = this.read()) !== null) { console.log(data); } }); ``` If the end of the stream has been reached, calling [`stream.read()`][stream-read] will return `null` and trigger the `'end'` event. This is also true if there never was any data to be read. For instance, in the following example, `foo.txt` is an empty file: ```js const | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.03769557923078537,
-0.013761756010353565,
-0.008195677772164345,
0.05734400823712349,
0.05653270706534386,
-0.08665315061807632,
0.05884624272584915,
0.030087199062108994,
0.05205560848116875,
-0.017598900943994522,
-0.037031929939985275,
0.0414956733584404,
-0.09989459067583084,
-0.00197735708206892,
-0.008234846405684948,
0.024267438799142838,
-0.029357703402638435,
-0.021545767784118652,
-0.09752827137708664,
-0.0777195543050766,
0.054757341742515564,
0.00246112491004169,
-0.05649180710315704,
0.040349941700696945,
-0.04591681808233261,
0.0418243333697319,
-0.036865923553705215,
-0.04386402294039726,
0.052919622510671616,
0.005280082579702139,
0.054302871227264404,
-0.09372340887784958,
-0.12428505718708038,
-0.002772173611447215,
-0.002974247559905052,
0.06531144678592682,
0.027647897601127625,
-0.10071113705635071,
-0.057096853852272034,
0.03847013786435127,
0.12806588411331177,
0.006020024418830872,
-0.13815447688102722,
-0.02534371241927147,
-0.08256778120994568,
0.007507983595132828,
-0.05631241202354431,
-0.03267824277281761,
-0.07803991436958313,
0.01402495801448822,
-0.06693682074546814,
0.04133006930351257,
-0.0504644438624382,
0.10760092735290527,
0.05189727246761322,
-0.04947257041931152,
0.019227134063839912,
-0.038853902369737625,
-0.07245732843875885,
-0.05252271890640259,
-0.07654451578855515,
-0.053221218287944794,
-0.05238024890422821,
0.01737256906926632,
0.03798874095082283,
-0.032504040747880936,
-0.0514889694750309,
0.0708821713924408,
0.12454234808683395,
0.0343385748565197,
-0.02177596092224121,
0.0588090606033802,
-0.07353862375020981,
0.0366988368332386,
0.03543167561292648,
-0.09534455835819244,
0.03619389235973358,
-0.019665442407131195,
-0.048924632370471954,
-0.023734772577881813,
-0.03584597632288933,
-0.0676170215010643,
0.017623715102672577,
-0.07047529518604279,
0.00833864975720644,
0.03564520552754402,
-0.007426334545016289,
0.027902988716959953,
0.01903679035604,
0.03841767832636833,
-0.10315574705600739,
0.050418585538864136,
0.07982492446899414,
0.12863633036613464,
0.0027749452274292707,
0.06514251232147217,
0.08682482689619064,
-0.008356636390089989,
0.06379734724760056,
0.017999565228819847,
-0.02661076746881008,
0.1129961684346199,
0.03401222825050354,
0.044497162103652954,
0.017596106976270676,
-0.06671416759490967,
-0.055213697254657745,
-0.013330841436982155,
-0.057753849774599075,
-0.060481153428554535,
0.0008987890905700624,
-0.017673609778285027,
0.010563935153186321,
0.024954620748758316,
-0.042085714638233185,
0.0797688215970993,
-0.05205020308494568,
0.043498024344444275,
0.02470487356185913,
0.12743203341960907,
0.06633755564689636,
-0.036438893526792526,
-0.026293497532606125,
0.012375387363135815,
0.06288295984268188,
-0.04343027248978615,
0.03327884152531624,
3.707921340200252e-33,
-0.035409051924943924,
-0.13974377512931824,
-0.09095852077007294,
0.031183958053588867,
0.005823574494570494,
0.05688897520303726,
0.01293136179447174,
0.046276260167360306,
-0.015466898679733276,
0.033272892236709595,
0.0076170121319592,
0.0031477808952331543,
-0.06043628603219986,
-0.008337145671248436,
0.05398839712142944,
-0.029355205595493317,
0.06968220323324203,
0.03596481308341026,
0.01584632508456707,
0.06020573154091835,
0.07773301750421524,
0.03349195420742035,
-0.07046831399202347,
0.0005952738574706018,
0.0011981178540736437,
-0.017694365233182907,
-0.027155695483088493,
0.013173185288906097,
-0.058306727558374405,
0.03176477551460266,
-0.029039651155471802,
0.015287395566701889,
0.03395652770996094,
0.015802763402462006,
0.0303810928016901,
-0.016887666657567024,
-0.004429765976965427,
-0.02807937189936638,
-0.0744398757815361,
-0.07331375032663345,
0.028168272227048874,
0.043777577579021454,
-0.04551664739847183,
-0.04132768511772156,
-0.10585782676935196,
-0.10442068427801132,
-0.06084898114204407,
0.036446455866098404,
-0.02682020701467991,
-0.03482360020279884,
0.07066278159618378,
0.02778153121471405,
0.07679019123315811,
0.04149729013442993,
0.03562711179256439,
-0.05602865293622017,
-0.031579840928316116,
-0.0073326351121068,
0.03186637535691261,
0.03201883286237717,
0.02637024223804474,
0.04948471114039421,
0.07865995168685913,
0.015337828546762466,
0.035539593547582626,
0.025174813345074654,
0.05680261552333832,
-0.026388389989733696,
0.09868370741605759,
-0.0337660051882267,
-0.09265906363725662,
0.09081890434026718,
-0.056736186146736145,
-0.05188192054629326,
0.038792580366134644,
0.0001224688603542745,
0.012352700345218182,
-0.06668607890605927,
0.02585427090525627,
0.04789046198129654,
0.05092356353998184,
-0.008959736675024033,
0.027924563735723495,
0.03669492527842522,
-0.1106770858168602,
0.04218233376741409,
-0.04730464518070221,
-0.03344506025314331,
-0.08233624696731567,
-0.014353717677295208,
-0.056782905012369156,
-0.0048985411413013935,
0.05009840801358223,
-0.13478228449821472,
-0.05439668893814087,
-5.467287408495816e-33,
0.026062102988362312,
-0.023837316781282425,
-0.03662287816405296,
0.05216195434331894,
0.00795153807848692,
0.0030651618726551533,
0.014484144747257233,
-0.001873405883088708,
0.04034147411584854,
-0.005002403166145086,
-0.02192152664065361,
0.03230975568294525,
-0.04935979098081589,
-0.009498977102339268,
0.024814525619149208,
-0.001957952044904232,
0.009507391601800919,
-0.09597746282815933,
0.03315766900777817,
-0.008760188706219196,
-0.0667523741722107,
-0.03914712741971016,
0.052558835595846176,
0.0006547088851220906,
-0.012090973556041718,
0.0040211123414337635,
-0.03599923104047775,
-0.043737463653087616,
0.008430253714323044,
-0.05367622151970863,
0.0040665739215910435,
-0.04389125853776932,
-0.003706816816702485,
-0.0018388082971796393,
0.0020103089045733213,
0.021589498966932297,
0.020582165569067,
0.05984931439161301,
0.02526627480983734,
-0.004014281556010246,
0.14594170451164246,
0.0995134636759758,
-0.03937922790646553,
-0.021776724606752396,
0.03049902245402336,
0.012436757795512676,
-0.02920539118349552,
0.03961321339011192,
-0.030533280223608017,
0.0016387380892410874,
0.015495308674871922,
-0.023606233298778534,
-0.03159814700484276,
0.07898618280887604,
0.050866615027189255,
0.029460132122039795,
0.11345696449279785,
-0.028146905824542046,
-0.07128700613975525,
-0.029105056077241898,
0.008696871809661388,
-0.051254063844680786,
-0.03865092247724533,
0.03100212663412094,
0.011892254464328289,
0.0023254144471138716,
0.005063602235168219,
-0.041701771318912506,
0.05594588443636894,
-0.062191665172576904,
0.07597256451845169,
0.01704474724829197,
-0.031076708808541298,
0.015174039639532566,
-0.008942150510847569,
0.06922008842229843,
-0.03382442519068718,
-0.0735502690076828,
-0.003969306126236916,
0.08806002885103226,
-0.11263510584831238,
0.05686280131340027,
-0.039940930902957916,
0.06435413658618927,
0.07778021693229675,
0.00838077999651432,
-0.00031159789068624377,
-0.05393519625067711,
0.017083115875720978,
-0.007356739602982998,
0.011109276674687862,
0.0010703959269449115,
-0.08627539128065109,
0.023889079689979553,
-0.02686791867017746,
-5.316588058690286e-8,
-0.01103418692946434,
-0.05893218144774437,
-0.019505484029650688,
0.08583217859268188,
0.026776669546961784,
-0.04719360172748566,
-0.0198979414999485,
-0.0027462460566312075,
0.033952221274375916,
-0.004664518870413303,
0.03336891904473305,
-0.019625745713710785,
0.04980550706386566,
-0.034325383603572845,
0.027080897241830826,
-0.02738102152943611,
0.04544375464320183,
-0.04997212812304497,
-0.04486383497714996,
-0.01935829222202301,
0.03264028578996658,
-0.027847200632095337,
-0.02623497135937214,
0.00046866084448993206,
-0.011432884261012077,
0.0388038195669651,
0.07542765885591507,
0.05234100669622421,
0.004597339779138565,
-0.10310369729995728,
0.04167478531599045,
0.001526425126940012,
0.054073311388492584,
0.08991148322820663,
0.00763723673298955,
0.007213353645056486,
-0.0009109828970395029,
0.010360008105635643,
-0.02433299645781517,
0.030516918748617172,
0.0752609446644783,
-0.05789567902684212,
-0.030524611473083496,
0.08371579647064209,
0.003664906369522214,
-0.003545797662809491,
-0.05863667652010918,
0.00646021356806159,
0.025080209597945213,
0.07085704803466797,
-0.049702152609825134,
0.02080223336815834,
-0.043257031589746475,
0.054050419479608536,
0.030508944764733315,
-0.08724000304937363,
0.045961592346429825,
-0.06333760917186737,
-0.053426455706357956,
-0.04116391763091087,
0.09635034203529358,
0.018241140991449356,
-0.05515516176819801,
-0.009348071180284023
] | 0.090407 |
{ console.log(data); } }); ``` If the end of the stream has been reached, calling [`stream.read()`][stream-read] will return `null` and trigger the `'end'` event. This is also true if there never was any data to be read. For instance, in the following example, `foo.txt` is an empty file: ```js const fs = require('node:fs'); const rr = fs.createReadStream('foo.txt'); rr.on('readable', () => { console.log(`readable: ${rr.read()}`); }); rr.on('end', () => { console.log('end'); }); ``` The output of running this script is: ```console $ node test.js readable: null end ``` In some cases, attaching a listener for the `'readable'` event will cause some amount of data to be read into an internal buffer. In general, the `readable.pipe()` and `'data'` event mechanisms are easier to understand than the `'readable'` event. However, handling `'readable'` might result in increased throughput. If both `'readable'` and [`'data'`][] are used at the same time, `'readable'` takes precedence in controlling the flow, i.e. `'data'` will be emitted only when [`stream.read()`][stream-read] is called. The `readableFlowing` property would become `false`. If there are `'data'` listeners when `'readable'` is removed, the stream will start flowing, i.e. `'data'` events will be emitted without calling `.resume()`. ##### Event: `'resume'` The `'resume'` event is emitted when [`stream.resume()`][stream-resume] is called and `readableFlowing` is not `true`. ##### `readable.destroy([error])` \* `error` {Error} Error which will be passed as payload in `'error'` event \* Returns: {this} Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'` event (unless `emitClose` is set to `false`). After this call, the readable stream will release any internal resources and subsequent calls to `push()` will be ignored. Once `destroy()` has been called any further calls will be a no-op and no further errors except from `\_destroy()` may be emitted as `'error'`. Implementors should not override this method, but instead implement [`readable.\_destroy()`][readable-\_destroy]. ##### `readable.closed` \* Type: {boolean} Is `true` after `'close'` has been emitted. ##### `readable.destroyed` \* Type: {boolean} Is `true` after [`readable.destroy()`][readable-destroy] has been called. ##### `readable.isPaused()` \* Returns: {boolean} The `readable.isPaused()` method returns the current operating state of the `Readable`. This is used primarily by the mechanism that underlies the `readable.pipe()` method. In most typical cases, there will be no reason to use this method directly. ```js const readable = new stream.Readable(); readable.isPaused(); // === false readable.pause(); readable.isPaused(); // === true readable.resume(); readable.isPaused(); // === false ``` ##### `readable.pause()` \* Returns: {this} The `readable.pause()` method will cause a stream in flowing mode to stop emitting [`'data'`][] events, switching out of flowing mode. Any data that becomes available will remain in the internal buffer. ```js const readable = getReadableStreamSomehow(); readable.on('data', (chunk) => { console.log(`Received ${chunk.length} bytes of data.`); readable.pause(); console.log('There will be no additional data for 1 second.'); setTimeout(() => { console.log('Now data will start flowing again.'); readable.resume(); }, 1000); }); ``` The `readable.pause()` method has no effect if there is a `'readable'` event listener. ##### `readable.pipe(destination[, options])` \* `destination` {stream.Writable} The destination for writing data \* `options` {Object} Pipe options \* `end` {boolean} End the writer when the reader ends. \*\*Default:\*\* `true`. \* Returns: {stream.Writable} The \_destination\_, allowing for a chain of pipes if it is a [`Duplex`][] or a [`Transform`][] stream The `readable.pipe()` method attaches a [`Writable`][] stream to the `readable`, causing it to switch automatically into flowing mode and push all of its data to the attached [`Writable`][]. The flow of data will be automatically managed so that the destination `Writable` stream is not overwhelmed by a faster `Readable` stream. The following example pipes all of the data from the `readable` into a file named `file.txt`: ```js const fs = require('node:fs'); const readable = getReadableStreamSomehow(); const writable = fs.createWriteStream('file.txt'); // All | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.0017338177422061563,
0.010686350986361504,
-0.042204052209854126,
0.06606370210647583,
0.08232027292251587,
-0.037253789603710175,
-0.00433906726539135,
0.05701236426830292,
0.08096813410520554,
0.024558119475841522,
-0.03924769535660744,
0.09519311785697937,
-0.05607854947447777,
-0.011753375642001629,
-0.04130588099360466,
-0.04910304769873619,
-0.02317546308040619,
-0.009982339106500149,
-0.0175551176071167,
-0.08357439935207367,
0.019568361341953278,
-0.022116227075457573,
-0.011106863617897034,
-0.013325710780918598,
-0.07988956570625305,
0.060615479946136475,
-0.05804478004574776,
-0.06493515521287918,
-0.007570717949420214,
-0.0062474450096488,
-0.00949312187731266,
-0.08225282281637192,
-0.0867910161614418,
-0.023067869246006012,
-0.03435986489057541,
0.10701248049736023,
0.03352048620581627,
-0.08396323025226593,
-0.07101143896579742,
-0.00027822653646580875,
0.08957318216562271,
0.09378745406866074,
-0.11857619136571884,
0.03614449128508568,
0.02989673987030983,
-0.022945288568735123,
-0.05198519676923752,
-0.0315496064722538,
-0.11029234528541565,
0.007519279606640339,
-0.034646354615688324,
0.01221387181431055,
-0.014224174432456493,
0.05282608047127724,
0.017935339361429214,
0.01987037993967533,
0.018993305042386055,
-0.03668800741434097,
-0.025195002555847168,
-0.019175086170434952,
-0.07535107433795929,
-0.06605011969804764,
-0.0012089182855561376,
-0.004514212254434824,
0.10137807577848434,
-0.02621801756322384,
-0.031152471899986267,
0.06758333742618561,
0.06066511571407318,
0.03968080133199692,
-0.006317873019725084,
0.06395707279443741,
-0.07440589368343353,
0.008915730752050877,
-0.029282445088028908,
-0.062207650393247604,
-0.01813829131424427,
0.020921451970934868,
-0.03507952764630318,
0.048755113035440445,
-0.05953513830900192,
-0.07584060728549957,
0.01607546955347061,
-0.0682794526219368,
-0.03254616633057594,
0.113060861825943,
0.02302297204732895,
0.051671937108039856,
0.02897254005074501,
0.08312129974365234,
-0.1233750507235527,
0.007058512885123491,
-0.03509777784347534,
0.1141052320599556,
-0.017889684066176414,
0.07840102165937424,
0.07520637661218643,
0.03645459562540054,
0.009470834396779537,
0.0020935479551553726,
0.041149187833070755,
0.044126175343990326,
-0.007148101460188627,
0.0166472215205431,
0.03552574664354324,
-0.04627925530076027,
-0.07575682550668716,
-0.010078598745167255,
-0.048640552908182144,
-0.004134226590394974,
0.029966095462441444,
-0.0002792791638057679,
0.02337002195417881,
-0.01130080595612526,
-0.06160902976989746,
0.0344475582242012,
0.0026082384865731,
-0.00564582459628582,
-0.003947109449654818,
0.14675459265708923,
0.11747661978006363,
0.01605837792158127,
-0.0203781109303236,
0.05230001360177994,
0.08082405477762222,
-0.02828849107027054,
0.07573805004358292,
-4.138179088566087e-34,
-0.030646514147520065,
-0.07829354703426361,
-0.004726273939013481,
0.048219211399555206,
-0.0015459106070920825,
0.0013705258024856448,
0.03843686357140541,
0.01865120232105255,
-0.05422830581665039,
-0.007604182232171297,
-0.01692642644047737,
-0.0038757731672376394,
-0.011827514506876469,
-0.017578041180968285,
0.008698645047843456,
0.06417954713106155,
0.061852287501096725,
-0.039030447602272034,
0.017000500112771988,
0.02817622572183609,
0.05875273048877716,
-0.032873474061489105,
-0.062411773949861526,
-0.0012704168912023306,
0.004789115395396948,
-0.0257074236869812,
-0.05953320488333702,
0.019731884822249413,
-0.025367043912410736,
-0.006569406948983669,
-0.02863982506096363,
0.019221028313040733,
0.023066405206918716,
-0.005656903609633446,
0.034355539828538895,
-0.053999923169612885,
0.005175542552024126,
-0.025912242010235786,
-0.09949774295091629,
-0.018167421221733093,
0.06388712674379349,
-0.019008714705705643,
-0.007926568388938904,
-0.007585679646581411,
-0.05984170734882355,
-0.11882499605417252,
-0.059771180152893066,
0.019840719178318977,
-0.043484024703502655,
-0.012020722031593323,
0.015750402584671974,
0.07448823750019073,
0.0933731198310852,
-0.006999527104198933,
0.04818993806838989,
0.0280726570636034,
0.011283586733043194,
-0.1084091067314148,
-0.06027776375412941,
0.04487909376621246,
0.09209956228733063,
0.0017788733821362257,
0.04611999914050102,
0.01873639039695263,
-0.0003988426469732076,
0.06573416292667389,
-0.004439080599695444,
-0.06945164501667023,
0.05956973135471344,
-0.08935996890068054,
-0.05620764195919037,
-0.0373128205537796,
0.005607889033854008,
0.03862306475639343,
0.02303892932832241,
0.05451401323080063,
-0.09767401963472366,
-0.06791115552186966,
0.042717594653367996,
-0.0161014162003994,
0.10201901197433472,
-0.034345027059316635,
0.03190825507044792,
0.10213280469179153,
-0.0064255776815116405,
-0.008650551550090313,
-0.051378339529037476,
-0.09488119930028915,
-0.017283974215388298,
-0.014669325202703476,
0.03713841363787651,
-0.01948646269738674,
0.021607721224427223,
-0.07686445862054825,
0.014592096209526062,
-2.628198554901287e-33,
0.005663692485541105,
0.0041375309228897095,
-0.0851110965013504,
0.09713498502969742,
-0.032191213220357895,
-0.005579683464020491,
-0.05376550182700157,
-0.009195324033498764,
0.07129844278097153,
0.029971851035952568,
-0.029137928038835526,
0.01861555129289627,
-0.033459559082984924,
0.07547513395547867,
-0.01863553188741207,
0.02216452546417713,
-0.018585029989480972,
-0.10059398412704468,
0.0025664467830210924,
-0.04334132373332977,
-0.008226879872381687,
-0.05297767370939255,
0.10421547293663025,
0.03150857612490654,
-0.014608587138354778,
0.012779406271874905,
-0.011270901188254356,
-0.0543380081653595,
-0.10447987914085388,
-0.05550217628479004,
-0.03657614067196846,
-0.00027741846861317754,
-0.04200112819671631,
0.023613102734088898,
0.03626668080687523,
-0.03970203921198845,
0.039800047874450684,
0.07458791136741638,
0.0015097282594069839,
0.05251942574977875,
0.07709428668022156,
0.08192751556634903,
0.02814043127000332,
-0.02392740175127983,
0.012904339469969273,
-0.032046783715486526,
-0.004431161098182201,
0.06336095929145813,
0.04843383654952049,
-0.015568830072879791,
-0.035560492426157,
-0.007331903092563152,
0.04092448204755783,
0.11525145918130875,
0.00843783374875784,
-0.04117276519536972,
0.003177872858941555,
0.018379518762230873,
0.035279203206300735,
-0.004849069751799107,
0.011381844989955425,
-0.09747093170881271,
-0.09365152567625046,
0.02194042131304741,
-0.0291306059807539,
-0.06931273639202118,
0.02196994051337242,
-0.03137771412730217,
0.12201400101184845,
-0.03954062610864639,
0.04501557722687721,
-0.019334379583597183,
-0.04773206636309624,
-0.025758249685168266,
0.045515675097703934,
0.06960439682006836,
-0.05657315254211426,
-0.13742567598819733,
-0.03366417810320854,
0.04265843331813812,
-0.010528448969125748,
0.05650346726179123,
-0.050917599350214005,
0.04139899089932442,
0.10969876497983932,
0.03473838046193123,
-0.016977833583950996,
-0.055141180753707886,
-0.0024067044723778963,
0.00437486357986927,
0.0047651901841163635,
0.02549678273499012,
-0.127158522605896,
-0.02259521186351776,
-0.060422610491514206,
-4.875304071561004e-8,
-0.024493124336004257,
-0.06391244381666183,
-0.11582355201244354,
0.012593016028404236,
0.0067466506734490395,
-0.03765619546175003,
0.00906381569802761,
-0.024849340319633484,
0.015254327096045017,
0.023739181458950043,
-0.0010635112412273884,
-0.04536911100149155,
0.03206700086593628,
-0.03610573336482048,
-0.014381332322955132,
0.019639259204268456,
0.07091738283634186,
-0.02205694280564785,
-0.019994616508483887,
-0.03514161705970764,
-0.014040207490324974,
0.059916701167821884,
-0.08537320792675018,
0.06651405245065689,
0.013354347087442875,
0.021536758169531822,
0.12567494809627533,
0.05204864963889122,
0.009006541222333908,
-0.03380712494254112,
0.01808595284819603,
0.05285457521677017,
0.07873918116092682,
0.048284564167261124,
-0.06254193186759949,
0.016541069373488426,
0.05749067664146423,
0.058406610041856766,
-0.01418110728263855,
0.05152929574251175,
0.07940467447042465,
0.031575676053762436,
-0.021428478881716728,
0.03487870842218399,
-0.07159251719713211,
-0.05194714665412903,
0.008606119081377983,
0.033711597323417664,
0.01575704663991928,
-0.022189855575561523,
0.01106991432607174,
0.019944526255130768,
-0.07364466786384583,
-0.01016995869576931,
0.026080969721078873,
-0.07961493730545044,
0.04944074526429176,
-0.03229956701397896,
-0.061738282442092896,
-0.005711016245186329,
0.07397191971540451,
-0.004440623335540295,
-0.017100075259804726,
-0.046168506145477295
] | 0.075066 |
data will be automatically managed so that the destination `Writable` stream is not overwhelmed by a faster `Readable` stream. The following example pipes all of the data from the `readable` into a file named `file.txt`: ```js const fs = require('node:fs'); const readable = getReadableStreamSomehow(); const writable = fs.createWriteStream('file.txt'); // All the data from readable goes into 'file.txt'. readable.pipe(writable); ``` It is possible to attach multiple `Writable` streams to a single `Readable` stream. The `readable.pipe()` method returns a reference to the \_destination\_ stream making it possible to set up chains of piped streams: ```js const fs = require('node:fs'); const zlib = require('node:zlib'); const r = fs.createReadStream('file.txt'); const z = zlib.createGzip(); const w = fs.createWriteStream('file.txt.gz'); r.pipe(z).pipe(w); ``` By default, [`stream.end()`][stream-end] is called on the destination `Writable` stream when the source `Readable` stream emits [`'end'`][], so that the destination is no longer writable. To disable this default behavior, the `end` option can be passed as `false`, causing the destination stream to remain open: ```js reader.pipe(writer, { end: false }); reader.on('end', () => { writer.end('Goodbye\n'); }); ``` One important caveat is that if the `Readable` stream emits an error during processing, the `Writable` destination \_is not closed\_ automatically. If an error occurs, it will be necessary to \_manually\_ close each stream in order to prevent memory leaks. The [`process.stderr`][] and [`process.stdout`][] `Writable` streams are never closed until the Node.js process exits, regardless of the specified options. ##### `readable.read([size])` \* `size` {number} Optional argument to specify how much data to read. \* Returns: {string|Buffer|null|any} The `readable.read()` method reads data out of the internal buffer and returns it. If no data is available to be read, `null` is returned. By default, the data is returned as a `Buffer` object unless an encoding has been specified using the `readable.setEncoding()` method or the stream is operating in object mode. The optional `size` argument specifies a specific number of bytes to read. If `size` bytes are not available to be read, `null` will be returned \_unless\_ the stream has ended, in which case all of the data remaining in the internal buffer will be returned. If the `size` argument is not specified, all of the data contained in the internal buffer will be returned. The `size` argument must be less than or equal to 1 GiB. The `readable.read()` method should only be called on `Readable` streams operating in paused mode. In flowing mode, `readable.read()` is called automatically until the internal buffer is fully drained. ```js const readable = getReadableStreamSomehow(); // 'readable' may be triggered multiple times as data is buffered in readable.on('readable', () => { let chunk; console.log('Stream is readable (new data received in buffer)'); // Use a loop to make sure we read all currently available data while (null !== (chunk = readable.read())) { console.log(`Read ${chunk.length} bytes of data...`); } }); // 'end' will be triggered once when there is no more data available readable.on('end', () => { console.log('Reached end of stream.'); }); ``` Each call to `readable.read()` returns a chunk of data or `null`, signifying that there's no more data to read at that moment. These chunks aren't automatically concatenated. Because a single `read()` call does not return all the data, using a while loop may be necessary to continuously read chunks until all data is retrieved. When reading a large file, `.read()` might return `null` temporarily, indicating that it has consumed all buffered content but there may be more data yet to be buffered. In such cases, a new `'readable'` event is emitted once there's more data in the buffer, and the `'end'` event signifies the end of data transmission. Therefore to read a file's whole | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.02536769211292267,
-0.021636174991726875,
-0.04837340489029884,
0.05023388937115669,
0.006174146663397551,
-0.0770842656493187,
-0.0322599820792675,
0.06673094630241394,
0.000050538015784695745,
-0.006667217239737511,
-0.04960312694311142,
0.09203777462244034,
-0.0012420850107446313,
0.029073160141706467,
-0.05102032795548439,
-0.06403642892837524,
-0.03510283678770065,
0.05413350462913513,
-0.051310691982507706,
-0.0543404147028923,
0.05610939487814903,
-0.010629341937601566,
0.02656610496342182,
-0.007143677677959204,
0.046575065702199936,
0.010963351465761662,
-0.08539000898599625,
-0.03629438206553459,
0.0242927148938179,
-0.024235432967543602,
0.01237694825977087,
-0.040072306990623474,
-0.10698703676462173,
0.017528200522065163,
-0.08078911900520325,
0.09622805565595627,
0.041509490460157394,
-0.09140519797801971,
-0.05655469372868538,
-0.03453538194298744,
0.11009223759174347,
0.09248360991477966,
-0.08451135456562042,
-0.011778600513935089,
-0.05624832212924957,
0.012682678177952766,
-0.012445845641195774,
-0.019261615350842476,
-0.06398716568946838,
0.04267815873026848,
-0.09628117084503174,
-0.005541671998798847,
-0.06791681796312332,
0.0780046358704567,
-0.003947898279875517,
0.01986340433359146,
-0.037022028118371964,
-0.031367335468530655,
-0.031078191474080086,
0.005884090904146433,
-0.0510077141225338,
-0.046185266226530075,
0.026008060202002525,
0.03162287548184395,
0.09092286974191666,
0.002450296189635992,
0.016708945855498314,
0.09745761752128601,
0.04042455554008484,
0.005205155815929174,
0.011403771117329597,
0.09102597087621689,
-0.08260193467140198,
0.006671539973467588,
-0.03468559309840202,
-0.08109746128320694,
-0.031072773039340973,
0.06669775396585464,
-0.07606270164251328,
0.02206961065530777,
-0.047634199261665344,
-0.04623069241642952,
0.05584194138646126,
-0.02388034574687481,
-0.042370762676000595,
0.07310346513986588,
-0.017147965729236603,
0.03630998358130455,
-0.011959812603890896,
0.009056292474269867,
-0.09384521842002869,
0.029712939634919167,
0.055442556738853455,
0.05511437729001045,
-0.02044624462723732,
0.042507171630859375,
0.07749759405851364,
0.053321994841098785,
0.018983442336320877,
-0.008711383678019047,
0.05539301782846451,
0.10326896607875824,
0.0761442631483078,
0.019458208233118057,
0.03065936267375946,
-0.07623771578073502,
0.018208008259534836,
0.006965528707951307,
-0.1098920926451683,
-0.018618876114487648,
-0.028093937784433365,
0.05211840197443962,
0.06694348901510239,
-0.04388409107923508,
-0.056728970259428024,
0.004071137867867947,
-0.07826253771781921,
-0.02968854084610939,
0.014244183897972107,
0.11719828844070435,
0.029474791139364243,
-0.02691975235939026,
-0.005040740594267845,
0.040932681411504745,
0.07995938509702682,
-0.046894319355487823,
0.0362282358109951,
4.444165778214898e-33,
-0.02422007918357849,
-0.023169584572315216,
0.010896330699324608,
0.037956856191158295,
0.012806695885956287,
0.026331782341003418,
0.02872462011873722,
0.001462920568883419,
-0.11043129116296768,
-0.045561257749795914,
-0.009161756373941898,
0.015346179716289043,
0.0020164954476058483,
0.03235728293657303,
-0.014513742178678513,
-0.06767942011356354,
0.02728196606040001,
0.010330510325729847,
0.05944014713168144,
0.054981403052806854,
0.07044908404350281,
0.02863371931016445,
-0.06730266660451889,
-0.057754505425691605,
-0.003568139160051942,
-0.06175608932971954,
0.001867637038230896,
0.018276190385222435,
-0.030574055388569832,
-0.00260647339746356,
0.014473050832748413,
-0.02036152221262455,
-0.014153341762721539,
-0.019179677590727806,
0.04941674321889877,
-0.03563109040260315,
-0.0009320792742073536,
-0.03970959782600403,
-0.0603683739900589,
-0.048054296523332596,
0.0703892633318901,
-0.004522447474300861,
-0.04985133558511734,
0.022952741011977196,
-0.08392906188964844,
0.017240900546312332,
-0.10412134975194931,
0.001417855848558247,
-0.034981440752744675,
-0.0327015295624733,
0.05980689451098442,
0.07678430527448654,
0.0029927461873739958,
0.00769921625033021,
0.05050394684076309,
-0.019248131662607193,
-0.03873253986239433,
-0.05203616991639137,
-0.028788220137357712,
0.10759740322828293,
-0.011032509617507458,
0.07858552783727646,
-0.012762127444148064,
0.06195061281323433,
0.07439083606004715,
0.05632183700799942,
0.0070412131026387215,
0.017257189378142357,
0.10837312042713165,
-0.06045367941260338,
-0.08148252218961716,
0.0013069423148408532,
-0.0018286490812897682,
0.017181413248181343,
0.024625316262245178,
0.013220480643212795,
-0.01714252308011055,
-0.10932113230228424,
0.014851479791104794,
-0.03229016065597534,
-0.0664837509393692,
-0.038099050521850586,
0.023234514519572258,
0.0663427859544754,
0.037598345428705215,
-0.01861478015780449,
-0.06601309776306152,
-0.08339182287454605,
-0.036101147532463074,
-0.01655000075697899,
0.020231617614626884,
0.008254900574684143,
0.08418657630681992,
-0.1208760216832161,
0.008220436051487923,
-4.37485495787057e-33,
0.031755901873111725,
-0.025654952973127365,
-0.04822887107729912,
0.12397009134292603,
0.015552242286503315,
0.008310694247484207,
-0.036639101803302765,
-0.006056345999240875,
0.06254670023918152,
0.012497158721089363,
-0.1237657442688942,
0.017085377126932144,
0.003944792319089174,
-0.03547417372465134,
-0.013855967670679092,
-0.01624509133398533,
-0.002608533250167966,
-0.11121371388435364,
0.02752094715833664,
-0.06762412935495377,
-0.04256854206323624,
-0.017383920028805733,
0.1459767073392868,
0.05436958000063896,
-0.012350617907941341,
0.0631643757224083,
-0.07603482902050018,
0.017303291708230972,
-0.05545821785926819,
-0.045569226145744324,
-0.011957681737840176,
-0.021032944321632385,
-0.032289355993270874,
-0.10118453204631805,
-0.006401779130101204,
-0.03452077507972717,
0.016131635755300522,
0.14606188237667084,
0.025366177782416344,
0.012640681117773056,
0.06029883027076721,
0.03289257362484932,
-0.006123069673776627,
-0.07365995645523071,
0.04334492236375809,
0.016428766772150993,
-0.044328901916742325,
-0.00879268441349268,
-0.0028163986280560493,
0.04371385648846626,
-0.029830049723386765,
-0.004289455711841583,
-0.028245601803064346,
0.029939627274870872,
0.11864162236452103,
-0.044247984886169434,
0.06954143941402435,
-0.028406474739313126,
0.025306357070803642,
-0.0324254110455513,
0.026893945410847664,
-0.0673559159040451,
0.010254793800413609,
-0.00953944493085146,
0.06018581613898277,
-0.06106540560722351,
0.030626505613327026,
-0.06110745668411255,
0.033115774393081665,
0.027075225487351418,
0.03722574934363365,
-0.030335551127791405,
0.009789529256522655,
0.028468849137425423,
0.07578260451555252,
0.010647592134773731,
0.02375579997897148,
-0.029723750427365303,
-0.04769004508852959,
0.04098598286509514,
-0.012092527002096176,
0.13032150268554688,
-0.043778084218502045,
0.07505475729703903,
0.08277855813503265,
-0.050529345870018005,
0.022696951404213905,
-0.07038542628288269,
0.029872843995690346,
-0.004434133879840374,
0.0003529434325173497,
0.04847140237689018,
-0.06329116970300674,
-0.06110236421227455,
-0.07650630921125412,
-4.4012647748559175e-8,
-0.03374315798282623,
-0.06285016238689423,
-0.14274771511554718,
0.052069272845983505,
-0.007994216866791248,
-0.048482149839401245,
-0.03288092836737633,
0.035611480474472046,
0.048106953501701355,
-0.028742020949721336,
0.07842344045639038,
-0.009098793379962444,
-0.001549858832731843,
-0.04799489304423332,
-0.008786075748503208,
-0.012192129157483578,
0.040614668279886246,
-0.06705038249492645,
-0.04051067680120468,
-0.010032952763140202,
0.03434713929891586,
0.03584463894367218,
-0.06704025715589523,
0.0994335263967514,
0.018969649448990822,
-0.033438488841056824,
0.1054287776350975,
-0.0002754382439889014,
0.01408432237803936,
0.001400053733959794,
-0.040287524461746216,
-0.004291834309697151,
0.07920625805854797,
0.10828088223934174,
0.024177396669983864,
-0.05443519353866577,
-0.03221685439348221,
0.02380378358066082,
-0.046686504036188126,
0.02142307162284851,
0.09337998926639557,
0.030981963500380516,
0.02280891127884388,
0.04585641250014305,
0.006352464202791452,
-0.07110777497291565,
-0.00842279102653265,
-0.009925608523190022,
0.04818069562315941,
0.03825688734650612,
-0.005094870924949646,
0.06610044091939926,
0.01966969110071659,
0.04040152207016945,
0.015580195933580399,
-0.028128715232014656,
0.02392594888806343,
-0.05155690759420395,
-0.0036522129084914923,
0.004005915019661188,
0.04158433526754379,
0.023460406810045242,
0.04719648137688637,
0.00749334879219532
] | 0.087336 |
indicating that it has consumed all buffered content but there may be more data yet to be buffered. In such cases, a new `'readable'` event is emitted once there's more data in the buffer, and the `'end'` event signifies the end of data transmission. Therefore to read a file's whole contents from a `readable`, it is necessary to collect chunks across multiple `'readable'` events: ```js const chunks = []; readable.on('readable', () => { let chunk; while (null !== (chunk = readable.read())) { chunks.push(chunk); } }); readable.on('end', () => { const content = chunks.join(''); }); ``` A `Readable` stream in object mode will always return a single item from a call to [`readable.read(size)`][stream-read], regardless of the value of the `size` argument. If the `readable.read()` method returns a chunk of data, a `'data'` event will also be emitted. Calling [`stream.read([size])`][stream-read] after the [`'end'`][] event has been emitted will return `null`. No runtime error will be raised. ##### `readable.readable` \* Type: {boolean} Is `true` if it is safe to call [`readable.read()`][stream-read], which means the stream has not been destroyed or emitted `'error'` or `'end'`. ##### `readable.readableAborted` \* Type: {boolean} Returns whether the stream was destroyed or errored before emitting `'end'`. ##### `readable.readableDidRead` \* Type: {boolean} Returns whether `'data'` has been emitted. ##### `readable.readableEncoding` \* Type: {null|string} Getter for the property `encoding` of a given `Readable` stream. The `encoding` property can be set using the [`readable.setEncoding()`][] method. ##### `readable.readableEnded` \* Type: {boolean} Becomes `true` when [`'end'`][] event is emitted. ##### `readable.errored` \* Type: {Error} Returns error if the stream has been destroyed with an error. ##### `readable.readableFlowing` \* Type: {boolean} This property reflects the current state of a `Readable` stream as described in the [Three states][] section. ##### `readable.readableHighWaterMark` \* Type: {number} Returns the value of `highWaterMark` passed when creating this `Readable`. ##### `readable.readableLength` \* Type: {number} This property contains the number of bytes (or objects) in the queue ready to be read. The value provides introspection data regarding the status of the `highWaterMark`. ##### `readable.readableObjectMode` \* Type: {boolean} Getter for the property `objectMode` of a given `Readable` stream. ##### `readable.resume()` \* Returns: {this} The `readable.resume()` method causes an explicitly paused `Readable` stream to resume emitting [`'data'`][] events, switching the stream into flowing mode. The `readable.resume()` method can be used to fully consume the data from a stream without actually processing any of that data: ```js getReadableStreamSomehow() .resume() .on('end', () => { console.log('Reached the end, but did not read anything.'); }); ``` The `readable.resume()` method has no effect if there is a `'readable'` event listener. ##### `readable.setEncoding(encoding)` \* `encoding` {string} The encoding to use. \* Returns: {this} The `readable.setEncoding()` method sets the character encoding for data read from the `Readable` stream. By default, no encoding is assigned and stream data will be returned as `Buffer` objects. Setting an encoding causes the stream data to be returned as strings of the specified encoding rather than as `Buffer` objects. For instance, calling `readable.setEncoding('utf8')` will cause the output data to be interpreted as UTF-8 data, and passed as strings. Calling `readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal string format. The `Readable` stream will properly handle multi-byte characters delivered through the stream that would otherwise become improperly decoded if simply pulled from the stream as `Buffer` objects. ```js const readable = getReadableStreamSomehow(); readable.setEncoding('utf8'); readable.on('data', (chunk) => { assert.equal(typeof chunk, 'string'); console.log('Got %d characters of string data:', chunk.length); }); ``` ##### `readable.unpipe([destination])` \* `destination` {stream.Writable} Optional specific stream to unpipe \* Returns: {this} The `readable.unpipe()` method detaches a `Writable` stream previously attached using the [`stream.pipe()`][] method. If the `destination` is not specified, then \_all\_ pipes are | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
0.012947994284331799,
0.019887864589691162,
0.02151154913008213,
0.020354866981506348,
0.04548272117972374,
-0.055184002965688705,
0.04397020861506462,
0.05517124384641647,
0.04664243012666702,
-0.023084495216608047,
-0.08129949122667313,
0.1216946393251419,
-0.1151595339179039,
-0.004713833332061768,
-0.042470190674066544,
-0.08101771026849747,
0.007089513354003429,
0.042716965079307556,
-0.04528893157839775,
-0.07557065784931183,
0.06434625387191772,
-0.03312419727444649,
0.003942772280424833,
-0.035379983484745026,
-0.0173706766217947,
0.10967845469713211,
-0.056426752358675,
-0.08878468722105026,
0.028703730553388596,
-0.03297460079193115,
0.0508660264313221,
-0.060934845358133316,
-0.03755950182676315,
-0.02200046181678772,
-0.04197040945291519,
0.03101736679673195,
0.00008974400407169014,
-0.10644081234931946,
-0.015406455844640732,
-0.018158871680498123,
0.08178753405809402,
0.09770791977643967,
-0.10853726416826248,
0.015814417973160744,
0.018695320934057236,
-0.013918834738433361,
-0.05706046149134636,
-0.04325603321194649,
-0.023490875959396362,
0.03159720450639725,
-0.06788669526576996,
0.022066768258810043,
-0.049587562680244446,
0.07250183820724487,
0.06027961149811745,
-0.019624151289463043,
0.0037202120292931795,
-0.029845619574189186,
-0.047148704528808594,
-0.024278633296489716,
-0.06969033181667328,
-0.020017383620142937,
0.04524870216846466,
0.007823500782251358,
0.08246670663356781,
-0.014146734029054642,
0.02897840552031994,
0.1123475506901741,
-0.00357834342867136,
0.027361081913113594,
0.047816671431064606,
0.09673609584569931,
0.005340940784662962,
0.03179972991347313,
-0.015365018509328365,
-0.08474556356668472,
-0.007003418635576963,
0.043847959488630295,
-0.029716340824961662,
0.01988215185701847,
-0.0578586682677269,
-0.07601302117109299,
0.07137447595596313,
-0.04242637753486633,
-0.04129944369196892,
0.03968692570924759,
-0.012178230099380016,
0.021037178114056587,
-0.04350113868713379,
0.03940937668085098,
-0.09949711710214615,
0.01881944201886654,
0.001012779655866325,
0.1184733510017395,
-0.013021457940340042,
0.0567021407186985,
0.07558617740869522,
-0.00018823734717443585,
0.038169119507074356,
-0.01486748643219471,
-0.0007715877145528793,
0.10107734799385071,
0.06181212142109871,
0.03961433470249176,
-0.022816073149442673,
-0.08458025008440018,
-0.045545998960733414,
0.018265241757035255,
-0.053729474544525146,
0.022298268973827362,
0.06862001121044159,
-0.015866070985794067,
0.025270158424973488,
0.015807051211595535,
-0.014200344681739807,
-0.01989310421049595,
-0.030180083587765694,
0.0300954170525074,
0.02217969112098217,
0.13299503922462463,
0.08509347587823868,
-0.010030336678028107,
-0.06948717683553696,
0.022085443139076233,
0.0800013318657875,
-0.046773526817560196,
0.1392388641834259,
4.533136466070241e-34,
-0.0702304095029831,
-0.07125959545373917,
-0.0015384737635031343,
0.0634617730975151,
-0.03616977855563164,
0.011501203291118145,
0.011037020944058895,
-0.0035892559681087732,
-0.09422345459461212,
-0.005546728149056435,
-0.03137572854757309,
0.009348556399345398,
-0.004246281925588846,
0.020997600629925728,
0.040687259286642075,
0.012319465167820454,
0.02312975749373436,
-0.021541401743888855,
0.01833471469581127,
0.050797175616025925,
-0.01645071804523468,
-0.02384435012936592,
-0.03681621327996254,
0.022625265643000603,
-0.025686392560601234,
-0.05799208581447601,
-0.028475355356931686,
0.023710019886493683,
-0.08305248618125916,
-0.0018110853852704167,
0.015479261986911297,
0.018428325653076172,
0.020010218024253845,
-0.01657438464462757,
0.06127214804291725,
-0.07303857803344727,
0.020709780976176262,
0.005443011410534382,
-0.14027263224124908,
-0.05317224562168121,
0.06364122778177261,
-0.010814337059855461,
-0.00011151970829814672,
-0.030953826382756233,
-0.10464463382959366,
-0.048565056174993515,
-0.07653801888227463,
-0.02839161641895771,
-0.0654003918170929,
0.03113815188407898,
0.030961256474256516,
0.05114103853702545,
0.05130931735038757,
0.006912573706358671,
0.030440853908658028,
-0.021062009036540985,
0.04781150072813034,
-0.006580210290849209,
-0.003954532090574503,
0.051456745713949203,
0.06666841357946396,
0.03423145413398743,
0.07099469006061554,
0.053410258144140244,
-0.003240145742893219,
0.0881553441286087,
-0.01867000386118889,
-0.007368257734924555,
0.05670235678553581,
-0.09049207717180252,
-0.07355865836143494,
-0.019829589873552322,
0.04031193628907204,
-0.006694089155644178,
-0.03203839808702469,
-0.026427587494254112,
-0.04404180124402046,
-0.0504392571747303,
0.02009623870253563,
-0.060789477080106735,
0.034177154302597046,
-0.033025212585926056,
0.06505443900823593,
0.027716638520359993,
-0.08480134606361389,
0.046673066914081573,
-0.05207071825861931,
-0.08761803805828094,
-0.016040539368987083,
0.006169070489704609,
-0.007779159117490053,
-0.007471498567610979,
0.056116919964551926,
-0.12196622043848038,
-0.01808219775557518,
-2.7631667958817866e-33,
0.04813278093934059,
-0.01990937441587448,
-0.05757182464003563,
0.05105412006378174,
-0.028801996260881424,
0.036726392805576324,
-0.07203076034784317,
0.12831240892410278,
0.04364652559161186,
-0.0016070405254140496,
-0.026995990425348282,
0.07384912669658661,
-0.032907307147979736,
-0.027382517233490944,
-0.07084234803915024,
0.04072315990924835,
0.013391992077231407,
-0.10804689675569534,
0.03402717038989067,
-0.04643765836954117,
0.008925657719373703,
-0.12615463137626648,
0.12287643551826477,
0.03156081587076187,
-0.0034225271083414555,
0.05947292596101761,
-0.0394415520131588,
-0.057453788816928864,
-0.0105314701795578,
-0.07433713972568512,
-0.047373149544000626,
-0.05700376629829407,
-0.021208027377724648,
-0.04295724630355835,
-0.0002484639408066869,
-0.07352479547262192,
0.04093480482697487,
0.08477691560983658,
-0.006999117322266102,
0.024839065968990326,
0.04485487565398216,
0.045678116381168365,
-0.003325598780065775,
-0.03808378055691719,
0.002716796239838004,
-0.04161383584141731,
-0.0004497295885812491,
0.06005193665623665,
0.005794710945338011,
-0.01662849448621273,
0.031484730541706085,
0.0015926796477288008,
0.0037739581894129515,
0.093901626765728,
0.04246918857097626,
0.03094976581633091,
0.013177530840039253,
-0.029629113152623177,
0.001232416951097548,
-0.004730382934212685,
0.002760958159342408,
-0.06548444926738739,
-0.08816201984882355,
0.008865921758115292,
0.06581147760152817,
-0.0349288173019886,
0.0016525149112567306,
-0.09516549110412598,
0.08824194967746735,
0.01233525201678276,
0.0006603715592063963,
0.012126555666327477,
-0.018518639728426933,
-0.01635596714913845,
0.06564196944236755,
0.04369732365012169,
-0.07631804049015045,
-0.11513262242078781,
-0.000107678679341916,
0.07265826314687729,
-0.01723073609173298,
0.06352157890796661,
-0.02184382826089859,
0.06679193675518036,
0.13082201778888702,
0.042207300662994385,
-0.08598341792821884,
-0.05549309775233269,
0.006541498936712742,
0.01727730594575405,
-0.005009256768971682,
0.017334194853901863,
-0.07344973087310791,
-0.024259138852357864,
-0.02970082499086857,
-4.8764103866005826e-8,
-0.013406477868556976,
-0.06407196074724197,
-0.10710141062736511,
0.024639207869768143,
0.03875896707177162,
-0.07128646969795227,
-0.020820720121264458,
0.001955378334969282,
0.039505891501903534,
0.029158035293221474,
0.04489186778664589,
-0.01982239820063114,
-0.024494493380188942,
-0.050416894257068634,
0.028840115293860435,
0.017082199454307556,
0.09042438864707947,
-0.04776018112897873,
-0.06556587666273117,
-0.0024284571409225464,
0.04219252988696098,
-0.02144814282655716,
-0.06072831526398659,
0.04456794261932373,
0.047180477529764175,
0.02911723218858242,
0.030034231022000313,
0.027961941435933113,
0.015416067093610764,
-0.06560641527175903,
-0.017610697075724602,
-0.0003917027497664094,
0.05197640135884285,
0.06138698384165764,
-0.015450992621481419,
-0.016167625784873962,
0.019221948459744453,
0.009508393704891205,
0.015377091243863106,
0.018093399703502655,
0.10096617788076401,
-0.04091888293623924,
0.016284432262182236,
0.06457137316465378,
-0.023238983005285263,
-0.04115033894777298,
-0.01713172346353531,
0.02381407842040062,
-0.005027239676564932,
0.03278230503201485,
0.004711939487606287,
-0.01836628094315529,
-0.07265157997608185,
0.01731833815574646,
-0.049680743366479874,
-0.08245188742876053,
0.07738194614648819,
0.0045681181363761425,
-0.02466733381152153,
-0.032620128244161606,
0.09128428995609283,
0.022631727159023285,
-0.03184487670660019,
0.00501973507925868
] | 0.076951 |
=> { assert.equal(typeof chunk, 'string'); console.log('Got %d characters of string data:', chunk.length); }); ``` ##### `readable.unpipe([destination])` \* `destination` {stream.Writable} Optional specific stream to unpipe \* Returns: {this} The `readable.unpipe()` method detaches a `Writable` stream previously attached using the [`stream.pipe()`][] method. If the `destination` is not specified, then \_all\_ pipes are detached. If the `destination` is specified, but no pipe is set up for it, then the method does nothing. ```js const fs = require('node:fs'); const readable = getReadableStreamSomehow(); const writable = fs.createWriteStream('file.txt'); // All the data from readable goes into 'file.txt', // but only for the first second. readable.pipe(writable); setTimeout(() => { console.log('Stop writing to file.txt.'); readable.unpipe(writable); console.log('Manually close the file stream.'); writable.end(); }, 1000); ``` ##### `readable.unshift(chunk[, encoding])` \* `chunk` {Buffer|TypedArray|DataView|string|null|any} Chunk of data to unshift onto the read queue. For streams not operating in object mode, `chunk` must be a {string}, {Buffer}, {TypedArray}, {DataView} or `null`. For object mode streams, `chunk` may be any JavaScript value. \* `encoding` {string} Encoding of string chunks. Must be a valid `Buffer` encoding, such as `'utf8'` or `'ascii'`. Passing `chunk` as `null` signals the end of the stream (EOF) and behaves the same as `readable.push(null)`, after which no more data can be written. The EOF signal is put at the end of the buffer and any buffered data will still be flushed. The `readable.unshift()` method pushes a chunk of data back into the internal buffer. This is useful in certain situations where a stream is being consumed by code that needs to "un-consume" some amount of data that it has optimistically pulled out of the source, so that the data can be passed on to some other party. The `stream.unshift(chunk)` method cannot be called after the [`'end'`][] event has been emitted or a runtime error will be thrown. Developers using `stream.unshift()` often should consider switching to use of a [`Transform`][] stream instead. See the [API for stream implementers][] section for more information. ```js // Pull off a header delimited by \n\n. // Use unshift() if we get too much. // Call the callback with (error, header, stream). const { StringDecoder } = require('node:string\_decoder'); function parseHeader(stream, callback) { stream.on('error', callback); stream.on('readable', onReadable); const decoder = new StringDecoder('utf8'); let header = ''; function onReadable() { let chunk; while (null !== (chunk = stream.read())) { const str = decoder.write(chunk); if (str.includes('\n\n')) { // Found the header boundary. const split = str.split(/\n\n/); header += split.shift(); const remaining = split.join('\n\n'); const buf = Buffer.from(remaining, 'utf8'); stream.removeListener('error', callback); // Remove the 'readable' listener before unshifting. stream.removeListener('readable', onReadable); if (buf.length) stream.unshift(buf); // Now the body of the message can be read from the stream. callback(null, header, stream); return; } // Still reading the header. header += str; } } } ``` Unlike [`stream.push(chunk)`][stream-push], `stream.unshift(chunk)` will not end the reading process by resetting the internal reading state of the stream. This can cause unexpected results if `readable.unshift()` is called during a read (i.e. from within a [`stream.\_read()`][stream-\_read] implementation on a custom stream). Following the call to `readable.unshift()` with an immediate [`stream.push('')`][stream-push] will reset the reading state appropriately, however it is best to simply avoid calling `readable.unshift()` while in the process of performing a read. ##### `readable.wrap(stream)` \* `stream` {Stream} An "old style" readable stream \* Returns: {this} Prior to Node.js 0.10, streams did not implement the entire `node:stream` module API as it is currently defined. (See [Compatibility][] for more information.) When using an older Node.js library that emits [`'data'`][] events and has a [`stream.pause()`][stream-pause] method that is advisory only, the `readable.wrap()` method can be used to create a [`Readable`][] stream that uses the old stream as its data source. It | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.043954867869615555,
0.0373612716794014,
0.031404048204422,
0.03123212605714798,
0.02527575008571148,
-0.07821781933307648,
0.001392063102684915,
0.07858947664499283,
0.0002222232724307105,
-0.012511848472058773,
-0.021335411816835403,
0.07668717950582504,
-0.050007082521915436,
0.0017626093467697501,
-0.07297443598508835,
-0.07709717750549316,
-0.09131940454244614,
0.035841602832078934,
-0.02462422102689743,
-0.09562987834215164,
0.0621519461274147,
-0.0024493890814483166,
-0.006942816078662872,
0.017013777047395706,
0.05674209073185921,
0.06490872800350189,
-0.07757142186164856,
-0.07061833888292313,
0.018270224332809448,
-0.03313060104846954,
0.021905522793531418,
-0.05214661732316017,
-0.10749242454767227,
-0.011891276575624943,
-0.039911847561597824,
0.10851377248764038,
0.018928801640868187,
-0.06685355305671692,
-0.062114279717206955,
-0.013890907168388367,
0.05791333317756653,
0.03307564556598663,
-0.0852309986948967,
-0.03854159265756607,
-0.0009700469672679901,
-0.01798202283680439,
-0.0417802594602108,
0.021542342379689217,
-0.0478859506547451,
0.035339683294296265,
-0.054931722581386566,
0.0074966042302548885,
-0.06238875538110733,
0.07566642016172409,
0.005743497982621193,
-0.031094500795006752,
0.01396504882723093,
-0.00420580105856061,
-0.014063078910112381,
-0.02906610816717148,
-0.03573398292064667,
-0.03759343922138214,
0.010418863035738468,
0.01837877370417118,
0.09468632191419601,
-0.010606389492750168,
0.00971304066479206,
0.10752113163471222,
0.019665181636810303,
0.05135415494441986,
0.0014145117020234466,
0.09115450084209442,
-0.0882439985871315,
0.03302482143044472,
0.0010809899540618062,
-0.04169801250100136,
0.0020255183335393667,
0.06938118487596512,
-0.03217978775501251,
0.05239538475871086,
-0.06215281039476395,
-0.09357921779155731,
0.03645440191030502,
-0.022480960935354233,
-0.0898502841591835,
0.1034260243177414,
-0.05771447345614433,
0.043824560940265656,
-0.017888745293021202,
0.003125343006104231,
-0.12465443462133408,
-0.004735001362860203,
0.02296486869454384,
0.06143651902675629,
0.023082908242940903,
0.009195469319820404,
-0.004395941272377968,
0.09229794889688492,
0.04133694991469383,
0.009976825676858425,
0.00005552109359996393,
0.09790568053722382,
0.04857509210705757,
-0.03490865230560303,
0.03447846695780754,
-0.08169347792863846,
0.06120328605175018,
-0.09521607309579849,
-0.028332475572824478,
-0.03712451457977295,
0.028761476278305054,
0.004255537409335375,
0.05016770586371422,
0.023226287215948105,
0.010095873847603798,
-0.017017345875501633,
-0.009445122443139553,
0.010027886368334293,
-0.019713440909981728,
0.13810311257839203,
0.022143585607409477,
-0.03345532342791557,
-0.0009913052199408412,
0.04727758467197418,
0.0027991810347884893,
-0.01985854096710682,
0.08866891264915466,
1.5479486338543754e-33,
-0.06198564171791077,
-0.0718407928943634,
0.01586350053548813,
0.058711547404527664,
0.005850567482411861,
0.0017203306779265404,
0.023051142692565918,
0.033518850803375244,
-0.08641263842582703,
0.01220876444131136,
-0.031238039955496788,
-0.017899584025144577,
0.0137751130387187,
-0.012278472073376179,
-0.022938137874007225,
-0.05293861776590347,
0.09797585010528564,
-0.03879520669579506,
0.031172357499599457,
0.022079719230532646,
0.08024536073207855,
-0.015796242281794548,
-0.030918579548597336,
-0.062298212200403214,
-0.03792950510978699,
-0.12694793939590454,
-0.004407805856317282,
0.03347112238407135,
-0.03315799683332443,
-0.022694576531648636,
0.01961003802716732,
-0.022213151678442955,
0.014255627989768982,
0.06289370357990265,
0.05445726960897446,
-0.0843932256102562,
0.07976046204566956,
-0.005197220481932163,
-0.08939285576343536,
-0.011051885783672333,
0.021973850205540657,
-0.013928941451013088,
-0.01791687123477459,
0.02646796591579914,
-0.0013609756715595722,
-0.1000637635588646,
-0.11736638844013214,
-0.02646818943321705,
0.006060929037630558,
0.036876559257507324,
0.08889386057853699,
0.11888255178928375,
0.07843539863824844,
-0.015822909772396088,
0.039690203964710236,
-0.037945766001939774,
-0.0015807393938302994,
-0.05072394758462906,
-0.03058064915239811,
0.0952957272529602,
0.005772794596850872,
0.091001957654953,
-0.0017840082291513681,
0.03228401392698288,
0.02024967037141323,
0.07570761442184448,
0.0013035384472459555,
0.0112865399569273,
0.04905053600668907,
-0.04746504873037338,
-0.0913519486784935,
-0.06037617474794388,
-0.009648045524954796,
0.021885668858885765,
-0.025008970871567726,
0.005870707333087921,
-0.015624038875102997,
-0.04419567063450813,
0.022128690034151077,
-0.054873622953891754,
-0.020135218277573586,
-0.03645254671573639,
-0.00868395809084177,
0.03508370369672775,
-0.0065091014839708805,
0.003619350027292967,
-0.07919641584157944,
-0.12918536365032196,
0.07653950899839401,
-0.010857920162379742,
-0.018067386001348495,
0.04505447298288345,
-0.03539084643125534,
-0.07711511850357056,
0.08852586895227432,
-3.708932265341959e-33,
0.09351614862680435,
0.051282867789268494,
-0.0618794783949852,
0.07516322284936905,
0.043800774961709976,
0.016078799962997437,
0.04573077708482742,
0.02465793304145336,
0.07834099978208542,
0.014951718039810658,
-0.09002246707677841,
0.038326460868120193,
-0.015644628554582596,
-0.002626570174470544,
0.019353710114955902,
-0.016204867511987686,
-0.021522898226976395,
-0.10785017907619476,
0.021121930330991745,
-0.028988461941480637,
-0.013372744433581829,
-0.04202676936984062,
0.11685285717248917,
0.025931814685463905,
-0.05727049335837364,
0.06700794398784637,
-0.03678033500909805,
-0.01541157066822052,
-0.05900808423757553,
-0.03927074000239372,
-0.010965099558234215,
-0.004324061796069145,
-0.0227798018604517,
-0.07238300889730453,
-0.014433654025197029,
-0.05867800489068031,
-0.009596218355000019,
0.18036991357803345,
0.07197853177785873,
0.02868080511689186,
0.03933395445346832,
0.05860282480716705,
0.02039325051009655,
-0.03554791212081909,
0.03969189152121544,
0.04175659641623497,
0.049639295786619186,
-0.017844166606664658,
0.00518965907394886,
0.004264298360794783,
0.03771369904279709,
-0.021094830706715584,
-0.012201441451907158,
0.10777779668569565,
0.06590164452791214,
-0.013048614375293255,
0.03656599298119545,
-0.04905558004975319,
-0.035755641758441925,
0.008969328366219997,
0.023197153583168983,
-0.04948672652244568,
-0.032978348433971405,
0.014732850715517998,
0.04238331690430641,
-0.0988365188241005,
-0.007994221523404121,
-0.03660319373011589,
0.07531062513589859,
-0.009366177022457123,
-0.013686971738934517,
-0.011881732381880283,
-0.006828949321061373,
-0.005582722835242748,
0.05708007514476776,
0.05008761212229729,
-0.03379708155989647,
-0.06652477383613586,
-0.002283115405589342,
0.08433976769447327,
0.016248177736997604,
0.09116338193416595,
-0.08577444404363632,
0.05069957301020622,
0.10828810930252075,
-0.02351377345621586,
-0.017121760174632072,
-0.06681980192661285,
-0.016990160569548607,
0.02046746201813221,
0.041883282363414764,
0.03236664831638336,
-0.09043547511100769,
-0.0754791796207428,
-0.024786759167909622,
-4.5021540273637584e-8,
-0.029026105999946594,
-0.08373463153839111,
-0.11289370805025101,
0.056132517755031586,
-0.0045464723370969296,
-0.07277568429708481,
-0.046267591416835785,
-0.048107970505952835,
0.05002826824784279,
-0.027522161602973938,
0.007969846948981285,
0.0020752460695803165,
0.00379757909104228,
-0.05202620103955269,
-0.0036951391957700253,
-0.0698399469256401,
0.061769962310791016,
-0.048234738409519196,
-0.036424119025468826,
-0.01679069735109806,
0.010069926269352436,
-0.02773256227374077,
-0.05033920705318451,
0.07149526476860046,
-0.011716191656887531,
-0.034233808517456055,
0.059690602123737335,
0.010510782711207867,
-0.050036411732435226,
-0.012979351915419102,
-0.022056177258491516,
0.01320146955549717,
0.03962397947907448,
0.01820293441414833,
0.0016212943010032177,
0.012555902823805809,
0.024836819618940353,
0.03080977313220501,
0.005825798027217388,
0.04973513260483742,
0.05775802955031395,
0.06511400640010834,
-0.0013668130850419402,
0.011724482290446758,
-0.05279212072491646,
-0.04931198060512543,
-0.00015147052181418985,
0.026379648596048355,
-0.021208522841334343,
0.00450077373534441,
-0.020072419196367264,
0.02541004680097103,
-0.02285161428153515,
0.043765656650066376,
-0.0032405389938503504,
-0.059367913752794266,
0.060202889144420624,
-0.046012841165065765,
-0.05516691505908966,
0.01134797465056181,
0.1032402291893959,
0.035006046295166016,
0.04655132815241814,
-0.06161047890782356
] | 0.096339 |
as it is currently defined. (See [Compatibility][] for more information.) When using an older Node.js library that emits [`'data'`][] events and has a [`stream.pause()`][stream-pause] method that is advisory only, the `readable.wrap()` method can be used to create a [`Readable`][] stream that uses the old stream as its data source. It will rarely be necessary to use `readable.wrap()` but the method has been provided as a convenience for interacting with older Node.js applications and libraries. ```js const { OldReader } = require('./old-api-module.js'); const { Readable } = require('node:stream'); const oreader = new OldReader(); const myReader = new Readable().wrap(oreader); myReader.on('readable', () => { myReader.read(); // etc. }); ``` ##### `readable[Symbol.asyncIterator]()` \* Returns: {AsyncIterator} to fully consume the stream. ```js const fs = require('node:fs'); async function print(readable) { readable.setEncoding('utf8'); let data = ''; for await (const chunk of readable) { data += chunk; } console.log(data); } print(fs.createReadStream('file')).catch(console.error); ``` If the loop terminates with a `break`, `return`, or a `throw`, the stream will be destroyed. In other terms, iterating over a stream will consume the stream fully. The stream will be read in chunks of size equal to the `highWaterMark` option. In the code example above, data will be in a single chunk if the file has less then 64 KiB of data because no `highWaterMark` option is provided to [`fs.createReadStream()`][]. ##### `readable[Symbol.asyncDispose]()` Calls [`readable.destroy()`][readable-destroy] with an `AbortError` and returns a promise that fulfills when the stream is finished. ##### `readable.compose(stream[, options])` \* `stream` {Writable|Duplex|WritableStream|TransformStream|Function} \* `options` {Object} \* `signal` {AbortSignal} allows destroying the stream if the signal is aborted. \* Returns: {Duplex} a stream composed with the stream `stream`. ```mjs import { Readable } from 'node:stream'; async function\* splitToWords(source) { for await (const chunk of source) { const words = String(chunk).split(' '); for (const word of words) { yield word; } } } const wordsStream = Readable.from(['text passed through', 'composed stream']).compose(splitToWords); const words = await wordsStream.toArray(); console.log(words); // prints ['text', 'passed', 'through', 'composed', 'stream'] ``` `readable.compose(s)` is equivalent to `stream.compose(readable, s)`. This method also allows for an {AbortSignal} to be provided, which will destroy the composed stream when aborted. See [`stream.compose(...streams)`][] for more information. ##### `readable.iterator([options])` \* `options` {Object} \* `destroyOnReturn` {boolean} When set to `false`, calling `return` on the async iterator, or exiting a `for await...of` iteration using a `break`, `return`, or `throw` will not destroy the stream. \*\*Default:\*\* `true`. \* Returns: {AsyncIterator} to consume the stream. The iterator created by this method gives users the option to cancel the destruction of the stream if the `for await...of` loop is exited by `return`, `break`, or `throw`, or if the iterator should destroy the stream if the stream emitted an error during iteration. ```js const { Readable } = require('node:stream'); async function printIterator(readable) { for await (const chunk of readable.iterator({ destroyOnReturn: false })) { console.log(chunk); // 1 break; } console.log(readable.destroyed); // false for await (const chunk of readable.iterator({ destroyOnReturn: false })) { console.log(chunk); // Will print 2 and then 3 } console.log(readable.destroyed); // True, stream was totally consumed } async function printSymbolAsyncIterator(readable) { for await (const chunk of readable) { console.log(chunk); // 1 break; } console.log(readable.destroyed); // true } async function showBoth() { await printIterator(Readable.from([1, 2, 3])); await printSymbolAsyncIterator(Readable.from([1, 2, 3])); } showBoth(); ``` ##### `readable.map(fn[, options])` > Stability: 1 - Experimental \* `fn` {Function|AsyncFunction} a function to map over every chunk in the stream. \* `data` {any} a chunk of data from the stream. \* `options` {Object} \* `signal` {AbortSignal} aborted if the stream is destroyed allowing to abort the `fn` call early. \* `options` {Object} \* `concurrency` {number} the maximum concurrent invocation of `fn` to call on the stream at once. | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.05259402096271515,
-0.011336307972669601,
-0.026234352961182594,
0.05581866204738617,
0.12090146541595459,
0.01638123393058777,
-0.03612704947590828,
0.02805153839290142,
-0.0009569434332661331,
-0.02168925851583481,
-0.03647911548614502,
0.11253045499324799,
-0.09883321821689606,
-0.0031713375356048346,
-0.0003646956174634397,
-0.019468018785119057,
-0.01506081037223339,
0.044681988656520844,
-0.030325377359986305,
-0.0831528753042221,
0.014543107710778713,
-0.046282071620225906,
-0.016913099214434624,
0.013684878125786781,
-0.018593989312648773,
0.011505693197250366,
-0.04670856148004532,
-0.026277683675289154,
0.04360333830118179,
0.01024578046053648,
0.023854590952396393,
-0.06495573371648788,
-0.10866378247737885,
-0.022994784638285637,
-0.12393249571323395,
0.07797635346651077,
0.005579530261456966,
-0.052574507892131805,
-0.05732530727982521,
-0.022021301090717316,
0.12167389690876007,
0.08419840037822723,
-0.13819138705730438,
-0.046864744275808334,
-0.018841475248336792,
-0.02101360820233822,
-0.04329715296626091,
-0.06858297437429428,
-0.0641523227095604,
0.09440336376428604,
-0.019342632964253426,
-0.011855080723762512,
-0.03815236687660217,
0.0380147285759449,
0.013363536447286606,
-0.01116020604968071,
-0.01031503640115261,
0.03122788481414318,
0.015886450186371803,
0.03357549011707306,
-0.050176139920949936,
-0.0563734769821167,
0.019344571977853775,
0.04481932148337364,
-0.0015349307795986533,
-0.006510761100798845,
-0.005235960241407156,
0.08915252238512039,
0.08238749951124191,
-0.008057422935962677,
-0.055827170610427856,
0.0443974994122982,
-0.027000941336154938,
-0.004497354384511709,
-0.049077294766902924,
-0.10631414502859116,
0.007071099244058132,
0.011133845895528793,
-0.03920590505003929,
0.04370778799057007,
-0.06032433733344078,
-0.04917694628238678,
0.00939521100372076,
0.03858766704797745,
-0.04272637888789177,
0.16331878304481506,
-0.012020486406981945,
-0.024998463690280914,
0.02275681309401989,
0.017255550250411034,
-0.058072686195373535,
-0.01591268554329872,
-0.0029967951122671366,
0.0994209423661232,
-0.02034541219472885,
0.053793810307979584,
-0.003640019102022052,
0.021074023097753525,
-0.007229762617498636,
0.012841240502893925,
0.010997965931892395,
0.06760276108980179,
-0.024071063846349716,
0.05115830525755882,
0.02087438851594925,
-0.1501636505126953,
-0.04103481397032738,
0.03378571197390556,
-0.06393101066350937,
0.03582621365785599,
0.04633734002709389,
0.04800314083695412,
-0.01585148461163044,
-0.04292728751897812,
-0.06689281761646271,
0.02444653958082199,
-0.0082016009837389,
-0.019022591412067413,
0.06438258290290833,
0.15288208425045013,
0.10804149508476257,
0.017822489142417908,
0.006582776550203562,
0.015812959522008896,
0.10156407952308655,
-0.04479152336716652,
0.05317070707678795,
-1.4327658913436342e-33,
-0.038318295031785965,
-0.07414186000823975,
-0.047575078904628754,
0.07786543667316437,
0.005743321031332016,
-0.013506394810974598,
0.011529280804097652,
-0.009724360890686512,
-0.08487437665462494,
-0.058355510234832764,
0.0466967411339283,
0.02157062292098999,
-0.029116973280906677,
-0.04310675710439682,
0.0698498785495758,
-0.03159297630190849,
-0.01313056144863367,
0.02247435785830021,
0.05904414877295494,
0.0185378585010767,
0.003864063648506999,
-0.041196051985025406,
-0.02557455562055111,
0.009502943605184555,
-0.012484931387007236,
0.024272916838526726,
-0.012489037588238716,
0.04424567148089409,
-0.01160277146846056,
0.004590780008584261,
0.016802795231342316,
0.032064151018857956,
-0.003745976835489273,
0.029811298474669456,
0.009867796674370766,
-0.08409710973501205,
-0.03134145960211754,
-0.038726095110177994,
-0.09805617481470108,
-0.04925547540187836,
0.03913623467087746,
0.031818460673093796,
-0.03344622254371643,
-0.0360151007771492,
-0.045547958463430405,
-0.0688604936003685,
-0.02404194325208664,
0.0032020462676882744,
0.038165055215358734,
-0.055247072130441666,
0.020500725135207176,
0.06635424494743347,
0.060215916484594345,
-0.04808104783296585,
0.07395225763320923,
0.008506549522280693,
0.04491226747632027,
-0.018205782398581505,
-0.021955562755465508,
-0.0005557285621762276,
0.07324370741844177,
0.059930216521024704,
0.06283926218748093,
0.0365152545273304,
0.07369212806224823,
0.10707052797079086,
-0.06594756990671158,
-0.04795217141509056,
0.011735379695892334,
-0.11157955229282379,
-0.08687198907136917,
-0.018315883353352547,
-0.04437793046236038,
0.07871897518634796,
-0.0008168489439412951,
-0.02713526412844658,
-0.030979959294199944,
-0.004538857843726873,
0.05911650508642197,
-0.046786829829216,
0.03811526671051979,
-0.046994034200906754,
-0.022426599636673927,
0.11420480161905289,
-0.016198091208934784,
-0.0304748322814703,
-0.07632769644260406,
-0.022540321573615074,
0.0415048748254776,
0.02140575461089611,
0.02707761898636818,
0.024871213361620903,
0.02751762792468071,
-0.10073169320821762,
-0.07298560440540314,
-1.311690799728404e-33,
-0.029837267473340034,
-0.014549577608704567,
-0.05749431252479553,
0.09053591638803482,
-0.020680591464042664,
-0.00020101238624192774,
-0.06363720446825027,
0.05096590146422386,
0.10847600549459457,
0.0016880768816918135,
-0.02378617599606514,
0.024355875328183174,
-0.05262505263090134,
0.010287078097462654,
-0.00476220715790987,
0.04148752987384796,
-0.046188924461603165,
-0.09395324438810349,
0.0017500834073871374,
-0.05525357648730278,
-0.06571586430072784,
-0.03148246556520462,
0.075564906001091,
-0.029614632949233055,
0.002359380479902029,
0.00941550824791193,
-0.016879703849554062,
0.019531309604644775,
-0.012368847616016865,
-0.13527482748031616,
-0.0721423476934433,
-0.01937888003885746,
-0.00032787720556370914,
0.03199617937207222,
0.008556381799280643,
-0.02579142525792122,
0.04541896656155586,
0.057115621864795685,
-0.003187344642356038,
-0.023980649188160896,
0.09420119225978851,
0.04438962787389755,
-0.019514163956046104,
-0.058998722583055496,
0.014179443009197712,
0.028084732592105865,
-0.08173002302646637,
0.040109701454639435,
0.0019739652052521706,
-0.020754747092723846,
-0.013457498513162136,
-0.014907852746546268,
0.004855488892644644,
0.021901171654462814,
0.009112413972616196,
0.03302035853266716,
0.07918888330459595,
0.009614591486752033,
0.023989178240299225,
-0.017200544476509094,
0.06014375388622284,
-0.13015216588974,
-0.02169043943285942,
0.004402525257319212,
0.03470320627093315,
0.01621001586318016,
-0.014176483266055584,
-0.029859719797968864,
0.003593466244637966,
0.023002268746495247,
0.028586313128471375,
-0.024991903454065323,
-0.029217571020126343,
-0.0181825440376997,
0.045178692787885666,
-0.0018188911490142345,
0.03417370468378067,
-0.0746804028749466,
-0.025997046381235123,
0.022134831175208092,
-0.05691149830818176,
0.08890552073717117,
-0.02904794178903103,
0.015936026349663734,
0.12734562158584595,
0.031535305082798004,
-0.0026884612161666155,
-0.04948963224887848,
0.025704991072416306,
-0.0014049209421500564,
-0.010475991293787956,
-0.01969725824892521,
-0.1581495851278305,
0.03683210164308548,
-0.04915570095181465,
-5.113319545557715e-8,
-0.0503712072968483,
-0.02179792895913124,
-0.084361732006073,
-0.010930540971457958,
0.021606631577014923,
-0.020424790680408478,
-0.02192956954240799,
-0.019707290455698967,
0.04195839539170265,
0.0002757781185209751,
0.0026698349975049496,
0.018334876745939255,
0.09412571042776108,
-0.023664431646466255,
0.026345141232013702,
-0.03010145016014576,
0.036371130496263504,
-0.020643893629312515,
-0.04571302980184555,
0.038306813687086105,
0.006109477020800114,
0.02561449259519577,
-0.030237192288041115,
0.013219557702541351,
0.03974172845482826,
0.02981080673635006,
0.09580443054437637,
0.06020940840244293,
0.039551880210638046,
-0.06550352275371552,
-0.060629952698946,
0.08799704909324646,
0.10642117261886597,
0.03230687230825424,
-0.03590524569153786,
0.005767511669546366,
-0.006404242943972349,
0.010995972901582718,
0.011655819602310658,
0.1503918468952179,
0.07669948786497116,
-0.04164374992251396,
-0.07428627461194992,
0.06789796054363251,
-0.01793588325381279,
-0.006217116955667734,
0.02935045212507248,
-0.00570119172334671,
0.041106950491666794,
0.08648458123207092,
0.005370531231164932,
0.034696824848651886,
-0.018608856946229935,
-0.04591722786426544,
-0.0015119081363081932,
-0.06249679625034332,
0.02361546829342842,
-0.09313203394412994,
-0.05359392613172531,
-0.017278103157877922,
0.07408395409584045,
0.0004020569322165102,
0.035009291023015976,
0.03470419719815254
] | 0.145314 |
the stream. \* `data` {any} a chunk of data from the stream. \* `options` {Object} \* `signal` {AbortSignal} aborted if the stream is destroyed allowing to abort the `fn` call early. \* `options` {Object} \* `concurrency` {number} the maximum concurrent invocation of `fn` to call on the stream at once. \*\*Default:\*\* `1`. \* `highWaterMark` {number} how many items to buffer while waiting for user consumption of the mapped items. \*\*Default:\*\* `concurrency \* 2 - 1`. \* `signal` {AbortSignal} allows destroying the stream if the signal is aborted. \* Returns: {Readable} a stream mapped with the function `fn`. This method allows mapping over the stream. The `fn` function will be called for every chunk in the stream. If the `fn` function returns a promise - that promise will be `await`ed before being passed to the result stream. ```mjs import { Readable } from 'node:stream'; import { Resolver } from 'node:dns/promises'; // With a synchronous mapper. for await (const chunk of Readable.from([1, 2, 3, 4]).map((x) => x \* 2)) { console.log(chunk); // 2, 4, 6, 8 } // With an asynchronous mapper, making at most 2 queries at a time. const resolver = new Resolver(); const dnsResults = Readable.from([ 'nodejs.org', 'openjsf.org', 'www.linuxfoundation.org', ]).map((domain) => resolver.resolve4(domain), { concurrency: 2 }); for await (const result of dnsResults) { console.log(result); // Logs the DNS result of resolver.resolve4. } ``` ##### `readable.filter(fn[, options])` > Stability: 1 - Experimental \* `fn` {Function|AsyncFunction} a function to filter chunks from the stream. \* `data` {any} a chunk of data from the stream. \* `options` {Object} \* `signal` {AbortSignal} aborted if the stream is destroyed allowing to abort the `fn` call early. \* `options` {Object} \* `concurrency` {number} the maximum concurrent invocation of `fn` to call on the stream at once. \*\*Default:\*\* `1`. \* `highWaterMark` {number} how many items to buffer while waiting for user consumption of the filtered items. \*\*Default:\*\* `concurrency \* 2 - 1`. \* `signal` {AbortSignal} allows destroying the stream if the signal is aborted. \* Returns: {Readable} a stream filtered with the predicate `fn`. This method allows filtering the stream. For each chunk in the stream the `fn` function will be called and if it returns a truthy value, the chunk will be passed to the result stream. If the `fn` function returns a promise - that promise will be `await`ed. ```mjs import { Readable } from 'node:stream'; import { Resolver } from 'node:dns/promises'; // With a synchronous predicate. for await (const chunk of Readable.from([1, 2, 3, 4]).filter((x) => x > 2)) { console.log(chunk); // 3, 4 } // With an asynchronous predicate, making at most 2 queries at a time. const resolver = new Resolver(); const dnsResults = Readable.from([ 'nodejs.org', 'openjsf.org', 'www.linuxfoundation.org', ]).filter(async (domain) => { const { address } = await resolver.resolve4(domain, { ttl: true }); return address.ttl > 60; }, { concurrency: 2 }); for await (const result of dnsResults) { // Logs domains with more than 60 seconds on the resolved dns record. console.log(result); } ``` ##### `readable.forEach(fn[, options])` > Stability: 1 - Experimental \* `fn` {Function|AsyncFunction} a function to call on each chunk of the stream. \* `data` {any} a chunk of data from the stream. \* `options` {Object} \* `signal` {AbortSignal} aborted if the stream is destroyed allowing to abort the `fn` call early. \* `options` {Object} \* `concurrency` {number} the maximum concurrent invocation of `fn` to call on the stream at once. \*\*Default:\*\* `1`. \* `signal` {AbortSignal} allows destroying the stream if the signal is aborted. \* Returns: {Promise} a promise for when the stream has finished. This method allows iterating a stream. For each chunk in the stream | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.04148627072572708,
-0.0035489569418132305,
-0.0012315514031797647,
0.011958074755966663,
-0.00039526427281089127,
-0.08233598619699478,
0.05858059972524643,
0.04963718727231026,
0.004736968316137791,
-0.02053568884730339,
-0.03376399353146553,
0.020951654762029648,
-0.05484090745449066,
-0.029980633407831192,
0.008729674853384495,
-0.017798325046896935,
-0.022399846464395523,
-0.024804964661598206,
-0.08643476665019989,
-0.08479781448841095,
0.09561701864004135,
-0.0019212780753150582,
-0.017292050644755363,
-0.0010824139462783933,
-0.07769493758678436,
0.01807555928826332,
-0.0324363112449646,
-0.025095928460359573,
0.045749060809612274,
-0.0534176230430603,
0.04770270362496376,
-0.003974545747041702,
-0.043475281447172165,
-0.019270852208137512,
-0.038113608956336975,
0.09406081587076187,
-0.029868189245462418,
-0.12513624131679535,
-0.02480575628578663,
-0.011769695207476616,
0.08244749158620834,
0.010060466825962067,
-0.09810891002416611,
-0.014697243459522724,
0.0015183500945568085,
0.015482558868825436,
-0.02110620029270649,
-0.0008657099679112434,
-0.09350794553756714,
0.07635453343391418,
-0.1144198402762413,
0.013863042928278446,
-0.09790433198213577,
0.10842659324407578,
0.08321230858564377,
-0.013243597000837326,
-0.020006168633699417,
-0.05225879326462746,
-0.056292373687028885,
-0.007864647544920444,
-0.045255791395902634,
-0.04045495018362999,
-0.0008768826373852789,
-0.01251328457146883,
0.12669506669044495,
-0.02783416397869587,
-0.03409315273165703,
0.014402128756046295,
0.10826641321182251,
0.06422077119350433,
0.0255459975451231,
0.015901071950793266,
-0.02138620801270008,
-0.043106526136398315,
0.01958770863711834,
-0.03414996713399887,
-0.013239387422800064,
-0.0018953080289065838,
-0.02883758582174778,
-0.040844645351171494,
-0.022319698706269264,
-0.0787738487124443,
0.02906678058207035,
-0.045095138251781464,
0.025215933099389076,
0.026814386248588562,
-0.02395925112068653,
0.014169782400131226,
0.0450609028339386,
0.029662519693374634,
-0.08462569117546082,
0.020133482292294502,
0.035130348056554794,
0.06430727243423462,
-0.018222838640213013,
0.07244527339935303,
0.0036340001970529556,
-0.01371045783162117,
-0.016999278217554092,
0.013154140673577785,
0.02167985774576664,
0.022194482386112213,
0.02180119976401329,
-0.015249829739332199,
0.04609588533639908,
-0.0956871286034584,
0.017116069793701172,
0.04347257316112518,
-0.03094690479338169,
-0.07431545853614807,
-0.005987740587443113,
0.025778111070394516,
0.03404800966382027,
-0.006172178313136101,
-0.07793785631656647,
0.025529956445097923,
-0.033410198986530304,
-0.026667654514312744,
0.05621674284338951,
0.11433346569538116,
0.07355947047472,
-0.003929624799638987,
0.000197511151782237,
-0.010451321490108967,
0.025940535590052605,
0.022856784984469414,
0.07861556112766266,
3.499977858907728e-33,
-0.015016334131360054,
-0.13187818229198456,
-0.04637492075562477,
-0.01332256942987442,
0.02437012456357479,
-0.0022864388301968575,
0.03187564015388489,
-0.006377086974680424,
-0.09601429104804993,
0.0235002338886261,
-0.04711587727069855,
0.00005263882485451177,
-0.062311578541994095,
0.07246533036231995,
0.009129241108894348,
-0.08902197331190109,
0.11665691435337067,
-0.01354528684169054,
-0.010585625655949116,
0.01790841482579708,
0.11370354145765305,
-0.03491911664605141,
-0.07931644469499588,
-0.061409030109643936,
0.0266690906137228,
0.013031176291406155,
-0.03414248302578926,
0.05250030383467674,
-0.012977737933397293,
0.046171605587005615,
0.006701188627630472,
0.017967944964766502,
-0.011665728874504566,
-0.008532333187758923,
0.07266360521316528,
-0.03848985582590103,
-0.007468508090823889,
-0.015263954177498817,
-0.08802404999732971,
-0.05807792767882347,
-0.01014605350792408,
0.04124107584357262,
-0.06940897554159164,
0.0037513794377446175,
-0.06633669883012772,
-0.12160971760749817,
-0.059601686894893646,
0.04966776445508003,
-0.0048728822730481625,
0.03732680901885033,
0.07153158634901047,
0.0038401042111217976,
-0.01002681814134121,
0.01705874688923359,
0.01306044589728117,
-0.029218170791864395,
-0.0018137000733986497,
0.03171353042125702,
0.03272337466478348,
0.09487347304821014,
-0.021244021132588387,
0.009722622111439705,
0.015021747909486294,
0.02783845365047455,
0.007133941166102886,
0.10884029418230057,
0.06688275933265686,
0.006982987746596336,
0.07212530076503754,
-0.013019286096096039,
-0.06366713345050812,
0.0476096011698246,
0.0407070517539978,
-0.004298890009522438,
-0.029467448592185974,
0.01030629500746727,
-0.00985953863710165,
-0.10167798399925232,
-0.022939803078770638,
-0.0015440494753420353,
0.050585031509399414,
0.00005506276647793129,
-0.02003924548625946,
0.07592852413654327,
-0.07003775238990784,
0.038709986954927444,
-0.0023666585329920053,
-0.09370401501655579,
-0.025277577340602875,
-0.014094701036810875,
-0.01563909463584423,
0.003196400823071599,
0.08694148808717728,
-0.14897452294826508,
-0.04670385643839836,
-4.333676288735311e-33,
0.04281224310398102,
-0.03840174525976181,
-0.04754522070288658,
0.08314795792102814,
0.008957626298069954,
-0.037945326417684555,
0.046077314764261246,
0.017693648114800453,
0.009813003242015839,
0.0010999043006449938,
-0.04739409685134888,
-0.008232221007347107,
-0.0015043282182887197,
-0.031353846192359924,
-0.0068902503699064255,
-0.003677421249449253,
0.00675729988142848,
-0.056465692818164825,
0.03829741105437279,
-0.049144670367240906,
-0.007459836546331644,
-0.04871334135532379,
0.04431712254881859,
0.08894525468349457,
-0.0504179447889328,
0.021546052768826485,
-0.02992786467075348,
-0.036720506846904755,
-0.013963276520371437,
-0.04041195660829544,
-0.021871721372008324,
-0.04920366033911705,
-0.018767351284623146,
-0.05141071230173111,
0.01853274554014206,
-0.023046152666211128,
0.10489363968372345,
0.1359850913286209,
-0.06316254287958145,
0.012727453373372555,
0.14174528419971466,
0.016292164102196693,
0.003324029268696904,
-0.045575100928545,
0.01444353349506855,
0.04782896116375923,
-0.011618223041296005,
-0.012338085100054741,
-0.030889933928847313,
0.040892235934734344,
0.027637362480163574,
-0.03277505189180374,
-0.0027211729902774096,
0.06269897520542145,
0.018030257895588875,
-0.03511078283190727,
0.08969318866729736,
-0.06754466146230698,
0.014725219458341599,
0.0017558985855430365,
0.0032482726965099573,
-0.09198693931102753,
0.0223951768130064,
0.019159957766532898,
0.08822610229253769,
0.03833624720573425,
-0.018085014075040817,
-0.07336527109146118,
0.060150448232889175,
0.018211642280220985,
0.06788744032382965,
0.004801054485142231,
-0.01557749044150114,
0.030021365731954575,
0.028226669877767563,
-0.03218672052025795,
-0.08739553391933441,
-0.04779384285211563,
0.012261169962584972,
0.09866802394390106,
-0.008827457204461098,
0.0885424017906189,
-0.04283968731760979,
0.11044321954250336,
0.03664254769682884,
-0.02318796142935753,
0.021164868026971817,
-0.06698648631572723,
0.002620578045025468,
-0.0192413330078125,
0.005238227546215057,
0.028966916725039482,
-0.1607387214899063,
0.000011757635547837708,
-0.035596199333667755,
-4.8583437717297784e-8,
-0.03529677540063858,
-0.06848966330289841,
-0.04615544527769089,
0.07144194096326828,
0.01225400622934103,
-0.03525238111615181,
-0.002858994761481881,
0.053024131804704666,
0.045152515172958374,
-0.059479616582393646,
0.06541173160076141,
-0.014483962208032608,
0.0092235142365098,
-0.06555347889661789,
0.04751652106642723,
-0.03589598834514618,
0.07274529337882996,
-0.048784058541059494,
-0.05894780531525612,
-0.03837641701102257,
0.021671796217560768,
0.023067235946655273,
-0.013713769614696503,
0.016610000282526016,
0.005732466001063585,
0.029164385050535202,
0.1320403665304184,
0.10730496048927307,
-0.006704576313495636,
-0.05237574875354767,
-0.0185236856341362,
-0.028341593220829964,
0.08828459680080414,
0.0757899060845375,
-0.04885212332010269,
0.015250523574650288,
-0.028515387326478958,
0.03855607658624649,
-0.02940760925412178,
0.09423354268074036,
0.006789656821638346,
-0.000036321514926385134,
0.018330581486225128,
0.03145618364214897,
0.04578908532857895,
-0.0009507577051408589,
-0.040063511580228806,
0.03681741654872894,
0.003156829858198762,
0.0283346064388752,
-0.030207308009266853,
0.01626749336719513,
-0.012550720945000648,
0.09858206659555435,
-0.004023679532110691,
-0.04682925343513489,
0.04209834709763527,
-0.11990810185670853,
-0.06739989668130875,
-0.008439569734036922,
0.14326830208301544,
0.035197559744119644,
-0.004502197727560997,
-0.009834438562393188
] | 0.15453 |
the maximum concurrent invocation of `fn` to call on the stream at once. \*\*Default:\*\* `1`. \* `signal` {AbortSignal} allows destroying the stream if the signal is aborted. \* Returns: {Promise} a promise for when the stream has finished. This method allows iterating a stream. For each chunk in the stream the `fn` function will be called. If the `fn` function returns a promise - that promise will be `await`ed. This method is different from `for await...of` loops in that it can optionally process chunks concurrently. In addition, a `forEach` iteration can only be stopped by having passed a `signal` option and aborting the related `AbortController` while `for await...of` can be stopped with `break` or `return`. In either case the stream will be destroyed. This method is different from listening to the [`'data'`][] event in that it uses the [`readable`][] event in the underlying machinery and can limit the number of concurrent `fn` calls. ```mjs import { Readable } from 'node:stream'; import { Resolver } from 'node:dns/promises'; // With a synchronous predicate. for await (const chunk of Readable.from([1, 2, 3, 4]).filter((x) => x > 2)) { console.log(chunk); // 3, 4 } // With an asynchronous predicate, making at most 2 queries at a time. const resolver = new Resolver(); const dnsResults = Readable.from([ 'nodejs.org', 'openjsf.org', 'www.linuxfoundation.org', ]).map(async (domain) => { const { address } = await resolver.resolve4(domain, { ttl: true }); return address; }, { concurrency: 2 }); await dnsResults.forEach((result) => { // Logs result, similar to `for await (const result of dnsResults)` console.log(result); }); console.log('done'); // Stream has finished ``` ##### `readable.toArray([options])` > Stability: 1 - Experimental \* `options` {Object} \* `signal` {AbortSignal} allows cancelling the toArray operation if the signal is aborted. \* Returns: {Promise} a promise containing an array with the contents of the stream. This method allows easily obtaining the contents of a stream. As this method reads the entire stream into memory, it negates the benefits of streams. It's intended for interoperability and convenience, not as the primary way to consume streams. ```mjs import { Readable } from 'node:stream'; import { Resolver } from 'node:dns/promises'; await Readable.from([1, 2, 3, 4]).toArray(); // [1, 2, 3, 4] const resolver = new Resolver(); // Make dns queries concurrently using .map and collect // the results into an array using toArray const dnsResults = await Readable.from([ 'nodejs.org', 'openjsf.org', 'www.linuxfoundation.org', ]).map(async (domain) => { const { address } = await resolver.resolve4(domain, { ttl: true }); return address; }, { concurrency: 2 }).toArray(); ``` ##### `readable.some(fn[, options])` > Stability: 1 - Experimental \* `fn` {Function|AsyncFunction} a function to call on each chunk of the stream. \* `data` {any} a chunk of data from the stream. \* `options` {Object} \* `signal` {AbortSignal} aborted if the stream is destroyed allowing to abort the `fn` call early. \* `options` {Object} \* `concurrency` {number} the maximum concurrent invocation of `fn` to call on the stream at once. \*\*Default:\*\* `1`. \* `signal` {AbortSignal} allows destroying the stream if the signal is aborted. \* Returns: {Promise} a promise evaluating to `true` if `fn` returned a truthy value for at least one of the chunks. This method is similar to `Array.prototype.some` and calls `fn` on each chunk in the stream until the awaited return value is `true` (or any truthy value). Once an `fn` call on a chunk awaited return value is truthy, the stream is destroyed and the promise is fulfilled with `true`. If none of the `fn` calls on the chunks return a truthy value, the promise is fulfilled with `false`. ```mjs import { Readable } from 'node:stream'; import { stat } from 'node:fs/promises'; // With a | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.0737854540348053,
-0.03808880224823952,
-0.08241882175207138,
0.022287551313638687,
0.035123784095048904,
-0.06952665746212006,
0.014781235717236996,
0.05821174755692482,
0.08802611380815506,
-0.03229993209242821,
-0.02476762980222702,
0.08324076980352402,
-0.05839076638221741,
-0.03126304969191551,
-0.011795373633503914,
-0.05135400593280792,
-0.06245541572570801,
-0.07253319025039673,
-0.055214498192071915,
-0.0377902053296566,
0.08483264595270157,
-0.015500959008932114,
0.012545744888484478,
0.03768165782094002,
-0.0682302862405777,
-0.010131007991731167,
-0.03594888374209404,
-0.03567522391676903,
0.06324940174818039,
-0.03108898364007473,
0.05418647080659866,
-0.006429411470890045,
-0.02723841555416584,
0.061179403215646744,
-0.10126405954360962,
0.05043613910675049,
-0.020161688327789307,
-0.07005942612886429,
0.006432227790355682,
0.010473192669451237,
0.040016356855630875,
0.011885100044310093,
-0.09452971816062927,
-0.04521656781435013,
0.05444344878196716,
-0.007194044068455696,
-0.03228415176272392,
-0.012629188597202301,
-0.028764838352799416,
0.06360834091901779,
-0.05848110839724541,
0.034049492329359055,
-0.058637816458940506,
0.10672609508037567,
0.07254122197628021,
-0.07821875065565109,
-0.000411069777328521,
-0.041926201432943344,
-0.02534136362373829,
0.06366801261901855,
0.010146635584533215,
-0.04409538581967354,
-0.08618701994419098,
0.04134899377822876,
0.11095724999904633,
-0.034816015511751175,
-0.013915820978581905,
-0.019203567877411842,
0.12804937362670898,
0.025098640471696854,
0.03416609391570091,
0.013214310631155968,
0.0040550511330366135,
-0.0337778702378273,
0.015454444102942944,
-0.042851801961660385,
0.05003171041607857,
0.012317060492932796,
-0.048823051154613495,
-0.05073878914117813,
-0.009602042846381664,
0.037697385996580124,
0.05106367543339729,
-0.11935081332921982,
0.010699749924242496,
0.0009926907951012254,
-0.04601871222257614,
-0.014307158999145031,
0.029829008504748344,
0.02447047084569931,
-0.047263000160455704,
0.015592426992952824,
-0.010087618604302406,
0.06459958106279373,
-0.0015709958970546722,
0.0696917176246643,
0.007213500328361988,
0.0084990831092,
-0.03308246657252312,
0.006371887866407633,
0.01631973125040531,
0.006419130600988865,
0.029206478968262672,
-0.02649313397705555,
-0.03490513563156128,
-0.09055067598819733,
0.007444691378623247,
0.0031757319811731577,
-0.06973060220479965,
-0.10787203907966614,
-0.020349834114313126,
0.01807590201497078,
0.07065760344266891,
-0.004716883879154921,
-0.04995407909154892,
0.01425403356552124,
-0.07575809955596924,
0.011880156584084034,
0.0988883450627327,
0.12460264563560486,
0.04177103564143181,
0.037170328199863434,
0.03040417842566967,
0.011890583671629429,
0.03549152612686157,
-0.02553977072238922,
-0.02786509320139885,
1.6269100791479625e-33,
0.00782052706927061,
-0.030715718865394592,
-0.019910903647542,
-0.022903520613908768,
0.05148965120315552,
0.014161195605993271,
0.06957338750362396,
0.0046893828548491,
-0.009976178407669067,
0.04703758656978607,
-0.0038000023923814297,
-0.0039350916631519794,
-0.03250845894217491,
0.0189877450466156,
0.04653758183121681,
-0.10780719667673111,
0.11488442867994308,
-0.021422160789370537,
-0.02384737879037857,
0.05191417410969734,
0.13932780921459198,
-0.04614941030740738,
0.019172392785549164,
0.002508907113224268,
0.023853352293372154,
-0.023004349321126938,
0.0010320935398340225,
0.12196354568004608,
-0.0609082356095314,
0.03684338182210922,
-0.025910766795277596,
0.022021934390068054,
-0.02460041083395481,
0.02342948503792286,
0.1010119840502739,
-0.06009571999311447,
0.0021358460653573275,
-0.0252376701682806,
-0.09227658808231354,
-0.015299870632588863,
-0.031197646632790565,
0.02076015993952751,
-0.05728333443403244,
0.01631990075111389,
-0.034416817128658295,
-0.08849628269672394,
-0.0881238728761673,
0.02906971238553524,
-0.010970004834234715,
0.07860518246889114,
0.09108368307352066,
0.016508275642991066,
0.01197184156626463,
-0.02795710600912571,
0.10842178016901016,
-0.03902345895767212,
0.0024320126976817846,
-0.018021682277321815,
0.008468277752399445,
0.13440632820129395,
0.04967288672924042,
-0.11742308735847473,
-0.06893856823444366,
0.0161167960613966,
-0.0727449506521225,
0.08506132662296295,
-0.004586148541420698,
0.041162602603435516,
0.053021930158138275,
-0.006081755738705397,
-0.06451360881328583,
0.09807449579238892,
0.001538574113510549,
-0.05208863317966461,
0.05551651865243912,
0.0035389976110309362,
-0.014835682697594166,
-0.09377433359622955,
-0.017973531037569046,
-0.0006137504824437201,
0.022978393360972404,
0.07407112419605255,
-0.07617215812206268,
0.07972826808691025,
-0.06097327172756195,
0.07603077590465546,
-0.01999015547335148,
-0.07846570014953613,
0.003465274814516306,
-0.06116354838013649,
-0.006733770947903395,
-0.02252981998026371,
0.0822623074054718,
-0.10477518290281296,
-0.006346379406750202,
-2.422062947186129e-33,
0.07477015256881714,
-0.06244540587067604,
-0.05756795406341553,
0.01168767735362053,
0.032608307898044586,
0.01512975338846445,
0.004572445526719093,
0.008786959573626518,
-0.022423701360821724,
-0.07905834168195724,
-0.007060131058096886,
0.0029565186705440283,
0.022227158769965172,
0.0491873174905777,
-0.008115625008940697,
0.004660921636968851,
0.03839246556162834,
-0.055968016386032104,
0.04507646709680557,
-0.012706583365797997,
-0.014877374283969402,
-0.04739212244749069,
0.036001041531562805,
-0.014319686219096184,
-0.02334454469382763,
0.007390814367681742,
-0.07783754169940948,
0.014372111298143864,
0.05371818318963051,
0.02541995979845524,
0.032154861837625504,
-0.07318343222141266,
-0.04094325378537178,
-0.01144840382039547,
0.04961065575480461,
0.007473193574696779,
0.07268894463777542,
0.09253200143575668,
-0.0009348750463686883,
-0.03885665908455849,
0.1621914803981781,
-0.0177625585347414,
0.05494122952222824,
-0.049180541187524796,
0.039419595152139664,
-0.011024110950529575,
-0.008978256024420261,
-0.052154429256916046,
-0.06799851357936859,
0.031137028709053993,
0.046213824301958084,
-0.031028728932142258,
-0.06099386885762215,
0.03560120239853859,
0.010879711247980595,
-0.06505436450242996,
0.04195169359445572,
-0.016431916505098343,
0.03541668877005577,
-0.033981118351221085,
-0.004543481394648552,
-0.08526461571455002,
0.03363523259758949,
0.07994973659515381,
0.05440906807780266,
0.028325462713837624,
-0.029166581109166145,
-0.0012995353899896145,
0.10176249593496323,
0.08315299451351166,
0.07903670519590378,
-0.034718889743089676,
-0.08498003333806992,
0.05131518840789795,
-0.057283733040094376,
-0.016497410833835602,
-0.03397949039936066,
-0.1359041929244995,
-0.015589915215969086,
0.09458525478839874,
-0.04192567244172096,
0.020356206223368645,
-0.019414644688367844,
0.05517909675836563,
-0.011156569235026836,
0.04574071615934372,
0.098321333527565,
-0.0733213871717453,
0.0007424198556691408,
-0.058599505573511124,
0.06752686947584152,
0.01214278768748045,
-0.010697104036808014,
0.0073470259085297585,
-0.03172292187809944,
-4.939623110544744e-8,
-0.011533800512552261,
-0.055715687572956085,
-0.08571969717741013,
0.017368080094456673,
0.10537389665842056,
-0.04752064123749733,
-0.00455757649615407,
-0.029927358031272888,
0.005809233523905277,
0.006847748067229986,
0.02943340688943863,
0.02208518236875534,
0.02701089344918728,
-0.02540244720876217,
0.024336842820048332,
-0.011414356529712677,
0.05789769068360329,
-0.009799666702747345,
0.0007394439890049398,
-0.0760381817817688,
-0.013454560190439224,
0.034822601824998856,
-0.051364630460739136,
-0.01074846088886261,
-0.0400371216237545,
0.021739067509770393,
0.07147499173879623,
0.07811988890171051,
0.010513772256672382,
-0.056177444756031036,
-0.053997788578271866,
-0.009617544710636139,
0.048855844885110855,
0.03742905706167221,
-0.036599040031433105,
0.002342057414352894,
-0.05267472192645073,
0.02314089424908161,
0.0033465714659541845,
0.06372523307800293,
0.0408465713262558,
-0.009080476127564907,
0.06730244308710098,
0.04455513879656792,
-0.003942147828638554,
0.006146816071122885,
-0.02279142662882805,
0.01488872803747654,
-0.022445667535066605,
-0.013432414270937443,
-0.05028389021754265,
0.057274915277957916,
-0.02627977915108204,
0.0805804431438446,
-0.02661898545920849,
0.006546622142195702,
0.012634220533072948,
-0.11060380935668945,
-0.027541011571884155,
0.03525881841778755,
0.03342179208993912,
0.0012507871724665165,
0.021492069587111473,
-0.007573883514851332
] | 0.159944 |
return value is truthy, the stream is destroyed and the promise is fulfilled with `true`. If none of the `fn` calls on the chunks return a truthy value, the promise is fulfilled with `false`. ```mjs import { Readable } from 'node:stream'; import { stat } from 'node:fs/promises'; // With a synchronous predicate. await Readable.from([1, 2, 3, 4]).some((x) => x > 2); // true await Readable.from([1, 2, 3, 4]).some((x) => x < 0); // false // With an asynchronous predicate, making at most 2 file checks at a time. const anyBigFile = await Readable.from([ 'file1', 'file2', 'file3', ]).some(async (fileName) => { const stats = await stat(fileName); return stats.size > 1024 \* 1024; }, { concurrency: 2 }); console.log(anyBigFile); // `true` if any file in the list is bigger than 1MB console.log('done'); // Stream has finished ``` ##### `readable.find(fn[, options])` > Stability: 1 - Experimental \* `fn` {Function|AsyncFunction} a function to call on each chunk of the stream. \* `data` {any} a chunk of data from the stream. \* `options` {Object} \* `signal` {AbortSignal} aborted if the stream is destroyed allowing to abort the `fn` call early. \* `options` {Object} \* `concurrency` {number} the maximum concurrent invocation of `fn` to call on the stream at once. \*\*Default:\*\* `1`. \* `signal` {AbortSignal} allows destroying the stream if the signal is aborted. \* Returns: {Promise} a promise evaluating to the first chunk for which `fn` evaluated with a truthy value, or `undefined` if no element was found. This method is similar to `Array.prototype.find` and calls `fn` on each chunk in the stream to find a chunk with a truthy value for `fn`. Once an `fn` call's awaited return value is truthy, the stream is destroyed and the promise is fulfilled with value for which `fn` returned a truthy value. If all of the `fn` calls on the chunks return a falsy value, the promise is fulfilled with `undefined`. ```mjs import { Readable } from 'node:stream'; import { stat } from 'node:fs/promises'; // With a synchronous predicate. await Readable.from([1, 2, 3, 4]).find((x) => x > 2); // 3 await Readable.from([1, 2, 3, 4]).find((x) => x > 0); // 1 await Readable.from([1, 2, 3, 4]).find((x) => x > 10); // undefined // With an asynchronous predicate, making at most 2 file checks at a time. const foundBigFile = await Readable.from([ 'file1', 'file2', 'file3', ]).find(async (fileName) => { const stats = await stat(fileName); return stats.size > 1024 \* 1024; }, { concurrency: 2 }); console.log(foundBigFile); // File name of large file, if any file in the list is bigger than 1MB console.log('done'); // Stream has finished ``` ##### `readable.every(fn[, options])` > Stability: 1 - Experimental \* `fn` {Function|AsyncFunction} a function to call on each chunk of the stream. \* `data` {any} a chunk of data from the stream. \* `options` {Object} \* `signal` {AbortSignal} aborted if the stream is destroyed allowing to abort the `fn` call early. \* `options` {Object} \* `concurrency` {number} the maximum concurrent invocation of `fn` to call on the stream at once. \*\*Default:\*\* `1`. \* `signal` {AbortSignal} allows destroying the stream if the signal is aborted. \* Returns: {Promise} a promise evaluating to `true` if `fn` returned a truthy value for all of the chunks. This method is similar to `Array.prototype.every` and calls `fn` on each chunk in the stream to check if all awaited return values are truthy value for `fn`. Once an `fn` call on a chunk awaited return value is falsy, the stream is destroyed and the promise is fulfilled with `false`. If all of the `fn` calls on the chunks return a truthy value, the promise is fulfilled with | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.059784986078739166,
0.051076456904411316,
-0.008430385030806065,
0.05068034678697586,
0.10572906583547592,
-0.034337643533945084,
-0.01428557001054287,
0.04087650775909424,
0.04098771885037422,
0.022128859534859657,
-0.06044670566916466,
0.06991469115018845,
-0.017119962722063065,
-0.014519914984703064,
0.011641818098723888,
-0.07903792709112167,
-0.07542413473129272,
0.025184182450175285,
-0.05680154263973236,
-0.07947022467851639,
0.07108639180660248,
-0.002287033712491393,
0.047202128916978836,
0.009502481669187546,
0.02786998078227043,
0.017781812697649002,
-0.0788886621594429,
-0.10205773264169693,
0.009160327725112438,
-0.07317224144935608,
0.04393412545323372,
0.020945534110069275,
-0.055895280092954636,
-0.014644766226410866,
-0.006767150014638901,
0.0705665647983551,
-0.040319450199604034,
-0.10258714854717255,
-0.06728707998991013,
-0.02555558644235134,
0.04035642370581627,
0.06881453841924667,
-0.06028014048933983,
-0.03218991681933403,
0.05323534086346626,
0.01099658478051424,
-0.027306970208883286,
0.011043159291148186,
-0.0362822562456131,
0.034047435969114304,
-0.07706432044506073,
0.04973139241337776,
-0.10288912802934647,
0.06353897601366043,
0.05037909746170044,
-0.030561884865164757,
-0.03157560154795647,
-0.044771913439035416,
-0.0733899176120758,
0.014931589365005493,
-0.021098341792821884,
-0.06030719727277756,
0.005260639823973179,
-0.01464523933827877,
0.1432228684425354,
0.043095700442790985,
-0.022075841203331947,
0.06955055147409439,
0.04385834187269211,
0.0668983981013298,
0.05229303240776062,
0.04848821461200714,
-0.015268710441887379,
0.03155650570988655,
-0.023893361911177635,
-0.05781358852982521,
0.014278609305620193,
0.06247671693563461,
0.006449000909924507,
0.02257782407104969,
-0.08474522829055786,
-0.03991076350212097,
0.034187547862529755,
-0.05478415638208389,
-0.01991284266114235,
-0.010926893912255764,
-0.03613372892141342,
0.04412314295768738,
0.01037812139838934,
0.009403012692928314,
-0.06937581300735474,
0.07258163392543793,
-0.06415373086929321,
0.10955610126256943,
0.0371202751994133,
0.07159916311502457,
0.0325770266354084,
0.03176787495613098,
0.08099716901779175,
-0.018633319064974785,
-0.0030472760554403067,
0.05720262974500656,
0.05912933871150017,
-0.018211446702480316,
0.026399804279208183,
-0.07453706860542297,
0.006179738789796829,
-0.014155544340610504,
-0.0750858411192894,
-0.04697880521416664,
0.04699927195906639,
-0.03941934555768967,
0.07636687159538269,
0.020531896501779556,
-0.0033608153462409973,
0.000020701698304037564,
-0.013086565770208836,
-0.006316919345408678,
-0.034663498401641846,
0.11353606730699539,
0.06344502419233322,
0.059794045984745026,
0.05429903417825699,
0.06590539216995239,
0.06079772859811783,
-0.034739572554826736,
0.05297138914465904,
2.934036471046322e-33,
-0.03567308560013771,
-0.05566176772117615,
0.0333825908601284,
0.013531406410038471,
0.006624174769967794,
0.0011564234737306833,
0.05170998349785805,
-0.03101303055882454,
-0.08524782955646515,
0.025493284687399864,
-0.03728533163666725,
0.03549890220165253,
-0.06168344244360924,
-0.016636090353131294,
0.014886067248880863,
-0.06759708374738693,
0.09580782055854797,
-0.06377913802862167,
-0.012851580046117306,
0.03930876404047012,
0.05527721717953682,
-0.03710486367344856,
-0.03681955114006996,
0.0008715195581316948,
-0.03677938133478165,
-0.0842803344130516,
0.02595517598092556,
0.04026162251830101,
-0.024154916405677795,
-0.015981433913111687,
0.02995641529560089,
-0.030182015150785446,
0.024937868118286133,
-0.00941002368927002,
0.05359376594424248,
-0.06402590870857239,
-0.010910085402429104,
-0.020036624744534492,
-0.1242457926273346,
-0.038245789706707,
-0.04678855836391449,
0.0825967863202095,
-0.002355008851736784,
-0.017890583723783493,
-0.07817911356687546,
-0.09975085407495499,
-0.08235637843608856,
0.012615586631000042,
-0.02155247889459133,
0.01596965827047825,
0.10340717434883118,
0.04403485357761383,
0.025337550789117813,
0.017520587891340256,
0.040637314319610596,
-0.02308402583003044,
0.023078346624970436,
0.037793099880218506,
-0.04975725710391998,
0.04844310134649277,
0.0791003629565239,
-0.07757774740457535,
-0.03689565882086754,
-0.004608527757227421,
-0.020778542384505272,
0.08595505356788635,
-0.007250811904668808,
0.06080573797225952,
0.04005872830748558,
-0.010211925022304058,
-0.014060433022677898,
-0.039861273020505905,
0.03435378894209862,
-0.03619888052344322,
0.03426190838217735,
0.021197261288762093,
-0.052616529166698456,
-0.041371699422597885,
-0.034223780035972595,
-0.09048487991094589,
0.017766747623682022,
-0.012789652682840824,
-0.054691147059202194,
0.09517557919025421,
-0.031237918883562088,
0.03933208808302879,
-0.03127819299697876,
-0.09421195834875107,
0.021642934530973434,
0.007476449478417635,
0.0036609312519431114,
-0.03935027867555618,
0.06978130340576172,
-0.10979237407445908,
-0.02088296040892601,
-2.404096985401749e-33,
0.044870637357234955,
0.031916022300720215,
0.019788667559623718,
0.05330875143408775,
0.017870884388685226,
0.029948769137263298,
-0.009189465083181858,
0.07500868290662766,
0.06557604670524597,
0.010744623839855194,
-0.03450522944331169,
-0.031050844117999077,
0.01172003336250782,
-0.00965090375393629,
-0.02886579930782318,
0.007782808039337397,
0.09509256482124329,
-0.08585084229707718,
0.01819062978029251,
-0.0037893997505307198,
-0.0006440964643843472,
-0.04721715301275253,
0.0573510006070137,
0.03923691436648369,
-0.03371436893939972,
0.1027785912156105,
-0.052124008536338806,
0.007628888823091984,
-0.018997136503458023,
-0.022684594616293907,
-0.027603795751929283,
-0.04054025560617447,
-0.07898805290460587,
-0.03889947757124901,
0.054380856454372406,
-0.08319834619760513,
0.0260662529617548,
0.13710294663906097,
-0.02665228769183159,
0.0042638457380235195,
0.05589082092046738,
0.01698148064315319,
0.010460062883794308,
-0.04369845986366272,
0.0571875125169754,
-0.04321928322315216,
0.030615191906690598,
0.03734390810132027,
0.008047244511544704,
-0.030118511989712715,
-0.008332544006407261,
0.025264505296945572,
-0.014568064361810684,
0.10776296257972717,
0.005698556080460548,
-0.048246126621961594,
-0.003566720988601446,
-0.0693463683128357,
0.033769771456718445,
-0.029225539416074753,
-0.00285379053093493,
-0.08956215530633926,
-0.04934701696038246,
-0.002148308092728257,
0.03787695989012718,
-0.024956291541457176,
-0.0372941717505455,
-0.047659989446401596,
0.09295479208230972,
0.06650048494338989,
0.030713774263858795,
0.014849367551505566,
-0.03487565740942955,
-0.027060264721512794,
0.0030475896783173084,
0.035382747650146484,
-0.08025413751602173,
-0.11109856516122818,
-0.01696278341114521,
0.13882514834403992,
-0.009048783220350742,
0.07398253679275513,
-0.013287592679262161,
0.041465602815151215,
0.10464642941951752,
-0.00394113315269351,
0.04977993294596672,
-0.05621614307165146,
0.03243790939450264,
0.0548936128616333,
0.01999921351671219,
0.02502979338169098,
-0.07995195686817169,
-0.019520286470651627,
-0.03490406274795532,
-4.9617405295521166e-8,
-0.07247084379196167,
-0.09746739268302917,
-0.09707890450954437,
0.05171513929963112,
0.04700659587979317,
-0.03629292920231819,
-0.062416672706604004,
0.012625446543097496,
0.043893422931432724,
-0.03541167452931404,
0.09121249616146088,
-0.029579633846879005,
-0.04747319966554642,
-0.06170733645558357,
0.033107247203588486,
-0.030189204961061478,
0.06718403846025467,
-0.043740130960941315,
-0.01933848112821579,
-0.04855570197105408,
0.030498454347252846,
0.01691465824842453,
-0.013845923356711864,
0.08426278829574585,
-0.0201646126806736,
0.03982214629650116,
0.1090703010559082,
-0.0139982420951128,
0.036725003272295,
-0.0069128843024373055,
-0.04863658919930458,
-0.02610972337424755,
0.1495961993932724,
0.02935490384697914,
-0.015814917162060738,
0.0026779044419527054,
0.043139826506376266,
0.0601523257791996,
0.03212311863899231,
0.0038019749335944653,
0.03642800822854042,
0.047887351363897324,
0.007341789547353983,
0.07568424195051193,
-0.024145664647221565,
-0.09949992597103119,
0.010131249204277992,
-0.00016361012239940464,
-0.010352525860071182,
-0.034224603325128555,
-0.0063719963654875755,
-0.01642845943570137,
-0.06593633443117142,
0.07108458876609802,
-0.011389737948775291,
-0.055387336760759354,
0.031801722943782806,
-0.03972660005092621,
-0.04944754019379616,
-0.009403439238667488,
0.09511809051036835,
-0.04265261068940163,
0.03223033249378204,
-0.013686799444258213
] | 0.066911 |
all awaited return values are truthy value for `fn`. Once an `fn` call on a chunk awaited return value is falsy, the stream is destroyed and the promise is fulfilled with `false`. If all of the `fn` calls on the chunks return a truthy value, the promise is fulfilled with `true`. ```mjs import { Readable } from 'node:stream'; import { stat } from 'node:fs/promises'; // With a synchronous predicate. await Readable.from([1, 2, 3, 4]).every((x) => x > 2); // false await Readable.from([1, 2, 3, 4]).every((x) => x > 0); // true // With an asynchronous predicate, making at most 2 file checks at a time. const allBigFiles = await Readable.from([ 'file1', 'file2', 'file3', ]).every(async (fileName) => { const stats = await stat(fileName); return stats.size > 1024 \* 1024; }, { concurrency: 2 }); // `true` if all files in the list are bigger than 1MiB console.log(allBigFiles); console.log('done'); // Stream has finished ``` ##### `readable.flatMap(fn[, options])` > Stability: 1 - Experimental \* `fn` {Function|AsyncGeneratorFunction|AsyncFunction} a function to map over every chunk in the stream. \* `data` {any} a chunk of data from the stream. \* `options` {Object} \* `signal` {AbortSignal} aborted if the stream is destroyed allowing to abort the `fn` call early. \* `options` {Object} \* `concurrency` {number} the maximum concurrent invocation of `fn` to call on the stream at once. \*\*Default:\*\* `1`. \* `signal` {AbortSignal} allows destroying the stream if the signal is aborted. \* Returns: {Readable} a stream flat-mapped with the function `fn`. This method returns a new stream by applying the given callback to each chunk of the stream and then flattening the result. It is possible to return a stream or another iterable or async iterable from `fn` and the result streams will be merged (flattened) into the returned stream. ```mjs import { Readable } from 'node:stream'; import { createReadStream } from 'node:fs'; // With a synchronous mapper. for await (const chunk of Readable.from([1, 2, 3, 4]).flatMap((x) => [x, x])) { console.log(chunk); // 1, 1, 2, 2, 3, 3, 4, 4 } // With an asynchronous mapper, combine the contents of 4 files const concatResult = Readable.from([ './1.mjs', './2.mjs', './3.mjs', './4.mjs', ]).flatMap((fileName) => createReadStream(fileName)); for await (const result of concatResult) { // This will contain the contents (all chunks) of all 4 files console.log(result); } ``` ##### `readable.drop(limit[, options])` > Stability: 1 - Experimental \* `limit` {number} the number of chunks to drop from the readable. \* `options` {Object} \* `signal` {AbortSignal} allows destroying the stream if the signal is aborted. \* Returns: {Readable} a stream with `limit` chunks dropped. This method returns a new stream with the first `limit` chunks dropped. ```mjs import { Readable } from 'node:stream'; await Readable.from([1, 2, 3, 4]).drop(2).toArray(); // [3, 4] ``` ##### `readable.take(limit[, options])` > Stability: 1 - Experimental \* `limit` {number} the number of chunks to take from the readable. \* `options` {Object} \* `signal` {AbortSignal} allows destroying the stream if the signal is aborted. \* Returns: {Readable} a stream with `limit` chunks taken. This method returns a new stream with the first `limit` chunks. ```mjs import { Readable } from 'node:stream'; await Readable.from([1, 2, 3, 4]).take(2).toArray(); // [1, 2] ``` ##### `readable.reduce(fn[, initial[, options]])` > Stability: 1 - Experimental \* `fn` {Function|AsyncFunction} a reducer function to call over every chunk in the stream. \* `previous` {any} the value obtained from the last call to `fn` or the `initial` value if specified or the first chunk of the stream otherwise. \* `data` {any} a chunk of data from the stream. \* `options` {Object} \* `signal` {AbortSignal} aborted if the stream is destroyed allowing to abort the `fn` call | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.07067564874887466,
0.04147141054272652,
0.0029345802031457424,
0.058672644197940826,
0.08565428853034973,
-0.023514945060014725,
-0.014545734971761703,
0.03410499915480614,
0.04941050335764885,
0.01190864946693182,
-0.04725818336009979,
0.05044598504900932,
-0.021949954330921173,
-0.025728436186909676,
-0.011168810538947582,
-0.06166577339172363,
-0.11374282091856003,
0.024039804935455322,
-0.03154614195227623,
-0.1072692796587944,
0.058803804218769073,
0.004365155939012766,
0.05079544335603714,
0.002930145710706711,
0.0018184538930654526,
0.00884073507040739,
-0.07942409813404083,
-0.0859098955988884,
0.00157252699136734,
-0.06140460446476936,
0.04391682520508766,
0.023689575493335724,
-0.03020261600613594,
0.010568328201770782,
0.001567991217598319,
0.0788392424583435,
-0.040158193558454514,
-0.10073236376047134,
-0.029541967436671257,
-0.004038780927658081,
0.0386589951813221,
0.060759298503398895,
-0.04292890056967735,
-0.05573193356394768,
0.10015279054641724,
-0.0054224287159740925,
-0.01956482231616974,
0.003423214890062809,
-0.01595291867852211,
0.03850175440311432,
-0.06527475267648697,
0.03606672212481499,
-0.10109733790159225,
0.05222644656896591,
0.06007732078433037,
-0.019785569980740547,
-0.012022314593195915,
-0.03774019330739975,
-0.03156866505742073,
-0.0115555664524436,
-0.028478557243943214,
-0.04957783594727516,
0.010534878820180893,
-0.021292155608534813,
0.1392034888267517,
0.06025289371609688,
-0.04570075869560242,
0.07489870488643646,
0.05332305282354355,
0.08446906507015228,
0.03508273884654045,
0.039127372205257416,
-0.020744405686855316,
0.008961756713688374,
-0.04998500272631645,
-0.043399129062891006,
-0.004416360054165125,
0.03216109797358513,
0.00882142223417759,
0.03712485358119011,
-0.10272952169179916,
-0.05205255001783371,
0.05308167636394501,
-0.07441895455121994,
-0.02332143671810627,
0.002547086216509342,
-0.033697325736284256,
0.03355112299323082,
0.005515912547707558,
-0.011234049685299397,
-0.05559663847088814,
0.036232005804777145,
-0.06202598288655281,
0.10926635563373566,
0.009019115008413792,
0.0863228589296341,
0.04329119622707367,
0.0335586853325367,
0.07788970321416855,
-0.0167834535241127,
-0.0041733733378350735,
0.02420649118721485,
0.060828227549791336,
-0.014429722912609577,
0.012624473311007023,
-0.06768137961626053,
0.026411646977066994,
-0.02177560329437256,
-0.0885082259774208,
-0.05801284685730934,
0.03630281239748001,
-0.02050745114684105,
0.06804464757442474,
0.015194172970950603,
-0.003951891791075468,
-0.010882955975830555,
-0.022630497813224792,
-0.01379335392266512,
0.004228923469781876,
0.11522870510816574,
0.07620437443256378,
0.08151543885469437,
0.04345337674021721,
0.06742606312036514,
0.07403990626335144,
-0.056702375411987305,
0.05257903039455414,
3.978765156863292e-33,
-0.06436742842197418,
-0.047160904854536057,
0.05421451851725578,
0.004353946540504694,
-0.002794850617647171,
-0.018904564902186394,
0.06662116199731827,
-0.029351571574807167,
-0.08902916312217712,
0.03406238555908203,
-0.04538484290242195,
0.046356845647096634,
-0.05897684767842293,
-0.02572472020983696,
-0.021124279126524925,
-0.0655314177274704,
0.10210319608449936,
-0.08269612491130829,
0.02057696133852005,
0.030497737228870392,
0.07043202966451645,
-0.044358063489198685,
-0.022646622732281685,
0.009032027795910835,
-0.03379403427243233,
-0.07707075029611588,
0.03847234323620796,
0.06073624640703201,
-0.03110249526798725,
-0.010127994231879711,
0.029637807980179787,
-0.009301579557359219,
0.028471404686570168,
-0.007654726505279541,
0.032744400203228,
-0.07686805725097656,
-0.003878176910802722,
-0.006595412269234657,
-0.1109706237912178,
-0.05354129523038864,
-0.036102455109357834,
0.06672439724206924,
-0.0001442134234821424,
-0.010201927274465561,
-0.07295164465904236,
-0.08348461985588074,
-0.09123441576957703,
0.014268648810684681,
0.01510640885680914,
0.019864503294229507,
0.09192509204149246,
0.04150842875242233,
0.016232743859291077,
-0.012425034306943417,
0.035087794065475464,
-0.03972521796822548,
0.041123971343040466,
0.048163123428821564,
-0.03753703832626343,
0.05535532534122467,
0.07033619284629822,
-0.09632936120033264,
-0.05509538576006889,
-0.004761111456900835,
-0.030284661799669266,
0.08924919366836548,
-0.004692074377089739,
0.04473521187901497,
0.04755718633532524,
0.012591797858476639,
0.006474663037806749,
-0.028635889291763306,
0.034122686833143234,
-0.04075295478105545,
0.044091273099184036,
0.022934965789318085,
-0.03939562663435936,
-0.0435175858438015,
-0.028808532282710075,
-0.047666996717453,
0.012990395538508892,
0.021318402141332626,
-0.0712440013885498,
0.09455833584070206,
-0.019616013392806053,
0.029550129547715187,
-0.02771402895450592,
-0.09855298697948456,
0.033770833164453506,
0.015558230690658092,
0.009199781343340874,
-0.05656623840332031,
0.07422423362731934,
-0.10116143524646759,
-0.0405130572617054,
-3.326012041825722e-33,
0.06548038870096207,
0.0555504709482193,
0.03632301092147827,
0.04570566117763519,
0.0008670532843098044,
0.020349401980638504,
-0.01858544908463955,
0.0625058114528656,
0.08344262838363647,
0.03929375857114792,
-0.021998396143317223,
-0.04034435749053955,
0.024039871990680695,
-0.007082694675773382,
-0.032772962003946304,
0.04281880706548691,
0.07975468039512634,
-0.11434949189424515,
0.0302182175219059,
-0.0030589548405259848,
0.005309246946126223,
-0.023060893639922142,
0.03128679841756821,
0.03612402826547623,
-0.0435512512922287,
0.09817830473184586,
-0.027841391041874886,
0.029058445245027542,
-0.021894104778766632,
-0.03592934086918831,
-0.05792299285531044,
-0.06192313879728317,
-0.08141905069351196,
-0.012221366167068481,
0.02718704380095005,
-0.0901549682021141,
0.033311184495687485,
0.14643694460391998,
-0.03272780030965805,
0.022448625415563583,
0.07387162744998932,
0.002145506674423814,
-0.006329827010631561,
-0.03472215682268143,
0.058421216905117035,
-0.03707801178097725,
0.03879991173744202,
0.04743868485093117,
0.006364981643855572,
-0.028930777683854103,
-0.01071953121572733,
0.00020540265541058034,
-0.01546885073184967,
0.07777998596429825,
-0.005585250910371542,
-0.04237178713083267,
-0.011966824531555176,
-0.07377048581838608,
0.03256142511963844,
-0.019235070794820786,
-0.008481115102767944,
-0.11051423847675323,
-0.004607862327247858,
0.009116306900978088,
0.03268157318234444,
-0.02550268918275833,
-0.05178780108690262,
-0.039908524602651596,
0.09163304418325424,
0.05558454617857933,
0.05177522823214531,
0.006680528167635202,
-0.049193646758794785,
-0.03572675213217735,
0.002987318905070424,
0.020266946405172348,
-0.0838385671377182,
-0.11015784740447998,
0.0003549170505721122,
0.14274263381958008,
-0.004445681348443031,
0.06287568062543869,
-0.008935319259762764,
0.05742376670241356,
0.06641141325235367,
-0.0062673501670360565,
0.07966046035289764,
-0.036110442131757736,
0.04564046114683151,
0.06188971549272537,
0.020371602848172188,
0.02990679442882538,
-0.04288536310195923,
-0.032209500670433044,
-0.03283504396677017,
-4.847734658142144e-8,
-0.09186239540576935,
-0.09731568396091461,
-0.09426859766244888,
0.03952150419354439,
0.056968651711940765,
-0.04896017163991928,
-0.0398118756711483,
-0.0009328054147772491,
0.038971953094005585,
-0.04709178954362869,
0.07805667817592621,
-0.04708004370331764,
-0.036554113030433655,
-0.05896447226405144,
0.013432529754936695,
-0.023303233087062836,
0.06350646167993546,
-0.032907865941524506,
-0.019817117601633072,
-0.04390419274568558,
0.019095471128821373,
0.03164567053318024,
0.014852293767035007,
0.07737378031015396,
0.004797231871634722,
0.030016010627150536,
0.06033019721508026,
-0.04184070974588394,
0.037411775439977646,
0.012695706449449062,
-0.04939287528395653,
-0.04594016447663307,
0.14553815126419067,
0.003845537779852748,
-0.03665278106927872,
-0.001357728149741888,
0.04620565101504326,
0.037140537053346634,
0.01803949475288391,
0.02881128154695034,
0.030554872006177902,
0.02602888084948063,
-0.014077902771532536,
0.0689648762345314,
-0.050799913704395294,
-0.10218070447444916,
-0.007602934259921312,
0.0014483509585261345,
0.02100037783384323,
-0.05124741792678833,
-0.001825467450544238,
-0.04418465122580528,
-0.07743068039417267,
0.05115146562457085,
-0.018078889697790146,
-0.053105056285858154,
0.042307350784540176,
-0.029065370559692383,
-0.03537647798657417,
-0.0040494115091860294,
0.10601860284805298,
-0.05847597122192383,
0.0354200154542923,
-0.03051384724676609
] | 0.061204 |
value obtained from the last call to `fn` or the `initial` value if specified or the first chunk of the stream otherwise. \* `data` {any} a chunk of data from the stream. \* `options` {Object} \* `signal` {AbortSignal} aborted if the stream is destroyed allowing to abort the `fn` call early. \* `initial` {any} the initial value to use in the reduction. \* `options` {Object} \* `signal` {AbortSignal} allows destroying the stream if the signal is aborted. \* Returns: {Promise} a promise for the final value of the reduction. This method calls `fn` on each chunk of the stream in order, passing it the result from the calculation on the previous element. It returns a promise for the final value of the reduction. If no `initial` value is supplied the first chunk of the stream is used as the initial value. If the stream is empty, the promise is rejected with a `TypeError` with the `ERR\_INVALID\_ARGS` code property. ```mjs import { Readable } from 'node:stream'; import { readdir, stat } from 'node:fs/promises'; import { join } from 'node:path'; const directoryPath = './src'; const filesInDir = await readdir(directoryPath); const folderSize = await Readable.from(filesInDir) .reduce(async (totalSize, file) => { const { size } = await stat(join(directoryPath, file)); return totalSize + size; }, 0); console.log(folderSize); ``` The reducer function iterates the stream element-by-element which means that there is no `concurrency` parameter or parallelism. To perform a `reduce` concurrently, you can extract the async function to [`readable.map`][] method. ```mjs import { Readable } from 'node:stream'; import { readdir, stat } from 'node:fs/promises'; import { join } from 'node:path'; const directoryPath = './src'; const filesInDir = await readdir(directoryPath); const folderSize = await Readable.from(filesInDir) .map((file) => stat(join(directoryPath, file)), { concurrency: 2 }) .reduce((totalSize, { size }) => totalSize + size, 0); console.log(folderSize); ``` ### Duplex and transform streams #### Class: `stream.Duplex` Duplex streams are streams that implement both the [`Readable`][] and [`Writable`][] interfaces. Examples of `Duplex` streams include: \* [TCP sockets][] \* [zlib streams][zlib] \* [crypto streams][crypto] ##### `duplex.allowHalfOpen` \* Type: {boolean} If `false` then the stream will automatically end the writable side when the readable side ends. Set initially by the `allowHalfOpen` constructor option, which defaults to `true`. This can be changed manually to change the half-open behavior of an existing `Duplex` stream instance, but must be changed before the `'end'` event is emitted. #### Class: `stream.Transform` Transform streams are [`Duplex`][] streams where the output is in some way related to the input. Like all [`Duplex`][] streams, `Transform` streams implement both the [`Readable`][] and [`Writable`][] interfaces. Examples of `Transform` streams include: \* [zlib streams][zlib] \* [crypto streams][crypto] ##### `transform.destroy([error])` \* `error` {Error} \* Returns: {this} Destroy the stream, and optionally emit an `'error'` event. After this call, the transform stream would release any internal resources. Implementors should not override this method, but instead implement [`readable.\_destroy()`][readable-\_destroy]. The default implementation of `\_destroy()` for `Transform` also emit `'close'` unless `emitClose` is set in false. Once `destroy()` has been called, any further calls will be a no-op and no further errors except from `\_destroy()` may be emitted as `'error'`. #### `stream.duplexPair([options])` \* `options` {Object} A value to pass to both [`Duplex`][] constructors, to set options such as buffering. \* Returns: {Array} of two [`Duplex`][] instances. The utility function `duplexPair` returns an Array with two items, each being a `Duplex` stream connected to the other side: ```js const [ sideA, sideB ] = duplexPair(); ``` Whatever is written to one stream is made readable on the other. It provides behavior analogous to a network connection, where the data written by the client becomes readable by the server, and vice-versa. The | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.1285158395767212,
0.10297756642103195,
0.05041923746466637,
0.05856718122959137,
0.017731700092554092,
-0.05800597369670868,
0.04612858220934868,
0.0820644274353981,
0.034255798906087875,
-0.010364759713411331,
-0.019798340275883675,
0.06582155078649521,
-0.05230066925287247,
-0.00005511850395123474,
0.0004343139298725873,
-0.023567723110318184,
-0.09912113845348358,
-0.027459392324090004,
-0.08014274388551712,
-0.07622572779655457,
0.09653104841709137,
0.03190379962325096,
-0.04143662750720978,
0.05290059372782707,
-0.0011974489316344261,
-0.01665920950472355,
-0.05603855475783348,
-0.021880291402339935,
0.08511484414339066,
-0.04188801720738411,
0.04975230619311333,
-0.006431393790990114,
-0.03418552130460739,
-0.04049986973404884,
-0.06654674559831619,
0.10577883571386337,
-0.018919020891189575,
-0.08477672934532166,
-0.05237353965640068,
0.005519925616681576,
0.08459613472223282,
0.05624004080891609,
-0.12793563306331635,
-0.06907893717288971,
0.006684490479528904,
0.0376303568482399,
0.0046690478920936584,
-0.03428272530436516,
-0.08471947908401489,
0.01200906652957201,
-0.06773068010807037,
0.08833377063274384,
-0.10990456491708755,
0.13355909287929535,
0.09872794896364212,
-0.032846082001924515,
-0.020773600786924362,
-0.037828799337148666,
-0.019584987312555313,
-0.04400968551635742,
-0.03889147564768791,
-0.03641871362924576,
-0.03199001029133797,
-0.01327492855489254,
0.0807550847530365,
-0.027548324316740036,
0.025616329163312912,
0.0002510569174773991,
0.07489538937807083,
0.07489579170942307,
0.019520044326782227,
-0.025041989982128143,
-0.005740026943385601,
0.014428405091166496,
0.022457726299762726,
-0.031195536255836487,
0.03304425626993179,
-0.0013740871800109744,
-0.005684984847903252,
0.0038167955353856087,
-0.02712240256369114,
-0.08276727050542831,
-0.002659431891515851,
-0.0311517883092165,
-0.07200417667627335,
0.03530849888920784,
-0.03699810430407524,
-0.02353423833847046,
0.07855989038944244,
0.0008587354677729309,
-0.05100216716527939,
-0.015208245255053043,
-0.065843366086483,
0.0757390633225441,
0.018048565834760666,
0.010924953036010265,
0.03987185284495354,
-0.08952303975820541,
-0.02378426119685173,
0.05146375298500061,
-0.0013453224673867226,
0.018450148403644562,
0.04943627864122391,
-0.04161638021469116,
0.02466866746544838,
-0.09036920219659805,
-0.026955295354127884,
-0.058701466768980026,
-0.00033763321698643267,
-0.0026073281187564135,
-0.044215984642505646,
0.018802734091877937,
0.0009590070112608373,
0.01938832364976406,
-0.020570043474435806,
0.08176364004611969,
0.013886900618672371,
0.007424835115671158,
0.04307081550359726,
0.06214035674929619,
0.06989792734384537,
-0.0017045660642907023,
0.05586761236190796,
0.03095809556543827,
0.03220810741186142,
0.0013237172970548272,
0.010926095768809319,
1.5093022366901772e-33,
-0.019642172381281853,
-0.09934774786233902,
-0.021458420902490616,
-0.021443061530590057,
0.04939218610525131,
0.02119920589029789,
0.02459375001490116,
0.011873714625835419,
-0.03179173171520233,
0.03617855906486511,
-0.052611514925956726,
-0.025977518409490585,
-0.06041749194264412,
0.027913790196180344,
0.03139118105173111,
-0.0620265007019043,
0.08644242584705353,
-0.03632571920752525,
0.006412678398191929,
0.053246043622493744,
0.10639678686857224,
0.0150569723919034,
-0.04660903289914131,
-0.02292863465845585,
-0.025313472375273705,
-0.0032357992604374886,
-0.04030231386423111,
0.03156184405088425,
-0.0493096224963665,
0.004008266143500805,
-0.023693615570664406,
0.01973940059542656,
-0.016658976674079895,
-0.039136361330747604,
0.09019441902637482,
-0.0793091356754303,
0.006093575153499842,
-0.0309077687561512,
-0.11202146112918854,
-0.06077326834201813,
-0.0160144604742527,
0.06403117626905441,
-0.059934429824352264,
0.009234198369085789,
0.006446502171456814,
-0.14238160848617554,
-0.030344879254698753,
0.04683016240596771,
0.07025472074747086,
0.035003989934921265,
0.07417532056570053,
0.029756203293800354,
0.04664472118020058,
-0.013967384584248066,
0.031052710488438606,
0.004852331709116697,
0.011751818470656872,
0.00013405231584329158,
0.023237023502588272,
-0.018561657518148422,
0.09779565036296844,
-0.043140709400177,
0.02615818940103054,
0.03361019864678383,
0.003940979018807411,
0.07819461077451706,
0.0025487339589744806,
-0.01407372485846281,
0.05866387486457825,
-0.05340215936303139,
-0.08781266212463379,
0.04958505555987358,
-0.00416342681273818,
0.012168776243925095,
0.027748875319957733,
-0.013024600222706795,
0.0037528490647673607,
-0.0654526948928833,
0.0586194172501564,
-0.06631124764680862,
0.037445519119501114,
0.02088901214301586,
-0.025562020018696785,
0.04052352160215378,
-0.03377159684896469,
0.06263075768947601,
0.03636647015810013,
-0.08016393333673477,
0.010931716300547123,
-0.05751024931669235,
-0.03548358753323555,
-0.013653671368956566,
0.015541544184088707,
-0.10397198051214218,
-0.0447380430996418,
-3.7391509190237384e-33,
0.07272428274154663,
0.02093174308538437,
-0.027550622820854187,
0.02910223975777626,
-0.027445245534181595,
-0.025039192289114,
0.07371806353330612,
0.02899581380188465,
0.09298347681760788,
-0.0004917106707580388,
-0.02099507488310337,
-0.01957743801176548,
0.07660377770662308,
0.0027988229412585497,
0.021258926019072533,
0.020492443814873695,
-0.03164069354534149,
-0.16540825366973877,
0.018689941614866257,
-0.018846619874238968,
-0.05324331670999527,
-0.03336357697844505,
0.00039364502299577,
-0.0006226279656402767,
-0.06012961268424988,
0.024107178673148155,
-0.003258002456277609,
0.034332796931266785,
0.02747868373990059,
-0.09124398231506348,
-0.013982826843857765,
-0.04323095828294754,
-0.07542447745800018,
0.02911248803138733,
0.00496632419526577,
-0.05440910533070564,
0.06088739261031151,
0.14168749749660492,
-0.07645709812641144,
-0.059628985822200775,
0.1484643518924713,
0.0705236941576004,
-0.019377097487449646,
0.01887579634785652,
0.018506288528442383,
-0.020970843732357025,
0.04525792971253395,
0.012113071046769619,
-0.0009373210486955941,
-0.02683582715690136,
0.019577423110604286,
0.005284955725073814,
-0.032258909195661545,
0.09098080545663834,
-0.006226715166121721,
-0.02855106256902218,
0.12343503534793854,
-0.05728308483958244,
-0.020866690203547478,
0.02297975867986679,
-0.03247587010264397,
-0.07452135533094406,
0.014689730480313301,
0.040796589106321335,
0.03171530365943909,
0.06644628196954727,
-0.05367598682641983,
-0.013531231321394444,
0.11477286368608475,
-0.03189782053232193,
0.07736565172672272,
0.008435756899416447,
0.005636133719235659,
-0.033929258584976196,
0.04937751218676567,
0.023877380415797234,
-0.07431675493717194,
-0.0921953096985817,
0.030657855793833733,
0.05687849968671799,
-0.025994928553700447,
0.029231034219264984,
-0.03437146916985512,
0.06709455698728561,
-0.004474719520658255,
-0.06650987267494202,
0.013429579325020313,
-0.027919691056013107,
-0.011303485371172428,
0.0068471720442175865,
0.007063086610287428,
0.03025834448635578,
-0.06388931721448898,
0.038272250443696976,
-0.034929823130369186,
-5.332487518217022e-8,
-0.06974916160106659,
-0.06649313122034073,
-0.06519730389118195,
0.046773746609687805,
0.036491360515356064,
-0.08584776520729065,
-0.05752236396074295,
-0.03897147998213768,
0.0178342554718256,
-0.08731449395418167,
0.04447709023952484,
-0.00783534999936819,
0.03346327319741249,
-0.04875314608216286,
0.024073053151369095,
-0.0013235731748864055,
0.00975499115884304,
-0.01071743294596672,
-0.035676468163728714,
-0.01538134552538395,
-0.012528041377663612,
-0.03478468954563141,
-0.03257950395345688,
-0.010170377790927887,
0.027091657742857933,
0.03316713124513626,
0.09020703285932541,
0.12160947173833847,
-0.0485231988132,
-0.02976943552494049,
-0.005528731271624565,
0.019057705998420715,
0.12022612243890762,
0.07868453115224838,
-0.04483802989125252,
0.02479594014585018,
0.03560788556933403,
0.05645981803536415,
0.01273688767105341,
0.07653802633285522,
0.020714545622467995,
-0.004917860962450504,
-0.02568671852350235,
0.010105227120220661,
0.006399250589311123,
-0.019729269668459892,
-0.015897592529654503,
-0.034042198210954666,
0.026248542591929436,
0.01863795332610607,
-0.013021983206272125,
0.03226139768958092,
-0.034916989505290985,
0.04941035807132721,
-0.00421294616535306,
-0.06905243545770645,
0.0065007335506379604,
-0.09307991713285446,
-0.09629600495100021,
-0.021716173738241196,
0.08439119905233383,
-0.012968536466360092,
0.031817477196455,
-0.03290720283985138
] | 0.1668 |
stream connected to the other side: ```js const [ sideA, sideB ] = duplexPair(); ``` Whatever is written to one stream is made readable on the other. It provides behavior analogous to a network connection, where the data written by the client becomes readable by the server, and vice-versa. The Duplex streams are symmetrical; one or the other may be used without any difference in behavior. ### `stream.finished(stream[, options], callback)` \* `stream` {Stream|ReadableStream|WritableStream} A readable and/or writable stream/webstream. \* `options` {Object} \* `error` {boolean} If set to `false`, then a call to `emit('error', err)` is not treated as finished. \*\*Default:\*\* `true`. \* `readable` {boolean} When set to `false`, the callback will be called when the stream ends even though the stream might still be readable. \*\*Default:\*\* `true`. \* `writable` {boolean} When set to `false`, the callback will be called when the stream ends even though the stream might still be writable. \*\*Default:\*\* `true`. \* `signal` {AbortSignal} allows aborting the wait for the stream finish. The underlying stream will \_not\_ be aborted if the signal is aborted. The callback will get called with an `AbortError`. All registered listeners added by this function will also be removed. \* `callback` {Function} A callback function that takes an optional error argument. \* Returns: {Function} A cleanup function which removes all registered listeners. A function to get notified when a stream is no longer readable, writable or has experienced an error or a premature close event. ```js const { finished } = require('node:stream'); const fs = require('node:fs'); const rs = fs.createReadStream('archive.tar'); finished(rs, (err) => { if (err) { console.error('Stream failed.', err); } else { console.log('Stream is done reading.'); } }); rs.resume(); // Drain the stream. ``` Especially useful in error handling scenarios where a stream is destroyed prematurely (like an aborted HTTP request), and will not emit `'end'` or `'finish'`. The `finished` API provides [promise version][stream-finished-promise]. `stream.finished()` leaves dangling event listeners (in particular `'error'`, `'end'`, `'finish'` and `'close'`) after `callback` has been invoked. The reason for this is so that unexpected `'error'` events (due to incorrect stream implementations) do not cause unexpected crashes. If this is unwanted behavior then the returned cleanup function needs to be invoked in the callback: ```js const cleanup = finished(rs, (err) => { cleanup(); // ... }); ``` ### `stream.pipeline(source[, ...transforms], destination, callback)` ### `stream.pipeline(streams, callback)` \* `streams` {Stream\[]|Iterable\[]|AsyncIterable\[]|Function\[]| ReadableStream\[]|WritableStream\[]|TransformStream\[]} \* `source` {Stream|Iterable|AsyncIterable|Function|ReadableStream} \* Returns: {Iterable|AsyncIterable} \* `...transforms` {Stream|Function|TransformStream} \* `source` {AsyncIterable} \* Returns: {AsyncIterable} \* `destination` {Stream|Function|WritableStream} \* `source` {AsyncIterable} \* Returns: {AsyncIterable|Promise} \* `callback` {Function} Called when the pipeline is fully done. \* `err` {Error} \* `val` Resolved value of `Promise` returned by `destination`. \* Returns: {Stream} A module method to pipe between streams and generators forwarding errors and properly cleaning up and provide a callback when the pipeline is complete. ```js const { pipeline } = require('node:stream'); const fs = require('node:fs'); const zlib = require('node:zlib'); // Use the pipeline API to easily pipe a series of streams // together and get notified when the pipeline is fully done. // A pipeline to gzip a potentially huge tar file efficiently: pipeline( fs.createReadStream('archive.tar'), zlib.createGzip(), fs.createWriteStream('archive.tar.gz'), (err) => { if (err) { console.error('Pipeline failed.', err); } else { console.log('Pipeline succeeded.'); } }, ); ``` The `pipeline` API provides a [promise version][stream-pipeline-promise]. `stream.pipeline()` will call `stream.destroy(err)` on all streams except: \* `Readable` streams which have emitted `'end'` or `'close'`. \* `Writable` streams which have emitted `'finish'` or `'close'`. `stream.pipeline()` leaves dangling event listeners on the streams after the `callback` has been invoked. In the case of reuse of streams after failure, this can cause event listener leaks and swallowed errors. If | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.07465671747922897,
-0.030356161296367645,
-0.024412866681814194,
0.022889016196131706,
-0.0221610926091671,
-0.02634170651435852,
-0.051282722502946854,
0.0330209843814373,
0.02148444578051567,
-0.049511197954416275,
-0.030302131548523903,
0.10790958255529404,
-0.06060982123017311,
0.03252686187624931,
0.0020079545211046934,
-0.03929569944739342,
-0.013574928045272827,
-0.04016212746500969,
-0.04046754166483879,
-0.008571273647248745,
0.013663285411894321,
-0.08251805603504181,
-0.08681600540876389,
-0.025791553780436516,
0.010382852517068386,
0.06227177754044533,
0.03059714287519455,
-0.0014202998718246818,
0.03269137069582939,
-0.04263787344098091,
0.00742217106744647,
-0.02636023983359337,
-0.1689307540655136,
-0.05540767312049866,
-0.07742343097925186,
0.06464777141809464,
0.013383730314671993,
-0.0742427408695221,
-0.017218369990587234,
0.004469181410968304,
0.07736799120903015,
0.05948098748922348,
-0.10572812706232071,
0.01833128184080124,
-0.0805526077747345,
0.017248054966330528,
-0.10870348662137985,
-0.023362532258033752,
-0.060042377561330795,
0.019579172134399414,
-0.07531402260065079,
0.028280790895223618,
-0.045471563935279846,
0.10163780301809311,
0.05297603830695152,
0.03594588488340378,
-0.06950290501117706,
0.07499773055315018,
0.0034319215919822454,
0.03720066323876381,
-0.0486866757273674,
-0.028622126206755638,
0.03529227897524834,
0.0643300712108612,
0.09159781783819199,
-0.06923829019069672,
-0.019058115780353546,
0.08900709450244904,
-0.01031258050352335,
0.02150128409266472,
-0.018029991537332535,
0.06390591710805893,
-0.04196586087346077,
-0.0010090537834912539,
0.008688762784004211,
-0.10115715116262436,
0.03571942448616028,
0.05263511836528778,
-0.05285398289561272,
0.021343981847167015,
-0.04618591442704201,
-0.08433685451745987,
-0.035284318029880524,
0.010966151021420956,
-0.006942199543118477,
0.021598100662231445,
-0.018934790045022964,
-0.015394413843750954,
0.046233296394348145,
0.02044905535876751,
-0.07784274965524673,
0.030083242803812027,
0.053582288324832916,
0.054420411586761475,
0.004199327901005745,
0.09156062453985214,
0.006301325745880604,
0.03360341116786003,
-0.021211544051766396,
-0.026989556849002838,
0.02327571250498295,
0.00373048335313797,
0.08253245800733566,
0.026760173961520195,
0.058750081807374954,
-0.08422794193029404,
0.013985179364681244,
0.04225284233689308,
0.0478009358048439,
-0.0393228754401207,
-0.011893779039382935,
0.04399856925010681,
0.06657472252845764,
-0.03079565055668354,
-0.04823889583349228,
0.06857510656118393,
-0.009970985352993011,
0.013388861902058125,
0.0606156624853611,
0.05614231154322624,
0.05586770176887512,
-0.03932971507310867,
0.01718885451555252,
0.014150549657642841,
0.11742742359638214,
-0.07313146442174911,
0.07152187079191208,
3.275500314886919e-33,
-0.023720232769846916,
-0.11209344118833542,
-0.06287077814340591,
0.0758574828505516,
0.031750500202178955,
0.016825467348098755,
0.005342644173651934,
0.035329267382621765,
-0.14508095383644104,
-0.01772203855216503,
-0.028066394850611687,
0.028550976887345314,
-0.05105209723114967,
0.02846825122833252,
-0.03581826388835907,
-0.041352104395627975,
0.0438346229493618,
0.006634983699768782,
-0.056689221411943436,
0.06621386855840683,
0.09238627552986145,
-0.001801688689738512,
-0.02032414637506008,
0.0014128133188933134,
-0.023401444777846336,
-0.048014890402555466,
0.0039545828476548195,
0.007577975280582905,
-0.01409481093287468,
0.0013571541057899594,
0.023710429668426514,
0.016202881932258606,
0.011066485196352005,
0.018019994720816612,
0.0668318048119545,
-0.02866683341562748,
-0.0022135411854833364,
-0.04807489737868309,
-0.10725535452365875,
-0.03316585719585419,
-0.016734110191464424,
0.01135469600558281,
-0.11167227476835251,
-0.062167007476091385,
-0.013090579770505428,
-0.1297135055065155,
-0.03740251064300537,
0.008264291100203991,
0.022675827145576477,
-0.01461578905582428,
-0.01786460168659687,
0.07770293951034546,
0.042108550667762756,
0.034695982933044434,
0.052225079387426376,
0.009575805626809597,
0.022582340985536575,
0.04032658413052559,
-0.023656848818063736,
0.06205028295516968,
0.04793671518564224,
0.09577018022537231,
-0.042211003601551056,
-0.060586199164390564,
-0.0004498396592680365,
0.032635901123285294,
-0.0006037781131453812,
-0.01825021579861641,
0.05961032211780548,
-0.10976208746433258,
-0.08804604411125183,
0.007289917673915625,
0.009656207635998726,
0.05630681663751602,
-0.010885451920330524,
-0.022739116102457047,
-0.0841277688741684,
-0.023942478001117706,
0.08064083009958267,
-0.023316165432333946,
0.002723224926739931,
-0.0388970747590065,
0.006862817332148552,
0.07464122027158737,
-0.015455348417162895,
-0.012167597189545631,
-0.0668734461069107,
-0.10103026777505875,
-0.007510446012020111,
0.10268887877464294,
0.042356956750154495,
0.04824645817279816,
0.07468858361244202,
-0.0801953449845314,
-0.014924323186278343,
-5.7156561405131185e-33,
-0.0468149296939373,
-0.028255390003323555,
-0.07048659771680832,
0.07892745733261108,
-0.05467859283089638,
0.00828617811203003,
0.037418827414512634,
0.03885537385940552,
0.06490398943424225,
-0.005964999087154865,
0.023134732618927956,
0.014088585041463375,
-0.0956985205411911,
-0.012523734010756016,
0.0026752303820103407,
0.021373458206653595,
0.007411174941807985,
-0.07478904724121094,
0.003393442602828145,
-0.056055858731269836,
0.002758684568107128,
-0.045565854758024216,
0.08022996038198471,
0.040547117590904236,
0.019526798278093338,
0.03791783004999161,
-0.00939542893320322,
0.03837045282125473,
-0.04843636974692345,
-0.023307036608457565,
0.026833035051822662,
-0.002292771590873599,
-0.06393788754940033,
0.004278989974409342,
0.0077427830547094345,
-0.019616341218352318,
0.02779080718755722,
0.07870283722877502,
-0.0009456145344302058,
-0.030249739065766335,
0.08784468472003937,
0.0003019036666955799,
-0.015299627557396889,
0.007487939205020666,
0.03513246402144432,
0.02438303641974926,
-0.07801200449466705,
0.021723274141550064,
-0.03976975753903389,
-0.016345113515853882,
0.02846934087574482,
-0.003252259222790599,
-0.010640846565365791,
0.06071427837014198,
0.028919987380504608,
-0.05310959368944168,
0.06130870431661606,
-0.015194877050817013,
0.045857325196266174,
0.05988965928554535,
0.08631115406751633,
-0.10084720700979233,
-0.02482672594487667,
-0.0423382893204689,
-0.006073581054806709,
0.028862347826361656,
-0.033217377960681915,
0.017684897407889366,
0.10494833439588547,
-0.00013978408242110163,
0.03437868878245354,
-0.00667995773255825,
-0.032599471509456635,
-0.04950632154941559,
0.07941795885562897,
0.03931017592549324,
-0.009501766413450241,
-0.07214852422475815,
-0.004234931897372007,
0.08812160789966583,
-0.049321625381708145,
0.10441415756940842,
-0.07094813138246536,
0.04506126791238785,
0.042924512177705765,
0.0056761098094284534,
0.0021276173647493124,
-0.03172621130943298,
-0.05487794429063797,
-0.05758824944496155,
-0.006972149480134249,
0.039430323988199234,
-0.11648992449045181,
0.010912575758993626,
-0.007397545967251062,
-4.748238069396393e-8,
-0.07995887100696564,
-0.05775969475507736,
-0.1031055897474289,
-0.04678614065051079,
-0.041826795786619186,
-0.11309614032506943,
-0.014784758910536766,
-0.06835313886404037,
0.03351709619164467,
-0.0001289000065298751,
-0.016478082165122032,
0.018589891493320465,
-0.005369510035961866,
-0.02932245470583439,
0.0584663525223732,
-0.015165014192461967,
0.023128116503357887,
-0.04306522011756897,
-0.027720702812075615,
0.012995767407119274,
0.07531633228063583,
-0.06495914608240128,
-0.04551183432340622,
0.1403113752603531,
0.010319719091057777,
0.018778810277581215,
0.08262897282838821,
0.04856281727552414,
0.002500903094187379,
-0.08115509897470474,
-0.03564631938934326,
0.030249731615185738,
0.0745047926902771,
0.06410462409257889,
-0.016088783740997314,
0.04775937646627426,
0.019132649526000023,
0.06140778213739395,
-0.03975700959563255,
0.06323959678411484,
0.08282629400491714,
-0.007533565163612366,
-0.011911265552043915,
0.04463351145386696,
0.06108488142490387,
0.028063399717211723,
0.01657358556985855,
0.020893186330795288,
-0.01769672892987728,
-0.04876870661973953,
-0.04159892350435257,
0.015426591970026493,
-0.0076636155135929585,
0.006782013922929764,
0.006409004330635071,
-0.07071609050035477,
-0.009715091437101364,
-0.10010289400815964,
-0.012241442687809467,
0.00924715306609869,
0.06079345569014549,
0.07977990061044693,
0.01892448589205742,
0.009468324482440948
] | 0.083935 |
`Readable` streams which have emitted `'end'` or `'close'`. \* `Writable` streams which have emitted `'finish'` or `'close'`. `stream.pipeline()` leaves dangling event listeners on the streams after the `callback` has been invoked. In the case of reuse of streams after failure, this can cause event listener leaks and swallowed errors. If the last stream is readable, dangling event listeners will be removed so that the last stream can be consumed later. `stream.pipeline()` closes all the streams when an error is raised. The `IncomingRequest` usage with `pipeline` could lead to an unexpected behavior once it would destroy the socket without sending the expected response. See the example below: ```js const fs = require('node:fs'); const http = require('node:http'); const { pipeline } = require('node:stream'); const server = http.createServer((req, res) => { const fileStream = fs.createReadStream('./fileNotExist.txt'); pipeline(fileStream, res, (err) => { if (err) { console.log(err); // No such file // this message can't be sent once `pipeline` already destroyed the socket return res.end('error!!!'); } }); }); ``` ### `stream.compose(...streams)` > Stability: 1 - `stream.compose` is experimental. \* `streams` {Stream\[]|Iterable\[]|AsyncIterable\[]|Function\[]| ReadableStream\[]|WritableStream\[]|TransformStream\[]|Duplex\[]|Function} \* Returns: {stream.Duplex} Combines two or more streams into a `Duplex` stream that writes to the first stream and reads from the last. Each provided stream is piped into the next, using `stream.pipeline`. If any of the streams error then all are destroyed, including the outer `Duplex` stream. Because `stream.compose` returns a new stream that in turn can (and should) be piped into other streams, it enables composition. In contrast, when passing streams to `stream.pipeline`, typically the first stream is a readable stream and the last a writable stream, forming a closed circuit. If passed a `Function` it must be a factory method taking a `source` `Iterable`. ```mjs import { compose, Transform } from 'node:stream'; const removeSpaces = new Transform({ transform(chunk, encoding, callback) { callback(null, String(chunk).replace(' ', '')); }, }); async function\* toUpper(source) { for await (const chunk of source) { yield String(chunk).toUpperCase(); } } let res = ''; for await (const buf of compose(removeSpaces, toUpper).end('hello world')) { res += buf; } console.log(res); // prints 'HELLOWORLD' ``` `stream.compose` can be used to convert async iterables, generators and functions into streams. \* `AsyncIterable` converts into a readable `Duplex`. Cannot yield `null`. \* `AsyncGeneratorFunction` converts into a readable/writable transform `Duplex`. Must take a source `AsyncIterable` as first parameter. Cannot yield `null`. \* `AsyncFunction` converts into a writable `Duplex`. Must return either `null` or `undefined`. ```mjs import { compose } from 'node:stream'; import { finished } from 'node:stream/promises'; // Convert AsyncIterable into readable Duplex. const s1 = compose(async function\*() { yield 'Hello'; yield 'World'; }()); // Convert AsyncGenerator into transform Duplex. const s2 = compose(async function\*(source) { for await (const chunk of source) { yield String(chunk).toUpperCase(); } }); let res = ''; // Convert AsyncFunction into writable Duplex. const s3 = compose(async function(source) { for await (const chunk of source) { res += chunk; } }); await finished(compose(s1, s2, s3)); console.log(res); // prints 'HELLOWORLD' ``` For convenience, the [`readable.compose(stream)`][] method is available on {Readable} and {Duplex} streams as a wrapper for this function. ### `stream.isErrored(stream)` \* `stream` {Readable|Writable|Duplex|WritableStream|ReadableStream} \* Returns: {boolean} Returns whether the stream has encountered an error. ### `stream.isReadable(stream)` \* `stream` {Readable|Duplex|ReadableStream} \* Returns: {boolean|null} - Only returns `null` if `stream` is not a valid `Readable`, `Duplex` or `ReadableStream`. Returns whether the stream is readable. ### `stream.isWritable(stream)` \* `stream` {Writable|Duplex|WritableStream} \* Returns: {boolean|null} - Only returns `null` if `stream` is not a valid `Writable`, `Duplex` or `WritableStream`. Returns whether the stream is writable. ### `stream.Readable.from(iterable[, options])` \* `iterable` {Iterable} Object implementing the `Symbol.asyncIterator` or `Symbol.iterator` iterable protocol. Emits an 'error' event if a null value | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.05825020745396614,
0.0022977322805672884,
0.030664950609207153,
0.027620961889624596,
0.017816990613937378,
-0.06778403371572495,
-0.024218646809458733,
0.050072528421878815,
0.07099037617444992,
0.007582810241729021,
-0.09170488268136978,
0.09841395169496536,
-0.0759623572230339,
0.007705440279096365,
-0.04291249439120293,
-0.029731350019574165,
0.0058964951895177364,
-0.0035911952145397663,
-0.07035079598426819,
-0.06829667091369629,
-0.00639966269955039,
0.006611865479499102,
-0.019609270617365837,
-0.0034280228428542614,
-0.023823600262403488,
-0.0016813799738883972,
-0.06114642322063446,
-0.11246238648891449,
0.035272859036922455,
0.014941910281777382,
0.05229603871703148,
-0.09059406071901321,
-0.13719442486763,
-0.040789779275655746,
-0.05111195519566536,
0.1014203205704689,
0.018767984583973885,
-0.10138805955648422,
-0.06268025189638138,
0.01564023643732071,
0.06708522140979767,
0.02014491707086563,
-0.08728776127099991,
-0.000017066553482436575,
-0.017978403717279434,
-0.0160551555454731,
-0.025640586391091347,
-0.0871066078543663,
-0.08749926835298538,
0.06837712973356247,
-0.0341070219874382,
0.019474176689982414,
-0.04938342422246933,
0.0984393060207367,
0.05726555734872818,
-0.06245017796754837,
-0.013788956217467785,
0.005883004982024431,
-0.032407987862825394,
0.03620193526148796,
-0.06046152487397194,
-0.07841747999191284,
-0.01597117818892002,
0.013588419184088707,
0.06580609828233719,
0.0048037366941571236,
0.004726175218820572,
0.024611525237560272,
0.05258186534047127,
0.040102846920490265,
0.026410965248942375,
0.061712250113487244,
-0.10667424649000168,
-0.023319780826568604,
-0.004518690053373575,
-0.017186611890792847,
-0.006595795974135399,
-0.018107658252120018,
-0.06513917446136475,
0.08145752549171448,
-0.006000934634357691,
-0.10095997154712677,
-0.02811567112803459,
-0.022037265822291374,
-0.019871994853019714,
0.08439689129590988,
0.005407447926700115,
-0.02976221963763237,
0.0272630974650383,
0.012138254940509796,
-0.1254466325044632,
-0.002415228867903352,
0.0280749574303627,
0.12247510254383087,
0.011730965226888657,
0.03134652227163315,
0.022081580013036728,
0.0030696953181177378,
-0.0052597844041883945,
-0.01834949664771557,
0.0001908645499497652,
0.04063798114657402,
0.03601064905524254,
-0.0020736390724778175,
0.035081569105386734,
-0.03327396884560585,
-0.07805105298757553,
0.05746149271726608,
-0.039456211030483246,
-0.04006078094244003,
0.0015186623204499483,
-0.03979302942752838,
0.055764179676771164,
0.007142374757677317,
-0.03197376802563667,
0.05688070133328438,
-0.002106948522850871,
-0.018830321729183197,
-0.012710027396678925,
0.08801646530628204,
0.05112692341208458,
-0.01666560396552086,
-0.020710252225399017,
0.00034290316398255527,
0.08480670303106308,
-0.06511155515909195,
0.06046408414840698,
2.3136527970105514e-33,
-0.044879648834466934,
-0.07665988802909851,
-0.06187359616160393,
0.017017101868987083,
0.09015097469091415,
-0.00831826776266098,
0.03947065770626068,
-0.02116161398589611,
-0.06053872033953667,
-0.04179433733224869,
0.029782982543110847,
-0.05116013437509537,
0.020121019333600998,
-0.03262609243392944,
0.023669730871915817,
-0.036009326577186584,
0.0793042927980423,
0.012836816720664501,
0.031613789498806,
0.058511458337306976,
0.032398391515016556,
-0.006996779702603817,
-0.04700760915875435,
0.0003945089119952172,
-0.013067034073174,
-0.04423661157488823,
-0.010261688381433487,
0.022209344431757927,
-0.028883857652544975,
-0.0022735826205462217,
-0.010617357678711414,
0.0341142937541008,
0.04967933148145676,
-0.00823301449418068,
0.029260987415909767,
-0.06812801212072372,
0.06500670313835144,
0.004533205647021532,
-0.07698050886392593,
-0.03006347268819809,
0.0437602773308754,
0.06127741187810898,
-0.11012446880340576,
0.04946694150567055,
0.006079717073589563,
-0.1393614560365677,
-0.06155737489461899,
-0.04677874222397804,
0.010534311644732952,
-0.03251808509230614,
0.035314273089170456,
0.06354847550392151,
0.12270251661539078,
0.023968586698174477,
0.05221959948539734,
0.0037254802882671356,
0.0071698687970638275,
-0.011805680580437183,
-0.034705523401498795,
0.03642746061086655,
0.05038421228528023,
0.04818735271692276,
0.006802815478295088,
-0.010790479369461536,
0.03625185042619705,
-0.012634082697331905,
0.03518126159906387,
0.03873980790376663,
0.02516535110771656,
-0.03161483630537987,
-0.05560417100787163,
0.00769851403310895,
-0.026972420513629913,
0.020378751680254936,
0.03894336521625519,
0.043334007263183594,
0.000290024618152529,
-0.00687385443598032,
0.06834778934717178,
-0.03717580810189247,
0.05638045445084572,
-0.025549201294779778,
0.04768634960055351,
0.09707567095756531,
0.012197287753224373,
0.05167907848954201,
-0.0551287867128849,
-0.08532905578613281,
-0.01853930577635765,
0.06521153450012207,
-0.006635692436248064,
0.023327946662902832,
0.03558339551091194,
-0.05623403564095497,
-0.030775191262364388,
-3.55921873342734e-33,
-0.015780610963702202,
0.0076738824136555195,
-0.12686362862586975,
0.08311960846185684,
-0.012520784512162209,
-0.02711717039346695,
-0.007496863137930632,
0.01940828375518322,
0.03738560155034065,
-0.021906418725848198,
-0.028387296944856644,
0.05818723142147064,
-0.02286473475396633,
0.07417946308851242,
-0.05239352956414223,
-0.057683758437633514,
-0.004858042113482952,
-0.11936338990926743,
0.017629403620958328,
-0.056641895323991776,
0.012155323289334774,
-0.06643828749656677,
0.07673440873622894,
0.005423640366643667,
-0.06202462315559387,
0.05236227065324783,
-0.07247477024793625,
-0.04532189294695854,
-0.0440511479973793,
-0.07367921620607376,
-0.015133263543248177,
-0.03702988103032112,
0.0026297899894416332,
0.004941409919410944,
0.00853960681706667,
-0.01571231335401535,
0.010167780332267284,
0.11949598789215088,
0.050868406891822815,
-0.026561351493000984,
0.1000482439994812,
0.05521419271826744,
0.01909654028713703,
-0.04710644856095314,
0.017803022637963295,
-0.02332121692597866,
0.017530420795083046,
0.0016177707584574819,
-0.025836842134594917,
-0.0036226455122232437,
-0.0572882816195488,
0.033368069678545,
0.0012012951774522662,
0.12286520004272461,
-0.012348821386694908,
-0.019203927367925644,
0.09956156462430954,
-0.015137904323637486,
0.033926643431186676,
-0.0024560040328651667,
0.08252552896738052,
-0.051890164613723755,
0.011578474193811417,
-0.02844846621155739,
0.05154333636164665,
-0.0036622805055230856,
-0.013657727278769016,
0.00009113668056670576,
0.12933507561683655,
-0.01903776451945305,
0.03383379057049751,
0.003961435053497553,
-0.06150383874773979,
0.007599825505167246,
0.05004081502556801,
0.03755398467183113,
-0.0670284554362297,
-0.08003287017345428,
0.010424219071865082,
0.10116060823202133,
-0.06917745620012283,
0.10754464566707611,
-0.10154715925455093,
0.07733003050088882,
0.15099342167377472,
-0.0015895100077614188,
-0.032337088137865067,
-0.0532352440059185,
0.014864355325698853,
-0.0021624474320560694,
0.018489977344870567,
0.017513466998934746,
-0.1262776404619217,
-0.03980265185236931,
-0.024369515478610992,
-4.740158487948065e-8,
-0.033883288502693176,
0.02844993956387043,
-0.10553272813558578,
0.0667133778333664,
0.044543586671352386,
-0.06408599764108658,
0.029200615361332893,
-0.0015608534449711442,
0.01387990452349186,
-0.0008871565223671496,
-0.025458531454205513,
-0.03436177968978882,
0.05253974348306656,
0.009436678141355515,
0.03952652961015701,
-0.01870219223201275,
0.054214056581258774,
-0.015548759140074253,
-0.02616656944155693,
-0.037130262702703476,
0.0028677727095782757,
-0.007556423079222441,
-0.03779095411300659,
0.06699593365192413,
-0.07427115738391876,
-0.01776053011417389,
0.15114562213420868,
0.016839653253555298,
-0.04275726154446602,
-0.04750705510377884,
-0.07147182524204254,
0.0318400077521801,
0.03283150494098663,
0.054435305297374725,
-0.05008246377110481,
0.03361406922340393,
-0.029487770050764084,
-0.011920474469661713,
-0.02063743583858013,
0.023393984884023666,
0.07231336832046509,
0.0047091334126889706,
0.013975497335195541,
0.0619795098900795,
-0.02217390201985836,
0.027824627235531807,
0.05881517753005028,
0.058887407183647156,
-0.012473777867853642,
0.014201123267412186,
0.0077933561988174915,
-0.017287570983171463,
-0.04150497168302536,
-0.022588402032852173,
0.0707346722483635,
-0.06261749565601349,
0.03553296625614166,
-0.07071002572774887,
-0.055610038340091705,
-0.028451532125473022,
0.11427046358585358,
0.03381766378879547,
0.0016801984747871757,
-0.021499745547771454
] | 0.051266 |
### `stream.isWritable(stream)` \* `stream` {Writable|Duplex|WritableStream} \* Returns: {boolean|null} - Only returns `null` if `stream` is not a valid `Writable`, `Duplex` or `WritableStream`. Returns whether the stream is writable. ### `stream.Readable.from(iterable[, options])` \* `iterable` {Iterable} Object implementing the `Symbol.asyncIterator` or `Symbol.iterator` iterable protocol. Emits an 'error' event if a null value is passed. \* `options` {Object} Options provided to `new stream.Readable([options])`. By default, `Readable.from()` will set `options.objectMode` to `true`, unless this is explicitly opted out by setting `options.objectMode` to `false`. \* Returns: {stream.Readable} A utility method for creating readable streams out of iterators. ```js const { Readable } = require('node:stream'); async function \* generate() { yield 'hello'; yield 'streams'; } const readable = Readable.from(generate()); readable.on('data', (chunk) => { console.log(chunk); }); ``` Calling `Readable.from(string)` or `Readable.from(buffer)` will not have the strings or buffers be iterated to match the other streams semantics for performance reasons. If an `Iterable` object containing promises is passed as an argument, it might result in unhandled rejection. ```js const { Readable } = require('node:stream'); Readable.from([ new Promise((resolve) => setTimeout(resolve('1'), 1500)), new Promise((\_, reject) => setTimeout(reject(new Error('2')), 1000)), // Unhandled rejection ]); ``` ### `stream.Readable.fromWeb(readableStream[, options])` \* `readableStream` {ReadableStream} \* `options` {Object} \* `encoding` {string} \* `highWaterMark` {number} \* `objectMode` {boolean} \* `signal` {AbortSignal} \* Returns: {stream.Readable} ### `stream.Readable.isDisturbed(stream)` \* `stream` {stream.Readable|ReadableStream} \* Returns: `boolean` Returns whether the stream has been read from or cancelled. ### `stream.Readable.toWeb(streamReadable[, options])` \* `streamReadable` {stream.Readable} \* `options` {Object} \* `strategy` {Object} \* `highWaterMark` {number} The maximum internal queue size (of the created `ReadableStream`) before backpressure is applied in reading from the given `stream.Readable`. If no value is provided, it will be taken from the given `stream.Readable`. \* `size` {Function} A function that size of the given chunk of data. If no value is provided, the size will be `1` for all the chunks. \* `chunk` {any} \* Returns: {number} \* `type` {string} Must be 'bytes' or undefined. \* Returns: {ReadableStream} ### `stream.Writable.fromWeb(writableStream[, options])` \* `writableStream` {WritableStream} \* `options` {Object} \* `decodeStrings` {boolean} \* `highWaterMark` {number} \* `objectMode` {boolean} \* `signal` {AbortSignal} \* Returns: {stream.Writable} ### `stream.Writable.toWeb(streamWritable)` \* `streamWritable` {stream.Writable} \* Returns: {WritableStream} ### `stream.Duplex.from(src)` \* `src` {Stream|Blob|ArrayBuffer|string|Iterable|AsyncIterable| AsyncGeneratorFunction|AsyncFunction|Promise|Object| ReadableStream|WritableStream} A utility method for creating duplex streams. \* `Stream` converts writable stream into writable `Duplex` and readable stream to `Duplex`. \* `Blob` converts into readable `Duplex`. \* `string` converts into readable `Duplex`. \* `ArrayBuffer` converts into readable `Duplex`. \* `AsyncIterable` converts into a readable `Duplex`. Cannot yield `null`. \* `AsyncGeneratorFunction` converts into a readable/writable transform `Duplex`. Must take a source `AsyncIterable` as first parameter. Cannot yield `null`. \* `AsyncFunction` converts into a writable `Duplex`. Must return either `null` or `undefined` \* `Object ({ writable, readable })` converts `readable` and `writable` into `Stream` and then combines them into `Duplex` where the `Duplex` will write to the `writable` and read from the `readable`. \* `Promise` converts into readable `Duplex`. Value `null` is ignored. \* `ReadableStream` converts into readable `Duplex`. \* `WritableStream` converts into writable `Duplex`. \* Returns: {stream.Duplex} If an `Iterable` object containing promises is passed as an argument, it might result in unhandled rejection. ```js const { Duplex } = require('node:stream'); Duplex.from([ new Promise((resolve) => setTimeout(resolve('1'), 1500)), new Promise((\_, reject) => setTimeout(reject(new Error('2')), 1000)), // Unhandled rejection ]); ``` ### `stream.Duplex.fromWeb(pair[, options])` \* `pair` {Object} \* `readable` {ReadableStream} \* `writable` {WritableStream} \* `options` {Object} \* `allowHalfOpen` {boolean} \* `decodeStrings` {boolean} \* `encoding` {string} \* `highWaterMark` {number} \* `objectMode` {boolean} \* `signal` {AbortSignal} \* Returns: {stream.Duplex} ```mjs import { Duplex } from 'node:stream'; import { ReadableStream, WritableStream, } from 'node:stream/web'; const readable = new ReadableStream({ start(controller) { controller.enqueue('world'); }, }); const writable = new WritableStream({ write(chunk) | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.0497007891535759,
0.01875448040664196,
-0.0632627010345459,
0.0483161099255085,
0.03873179852962494,
-0.030214596539735794,
-0.02040410041809082,
0.025427045300602913,
-0.0337507389485836,
-0.05924001336097717,
-0.04344182088971138,
0.041223976761102676,
-0.07361471652984619,
0.07917562127113342,
-0.02622193470597267,
-0.04901916906237602,
0.023360976949334145,
-0.020173586905002594,
0.008643670938909054,
-0.059414733201265335,
0.08010931313037872,
-0.007536879274994135,
-0.0061570038087666035,
-0.008256173692643642,
0.03149763122200966,
0.05811573937535286,
-0.036184150725603104,
-0.091497503221035,
0.01084581296890974,
-0.03392838314175606,
-0.01306142657995224,
-0.06441661715507507,
-0.10592997819185257,
-0.0196626465767622,
0.02088128589093685,
0.08326029777526855,
0.07097598910331726,
-0.054933544248342514,
-0.01979801245033741,
-0.028311779722571373,
0.10164102911949158,
0.05007944628596306,
-0.12188504636287689,
-0.05807419493794441,
-0.07156417518854141,
0.011765348725020885,
-0.042632848024368286,
-0.007209031842648983,
-0.10508013516664505,
0.013687917031347752,
-0.05126718059182167,
0.04992376267910004,
-0.0328463613986969,
0.039313722401857376,
0.08066734671592712,
-0.00553723331540823,
-0.03617757558822632,
-0.011351067572832108,
-0.02880248799920082,
-0.046168018132448196,
-0.02546132169663906,
-0.023075001314282417,
-0.00882049836218357,
0.017836876213550568,
0.00806590635329485,
-0.024940403178334236,
0.0183585062623024,
0.10350174456834793,
0.06616925448179245,
0.020735913887619972,
-0.024952329695224762,
0.022117052227258682,
-0.03513637185096741,
0.04635925590991974,
-0.007728913798928261,
-0.07078322023153305,
0.044872816652059555,
0.027041159570217133,
-0.0586380735039711,
0.047744058072566986,
-0.12790243327617645,
-0.10004443675279617,
-0.013199372217059135,
0.0003059681330341846,
-0.036961182951927185,
0.008092723786830902,
-0.04808121547102928,
0.03744109347462654,
0.0636989176273346,
0.0791965126991272,
-0.10679225623607635,
0.048344749957323074,
0.03258734568953514,
0.04180334880948067,
0.03305380046367645,
0.09457540512084961,
0.08300583809614182,
-0.008479575626552105,
0.007501010783016682,
-0.027692629024386406,
0.014447841793298721,
-0.009949942119419575,
0.05881601199507713,
-0.04872438684105873,
0.04856334999203682,
-0.09013143926858902,
0.017297912389039993,
-0.047839295119047165,
0.009122856892645359,
-0.01153338048607111,
-0.006342379376292229,
0.011035402305424213,
0.05724984034895897,
-0.02723495103418827,
-0.022750375792384148,
0.06455016881227493,
-0.10610590130090714,
0.013115833513438702,
0.03691314905881882,
0.1335841864347458,
0.07532353699207306,
-0.03528168052434921,
0.048798125237226486,
0.027590442448854446,
0.09942910820245743,
-0.015356172807514668,
0.03364315629005432,
3.557298636873669e-33,
0.04120885580778122,
-0.03998716548085213,
-0.04526124522089958,
0.07787197828292847,
-0.01754179038107395,
0.01774938777089119,
0.060407958924770355,
-0.0009360755793750286,
-0.0823914110660553,
-0.0192385446280241,
0.0008154293172992766,
0.0761101022362709,
-0.0705014243721962,
0.028861412778496742,
0.00969485379755497,
-0.026039525866508484,
0.04512102156877518,
-0.02729201875627041,
0.007336253300309181,
0.03252024948596954,
0.10385282337665558,
-0.0035345633514225483,
-0.08672956377267838,
-0.021343780681490898,
-0.030850443989038467,
-0.05293050780892372,
-0.04426342248916626,
0.023288939148187637,
-0.052308544516563416,
0.03023567982017994,
0.0017793410224840045,
-0.010317263193428516,
-0.011476030573248863,
0.019106371328234673,
0.05817306786775589,
-0.05354822799563408,
-0.002258336404338479,
-0.04252512753009796,
-0.10443389415740967,
-0.06317367404699326,
0.010240837000310421,
-0.033459313213825226,
-0.06343407928943634,
-0.04953964054584503,
-0.04448077082633972,
-0.044814154505729675,
-0.044102221727371216,
-0.02610146254301071,
-0.03086259961128235,
0.000705689424648881,
0.011846511624753475,
0.04747575521469116,
0.024396181106567383,
0.0034762152936309576,
0.03691365197300911,
0.015645571053028107,
0.020948654040694237,
0.05338748171925545,
0.06257936358451843,
0.02993178553879261,
0.054909009486436844,
0.09554722905158997,
-0.002711415058001876,
-0.04161981865763664,
0.055386584252119064,
0.08012528717517853,
0.005042633973062038,
-0.008217406459152699,
0.037804849445819855,
-0.0920022502541542,
-0.09784651547670364,
-0.006964507512748241,
-0.030880287289619446,
0.024309758096933365,
-0.00392212113365531,
-0.061379171907901764,
-0.005104505456984043,
-0.07603393495082855,
0.02451440505683422,
-0.0643923282623291,
-0.003996136598289013,
0.007231603842228651,
-0.009098699316382408,
0.09324610233306885,
-0.04886014759540558,
0.015781648457050323,
-0.03188876435160637,
-0.05497946962714195,
-0.009692033752799034,
0.008003048598766327,
0.006227973848581314,
-0.014586289413273335,
0.09518297761678696,
-0.1285601556301117,
-0.00003292377004981972,
-5.69723908277161e-33,
0.026734672486782074,
-0.05904712527990341,
-0.02764718607068062,
0.06985601037740707,
0.0015324032865464687,
-0.028099877759814262,
0.042869970202445984,
0.06534826010465622,
0.09527603536844254,
-0.07628542929887772,
-0.0842144563794136,
-0.008481503464281559,
-0.03908124193549156,
-0.03860285505652428,
-0.012711461633443832,
0.019842224195599556,
-0.035592444241046906,
-0.11763151735067368,
0.03915159031748772,
-0.02734639309346676,
-0.021786663681268692,
-0.050164949148893356,
0.074164479970932,
0.0048001669347286224,
-0.02339850179851055,
0.04517830163240433,
-0.0198943093419075,
-0.03942881524562836,
0.03189128637313843,
-0.043299902230501175,
0.05900181457400322,
0.030296657234430313,
0.004575283266603947,
-0.009260565042495728,
-0.0002813477476593107,
-0.042218491435050964,
0.040840066969394684,
0.11366792023181915,
-0.04059547930955887,
0.027392718940973282,
0.10527187585830688,
0.0075384206138551235,
0.021974503993988037,
-0.02711263671517372,
0.06644842028617859,
-0.002354748547077179,
-0.023595791310071945,
0.019097574055194855,
-0.01147002074867487,
0.018880387768149376,
0.06473810970783234,
-0.038853906095027924,
-0.013611830770969391,
0.08862903714179993,
0.03696995973587036,
-0.018757209181785583,
0.114781953394413,
-0.03806686773896217,
0.06650790572166443,
-0.007588187698274851,
-0.013251427561044693,
-0.11632139980792999,
-0.041949640959501266,
0.017387064173817635,
0.03383520618081093,
-0.020075395703315735,
-0.04257684573531151,
-0.03232499957084656,
0.01923120766878128,
0.002498714020475745,
0.05785912275314331,
-0.1333335041999817,
-0.030721526592969894,
-0.03832659870386124,
0.09429780393838882,
0.01670486479997635,
-0.04830174148082733,
-0.015900596976280212,
0.00864377710968256,
0.03782180696725845,
-0.04556834697723389,
0.09665528684854507,
-0.05020182579755783,
0.021161695942282677,
0.11304163932800293,
-0.036625076085329056,
0.04963216558098793,
0.0038454204332083464,
-0.020380858331918716,
-0.0037515205331146717,
0.01526895072311163,
-0.0021937668789178133,
-0.1075977012515068,
0.0470641665160656,
-0.028965333476662636,
-4.766187799987165e-8,
-0.10068298876285553,
-0.08061754703521729,
-0.10642647743225098,
0.031533900648355484,
0.03360632807016373,
-0.01694001816213131,
0.005545792635530233,
-0.055759795010089874,
0.11514417082071304,
-0.04349435120820999,
-0.02076859027147293,
-0.031073616817593575,
0.014589738100767136,
-0.05357412248849869,
0.03917106240987778,
-0.038555409759283066,
0.021202733740210533,
0.010954719968140125,
-0.04429361969232559,
0.031373031437397,
0.036484479904174805,
-0.05242384597659111,
-0.05554724857211113,
0.04690968617796898,
-0.01552686095237732,
0.06984482705593109,
0.07161823660135269,
0.012063778005540371,
0.03386108577251434,
0.005984960123896599,
-0.029488885775208473,
0.07817941904067993,
0.10786665230989456,
0.04133564978837967,
-0.04829591140151024,
0.0579506941139698,
-0.02401791699230671,
0.05354740843176842,
-0.00025895750150084496,
0.06473209708929062,
0.06035027280449867,
-0.007530825212597847,
-0.05998199060559273,
0.019695762544870377,
0.005257231183350086,
-0.055472999811172485,
0.009743873961269855,
0.00003524766361806542,
0.00527475168928504,
0.022049441933631897,
-0.07365158945322037,
0.053033944219350815,
-0.031134994700551033,
0.004114850889891386,
-0.029099609702825546,
-0.013510719873011112,
0.05021196976304054,
-0.10215748101472855,
-0.03669866919517517,
-0.03317485377192497,
0.12288781255483627,
-0.003200098406523466,
0.036434631794691086,
0.04007750004529953
] | 0.041792 |
`allowHalfOpen` {boolean} \* `decodeStrings` {boolean} \* `encoding` {string} \* `highWaterMark` {number} \* `objectMode` {boolean} \* `signal` {AbortSignal} \* Returns: {stream.Duplex} ```mjs import { Duplex } from 'node:stream'; import { ReadableStream, WritableStream, } from 'node:stream/web'; const readable = new ReadableStream({ start(controller) { controller.enqueue('world'); }, }); const writable = new WritableStream({ write(chunk) { console.log('writable', chunk); }, }); const pair = { readable, writable, }; const duplex = Duplex.fromWeb(pair, { encoding: 'utf8', objectMode: true }); duplex.write('hello'); for await (const chunk of duplex) { console.log('readable', chunk); } ``` ```cjs const { Duplex } = require('node:stream'); const { ReadableStream, WritableStream, } = require('node:stream/web'); const readable = new ReadableStream({ start(controller) { controller.enqueue('world'); }, }); const writable = new WritableStream({ write(chunk) { console.log('writable', chunk); }, }); const pair = { readable, writable, }; const duplex = Duplex.fromWeb(pair, { encoding: 'utf8', objectMode: true }); duplex.write('hello'); duplex.once('readable', () => console.log('readable', duplex.read())); ``` ### `stream.Duplex.toWeb(streamDuplex[, options])` \* `streamDuplex` {stream.Duplex} \* `options` {Object} \* `type` {string} Must be 'bytes' or undefined. \* Returns: {Object} \* `readable` {ReadableStream} \* `writable` {WritableStream} ```mjs import { Duplex } from 'node:stream'; const duplex = Duplex({ objectMode: true, read() { this.push('world'); this.push(null); }, write(chunk, encoding, callback) { console.log('writable', chunk); callback(); }, }); const { readable, writable } = Duplex.toWeb(duplex); writable.getWriter().write('hello'); const { value } = await readable.getReader().read(); console.log('readable', value); ``` ```cjs const { Duplex } = require('node:stream'); const duplex = Duplex({ objectMode: true, read() { this.push('world'); this.push(null); }, write(chunk, encoding, callback) { console.log('writable', chunk); callback(); }, }); const { readable, writable } = Duplex.toWeb(duplex); writable.getWriter().write('hello'); readable.getReader().read().then((result) => { console.log('readable', result.value); }); ``` ### `stream.addAbortSignal(signal, stream)` \* `signal` {AbortSignal} A signal representing possible cancellation \* `stream` {Stream|ReadableStream|WritableStream} A stream to attach a signal to. Attaches an AbortSignal to a readable or writeable stream. This lets code control stream destruction using an `AbortController`. Calling `abort` on the `AbortController` corresponding to the passed `AbortSignal` will behave the same way as calling `.destroy(new AbortError())` on the stream, and `controller.error(new AbortError())` for webstreams. ```js const fs = require('node:fs'); const controller = new AbortController(); const read = addAbortSignal( controller.signal, fs.createReadStream(('object.json')), ); // Later, abort the operation closing the stream controller.abort(); ``` Or using an `AbortSignal` with a readable stream as an async iterable: ```js const controller = new AbortController(); setTimeout(() => controller.abort(), 10\_000); // set a timeout const stream = addAbortSignal( controller.signal, fs.createReadStream(('object.json')), ); (async () => { try { for await (const chunk of stream) { await process(chunk); } } catch (e) { if (e.name === 'AbortError') { // The operation was cancelled } else { throw e; } } })(); ``` Or using an `AbortSignal` with a ReadableStream: ```js const controller = new AbortController(); const rs = new ReadableStream({ start(controller) { controller.enqueue('hello'); controller.enqueue('world'); controller.close(); }, }); addAbortSignal(controller.signal, rs); finished(rs, (err) => { if (err) { if (err.name === 'AbortError') { // The operation was cancelled } } }); const reader = rs.getReader(); reader.read().then(({ value, done }) => { console.log(value); // hello console.log(done); // false controller.abort(); }); ``` ### `stream.getDefaultHighWaterMark(objectMode)` \* `objectMode` {boolean} \* Returns: {integer} Returns the default highWaterMark used by streams. Defaults to `65536` (64 KiB), or `16` for `objectMode`. ### `stream.setDefaultHighWaterMark(objectMode, value)` \* `objectMode` {boolean} \* `value` {integer} highWaterMark value Sets the default highWaterMark used by streams. ## API for stream implementers The `node:stream` module API has been designed to make it possible to easily implement streams using JavaScript's prototypal inheritance model. First, a stream developer would declare a new JavaScript class that extends one of the four basic stream classes (`stream.Writable`, `stream.Readable`, `stream.Duplex`, or `stream.Transform`), making sure they call the appropriate parent class constructor: ```js const { Writable } = require('node:stream'); class MyWritable extends Writable { constructor({ | https://github.com/nodejs/node/blob/main//doc/api/stream.md | main | nodejs | [
-0.021513106301426888,
0.04418512433767319,
0.004005109891295433,
0.007932503707706928,
-0.009040925651788712,
-0.02240912802517414,
0.003939473535865545,
0.01623464748263359,
-0.01685699261724949,
-0.006916990969330072,
-0.03800290822982788,
0.009440186433494091,
-0.01387370191514492,
0.04557071626186371,
0.002117110649123788,
-0.006840776652097702,
-0.04780251532793045,
0.01070147193968296,
-0.027266278862953186,
-0.03257424011826515,
0.12416014075279236,
-0.0188087560236454,
-0.03282760828733444,
-0.014001579023897648,
-0.014850667677819729,
0.01349573116749525,
-0.006590047851204872,
0.021479180082678795,
0.08351969718933105,
-0.04192603752017021,
0.04897209629416466,
-0.020539116114377975,
-0.09385793656110764,
-0.05883162096142769,
-0.003734149970114231,
0.09057183563709259,
-0.017672566697001457,
-0.1535111367702484,
-0.01679954305291176,
-0.049077168107032776,
0.11635647714138031,
0.07355863600969315,
-0.03861353173851967,
-0.021565256640315056,
0.011407923884689808,
-0.021346012130379677,
-0.07995442301034927,
0.05622265115380287,
-0.029172614216804504,
0.010064030066132545,
-0.061576396226882935,
-0.015441072173416615,
-0.09149719774723053,
0.03918973729014397,
0.05769246444106102,
-0.04325169324874878,
-0.0629105418920517,
0.005460957996547222,
-0.01681014522910118,
-0.052089035511016846,
-0.026513421908020973,
-0.0022488280665129423,
0.06727395951747894,
-0.03414449840784073,
0.09676691889762878,
-0.03218574449419975,
-0.03501342236995697,
0.08343630284070969,
0.04110262170433998,
0.027658991515636444,
0.0018175123259425163,
-0.001817169482819736,
0.00664180563762784,
0.015073991380631924,
-0.04341204836964607,
-0.08218131959438324,
-0.01515232864767313,
0.019277766346931458,
-0.0429723784327507,
0.05552230030298233,
-0.07766417413949966,
-0.13805654644966125,
-0.011922607198357582,
-0.00584817212074995,
0.04604436829686165,
0.029390297830104828,
-0.01049667876213789,
-0.0269623976200819,
-0.016464218497276306,
-0.03319038078188896,
-0.08326277881860733,
-0.00009129769750870764,
0.004603046923875809,
0.0924253985285759,
-0.029119551181793213,
0.06981240957975388,
0.0061948541551828384,
0.06805615872144699,
-0.026740260422229767,
0.030109627172350883,
-0.015554442070424557,
0.009106590412557125,
0.005559866316616535,
0.0014430471928790212,
0.07471427321434021,
-0.07319379597902298,
0.0337638258934021,
0.06479562819004059,
0.021838463842868805,
-0.09595797210931778,
-0.04482864588499069,
0.04820458963513374,
0.05709019675850868,
0.016823437064886093,
-0.035425927489995956,
0.03657011315226555,
0.02432960271835327,
-0.012815453112125397,
0.08015663176774979,
0.04752778634428978,
0.05744652450084686,
-0.02941865473985672,
-0.010670880787074566,
0.04968808963894844,
0.09020120650529861,
-0.02030877210199833,
0.11449553817510605,
4.4194480707529825e-33,
0.03700396046042442,
-0.049063876271247864,
-0.06401120871305466,
0.08576534688472748,
0.019458334892988205,
-0.0007267669425345957,
0.026298344135284424,
0.019910428673028946,
-0.08144441992044449,
0.017168890684843063,
-0.046048980206251144,
-0.007574633229523897,
-0.03702925518155098,
0.012347419746220112,
-0.03141389414668083,
-0.09076941758394241,
0.08952803164720535,
-0.0610593818128109,
0.015492425300180912,
0.06490203738212585,
0.06758596748113632,
-0.0256765466183424,
-0.07142893224954605,
-0.056057702749967575,
-0.03578723222017288,
-0.015445222146809101,
-0.02073168382048607,
0.036656081676483154,
0.031011659651994705,
0.006254170555621386,
0.0884462371468544,
-0.02637356147170067,
-0.010270576924085617,
0.010512765496969223,
0.0668143704533577,
-0.03555852547287941,
0.035175587981939316,
0.012303981930017471,
-0.13482294976711273,
-0.0845547690987587,
-0.023046091198921204,
0.010747691616415977,
-0.05367467179894447,
-0.055014949291944504,
-0.01324377115815878,
-0.1008305549621582,
-0.037001997232437134,
-0.017669986933469772,
0.030734876170754433,
-0.09284310787916183,
0.005822680424898863,
0.0768672302365303,
0.003601498669013381,
0.0032244857866317034,
0.003732900135219097,
-0.009287703782320023,
0.06354182958602905,
-0.0011934461072087288,
-0.015711210668087006,
0.054396580904722214,
-0.035379935055971146,
0.029883472248911858,
-0.005409786943346262,
-0.025191837921738625,
0.017695607617497444,
0.05334233120083809,
0.0018163539934903383,
-0.002820362104102969,
0.08384090662002563,
-0.053605031222105026,
-0.07469233870506287,
-0.01632155291736126,
0.05234363302588463,
0.028228437528014183,
-0.02343837544322014,
0.013159296475350857,
-0.020910760387778282,
-0.05827654153108597,
0.015419566072523594,
-0.040948837995529175,
0.0488203763961792,
-0.03824133798480034,
-0.020976262167096138,
0.09461308270692825,
0.011689160950481892,
0.007916191592812538,
-0.04909835010766983,
-0.08728569000959396,
0.06969352066516876,
0.05386492609977722,
-0.00014510974870063365,
0.02936323545873165,
0.09203990548849106,
-0.17252132296562195,
-0.03916531801223755,
-5.3841527745858174e-33,
-0.014468415640294552,
0.026712313294410706,
-0.03126894682645798,
0.029843417927622795,
-0.005732513964176178,
-0.03834248334169388,
0.03941313549876213,
0.0386151559650898,
0.023840688169002533,
0.028226656839251518,
0.025056632235646248,
-0.01885095052421093,
0.0019390827510505915,
0.0129330363124609,
-0.017239106819033623,
-0.024222688749432564,
0.005680966190993786,
-0.04284156858921051,
0.04218663275241852,
-0.0762525126338005,
-0.0211773831397295,
0.016756564378738403,
0.009659652598202229,
0.04048972576856613,
-0.036277368664741516,
0.08493655174970627,
-0.0569608174264431,
-0.006405436899513006,
-0.021916605532169342,
-0.008860660716891289,
-0.025967741385102272,
0.03876854479312897,
-0.029878268018364906,
0.06303758174180984,
-0.026608960703015327,
-0.048397377133369446,
0.022886399179697037,
0.15095806121826172,
-0.06690492480993271,
-0.0021784754935652018,
0.08419031649827957,
-0.030915504321455956,
-0.05972861871123314,
0.003774998476728797,
0.04590979963541031,
-0.008770367130637169,
0.018828455358743668,
0.012063773348927498,
0.024865727871656418,
0.06021414324641228,
0.0268477201461792,
-0.05662492290139198,
-0.0392407551407814,
0.028066184371709824,
-0.006478500552475452,
-0.03639642521739006,
0.08829764276742935,
-0.07537645846605301,
0.06120156869292259,
0.0045635695569217205,
0.05571338161826134,
-0.07263447344303131,
-0.015167681500315666,
-0.03499941900372505,
0.07693256437778473,
0.018102549016475677,
-0.06717599928379059,
0.037439119070768356,
0.06998476386070251,
-0.01490140799432993,
-0.03625745698809624,
0.03418108820915222,
0.005399094428867102,
-0.035424113273620605,
0.08377545326948166,
0.007828672416508198,
-0.09607504308223724,
0.016661139205098152,
0.005460747983306646,
0.09157074987888336,
-0.012721068225800991,
0.06708069145679474,
-0.08045366406440735,
0.07299123704433441,
0.046951524913311005,
-0.014835821464657784,
0.01715174876153469,
-0.046786412596702576,
-0.08577702194452286,
-0.04759270325303078,
-0.03098822385072708,
0.06400211155414581,
-0.14775006473064423,
-0.0008865687414072454,
-0.029210662469267845,
-5.113652079558051e-8,
-0.1117096096277237,
-0.053927063941955566,
-0.14195865392684937,
-0.005706856492906809,
0.002098274417221546,
-0.060279056429862976,
-0.028256196528673172,
-0.06295174360275269,
0.041750192642211914,
-0.025782082229852676,
-0.045756157487630844,
-0.033797476440668106,
-0.033569034188985825,
-0.04956650361418724,
0.050600696355104446,
-0.07245262712240219,
-0.010274792090058327,
-0.07845856994390488,
-0.04678208753466606,
-0.02040615677833557,
0.051197364926338196,
-0.015714533627033234,
-0.033448394387960434,
0.12533625960350037,
0.03143247589468956,
-0.004829902667552233,
0.07090545445680618,
0.0653405413031578,
0.036062851548194885,
0.02062273398041725,
-0.01330578327178955,
0.046279024332761765,
0.08083097636699677,
0.07373581826686859,
-0.05139921233057976,
0.034482765942811966,
0.015632202848792076,
0.0771954283118248,
-0.004896538332104683,
0.0860898494720459,
0.07472004741430283,
0.05139988660812378,
-0.03661646321415901,
0.04159614443778992,
0.06665582209825516,
-0.04415076971054077,
0.039474163204431534,
0.021226685494184494,
0.025511175394058228,
0.022838229313492775,
-0.02482563629746437,
-0.014895276166498661,
-0.0022577662020921707,
0.00008988954505184665,
-0.001500731916166842,
-0.06227278336882591,
0.0009904641192406416,
-0.07831811159849167,
-0.0525762178003788,
-0.0006235766923055053,
0.13066650927066803,
-0.006714277435094118,
0.07472840696573257,
-0.02862829528748989
] | 0.040054 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.