content
large_stringlengths
3
20.5k
url
large_stringlengths
53
192
branch
large_stringclasses
4 values
source
large_stringclasses
51 values
embeddings
listlengths
384
384
score
float64
-0.21
0.65
the result to zero. #### `napi\_get\_value\_int64` ```c napi\_status napi\_get\_value\_int64(napi\_env env, napi\_value value, int64\_t\* result) ``` \* `[in] env`: The environment that the API is invoked under. \* `[in] value`: `napi\_value` representing JavaScript `number`. \* `[out] result`: C `int64` primitive equi...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.024667518213391304, 0.11009719967842102, -0.007001732941716909, -0.034271206706762314, -0.018249616026878357, -0.03363047167658806, 0.07072644680738449, 0.05504177138209343, -0.0005600426229648292, -0.09313544631004333, -0.057191479951143265, -0.050257984548807144, 0.03918256238102913, ...
0.104388
`[in] env`: The environment that the API is invoked under. \* `[in] value`: `napi\_value` representing JavaScript `number`. \* `[out] result`: C primitive equivalent of the given `napi\_value` as a `uint32\_t`. Returns `napi\_ok` if the API succeeded. If a non-number `napi\_value` is passed in it returns `napi\_number\...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.02751391939818859, 0.0803205743432045, -0.038869619369506836, 0.0000022761769287171774, -0.02739799953997135, -0.0695478618144989, 0.09607880562543869, 0.015071004629135132, 0.00884042028337717, -0.08250705897808075, -0.032293763011693954, -0.08014384657144547, 0.01324467733502388, 0.02...
0.209351
Returns `napi\_ok` if the API succeeded. This API implements the abstract operation `ToString()` as defined in [Section ToString][] of the ECMAScript Language Specification. This function potentially runs JS code if the passed-in value is an object. ### `napi\_typeof` ```c napi\_status napi\_typeof(napi\_env env, napi\...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.029187481850385666, 0.13278508186340332, -0.005502905230969191, 0.0529574453830719, -0.04137033969163895, -0.027472222223877907, 0.057175759226083755, 0.06631334871053696, 0.03702893853187561, -0.10585857927799225, -0.06288443505764008, -0.04048570618033409, -0.023475056514143944, 0.013...
0.265922
the given `napi\_value` represents an `Error` object. Returns `napi\_ok` if the API succeeded. This API checks if the `Object` passed in is an `Error`. ### `napi\_is\_typedarray` ```c napi\_status napi\_is\_typedarray(napi\_env env, napi\_value value, bool\* result) ``` \* `[in] env`: The environment that the API is in...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ 0.020443571731448174, 0.08480630815029144, 0.00019082693324889988, -0.0030039784032851458, -0.08092482388019562, -0.05152066424489021, 0.10813271999359131, -0.004658671095967293, -0.025651294738054276, -0.07609821856021881, -0.06711522489786148, -0.08735569566488266, 0.006007694639265537, ...
0.144604
fixed-length binary data buffers that can be shared across multiple workers. The `SharedArrayBuffer` allocated will have an underlying byte buffer whose size is determined by the `byte\_length` parameter that's passed in. The underlying buffer is optionally returned back to the caller in case the caller wants to direct...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ 0.017883483320474625, 0.044076062738895416, 0.013689151033759117, 0.06184651330113411, -0.05112643167376518, -0.01724686473608017, 0.01040694024413824, 0.02218392863869667, -0.011522489599883556, -0.040870826691389084, -0.11062705516815186, -0.015124639496207237, -0.04403093829751015, -0.0...
0.143569
equivalent of the Node-API counterpart: ```c napi\_status status = napi\_status\_generic\_failure; // const obj = {}; napi\_value obj; status = napi\_create\_object(env, &obj); if (status != napi\_ok) return status; // Create napi\_values for 123 and 456 napi\_value fooValue, barValue; status = napi\_create\_int32(env,...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ 0.038519252091646194, 0.10058317333459854, -0.05496140569448471, 0.016625123098492622, -0.09627920389175415, -0.02142280712723732, -0.008221613243222237, -0.008346864953637123, -0.03415130451321602, -0.04072696715593338, -0.037624165415763855, -0.08436628431081772, 0.003540291450917721, -0...
0.169237
when a set access of the property is performed. If this is passed in, set `value` and `method` to `NULL` (since these members won't be used). The given function is called implicitly by the runtime when the property is set from JavaScript code (or if a set on the property is performed using a Node-API call). [`napi\_cal...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.05515994504094124, 0.1160188615322113, -0.04800594225525856, 0.06427505612373352, -0.0687599778175354, -0.020912645384669304, 0.06511222571134567, -0.005968098994344473, 0.014073182828724384, -0.07484672218561172, 0.016471924260258675, -0.03222205489873886, -0.002676215721294284, -0.081...
0.162162
succeeded. This API checks if the `Object` passed in has the named property. #### `napi\_delete\_property` ```c napi\_status napi\_delete\_property(napi\_env env, napi\_value object, napi\_value key, bool\* result); ``` \* `[in] env`: The environment that the Node-API call is invoked under. \* `[in] object`: The object...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.019830524921417236, 0.10302164405584335, -0.03887373208999634, 0.03031323105096817, -0.03548331931233406, -0.08569663017988205, 0.05596046894788742, -0.07537958025932312, 0.04314802587032318, 0.02035507559776306, -0.008627131581306458, -0.06436526030302048, 0.0632171705365181, -0.023234...
0.151035
`napi\_ok` if the API succeeded. This API gets the element at the requested index. #### `napi\_has\_element` ```c napi\_status napi\_has\_element(napi\_env env, napi\_value object, uint32\_t index, bool\* result); ``` \* `[in] env`: The environment that the Node-API call is invoked under. \* `[in] object`: The object t...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ 0.005115898326039314, 0.1256425827741623, -0.019874151796102524, 0.07298093289136887, 0.011415286920964718, -0.07792313396930695, 0.07450412213802338, -0.09334326535463333, 0.04339965805411339, -0.02433113008737564, -0.022847818210721016, -0.06933987885713577, 0.03725339099764824, -0.04827...
0.225484
to native code, the `napi\_callback` function provided is invoked. The APIs documented in this section allow the callback function to do the following: \* Get information about the context in which the callback was invoked. \* Get the arguments passed into the callback. \* Return a `napi\_value` back from the callback....
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.046016741544008255, 0.07019398361444473, -0.04462934657931328, 0.07089243829250336, -0.03780345991253853, -0.050607409328222275, 0.014203855767846107, -0.01528075896203518, 0.016962258145213127, -0.05175856128334999, -0.029297882691025734, -0.026530509814620018, -0.05398022383451462, -0...
0.243979
The newly created function is not automatically visible from script after this call. Instead, a property must be explicitly set on any object that is visible to JavaScript, in order for the function to be accessible from script. In order to expose a function as part of the add-on's module exports, set the newly created...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.022163527086377144, 0.02455880306661129, -0.07358618825674057, 0.015479777939617634, -0.04343912750482559, 0.0027274840977042913, 0.04480064660310745, 0.07576005160808563, -0.013492945581674576, -0.034500040113925934, 0.05688881501555443, -0.055618416517972946, -0.07252372801303864, -0....
0.137735
zero this parameter may be omitted by passing in `NULL`. \* `[out] result`: `napi\_value` representing the JavaScript object returned, which in this case is the constructed object. This method is used to instantiate a new JavaScript value using a given `napi\_value` that represents the constructor for the object. For e...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.05716649070382118, 0.13208532333374023, -0.001723304740153253, 0.066227987408638, -0.06412997096776962, -0.008380861952900887, 0.018124623224139214, 0.03681834042072296, 0.004202653653919697, -0.00850850623100996, -0.021296851336956024, -0.07024060934782028, -0.026723947376012802, -0.04...
0.14045
query handle. Internally, it unwraps the first argument and casts the resulting pointer to a native database handle. It then unwraps the second argument and casts the resulting pointer to a query handle. If the arguments are passed in the wrong order, the casts will work, however, there is a good chance that the underl...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.09421449899673462, 0.016328785568475723, 0.023491188883781433, 0.06649509817361832, -0.1394512802362442, 0.02877957746386528, 0.1054467111825943, -0.0016326440963894129, 0.036158375442028046, -0.0225826445966959, -0.06502331048250198, 0.06477457284927368, 0.009458959102630615, 0.0001885...
0.101644
is indeed such a // handle. static napi\_value query(napi\_env env, napi\_callback\_info info) { napi\_status status; size\_t argc = 2; napi\_value argv[2]; bool is\_db\_handle; status = napi\_get\_cb\_info(env, info, &argc, argv, NULL, NULL); if (status != napi\_ok) return NULL; // Check that the object passed as the ...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ 0.01244109496474266, 0.08846026659011841, -0.09465214610099792, 0.049487389624118805, -0.0976986289024353, -0.07746769487857819, 0.14874064922332764, -0.01719600148499012, -0.045889921486377716, -0.03712233528494835, -0.04579153284430504, -0.0527278371155262, 0.02379734069108963, -0.022231...
0.156508
freed whenever the class is garbage-collected by passing both the JavaScript function and the data to [`napi\_add\_finalizer`][]. ### `napi\_wrap` ```c napi\_status napi\_wrap(napi\_env env, napi\_value js\_object, void\* native\_object, napi\_finalize finalize\_cb, void\* finalize\_hint, napi\_ref\* result); ``` \* `[...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.055467959493398666, 0.11085981130599976, 8.074604807006835e-7, 0.04713616892695427, 0.010538090020418167, -0.03082398697733879, 0.03236676752567291, 0.010296819731593132, -0.032583385705947876, -0.0671372041106224, -0.019660161808133125, -0.03501616790890694, -0.07750381529331207, -0.00...
0.221489
\* `[in] js\_object`: The object associated with the native instance. \* `[out] result`: Pointer to the wrapped native instance. Returns `napi\_ok` if the API succeeded. Retrieves a native instance that was previously wrapped in the JavaScript object `js\_object` using `napi\_wrap()` and removes the wrapping. If a fina...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.06004730984568596, 0.09636715054512024, 0.022519733756780624, 0.03724099323153496, 0.024948813021183014, -0.08003982156515121, 0.06885793805122375, 0.0008008395088836551, -0.00200829328969121, -0.06604353338479996, -0.04756942018866539, -0.0034245657734572887, -0.07236644625663757, 0.03...
0.221638
object has been garbage-collected. [`napi\_finalize`][] provides more details. \* `[in] finalize\_data`: Optional data to be passed to `finalize\_cb`. \* `[in] finalize\_hint`: Optional contextual hint that is passed to the finalize callback. Returns `napi\_ok` if the API succeeded. Schedules a `napi\_finalize` callbac...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.0744781494140625, 0.057530391961336136, 0.0039130523800849915, 0.051772985607385635, 0.0395159013569355, -0.04158748313784599, -0.007775498554110527, 0.003175632795318961, 0.016717758029699326, 0.0003012528468389064, -0.04795622080564499, 0.03192610293626785, -0.06247905641794205, -0.03...
0.125305
result`: `napi\_async\_work\*` which is the handle to the newly created async work. Returns `napi\_ok` if the API succeeded. This API allocates a work object that is used to execute logic asynchronously. It should be freed using [`napi\_delete\_async\_work`][] once the work is no longer required. `async\_resource\_name...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.10179812461137772, 0.06560634076595306, -0.15063682198524475, 0.07794323563575745, -0.05669502913951874, -0.04756094515323639, 0.03182213380932808, -0.09133163094520569, 0.04048982635140419, -0.07513836771249771, -0.03124619461596012, -0.02546347863972187, -0.041855182498693466, 0.03574...
0.16125
every call to `napi\_async\_init()` is a requirement in any case to avoid memory leaks. ### `napi\_async\_destroy` ```c napi\_status napi\_async\_destroy(napi\_env env, napi\_async\_context async\_context); ``` \* `[in] env`: The environment that the API is invoked under. \* `[in] async\_context`: The async context to ...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.1120336577296257, 0.09807056188583374, -0.0741405040025711, 0.04666638746857643, 0.0005948335747234523, -0.08458387851715088, 0.02187846228480339, -0.000924738880712539, 0.029270309954881668, -0.07419722527265549, -0.03781012073159218, 0.019898219034075737, -0.004384562373161316, -0.013...
0.177124
typedef struct { uint32\_t major; uint32\_t minor; uint32\_t patch; const char\* release; } napi\_node\_version; napi\_status napi\_get\_node\_version(node\_api\_basic\_env env, const napi\_node\_version\*\* version); ``` \* `[in] env`: The environment that the API is invoked under. \* `[out] version`: A pointer to ver...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ 0.004898468032479286, 0.09547389298677444, 0.019380800426006317, 0.024040091782808304, 0.05058352276682854, -0.029405897483229637, -0.011707459576427937, 0.02158748358488083, -0.01901753433048725, -0.037764567881822586, -0.017803926020860672, 0.0066793556325137615, -0.08123921602964401, -0...
0.206912
return NULL; // Pass the deferred to a function that performs an asynchronous action. do\_something\_asynchronous(deferred); // Return the promise to JS return promise; ``` The above function `do\_something\_asynchronous()` would perform its asynchronous action and then it would resolve or reject the deferred, thereby ...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.11151629686355591, 0.09476670622825623, -0.036615993827581406, 0.015547887422144413, -0.05507761240005493, 0.003384361043572426, -0.03279901295900345, -0.04108131676912308, 0.06412307173013687, -0.05553796887397766, 0.019210955128073692, -0.0012158909812569618, -0.07858844101428986, -0....
0.103951
to execute. \* `[out] result`: The value resulting from having executed the script. This function executes a string of JavaScript code and returns its result with the following caveats: \* Unlike `eval`, this function does not allow the script to access the current lexical scope, and therefore also does not allow to ac...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.02151697687804699, 0.09123830497264862, -0.016695261001586914, 0.04988580569624901, 0.025075864046812057, -0.05043696612119675, 0.06328101456165314, -0.0015571287367492914, -0.005215174984186888, -0.06472849100828171, -0.05409299209713936, -0.0051316190510988235, -0.002899730810895562, ...
0.102049
with a maximum queue size of 0. `napi\_call\_threadsafe\_function()` should not be called with `napi\_tsfn\_blocking` from a JavaScript thread, because, if the queue is full, it may cause the JavaScript thread to deadlock. The actual call into JavaScript is controlled by the callback given via the `call\_js\_cb` parame...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.11015002429485321, -0.014100810512900352, -0.043274812400341034, -0.0038541534449905157, -0.04511155188083649, -0.01160932332277298, 0.09878068417310715, -0.040774665772914886, 0.06476957350969315, -0.08715814352035522, -0.013850335963070393, 0.024337196722626686, -0.03220135346055031, ...
0.169806
it is no longer possible to make asynchronous calls to the thread-safe function. This can be used as a criterion for terminating the thread. \*\*Upon receiving a return value of `napi\_closing` from `napi\_call\_threadsafe\_function()` a thread must not use the thread-safe function anymore because it is no longer guara...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.07875557243824005, -0.015231678262352943, -0.09351126849651337, -0.007273167371749878, 0.027334531769156456, 0.00016713373770471662, -0.009704514406621456, -0.06650719046592712, 0.08333484828472137, -0.026453273370862007, -0.031114421784877777, 0.015361527912318707, -0.010852573439478874,...
0.116556
queue is full, it may cause the JavaScript thread to deadlock. This API will return `napi\_closing` if `napi\_release\_threadsafe\_function()` was called with `abort` set to `napi\_tsfn\_abort` from any thread. The value is only added to the queue if the API returns `napi\_ok`. This API may be called from any thread wh...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.10672098398208618, -0.00688926363363862, -0.029676195234060287, -0.000895085686352104, -0.0042811851017177105, -0.05037921667098999, 0.08946555852890015, -0.0936858281493187, 0.0855078473687172, -0.006338638719171286, 0.013748835772275925, 0.016756495460867882, -0.07522431761026382, -0....
0.201612
[GitHub releases]: https://help.github.com/en/github/administering-a-repository/about-releases [LLVM]: https://llvm.org [Native Abstractions for Node.js]: https://github.com/nodejs/nan [Node-API Media]: https://github.com/nodejs/abi-stable-node/blob/HEAD/node-api-media.md [Object lifetime management]: #object-lifetime-...
https://github.com/nodejs/node/blob/main/doc/api/n-api.md
main
nodejs
[ -0.06507381796836853, 0.01952308602631092, -0.024871494621038437, 0.02129325643181801, 0.07909813523292542, -0.04813094064593315, -0.04752974212169647, -0.013028719462454319, 0.00490316329523921, 0.02654445916414261, 0.020580869168043137, -0.020401019603013992, -0.014100148342549801, -0.01...
0.228192
# Diagnostic report > Stability: 2 - Stable Delivers a JSON-formatted diagnostic summary, written to a file. The report is intended for development, test, and production use, to capture and preserve information for problem determination. It includes JavaScript and native stack traces, heap statistics, platform informat...
https://github.com/nodejs/node/blob/main/doc/api/report.md
main
nodejs
[ -0.03155870735645294, 0.04952438548207283, -0.07357687503099442, 0.08114887028932571, 0.05973784625530243, -0.019237907603383064, -0.05317432060837746, 0.11818104237318039, -0.017385419458150864, -0.0009436236578039825, -0.010711691342294216, -0.00016617953951936215, 0.03630038723349571, 0...
0.163263
}, { "type": "idle", "is\_active": false, "is\_referenced": true, "address": "0x00007fff5fbfebc0" }, { "type": "prepare", "is\_active": false, "is\_referenced": false, "address": "0x00007fff5fbfec38" }, { "type": "check", "is\_active": false, "is\_referenced": false, "address": "0x00007fff5fbfecb0" }, { "type": "async"...
https://github.com/nodejs/node/blob/main/doc/api/report.md
main
nodejs
[ -0.027484282851219177, 0.021915489807724953, -0.08434611558914185, 0.11684130877256393, 0.001123656751587987, -0.05107993632555008, 0.06301713734865189, -0.03608906269073486, 0.019853761419653893, -0.011712317354977131, -0.028296707198023796, -0.049911774694919586, -0.0058882287703454494, ...
0.117825
consumption. \* `--report-directory` Location at which the report will be generated. \* `--report-filename` Name of the file to which the report will be written. \* `--report-signal` Sets or resets the signal for report generation (not supported on Windows). Default signal is `SIGUSR2`. \* `--report-exclude-network` Ex...
https://github.com/nodejs/node/blob/main/doc/api/report.md
main
nodejs
[ -0.007025266066193581, 0.0322473868727684, -0.07412528991699219, 0.08036143332719803, 0.03963159769773483, -0.0011150374775752425, -0.028946008533239365, 0.06007172539830208, 0.011727464385330677, -0.023135956376791, -0.00317776040174067, 0.006882910616695881, 0.03894837573170662, -0.01155...
0.044152
in the `userLimits` section, as these values are given in bytes. ```json { "userLimits": { // Skip some keys ... "data\_seg\_size\_bytes": { // replacing data\_seg\_size\_kbytes "soft": "unlimited", "hard": "unlimited" }, // ... "max\_memory\_size\_bytes": { // replacing max\_memory\_size\_kbytes "soft": "unlimited", "...
https://github.com/nodejs/node/blob/main/doc/api/report.md
main
nodejs
[ 0.005882115103304386, 0.0375773087143898, -0.05222398415207863, -0.02660983055830002, -0.0018934388644993305, -0.057658687233924866, 0.023724593222141266, 0.04622269794344902, -0.01289066206663847, -0.02386840432882309, 0.03506957367062569, 0.002004403155297041, 0.0027036836836487055, -0.0...
0.081623
in the standard report format. The thread which is generating the report will wait for the reports from Worker threads to finish. However, the latency for this will usually be low, as both running JavaScript and the event loop are interrupted to generate the report. [`Worker`]: worker\_threads.md [`process API document...
https://github.com/nodejs/node/blob/main/doc/api/report.md
main
nodejs
[ -0.07156629860401154, 0.016766440123319626, -0.11042369902133942, 0.054148491472005844, 0.04969143122434616, -0.029582468792796135, -0.08015350997447968, -0.025148574262857437, 0.0990012139081955, 0.0076461974531412125, -0.02223709225654602, 0.05994052812457085, -0.012864968739449978, -0.0...
0.132057
# FFI > Stability: 1 - Experimental The `node:ffi` module provides an experimental foreign function interface for loading dynamic libraries and calling native symbols from JavaScript. This API is unsafe. Passing invalid pointers, using an incorrect symbol signature, or accessing memory after it has been freed can crash...
https://github.com/nodejs/node/blob/main/doc/api/ffi.md
main
nodejs
[ -0.06448971480131149, -0.04865696281194687, -0.00782453827559948, 0.049905579537153244, -0.001453258446417749, -0.03675328567624092, -0.060726799070835114, 0.004627761896699667, -0.02639499306678772, -0.09557879716157913, -0.04854875057935715, 0.03553558886051178, -0.069839708507061, -0.01...
0.108762
which are optional: \* `return` {string} A [type name][type names] specifying the return type of the function or callback. \*\*Default:\*\* `'void'`. \* `arguments` {string\[]} An array of [type names][] specifying the argument type list of the function or callback. \*\*Default:\*\* `[]`. ```js const signature = { retu...
https://github.com/nodejs/node/blob/main/doc/api/ffi.md
main
nodejs
[ -0.07052209973335266, 0.0036708323750644922, -0.035944219678640366, 0.02390909381210804, -0.07643378525972366, -0.025326870381832123, 0.04779256507754326, 0.04817260429263115, -0.016115007922053337, -0.11421151459217072, -0.06026124209165573, 0.01680261455476284, -0.06389080733060837, 0.04...
0.095616
safe to reuse. Node.js does not track or revoke callback pointers that have already been handed to native code. If native code still holds a callback pointer after `library.close()` or after `library.unregisterCallback(pointer)`, invoking that pointer has undefined behavior, is not allowed, and is dangerous: it can cra...
https://github.com/nodejs/node/blob/main/doc/api/ffi.md
main
nodejs
[ -0.04034178704023361, -0.004389344248920679, -0.010444045066833496, 0.07736499607563019, 0.04312952607870102, -0.026635879650712013, 0.03966598957777023, 0.027198201045393944, 0.011194447986781597, -0.08065688610076904, -0.04992275312542915, 0.11521700024604797, -0.040994107723236084, -0.0...
0.026442
JavaScript. If the callback function is later garbage collected, subsequent native invocations become a no-op. Non-void return values are zero-initialized before returning to native code. ## Calling native functions Argument conversion depends on the declared FFI type. For 8-, 16-, and 32-bit integer types and for floa...
https://github.com/nodejs/node/blob/main/doc/api/ffi.md
main
nodejs
[ 0.010256728157401085, 0.0093380743637681, -0.041206441819667816, 0.025841783732175827, -0.10938257724046707, -0.08479806780815125, 0.05083156004548073, 0.07423137873411179, 0.002413460984826088, -0.0757589116692543, -0.06383999437093735, 0.03599131479859352, -0.09025442600250244, -0.024438...
0.151409
directly. The caller must guarantee that: \* `pointer` remains valid for the entire lifetime of the returned `Buffer`. \* `length` stays within the allocated native region. \* no native code frees or repurposes that memory while JavaScript still uses the `Buffer`. \* Memory protection is observed. For example, read-onl...
https://github.com/nodejs/node/blob/main/doc/api/ffi.md
main
nodejs
[ -0.030973676592111588, -0.014154464937746525, -0.06938634812831879, 0.022573107853531837, -0.03750267252326012, -0.03666249290108681, 0.04264841601252556, -0.0017145286547020078, 0.028868500143289566, -0.08016688376665115, -0.09173522144556046, 0.07100290060043335, -0.06656374037265778, 0....
0.15835
undefined callback behavior can crash the process, produce incorrect output, or corrupt memory. \* Do not assume pointer return values imply ownership; whether the caller must free the returned address depends entirely on the native API. As a general rule, prefer copied values unless zero-copy access is required, and k...
https://github.com/nodejs/node/blob/main/doc/api/ffi.md
main
nodejs
[ -0.04004189744591713, -0.006013145204633474, -0.05596521496772766, 0.012507354840636253, -0.06511803716421127, -0.06178528070449829, 0.00357871875166893, -0.02182758040726185, 0.007010129280388355, -0.06266822665929794, -0.025577200576663017, -0.007502096239477396, -0.06800919026136398, 0....
0.076262
# String decoder > Stability: 2 - Stable The `node:string\_decoder` module provides an API for decoding `Buffer` objects into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16 characters. It can be accessed using: ```mjs import { StringDecoder } from 'node:string\_decoder'; ``` ```cjs const { Strin...
https://github.com/nodejs/node/blob/main/doc/api/string_decoder.md
main
nodejs
[ -0.005371804349124432, 0.020492132753133774, -0.0450509749352932, -0.0041944729164242744, -0.04104958847165108, -0.05159217119216919, -0.0035255944821983576, 0.06570645421743393, 0.027163216844201088, -0.027237996459007263, -0.030461231246590614, -0.03257817029953003, 0.0062808385118842125, ...
0.078785
# Path > Stability: 2 - Stable The `node:path` module provides utilities for working with file and directory paths. It can be accessed using: ```cjs const path = require('node:path'); ``` ```mjs import path from 'node:path'; ``` ## Windows vs. POSIX The default operation of the `node:path` module varies based on the op...
https://github.com/nodejs/node/blob/main/doc/api/path.md
main
nodejs
[ -0.06645947694778442, 0.0027339444495737553, -0.011095819063484669, 0.06097820773720741, 0.032893430441617966, -0.03668994829058647, -0.04029686376452446, 0.08627273887395859, 0.04849674925208092, -0.026423882693052292, -0.03516815975308418, 0.07636712491512299, -0.002616459270939231, 0.01...
0.060754
`ext` {string} \* Returns: {string} The `path.format()` method returns a path string from an object. This is the opposite of [`path.parse()`][]. When providing properties to the `pathObject` remember that there are combinations where one property has priority over another: \* `pathObject.root` is ignored if `pathObject...
https://github.com/nodejs/node/blob/main/doc/api/path.md
main
nodejs
[ -0.0377468466758728, 0.09821570664644241, -0.022017192095518112, 0.08443716168403625, -0.06842772662639618, -0.05106247216463089, 0.00459186639636755, 0.13474713265895844, 0.07237525284290314, -0.026568779721856117, 0.010649912990629673, 0.02813217043876648, -0.06350470334291458, 0.0375753...
0.07372
will replace two leading forward slashes with a single slash as if it was a regular absolute path, whereas a few POSIX systems assign special meaning to paths beginning with exactly two forward slashes. Similarly, other substitutions performed by this function, such as removing `..` segments, may change how the underly...
https://github.com/nodejs/node/blob/main/doc/api/path.md
main
nodejs
[ -0.036839697510004044, 0.006434490438550711, 0.04562478885054588, 0.05119699612259865, -0.057996101677417755, -0.050664033740758896, -0.045485906302928925, 0.04133794084191322, 0.06321322917938232, -0.005567651707679033, 0.03782200440764427, 0.016300177201628685, -0.030983831733465195, 0.0...
0.074807
to the root directory. Zero-length `path` segments are ignored. If no `path` segments are passed, `path.resolve()` will return the absolute path of the current working directory. ```js path.resolve('/foo/bar', './baz'); // Returns: '/foo/bar/baz' path.resolve('/foo/bar', '/tmp/file/'); // Returns: '/tmp/file' path.reso...
https://github.com/nodejs/node/blob/main/doc/api/path.md
main
nodejs
[ -0.061341121792793274, 0.007299638353288174, 0.032865140587091446, -0.0007117980276234448, -0.0032904965337365866, -0.10943026840686798, -0.01465025544166565, 0.14347538352012634, 0.0705019161105156, -0.02662038803100586, 0.029827337712049484, 0.06697793304920197, -0.0011234133271500468, 0...
0.0429
# Worker threads > Stability: 2 - Stable The `node:worker\_threads` module enables the use of threads that execute JavaScript in parallel. To access it: ```mjs import worker\_threads from 'node:worker\_threads'; ``` ```cjs const worker\_threads = require('node:worker\_threads'); ``` Workers (threads) are useful for per...
https://github.com/nodejs/node/blob/main/doc/api/worker_threads.md
main
nodejs
[ -0.07959102839231491, -0.005928422324359417, -0.03370955213904381, 0.09165160357952118, 0.032378289848566055, -0.10202743858098984, -0.031589094549417496, 0.026505302637815475, -0.014001813717186451, 0.003731697564944625, -0.07110012322664261, 0.0828067883849144, -0.009526225738227367, -0....
0.205992
file inside a Worker instance. new Worker(new URL(import.meta.url)); } else { console.log('Inside Worker!'); console.log(isMainThread); // Prints 'false'. } ``` ```cjs const { Worker, isMainThread } = require('node:worker\_threads'); if (isMainThread) { // This re-loads the current file inside a Worker instance. new Wo...
https://github.com/nodejs/node/blob/main/doc/api/worker_threads.md
main
nodejs
[ -0.09431402385234833, 0.05553421750664711, 0.0039256904274225235, 0.03573804721236229, 0.07946852594614029, -0.12610261142253876, 0.03095569834113121, -0.01757401041686535, 0.06075765937566757, 0.027756663039326668, -0.048399172723293304, 0.05597697198390961, -0.10748893767595291, -0.01610...
0.152043
} = new MessageChannel(); try { // This will throw an error, because anyObject is not cloneable. port1.postMessage(anyObject); } catch (error) { // error.name === 'DataCloneError' } ``` There is no equivalent to this API in browsers. ## `worker\_threads.moveMessagePortToContext(port, contextifiedSandbox)` \* `port` {Me...
https://github.com/nodejs/node/blob/main/doc/api/worker_threads.md
main
nodejs
[ -0.03255878761410713, -0.031064851209521294, -0.007853581570088863, 0.04011208564043045, 0.0037823172751814127, -0.07456232607364655, 0.051164768636226654, -0.009693413972854614, -0.01453255582600832, -0.05181247368454933, 0.02543565444648266, -0.07859203219413757, 0.045623529702425, 0.016...
0.132785
workerData, Worker, } from 'node:worker\_threads'; const channel = new BroadcastChannel('sync'); const level = workerData?.level ?? 0; if (level < 10) { const worker = new Worker(new URL(import.meta.url), { workerData: { level: level + 1 }, }); } if (level === 0) { process.on('workerMessage', (value, source) => { conso...
https://github.com/nodejs/node/blob/main/doc/api/worker_threads.md
main
nodejs
[ 0.012161249294877052, 0.009708959609270096, -0.001409012358635664, 0.02587827295064926, 0.03635221719741821, -0.04674183949828148, 0.07116781920194626, -0.05061803758144379, 0.04790523275732994, -0.03238823264837265, -0.061957504600286484, -0.01957404427230358, -0.04910131171345711, -0.003...
0.126325
Type: {integer} An integer identifier for the current thread. On the corresponding worker object (if there is any), it is available as [`worker.threadId`][]. This value is unique for each [`Worker`][] instance inside a single process. ## `worker\_threads.threadName` \* {string|null} A string identifier for the current ...
https://github.com/nodejs/node/blob/main/doc/api/worker_threads.md
main
nodejs
[ -0.1174270510673523, 0.05239926651120186, 0.00765515211969614, 0.028221644461154938, -0.004449265543371439, -0.11918912827968597, 0.04999716207385063, -0.07819833606481552, 0.031402990221977234, -0.028679126873612404, -0.05257676914334297, 0.019007906317710876, -0.02279338426887989, -0.060...
0.160041
name ${pending.name}, mode ${pending.mode}`); } ``` ```cjs const { locks } = require('node:worker\_threads'); locks.query().then((snapshot) => { for (const lock of snapshot.held) { console.log(`held lock: name ${lock.name}, mode ${lock.mode}`); } for (const pending of snapshot.pending) { console.log(`pending lock: name...
https://github.com/nodejs/node/blob/main/doc/api/worker_threads.md
main
nodejs
[ -0.013008452951908112, 0.0327460952103138, -0.004510114900767803, 0.03749135509133339, 0.022554943338036537, -0.044728510081768036, 0.10558865964412689, -0.06884780526161194, 0.05016104876995087, -0.006362670101225376, 0.0007399251917377114, 0.015327402390539646, -0.009862200357019901, -0....
0.103041
() => console.log('closed!')); port1.postMessage('foobar'); port1.close(); ``` ### Event: `'message'` \* `value` {any} The transmitted value The `'message'` event is emitted for any incoming message, containing the cloned input of [`port.postMessage()`][]. Listeners on this event receive a clone of the `value` paramete...
https://github.com/nodejs/node/blob/main/doc/api/worker_threads.md
main
nodejs
[ -0.053390905261039734, 0.024402514100074768, 0.028424914926290512, 0.03735094144940376, 0.004259567242115736, -0.07738696783781052, -0.0007101623341441154, 0.01611480675637722, 0.07206207513809204, -0.0237452182918787, 0.005231868010014296, 0.011007322929799557, -0.013160301372408867, -0.0...
0.093403
const { port1, port2 } = new MessageChannel(); port1.on('message', (message) => console.log(message)); const uint8Array = new Uint8Array([ 1, 2, 3, 4 ]); // This posts a copy of `uint8Array`: port2.postMessage(uint8Array); // This does not copy data, but renders `uint8Array` unusable: port2.postMessage(uint8Array, [ ui...
https://github.com/nodejs/node/blob/main/doc/api/worker_threads.md
main
nodejs
[ 0.009756986983120441, -0.006921874359250069, -0.07028131186962128, 0.01635579951107502, -0.08044452220201492, -0.03259734436869621, 0.019547421485185623, -0.02924235537648201, -0.0030704804230481386, -0.0758153572678566, -0.026304608210921288, 0.03286043182015419, -0.033494334667921066, 0....
0.11735
`URL` object throws a `DataCloneError`: ```js const { port1, port2 } = new MessageChannel(); port2.postMessage(new URL('https://example.org')); // Throws DataCloneError: Cannot clone object of unsupported type. ``` ### `port.hasRef()` \* Returns: {boolean} If true, the `MessagePort` object will keep the Node.js event l...
https://github.com/nodejs/node/blob/main/doc/api/worker_threads.md
main
nodejs
[ -0.1066184937953949, -0.036406632512807846, 0.09193205088376999, 0.05922582000494003, 0.023069748654961586, -0.13055717945098877, -0.004552718251943588, -0.04770386591553688, 0.05916822329163551, -0.039355985820293427, -0.009566816501319408, 0.03636183962225914, -0.023479236289858818, -0.0...
0.07772
users can create a `MessageChannel` object on either thread and pass one of the `MessagePort`s on that `MessageChannel` to the other thread through a pre-existing channel, such as the global one. See [`port.postMessage()`][] for more information on how messages are passed, and what kind of JavaScript values can be succ...
https://github.com/nodejs/node/blob/main/doc/api/worker_threads.md
main
nodejs
[ -0.010633070021867752, -0.04476606845855713, 0.05551089718937874, 0.04230659082531929, 0.0016260804841294885, -0.08880788832902908, 0.03898034617304802, -0.04261334612965584, 0.031229158863425255, -0.036897871643304825, -0.04113204404711723, -0.00468813581392169, -0.0023342829663306475, 0....
0.089722
If this is set to `true`, then the Worker tracks raw file descriptors managed through [`fs.open()`][] and [`fs.close()`][], and closes them when the Worker exits, similar to other resources like network sockets or file descriptors managed through the [`FileHandle`][] API. This option is automatically inherited by all n...
https://github.com/nodejs/node/blob/main/doc/api/worker_threads.md
main
nodejs
[ -0.10066226124763489, 0.042977917939424515, -0.023209625855088234, 0.05853896215558052, 0.11776741594076157, -0.06732726842164993, 0.056824155151844025, 0.00197711237706244, 0.004635046236217022, -0.03337956592440605, -0.035382892936468124, 0.07251548022031784, -0.053027018904685974, 0.007...
0.207331
snapshot Returns a readable stream for a V8 snapshot of the current state of the Worker. See [`v8.getHeapSnapshot()`][] for more details. If the Worker thread is no longer running, which may occur before the [`'exit'` event][] is emitted, the returned `Promise` is rejected immediately with an [`ERR\_WORKER\_NOT\_RUNNIN...
https://github.com/nodejs/node/blob/main/doc/api/worker_threads.md
main
nodejs
[ -0.10955510288476944, 0.0784420520067215, -0.009484946727752686, 0.04787571355700493, 0.07706734538078308, -0.1058545634150505, -0.04407098889350891, 0.012655514292418957, -0.011413443833589554, -0.030023423954844475, -0.09133044630289078, -0.027220452204346657, -0.03791002929210663, -0.03...
0.086504
{ Worker } = require('node:worker\_threads'); const worker = new Worker(` const { parentPort } = require('worker\_threads'); parentPort.on('message', () => {}); `, { eval: true }); worker.on('online', async () => { const handle = await worker.startCpuProfile({ sampleInterval: 1 }); const profile = await handle.stop(); ...
https://github.com/nodejs/node/blob/main/doc/api/worker_threads.md
main
nodejs
[ -0.0601230226457119, 0.05038493126630783, -0.021740444004535675, 0.0747871845960617, 0.055160343647003174, -0.07112495601177216, 0.04424247518181801, 0.04816211760044098, -0.010997352190315723, -0.05130454897880554, -0.006752533372491598, -0.0049332184717059135, -0.06538914889097214, -0.00...
0.070212
thread, it is available as [`require('node:worker\_threads').threadId`][]. This value is unique for each `Worker` instance inside a single process. ### `worker.threadName` \* {string|null} A string identifier for the referenced thread or null if the thread is not running. Inside the worker thread, it is available as [`...
https://github.com/nodejs/node/blob/main/doc/api/worker_threads.md
main
nodejs
[ -0.1013634204864502, 0.004839338827878237, -0.01978948898613453, 0.07867036759853363, 0.06472492218017578, -0.055999018251895905, 0.02620808407664299, -0.0564904548227787, 0.06208087503910065, -0.0065233116038143635, -0.08816805481910706, 0.03302424028515816, -0.06696317344903946, -0.03063...
0.144001
# Iterable Streams > Stability: 1 - Experimental The `node:stream/iter` module provides a streaming API built on iterables rather than the event-driven `Readable`/`Writable`/`Transform` class hierarchy, or the Web Streams `ReadableStream`/`WritableStream`/`TransformStream` interfaces. This module is available only when...
https://github.com/nodejs/node/blob/main/doc/api/stream_iter.md
main
nodejs
[ -0.12706738710403442, 0.037139348685741425, -0.02622019499540329, 0.037928782403469086, 0.015740852802991867, -0.07317868620157242, -0.05754825845360756, 0.04574378579854965, -0.038350723683834076, -0.0396055206656456, -0.06716842949390411, 0.07610536366701126, -0.03030470572412014, 0.0223...
0.144097
an error, or the consumer stops reading. Transforms can check `signal.aborted` or listen for the `'abort'` event to perform early cleanup. The flush signal (`null`) is sent after the source ends, giving transforms a chance to emit trailing data (e.g., compression footers). ```js // Stateless: uppercase transform const ...
https://github.com/nodejs/node/blob/main/doc/api/stream_iter.md
main
nodejs
[ -0.10735023766756058, 0.024544429033994675, 0.017920278012752533, 0.005732431076467037, -0.013999918475747108, -0.05321241542696953, -0.10601571202278137, 0.0036796496715396643, 0.026116445660591125, -0.03659644350409508, -0.018496524542570114, 0.02095472440123558, -0.0978211760520935, -0....
0.081974
-- without it, the first write // that fills the buffer blocks the producer forever. const consuming = text(readable); // GOOD: awaited writes. The producer waits for the consumer to // make room when the buffer is full. for (const item of dataset) { await writer.write(item); } await writer.end(); console.log(await con...
https://github.com/nodejs/node/blob/main/doc/api/stream_iter.md
main
nodejs
[ -0.044233739376068115, 0.025724411010742188, -0.02626907452940941, 0.08327171206474304, -0.013584738597273827, -0.06878725439310074, -0.010663239285349846, 0.02861018478870392, 0.017120540142059326, -0.025232724845409393, -0.024884885177016258, 0.0020987773314118385, -0.05911814421415329, ...
0.076431
discard anything beyond that const { writer, readable } = push({ highWaterMark: 10, backpressure: 'drop-newest', }); ``` ### Writer interface A writer is any object conforming to the Writer interface. Only `write()` is required; all other methods are optional. Each async method has a synchronous `\*Sync` counterpart de...
https://github.com/nodejs/node/blob/main/doc/api/stream_iter.md
main
nodejs
[ -0.0921134427189827, 0.004643209744244814, 0.034412190318107605, 0.08844869583845139, -0.02412232756614685, -0.05287157744169235, -0.07750822603702545, 0.0028626800049096346, -0.05809280276298523, -0.048358358442783356, -0.057958438992500305, 0.058323390781879425, -0.018019691109657288, -0...
0.016788
the iteration protocols (`Symbol.asyncIterator`, `Symbol.iterator`). ```mjs import { Buffer } from 'node:buffer'; import { from, text } from 'node:stream/iter'; console.log(await text(from('hello'))); // 'hello' console.log(await text(from(Buffer.from('hello')))); // 'hello' ``` ```cjs const { Buffer } = require('node:...
https://github.com/nodejs/node/blob/main/doc/api/stream_iter.md
main
nodejs
[ -0.016174813732504845, 0.023629607632756233, -0.027575410902500153, 0.03039882518351078, -0.03612980619072914, -0.0015920486766844988, -0.011283554136753082, 0.033119846135377884, 0.02250281162559986, -0.10472273081541061, -0.00020239259174559265, -0.009270035661756992, -0.007203500717878342...
0.047228
} return c; }); }; const result = pull(from('hello'), asciiUpper); console.log(await text(result)); // 'HELLO' ``` ```cjs const { from, pull, text } = require('node:stream/iter'); const asciiUpper = (chunks) => { if (chunks === null) return null; return chunks.map((c) => { for (let i = 0; i < c.length; i++) { c[i] -= (...
https://github.com/nodejs/node/blob/main/doc/api/stream_iter.md
main
nodejs
[ -0.05180549621582031, 0.09395438432693481, -0.029591219499707222, 0.007944922894239426, -0.03923710435628891, -0.028116848319768906, -0.02029716782271862, 0.07885497808456421, -0.005356924142688513, -0.06837169080972672, -0.008566683158278465, -0.07161948084831238, -0.018158946186304092, -...
0.138621
async dispose support for `await using`. ```mjs import { duplex, text } from 'node:stream/iter'; const [client, server] = duplex(); // Server echoes back const serving = (async () => { for await (const chunks of server.readable) { await server.writer.writev(chunks); } })(); await client.writer.write('hello'); await cli...
https://github.com/nodejs/node/blob/main/doc/api/stream_iter.md
main
nodejs
[ -0.043548256158828735, 0.062103912234306335, 0.03508549928665161, 0.09177838265895844, -0.0273793563246727, -0.010067682713270187, -0.06109776720404625, 0.027489228174090385, 0.06520826369524002, -0.014627285301685333, -0.05932724475860596, 0.07174891233444214, -0.023614026606082916, -0.01...
0.044483
{string} Synchronous version of [`text()`][]. ## Utilities ### `ondrain(drainable)` \* `drainable` {Object} An object implementing the drainable protocol. \* Returns: {Promise|null} Wait for a drainable writer's backpressure to clear. Returns `null` if the object does not implement the drainable protocol, or a promise ...
https://github.com/nodejs/node/blob/main/doc/api/stream_iter.md
main
nodejs
[ -0.08229828625917435, 0.0767337754368782, 0.012841739691793919, 0.08462425321340561, -0.0338701494038105, -0.05709195137023926, -0.007637721486389637, 0.02829795889556408, 0.017900994047522545, -0.062013763934373856, -0.06959662586450577, 0.044495511800050735, -0.035172365605831146, -0.032...
0.072598
run() { const { writer, broadcast: bc } = broadcast(); // Create consumers before writing const c1 = bc.push(); // Consumer 1 const c2 = bc.push(); // Consumer 2 // Producer and consumers must run concurrently. Awaited writes // block when the buffer fills until consumers read. const producing = (async () => { await wr...
https://github.com/nodejs/node/blob/main/doc/api/stream_iter.md
main
nodejs
[ -0.0017109792679548264, 0.010597978718578815, -0.029719913378357887, 0.0565955825150013, -0.04194217175245285, -0.0399942621588707, 0.006457144394516945, 0.03816543146967888, 0.047152310609817505, -0.010266127064824104, -0.03729630261659622, -0.027468303218483925, -0.04423064365983009, -0....
0.107095
input to extend `stream.Readable` or `stream.Writable` directly. The minimum contract is described below for each function. ### `fromReadable(readable)` > Stability: 1 - Experimental \* `readable` {stream.Readable|Object} A classic Readable stream or any object with `read()` and `on()` methods. \* Returns: {AsyncIterab...
https://github.com/nodejs/node/blob/main/doc/api/stream_iter.md
main
nodejs
[ -0.06062883138656616, -0.03311099112033844, -0.06653081625699997, 0.04145113006234169, -0.001560859614983201, -0.005366442259401083, 0.005351770669221878, 0.04205631464719772, -0.013775370083749294, -0.05499615520238876, -0.07713068276643753, 0.09415717422962189, -0.05864877253770828, 0.00...
0.104737
Creates a byte-mode [`stream.Readable`][] from an `AsyncIterable` (the native batch format used by the stream/iter API). Each `Uint8Array` in a yielded batch is pushed as a separate chunk into the Readable. ```mjs import { createWriteStream } from 'node:fs'; import { from, pull, toReadable } from 'node:stream/iter'; im...
https://github.com/nodejs/node/blob/main/doc/api/stream_iter.md
main
nodejs
[ -0.1268492490053177, 0.08845178782939911, -0.07044313102960587, 0.0384952649474144, 0.016659295186400414, -0.028510674834251404, -0.044425807893276215, 0.09055142104625702, -0.07737144082784653, -0.011555845849215984, -0.07430234551429749, 0.03229842707514763, -0.00434538908302784, 0.02122...
0.060139
{ writer, broadcast } = Broadcast(); this.#writer = writer; this.#broadcast = broadcast; } [Symbol.for('Stream.broadcastProtocol')](options) { return this.#broadcast; } send(data) { this.#writer.write(new TextEncoder().encode(data)); } close() { this.#writer.end(); } } const bus = new MessageBus(); const { broadcast } ...
https://github.com/nodejs/node/blob/main/doc/api/stream_iter.md
main
nodejs
[ -0.04386981949210167, 0.03013748861849308, -0.013928874395787716, 0.050268154591321945, -0.004908832721412182, -0.009402602910995483, 0.05499538034200668, 0.0261368490755558, 0.011677171103656292, -0.06955822557210922, -0.013432975858449936, 0.05266902223229408, -0.02861655503511429, -0.00...
0.115704
= require('node:stream/iter'); // This example defers to the built-in shareSync(), but a custom // implementation could use any mechanism. class SyncDataPool { #share; constructor(source) { this.#share = shareSync(source); } [Symbol.for('Stream.shareSyncProtocol')](options) { return this.#share; } } const encoder = new...
https://github.com/nodejs/node/blob/main/doc/api/stream_iter.md
main
nodejs
[ -0.08365615457296371, -0.01809670403599739, -0.06257255375385284, 0.035633355379104614, -0.005492350552231073, 0.022800220176577568, -0.0333586148917675, -0.03286042436957359, -0.02777642384171486, -0.05112770199775696, -0.03909754008054733, -0.028230035677552223, -0.04992017522454262, 0.0...
0.053902
# Modules: `node:module` API ## The `Module` object \* Type: {Object} Provides general utility methods when interacting with instances of `Module`, the [`module`][] variable often seen in [CommonJS][] modules. Accessed via `import 'node:module'` or `require('node:module')`. ### `module.builtinModules` \* Type: {string\...
https://github.com/nodejs/node/blob/main/doc/api/module.md
main
nodejs
[ -0.071896031498909, 0.016375703737139702, -0.022875988855957985, 0.07386341691017151, 0.0783470869064331, -0.041144028306007385, 0.012981930747628212, 0.03838743641972542, -0.013756604865193367, -0.09124356508255005, -0.00046204033424146473, 0.01436151098459959, 0.0032047443091869354, 0.02...
0.114206
\* Returns: {boolean} returns true if the module is builtin else returns false ```mjs import { isBuiltin } from 'node:module'; isBuiltin('node:fs'); // true isBuiltin('fs'); // true isBuiltin('wss'); // false ``` ### `module.register(specifier[, parentURL][, options])` > Stability: 0 - Deprecated: Use [`module.register...
https://github.com/nodejs/node/blob/main/doc/api/module.md
main
nodejs
[ -0.059800874441862106, 0.030447565019130707, -0.017260197550058365, 0.08234545588493347, 0.08658467233181, 0.0013925473904237151, 0.025028269737958908, 0.0508258119225502, -0.06929933279752731, 0.008116748183965683, -0.01648692414164543, -0.05488363280892372, 0.014306520111858845, 0.028391...
0.052226
a = 1\n\n//# sourceURL=source.ts; ``` ### `module.syncBuiltinESMExports()` The `module.syncBuiltinESMExports()` method updates all the live bindings for builtin [ES Modules][] to match the properties of the [CommonJS][] exports. It does not add or remove exported names from the [ES Modules][]. ```js const fs = require(...
https://github.com/nodejs/node/blob/main/doc/api/module.md
main
nodejs
[ -0.09071359783411026, -0.02774931490421295, -0.009627505205571651, 0.0462089367210865, 0.08867808431386948, -0.01892743445932865, -0.0075835660099983215, -0.014514269307255745, 0.01885620504617691, 0.0354665070772171, 0.013941586948931217, 0.024619070813059807, -0.027479203417897224, -0.04...
0.054586
are two ways to enable the portable mode: 1. Using the portable option in [`module.enableCompileCache()`][]: ```js // Non-portable cache (default): cache breaks if project is moved module.enableCompileCache({ directory: '/path/to/cache/storage/dir' }); // Portable cache: cache works after the project is moved module.en...
https://github.com/nodejs/node/blob/main/doc/api/module.md
main
nodejs
[ -0.011984393000602722, 0.046938829123973846, 0.02033280022442341, 0.05642739683389664, 0.08556140959262848, -0.05520634353160858, -0.02260020188987255, 0.026365069672465324, -0.05136575549840927, -0.03368077054619789, 0.02283521741628647, 0.09636372327804565, -0.06310834735631943, -0.00152...
-0.017442
message in the `message` field to aid debugging. If compile cache is enabled successfully, the `directory` field in the returned object contains the path to the directory where the compile cache is stored. The `status` field in the returned object would be one of the `module.constants.compileCacheStatus` values to indi...
https://github.com/nodejs/node/blob/main/doc/api/module.md
main
nodejs
[ -0.060910243541002274, 0.017687154933810234, 0.020274965092539787, 0.0656547024846077, 0.05400198698043823, -0.07366836071014404, 0.009077610448002815, -0.02041465975344181, 0.0029526464641094208, 0.029419248923659325, 0.012192415073513985, 0.07847242057323456, -0.07203635573387146, -0.046...
0.047094
need to be customized in the same module that registers the hooks, because static `import` statements are evaluated before any code in the importer module is run, including the call to `registerHooks()`, regardless of where the static `import` statements appear in the importer module. ```mjs import { registerHooks } fr...
https://github.com/nodejs/node/blob/main/doc/api/module.md
main
nodejs
[ -0.057980772107839584, 0.0028082828503102064, -0.002100449986755848, 0.06831037998199463, -0.004091382957994938, 0.012370487675070763, -0.012210224755108356, 0.07746830582618713, -0.06521033495664597, -0.03905469924211502, -0.018307847902178764, -0.051895998418331146, 0.046530112624168396, ...
0.036836
resolve(specifier, context, nextResolve) { console.log('resolve hook called for', specifier); return nextResolve(specifier, context); }, load(url, context, nextLoad) { return nextLoad(url, context); }, }); // At this point, the hooks are active and will be called for // any subsequent import() or require() calls. await...
https://github.com/nodejs/node/blob/main/doc/api/module.md
main
nodejs
[ -0.08368723839521408, -0.007814479991793633, 0.039774179458618164, 0.044312264770269394, 0.006281459238380194, -0.013619749806821346, -0.0511358417570591, 0.05040464177727699, 0.007963898591697216, -0.05557806044816971, 0.0036430107429623604, -0.04152599349617958, -0.003147727344185114, -0...
0.06913
the Node.js default `load` hook. Import type attributes are part of the cache key for saving loaded modules into the internal module cache. The `resolve` hook is responsible for returning an `importAttributes` object if the module should be cached with different attributes than were present in the source code. The `con...
https://github.com/nodejs/node/blob/main/doc/api/module.md
main
nodejs
[ -0.05273006856441498, 0.028401723131537437, 0.03476717323064804, 0.04931917041540146, 0.03780311718583107, 0.011912609450519085, 0.003260920289903879, 0.044917698949575424, 0.013760343194007874, -0.0059886802919209, -0.0008721744525246322, -0.010769205167889595, -0.011975753121078014, -0.0...
0.070134
// It's possible to modify the source code loaded by the next - possibly default - step, // for example, replacing 'foo' with 'bar' in the source code of the module. const result = nextLoad(url, context); const source = typeof result.source === 'string' ? result.source : Buffer.from(result.source).toString('utf8'); ret...
https://github.com/nodejs/node/blob/main/doc/api/module.md
main
nodejs
[ -0.12198913097381592, 0.04760332033038139, 0.03144052252173424, 0.030916066840291023, -0.08648494631052017, 0.058313388377428055, -0.040738631039857864, 0.0326492078602314, 0.016368865966796875, -0.037279482930898666, -0.0908379852771759, 0.0013638358796015382, -0.018270356580615044, -0.04...
0.015985
that CommonJS module. #### Registration of asynchronous customization hooks Asynchronous customization hooks are registered using [`module.register()`][`register`] which takes a path or URL to another module that exports the [asynchronous hook functions][]. Similar to `registerHooks()`, `register()` can be called in a ...
https://github.com/nodejs/node/blob/main/doc/api/module.md
main
nodejs
[ -0.048099394887685776, -0.026386186480522156, -0.009098932147026062, 0.06080957502126694, 0.030105354264378548, -0.03612487390637398, -0.005288552958518267, 0.04570545628666878, -0.025134259834885597, -0.029356444254517555, -0.018600711598992348, -0.004009957890957594, -0.016321474686264992,...
0.109578
#### Communication with asynchronous module customization hooks Asynchronous hooks run on a dedicated thread, separate from the main thread that runs application code. This means mutating global variables won't affect the other thread(s), and message channels must be used to communicate between the threads. The `regist...
https://github.com/nodejs/node/blob/main/doc/api/module.md
main
nodejs
[ -0.0069318003952503204, -0.03062068298459053, 0.0021835670340806246, 0.08080919086933136, -0.02511686645448208, -0.06751774996519089, 0.03783446550369263, 0.029525160789489746, -0.023341741412878036, -0.05086497962474823, -0.01937909610569477, 0.01383218914270401, -0.01748735085129738, -0....
0.107639
the hooks running on the hooks // thread, by sending `port2` to the `initialize` hook. const { port1, port2 } = new MessageChannel(); port1.on('message', (msg) => { assert.strictEqual(msg, 'increment: 2'); }); port1.unref(); register('./path-to-my-hooks.js', { parentURL: import.meta.url, data: { number: 1, port: port2 ...
https://github.com/nodejs/node/blob/main/doc/api/module.md
main
nodejs
[ -0.04079865291714668, -0.03160706162452698, 0.015618272125720978, 0.02535511925816536, 0.003272856818512082, -0.07578776776790619, 0.03856174647808075, 0.01753300242125988, 0.03417384624481201, -0.042467307299375534, -0.02361147664487362, 0.0028944883961230516, -0.04777318984270096, 0.0098...
0.102056
not calling nextResolve(). }; } // If no customization is needed, defer to the next hook in the chain which would be the // Node.js default resolve if this is the last user-specified loader. return nextResolve(specifier); } ``` #### Asynchronous `load(url, context, nextLoad)` \* `url` {string} The URL returned by the `...
https://github.com/nodejs/node/blob/main/doc/api/module.md
main
nodejs
[ -0.1070217564702034, 0.05674124136567116, 0.033610694110393524, -0.016203608363866806, -0.05924900248646736, 0.017850343137979507, -0.07766499370336533, 0.06651237607002258, 0.02213863469660282, -0.017271995544433594, -0.04771242290735245, 0.002892119809985161, -0.021752944216132164, -0.03...
-0.006505
result; } ``` This doesn't apply to the synchronous `load` hook either, in which case the `source` returned contains source code loaded by the next hook, regardless of module format. ### Examples The various module customization hooks can be used together to accomplish wide-ranging customizations of the Node.js code lo...
https://github.com/nodejs/node/blob/main/doc/api/module.md
main
nodejs
[ -0.09267224371433258, 0.06706893444061279, 0.05178491771221161, 0.049504246562719345, 0.0390092171728611, -0.04837978258728981, -0.08648986369371414, -0.0005835328483954072, 0.046443600207567215, 0.0003743182751350105, -0.04347987100481987, 0.0956583321094513, -0.0036309233400970697, -0.08...
0.078665
findPackageJSON } from 'node:module'; import coffeescript from 'coffeescript'; const extensionsRegex = /\.(coffee|litcoffee|coffee\.md)$/; function load(url, context, nextLoad) { if (extensionsRegex.test(url)) { const { source: rawSource } = nextLoad(url, { ...context, format: 'coffee' }); const transformedSource = cof...
https://github.com/nodejs/node/blob/main/doc/api/module.md
main
nodejs
[ -0.07854753732681274, 0.03024832159280777, 0.031843457370996475, 0.04575391486287117, 0.027259573340415955, 0.03822752460837364, 0.0004675117088481784, 0.07881604880094528, 0.018686367198824883, -0.07644066214561462, 0.004513016901910305, -0.0038771715480834246, -0.053428344428539276, 0.03...
0.044887
import { findSourceMap, SourceMap } from 'node:module'; ``` ```cjs // module.cjs // In a CommonJS module const { findSourceMap, SourceMap } = require('node:module'); ``` ### `module.getSourceMapsSupport()` \* Returns: {Object} \* `enabled` {boolean} If the source maps support is enabled \* `nodeModules` {boolean} If th...
https://github.com/nodejs/node/blob/main/doc/api/module.md
main
nodejs
[ -0.05744161084294319, 0.025851264595985413, 0.011947562918066978, 0.043459054082632065, 0.11765345931053162, -0.0038544433191418648, -0.025398332625627518, 0.025322405621409416, -0.044871628284454346, -0.01992860622704029, 0.06004511937499046, 0.009428649209439754, -0.010895606130361557, -...
0.060599
use `sourceMap.findOrigin(lineNumber, columnNumber)` #### `sourceMap.findOrigin(lineNumber, columnNumber)` \* `lineNumber` {number} The 1-indexed line number of the call site in the generated source \* `columnNumber` {number} The 1-indexed column number of the call site in the generated source \* Returns: {Object} Give...
https://github.com/nodejs/node/blob/main/doc/api/module.md
main
nodejs
[ -0.07876600325107574, 0.030870867893099785, -0.07602883130311966, 0.04041977971792221, -0.0003649408754426986, -0.041542839258909225, 0.06546778231859207, 0.028150202706456184, 0.03382407873868942, 0.014325134456157684, -0.01791469007730484, -0.08955305069684982, -0.024581843987107277, -0....
0.051967
# Errors Applications running in Node.js will generally experience the following categories of errors: \* Standard JavaScript errors such as {EvalError}, {SyntaxError}, {RangeError}, {ReferenceError}, {TypeError}, and {URIError}. \* Standard `DOMException`s. \* System errors triggered by underlying operating system con...
https://github.com/nodejs/node/blob/main/doc/api/errors.md
main
nodejs
[ -0.062240272760391235, 0.027866180986166, 0.06844081729650497, 0.0728336051106453, 0.09863225370645523, -0.06461440771818161, -0.012466990388929844, 0.04624300077557564, 0.04126453027129173, 0.020869484171271324, -0.04785948619246483, 0.05119163915514946, 0.06125248596072197, -0.0235360264...
0.126919
of error encountered by // the connection, the error will be sent here. console.error(err); }); connection.pipe(process.stdout); ``` \* A handful of typically asynchronous methods in the Node.js API may still use the `throw` mechanism to raise exceptions that must be handled using `try…catch`. There is no comprehensive...
https://github.com/nodejs/node/blob/main/doc/api/errors.md
main
nodejs
[ 0.013868861831724644, 0.02359529584646225, 0.02841118350625038, 0.04951511695981026, 0.05448136851191521, -0.015219088643789291, -0.028526542708277702, 0.075242780148983, 0.054756369441747665, 0.010190844535827637, -0.08372510224580765, 0.004300975706428289, -0.031394604593515396, -0.03355...
0.11877
Error.stackTraceLimit = stackTraceLimit; // Capture the stack trace above function b Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace throw error; } a(); ``` ### `Error.stackTraceLimit` \* Type: {number} The `Error.stackTraceLimit` property specifies the number of stack fra...
https://github.com/nodejs/node/blob/main/doc/api/errors.md
main
nodejs
[ -0.03872191905975342, -0.05922430381178856, -0.008602508343756199, 0.021820390596985817, 0.025894371792674065, -0.0223535168915987, 0.013964652083814144, 0.08591453731060028, 0.05758989229798317, -0.045849207788705826, -0.01605682075023651, -0.04489414766430855, -0.004165926482528448, -0.0...
0.100577
occasionally it will not be able to find a suitable name. If V8 cannot determine a name for the function, only location information will be displayed for that frame. Otherwise, the determined function name will be displayed with location information appended in parentheses. Frames are only generated for JavaScript func...
https://github.com/nodejs/node/blob/main/doc/api/errors.md
main
nodejs
[ -0.07417674362659454, -0.028880858793854713, 0.0074216690845787525, 0.0248465184122324, 0.03207665681838989, -0.06286196410655975, -0.022847436368465424, -0.003805391024798155, 0.08518581092357635, -0.13090798258781433, 0.03821457177400589, 0.022982530295848846, -0.09431666880846024, -0.06...
0.090949
program. ```js try { require('node:vm').runInThisContext('binary ! isNotOk'); } catch (err) { // 'err' will be a SyntaxError. } ``` `SyntaxError` instances are unrecoverable in the context that created them – they may only be caught by other contexts. ## Class: `SystemError` \* Extends: {errors.Error} Node.js generates...
https://github.com/nodejs/node/blob/main/doc/api/errors.md
main
nodejs
[ -0.04694998264312744, 0.03325439617037773, 0.0050604999996721745, 0.030107714235782623, 0.09047097712755203, -0.05614336207509041, -0.0011030883761122823, 0.10608445107936859, 0.011791262775659561, 0.013818138279020786, -0.01088580209761858, 0.016272127628326416, 0.07433000952005386, -0.05...
0.172757
operation expected a file, but the given pathname was a directory. \* `EMFILE` (Too many open files in system): Maximum number of [file descriptors][] allowable on the system has been reached, and requests for another descriptor cannot be fulfilled until at least one has been closed. This is encountered when opening ma...
https://github.com/nodejs/node/blob/main/doc/api/errors.md
main
nodejs
[ -0.045455675572156906, -0.025309303775429726, -0.021494638174772263, -0.013178040273487568, 0.1046394631266594, -0.10728993266820908, -0.03569211810827255, 0.10907094925642014, 0.07354087382555008, 0.06412189453840256, 0.004177632741630077, 0.03204290196299553, -0.005423711147159338, -0.02...
0.199073
this code. This code does not use the regular `ERR\_\*` convention Node.js errors use in order to be compatible with the web platform's `AbortError`. ### `ERR\_ACCESS\_DENIED` A special type of error that is triggered whenever Node.js tries to get access to a resource restricted by the [Permission Model][]. ### `ERR\_A...
https://github.com/nodejs/node/blob/main/doc/api/errors.md
main
nodejs
[ -0.080411896109581, 0.06647758930921555, 0.013404667377471924, 0.055416274815797806, 0.11287738382816315, -0.09904157370328903, 0.053018637001514435, 0.014683492481708527, 0.010033268481492996, -0.04591939225792885, 0.01268809661269188, 0.02381403185427189, 0.03846760466694832, 0.008971942...
0.106196
size is reached when the context is created. ### `ERR\_CPU\_PROFILE\_ALREADY\_STARTED` The CPU profile with the given name is already started. ### `ERR\_CPU\_PROFILE\_NOT\_STARTED` The CPU profile with the given name is not started. ### `ERR\_CPU\_PROFILE\_TOO\_MANY` There are too many CPU profiles being collected. ###...
https://github.com/nodejs/node/blob/main/doc/api/errors.md
main
nodejs
[ -0.011182716116309166, 0.05812237784266472, -0.09189756959676743, 0.07162582129240036, 0.055424537509679794, -0.09152072668075562, -0.06197568029165268, 0.062039997428655624, -0.022503485903143883, -0.09965211153030396, 0.02668803744018078, -0.050896719098091125, -0.0034333516377955675, -0...
0.037503
unknown cipher was specified. ### `ERR\_CRYPTO\_UNKNOWN\_DH\_GROUP` An unknown Diffie-Hellman group name was given. See [`crypto.getDiffieHellman()`][] for a list of valid group names. ### `ERR\_CRYPTO\_UNSUPPORTED\_OPERATION` An attempt to invoke an unsupported crypto operation was made. ### `ERR\_DEBUGGER\_ERROR` An ...
https://github.com/nodejs/node/blob/main/doc/api/errors.md
main
nodejs
[ -0.09884605556726456, 0.0536111481487751, -0.05791372060775757, 0.034581564366817474, 0.03067348524928093, -0.10173151642084122, -0.04368463158607483, -0.05653514713048935, -0.004530230071395636, 0.00980209931731224, 0.08426576852798462, -0.05384346470236778, -0.04596666991710663, 0.041680...
0.050567
require a valid origin. ### `ERR\_HTTP2\_ALTSVC\_LENGTH` HTTP/2 ALTSVC frames are limited to a maximum of 16,382 payload bytes. ### `ERR\_HTTP2\_CONNECT\_AUTHORITY` For HTTP/2 requests using the `CONNECT` method, the `:authority` pseudo-header is required. ### `ERR\_HTTP2\_CONNECT\_PATH` For HTTP/2 requests using the `...
https://github.com/nodejs/node/blob/main/doc/api/errors.md
main
nodejs
[ -0.06114806607365608, -0.055128272622823715, -0.06569497287273407, -0.0746736079454422, -0.03704410791397095, -0.10636618733406067, -0.054587472230196, -0.04353548213839531, 0.06207052990794182, 0.041417043656110764, 0.025019356980919838, -0.01933101750910282, 0.027229929342865944, 0.03202...
0.047297
error code. ### `ERR\_HTTP2\_SETTINGS\_CANCEL` The `Http2Session` settings canceled. ### `ERR\_HTTP2\_SOCKET\_BOUND` An attempt was made to connect a `Http2Session` object to a `net.Socket` or `tls.TLSSocket` that had already been bound to another `Http2Session` object. ### `ERR\_HTTP2\_SOCKET\_UNBOUND` An attempt was ...
https://github.com/nodejs/node/blob/main/doc/api/errors.md
main
nodejs
[ -0.06160885468125343, 0.04098404943943024, -0.0388004444539547, -0.06977840512990952, -0.03511364385485649, -0.07961226999759674, -0.03395475447177887, 0.0007558814249932766, 0.020596643909811974, 0.0878663882613182, 0.027978215366601944, 0.017948633059859276, 0.010871420614421368, 0.03000...
0.033515
attempt was made to connect when the inspector was already connected. ### `ERR\_INSPECTOR\_CLOSED` While using the `node:inspector` module, an attempt was made to use the inspector after the session had already closed. ### `ERR\_INSPECTOR\_COMMAND` An error occurred while issuing a command via the `node:inspector` modu...
https://github.com/nodejs/node/blob/main/doc/api/errors.md
main
nodejs
[ -0.061740342527627945, -0.01203918643295765, -0.07163476943969727, 0.07386983931064606, 0.08655480295419693, -0.023515550419688225, -0.02688557282090187, -0.02401087060570717, 0.010215124115347862, 0.05668957158923149, 0.02471829205751419, -0.006082913372665644, -0.02274514175951481, -0.04...
0.194484
case a function option does not provide a valid value for one of its returned object properties on execution. ### `ERR\_INVALID\_RETURN\_PROPERTY\_VALUE` Thrown in case a function option does not provide an expected value type for one of its returned object properties on execution. ### `ERR\_INVALID\_RETURN\_VALUE` Thr...
https://github.com/nodejs/node/blob/main/doc/api/errors.md
main
nodejs
[ -0.07232412695884705, 0.02901618555188179, -0.012545022182166576, 0.04568936675786972, 0.017143744975328445, -0.07791970670223236, 0.04448235407471657, 0.07439963519573212, 0.01215032022446394, -0.007708777207881212, 0.008190478198230267, -0.002665623789653182, -0.059009235352277756, 0.016...
0.103139
strict compliance with the API specification (which in some cases may accept `func(undefined)` but not `func()`). In most native Node.js APIs, `func(undefined)` and `func()` are treated identically, and the [`ERR\_INVALID\_ARG\_TYPE`][] error code may be used instead. ### `ERR\_MISSING\_OPTION` For APIs that accept opt...
https://github.com/nodejs/node/blob/main/doc/api/errors.md
main
nodejs
[ -0.12683214247226715, -0.013346968218684196, 0.011472001671791077, 0.04792783781886101, 0.08852241933345795, -0.040693316608667374, 0.010775227099657059, -0.017774926498532295, 0.019900068640708923, -0.02375168912112713, 0.025516998022794724, 0.014293257147073746, -0.019523493945598602, 0....
0.044323