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
++i) { zlib.deflate(payload, (err, buffer) => {}); } ``` ```cjs const zlib = require('node:zlib'); const payload = Buffer.from('This is some data'); // WARNING: DO NOT DO THIS! for (let i = 0; i < 30000; ++i) { zlib.deflate(payload, (err, buffer) => {}); } ``` In the preceding example, 30,000 deflate instances are created concurrently. Because of how some operating systems handle memory allocation and deallocation, this may lead to significant memory fragmentation. It is strongly recommended that the results of compression operations be cached to avoid duplication of effort. ## Compressing HTTP requests and responses The `node:zlib` module can be used to implement support for the `gzip`, `deflate`, `br`, and `zstd` content-encoding mechanisms defined by [HTTP](https://tools.ietf.org/html/rfc7230#section-4.2). The HTTP [`Accept-Encoding`][] header is used within an HTTP request to identify the compression encodings accepted by the client. The [`Content-Encoding`][] header is used to identify the compression encodings actually applied to a message. The examples given below are drastically simplified to show the basic concept. Using `zlib` encoding can be expensive, and the results ought to be cached. See [Memory usage tuning][] for more information on the speed/memory/compression tradeoffs involved in `zlib` usage. ```mjs // Client request example import fs from 'node:fs'; import zlib from 'node:zlib'; import http from 'node:http'; import process from 'node:process'; import { pipeline } from 'node:stream'; const request = http.get({ host: 'example.com', path: '/', port: 80, headers: { 'Accept-Encoding': 'br,gzip,deflate,zstd' } }); request.on('response', (response) => { const output = fs.createWriteStream('example.com\_index.html'); const onError = (err) => { if (err) { console.error('An error occurred:', err); process.exitCode = 1; } }; switch (response.headers['content-encoding']) { case 'br': pipeline(response, zlib.createBrotliDecompress(), output, onError); break; // Or, just use zlib.createUnzip() to handle both of the following cases: case 'gzip': pipeline(response, zlib.createGunzip(), output, onError); break; case 'deflate': pipeline(response, zlib.createInflate(), output, onError); break; case 'zstd': pipeline(response, zlib.createZstdDecompress(), output, onError); break; default: pipeline(response, output, onError); break; } }); ``` ```cjs // Client request example const zlib = require('node:zlib'); const http = require('node:http'); const fs = require('node:fs'); const { pipeline } = require('node:stream'); const request = http.get({ host: 'example.com', path: '/', port: 80, headers: { 'Accept-Encoding': 'br,gzip,deflate,zstd' } }); request.on('response', (response) => { const output = fs.createWriteStream('example.com\_index.html'); const onError = (err) => { if (err) { console.error('An error occurred:', err); process.exitCode = 1; } }; switch (response.headers['content-encoding']) { case 'br': pipeline(response, zlib.createBrotliDecompress(), output, onError); break; // Or, just use zlib.createUnzip() to handle both of the following cases: case 'gzip': pipeline(response, zlib.createGunzip(), output, onError); break; case 'deflate': pipeline(response, zlib.createInflate(), output, onError); break; case 'zstd': pipeline(response, zlib.createZstdDecompress(), output, onError); break; default: pipeline(response, output, onError); break; } }); ``` ```mjs // server example // Running a gzip operation on every request is quite expensive. // It would be much more efficient to cache the compressed buffer. import zlib from 'node:zlib'; import http from 'node:http'; import fs from 'node:fs'; import { pipeline } from 'node:stream'; http.createServer((request, response) => { const raw = fs.createReadStream('index.html'); // Store both a compressed and an uncompressed version of the resource. response.setHeader('Vary', 'Accept-Encoding'); const acceptEncoding = request.headers['accept-encoding'] || ''; const onError = (err) => { if (err) { // If an error occurs, there's not much we can do because // the server has already sent the 200 response code and // some amount of data has already been sent to the client. // The best we can do is terminate the response immediately // and log the error. response.end(); console.error('An error occurred:', err); } }; // Note: This is not a conformant accept-encoding parser. // See https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3 if (/\bdeflate\b/.test(acceptEncoding)) { response.writeHead(200, { 'Content-Encoding': 'deflate' }); pipeline(raw, zlib.createDeflate(), response, onError); } else if (/\bgzip\b/.test(acceptEncoding)) { response.writeHead(200, { 'Content-Encoding': 'gzip' });
https://github.com/nodejs/node/blob/main//doc/api/zlib.md
main
nodejs
[ -0.11390027403831482, 0.06694633513689041, -0.018965868279337883, 0.041996926069259644, 0.038023535162210464, -0.13846160471439362, 0.011119208298623562, 0.06890664249658585, -0.0219439584761858, -0.030735624954104424, -0.05379801616072655, 0.06689013540744781, -0.01511075533926487, 0.02520483173429966, -0.0010933179873973131, -0.014514128677546978, -0.017944149672985077, 0.06207552179694176, -0.048507481813430786, -0.054629381746053696, 0.05566268414258957, 0.006857920903712511, 0.015336034819483757, -0.012423836626112461, 0.05787024274468422, -0.02721673622727394, -0.030762609094381332, -0.03397436439990997, 0.10896778851747513, -0.0009626261307857931, 0.039683692157268524, -0.02143792435526848, -0.027928682044148445, 0.052110325545072556, -0.01135936938226223, 0.13478687405586243, 0.007395132910460234, -0.08052098006010056, -0.03552858904004097, -0.006399220321327448, 0.012012193910777569, 0.18235494196414948, -0.08729686588048935, 0.06271486729383469, 0.023966047912836075, 0.08431699872016907, 0.009439841844141483, 0.008187444880604744, -0.06490587443113327, 0.0016512388829141855, -0.021015850827097893, -0.002532237209379673, -0.07218644767999649, 0.09756758064031601, -0.021813565865159035, -0.0352051816880703, -0.09968248009681702, -0.024160213768482208, -0.01134458277374506, 0.0772433802485466, -0.08596553653478622, -0.0037862909957766533, 0.04040737822651863, 0.04757743701338768, 0.07510177791118622, -0.0034833699464797974, 0.1035456657409668, -0.0070923445746302605, -0.025127990171313286, 0.02207591012120247, 0.0029281298629939556, 0.012264106422662735, -0.04104001820087433, 0.056619465351104736, -0.07651198655366898, -0.07007935643196106, -0.01478472538292408, -0.051616769284009933, -0.040507324039936066, 0.044765207916498184, 0.005966019816696644, -0.08407138288021088, 0.05009319633245468, -0.029622714966535568, -0.013116351328790188, -0.03119436278939247, -0.03942834213376045, -0.0012182160280644894, -0.0423441044986248, 0.005752237979322672, 0.02148004248738289, 0.04705015942454338, -0.031819988042116165, 0.14701902866363525, -0.05566021054983139, 0.05025819316506386, 0.04073629155755043, 0.004903562366962433, 0.0008865271229296923, 0.0555870458483696, 0.05423513799905777, 0.032118938863277435, 0.11731930822134018, 0.009985888376832008, -0.012371706776320934, -0.0876689925789833, 0.04129878059029579, 0.05900220572948456, -0.1182921975851059, 0.10486803948879242, -0.029929736629128456, 0.041586920619010925, 0.03467597812414169, -0.09192090481519699, -0.06541191041469574, 0.009812276810407639, -0.029594147577881813, 0.010005436837673187, -0.041979409754276276, 0.0866314098238945, 0.01664680428802967, 0.027053900063037872, -0.03783465176820755, -0.0007477534236386418, 0.005872043780982494, -0.044438015669584274, -0.05869543179869652, 2.879636612871182e-33, -0.019980110228061676, -0.014347954653203487, -0.050889045000076294, 0.08187445998191833, -0.06974779814481735, 0.0606091134250164, -0.0044428640976548195, 0.06303819268941879, -0.08427352458238602, 0.0087025947868824, -0.041234392672777176, 0.0038405046798288822, 0.007373835425823927, -0.00971739087253809, -0.03462255746126175, -0.04308350011706352, 0.058635588735342026, 0.018001485615968704, 0.0128695173189044, 0.09309221059083939, 0.0445580892264843, -0.030798811465501785, -0.03713466227054596, -0.02954934537410736, 0.012332870624959469, 0.018310362473130226, -0.01695208251476288, -0.04672815650701523, -0.04218224436044693, -0.012075724080204964, 0.03769311308860779, 0.03056294657289982, -0.07489117234945297, 0.0031121294014155865, 0.09371362626552582, -0.00978308916091919, 0.03584572672843933, -0.026183241978287697, -0.12339026480913162, -0.06507235020399094, 0.023936280980706215, 0.042406439781188965, -0.0866304486989975, 0.025202319025993347, -0.051437344402074814, -0.04697784036397934, 0.01172955334186554, -0.030195435509085655, -0.008223176002502441, -0.030953925102949142, 0.04074936360120773, 0.09347162395715714, -0.03937351331114769, 0.08963128179311752, 0.002588798990473151, 0.0013460720656439662, 0.044659990817308426, -0.1120418831706047, -0.0006811055936850607, 0.06468969583511353, 0.026948167011141777, 0.01500722300261259, -0.0020486239809542894, 0.0451749749481678, 0.03454992547631264, 0.017997587099671364, -0.08215595781803131, 0.058166563510894775, -0.0029098596423864365, 0.041951704770326614, -0.04573396220803261, -0.009286023676395416, 0.052471548318862915, -0.024563880637288094, -0.03421695902943611, -0.03389490768313408, -0.035404022783041, -0.031161407008767128, -0.03423168137669563, -0.07698355615139008, 0.05293423682451248, -0.04839029908180237, 0.0446535125374794, 0.03123369812965393, 0.023810923099517822, -0.04500022903084755, -0.02382528781890869, -0.04322920739650726, 0.021688371896743774, 0.012554795481264591, 0.011066801846027374, -0.05410119518637657, 0.021360570564866066, -0.14147618412971497, -0.048608798533678055, -3.067281510776913e-33, -0.005073660984635353, 0.07703343778848648, -0.12701182067394257, 0.08298283070325851, 0.02851243130862713, -0.0003175114397890866, 0.03682903200387955, 0.020555483177304268, -0.028181830421090126, -0.044441863894462585, -0.05325441434979439, -0.0016875877045094967, 0.062171127647161484, 0.024835646152496338, -0.019414877519011497, 0.082246333360672, -0.05604280158877373, -0.061632491648197174, 0.015452181920409203, -0.04257447272539139, -0.05821827054023743, -0.017559915781021118, 0.07242019474506378, -0.03294213116168976, -0.020655451342463493, 0.06795307993888855, -0.04985984414815903, -0.01871333457529545, 0.07935751229524612, -0.010066782124340534, -0.04396221786737442, 0.003274624701589346, -0.06096279248595238, -0.06597860902547836, 0.0029670994263142347, 0.00047136229113675654, 0.0005130533245392144, 0.1287485957145691, 0.007122147362679243, -0.09095551073551178, 0.07443095743656158, 0.019097959622740746, -0.07211976498365402, 0.011819672770798206, 0.025026675313711166, -0.01673855446279049, -0.06756789237260818, -0.05691911652684212, 0.0436176173388958, 0.0014064477290958166, -0.005447329953312874, 0.07015648484230042, -0.06031543016433716, 0.02923526056110859, 0.07757692784070969, -0.04944757744669914, -0.03938746452331543, -0.014775235205888748, 0.0334816575050354, -0.009714034385979176, -0.011591409333050251, -0.03294165059924126, -0.08336237072944641, -0.05453412979841232, 0.04223738983273506, -0.048302363604307175, -0.04479839280247688, -0.05122390389442444, 0.07602542638778687, 0.06197286769747734, 0.06253862380981445, 0.04999043419957161, 0.012670908123254776, -0.0011594522511586547, -0.04460684210062027, 0.017309915274381638, 0.04636894911527634, -0.061889830976724625, 0.022825006395578384, 0.05516330525279045, 0.04103540629148483, 0.1023116186261177, 0.02875467948615551, 0.08850990235805511, 0.02135162241756916, -0.049060970544815063, -0.032954782247543335, -0.037866801023483276, -0.046412739902734756, -0.011226006783545017, 0.0002897537196986377, 0.009548933245241642, -0.043896984308958054, 0.006799500435590744, -0.019211363047361374, -4.7961535187823756e-8, -0.0627962052822113, -0.009641519747674465, -0.07897570729255676, 0.0387459397315979, 0.04022872820496559, -0.033927880227565765, 0.007899668999016285, 0.04847057908773422, 0.013593385927379131, -0.03904721140861511, 0.08075805008411407, 0.02211904339492321, 0.009697017259895802, 0.020643530413508415, 0.07992855459451675, 0.09201832115650177, -0.051527488976716995, -0.046347543597221375, -0.025366198271512985, 0.012516595423221588, -0.02002052403986454, -0.002999455202370882, -0.07145479321479797, 0.07562663406133652, 0.012249222956597805, -0.033310774713754654, 0.07184644043445587, 0.07963824272155762, -0.01688580960035324, -0.05083717405796051, -0.10641901940107346, 0.021732982248067856, 0.03474254533648491, -0.01879434660077095, -0.002057589590549469, 0.007710293401032686, -0.03952113166451454, -0.019673524424433708, 0.02204044722020626, 0.029234180226922035, 0.01391252875328064, 0.014221373945474625, 0.021392647176980972, 0.038988374173641205, 0.03530656546354294, -0.02379281260073185, -0.0462341234087944, 0.003483345964923501, 0.039054423570632935, 0.08415807038545609, 0.0639858990907669, -0.002959126140922308, -0.07711216062307358, 0.06414218246936798, 0.05766705051064491, -0.02727624773979187, -0.033223945647478104, -0.03734707087278366, 0.024512337520718575, 0.06631645560264587, -0.03064665198326111, -0.035840850323438644, 0.017527973279356956, -0.04792525991797447 ]
0.100657
terminate the response immediately // and log the error. response.end(); console.error('An error occurred:', err); } }; // Note: This is not a conformant accept-encoding parser. // See https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3 if (/\bdeflate\b/.test(acceptEncoding)) { response.writeHead(200, { 'Content-Encoding': 'deflate' }); pipeline(raw, zlib.createDeflate(), response, onError); } else if (/\bgzip\b/.test(acceptEncoding)) { response.writeHead(200, { 'Content-Encoding': 'gzip' }); pipeline(raw, zlib.createGzip(), response, onError); } else if (/\bbr\b/.test(acceptEncoding)) { response.writeHead(200, { 'Content-Encoding': 'br' }); pipeline(raw, zlib.createBrotliCompress(), response, onError); } else if (/\bzstd\b/.test(acceptEncoding)) { response.writeHead(200, { 'Content-Encoding': 'zstd' }); pipeline(raw, zlib.createZstdCompress(), response, onError); } else { response.writeHead(200, {}); pipeline(raw, response, onError); } }).listen(1337); ``` ```cjs // server example // Running a gzip operation on every request is quite expensive. // It would be much more efficient to cache the compressed buffer. const zlib = require('node:zlib'); const http = require('node:http'); const fs = require('node:fs'); const { pipeline } = require('node:stream'); http.createServer((request, response) => { const raw = fs.createReadStream('index.html'); // Store both a compressed and an uncompressed version of the resource. response.setHeader('Vary', 'Accept-Encoding'); const acceptEncoding = request.headers['accept-encoding'] || ''; const onError = (err) => { if (err) { // If an error occurs, there's not much we can do because // the server has already sent the 200 response code and // some amount of data has already been sent to the client. // The best we can do is terminate the response immediately // and log the error. response.end(); console.error('An error occurred:', err); } }; // Note: This is not a conformant accept-encoding parser. // See https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3 if (/\bdeflate\b/.test(acceptEncoding)) { response.writeHead(200, { 'Content-Encoding': 'deflate' }); pipeline(raw, zlib.createDeflate(), response, onError); } else if (/\bgzip\b/.test(acceptEncoding)) { response.writeHead(200, { 'Content-Encoding': 'gzip' }); pipeline(raw, zlib.createGzip(), response, onError); } else if (/\bbr\b/.test(acceptEncoding)) { response.writeHead(200, { 'Content-Encoding': 'br' }); pipeline(raw, zlib.createBrotliCompress(), response, onError); } else if (/\bzstd\b/.test(acceptEncoding)) { response.writeHead(200, { 'Content-Encoding': 'zstd' }); pipeline(raw, zlib.createZstdCompress(), response, onError); } else { response.writeHead(200, {}); pipeline(raw, response, onError); } }).listen(1337); ``` By default, the `zlib` methods will throw an error when decompressing truncated data. However, if it is known that the data is incomplete, or the desire is to inspect only the beginning of a compressed file, it is possible to suppress the default error handling by changing the flushing method that is used to decompress the last chunk of input data: ```js // This is a truncated version of the buffer from the above examples const buffer = Buffer.from('eJzT0yMA', 'base64'); zlib.unzip( buffer, // For Brotli, the equivalent is zlib.constants.BROTLI\_OPERATION\_FLUSH. // For Zstd, the equivalent is zlib.constants.ZSTD\_e\_flush. { finishFlush: zlib.constants.Z\_SYNC\_FLUSH }, (err, buffer) => { if (err) { console.error('An error occurred:', err); process.exitCode = 1; } console.log(buffer.toString()); }); ``` This will not change the behavior in other error-throwing situations, e.g. when the input data has an invalid format. Using this method, it will not be possible to determine whether the input ended prematurely or lacks the integrity checks, making it necessary to manually check that the decompressed result is valid. ## Memory usage tuning ### For zlib-based streams From `zlib/zconf.h`, modified for Node.js usage: The memory requirements for deflate are (in bytes): ```js (1 << (windowBits + 2)) + (1 << (memLevel + 9)) ``` That is: 128K for `windowBits` = 15 + 128K for `memLevel` = 8 (default values) plus a few kilobytes for small objects. For example, to reduce the default memory requirements from 256K to 128K, the options should be set to: ```js const options = { windowBits: 14, memLevel: 7 }; ``` This will, however, generally degrade compression. The memory requirements for inflate are (in bytes) `1 << windowBits`. That is, 32K for `windowBits` = 15 (default value) plus a few kilobytes for small objects. This is
https://github.com/nodejs/node/blob/main//doc/api/zlib.md
main
nodejs
[ -0.09059597551822662, 0.08576299250125885, -0.04557866230607033, 0.018424976617097855, 0.027890583500266075, -0.11097956448793411, -0.05110948160290718, 0.008049807511270046, -0.03053341619670391, 0.0048749567940831184, -0.037008292973041534, -0.05908353999257088, 0.0018975877901539207, 0.0731826201081276, -0.016065292060375214, -0.0612453892827034, -0.03177236393094063, 0.01642102189362049, -0.02363596297800541, -0.030234217643737793, 0.04881219193339348, 0.03584374487400055, 0.06745681166648865, 0.03299805149435997, 0.03766881674528122, -0.016734760254621506, -0.031953100115060806, -0.028434498235583305, 0.028893673792481422, 0.013487855903804302, 0.040255386382341385, -0.05453025922179222, -0.022909604012966156, 0.010648342780768871, 0.08540099859237671, 0.09295157343149185, 0.09831609576940536, -0.06361335515975952, -0.04984079301357269, -0.008311772719025612, 0.006784720811992884, 0.03939254581928253, -0.06399498134851456, 0.03878044709563255, 0.01141001284122467, 0.06552547961473465, 0.038729362189769745, 0.027526790276169777, -0.11448892205953598, 0.01151986327022314, -0.014981675893068314, 0.0244721919298172, -0.037523798644542694, 0.07042673975229263, -0.0013482548529282212, 0.0160874892026186, -0.10811808705329895, 0.013396316207945347, -0.029361272230744362, 0.005561661906540394, -0.10518667101860046, -0.04796610772609711, -0.057157326489686966, 0.02588828094303608, 0.03663811460137367, 0.046990808099508286, 0.07197108864784241, -0.05544080212712288, -0.06935887038707733, -0.017235340550541878, -0.06113222613930702, -0.05944373458623886, -0.12466985732316971, 0.05577976256608963, -0.03560079261660576, 0.053095318377017975, 0.05063820257782936, 0.008159786462783813, -0.01474269013851881, 0.02043863944709301, 0.028575129806995392, -0.1215776577591896, 0.058595359325408936, 0.07715503126382828, 0.02448911964893341, -0.0240362249314785, -0.0479280948638916, 0.0744277834892273, -0.04884606972336769, 0.040408048778772354, -0.010446509346365929, 0.0707826241850853, -0.007570063229650259, 0.13606013357639313, 0.006135381758213043, 0.06778838485479355, 0.036292631179094315, -0.016429565846920013, 0.027820918709039688, 0.07580895721912384, 0.0538874976336956, -0.019875507801771164, 0.017046138644218445, -0.05706512928009033, 0.00408517150208354, -0.04269588738679886, 0.04737836867570877, 0.04532831162214279, -0.01718008704483509, 0.04816393181681633, -0.017835868522524834, -0.023887930437922478, 0.021038800477981567, -0.10025462508201599, 0.01593039371073246, 0.043616365641355515, -0.024271441623568535, 0.055036332458257675, -0.0812968984246254, -0.0221459548920393, 0.014730827882885933, -0.0034528232645243406, -0.03233443200588226, -0.016173023730516434, 0.058784231543540955, -0.08193144202232361, 0.07563430070877075, 1.567424371195593e-33, -0.05789048969745636, 0.008227716200053692, -0.00766407884657383, 0.05004635080695152, -0.04101254791021347, 0.11231657862663269, 0.04086160659790039, 0.07400874048471451, -0.06129002943634987, -0.04545820131897926, -0.024618025869131088, -0.08206892013549805, -0.025220831856131554, -0.045831311494112015, -0.05848413705825806, 0.00022827781504020095, 0.03605934605002403, 0.01424536295235157, 0.008075898513197899, 0.10234270244836807, 0.07963654398918152, -0.0432484932243824, -0.019496643915772438, -0.03445608541369438, -0.015289767645299435, -0.028072597458958626, -0.04667489975690842, -0.07043427973985672, -0.06187475100159645, -0.028078800067305565, 0.058429133147001266, -0.047245562076568604, -0.05396941676735878, -0.006568215787410736, 0.019710659980773926, -0.10518675297498703, 0.013218802399933338, 0.014439035207033157, -0.14253993332386017, -0.04930659383535385, 0.015122138895094395, 0.02082292176783085, -0.11555740982294083, 0.10525831580162048, 0.05100252479314804, -0.04671537131071091, -0.022287631407380104, -0.07676304876804352, 0.03383190557360649, -0.03541935980319977, 0.06391685456037521, 0.1166132241487503, -0.017990805208683014, -0.028522666543722153, 0.006200325209647417, 0.04410310462117195, 0.01605215296149254, 0.016226476058363914, -0.01049218513071537, -0.05856797471642494, 0.060688380151987076, 0.05814017727971077, -0.031236056238412857, -0.046545326709747314, 0.07198586314916611, -0.01760912872850895, -0.018808849155902863, 0.016390690580010414, -0.041362255811691284, -0.017515424638986588, -0.025175685063004494, -0.048088353127241135, 0.0679880827665329, 0.04719625040888786, -0.07734113931655884, -0.0527452789247036, -0.042437173426151276, 0.025334838777780533, 0.07993727922439575, -0.11178705096244812, 0.0011407904094085097, -0.029598359018564224, 0.03913670405745506, 0.05407387390732765, 0.007483136374503374, -0.0002031502517638728, -0.014191273599863052, -0.008556864224374294, 0.024663636460900307, 0.01702895201742649, 0.009941437281668186, -0.004332489334046841, 0.016080984845757484, -0.08802285045385361, 0.057630110532045364, -1.8436835433960775e-33, 0.044522419571876526, 0.06837186217308044, -0.1070624440908432, 0.06817608326673508, -0.03491722047328949, -0.027674859389662743, 0.12845048308372498, 0.02528412453830242, 0.04352651163935661, -0.011846501380205154, 0.07454060763120651, -0.044864799827337265, 0.07147645950317383, 0.02847954072058201, -0.026445770636200905, 0.016772238537669182, -0.05434359982609749, -0.033036310225725174, 0.026297811418771744, -0.002808657707646489, 0.018230915069580078, -0.012777678668498993, 0.03287333995103836, 0.018853137269616127, -0.03545962646603584, 0.05262560024857521, -0.010485079139471054, -0.024158695712685585, -0.008596330881118774, 0.03464807569980621, 0.02866906113922596, 0.0874314159154892, -0.03500068187713623, -0.0609247125685215, -0.0029347797390073538, -0.05335349217057228, -0.021117230877280235, 0.1099693775177002, -0.02021302841603756, 0.012646740302443504, 0.06659054011106491, -0.011187954805791378, -0.08197450637817383, 0.0029009999707341194, 0.08922719955444336, -0.03364093229174614, 0.012131160125136375, -0.051546502858400345, 0.021401958540081978, 0.009029190987348557, -0.01327418815344572, 0.11162499338388443, -0.027233745902776718, 0.03240177407860756, 0.10779976844787598, -0.017794081941246986, 0.007551333401352167, -0.055988114327192307, -0.03216543048620224, -0.04393851011991501, -0.03509797155857086, -0.016741996631026268, 0.04745360463857651, -0.000008749674634600524, 0.06323756277561188, -0.034663014113903046, -0.03849225491285324, -0.009905757382512093, 0.08977124840021133, 0.023749733343720436, 0.045079026371240616, 0.01613422855734825, 0.02533426322042942, 0.016345757991075516, 0.110769122838974, 0.017664505168795586, -0.006913402583450079, -0.030431384220719337, 0.008938558399677277, 0.081444650888443, -0.037782005965709686, 0.08864860981702805, -0.05175959691405296, 0.1379963904619217, 0.03480587899684906, -0.1247318908572197, 0.004774073138833046, 0.010041062720119953, -0.04804995283484459, -0.04049919173121452, 0.02312847413122654, 0.03244646638631821, -0.024450568482279778, 0.020144635811448097, 0.0381709560751915, -4.423947785880955e-8, -0.1074618324637413, -0.08372712880373001, -0.05859002098441124, -0.009654343128204346, -0.013853338547050953, 0.08222536742687225, -0.0353805273771286, -0.03975384682416916, -0.02282179892063141, -0.12335970997810364, 0.002828318625688553, 0.019344814121723175, 0.0009061044547706842, 0.04749291017651558, 0.04428897425532341, -0.0061692483723163605, -0.022934336215257645, -0.03950975462794304, -0.007313679438084364, -0.012251714244484901, 0.02471071109175682, 0.005504855420440435, -0.03520677238702774, 0.00846888404339552, 0.00387487537227571, 0.011531474068760872, 0.048457905650138855, 0.02144661173224449, -0.05211569368839264, -0.05329856276512146, -0.023589059710502625, -0.017595428973436356, 0.02716008573770523, -0.06855086982250214, -0.03107842616736889, 0.06433477252721786, 0.04024983569979668, -0.01050296425819397, 0.023930851370096207, 0.018014870584011078, 0.048273541033267975, 0.06695261597633362, -0.021725494414567947, -0.02068646065890789, 0.041431933641433716, -0.028266819193959236, 0.008197895251214504, 0.04196776822209358, 0.017382388934493065, 0.06443177908658981, 0.036375243216753006, -0.07273160666227341, -0.08347868919372559, 0.01484788116067648, 0.043719541281461716, -0.04852508753538132, -0.039841994643211365, -0.06958916783332825, 0.0009781327098608017, 0.036422908306121826, 0.04621615260839462, -0.01939055137336254, 0.01816723681986332, -0.08212221413850784 ]
-0.009973
should be set to: ```js const options = { windowBits: 14, memLevel: 7 }; ``` This will, however, generally degrade compression. The memory requirements for inflate are (in bytes) `1 << windowBits`. That is, 32K for `windowBits` = 15 (default value) plus a few kilobytes for small objects. This is in addition to a single internal output slab buffer of size `chunkSize`, which defaults to 16K. The speed of `zlib` compression is affected most dramatically by the `level` setting. A higher level will result in better compression, but will take longer to complete. A lower level will result in less compression, but will be much faster. In general, greater memory usage options will mean that Node.js has to make fewer calls to `zlib` because it will be able to process more data on each `write` operation. So, this is another factor that affects the speed, at the cost of memory usage. ### For Brotli-based streams There are equivalents to the zlib options for Brotli-based streams, although these options have different ranges than the zlib ones: \* zlib's `level` option matches Brotli's `BROTLI\_PARAM\_QUALITY` option. \* zlib's `windowBits` option matches Brotli's `BROTLI\_PARAM\_LGWIN` option. See [below][Brotli parameters] for more details on Brotli-specific options. ### For Zstd-based streams > Stability: 1 - Experimental There are equivalents to the zlib options for Zstd-based streams, although these options have different ranges than the zlib ones: \* zlib's `level` option matches Zstd's `ZSTD\_c\_compressionLevel` option. \* zlib's `windowBits` option matches Zstd's `ZSTD\_c\_windowLog` option. See [below][Zstd parameters] for more details on Zstd-specific options. ## Flushing Calling [`.flush()`][] on a compression stream will make `zlib` return as much output as currently possible. This may come at the cost of degraded compression quality, but can be useful when data needs to be available as soon as possible. In the following example, `flush()` is used to write a compressed partial HTTP response to the client: ```mjs import zlib from 'node:zlib'; import http from 'node:http'; import { pipeline } from 'node:stream'; http.createServer((request, response) => { // For the sake of simplicity, the Accept-Encoding checks are omitted. response.writeHead(200, { 'content-encoding': 'gzip' }); const output = zlib.createGzip(); let i; pipeline(output, response, (err) => { if (err) { // If an error occurs, there's not much we can do because // the server has already sent the 200 response code and // some amount of data has already been sent to the client. // The best we can do is terminate the response immediately // and log the error. clearInterval(i); response.end(); console.error('An error occurred:', err); } }); i = setInterval(() => { output.write(`The current time is ${Date()}\n`, () => { // The data has been passed to zlib, but the compression algorithm may // have decided to buffer the data for more efficient compression. // Calling .flush() will make the data available as soon as the client // is ready to receive it. output.flush(); }); }, 1000); }).listen(1337); ``` ```cjs const zlib = require('node:zlib'); const http = require('node:http'); const { pipeline } = require('node:stream'); http.createServer((request, response) => { // For the sake of simplicity, the Accept-Encoding checks are omitted. response.writeHead(200, { 'content-encoding': 'gzip' }); const output = zlib.createGzip(); let i; pipeline(output, response, (err) => { if (err) { // If an error occurs, there's not much we can do because // the server has already sent the 200 response code and // some amount of data has already been sent to the client. // The best we can do is terminate the response immediately // and log the error. clearInterval(i); response.end(); console.error('An error occurred:', err); } }); i = setInterval(() => { output.write(`The current time is
https://github.com/nodejs/node/blob/main//doc/api/zlib.md
main
nodejs
[ -0.036257922649383545, 0.06952600181102753, -0.007973970845341682, 0.04603961855173111, 0.07461230456829071, -0.09528478235006332, -0.05789359658956528, 0.09840650111436844, 0.04045799374580383, -0.044800251722335815, -0.09166895598173141, 0.04443783685564995, -0.03801426663994789, -0.0015097621362656355, -0.00994185358285904, 0.0003310407337266952, 0.0399392768740654, 0.013238143175840378, -0.04942094534635544, -0.06307971477508545, -0.0006048491923138499, -0.0762934535741806, 0.025689395144581795, -0.06505361944437027, 0.04592956230044365, -0.042949333786964417, -0.04348249360918999, 0.011000183410942554, 0.10940296947956085, -0.02038305252790451, 0.010057827457785606, 0.00580451637506485, 0.027593277394771576, 0.028518948704004288, -0.0589284710586071, 0.07223767042160034, 0.029533367604017258, -0.14283299446105957, -0.06457626819610596, 0.010103913024067879, 0.018017375841736794, 0.12547370791435242, -0.07648709416389465, 0.036177732050418854, -0.037178557366132736, 0.07954040169715881, -0.017541423439979553, -0.009431350976228714, -0.07756763696670532, -0.010632497258484364, -0.06866123527288437, -0.013248393312096596, -0.03798655420541763, 0.007595482748001814, -0.012888072989881039, 0.030012676492333412, -0.09670056402683258, -0.02166256308555603, 0.024593502283096313, 0.07106216996908188, -0.09788864850997925, -0.027297286316752434, -0.0010409181704744697, 0.036235060542821884, 0.0241791233420372, 0.015418986789882183, 0.06903066486120224, 0.005977940745651722, 0.017960883677005768, 0.01429842785000801, 0.0021263945382088423, 0.04888758435845375, -0.04554648697376251, 0.0032397452741861343, -0.046130020171403885, -0.1018320843577385, -0.004995400086045265, -0.07581701129674911, -0.04244033619761467, -0.018450692296028137, 0.015079204924404621, -0.07282796502113342, -0.01802205480635166, -0.051899999380111694, 0.034233395010232925, 0.010348593816161156, -0.01558406837284565, -0.006554559804499149, -0.0643717497587204, 0.07304029166698456, -0.005547625012695789, 0.020213104784488678, 0.022135434672236443, 0.0760054662823677, 0.016444319859147072, 0.08976341038942337, 0.09022293984889984, 0.0002569998032413423, -0.02493400126695633, -0.005168012343347073, 0.08826259523630142, 0.023980308324098587, 0.05458064377307892, 0.05894717201590538, -0.03469798341393471, -0.09174410998821259, 0.07190019637346268, 0.0996609479188919, -0.08398076146841049, 0.0926654115319252, 0.039833031594753265, 0.0272472333163023, 0.02335573546588421, -0.09852544963359833, -0.03593532368540764, 0.0451946035027504, 0.0010817713337019086, 0.02847595140337944, 0.030248448252677917, 0.085100919008255, -0.0018121200846508145, 0.03038802370429039, -0.049466945230960846, -0.02140657603740692, -0.009166774339973927, 0.014615596272051334, -0.06610681861639023, 4.681841552401549e-33, -0.048616889864206314, 0.006369139067828655, -0.053884491324424744, 0.02441960759460926, -0.027280956506729126, 0.07152631133794785, -0.02963375672698021, 0.011967942118644714, -0.036605581641197205, -0.017279502004384995, -0.08524926006793976, -0.011645613238215446, -0.07428143173456192, -0.01789979450404644, 0.05583278462290764, -0.09828916192054749, 0.01632397063076496, 0.007937212474644184, -0.022548390552401543, 0.07826688885688782, 0.011183161288499832, -0.010356501676142216, -0.052549995481967926, -0.0037803370505571365, 0.05211986228823662, -0.05042874440550804, 0.05705652013421059, -0.019411960616707802, -0.10121215879917145, -0.004994187969714403, -0.019920645281672478, 0.01318784337490797, -0.04295580834150314, -0.023772288113832474, 0.05939793586730957, 0.0033483686856925488, -0.004625603556632996, -0.07779727131128311, -0.062225375324487686, -0.09124904125928879, -0.053962185978889465, 0.09382987767457962, -0.05146470665931702, -0.04781573638319969, -0.07151034474372864, -0.03441992029547691, 0.016122598201036453, -0.017372343689203262, -0.02882136031985283, -0.032298993319272995, 0.018997235223650932, 0.11185665428638458, -0.039959896355867386, 0.05246803164482117, 0.06217727065086365, 0.02556116133928299, 0.09284286201000214, -0.033062178641557693, 0.050448182970285416, 0.11797700077295303, -0.02563621662557125, -0.03633412718772888, 0.017632318660616875, 0.0761810764670372, 0.026415007188916206, 0.04426746815443039, -0.06830781698226929, -0.0007129861623980105, -0.009424564428627491, 0.03766254708170891, -0.031275708228349686, 0.024779900908470154, 0.08118806034326553, 0.022546440362930298, 0.005259962286800146, 0.027647878974676132, -0.06605550646781921, -0.02011626400053501, -0.07172355055809021, -0.009616009891033173, 0.00005164707181393169, 0.0338967889547348, 0.025267785415053368, 0.036270443350076675, 0.050732553005218506, -0.039926834404468536, 0.0067986599169671535, -0.02220500074326992, 0.013631136156618595, 0.05262750759720802, 0.058210451155900955, -0.06853821128606796, 0.09637854993343353, -0.08790846168994904, -0.08994550257921219, -4.828286107994928e-33, -0.0481310710310936, 0.013857103884220123, -0.050281330943107605, 0.08882828801870346, -0.028732195496559143, 0.009447201155126095, -0.009617803618311882, -0.012713750824332237, 0.028852155432105064, -0.04709446430206299, 0.02025200054049492, 0.0574614591896534, -0.006699399556964636, -0.0002858005464076996, -0.027785254642367363, 0.0439116507768631, -0.039094895124435425, -0.07432214170694351, 0.0645720586180687, -0.07588299363851547, 0.0026549899484962225, 0.016577262431383133, 0.07969962060451508, 0.022857390344142914, 0.009995290078222752, -0.010339991189539433, -0.058863796293735504, -0.025870582088828087, -0.008676989004015923, -0.049717992544174194, -0.009675021283328533, 0.022920353338122368, -0.04800281673669815, -0.047049831598997116, 0.03540520370006561, -0.03274271637201309, 0.04133392125368118, 0.05120028927922249, 0.005014414899051189, -0.048791639506816864, 0.0571252815425396, 0.022393038496375084, -0.03271690756082535, -0.029401889070868492, -0.010132214054465294, 0.0791708305478096, -0.07916487008333206, -0.07731489092111588, 0.08898232132196426, 0.02419491484761238, -0.028756847605109215, 0.034060895442962646, -0.038858503103256226, 0.03843975067138672, 0.09265844523906708, -0.10170301049947739, -0.04994679242372513, -0.03132205083966255, 0.051740750670433044, -0.01476695854216814, 0.02461305446922779, -0.011364509351551533, -0.03842282295227051, -0.04051823914051056, 0.011996764689683914, -0.026958303526043892, -0.05057486519217491, -0.011124715209007263, 0.08981113135814667, 0.032523076981306076, -0.04307173192501068, -0.019387003034353256, 0.040548961609601974, 0.052135251462459564, -0.08774767816066742, 0.026977000758051872, 0.10429580509662628, -0.025854121893644333, 0.0011467018630355597, 0.01532233040779829, -0.050927869975566864, 0.1405528485774994, -0.058221541345119476, 0.019371097907423973, -0.04624755308032036, -0.026569636538624763, 0.014814707450568676, -0.026136357337236404, -0.0028193427715450525, 0.014171174727380276, -0.0033161244355142117, 0.07106499373912811, -0.07890468835830688, 0.016356559470295906, -0.030787840485572815, -4.89707403517059e-8, -0.06944667547941208, -0.07786447554826736, -0.0331563763320446, -0.024561550468206406, -0.010464953258633614, -0.029376715421676636, -0.0056020054034888744, 0.07021773606538773, 0.0715269073843956, -0.0011412394233047962, 0.12186504900455475, 0.007801773492246866, 0.014444942586123943, -0.028956513851881027, 0.0713127925992012, 0.0702982023358345, 0.00947487074881792, -0.04050932824611664, 0.02121838927268982, 0.01178100798279047, 0.055144451558589935, 0.05048730969429016, -0.034544046968221664, 0.05302496999502182, -0.01596819795668125, -0.10248804092407227, 0.06641227751970291, 0.11029720306396484, -0.015386664308607578, -0.07325556129217148, -0.1094525009393692, 0.052031200379133224, 0.015133177861571312, 0.013964852318167686, -0.004254126455634832, -0.0025781081058084965, -0.06351383775472641, 0.023887403309345245, 0.009237658232450485, 0.09666449576616287, 0.06214873865246773, -0.06490758806467056, 0.028289437294006348, 0.021494314074516296, -0.03867354989051819, -0.026695722714066505, -0.05031327158212662, 0.05901140719652176, 0.05028441548347473, 0.06216016411781311, 0.016545824706554413, 0.04677176848053932, -0.006412793882191181, 0.021730512380599976, 0.11956475675106049, -0.004809042904525995, -0.009521761909127235, -0.08013925701379776, 0.004825270734727383, -0.009171637706458569, 0.021179040893912315, -0.0469818189740181, -0.004311177879571915, 0.010021201334893703 ]
0.057974
the 200 response code and // some amount of data has already been sent to the client. // The best we can do is terminate the response immediately // and log the error. clearInterval(i); response.end(); console.error('An error occurred:', err); } }); i = setInterval(() => { output.write(`The current time is ${Date()}\n`, () => { // The data has been passed to zlib, but the compression algorithm may // have decided to buffer the data for more efficient compression. // Calling .flush() will make the data available as soon as the client // is ready to receive it. output.flush(); }); }, 1000); }).listen(1337); ``` ## Constants ### zlib constants All of the constants defined in `zlib.h` are also defined on `require('node:zlib').constants`. In the normal course of operations, it will not be necessary to use these constants. They are documented so that their presence is not surprising. This section is taken almost directly from the [zlib documentation][]. Previously, the constants were available directly from `require('node:zlib')`, for instance `zlib.Z\_NO\_FLUSH`. Accessing the constants directly from the module is currently still possible but is deprecated. Allowed flush values. \* `zlib.constants.Z\_NO\_FLUSH` \* `zlib.constants.Z\_PARTIAL\_FLUSH` \* `zlib.constants.Z\_SYNC\_FLUSH` \* `zlib.constants.Z\_FULL\_FLUSH` \* `zlib.constants.Z\_FINISH` \* `zlib.constants.Z\_BLOCK` Return codes for the compression/decompression functions. Negative values are errors, positive values are used for special but normal events. \* `zlib.constants.Z\_OK` \* `zlib.constants.Z\_STREAM\_END` \* `zlib.constants.Z\_NEED\_DICT` \* `zlib.constants.Z\_ERRNO` \* `zlib.constants.Z\_STREAM\_ERROR` \* `zlib.constants.Z\_DATA\_ERROR` \* `zlib.constants.Z\_MEM\_ERROR` \* `zlib.constants.Z\_BUF\_ERROR` \* `zlib.constants.Z\_VERSION\_ERROR` Compression levels. \* `zlib.constants.Z\_NO\_COMPRESSION` \* `zlib.constants.Z\_BEST\_SPEED` \* `zlib.constants.Z\_BEST\_COMPRESSION` \* `zlib.constants.Z\_DEFAULT\_COMPRESSION` Compression strategy. \* `zlib.constants.Z\_FILTERED` \* `zlib.constants.Z\_HUFFMAN\_ONLY` \* `zlib.constants.Z\_RLE` \* `zlib.constants.Z\_FIXED` \* `zlib.constants.Z\_DEFAULT\_STRATEGY` ### Brotli constants There are several options and other constants available for Brotli-based streams: #### Flush operations The following values are valid flush operations for Brotli-based streams: \* `zlib.constants.BROTLI\_OPERATION\_PROCESS` (default for all operations) \* `zlib.constants.BROTLI\_OPERATION\_FLUSH` (default when calling `.flush()`) \* `zlib.constants.BROTLI\_OPERATION\_FINISH` (default for the last chunk) \* `zlib.constants.BROTLI\_OPERATION\_EMIT\_METADATA` \* This particular operation may be hard to use in a Node.js context, as the streaming layer makes it hard to know which data will end up in this frame. Also, there is currently no way to consume this data through the Node.js API. #### Compressor options There are several options that can be set on Brotli encoders, affecting compression efficiency and speed. Both the keys and the values can be accessed as properties of the `zlib.constants` object. The most important options are: \* `BROTLI\_PARAM\_MODE` \* `BROTLI\_MODE\_GENERIC` (default) \* `BROTLI\_MODE\_TEXT`, adjusted for UTF-8 text \* `BROTLI\_MODE\_FONT`, adjusted for WOFF 2.0 fonts \* `BROTLI\_PARAM\_QUALITY` \* Ranges from `BROTLI\_MIN\_QUALITY` to `BROTLI\_MAX\_QUALITY`, with a default of `BROTLI\_DEFAULT\_QUALITY`. \* `BROTLI\_PARAM\_SIZE\_HINT` \* Integer value representing the expected input size; defaults to `0` for an unknown input size. The following flags can be set for advanced control over the compression algorithm and memory usage tuning: \* `BROTLI\_PARAM\_LGWIN` \* Ranges from `BROTLI\_MIN\_WINDOW\_BITS` to `BROTLI\_MAX\_WINDOW\_BITS`, with a default of `BROTLI\_DEFAULT\_WINDOW`, or up to `BROTLI\_LARGE\_MAX\_WINDOW\_BITS` if the `BROTLI\_PARAM\_LARGE\_WINDOW` flag is set. \* `BROTLI\_PARAM\_LGBLOCK` \* Ranges from `BROTLI\_MIN\_INPUT\_BLOCK\_BITS` to `BROTLI\_MAX\_INPUT\_BLOCK\_BITS`. \* `BROTLI\_PARAM\_DISABLE\_LITERAL\_CONTEXT\_MODELING` \* Boolean flag that decreases compression ratio in favour of decompression speed. \* `BROTLI\_PARAM\_LARGE\_WINDOW` \* Boolean flag enabling “Large Window Brotli” mode (not compatible with the Brotli format as standardized in [RFC 7932][]). \* `BROTLI\_PARAM\_NPOSTFIX` \* Ranges from `0` to `BROTLI\_MAX\_NPOSTFIX`. \* `BROTLI\_PARAM\_NDIRECT` \* Ranges from `0` to `15 << NPOSTFIX` in steps of `1 << NPOSTFIX`. #### Decompressor options These advanced options are available for controlling decompression: \* `BROTLI\_DECODER\_PARAM\_DISABLE\_RING\_BUFFER\_REALLOCATION` \* Boolean flag that affects internal memory allocation patterns. \* `BROTLI\_DECODER\_PARAM\_LARGE\_WINDOW` \* Boolean flag enabling “Large Window Brotli” mode (not compatible with the Brotli format as standardized in [RFC 7932][]). ### Zstd constants > Stability: 1 - Experimental There are several options and other constants available
https://github.com/nodejs/node/blob/main//doc/api/zlib.md
main
nodejs
[ -0.0667504221200943, 0.13295488059520721, -0.04342111200094223, 0.06302822381258011, -0.02637317217886448, -0.0905081182718277, -0.045619115233421326, 0.0015371502377092838, 0.02961031347513199, -0.0036950784269720316, -0.047285329550504684, 0.04910914599895477, 0.04224109649658203, -0.05859462544322014, -0.043452050536870956, -0.02205750346183777, -0.027797169983386993, 0.040361374616622925, -0.03595101088285446, -0.08061657845973969, 0.01000633742660284, 0.06727023422718048, 0.029847322031855583, 0.02709903009235859, 0.009314226917922497, -0.0632728636264801, -0.01598246954381466, -0.029137909412384033, 0.050418976694345474, 0.059799086302518845, 0.014193788170814514, 0.015943516045808792, 0.015959057956933975, 0.02741142362356186, -0.10711118578910828, 0.10553333163261414, 0.03838054835796356, -0.05047382041811943, -0.0750965029001236, -0.006181610282510519, 0.051027651876211166, 0.1283981055021286, -0.06718704104423523, 0.06416811048984528, -0.03500651940703392, 0.03510570153594017, -0.0515725240111351, -0.003695222781971097, -0.06077701225876808, 0.005935985594987869, -0.0031224950216710567, 0.010293170809745789, -0.006150224711745977, 0.07677152752876282, -0.0036798990331590176, 0.004987715743482113, -0.10708510130643845, 0.03759291023015976, -0.04709625616669655, 0.0637342631816864, -0.08333481848239899, -0.012961707077920437, -0.039569295942783356, 0.028141334652900696, 0.1100936159491539, 0.03396480530500412, 0.022619804367423058, -0.018961986526846886, -0.03950951248407364, 0.08108725398778915, -0.053843408823013306, -0.03451449051499367, -0.08463070541620255, 0.0011967566097155213, -0.08718659728765488, -0.011239116080105305, -0.004753132350742817, -0.003626657649874687, -0.06776159256696701, 0.00845551397651434, 0.01457111444324255, -0.10058965533971786, 0.007943637669086456, 0.0028052940033376217, 0.05705752223730087, 0.025191735476255417, 0.04740529507398605, 0.03426036611199379, 0.021015357226133347, -0.021774418652057648, -0.012306307442486286, 0.06648116558790207, 0.0037512052804231644, 0.1319568157196045, -0.002999223070219159, 0.05244226008653641, 0.13746415078639984, 0.012320765294134617, -0.016502805054187775, 0.06871207058429718, 0.12378621846437454, 0.022613532841205597, -0.005504186265170574, -0.031330447643995285, -0.013015748001635075, -0.06763279438018799, 0.030877728015184402, 0.10286807268857956, -0.10088584572076797, 0.09665937721729279, -0.03861850127577782, -0.0016126929549500346, 0.014219492673873901, -0.05629776418209076, 0.030884159728884697, 0.035187188535928726, -0.007630249951034784, 0.03850160539150238, -0.05189068615436554, 0.03710153326392174, 0.051529690623283386, 0.0075797997415065765, -0.062126629054546356, 0.0137724494561553, 0.07033838331699371, -0.024783844128251076, 0.05498344078660011, 1.3277045225354576e-33, -0.03510948270559311, 0.00034029249218292534, -0.04237331449985504, 0.028089625760912895, -0.022808728739619255, 0.09707450121641159, 0.05724439024925232, 0.07519232481718063, -0.038833655416965485, 0.0416756197810173, -0.06577541679143906, -0.052173636853694916, -0.009316802024841309, -0.016452942043542862, -0.08444389700889587, -0.025468017905950546, 0.10090022534132004, 0.03125934675335884, 0.02051207236945629, 0.040014397352933884, 0.08404643088579178, -0.044681232422590256, -0.03353169187903404, -0.016853632405400276, 0.06974560767412186, 0.010538717731833458, -0.01458505354821682, -0.027965743094682693, -0.07036910951137543, -0.02300247922539711, 0.06971348077058792, 0.005045027006417513, -0.0407741442322731, -0.05409577861428261, 0.02542823553085327, -0.05569741502404213, 0.04203745722770691, -0.003934276755899191, -0.06259871274232864, -0.10408610850572586, 0.008486423641443253, 0.037763774394989014, -0.12464029341936111, 0.06865938752889633, -0.019447878003120422, -0.06841041892766953, -0.07132405042648315, 0.015864569693803787, 0.015508804470300674, -0.016021370887756348, -0.030023369938135147, 0.10683277249336243, -0.09357501566410065, 0.039791978895664215, -0.0247826986014843, -0.00502400379627943, -0.0036390917375683784, -0.030999556183815002, -0.04198361933231354, 0.01993570476770401, 0.06356122344732285, -0.02357553504407406, 0.012302916496992111, 0.018819263204932213, 0.04739299416542053, 0.04694325849413872, -0.08008505403995514, 0.0029210152570158243, 0.009517695754766464, 0.019159752875566483, -0.06586013734340668, 0.002778452355414629, 0.06459265202283859, 0.020358534529805183, -0.025602661073207855, -0.03304506093263626, -0.0473579503595829, -0.030564524233341217, 0.03387098014354706, -0.04401065409183502, 0.015687212347984314, -0.001167207257822156, -0.021567706018686295, 0.08368948101997375, 0.060285378247499466, -0.03097175993025303, 0.02277681790292263, 0.037159938365221024, -0.04976653680205345, 0.013730686157941818, 0.014958338811993599, -0.014606918208301067, 0.0958738699555397, -0.11910711228847504, -0.014807828702032566, -2.2768943539763692e-33, 0.029393209144473076, 0.0733502060174942, -0.07102878391742706, 0.07258601486682892, 0.03812748193740845, -0.05355598405003548, -0.020736511796712875, 0.017871886491775513, -0.03660700470209122, 0.017133360728621483, 0.016568604856729507, -0.024004485458135605, 0.017088279128074646, 0.0040125115774571896, -0.05145612731575966, 0.037198711186647415, -0.02481447160243988, -0.06781008839607239, 0.04589013010263443, -0.04353635385632515, 0.004000185988843441, -0.050624433904886246, 0.0899435356259346, -0.006329751573503017, -0.04780374839901924, 0.0006795456865802407, -0.018879657611250877, -0.006307816598564386, -0.02131291665136814, 0.04542708769440651, -0.04406330734491348, -0.007633088622242212, -0.041406650096178055, -0.11793365329504013, 0.03269047662615776, -0.03838090971112251, 0.06561855971813202, 0.11599282175302505, -0.015870919451117516, 0.01347615197300911, 0.11033596843481064, -0.02535257302224636, -0.09536917507648468, -0.0358453094959259, 0.07398830354213715, -0.06449010223150253, -0.053565461188554764, -0.048532504588365555, -0.005699209403246641, -0.03927742317318916, 0.0699460357427597, 0.005136257037520409, 0.003948965575546026, 0.0467165969312191, 0.10026039183139801, -0.025547413155436516, 0.0025552769657224417, -0.016103798523545265, 0.02879640832543373, -0.04976995289325714, -0.036189716309309006, -0.030442915856838226, -0.050149105489254, -0.006299444008618593, -0.028148600831627846, -0.010478046722710133, -0.007125637028366327, -0.024583928287029266, 0.11690618097782135, 0.011451027356088161, 0.01218399964272976, 0.04225382208824158, -0.010969126597046852, 0.06251470744609833, -0.038162387907505035, 0.016724737361073494, -0.013203089125454426, -0.10605225712060928, -0.010654271580278873, 0.09281200915575027, -0.021063921973109245, 0.08612838387489319, -0.022516537457704544, 0.05762109532952309, -0.0007626935257576406, -0.04899080842733383, 0.020962387323379517, -0.020541982725262642, -0.028227591887116432, -0.047942958772182465, 0.0008868349832482636, 0.07383784651756287, -0.08285829424858093, 0.02772771753370762, -0.01866953633725643, -5.209949094364674e-8, -0.04612409323453903, -0.06933875381946564, -0.026182888075709343, 0.026406116783618927, 0.029422380030155182, -0.001590463682077825, -0.022343149408698082, -0.002678900258615613, -0.004601812455803156, -0.047364115715026855, 0.07654643803834915, 0.0028012495022267103, 0.06164901703596115, 0.022833116352558136, 0.042420607060194016, 0.015488984063267708, -0.00193554419092834, -0.08224165439605713, -0.03401646018028259, -0.02943998947739601, 0.036767058074474335, 0.02128944732248783, -0.023984309285879135, -0.009661738760769367, 0.03816498443484306, -0.09570468217134476, 0.08095002919435501, 0.12122088670730591, -0.10296745598316193, -0.08438471704721451, -0.06105075404047966, -0.03853108361363411, 0.0686081275343895, -0.010617231950163841, -0.02451622113585472, 0.006750589236617088, -0.017103105783462524, -0.06523483246564865, -0.01035306602716446, 0.053757134824991226, -0.017252247780561447, 0.021381307393312454, 0.022709529846906662, 0.009644368663430214, 0.04551573842763901, -0.08967912197113037, 0.0037603266537189484, 0.033215705305337906, 0.04442289471626282, 0.0336882621049881, 0.0032399778719991446, 0.04019367694854736, -0.0289936363697052, -0.006796332076191902, 0.10347910225391388, -0.012300056405365467, -0.03722512722015381, -0.07675831019878387, -0.0098334401845932, 0.058277614414691925, -0.013536340557038784, 0.036069106310606, -0.019293013960123062, -0.06560227274894714 ]
0.056491
controlling decompression: \* `BROTLI\_DECODER\_PARAM\_DISABLE\_RING\_BUFFER\_REALLOCATION` \* Boolean flag that affects internal memory allocation patterns. \* `BROTLI\_DECODER\_PARAM\_LARGE\_WINDOW` \* Boolean flag enabling “Large Window Brotli” mode (not compatible with the Brotli format as standardized in [RFC 7932][]). ### Zstd constants > Stability: 1 - Experimental There are several options and other constants available for Zstd-based streams: #### Flush operations The following values are valid flush operations for Zstd-based streams: \* `zlib.constants.ZSTD\_e\_continue` (default for all operations) \* `zlib.constants.ZSTD\_e\_flush` (default when calling `.flush()`) \* `zlib.constants.ZSTD\_e\_end` (default for the last chunk) #### Compressor options There are several options that can be set on Zstd encoders, affecting compression efficiency and speed. Both the keys and the values can be accessed as properties of the `zlib.constants` object. The most important options are: \* `ZSTD\_c\_compressionLevel` \* Set compression parameters according to pre-defined cLevel table. Default level is ZSTD\\_CLEVEL\\_DEFAULT==3. \* `ZSTD\_c\_strategy` \* Select the compression strategy. \* Possible values are listed in the strategy options section below. #### Strategy options The following constants can be used as values for the `ZSTD\_c\_strategy` parameter: \* `zlib.constants.ZSTD\_fast` \* `zlib.constants.ZSTD\_dfast` \* `zlib.constants.ZSTD\_greedy` \* `zlib.constants.ZSTD\_lazy` \* `zlib.constants.ZSTD\_lazy2` \* `zlib.constants.ZSTD\_btlazy2` \* `zlib.constants.ZSTD\_btopt` \* `zlib.constants.ZSTD\_btultra` \* `zlib.constants.ZSTD\_btultra2` Example: ```js const stream = zlib.createZstdCompress({ params: { [zlib.constants.ZSTD\_c\_strategy]: zlib.constants.ZSTD\_btultra, }, }); ``` #### Pledged Source Size It's possible to specify the expected total size of the uncompressed input via `opts.pledgedSrcSize`. If the size doesn't match at the end of the input, compression will fail with the code `ZSTD\_error\_srcSize\_wrong`. #### Decompressor options These advanced options are available for controlling decompression: \* `ZSTD\_d\_windowLogMax` \* Select a size limit (in power of 2) beyond which the streaming API will refuse to allocate memory buffer in order to protect the host from unreasonable memory requirements. ## Class: `Options` Each zlib-based class takes an `options` object. No options are required. Some options are only relevant when compressing and are ignored by the decompression classes. \* `flush` {integer} \*\*Default:\*\* `zlib.constants.Z\_NO\_FLUSH` \* `finishFlush` {integer} \*\*Default:\*\* `zlib.constants.Z\_FINISH` \* `chunkSize` {integer} \*\*Default:\*\* `16 \* 1024` \* `windowBits` {integer} \* `level` {integer} (compression only) \* `memLevel` {integer} (compression only) \* `strategy` {integer} (compression only) \* `dictionary` {Buffer|TypedArray|DataView|ArrayBuffer} (deflate/inflate only, empty dictionary by default) \* `info` {boolean} (If `true`, returns an object with `buffer` and `engine`.) \* `maxOutputLength` {integer} Limits output size when using [convenience methods][]. \*\*Default:\*\* [`buffer.kMaxLength`][] See the [`deflateInit2` and `inflateInit2`][] documentation for more information. ## Class: `BrotliOptions` Each Brotli-based class takes an `options` object. All options are optional. \* `flush` {integer} \*\*Default:\*\* `zlib.constants.BROTLI\_OPERATION\_PROCESS` \* `finishFlush` {integer} \*\*Default:\*\* `zlib.constants.BROTLI\_OPERATION\_FINISH` \* `chunkSize` {integer} \*\*Default:\*\* `16 \* 1024` \* `params` {Object} Key-value object containing indexed [Brotli parameters][]. \* `maxOutputLength` {integer} Limits output size when using [convenience methods][]. \*\*Default:\*\* [`buffer.kMaxLength`][] \* `info` {boolean} If `true`, returns an object with `buffer` and `engine`. \*\*Default:\*\* `false` For example: ```js const stream = zlib.createBrotliCompress({ chunkSize: 32 \* 1024, params: { [zlib.constants.BROTLI\_PARAM\_MODE]: zlib.constants.BROTLI\_MODE\_TEXT, [zlib.constants.BROTLI\_PARAM\_QUALITY]: 4, [zlib.constants.BROTLI\_PARAM\_SIZE\_HINT]: fs.statSync(inputFile).size, }, }); ``` ## Class: `zlib.BrotliCompress` \* Extends: [`ZlibBase`][] Compress data using the Brotli algorithm. ## Class: `zlib.BrotliDecompress` \* Extends: [`ZlibBase`][] Decompress data using the Brotli algorithm. ## Class: `zlib.Deflate` \* Extends: [`ZlibBase`][] Compress data using deflate. ## Class: `zlib.DeflateRaw` \* Extends: [`ZlibBase`][] Compress data using deflate, and do not append a `zlib` header. ## Class: `zlib.Gunzip` \* Extends: [`ZlibBase`][] Decompress a gzip stream. ## Class: `zlib.Gzip` \* Extends: [`ZlibBase`][] Compress data using gzip. ## Class: `zlib.Inflate` \* Extends: [`ZlibBase`][] Decompress a deflate stream. ## Class: `zlib.InflateRaw` \* Extends: [`ZlibBase`][] Decompress a raw deflate stream. ## Class: `zlib.Unzip` \* Extends: [`ZlibBase`][] Decompress either a Gzip- or Deflate-compressed stream by auto-detecting the header. ## Class: `zlib.ZlibBase` \* Extends: [`stream.Transform`][] Not exported by the `node:zlib` module. It is documented here
https://github.com/nodejs/node/blob/main//doc/api/zlib.md
main
nodejs
[ -0.1127418652176857, 0.07894740253686905, -0.07798635214567184, 0.037213169038295746, 0.0028134621679782867, -0.07183048874139786, -0.04296918585896492, 0.006831062026321888, -0.06760720163583755, -0.05969777703285217, -0.058268770575523376, 0.02389322593808174, 0.027439039200544357, 0.006602548528462648, -0.07154519110918045, -0.026889773085713387, 0.00405143853276968, 0.059135787189006805, -0.04033730551600456, -0.019371315836906433, 0.008401801809668541, 0.08057646453380585, 0.049377769231796265, 0.016167450696229935, 0.012899788096547127, -0.05921407788991928, -0.03530437499284744, -0.008976656943559647, 0.09712903946638107, 0.04752606526017189, 0.03275451436638832, 0.02901589870452881, -0.020643897354602814, 0.035411495715379715, 0.05013144388794899, 0.054461825639009476, 0.0462491475045681, -0.053904708474874496, -0.05045006424188614, 0.019522376358509064, 0.04095875844359398, 0.1305442601442337, -0.10423017293214798, -0.014731336385011673, -0.016078190878033638, 0.09118939936161041, 0.05125175416469574, -0.023462001234292984, -0.11585735529661179, -0.03245122730731964, -0.024032142013311386, 0.02993152104318142, 0.010930676013231277, 0.08321018517017365, 0.025279706344008446, 0.02041768468916416, -0.03968317434191704, 0.01428514439612627, -0.00566751416772604, 0.045142851769924164, -0.08343031257390976, -0.005966473836451769, -0.010680731385946274, -0.0024865290615707636, -0.011807512491941452, 0.06920647621154785, 0.023811299353837967, 0.05198013409972191, -0.0024388544261455536, -0.00238195457495749, -0.0441599078476429, 0.014953832142055035, -0.12225819379091263, 0.008402837440371513, -0.00289548235014081, 0.013017249293625355, 0.02367156185209751, -0.17668181657791138, -0.047114163637161255, -0.04936385527253151, 0.05628497526049614, -0.06960353255271912, 0.05721789225935936, -0.020286405459046364, 0.10616961866617203, -0.0005567797343246639, 0.037223946303129196, -0.0015609775437042117, -0.01816224679350853, 0.08960853517055511, -0.021004367619752884, 0.009132794104516506, 0.048004668205976486, 0.037254322320222855, 0.024128863587975502, -0.002222028560936451, 0.07689089328050613, 0.015549971722066402, -0.04625328257679939, 0.020924385637044907, 0.09338586032390594, 0.018950816243886948, 0.06672941148281097, -0.008020051755011082, 0.017881600186228752, -0.04796174541115761, 0.12771768867969513, 0.11201875656843185, -0.0841977447271347, 0.023242240771651268, -0.03236597403883934, -0.026746734976768494, 0.02640281617641449, -0.1074715331196785, 0.03776407614350319, 0.04997577890753746, -0.021317295730113983, 0.0455981083214283, -0.04409697651863098, 0.00039851380279287696, -0.02566610649228096, 0.003625065553933382, -0.10346202552318573, -0.000011419425391068216, 0.029806341975927353, 0.055127616971731186, -0.045643150806427, 2.9910675998573808e-33, -0.044997695833444595, -0.010495791211724281, -0.10400988906621933, 0.051629163324832916, -0.10158167779445648, 0.0646522119641304, -0.010846903547644615, 0.05003629997372627, -0.005336625035852194, 0.02902790531516075, -0.051712945103645325, -0.06153033673763275, -0.09974305331707001, 0.001977328211069107, -0.023183586075901985, -0.08254164457321167, 0.009418635629117489, 0.053983524441719055, -0.0530160516500473, 0.06450225412845612, 0.08933492749929428, 0.009613421745598316, -0.10437050461769104, -0.08059028536081314, 0.06099732592701912, -0.08956465870141983, -0.002850127639248967, -0.07203441113233566, -0.032637640833854675, -0.008672489784657955, -0.025698110461235046, 0.024732235819101334, -0.013397350907325745, -0.054968539625406265, 0.05173024907708168, -0.014302495867013931, -0.02996383234858513, -0.013817740604281425, -0.07166866958141327, -0.12818951904773712, -0.005762005690485239, 0.026735616847872734, -0.10927131026983261, -0.007219540886580944, -0.02998952567577362, -0.03729814663529396, -0.037806615233421326, -0.004972553346306086, -0.0053808437660336494, -0.08865122497081757, 0.05026601627469063, 0.12028323858976364, -0.10636311024427414, 0.03941641375422478, -0.007141794078052044, -0.041494596749544144, 0.02235664799809456, -0.04001503810286522, 0.07058360427618027, 0.04858741909265518, -0.042954765260219574, 0.011747511103749275, -0.005019386764615774, 0.10268782824277878, 0.035868339240550995, 0.05671347677707672, -0.07299844920635223, -0.05340254306793213, -0.05320825055241585, 0.02987939491868019, -0.08841145783662796, -0.018947629258036613, 0.018887700513005257, 0.008130761794745922, 0.038287509232759476, -0.05591442063450813, -0.014387974515557289, -0.05333046615123749, -0.006420075427740812, -0.021997224539518356, 0.02543693408370018, 0.006400844547897577, 0.04150371626019478, 0.019222751259803772, 0.019975626841187477, -0.10539266467094421, -0.014661471359431744, -0.04304154962301254, -0.009020338766276836, 0.026314428076148033, 0.03418999910354614, -0.08183859288692474, 0.1493491381406784, -0.06797192245721817, -0.049151208251714706, -3.685561233595704e-33, -0.021949389949440956, 0.05523107945919037, -0.05293871834874153, 0.022391516715288162, -0.06677702069282532, 0.03621607646346092, -0.011697082780301571, 0.015501812100410461, 0.01381075568497181, -0.08527301996946335, 0.019792817533016205, 0.003829008201137185, 0.028275230899453163, 0.024357136338949203, 0.01517669390887022, 0.027036985382437706, -0.0022178590297698975, -0.06428214907646179, 0.060071706771850586, 0.037662323564291, 0.013685016892850399, -0.057610463351011276, 0.0212076548486948, 0.011247411370277405, -0.0024436884559690952, 0.06781718134880066, -0.015539726242423058, 0.013521187007427216, 0.08577194064855576, 0.03462298586964607, -0.036334328353405, 0.037359245121479034, -0.037086062133312225, -0.05990241467952728, -0.040054257959127426, -0.027239399030804634, 0.02709038369357586, 0.006133748684078455, -0.09263232350349426, 0.015005439519882202, 0.06419458240270615, -0.004649887327104807, -0.052269384264945984, 0.03414227068424225, 0.07294648140668869, 0.03817284479737282, -0.029263094067573547, -0.10449793189764023, -0.0029785174410790205, -0.023549789562821388, 0.03581899031996727, 0.0758117139339447, -0.022934556007385254, 0.02999049611389637, 0.11955743283033371, -0.04781218245625496, -0.037399210035800934, 0.02597738616168499, -0.038619279861450195, -0.08362263441085815, 0.05314011499285698, -0.01665099523961544, -0.03736918047070503, -0.06417526304721832, 0.022216113284230232, -0.03294970467686653, 0.029417574405670166, -0.04723641648888588, 0.028464561328291893, -0.02411775290966034, 0.03392881900072098, 0.013228076510131359, 0.017706073820590973, 0.03766562417149544, -0.03016648441553116, 0.07752475142478943, 0.053902752697467804, -0.03385671228170395, 0.03521955385804176, 0.07232753932476044, -0.0550835058093071, 0.07281430065631866, 0.005422616843134165, 0.08844669163227081, -0.039074987173080444, -0.05229448154568672, -0.04434726759791374, 0.048454586416482925, -0.03869570419192314, -0.027055921033024788, -0.020666515454649925, 0.00755182234570384, 0.002024156739935279, -0.012026295065879822, -0.0003028545470442623, -4.637824346787056e-8, -0.024502841755747795, -0.048353590071201324, -0.026895076036453247, 0.05198594555258751, -0.031079743057489395, -0.050917938351631165, -0.026508603245019913, -0.041350677609443665, 0.047372426837682724, -0.07749029994010925, 0.0482904352247715, 0.051821719855070114, 0.036052342504262924, -0.053749170154333115, 0.03250241279602051, 0.0025488873943686485, -0.07042831182479858, -0.07632913440465927, 0.014823679812252522, 0.03495703637599945, 0.015772156417369843, 0.04475622996687889, -0.04755191504955292, 0.06764727830886841, -0.023367222398519516, -0.04808187112212181, 0.06969299167394638, 0.034788936376571655, 0.027460824698209763, -0.03177536651492119, 0.029766125604510307, 0.00897540058940649, 0.060608696192502975, -0.0013960092328488827, 0.004282466135919094, 0.0632317066192627, -0.003112836740911007, 0.014975478872656822, 0.023762261494994164, 0.07200399786233902, 0.01529103796929121, -0.006624963134527206, 0.01047412771731615, 0.011635974980890751, -0.01860591024160385, -0.01153498888015747, 0.011214269325137138, 0.001711654826067388, -0.019525861367583275, 0.05493967980146408, -0.02059854567050934, 0.07093285769224167, 0.045076172798871994, 0.0584634467959404, 0.1239197850227356, 0.011449119076132774, 0.010333140380680561, -0.08656856417655945, -0.040904734283685684, 0.012106513604521751, -0.013360133394598961, 0.0010364172048866749, -0.022947996854782104, 0.04201487451791763 ]
-0.032262
Extends: [`ZlibBase`][] Decompress a deflate stream. ## Class: `zlib.InflateRaw` \* Extends: [`ZlibBase`][] Decompress a raw deflate stream. ## Class: `zlib.Unzip` \* Extends: [`ZlibBase`][] Decompress either a Gzip- or Deflate-compressed stream by auto-detecting the header. ## Class: `zlib.ZlibBase` \* Extends: [`stream.Transform`][] Not exported by the `node:zlib` module. It is documented here because it is the base class of the compressor/decompressor classes. This class inherits from [`stream.Transform`][], allowing `node:zlib` objects to be used in pipes and similar stream operations. ### `zlib.bytesWritten` \* Type: {number} The `zlib.bytesWritten` property specifies the number of bytes written to the engine, before the bytes are processed (compressed or decompressed, as appropriate for the derived class). ### `zlib.close([callback])` \* `callback` {Function} Close the underlying handle. ### `zlib.flush([kind, ]callback)` \* `kind` \*\*Default:\*\* `zlib.constants.Z\_FULL\_FLUSH` for zlib-based streams, `zlib.constants.BROTLI\_OPERATION\_FLUSH` for Brotli-based streams. \* `callback` {Function} Flush pending data. Don't call this frivolously, premature flushes negatively impact the effectiveness of the compression algorithm. Calling this only flushes data from the internal `zlib` state, and does not perform flushing of any kind on the streams level. Rather, it behaves like a normal call to `.write()`, i.e. it will be queued up behind other pending writes and will only produce output when data is being read from the stream. ### `zlib.params(level, strategy, callback)` \* `level` {integer} \* `strategy` {integer} \* `callback` {Function} This function is only available for zlib-based streams, i.e. not Brotli. Dynamically update the compression level and compression strategy. Only applicable to deflate algorithm. ### `zlib.reset()` Reset the compressor/decompressor to factory defaults. Only applicable to the inflate and deflate algorithms. ## Class: `ZstdOptions` > Stability: 1 - Experimental Each Zstd-based class takes an `options` object. All options are optional. \* `flush` {integer} \*\*Default:\*\* `zlib.constants.ZSTD\_e\_continue` \* `finishFlush` {integer} \*\*Default:\*\* `zlib.constants.ZSTD\_e\_end` \* `chunkSize` {integer} \*\*Default:\*\* `16 \* 1024` \* `params` {Object} Key-value object containing indexed [Zstd parameters][]. \* `maxOutputLength` {integer} Limits output size when using [convenience methods][]. \*\*Default:\*\* [`buffer.kMaxLength`][] \* `info` {boolean} If `true`, returns an object with `buffer` and `engine`. \*\*Default:\*\* `false` \* `dictionary` {Buffer} Optional dictionary used to improve compression efficiency when compressing or decompressing data that shares common patterns with the dictionary. For example: ```js const stream = zlib.createZstdCompress({ chunkSize: 32 \* 1024, params: { [zlib.constants.ZSTD\_c\_compressionLevel]: 10, [zlib.constants.ZSTD\_c\_checksumFlag]: 1, }, }); ``` ## Class: `zlib.ZstdCompress` > Stability: 1 - Experimental Compress data using the Zstd algorithm. ## Class: `zlib.ZstdDecompress` > Stability: 1 - Experimental Decompress data using the Zstd algorithm. ## `zlib.constants` Provides an object enumerating Zlib-related constants. ## `zlib.crc32(data[, value])` \* `data` {string|Buffer|TypedArray|DataView} When `data` is a string, it will be encoded as UTF-8 before being used for computation. \* `value` {integer} An optional starting value. It must be a 32-bit unsigned integer. \*\*Default:\*\* `0` \* Returns: {integer} A 32-bit unsigned integer containing the checksum. Computes a 32-bit [Cyclic Redundancy Check][] checksum of `data`. If `value` is specified, it is used as the starting value of the checksum, otherwise, 0 is used as the starting value. The CRC algorithm is designed to compute checksums and to detect error in data transmission. It's not suitable for cryptographic authentication. To be consistent with other APIs, if the `data` is a string, it will be encoded with UTF-8 before being used for computation. If users only use Node.js to compute and match the checksums, this works well with other APIs that uses the UTF-8 encoding by default. Some third-party JavaScript libraries compute the checksum on a string based on `str.charCodeAt()` so that it can be run in browsers. If users want to match the checksum computed with this kind of library in the browser, it's better to use the same library in Node.js
https://github.com/nodejs/node/blob/main//doc/api/zlib.md
main
nodejs
[ -0.14406737685203552, 0.08248263597488403, -0.00846092589199543, 0.04836967960000038, 0.0900065079331398, -0.10451444983482361, -0.03359100967645645, 0.061759524047374725, -0.07748275250196457, -0.07141325622797012, -0.04557184502482414, 0.04765759035944939, 0.04221091419458389, 0.006375059951096773, -0.011609015055000782, -0.0056497566401958466, -0.04485804960131645, 0.029986724257469177, -0.05162535235285759, -0.033716268837451935, 0.04272055625915527, 0.09358898550271988, 0.04025318846106529, -0.017275789752602577, 0.04298282414674759, -0.03910727798938751, -0.05033334344625473, 0.030759138986468315, 0.08836708217859268, 0.02030099555850029, 0.012336804531514645, 0.06719871610403061, 0.0038964233826845884, 0.049516040831804276, 0.04261983931064606, 0.11005830019712448, 0.08504942804574966, -0.05522513762116432, -0.08066227287054062, -0.0024985934142023325, 0.06469019502401352, 0.15235425531864166, -0.02857416309416294, 0.02280374802649021, -0.08132621645927429, 0.11109685152769089, 0.02507098764181137, -0.005221055820584297, -0.13902811706066132, -0.04708365350961685, -0.03976466506719589, -0.02917521446943283, -0.05582331120967865, 0.09326285123825073, 0.007122845388948917, 0.046262700110673904, -0.08535972982645035, -0.03488254174590111, -0.024621132761240005, 0.05279649421572685, -0.11046333611011505, 0.03172913193702698, -0.03349195420742035, -0.007519423495978117, -0.01966111920773983, 0.03657616302371025, 0.032116375863552094, -0.011145216412842274, -0.004789571277797222, -0.047515228390693665, -0.04225492477416992, -0.022304341197013855, -0.029759420081973076, 0.04522012174129486, -0.08137830346822739, -0.09157190471887589, 0.04853040352463722, -0.00672477763146162, -0.009778578765690327, -0.03566417470574379, -0.030915021896362305, -0.09526490420103073, 0.08278170973062515, 0.01678249053657055, 0.032081183046102524, 0.030368587002158165, -0.02993043325841427, -0.007826234214007854, -0.01971733197569847, 0.09829391539096832, 0.02667403034865856, -0.01915770396590233, 0.014524416998028755, 0.1064278706908226, -0.030951853841543198, 0.002636514138430357, 0.0550268180668354, 0.041021376848220825, 0.0043107978999614716, 0.08631445467472076, 0.04848227649927139, 0.03717615827918053, 0.0924934670329094, -0.0632920116186142, 0.03248706832528114, -0.0363779217004776, 0.06145356222987175, 0.06950224190950394, -0.0788266658782959, 0.07856321334838867, -0.02554325759410858, -0.040353722870349884, 0.028482595458626747, -0.14506714046001434, 0.003148228395730257, -0.015608948655426502, -0.04480002075433731, 0.04402109608054161, -0.07011529058218002, 0.02474232017993927, -0.0037816010881215334, 0.014082562178373337, 0.009038789197802544, 0.005748945754021406, 0.01655176281929016, -0.010510282590985298, -0.06089336425065994, 3.9105721581781986e-33, -0.04275459796190262, -0.018081501126289368, -0.05374561622738838, 0.09275712817907333, -0.05766664445400238, 0.09012793004512787, 0.03396812826395035, 0.06543441116809845, -0.05398643761873245, 0.040259651839733124, -0.06436437368392944, 0.044768381863832474, -0.040209658443927765, 0.041388291865587234, -0.026333162561058998, -0.031235579401254654, 0.013236635364592075, 0.03193887695670128, 0.02952825091779232, 0.09623228013515472, 0.09207478165626526, 0.0696730837225914, -0.04402382671833038, -0.026734428480267525, -0.010115702636539936, 0.03555365651845932, -0.0047235069796442986, -0.09811870753765106, -0.031026547774672508, 0.005871000234037638, -0.00678643025457859, -0.05141919478774071, -0.03033633530139923, -0.046260375529527664, 0.02712939865887165, -0.03132680058479309, 0.006028866395354271, -0.04999292269349098, -0.1270374357700348, -0.09791628271341324, -0.006985843647271395, 0.02858961746096611, -0.10996761173009872, -0.03622922673821449, -0.03205928951501846, -0.01995287649333477, -0.0004616261285264045, -0.007910676300525665, 0.016361849382519722, -0.1081310585141182, 0.05299697443842888, 0.07554362714290619, 0.005559640005230904, 0.04940900206565857, -0.01374399196356535, 0.02463657595217228, 0.04751932993531227, 0.019973231479525566, 0.046179041266441345, -0.0032418600749224424, 0.014323930256068707, 0.05702301859855652, -0.017752479761838913, 0.059231534600257874, 0.06083909794688225, 0.05689506232738495, -0.06956592202186584, -0.0225543063133955, 0.044051557779312134, 0.03776608780026436, -0.048912689089775085, 0.001674127415753901, -0.01803850382566452, 0.06348074227571487, -0.014785435050725937, -0.016540788114070892, -0.02175799012184143, -0.054281074553728104, 0.03154462203383446, -0.04791422560811043, -0.06941045075654984, -0.04718148335814476, 0.07942749559879303, 0.025670496746897697, 0.017332853749394417, -0.07971907407045364, -0.005142442416399717, -0.02092878334224224, 0.016116831451654434, -0.04282326251268387, 0.024592649191617966, -0.09807933121919632, 0.007524406537413597, -0.0943470224738121, 0.0014105665031820536, -3.99970732340716e-33, 0.032307807356119156, 0.0849434956908226, -0.12309465557336807, 0.005703086964786053, -0.009042257443070412, -0.003388403682038188, -0.0012102954788133502, -0.03836926072835922, -0.0077941929921507835, -0.06136033311486244, -0.0649377703666687, 0.0022645615972578526, 0.07567674666643143, -0.0075491610914468765, 0.034489184617996216, 0.039666447788476944, -0.0820332020521164, -0.10250657796859741, 0.021270915865898132, -0.04183114692568779, -0.0328129343688488, 0.007841134443879128, 0.07151661068201065, -0.007438520435243845, 0.005666173063218594, 0.05249651521444321, -0.010849528945982456, 0.04973393678665161, 0.10394741594791412, 0.01621275581419468, 0.0179420318454504, 0.002522897906601429, -0.034152865409851074, -0.07619393616914749, -0.03858088701963425, -0.010755215771496296, -0.03847697004675865, 0.07053643465042114, 0.0017915925709530711, -0.047204241156578064, 0.05367925763130188, 0.026910457760095596, -0.042155638337135315, 0.016311682760715485, -0.0007734766113571823, 0.013464685529470444, -0.012716731987893581, -0.03605911135673523, 0.05170232057571411, -0.04857484623789787, 0.037389472126960754, 0.053478773683309555, -0.021640514954924583, 0.03848522529006004, 0.0492231622338295, -0.02340007945895195, 0.06135036423802376, 0.018246300518512726, 0.008753757923841476, -0.015231291763484478, 0.03816942870616913, -0.04412662982940674, -0.07003944367170334, -0.03967316448688507, -0.03931683301925659, -0.030263647437095642, -0.021616483107209206, -0.04118632152676582, 0.0031190039590001106, 0.01067929808050394, 0.03145913779735565, 0.048593297600746155, -0.003369402140378952, -0.007549148518592119, -0.03766441345214844, 0.07988712936639786, 0.0705358162522316, 0.018609723076224327, 0.009862546809017658, -0.0001646668097237125, -0.026266682893037796, 0.03265230730175972, 0.00821967888623476, 0.08477312326431274, 0.031010396778583527, -0.14343322813510895, 0.038149744272232056, -0.0014192390954121947, -0.0012567531084641814, -0.06567700952291489, 0.03739948943257332, 0.003989839926362038, -0.09580141305923462, 0.02874254807829857, -0.03540151193737984, -4.4827622502907616e-8, -0.08144593983888626, -0.023202715441584587, -0.04805264249444008, 0.021849695593118668, 0.014188658446073532, -0.0014201609883457422, 0.04223710671067238, 0.022812610492110252, 0.003594669746235013, -0.03292800858616829, 0.05555933341383934, -0.010579770430922508, 0.02775651402771473, -0.014191116206347942, 0.0611283965408802, 0.035424161702394485, -0.025172537192702293, -0.017230741679668427, -0.023139888420701027, 0.024242926388978958, 0.0026401099748909473, -0.03075527772307396, -0.060987457633018494, 0.03871753439307213, -0.08104648441076279, -0.03069796785712242, 0.023531736806035042, 0.023851418867707253, 0.0041753072291612625, -0.009380626492202282, -0.034589607268571854, 0.08043020218610764, 0.08052360266447067, -0.019483106210827827, -0.007446142379194498, 0.05808684602379799, 0.004291750956326723, -0.045430563390254974, -0.017380977049469948, 0.044604428112506866, -0.033968739211559296, -0.0021511849481612444, -0.029582006856799126, 0.008167305029928684, -0.0013972775777801871, -0.07153941690921783, -0.0035279160365462303, 0.002409011358395219, 0.018161611631512642, 0.13989903032779694, 0.07490915805101395, 0.057580556720495224, -0.05200676992535591, 0.03533698618412018, 0.0609622560441494, 0.03480558469891548, -0.06916802376508713, -0.050708841532468796, -0.020581092685461044, 0.02474787086248398, -0.05739713832736015, 0.013995697721838951, 0.08559358865022659, -0.04758765175938606 ]
0.089898
UTF-8 encoding by default. Some third-party JavaScript libraries compute the checksum on a string based on `str.charCodeAt()` so that it can be run in browsers. If users want to match the checksum computed with this kind of library in the browser, it's better to use the same library in Node.js if it also runs in Node.js. If users have to use `zlib.crc32()` to match the checksum produced by such a third-party library: 1. If the library accepts `Uint8Array` as input, use `TextEncoder` in the browser to encode the string into a `Uint8Array` with UTF-8 encoding, and compute the checksum based on the UTF-8 encoded string in the browser. 2. If the library only takes a string and compute the data based on `str.charCodeAt()`, on the Node.js side, convert the string into a buffer using `Buffer.from(str, 'utf16le')`. ```mjs import zlib from 'node:zlib'; import { Buffer } from 'node:buffer'; let crc = zlib.crc32('hello'); // 907060870 crc = zlib.crc32('world', crc); // 4192936109 crc = zlib.crc32(Buffer.from('hello', 'utf16le')); // 1427272415 crc = zlib.crc32(Buffer.from('world', 'utf16le'), crc); // 4150509955 ``` ```cjs const zlib = require('node:zlib'); const { Buffer } = require('node:buffer'); let crc = zlib.crc32('hello'); // 907060870 crc = zlib.crc32('world', crc); // 4192936109 crc = zlib.crc32(Buffer.from('hello', 'utf16le')); // 1427272415 crc = zlib.crc32(Buffer.from('world', 'utf16le'), crc); // 4150509955 ``` ## `zlib.createBrotliCompress([options])` \* `options` {brotli options} Creates and returns a new [`BrotliCompress`][] object. ## `zlib.createBrotliDecompress([options])` \* `options` {brotli options} Creates and returns a new [`BrotliDecompress`][] object. ## `zlib.createDeflate([options])` \* `options` {zlib options} Creates and returns a new [`Deflate`][] object. ## `zlib.createDeflateRaw([options])` \* `options` {zlib options} Creates and returns a new [`DeflateRaw`][] object. An upgrade of zlib from 1.2.8 to 1.2.11 changed behavior when `windowBits` is set to 8 for raw deflate streams. zlib would automatically set `windowBits` to 9 if was initially set to 8. Newer versions of zlib will throw an exception, so Node.js restored the original behavior of upgrading a value of 8 to 9, since passing `windowBits = 9` to zlib actually results in a compressed stream that effectively uses an 8-bit window only. ## `zlib.createGunzip([options])` \* `options` {zlib options} Creates and returns a new [`Gunzip`][] object. ## `zlib.createGzip([options])` \* `options` {zlib options} Creates and returns a new [`Gzip`][] object. See [example][zlib.createGzip example]. ## `zlib.createInflate([options])` \* `options` {zlib options} Creates and returns a new [`Inflate`][] object. ## `zlib.createInflateRaw([options])` \* `options` {zlib options} Creates and returns a new [`InflateRaw`][] object. ## `zlib.createUnzip([options])` \* `options` {zlib options} Creates and returns a new [`Unzip`][] object. ## `zlib.createZstdCompress([options])` > Stability: 1 - Experimental \* `options` {zstd options} Creates and returns a new [`ZstdCompress`][] object. ## `zlib.createZstdDecompress([options])` > Stability: 1 - Experimental \* `options` {zstd options} Creates and returns a new [`ZstdDecompress`][] object. ## Convenience methods All of these take a {Buffer}, {TypedArray}, {DataView}, {ArrayBuffer}, or string as the first argument, an optional second argument to supply options to the `zlib` classes and will call the supplied callback with `callback(error, result)`. Every method has a `\*Sync` counterpart, which accept the same arguments, but without a callback. ### `zlib.brotliCompress(buffer[, options], callback)` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {brotli options} \* `callback` {Function} ### `zlib.brotliCompressSync(buffer[, options])` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {brotli options} Compress a chunk of data with [`BrotliCompress`][]. ### `zlib.brotliDecompress(buffer[, options], callback)` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {brotli options} \* `callback` {Function} ### `zlib.brotliDecompressSync(buffer[, options])` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {brotli options} Decompress a chunk of data with [`BrotliDecompress`][]. ### `zlib.deflate(buffer[, options], callback)` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zlib options} \* `callback` {Function} ### `zlib.deflateSync(buffer[, options])` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zlib options} Compress a chunk of data with [`Deflate`][]. ### `zlib.deflateRaw(buffer[, options], callback)` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zlib options} \* `callback`
https://github.com/nodejs/node/blob/main//doc/api/zlib.md
main
nodejs
[ -0.008499511517584324, 0.03166014328598976, -0.07123100012540817, -0.015505846589803696, 0.026317710056900978, -0.08251702785491943, 0.048794329166412354, 0.010013852268457413, 0.02208026871085167, -0.03506274148821831, -0.032641563564538956, -0.009565007872879505, 0.05679032579064369, 0.016531268134713173, -0.04435206577181816, -0.08734102547168732, -0.024601545184850693, 0.07382610440254211, 0.004955964162945747, -0.05858442932367325, -0.008305507712066174, -0.017702391371130943, 0.09710550308227539, -0.007469603791832924, 0.0007865450461395085, -0.010407420806586742, -0.00036168660153634846, 0.05658038705587387, -0.016888931393623352, 0.007168557494878769, 0.0322665236890316, -0.009991776198148727, 0.0013768300414085388, 0.0009872225346043706, -0.00514829671010375, 0.0771665945649147, -0.033427633345127106, -0.18739619851112366, -0.025717400014400482, -0.017856478691101074, -0.03674900904297829, 0.08370058238506317, -0.05289643630385399, 0.06048554927110672, 0.034843362867832184, 0.06924762576818466, -0.01874171942472458, 0.0798761248588562, -0.035110827535390854, 0.01822846010327339, 0.03564939647912979, -0.0035796072334051132, -0.029864560812711716, 0.019273992627859116, 0.0028645272832363844, 0.014096703380346298, -0.0687158852815628, -0.0042633963748812675, 0.04893010854721069, 0.045980699360370636, -0.10267319530248642, 0.0008536162786185741, 0.05734521523118019, -0.0097525455057621, 0.057586513459682465, 0.08115611225366592, -0.04767950251698494, -0.047812558710575104, -0.06323964148759842, -0.019164059311151505, -0.006308145821094513, -0.008360507898032665, -0.015784278512001038, 0.08061036467552185, -0.10133272409439087, 0.02834172546863556, 0.005419083405286074, -0.06545408070087433, 0.006165861152112484, 0.04462522640824318, -0.060303639620542526, -0.059530988335609436, 0.06492768228054047, 0.10918309539556503, 0.08439593762159348, 0.0562906339764595, -0.05898677930235863, 0.06981820613145828, 0.010304494760930538, 0.03229886293411255, 0.051465652883052826, -0.0033361606765538454, 0.01840384118258953, 0.04278744384646416, 0.01344180479645729, 0.01956285536289215, 0.10780708491802216, 0.0877327024936676, -0.011975686065852642, 0.02212391421198845, 0.033790476620197296, -0.03942852094769478, 0.012992355972528458, -0.09180863946676254, 0.02401251532137394, 0.08410347253084183, 0.09853755682706833, 0.08979295939207077, -0.0048485249280929565, 0.015551426447927952, -0.006357772275805473, 0.007539753802120686, 0.003079024376347661, -0.08969584107398987, 0.0002788806741591543, -0.009600680321455002, 0.04162370786070824, -0.023477645590901375, 0.0018146674847230315, 0.0211032722145319, -0.03060220368206501, -0.009435143321752548, -0.04458584263920784, -0.005200348328799009, 0.053027234971523285, -0.06142699345946312, -0.0027546905912458897, 2.7872886746446293e-33, -0.058833278715610504, 0.1151966005563736, 0.007159238215535879, -0.006815303582698107, -0.10544335842132568, 0.0188340675085783, -0.024722108617424965, 0.03619582951068878, -0.045871905982494354, -0.038868535310029984, -0.05011753365397453, 0.052606698125600815, -0.02765798009932041, -0.0767773762345314, 0.05148801580071449, -0.03123351000249386, 0.05622575059533119, -0.08825071156024933, 0.08064907789230347, 0.04500852897763252, 0.046684153378009796, -0.01027545053511858, 0.0407109335064888, -0.012975938618183136, -0.07840020954608917, -0.03751513361930847, -0.01477062702178955, -0.040258876979351044, -0.040782999247312546, -0.018948514014482498, -0.07737167179584503, -0.027669528499245644, -0.04750581458210945, -0.013614130206406116, 0.0503145270049572, -0.040672313421964645, 0.0014627003110945225, 0.020953228697180748, -0.14988312125205994, -0.022676175460219383, 0.0032000744249671698, 0.020743684843182564, 0.0009963244665414095, 0.013919529505074024, 0.009460032917559147, 0.013554975390434265, -0.015151615254580975, -0.09803664684295654, 0.05366652086377144, -0.05817678943276405, 0.012729205191135406, 0.09418455511331558, -0.05345818027853966, 0.03306599333882332, -0.08090312033891678, -0.026272963732481003, 0.10247618705034256, -0.025535956025123596, -0.020568814128637314, 0.04901180788874626, 0.02065812610089779, 0.011426640674471855, 0.05798223242163658, 0.03908555209636688, -0.00823211669921875, -0.017433589324355125, -0.05888020247220993, -0.0312027744948864, -0.03201306611299515, 0.038195278495550156, -0.07843942940235138, -0.000931750051677227, 0.08490873128175735, 0.04768367484211922, -0.043363723903894424, -0.0014096457744017243, -0.06088440492749214, -0.03321342542767525, 0.027272535488009453, -0.05636022984981537, 0.05854996666312218, -0.040113870054483414, 0.02041039615869522, 0.026554519310593605, 0.036094117909669876, -0.08774679154157639, -0.018997836858034134, 0.002635151846334338, 0.020359892398118973, -0.003352162428200245, 0.09495346993207932, -0.07958094775676727, 0.009281528182327747, -0.03979082033038139, -0.015392123721539974, -3.8047839114179315e-33, -0.05321221426129341, 0.001811167341656983, 0.027641063556075096, 0.08261750638484955, -0.06997200846672058, -0.07680090516805649, 0.0057176691479980946, 0.017201343551278114, 0.0180307999253273, -0.05093475803732872, -0.005991628859192133, -0.012806255370378494, 0.07448583096265793, -0.010252525098621845, 0.042948611080646515, 0.015064792707562447, -0.06190937012434006, 0.06610868126153946, 0.10429222881793976, 0.00780319282785058, 0.0159013532102108, 0.0015291625168174505, 0.008969513699412346, 0.021701745688915253, 0.021621285006403923, 0.05744623392820358, 0.024322891607880592, -0.08144988864660263, 0.045759402215480804, 0.0024715557228773832, -0.027186881750822067, 0.10015518963336945, 0.01659773848950863, 0.027930796146392822, -0.051638856530189514, -0.0699830874800682, 0.023415736854076385, 0.04943320155143738, 0.0721329003572464, -0.021732477471232414, 0.07424765825271606, -0.03494387865066528, -0.04671863839030266, 0.04929383099079132, 0.020474625751376152, 0.03052549436688423, -0.10007582604885101, 0.13646025955677032, -0.010270382277667522, 0.01860574074089527, 0.03974584862589836, -0.017121531069278717, -0.056205641478300095, 0.008799975737929344, 0.04769701510667801, -0.03243577852845192, -0.014208684675395489, -0.01311880350112915, 0.02297298051416874, 0.030533239245414734, -0.05402708798646927, -0.11292920261621475, -0.00023140045232139528, -0.04466869309544563, -0.023922307416796684, -0.017346259206533432, -0.06113206222653389, -0.020665662363171577, 0.07421506196260452, -0.010129212401807308, 0.03872539475560188, -0.012301047332584858, -0.03123021312057972, 0.05442911013960838, -0.029790200293064117, -0.01809900440275669, 0.02667309157550335, -0.004987005144357681, -0.015270414762198925, 0.08252859860658646, -0.029810307547450066, 0.06452033668756485, 0.01242608018219471, 0.08995536714792252, 0.042621079832315445, -0.03277834877371788, -0.035718709230422974, -0.04627887159585953, -0.028819700703024864, -0.08145155757665634, 0.03430371731519699, 0.07856746762990952, -0.04001493379473686, -0.04992668703198433, -0.04128292202949524, -4.621351479272562e-8, -0.08246392011642456, -0.04513990134000778, -0.10801155865192413, -0.0023566726595163345, 0.015387587249279022, -0.02802804671227932, -0.09395770728588104, -0.08086254447698593, 0.07438558340072632, -0.024800924584269524, 0.058757904917001724, -0.041239578276872635, -0.047403980046510696, -0.04853423312306404, 0.027658803388476372, 0.0891118198633194, -0.0020483818370848894, 0.02804521657526493, 0.02893727645277977, 0.10869166254997253, 0.06932377070188522, 0.030065255239605904, -0.049959443509578705, 0.06451547145843506, -0.05809738114476204, -0.06039496883749962, -0.08618973195552826, 0.04690650850534439, -0.02829349786043167, -0.014700192026793957, -0.003563526552170515, -0.007711823098361492, 0.019833780825138092, -0.0542890764772892, -0.019008290022611618, 0.06896810233592987, 0.0029129553586244583, -0.07551409304141998, 0.014697770588099957, 0.08697240799665451, 0.08107349276542664, -0.004705851431936026, -0.08227960020303726, -0.02489163540303707, -0.04561004415154457, -0.05465751513838768, -0.005666480399668217, 0.028639236465096474, 0.03703003376722336, -0.016021257266402245, 0.11706306040287018, -0.09339539706707001, -0.011726359836757183, -0.05353689193725586, 0.025295164436101913, -0.050215236842632294, -0.030613696202635765, -0.05623865872621536, 0.030545510351657867, 0.04297809675335884, 0.04904107004404068, 0.022932428866624832, 0.09113021194934845, -0.08694512397050858 ]
-0.015439
a chunk of data with [`BrotliDecompress`][]. ### `zlib.deflate(buffer[, options], callback)` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zlib options} \* `callback` {Function} ### `zlib.deflateSync(buffer[, options])` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zlib options} Compress a chunk of data with [`Deflate`][]. ### `zlib.deflateRaw(buffer[, options], callback)` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zlib options} \* `callback` {Function} ### `zlib.deflateRawSync(buffer[, options])` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zlib options} Compress a chunk of data with [`DeflateRaw`][]. ### `zlib.gunzip(buffer[, options], callback)` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zlib options} \* `callback` {Function} ### `zlib.gunzipSync(buffer[, options])` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zlib options} Decompress a chunk of data with [`Gunzip`][]. ### `zlib.gzip(buffer[, options], callback)` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zlib options} \* `callback` {Function} ### `zlib.gzipSync(buffer[, options])` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zlib options} Compress a chunk of data with [`Gzip`][]. ### `zlib.inflate(buffer[, options], callback)` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zlib options} \* `callback` {Function} ### `zlib.inflateSync(buffer[, options])` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zlib options} Decompress a chunk of data with [`Inflate`][]. ### `zlib.inflateRaw(buffer[, options], callback)` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zlib options} \* `callback` {Function} ### `zlib.inflateRawSync(buffer[, options])` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zlib options} Decompress a chunk of data with [`InflateRaw`][]. ### `zlib.unzip(buffer[, options], callback)` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zlib options} \* `callback` {Function} ### `zlib.unzipSync(buffer[, options])` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zlib options} Decompress a chunk of data with [`Unzip`][]. ### `zlib.zstdCompress(buffer[, options], callback)` > Stability: 1 - Experimental \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zstd options} \* `callback` {Function} ### `zlib.zstdCompressSync(buffer[, options])` > Stability: 1 - Experimental \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zstd options} Compress a chunk of data with [`ZstdCompress`][]. ### `zlib.zstdDecompress(buffer[, options], callback)` \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zstd options} \* `callback` {Function} ### `zlib.zstdDecompressSync(buffer[, options])` > Stability: 1 - Experimental \* `buffer` {Buffer|TypedArray|DataView|ArrayBuffer|string} \* `options` {zstd options} Decompress a chunk of data with [`ZstdDecompress`][]. [Brotli parameters]: #brotli-constants [Cyclic redundancy check]: https://en.wikipedia.org/wiki/Cyclic\_redundancy\_check [Memory usage tuning]: #memory-usage-tuning [RFC 7932]: https://www.rfc-editor.org/rfc/rfc7932.txt [Streams API]: stream.md [Zstd parameters]: #zstd-constants [`.flush()`]: #zlibflushkind-callback [`Accept-Encoding`]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3 [`BrotliCompress`]: #class-zlibbrotlicompress [`BrotliDecompress`]: #class-zlibbrotlidecompress [`Content-Encoding`]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11 [`DeflateRaw`]: #class-zlibdeflateraw [`Deflate`]: #class-zlibdeflate [`Gunzip`]: #class-zlibgunzip [`Gzip`]: #class-zlibgzip [`InflateRaw`]: #class-zlibinflateraw [`Inflate`]: #class-zlibinflate [`Unzip`]: #class-zlibunzip [`ZlibBase`]: #class-zlibzlibbase [`ZstdCompress`]: #class-zlibzstdcompress [`ZstdDecompress`]: #class-zlibzstddecompress [`buffer.kMaxLength`]: buffer.md#bufferkmaxlength [`deflateInit2` and `inflateInit2`]: https://zlib.net/manual.html#Advanced [`stream.Transform`]: stream.md#class-streamtransform [convenience methods]: #convenience-methods [zlib documentation]: https://zlib.net/manual.html#Constants [zlib.createGzip example]: #zlib
https://github.com/nodejs/node/blob/main//doc/api/zlib.md
main
nodejs
[ -0.10822615027427673, 0.016446445137262344, -0.07267545908689499, 0.010303997434675694, -0.04398566856980324, -0.10005088150501251, 0.07346053421497345, 0.009555568918585777, -0.05355818197131157, -0.08569927513599396, -0.05926213786005974, -0.0024899409618228674, -0.00221252697519958, -0.012132343836128712, -0.010342384688556194, 0.0007110941805876791, -0.05556779354810715, -0.023895718157291412, -0.07657504081726074, -0.0041473121382296085, 0.0075718676671385765, 0.01775110326707363, -0.019561482593417168, -0.0005675172433257103, 0.07874587178230286, 0.02648315764963627, 0.022061016410589218, 0.005396696738898754, 0.044777173548936844, 0.00024111042148433626, 0.06257597357034683, 0.017642175778746605, -0.04695694148540497, 0.03825455531477928, -0.019993245601654053, 0.08419138193130493, 0.007766785100102425, -0.01354268379509449, -0.05547110363841057, 0.020623117685317993, 0.003567897016182542, 0.1371404230594635, -0.09511219710111618, 0.039020977914333344, -0.04089386761188507, 0.022061040624976158, 0.027061723172664642, -0.041659265756607056, -0.07226698845624924, 0.022885138168931007, -0.0734298825263977, 0.028532467782497406, -0.05153915286064148, 0.08949009329080582, 0.03918522596359253, 0.003671369282528758, -0.05079490691423416, -0.014158885926008224, 0.019050536677241325, 0.04638463631272316, -0.05199078097939491, -0.009515512734651566, -0.013696753419935703, 0.06671589612960815, 0.01824585162103176, 0.021832967177033424, 0.11248849332332611, 0.01239534467458725, 0.023387717083096504, 0.03321626037359238, -0.04395425692200661, 0.004325493238866329, -0.04176587238907814, 0.02687322348356247, -0.05357668548822403, -0.023952992632985115, 0.03181717172265053, -0.09597181528806686, -0.021429594606161118, -0.03700246661901474, 0.0022553522139787674, -0.07179877907037735, -0.016781093552708626, 0.005212880205363035, 0.013806285336613655, 0.016432814300060272, -0.06313390284776688, -0.0022729006595909595, -0.032817427068948746, -0.028170157223939896, 0.023249490186572075, 0.04914930462837219, -0.016356350854039192, 0.06993916630744934, -0.02717088907957077, 0.03091510385274887, 0.05821971222758293, -0.011389292776584625, 0.02826572209596634, 0.0656469389796257, -0.01297722291201353, 0.009686075150966644, 0.04611895605921745, 0.013173617422580719, -0.036055274307727814, -0.11740592122077942, 0.1078900545835495, 0.06579035520553589, -0.14618945121765137, 0.06911972910165787, -0.038241904228925705, 0.019397441297769547, 0.04288177937269211, -0.03375339135527611, -0.005588484462350607, 0.028735490515828133, -0.028800731524825096, 0.018739666789770126, -0.029993103817105293, 0.01018284447491169, 0.00768745131790638, 0.039103537797927856, -0.03999940678477287, 0.0024860803969204426, 0.024804597720503807, -0.025526976212859154, -0.05513489246368408, 6.322454405931245e-33, 0.02138032577931881, -0.061652764678001404, -0.014107733964920044, 0.014096138998866081, -0.006272603757679462, 0.04253336042165756, 0.019752847030758858, 0.00975123792886734, -0.042909931391477585, 0.03297065570950508, -0.06118454039096832, -0.06578350812196732, -0.0015834519872441888, 0.004596205428242683, -0.02401880919933319, -0.06852064281702042, 0.011590374633669853, 0.05637116730213165, -0.09128157049417496, 0.07354085892438889, 0.0853918120265007, 0.02627401426434517, -0.06976279616355896, -0.06552120298147202, -0.04651590436697006, -0.011380595155060291, 0.02306356281042099, -0.030198311433196068, -0.023889560252428055, 0.01244631689041853, -0.005123072769492865, -0.006122581195086241, -0.0342956967651844, -0.023380568251013756, 0.020539075136184692, -0.05064433068037033, -0.027375712990760803, -0.024480922147631645, -0.07207885384559631, -0.03098210319876671, 0.0021589715033769608, 0.04815664887428284, -0.07959295064210892, 0.020556896924972534, -0.06244250386953354, -0.04637657478451729, -0.013678467832505703, 0.07945800572633743, -0.0514381006360054, -0.06088060885667801, 0.056043047457933426, 0.07464002817869186, -0.03795616328716278, 0.025461707264184952, -0.02277933619916439, -0.05334554240107536, 0.0167002622038126, -0.0022007827647030354, 0.10091260075569153, 0.09265170246362686, -0.08069866895675659, 0.026204770430922508, -0.007244577165693045, 0.03407084196805954, 0.0073660290800035, 0.02807965874671936, -0.04044405370950699, -0.012759423814713955, 0.010251706466078758, -0.03982941433787346, -0.030260933563113213, 0.015908513218164444, 0.03780928999185562, 0.0025617077481001616, 0.016250988468527794, -0.022315531969070435, -0.09319683164358139, -0.07699117064476013, -0.08306076377630234, -0.11276239901781082, 0.0063257296569645405, -0.02831418439745903, 0.04854464903473854, 0.013215038925409317, 0.00033687532413750887, -0.08051130175590515, -0.026371901854872704, -0.07614798098802567, -0.04426240175962448, -0.042443398386240005, -0.09820502251386642, -0.06626152247190475, 0.07598324865102768, -0.20920813083648682, -0.0069379787892103195, -6.583359785200068e-33, 0.0813913568854332, 0.033334024250507355, -0.030715595930814743, 0.05864662677049637, 0.06585106998682022, 0.08000271022319794, 0.07169249653816223, 0.026691557839512825, -0.0052378796972334385, -0.03562043979763985, -0.08275013417005539, 0.01691223494708538, 0.03065190277993679, -0.013848330825567245, -0.010794054716825485, 0.06154493987560272, -0.019243774935603142, -0.10387925803661346, 0.002234074519947171, -0.014406350441277027, -0.04440605267882347, -0.022143753245472908, 0.050469204783439636, 0.045731935650110245, -0.012665380723774433, 0.027911175042390823, -0.029481766745448112, 0.08813649415969849, 0.12470833212137222, 0.025806963443756104, -0.051395006477832794, -0.026628419756889343, -0.06291153281927109, -0.050503846257925034, 0.0073233675211668015, 0.018971024081110954, 0.06772705912590027, 0.08427174389362335, -0.08584162592887878, 0.008836599998176098, 0.08135998249053955, 0.013179662637412548, -0.04942472279071808, 0.035676874220371246, 0.06988805532455444, 0.01104982104152441, -0.03736666589975357, -0.05436811223626137, -0.024125028401613235, -0.04757508635520935, -0.016513891518115997, 0.09325800091028214, -0.035055577754974365, 0.06565649807453156, 0.11907748878002167, -0.014955174177885056, 0.04665025696158409, -0.05960928648710251, -0.018393587321043015, -0.006046213209629059, -0.01952732354402542, -0.07118238508701324, 0.03887391462922096, -0.06452640146017075, 0.09121520072221756, -0.016613835468888283, -0.028934188187122345, -0.07325118780136108, 0.06549715250730515, 0.02925512194633484, 0.051953595131635666, -0.009069224819540977, 0.034586552530527115, 0.014705624431371689, 0.05328678339719772, 0.06411898136138916, 0.011001559905707836, -0.08482815325260162, 0.0747794434428215, 0.1456877887248993, 0.040190041065216064, 0.006026867311447859, 0.100863017141819, 0.11353766918182373, 0.04472608491778374, -0.027691029012203217, -0.02734893374145031, 0.052970413118600845, -0.03109872154891491, -0.06315332651138306, -0.01343208085745573, -0.025865696370601654, 0.034986160695552826, 0.032129622995853424, 0.03369245305657387, -4.082544435846103e-8, -0.04821913316845894, -0.07232563197612762, -0.03065217286348343, 0.09233357012271881, -0.054560575634241104, -0.05879015848040581, -0.04653148353099823, -0.012194138951599598, 0.0446448028087616, -0.12848857045173645, 0.05846436694264412, -0.030368629842996597, 0.047835107892751694, 0.04015631601214409, 0.03935100883245468, -0.0029285596683621407, 0.0190268624573946, -0.04041212797164917, -0.02841251529753208, 0.014755462296307087, -0.03651471808552742, -0.007572289556264877, -0.05197378993034363, 0.024285143241286278, 0.02471769042313099, -0.014388425275683403, 0.013619263656437397, 0.07376539707183838, 0.027867551892995834, -0.0386538989841938, -0.03774237632751465, 0.00890730693936348, 0.06093066558241844, 0.030960548669099808, -0.03315417096018791, -0.0010859298054128885, 0.04102868214249611, 0.027100924402475357, 0.01766641065478325, 0.09804321080446243, 0.014248378574848175, -0.027519244700670242, -0.035647958517074585, 0.028724245727062225, 0.07748527079820633, -0.03306647017598152, -0.03652498498558998, -0.0001272553054150194, 0.04821109399199486, 0.09530569612979889, 0.01819906197488308, 0.02435569278895855, 0.013384939171373844, 0.04330870509147644, 0.09629954397678375, -0.03864405304193497, -0.05620213598012924, -0.06279561668634415, 0.03811849653720856, 0.06284529715776443, -0.01933463104069233, -0.031709082424640656, 0.017850736156105995, -0.017763080075383186 ]
0.022734
# Cluster > Stability: 2 - Stable Clusters of Node.js processes can be used to run multiple instances of Node.js that can distribute workloads among their application threads. When process isolation is not needed, use the [`worker\_threads`][] module instead, which allows running multiple application threads within a single Node.js instance. The cluster module allows easy creation of child processes that all share server ports. ```mjs import cluster from 'node:cluster'; import http from 'node:http'; import { availableParallelism } from 'node:os'; import process from 'node:process'; const numCPUs = availableParallelism(); if (cluster.isPrimary) { console.log(`Primary ${process.pid} is running`); // Fork workers. for (let i = 0; i < numCPUs; i++) { cluster.fork(); } cluster.on('exit', (worker, code, signal) => { console.log(`worker ${worker.process.pid} died`); }); } else { // Workers can share any TCP connection // In this case it is an HTTP server http.createServer((req, res) => { res.writeHead(200); res.end('hello world\n'); }).listen(8000); console.log(`Worker ${process.pid} started`); } ``` ```cjs const cluster = require('node:cluster'); const http = require('node:http'); const numCPUs = require('node:os').availableParallelism(); const process = require('node:process'); if (cluster.isPrimary) { console.log(`Primary ${process.pid} is running`); // Fork workers. for (let i = 0; i < numCPUs; i++) { cluster.fork(); } cluster.on('exit', (worker, code, signal) => { console.log(`worker ${worker.process.pid} died`); }); } else { // Workers can share any TCP connection // In this case it is an HTTP server http.createServer((req, res) => { res.writeHead(200); res.end('hello world\n'); }).listen(8000); console.log(`Worker ${process.pid} started`); } ``` Running Node.js will now share port 8000 between the workers: ```console $ node server.js Primary 3596 is running Worker 4324 started Worker 4520 started Worker 6056 started Worker 5644 started ``` On Windows, it is not yet possible to set up a named pipe server in a worker. ## How it works The worker processes are spawned using the [`child\_process.fork()`][] method, so that they can communicate with the parent via IPC and pass server handles back and forth. The cluster module supports two methods of distributing incoming connections. The first one (and the default one on all platforms except Windows) is the round-robin approach, where the primary process listens on a port, accepts new connections and distributes them across the workers in a round-robin fashion, with some built-in smarts to avoid overloading a worker process. The second approach is where the primary process creates the listen socket and sends it to interested workers. The workers then accept incoming connections directly. The second approach should, in theory, give the best performance. In practice however, distribution tends to be very unbalanced due to operating system scheduler vagaries. Loads have been observed where over 70% of all connections ended up in just two processes, out of a total of eight. Because `server.listen()` hands off most of the work to the primary process, there are three cases where the behavior between a normal Node.js process and a cluster worker differs: 1. `server.listen({fd: 7})` Because the message is passed to the primary, file descriptor 7 \*\*in the parent\*\* will be listened on, and the handle passed to the worker, rather than listening to the worker's idea of what the number 7 file descriptor references. 2. `server.listen(handle)` Listening on handles explicitly will cause the worker to use the supplied handle, rather than talk to the primary process. 3. `server.listen(0)` Normally, this will cause servers to listen on a random port. However, in a cluster, each worker will receive the same "random" port each time they do `listen(0)`. In essence, the port is random the first time, but predictable thereafter. To listen on a unique port, generate a port number based on the cluster worker ID. Node.js does not provide routing logic. It is therefore
https://github.com/nodejs/node/blob/main//doc/api/cluster.md
main
nodejs
[ -0.06094501540064812, -0.043891023844480515, -0.032970279455184937, 0.015375296585261822, 0.029345309361815453, -0.06590024381875992, -0.0690661370754242, 0.02837207540869713, 0.007732630241662264, 0.026081427931785583, -0.034200746566057205, 0.028765570372343063, 0.00537990452721715, -0.04879365116357803, 0.03491489589214325, -0.011062494479119778, 0.05375754088163376, 0.0008901384426280856, 0.021641815081238747, -0.08123337477445602, -0.02909182198345661, -0.03041241131722927, 0.03255004808306694, 0.003643202129751444, -0.05570083111524582, 0.036186009645462036, -0.03608578443527222, -0.018634343519806862, 0.05787918344140053, -0.020609162747859955, 0.036841608583927155, -0.04499712958931923, -0.10289663076400757, 0.020126642659306526, 0.02094787172973156, 0.15302366018295288, -0.03654337674379349, -0.0801481157541275, -0.09249253571033478, -0.007182395551353693, 0.07655990868806839, 0.0631990134716034, -0.06952428817749023, -0.09786996990442276, -0.031966932117938995, -0.04021093249320984, -0.15769097208976746, 0.020490506663918495, -0.039545007050037384, -0.04724970459938049, -0.007251393981277943, -0.05910589173436165, -0.01282196119427681, 0.07107740640640259, -0.019341958686709404, -0.019300494343042374, 0.025426050648093224, -0.060299523174762726, -0.006418562959879637, 0.029698742553591728, 0.021107815206050873, -0.04039083793759346, 0.0626189261674881, -0.04285289719700813, 0.09087139368057251, 0.030039822682738304, 0.04094083607196808, 0.032285425812006, 0.01569485105574131, -0.00258626788854599, 0.04643712937831879, 0.006392583250999451, -0.05824648588895798, -0.02901061624288559, -0.08899945020675659, -0.016785966232419014, -0.007428114302456379, -0.04615774378180504, -0.06072964891791344, 0.0643366128206253, -0.04159161448478699, -0.01584916189312935, -0.027702314779162407, 0.0013948188861832023, -0.028171079233288765, 0.06567957997322083, -0.02069120667874813, -0.03179320693016052, 0.07400304824113846, -0.020661868155002594, -0.1083371564745903, 0.1434081643819809, -0.014309776946902275, 0.018795490264892578, 0.029843084514141083, -0.002571279415860772, -0.030799956992268562, 0.05711926147341728, -0.016100456938147545, 0.013661731034517288, 0.0447850376367569, -0.04086887836456299, 0.054666049778461456, -0.03363799303770065, 0.009722048416733742, -0.012969911098480225, -0.00244798231869936, -0.00556271243840456, 0.019506698474287987, -0.003100100439041853, 0.010290650650858879, 0.08669689297676086, -0.00909487809985876, 0.06385857611894608, -0.08280210942029953, 0.05173654481768608, 0.14458651840686798, -0.060418419539928436, 0.005177225451916456, 0.11582254618406296, 0.07743893563747406, -0.021504685282707214, -0.006469578482210636, -0.016471195966005325, 0.05418473854660988, -0.04815685749053955, -0.002131544752046466, 4.537103300326785e-33, -0.020341603085398674, -0.12138157337903976, 0.029803063720464706, -0.006224530749022961, 0.04182182997465134, -0.001619734801352024, -0.028105467557907104, -0.03786944970488548, -0.0757712870836258, -0.10022328048944473, -0.018875136971473694, 0.021967953070998192, 0.019113443791866302, -0.09156355261802673, 0.0066541144624352455, -0.06763558834791183, 0.1335090547800064, 0.035377949476242065, 0.11651777476072311, 0.016900526359677315, 0.02242438681423664, -0.027554623782634735, -0.07270387560129166, 0.04430123418569565, -0.033268243074417114, 0.018582316115498543, -0.009340797550976276, -0.01929181069135666, 0.010328398086130619, 0.016373764723539352, 0.06964119523763657, 0.0636945366859436, -0.07773467153310776, 0.012803240679204464, -0.04078491032123566, -0.0024864845909178257, -0.022777264937758446, 0.023135041818022728, -0.03846607357263565, -0.037064243108034134, -0.039494384080171585, 0.03869643062353134, 0.01930125616490841, -0.03876396268606186, -0.005604980979114771, -0.020903872326016426, -0.048688504844903946, -0.05349697172641754, 0.03207770735025406, -0.025146855041384697, 0.01470500510185957, -0.026734264567494392, 0.07224726676940918, -0.015430035069584846, 0.018377099186182022, 0.04029814526438713, -0.005833463743329048, -0.012177420780062675, -0.027076514437794685, 0.04839441925287247, 0.032095152884721756, -0.06925296038389206, -0.06153997778892517, 0.004254958126693964, 0.044974297285079956, -0.003262595972046256, -0.012680616229772568, 0.06238925829529762, 0.03218529745936394, 0.09584195911884308, -0.05704179033637047, 0.0455872118473053, 0.04075128957629204, 0.03639041632413864, -0.0033539526630192995, -0.02483905665576458, 0.004927912726998329, 0.0016897153109312057, -0.09094949811697006, 0.008511263877153397, 0.026173023506999016, -0.004832680337131023, -0.07642961293458939, 0.036380331963300705, 0.03309129923582077, 0.005111196544021368, -0.009003560990095139, 0.034974969923496246, -0.03567095845937729, 0.06513139605522156, 0.014261540025472641, 0.012563884258270264, 0.0794588178396225, -0.01862867921590805, -0.09287947416305542, -5.7991875037665195e-33, -0.05497811362147331, 0.01718386635184288, -0.07693406194448471, 0.08160637319087982, 0.03997999057173729, -0.015775777399539948, -0.034509267657995224, -0.007142826449126005, -0.07634250819683075, 0.0431077778339386, -0.0730803981423378, -0.02041439898312092, 0.019524382427334785, 0.05656338855624199, -0.08004508167505264, 0.028425579890608788, 0.04604819416999817, 0.003091743914410472, 0.0739341452717781, 0.021959060803055763, -0.08720926195383072, -0.0010935441823676229, 0.05944698303937912, -0.013734545558691025, -0.02388266660273075, 0.02525198832154274, -0.09333702176809311, -0.06764939427375793, -0.055134259164333344, -0.029394596815109253, -0.06714312732219696, 0.003518998622894287, 0.004546124953776598, 0.05715284124016762, 0.025305209681391716, -0.01782946102321148, -0.05818745121359825, 0.07806341350078583, 0.06830688565969467, -0.07786107063293457, 0.05799161270260811, -0.0072675226256251335, -0.02926112897694111, -0.022042952477931976, -0.010268446989357471, 0.0025703483261168003, 0.019152741879224777, -0.021424951031804085, -0.15139301121234894, 0.030151071026921272, -0.06501834839582443, -0.002077191835269332, 0.009677805006504059, 0.07865912467241287, -0.02550722099840641, 0.0001241055433638394, 0.0463995635509491, 0.036152005195617676, 0.002023461041972041, 0.02681311033666134, 0.08474121242761612, -0.13579237461090088, -0.054558880627155304, 0.03900768607854843, 0.047680724412202835, -0.043875787407159805, -0.05232217535376549, -0.008971482515335083, -0.0006982252816669643, 0.06321186572313309, -0.015553894452750683, 0.14352697134017944, 0.011652926914393902, 0.04126814752817154, -0.046525973826646805, 0.003690307028591633, -0.011199490167200565, -0.09487996995449066, -0.03628317639231682, 0.055731289088726044, -0.08502882719039917, 0.08382411301136017, -0.07106880843639374, 0.007319355849176645, 0.032675109803676605, 0.005616962444037199, 0.10097529739141464, 0.006324256770312786, 0.004707108251750469, -0.02391352318227291, -0.026610318571329117, 0.015395710244774818, -0.06354988366365433, -0.06212881952524185, -0.04860387742519379, -5.0807621221338195e-8, 0.04178297519683838, -0.023455243557691574, -0.06767147779464722, 0.030714554712176323, 0.014768107794225216, -0.015586608089506626, -0.004990363027900457, 0.02065838873386383, 0.058509260416030884, 0.14088088274002075, -0.01204484049230814, -0.01256097573786974, 0.026418061926960945, -0.0014236433198675513, 0.05561429634690285, 0.058138445019721985, -0.002370011992752552, 0.03921334818005562, -0.007387705147266388, -0.01843181811273098, -0.009806105867028236, -0.009698488749563694, -0.004078725352883339, 0.1019110381603241, -0.06293614208698273, -0.017552103847265244, 0.10446800291538239, -0.01630767062306404, -0.05196646228432655, -0.06638754159212112, -0.10643287748098373, -0.022231487557291985, 0.02059977687895298, 0.04104510322213173, -0.047522224485874176, 0.02527759037911892, -0.08881622552871704, 0.05121409147977829, 0.09356361627578735, 0.047350168228149414, 0.027346905320882797, 0.10151323676109314, -0.033006906509399414, 0.019107701256871223, 0.1006847694516182, 0.026209626346826553, -0.007306589279323816, -0.005612700246274471, -0.018479757010936737, 0.05406421795487404, 0.021693523973226547, -0.048537470400333405, -0.015832679346203804, 0.012360528111457825, 0.044283781200647354, -0.007516668643802404, 0.03362777829170227, -0.07226459681987762, 0.022485001012682915, 0.022472752258181572, 0.07720769196748734, 0.032684165984392166, -0.01169624924659729, -0.020224321633577347 ]
0.163157
each worker will receive the same "random" port each time they do `listen(0)`. In essence, the port is random the first time, but predictable thereafter. To listen on a unique port, generate a port number based on the cluster worker ID. Node.js does not provide routing logic. It is therefore important to design an application such that it does not rely too heavily on in-memory data objects for things like sessions and login. Because workers are all separate processes, they can be killed or re-spawned depending on a program's needs, without affecting other workers. As long as there are some workers still alive, the server will continue to accept connections. If no workers are alive, existing connections will be dropped and new connections will be refused. Node.js does not automatically manage the number of workers, however. It is the application's responsibility to manage the worker pool based on its own needs. Although a primary use case for the `node:cluster` module is networking, it can also be used for other use cases requiring worker processes. ## Class: `Worker` \* Extends: {EventEmitter} A `Worker` object contains all public information and method about a worker. In the primary it can be obtained using `cluster.workers`. In a worker it can be obtained using `cluster.worker`. ### Event: `'disconnect'` Similar to the `cluster.on('disconnect')` event, but specific to this worker. ```js cluster.fork().on('disconnect', () => { // Worker has disconnected }); ``` ### Event: `'error'` This event is the same as the one provided by [`child\_process.fork()`][]. Within a worker, `process.on('error')` may also be used. ### Event: `'exit'` \* `code` {number} The exit code, if it exited normally. \* `signal` {string} The name of the signal (e.g. `'SIGHUP'`) that caused the process to be killed. Similar to the `cluster.on('exit')` event, but specific to this worker. ```mjs import cluster from 'node:cluster'; if (cluster.isPrimary) { const worker = cluster.fork(); worker.on('exit', (code, signal) => { if (signal) { console.log(`worker was killed by signal: ${signal}`); } else if (code !== 0) { console.log(`worker exited with error code: ${code}`); } else { console.log('worker success!'); } }); } ``` ```cjs const cluster = require('node:cluster'); if (cluster.isPrimary) { const worker = cluster.fork(); worker.on('exit', (code, signal) => { if (signal) { console.log(`worker was killed by signal: ${signal}`); } else if (code !== 0) { console.log(`worker exited with error code: ${code}`); } else { console.log('worker success!'); } }); } ``` ### Event: `'listening'` \* `address` {Object} Similar to the `cluster.on('listening')` event, but specific to this worker. ```mjs cluster.fork().on('listening', (address) => { // Worker is listening }); ``` ```cjs cluster.fork().on('listening', (address) => { // Worker is listening }); ``` It is not emitted in the worker. ### Event: `'message'` \* `message` {Object} \* `handle` {undefined|Object} Similar to the `'message'` event of `cluster`, but specific to this worker. Within a worker, `process.on('message')` may also be used. See [`process` event: `'message'`][]. Here is an example using the message system. It keeps a count in the primary process of the number of HTTP requests received by the workers: ```mjs import cluster from 'node:cluster'; import http from 'node:http'; import { availableParallelism } from 'node:os'; import process from 'node:process'; if (cluster.isPrimary) { // Keep track of http requests let numReqs = 0; setInterval(() => { console.log(`numReqs = ${numReqs}`); }, 1000); // Count requests function messageHandler(msg) { if (msg.cmd && msg.cmd === 'notifyRequest') { numReqs += 1; } } // Start workers and listen for messages containing notifyRequest const numCPUs = availableParallelism(); for (let i = 0; i < numCPUs; i++) { cluster.fork(); } for (const id in cluster.workers) { cluster.workers[id].on('message', messageHandler); } } else { // Worker processes have a http server. http.Server((req, res)
https://github.com/nodejs/node/blob/main//doc/api/cluster.md
main
nodejs
[ -0.05252166837453842, -0.025290582329034805, -0.00156079709995538, 0.055179402232170105, 0.021462079137563705, -0.03275054693222046, 0.012060151435434818, -0.08693061769008636, 0.0439339354634285, -0.015791624784469604, -0.04816141352057457, 0.1291104257106781, -0.006450131069868803, -0.032946787774562836, -0.0027807962615042925, -0.003230677917599678, 0.027318205684423447, -0.053519099950790405, 0.015810269862413406, -0.04928676784038544, -0.05584869161248207, -0.06590981781482697, -0.02311583422124386, -0.03603792563080788, -0.11016539484262466, -0.023127706721425056, 0.04892502352595329, 0.0003769298200495541, 0.028179354965686798, 0.003983980976045132, -0.06398528814315796, 0.007517820689827204, 0.0076425326988101006, 0.03098353184759617, -0.06136877462267876, 0.05203736573457718, 0.011557955294847488, -0.04270194470882416, -0.1409633308649063, 0.03815010190010071, 0.0359036885201931, -0.019153274595737457, -0.05060715973377228, -0.03464701026678085, -0.01820056326687336, -0.016598906368017197, -0.10515124350786209, -0.03425873443484306, -0.05376612767577171, 0.0021690523717552423, 0.022150203585624695, -0.032715216279029846, 0.0398760661482811, 0.07902318239212036, 0.0013834345154464245, -0.022378450259566307, 0.01073414832353592, -0.07132692635059357, 0.003285838756710291, 0.07159797847270966, 0.039185531437397, -0.0875549167394638, 0.0239268746227026, -0.023662108927965164, 0.13544286787509918, -0.044004641473293304, 0.026409564539790154, -0.003212946467101574, 0.05727696046233177, -0.0005648378864862025, 0.002516267355531454, -0.013272585347294807, -0.015123581513762474, -0.019571460783481598, -0.009796896949410439, -0.05062364414334297, -0.036735743284225464, -0.07973658293485641, 0.0055522131733596325, 0.07221280038356781, -0.07530905306339264, -0.04784686490893364, 0.00991939939558506, 0.018311195075511932, -0.10228397697210312, 0.04500038921833038, -0.03422419726848602, -0.009763390757143497, 0.05183567479252815, -0.01890845037996769, -0.136415034532547, 0.08751492947340012, -0.04850159212946892, 0.011872838251292706, 0.006941935513168573, 0.050409406423568726, 0.027783837169408798, 0.04958895593881607, -0.0063247159123420715, -0.02519834041595459, 0.04600432515144348, -0.03392469510436058, 0.037560153752565384, -0.028783829882740974, -0.03673404082655907, -0.025173136964440346, -0.07781103253364563, -0.06130589172244072, 0.027365604415535927, 0.03964712470769882, 0.03373841941356659, 0.06953093409538269, -0.004286390729248524, 0.07667308300733566, -0.09077037125825882, 0.048693571239709854, 0.08299577236175537, -0.039465636014938354, -0.04392019659280777, 0.144431471824646, 0.0444268137216568, 0.054861024022102356, -0.0029824620578438044, -0.013260353356599808, -0.037923526018857956, 0.017581794410943985, 0.022506142035126686, 2.3401517457559474e-33, -0.001111517078243196, -0.07918691635131836, 0.016559967771172523, 0.008055208250880241, 0.10594534873962402, -0.058600977063179016, 0.01345731783658266, -0.008226062171161175, 0.0701061561703682, -0.011536050587892532, -0.10125374794006348, 0.03771979361772537, 0.08132200688123703, 0.007227975409477949, -0.010709178633987904, -0.023498302325606346, 0.05600174888968468, 0.011984055861830711, 0.047148462384939194, -0.02347479946911335, 0.002744910540059209, -0.01886226423084736, -0.07968059182167053, 0.01993199624121189, 0.02807324379682541, -0.011938472278416157, 0.0018535079434514046, 0.0032899980433285236, -0.037549734115600586, 0.01047589536756277, 0.0032554222270846367, 0.07398324459791183, -0.054111115634441376, 0.03683078661561012, -0.046478912234306335, 0.08165086805820465, -0.0027877595275640488, 0.02290329523384571, -0.06226864829659462, -0.046945154666900635, -0.052019353955984116, 0.046097639948129654, 0.014698673039674759, -0.035608962178230286, 0.013508456759154797, -0.06778203696012497, 0.047916214913129807, -0.048860497772693634, 0.04326750710606575, -0.017932476475834846, 0.023671520873904228, -0.027172444388270378, 0.023915082216262817, 0.06746260076761246, -0.007203119806945324, 0.08659442514181137, 0.017133422195911407, -0.0006172097637318075, -0.06690862774848938, 0.05926094949245453, 0.030859632417559624, -0.07518012076616287, -0.05440150201320648, 0.06820408999919891, 0.03691471740603447, 0.08805349469184875, 0.07789597660303116, -0.017069442197680473, 0.04124758020043373, 0.027880458161234856, -0.00038025647518225014, 0.04113475978374481, -0.010521916672587395, 0.0015768130542710423, -0.08027292788028717, 0.07574685662984848, 0.002197957132011652, 0.00951790064573288, -0.061060864478349686, 0.05910950154066086, 0.03456811234354973, -0.00027968717040494084, -0.02373804710805416, 0.03367714583873749, 0.02807903289794922, 0.03023618459701538, 0.03356871381402016, -0.031171394512057304, 0.001059816568158567, -0.021273791790008545, 0.08214066922664642, 0.006623845547437668, 0.11163677275180817, -0.00998664926737547, -0.058114562183618546, -4.757471022223532e-33, -0.09531351178884506, 0.02126500941812992, -0.0829530656337738, 0.029591239988803864, 0.028673360124230385, -0.023189254105091095, -0.0368819460272789, 0.00927011389285326, -0.000034209329896839336, 0.028601767495274544, -0.020114265382289886, 0.01234341785311699, 0.05977539345622063, 0.047830983996391296, -0.07560814172029495, -0.016996972262859344, 0.0031846538186073303, -0.015193606726825237, -0.01864871010184288, 0.03191594406962395, -0.015109545551240444, -0.028666509315371513, 0.04532506316900253, -0.06229245662689209, 0.0019006360089406371, 0.004881727043539286, -0.031297437846660614, -0.1285252571105957, -0.05441880226135254, -0.05177433416247368, 0.0035547716543078423, -0.043699271976947784, 0.026151563972234726, 0.08183037489652634, 0.06848437339067459, -0.05877828225493431, -0.055907219648361206, 0.08099278062582016, 0.12560151517391205, -0.05938427150249481, 0.038699209690093994, 0.005087080877274275, 0.001010665437206626, -0.014840041287243366, -0.016105933114886284, 0.008617093786597252, -0.022059796378016472, -0.0016951613361015916, -0.09160884469747543, -0.006747865583747625, -0.05311017483472824, 0.015288365073502064, 0.001529200468212366, 0.047835562378168106, -0.030914682894945145, -0.021417101845145226, -0.02991822548210621, 0.028906293213367462, 0.027485456317663193, 0.08614911884069443, 0.10697833448648453, -0.05988307669758797, -0.050046052783727646, 0.09825263917446136, -0.05115726962685585, -0.046661168336868286, -0.04733984172344208, -0.02043759450316429, 0.03302903100848198, 0.012167856097221375, 0.032304733991622925, 0.1116814836859703, -0.07140635699033737, 0.04632539674639702, -0.09632410854101181, -0.036287274211645126, -0.006598416715860367, -0.09413750469684601, -0.056766413152217865, 0.02591262012720108, -0.09493384510278702, 0.09700902551412582, -0.06566459685564041, -0.00869709998369217, 0.061872661113739014, 0.011255324818193913, 0.07390670478343964, -0.0186857171356678, 0.07471992075443268, -0.01368724461644888, -0.03237670287489891, -0.0030129351653158665, -0.109443299472332, -0.011757371947169304, -0.14558865129947662, -4.592799740521514e-8, 0.03724571317434311, 0.021335965022444725, -0.05693301558494568, -0.0161267202347517, -0.009891725145280361, -0.049238238483667374, 0.026342852041125298, 0.003625174518674612, 0.016575273126363754, 0.1469651460647583, 0.040912698954343796, 0.005172996781766415, -0.000833691970910877, -0.04530857130885124, 0.08880535513162613, 0.12991148233413696, 0.05234904587268829, -0.01005620788782835, -0.03266084939241409, -0.007479849271476269, 0.010850228369235992, -0.002884967951104045, -0.055098868906497955, 0.12045081704854965, -0.06662135571241379, -0.0006379798287525773, 0.057553768157958984, 0.05330862104892731, -0.03992852196097374, -0.023140018805861473, -0.115379698574543, 0.05124327540397644, -0.001834668219089508, 0.06666390597820282, -0.05902082100510597, 0.03473588079214096, -0.0929645225405693, -0.04260418564081192, 0.04145156592130661, 0.0726689025759697, -0.015152085572481155, 0.012601573951542377, -0.018205562606453896, 0.01783943735063076, 0.0011921771802008152, -0.007849200628697872, 0.021627068519592285, 0.012785532511770725, -0.029963674023747444, 0.01928360015153885, 0.015799585729837418, -0.016067584976553917, 0.010518116876482964, -0.01395358331501484, 0.062408123165369034, 0.037117090076208115, -0.021445894613862038, -0.06351343542337418, 0.025385506451129913, -0.028406288474798203, 0.007390359882265329, 0.0788445770740509, -0.007222300861030817, -0.05339086800813675 ]
0.172861
+= 1; } } // Start workers and listen for messages containing notifyRequest const numCPUs = availableParallelism(); for (let i = 0; i < numCPUs; i++) { cluster.fork(); } for (const id in cluster.workers) { cluster.workers[id].on('message', messageHandler); } } else { // Worker processes have a http server. http.Server((req, res) => { res.writeHead(200); res.end('hello world\n'); // Notify primary about the request process.send({ cmd: 'notifyRequest' }); }).listen(8000); } ``` ```cjs const cluster = require('node:cluster'); const http = require('node:http'); const numCPUs = require('node:os').availableParallelism(); const process = require('node:process'); if (cluster.isPrimary) { // Keep track of http requests let numReqs = 0; setInterval(() => { console.log(`numReqs = ${numReqs}`); }, 1000); // Count requests function messageHandler(msg) { if (msg.cmd && msg.cmd === 'notifyRequest') { numReqs += 1; } } // Start workers and listen for messages containing notifyRequest for (let i = 0; i < numCPUs; i++) { cluster.fork(); } for (const id in cluster.workers) { cluster.workers[id].on('message', messageHandler); } } else { // Worker processes have a http server. http.Server((req, res) => { res.writeHead(200); res.end('hello world\n'); // Notify primary about the request process.send({ cmd: 'notifyRequest' }); }).listen(8000); } ``` ### Event: `'online'` Similar to the `cluster.on('online')` event, but specific to this worker. ```js cluster.fork().on('online', () => { // Worker is online }); ``` It is not emitted in the worker. ### `worker.disconnect()` \* Returns: {cluster.Worker} A reference to `worker`. In a worker, this function will close all servers, wait for the `'close'` event on those servers, and then disconnect the IPC channel. In the primary, an internal message is sent to the worker causing it to call `.disconnect()` on itself. Causes `.exitedAfterDisconnect` to be set. After a server is closed, it will no longer accept new connections, but connections may be accepted by any other listening worker. Existing connections will be allowed to close as usual. When no more connections exist, see [`server.close()`][], the IPC channel to the worker will close allowing it to die gracefully. The above applies \_only\_ to server connections, client connections are not automatically closed by workers, and disconnect does not wait for them to close before exiting. In a worker, `process.disconnect` exists, but it is not this function; it is [`disconnect()`][]. Because long living server connections may block workers from disconnecting, it may be useful to send a message, so application specific actions may be taken to close them. It also may be useful to implement a timeout, killing a worker if the `'disconnect'` event has not been emitted after some time. ```js if (cluster.isPrimary) { const worker = cluster.fork(); let timeout; worker.on('listening', (address) => { worker.send('shutdown'); worker.disconnect(); timeout = setTimeout(() => { worker.kill(); }, 2000); }); worker.on('disconnect', () => { clearTimeout(timeout); }); } else if (cluster.isWorker) { const net = require('node:net'); const server = net.createServer((socket) => { // Connections never end }); server.listen(8000); process.on('message', (msg) => { if (msg === 'shutdown') { // Initiate graceful close of any connections to server } }); } ``` ### `worker.exitedAfterDisconnect` \* Type: {boolean} This property is `true` if the worker exited due to `.disconnect()`. If the worker exited any other way, it is `false`. If the worker has not exited, it is `undefined`. The boolean [`worker.exitedAfterDisconnect`][] allows distinguishing between voluntary and accidental exit, the primary may choose not to respawn a worker based on this value. ```js cluster.on('exit', (worker, code, signal) => { if (worker.exitedAfterDisconnect === true) { console.log('Oh, it was just voluntary – no need to worry'); } }); // kill worker worker.kill(); ``` ### `worker.id` \* Type: {integer} Each new worker is given its own unique id, this id is stored in the `id`. While a worker is alive, this
https://github.com/nodejs/node/blob/main//doc/api/cluster.md
main
nodejs
[ -0.04230432212352753, 0.03609256446361542, -0.0023199112620204687, 0.03522886708378792, 0.02281721495091915, -0.09786573052406311, 0.017331786453723907, -0.01222976017743349, 0.05089793726801872, 0.01661420799791813, -0.04992934316396713, -0.054396405816078186, -0.02336006611585617, -0.01827257126569748, -0.01945539563894272, -0.020123912021517754, 0.051658183336257935, -0.05283520370721817, 0.00309941777959466, -0.11221406608819962, -0.03030088171362877, 0.03233398124575615, 0.052786700427532196, 0.04060432314872742, -0.06472960859537125, -0.002239507157355547, 0.002744117518886924, -0.030766358599066734, 0.029261041432619095, 0.03304554522037506, 0.045940376818180084, -0.03600979223847389, -0.04262394458055496, 0.0028159799985587597, -0.0005977025139145553, 0.13686183094978333, 0.0033959161955863237, -0.07638765126466751, -0.06910264492034912, -0.04548752307891846, 0.07189144939184189, 0.03890356421470642, -0.0587029866874218, -0.045917779207229614, 0.02240363508462906, -0.024337932467460632, -0.1086924746632576, 0.07717379182577133, -0.01672455109655857, 0.002776650944724679, 0.01256689615547657, -0.07687940448522568, -0.017083413898944855, 0.08179914951324463, 0.017059817910194397, -0.013949651271104813, -0.05015864595770836, -0.036570847034454346, 0.04325719550251961, -0.0000656867996440269, 0.01401718333363533, -0.12725579738616943, 0.07287835329771042, -0.04748423025012016, 0.021988743916153908, -0.02197548933327198, -0.021009355783462524, 0.07735695689916611, -0.01453431136906147, 0.011853644624352455, 0.033622995018959045, 0.07531267404556274, -0.037632886320352554, -0.03595985844731331, -0.04163166135549545, -0.04491754621267319, 0.0013587750727310777, -0.049336571246385574, -0.07029221951961517, 0.07607060670852661, -0.08897056430578232, -0.028770994395017624, 0.008327433839440346, 0.02479425258934498, -0.019335899502038956, 0.0398850180208683, -0.004052886739373207, 0.016751494258642197, 0.03635924309492111, -0.08628422766923904, -0.09995775669813156, 0.050039857625961304, -0.10985405743122101, 0.0396776907145977, -0.03140083700418472, 0.07496003806591034, -0.0414046049118042, 0.03610490262508392, -0.011856704019010067, 0.04302770271897316, 0.052999094128608704, -0.04689258337020874, 0.043059296905994415, -0.026746481657028198, 0.012543979100883007, -0.016170559450984, -0.07705003768205643, 0.05022082105278969, -0.0010482764337211847, 0.036023203283548355, -0.04738829284906387, 0.03222265467047691, 0.02091876231133938, 0.05900123715400696, -0.05580240115523338, 0.020613687112927437, 0.12300139665603638, -0.013017477467656136, -0.011695673689246178, 0.05840544030070305, 0.10714464634656906, -0.0781586766242981, -0.04106837883591652, 0.00523024145513773, 0.07507839798927307, -0.0016336629632860422, 0.03260426968336105, 4.543155259523597e-33, 0.05404612794518471, -0.02293822355568409, 0.003972318023443222, 0.008708665147423744, 0.06423627585172653, -0.032947055995464325, 0.034440699964761734, -0.026797467842698097, -0.045468591153621674, -0.08181612938642502, -0.03818707913160324, 0.022826427593827248, 0.06583110243082047, -0.08429909497499466, -0.02052946761250496, -0.09509698301553726, 0.08912249654531479, 0.06872893869876862, 0.10388148576021194, 0.022079257294535637, -0.004491108004003763, -0.02033691667020321, -0.04665794223546982, 0.05402813106775284, -0.0011068650055676699, -0.011934269219636917, -0.0077070253901183605, -0.03093036077916622, -0.014702708460390568, -0.019682751968503, 0.10374818742275238, 0.08167504519224167, -0.03419268876314163, 0.010637971572577953, -0.024759303778409958, -0.018397675827145576, 0.03210257366299629, 0.03280314803123474, -0.08309909701347351, -0.08547654002904892, 0.024876464158296585, 0.055347345769405365, -0.02417078986763954, -0.0421806201338768, -0.045892562717199326, -0.049085140228271484, -0.04350348562002182, -0.059207484126091, 0.10269661247730255, -0.0320577472448349, 0.03935414180159569, -0.009434590116143227, 0.07426345348358154, -0.006184732541441917, 0.056472670286893845, 0.033764585852622986, 0.006372244097292423, -0.011816437356173992, -0.030483273789286613, 0.024348938837647438, 0.007609022781252861, -0.07315570116043091, -0.01090600062161684, -0.0068469881080091, 0.07525434345006943, 0.017323436215519905, -0.012108136899769306, 0.07540953159332275, 0.05766618251800537, 0.019441833719611168, -0.022311631590127945, 0.028629569336771965, 0.060563135892152786, 0.08035774528980255, -0.0393066480755806, 0.01585615612566471, -0.026544466614723206, 0.018382860347628593, -0.04825451225042343, -0.01183551549911499, 0.06646844744682312, -0.013106799684464931, -0.06142505258321762, 0.06760989129543304, 0.07234644144773483, 0.023413177579641342, -0.0375404991209507, 0.030024977400898933, -0.0011781963985413313, 0.08545540273189545, -0.04516443610191345, 0.043360039591789246, 0.064412422478199, -0.035705920308828354, -0.12677450478076935, -4.942015553778969e-33, -0.0341772586107254, 0.013380223885178566, -0.080753393471241, 0.03275842219591141, 0.027289653196930885, 0.014400041662156582, -0.0016135408077389002, 0.004949625115841627, -0.045166682451963425, 0.05047065019607544, 0.00042210271931253374, -0.0170805212110281, 0.012781522236764431, 0.07595164328813553, -0.10613339394330978, 0.01870083063840866, 0.060580041259527206, -0.027439069002866745, 0.004738320130854845, -0.042945604771375656, -0.08838370442390442, -0.006508271209895611, 0.00650135288015008, -0.03905211761593819, -0.07686715573072433, 0.04752551391720772, -0.06055132672190666, -0.0043538701720535755, -0.07140566408634186, -0.08428912609815598, -0.08876240253448486, 0.0014620170695707202, -0.022224247455596924, 0.06484213471412659, 0.1013464704155922, -0.0780976265668869, -0.009607394225895405, 0.1206866204738617, 0.03728732094168663, -0.009512532502412796, 0.10661955922842026, 0.009324613958597183, -0.022125890478491783, 0.003779721213504672, -0.04047185182571411, -0.04058680310845375, 0.061992671340703964, -0.0018784067360684276, -0.12931743264198303, 0.022941652685403824, -0.03854774683713913, -0.037168003618717194, 0.06432906538248062, 0.0816550999879837, -0.046622395515441895, 0.02364683523774147, 0.04448649287223816, -0.036723412573337555, 0.015527818351984024, 0.0063583808951079845, 0.03579728677868843, -0.16309195756912231, -0.023243950679898262, 0.03775591030716896, 0.035939283668994904, -0.055825963616371155, -0.04754992574453354, -0.01854826509952545, 0.061277907341718674, 0.05416199564933777, -0.06426792591810226, 0.07802188396453857, -0.036879707127809525, -0.004682779312133789, 0.024152016267180443, -0.02941901609301567, -0.03542415052652359, -0.14858803153038025, -0.036742474883794785, 0.064432293176651, -0.07767219841480255, 0.06021856516599655, -0.03783264011144638, -0.020197907462716103, 0.07618536800146103, 0.06289736181497574, 0.05395312234759331, 0.01132743339985609, 0.005838693585246801, -0.0032941598910838366, -0.03822874650359154, 0.023301169276237488, -0.018971696496009827, -0.02571910247206688, -0.051452238112688065, -5.082677745349429e-8, -0.014974728226661682, -0.015933824703097343, -0.04894651845097542, 0.00395663408562541, 0.0506720207631588, 0.023223673924803734, 0.01101168803870678, -0.07629019021987915, -0.014255579560995102, 0.045659538358449936, -0.04080112650990486, -0.02861574850976467, 0.037871140986680984, -0.005933435168117285, 0.06084500998258591, -0.03452667221426964, 0.024006536230444908, -0.03335186094045639, -0.022769326344132423, -0.05237117409706116, 0.03729761391878128, 0.031168678775429726, -0.02943338081240654, 0.05127721279859543, -0.016268983483314514, -0.004174686968326569, 0.12019601464271545, 0.017475459724664688, -0.08108548074960709, -0.07071969658136368, -0.13390660285949707, 0.003364486852660775, 0.010522584430873394, 0.0022551976144313812, -0.033944547176361084, 0.02569110132753849, -0.056129734963178635, -0.017509179189801216, 0.033393535763025284, 0.038715049624443054, 0.08049587905406952, 0.10118231177330017, -0.053674422204494476, 0.030745157971978188, 0.06237195432186127, 0.03216848894953728, 0.022638581693172455, -0.01604083552956581, 0.02613898180425167, 0.014092391356825829, -0.002303278772160411, -0.04234826937317848, 0.012751828879117966, -0.027724353596568108, -0.00602008868008852, -0.00432934146374464, 0.005936529021710157, -0.06547213345766068, -0.011098193004727364, 0.036738041788339615, 0.10441854596138, 0.013286387547850609, -0.04969196021556854, -0.0069029186852276325 ]
0.205255
{ if (worker.exitedAfterDisconnect === true) { console.log('Oh, it was just voluntary – no need to worry'); } }); // kill worker worker.kill(); ``` ### `worker.id` \* Type: {integer} Each new worker is given its own unique id, this id is stored in the `id`. While a worker is alive, this is the key that indexes it in `cluster.workers`. ### `worker.isConnected()` This function returns `true` if the worker is connected to its primary via its IPC channel, `false` otherwise. A worker is connected to its primary after it has been created. It is disconnected after the `'disconnect'` event is emitted. ### `worker.isDead()` This function returns `true` if the worker's process has terminated (either because of exiting or being signaled). Otherwise, it returns `false`. ```mjs import cluster from 'node:cluster'; import http from 'node:http'; import { availableParallelism } from 'node:os'; import process from 'node:process'; const numCPUs = availableParallelism(); if (cluster.isPrimary) { console.log(`Primary ${process.pid} is running`); // Fork workers. for (let i = 0; i < numCPUs; i++) { cluster.fork(); } cluster.on('fork', (worker) => { console.log('worker is dead:', worker.isDead()); }); cluster.on('exit', (worker, code, signal) => { console.log('worker is dead:', worker.isDead()); }); } else { // Workers can share any TCP connection. In this case, it is an HTTP server. http.createServer((req, res) => { res.writeHead(200); res.end(`Current process\n ${process.pid}`); process.kill(process.pid); }).listen(8000); } ``` ```cjs const cluster = require('node:cluster'); const http = require('node:http'); const numCPUs = require('node:os').availableParallelism(); const process = require('node:process'); if (cluster.isPrimary) { console.log(`Primary ${process.pid} is running`); // Fork workers. for (let i = 0; i < numCPUs; i++) { cluster.fork(); } cluster.on('fork', (worker) => { console.log('worker is dead:', worker.isDead()); }); cluster.on('exit', (worker, code, signal) => { console.log('worker is dead:', worker.isDead()); }); } else { // Workers can share any TCP connection. In this case, it is an HTTP server. http.createServer((req, res) => { res.writeHead(200); res.end(`Current process\n ${process.pid}`); process.kill(process.pid); }).listen(8000); } ``` ### `worker.kill([signal])` \* `signal` {string} Name of the kill signal to send to the worker process. \*\*Default:\*\* `'SIGTERM'` This function will kill the worker. In the primary worker, it does this by disconnecting the `worker.process`, and once disconnected, killing with `signal`. In the worker, it does it by killing the process with `signal`. The `kill()` function kills the worker process without waiting for a graceful disconnect, it has the same behavior as `worker.process.kill()`. This method is aliased as `worker.destroy()` for backwards compatibility. In a worker, `process.kill()` exists, but it is not this function; it is [`kill()`][]. ### `worker.process` \* Type: {ChildProcess} All workers are created using [`child\_process.fork()`][], the returned object from this function is stored as `.process`. In a worker, the global `process` is stored. See: [Child Process module][]. Workers will call `process.exit(0)` if the `'disconnect'` event occurs on `process` and `.exitedAfterDisconnect` is not `true`. This protects against accidental disconnection. ### `worker.send(message[, sendHandle[, options]][, callback])` \* `message` {Object} \* `sendHandle` {Handle} \* `options` {Object} The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties: \* `keepOpen` {boolean} A value that can be used when passing instances of `net.Socket`. When `true`, the socket is kept open in the sending process. \*\*Default:\*\* `false`. \* `callback` {Function} \* Returns: {boolean} Send a message to a worker or primary, optionally with a handle. In the primary, this sends a message to a specific worker. It is identical to [`ChildProcess.send()`][]. In a worker, this sends a message to the primary. It is identical to `process.send()`. This example will echo back all messages from the primary: ```js if (cluster.isPrimary) { const worker = cluster.fork(); worker.send('hi there'); } else if (cluster.isWorker) { process.on('message', (msg) => { process.send(msg); });
https://github.com/nodejs/node/blob/main//doc/api/cluster.md
main
nodejs
[ -0.028742901980876923, 0.021141136065125465, -0.030262937769293785, 0.08546865731477737, 0.08534472435712814, -0.0663347840309143, 0.02249833382666111, -0.04452240467071533, 0.0313015915453434, 0.022994576022028923, -0.02548358589410782, 0.053337372839450836, -0.010619494132697582, -0.010194316506385803, -0.04989713430404663, -0.042987942695617676, 0.031304243952035904, -0.024691404774785042, 0.016971906647086143, -0.12446151673793793, -0.023893972858786583, -0.002470829524099827, 0.02772715874016285, 0.004478670656681061, -0.02461889386177063, -0.016768978908658028, 0.041476670652627945, -0.004375580232590437, 0.051496151834726334, 0.020250460132956505, -0.054683867841959, -0.00769059406593442, -0.06870459020137787, 0.017572345212101936, 0.044772543013095856, 0.12386046350002289, 0.02816450223326683, -0.03647640347480774, -0.0711248517036438, -0.012326328083872795, 0.0872567743062973, -0.008754503913223743, -0.07210990786552429, -0.08166555315256119, -0.008591707795858383, 0.035029612481594086, -0.14738714694976807, 0.03943893313407898, -0.05507601797580719, -0.01391847338527441, -0.014827734790742397, 0.010762202553451061, -0.010879959911108017, 0.12706050276756287, 0.06537007540464401, 0.018592864274978638, 0.06316675990819931, -0.09260838478803635, -0.010897503234446049, 0.010223297402262688, 0.06576327234506607, -0.025344232097268105, 0.0023031297605484724, -0.030834419652819633, 0.08353956043720245, -0.010686039924621582, 0.035962387919425964, -0.010987426154315472, 0.025567801669239998, -0.02526203542947769, 0.024080689996480942, -0.021091477945446968, -0.0468321330845356, -0.01565389521420002, -0.0014531590277329087, -0.018544983118772507, 0.036351755261421204, -0.05190971493721008, -0.0067479731515049934, 0.038294706493616104, -0.06533969938755035, -0.04826868698000908, 0.04360395297408104, 0.05634345859289169, -0.00974484346807003, 0.012058760039508343, -0.010013528168201447, -0.003510915907099843, 0.08193255215883255, -0.006804169155657291, -0.10422269999980927, 0.12099114060401917, -0.029640143737196922, -0.0023691451642662287, 0.03784426301717758, 0.036521364003419876, 0.0008645848138257861, 0.06967846304178238, -0.034276168793439865, 0.03579176217317581, -0.01049107126891613, -0.06805790215730667, 0.02408348210155964, -0.04364519566297531, 0.003138009225949645, 0.010391282849013805, -0.06962867081165314, -0.011412166059017181, 0.06499997526407242, 0.011118282563984394, 0.012144772335886955, 0.012131644412875175, -0.019735459238290787, 0.06325633823871613, -0.022356346249580383, 0.08088602870702744, 0.10398701578378677, 0.0653393343091011, -0.0010080814827233553, 0.07403527945280075, 0.08121218532323837, -0.03271779790520668, 0.007846064865589142, -0.02004043199121952, -0.015737861394882202, -0.035510096698999405, 0.04356560483574867, 1.4735660834403518e-34, 0.03644370287656784, -0.11612492799758911, 0.026790296658873558, 0.010912677273154259, 0.0899820327758789, -0.011560892686247826, -0.008991091512143612, 0.0007715809624642134, 0.007367215119302273, -0.01563655398786068, -0.09809531271457672, 0.024964261800050735, 0.05938888341188431, -0.026152625679969788, -0.027618955820798874, -0.049733761698007584, 0.09312714636325836, 0.010715793818235397, 0.020317470654845238, 0.010488303378224373, 0.05685374513268471, 0.00039750346331857145, -0.031358301639556885, 0.0026786907110363245, -0.015630673617124557, 0.0021108973305672407, -0.053897395730018616, -0.05555601045489311, -0.016905199736356735, 0.030749831348657608, -0.055584829300642014, 0.04526757076382637, -0.01649601384997368, 0.005403195973485708, -0.07131008803844452, 0.013729369267821312, -0.025471899658441544, -0.030191410332918167, -0.09639596939086914, -0.12259064614772797, -0.05037539452314377, 0.017788300290703773, 0.017592107877135277, -0.06386945396661758, -0.007647044025361538, -0.08082236349582672, -0.006508624646812677, -0.03149259090423584, 0.05691182613372803, 0.024113735184073448, 0.029111862182617188, -0.03655043989419937, 0.1225234791636467, -0.042866162955760956, -0.006236822810024023, 0.05488137528300285, 0.05511430278420448, 0.07503683120012283, 0.014516200870275497, 0.013592232018709183, 0.03426705300807953, -0.04906813055276871, -0.04879693314433098, 0.0723198875784874, 0.0471966527402401, 0.03234422951936722, -0.03403589129447937, 0.040885742753744125, 0.05039572715759277, 0.039956074208021164, -0.0579441599547863, 0.10005194693803787, 0.004558982327580452, -0.004348653368651867, -0.06727145612239838, -0.006972602102905512, -0.07542116194963455, -0.004647477064281702, -0.1084681823849678, 0.0036007435992360115, 0.09855683892965317, 0.00036987365456297994, -0.051601774990558624, -0.013662446290254593, 0.018463842570781708, 0.02969273366034031, -0.017107252031564713, 0.028611402958631516, -0.02695978619158268, 0.03417864814400673, 0.008938196115195751, 0.030950186774134636, 0.04976640269160271, 0.026980075985193253, -0.052327170968055725, -2.8139194991625082e-33, -0.06066875532269478, 0.023833895102143288, -0.033158715814352036, 0.01857632026076317, -0.005286057945340872, -0.04461738467216492, 0.03568918630480766, 0.0024695019237697124, -0.07125081866979599, 0.03408709168434143, 0.053604502230882645, -0.03968712314963341, -0.014324534684419632, 0.0431273877620697, -0.004305470269173384, 0.023578813299536705, -0.017104657366871834, -0.03895791620016098, -0.00904332846403122, 0.0389447957277298, -0.07076265662908554, -0.022346053272485733, 0.02252284437417984, -0.0490068681538105, -0.017313580960035324, 0.006313547492027283, -0.01925681345164776, -0.05076643079519272, -0.0933678150177002, -0.07301925122737885, -0.03053337149322033, 0.0250423364341259, -0.03360414132475853, 0.09219764918088913, 0.03324461728334427, -0.033400122076272964, -0.06636308133602142, 0.02864636853337288, 0.022882429882884026, -0.0605367049574852, 0.11541169136762619, 0.04685903713107109, -0.027858059853315353, 0.04276098683476448, 0.019847331568598747, -0.05967402458190918, 0.007664704229682684, 0.03897048160433769, -0.12178563326597214, 0.0012371849734336138, -0.02745496667921543, -0.05989278107881546, 0.0563480481505394, 0.09715090692043304, -0.042858634144067764, 0.02403593622148037, -0.010986942797899246, -0.0007792006945237517, -0.020821886137127876, -0.03906993567943573, 0.09311376512050629, -0.14182087779045105, -0.016205908730626106, 0.16350355744361877, 0.0009661804651841521, -0.09939515590667725, -0.03098064661026001, 0.02366654761135578, 0.010819592513144016, 0.00685461238026619, 0.03000355325639248, 0.13636311888694763, -0.037020716816186905, -0.001925817341543734, -0.06189335137605667, -0.007718012202531099, -0.04757136106491089, -0.07106262445449829, -0.06702865660190582, 0.060068465769290924, -0.03611653670668602, 0.04511164501309395, -0.06622346490621567, -0.015787441283464432, 0.051826875656843185, 0.018278345465660095, 0.08393818140029907, 0.11537859588861465, 0.006064092740416527, -0.010224361903965473, -0.08323036134243011, 0.007097968831658363, -0.08265602588653564, -0.022278327494859695, -0.069890096783638, -4.9273239710601047e-8, -0.02013353258371353, 0.004581185523420572, -0.0914294421672821, -0.06470566987991333, 0.04721786081790924, -0.059164367616176605, 0.0030959362629801035, -0.008584985509514809, 0.007394090760499239, 0.10927445441484451, 0.02891187183558941, -0.02318151667714119, -0.010967771522700787, 0.042427923530340195, 0.04699644818902016, 0.029865223914384842, 0.013217426836490631, -0.012764545157551765, -0.012555721215903759, -0.0333159938454628, 0.00036060091224499047, -0.0683073103427887, -0.04443034902215004, 0.11715718358755112, -0.04658816382288933, 0.011339884251356125, 0.04545518010854721, 0.053962912410497665, -0.07081884145736694, -0.028731610625982285, -0.10805916786193848, -0.003247251035645604, 0.015909092500805855, 0.051575176417827606, -0.09076420962810516, 0.13139407336711884, -0.030435902997851372, 0.015620043501257896, 0.024001996964216232, 0.02094477228820324, 0.03897811472415924, 0.04940781742334366, -0.08617913722991943, 0.014488467015326023, 0.06458427757024765, -0.013362451456487179, 0.0009192266734316945, 0.039965879172086716, -0.027378691360354424, 0.02118550054728985, -0.02776980958878994, -0.08914554119110107, -0.01701870560646057, -0.030150501057505608, 0.006930699571967125, -0.047688454389572144, -0.01832464709877968, -0.03788622468709946, -0.014078590087592602, 0.006579751614481211, 0.0951298177242279, 0.040482018142938614, -0.0027910403441637754, -0.08162705600261688 ]
0.205577
is identical to [`ChildProcess.send()`][]. In a worker, this sends a message to the primary. It is identical to `process.send()`. This example will echo back all messages from the primary: ```js if (cluster.isPrimary) { const worker = cluster.fork(); worker.send('hi there'); } else if (cluster.isWorker) { process.on('message', (msg) => { process.send(msg); }); } ``` ## Event: `'disconnect'` \* `worker` {cluster.Worker} Emitted after the worker IPC channel has disconnected. This can occur when a worker exits gracefully, is killed, or is disconnected manually (such as with `worker.disconnect()`). There may be a delay between the `'disconnect'` and `'exit'` events. These events can be used to detect if the process is stuck in a cleanup or if there are long-living connections. ```js cluster.on('disconnect', (worker) => { console.log(`The worker #${worker.id} has disconnected`); }); ``` ## Event: `'exit'` \* `worker` {cluster.Worker} \* `code` {number} The exit code, if it exited normally. \* `signal` {string} The name of the signal (e.g. `'SIGHUP'`) that caused the process to be killed. When any of the workers die the cluster module will emit the `'exit'` event. This can be used to restart the worker by calling [`.fork()`][] again. ```js cluster.on('exit', (worker, code, signal) => { console.log('worker %d died (%s). restarting...', worker.process.pid, signal || code); cluster.fork(); }); ``` See [`child\_process` event: `'exit'`][]. ## Event: `'fork'` \* `worker` {cluster.Worker} When a new worker is forked the cluster module will emit a `'fork'` event. This can be used to log worker activity, and create a custom timeout. ```js const timeouts = []; function errorMsg() { console.error('Something must be wrong with the connection ...'); } cluster.on('fork', (worker) => { timeouts[worker.id] = setTimeout(errorMsg, 2000); }); cluster.on('listening', (worker, address) => { clearTimeout(timeouts[worker.id]); }); cluster.on('exit', (worker, code, signal) => { clearTimeout(timeouts[worker.id]); errorMsg(); }); ``` ## Event: `'listening'` \* `worker` {cluster.Worker} \* `address` {Object} After calling `listen()` from a worker, when the `'listening'` event is emitted on the server, a `'listening'` event will also be emitted on `cluster` in the primary. The event handler is executed with two arguments, the `worker` contains the worker object and the `address` object contains the following connection properties: `address`, `port`, and `addressType`. This is very useful if the worker is listening on more than one address. ```js cluster.on('listening', (worker, address) => { console.log( `A worker is now connected to ${address.address}:${address.port}`); }); ``` The `addressType` is one of: \* `4` (TCPv4) \* `6` (TCPv6) \* `-1` (Unix domain socket) \* `'udp4'` or `'udp6'` (UDPv4 or UDPv6) ## Event: `'message'` \* `worker` {cluster.Worker} \* `message` {Object} \* `handle` {undefined|Object} Emitted when the cluster primary receives a message from any worker. See [`child\_process` event: `'message'`][]. ## Event: `'online'` \* `worker` {cluster.Worker} After forking a new worker, the worker should respond with an online message. When the primary receives an online message it will emit this event. The difference between `'fork'` and `'online'` is that fork is emitted when the primary forks a worker, and `'online'` is emitted when the worker is running. ```js cluster.on('online', (worker) => { console.log('Yay, the worker responded after it was forked'); }); ``` ## Event: `'setup'` \* `settings` {Object} Emitted every time [`.setupPrimary()`][] is called. The `settings` object is the `cluster.settings` object at the time [`.setupPrimary()`][] was called and is advisory only, since multiple calls to [`.setupPrimary()`][] can be made in a single tick. If accuracy is important, use `cluster.settings`. ## `cluster.disconnect([callback])` \* `callback` {Function} Called when all workers are disconnected and handles are closed. Calls `.disconnect()` on each worker in `cluster.workers`. When they are disconnected all internal handles will be closed, allowing the primary process to die gracefully if no other event is waiting. The method takes an optional callback argument
https://github.com/nodejs/node/blob/main//doc/api/cluster.md
main
nodejs
[ -0.0684414878487587, -0.009722144342958927, 0.0022351404186338186, 0.08413935452699661, 0.11204738169908524, -0.07820024341344833, 0.048209384083747864, 0.011602766811847687, 0.08434152603149414, 0.01268652081489563, -0.01685057207942009, 0.041510529816150665, -0.0706687867641449, -0.01506896037608385, -0.040928445756435394, -0.029594456776976585, 0.06078182905912399, -0.09162430465221405, -0.019877104088664055, -0.12289930135011673, -0.016292748972773552, -0.026231391355395317, 0.030984731391072273, 0.03311777859926224, 0.005923171062022448, 0.03730495646595955, 0.024889210239052773, -0.01984984613955021, 0.009746149182319641, 0.03197818994522095, -0.04134565591812134, 0.013810827396810055, -0.06121109798550606, -0.004410377237945795, 0.009377554059028625, 0.1578654944896698, 0.0306980200111866, -0.007495848461985588, -0.05904623866081238, -0.03534805402159691, 0.07477303594350815, 0.021022135391831398, -0.12317207455635071, -0.07079429179430008, -0.017322711646556854, 0.006254248321056366, -0.13500234484672546, -0.005435934290289879, -0.05732220783829689, -0.014462614431977272, 0.012342561967670918, 0.016887441277503967, 0.04761112481355667, 0.128677636384964, 0.016437428072094917, 0.04226851463317871, 0.0466127023100853, -0.053485553711652756, 0.02208283543586731, 0.007983196526765823, -0.022756576538085938, -0.02143196016550064, -0.04893580824136734, 0.009193606674671173, 0.09097015112638474, -0.025542693212628365, 0.022244688123464584, -0.0016216073418036103, 0.046898480504751205, -0.04852794110774994, 0.0072954799979925156, 0.029319673776626587, -0.03187445551156998, 0.01568162627518177, -0.02653929591178894, -0.01652439497411251, 0.028022626414895058, -0.04106736555695534, -0.0701332539319992, 0.04314606264233589, -0.0617443211376667, -0.05289771407842636, -0.019611865282058716, 0.020913992077112198, -0.020422615110874176, 0.06507877260446548, -0.0055739083327353, -0.05011320114135742, 0.04839413985610008, -0.0006637610495090485, -0.06443766504526138, 0.0511193722486496, 0.0014484357088804245, 0.056115441024303436, 0.0025077471509575844, 0.01784578338265419, -0.053274475038051605, 0.06487279385328293, -0.014789385721087456, 0.031887661665678024, 0.024008166044950485, -0.024343542754650116, 0.04760192334651947, -0.04836885631084442, -0.03470153361558914, 0.009538104757666588, -0.08067389577627182, -0.01776929385960102, 0.031229251995682716, 0.024978216737508774, -0.01721799373626709, -0.01768219657242298, 0.010758860968053341, 0.0862584188580513, -0.051226191222667694, 0.04929492622613907, 0.09249188005924225, 0.007275561802089214, 0.01200199220329523, 0.06563520431518555, 0.09387345612049103, -0.06553590297698975, -0.003494948148727417, -0.03876426815986633, -0.0015032571973279119, -0.07131074368953705, -0.002103374572470784, -2.3756830369727185e-34, -0.016133040189743042, -0.11343955248594284, 0.012003430165350437, 0.05594960227608681, 0.06655517965555191, 0.03308337181806564, -0.010776320472359657, -0.003543633269146085, -0.008499471470713615, -0.04121461510658264, -0.08333221077919006, -0.016293460503220558, 0.10245200246572495, -0.06712426990270615, -0.019075579941272736, -0.04813356325030327, 0.08296418935060501, 0.0512392520904541, 0.04878513514995575, 0.050440363585948944, 0.04156380519270897, 0.0403573215007782, -0.07508456707000732, 0.061142124235630035, 0.025374049320816994, 0.011397168971598148, -0.021581731736660004, -0.025785859674215317, -0.03512484207749367, 0.015782555565238, -0.01404316071420908, 0.07533980906009674, -0.009824500419199467, 0.025185607373714447, -0.06840677559375763, 0.01830795221030712, 0.03953088819980621, -0.02895987406373024, -0.06010952591896057, -0.07951730489730835, -0.0540870726108551, -0.021628035232424736, -0.03463808819651604, -0.02424429915845394, 0.020150410011410713, -0.07445070892572403, -0.04085652530193329, -0.03622172400355339, 0.06923448294401169, 0.02856929413974285, 0.059893012046813965, -0.03394913673400879, 0.14045347273349762, -0.02459331788122654, 0.053502604365348816, 0.06747440993785858, 0.047408465296030045, 0.007867077365517616, 0.007996409200131893, 0.05260496214032173, 0.06465720385313034, -0.036827847361564636, -0.09229162335395813, 0.00351267890073359, 0.0704847052693367, 0.04301353171467781, -0.036632828414440155, 0.04058987647294998, 0.02994418889284134, -0.003006588900461793, -0.08796145766973495, 0.07914336025714874, -0.006651408039033413, 0.043809544295072556, -0.02410600148141384, 0.001968486001715064, -0.06152265891432762, 0.00756303733214736, -0.09398089349269867, 0.004251081962138414, 0.0022176105994731188, 0.013165507465600967, -0.05618011951446533, 0.007810982875525951, 0.020929336547851562, 0.011305545456707478, -0.041781891137361526, 0.012068940326571465, -0.054906658828258514, 0.09650585800409317, 0.01591075211763382, 0.010848506353795528, 0.04917250946164131, 0.08064748346805573, -0.0501464381814003, -2.794334110238878e-33, -0.07736340165138245, 0.020063461735844612, -0.10522781312465668, 0.032769594341516495, -0.022858621552586555, -0.01487694587558508, 0.05979207530617714, 0.018008960410952568, -0.06207076832652092, 0.021377863362431526, -0.026098018512129784, 0.003951442893594503, -0.044185131788253784, 0.04204084724187851, -0.051664941012859344, 0.02864125370979309, 0.04971751198172569, -0.03686929866671562, 0.010860857553780079, 0.009384517557919025, 0.006113460753113031, 0.008112957701086998, 0.0053088185377418995, -0.03898416832089424, -0.032953836023807526, -0.022806406021118164, -0.029437720775604248, -0.018169891089200974, -0.06275264918804169, -0.03400580212473869, -0.029759947210550308, -0.010598279535770416, 0.004481199197471142, 0.13436000049114227, 0.0404692068696022, -0.05688106641173363, -0.09159679710865021, -0.007930927909910679, 0.05777307599782944, -0.08514443039894104, 0.07817960530519485, 0.020526805892586708, -0.012977216392755508, 0.04381771758198738, -0.01787862367928028, 0.011361032724380493, -0.00969318114221096, -0.0010003859642893076, -0.09559806436300278, 0.022534048184752464, -0.0016664101276546717, -0.017569782212376595, 0.03893374279141426, 0.11215607821941376, -0.014470716007053852, 0.04625529795885086, 0.0210171677172184, -0.019617388024926186, -0.034876301884651184, -0.008762476965785027, 0.10532481223344803, -0.1603471040725708, 0.02811017818748951, 0.07671196013689041, 0.0301060751080513, -0.07594451308250427, 0.0026013709139078856, 0.025918029248714447, 0.06650549173355103, -0.0015107103390619159, 0.025512035936117172, 0.09340843558311462, -0.07993149757385254, -0.004967043176293373, -0.026455940678715706, -0.0203370600938797, -0.02496592327952385, -0.11517132073640823, -0.06543362885713577, 0.030963579192757607, -0.05999574065208435, 0.023470552638173103, -0.04771244525909424, -0.012545122765004635, 0.07047785818576813, 0.02228708751499653, 0.043784793466329575, 0.05578583478927612, 0.037495918571949005, -0.013286760076880455, -0.027216723188757896, -0.0048437947407364845, -0.05820176750421524, -0.015645714476704597, -0.06650681793689728, -4.889259841434068e-8, 0.021681351587176323, -0.04474770650267601, -0.04510439559817314, -0.03783361241221428, 0.04004979878664017, -0.06954824924468994, 0.004872115794569254, -0.025782663375139236, -0.005071742460131645, 0.08490269631147385, -0.04712861776351929, -0.012188241817057133, 0.014653115533292294, -0.02163289673626423, 0.12460631132125854, -0.0038653097581118345, 0.03525761142373085, -0.0030033469665795565, -0.02578630857169628, -0.06427156925201416, 0.03849334269762039, -0.02955750934779644, -0.08258850127458572, 0.11162073165178299, -0.09578944742679596, -0.044349659234285355, 0.07259335368871689, 0.06820887327194214, -0.10006698220968246, -0.10145830363035202, -0.11092114448547363, 0.020019270479679108, 0.03870537877082825, 0.04771246761083603, -0.06301147490739822, 0.07198622822761536, -0.04738323763012886, 0.005660668481141329, 0.054562777280807495, 0.028092876076698303, 0.05118244141340256, 0.031207766383886337, -0.07889775186777115, 0.028193319216370583, 0.04188495874404907, 0.01824602484703064, 0.003792837029322982, 0.024670127779245377, -0.0115566560998559, 0.05090242624282837, -0.04272153601050377, -0.00046889728400856256, -0.05078379064798355, -0.0032197062391787767, 0.016947701573371887, -0.04859268292784691, -0.0014028010191395879, -0.07926380634307861, -0.024000220000743866, 0.02360924705862999, 0.09530454874038696, 0.049574077129364014, -0.012240137904882431, -0.05007103085517883 ]
0.225162
\* `callback` {Function} Called when all workers are disconnected and handles are closed. Calls `.disconnect()` on each worker in `cluster.workers`. When they are disconnected all internal handles will be closed, allowing the primary process to die gracefully if no other event is waiting. The method takes an optional callback argument which will be called when finished. This can only be called from the primary process. ## `cluster.fork([env])` \* `env` {Object} Key/value pairs to add to worker process environment. \* Returns: {cluster.Worker} Spawn a new worker process. This can only be called from the primary process. ## `cluster.isMaster` > Stability: 0 - Deprecated Deprecated alias for [`cluster.isPrimary`][]. ## `cluster.isPrimary` \* Type: {boolean} True if the process is a primary. This is determined by the `process.env.NODE\_UNIQUE\_ID`. If `process.env.NODE\_UNIQUE\_ID` is undefined, then `isPrimary` is `true`. ## `cluster.isWorker` \* Type: {boolean} True if the process is not a primary (it is the negation of `cluster.isPrimary`). ## `cluster.schedulingPolicy` The scheduling policy, either `cluster.SCHED\_RR` for round-robin or `cluster.SCHED\_NONE` to leave it to the operating system. This is a global setting and effectively frozen once either the first worker is spawned, or [`.setupPrimary()`][] is called, whichever comes first. `SCHED\_RR` is the default on all operating systems except Windows. Windows will change to `SCHED\_RR` once libuv is able to effectively distribute IOCP handles without incurring a large performance hit. `cluster.schedulingPolicy` can also be set through the `NODE\_CLUSTER\_SCHED\_POLICY` environment variable. Valid values are `'rr'` and `'none'`. ## `cluster.settings` \* Type: {Object} \* `execArgv` {string\[]} List of string arguments passed to the Node.js executable. \*\*Default:\*\* `process.execArgv`. \* `exec` {string} File path to worker file. \*\*Default:\*\* `process.argv[1]`. \* `args` {string\[]} String arguments passed to worker. \*\*Default:\*\* `process.argv.slice(2)`. \* `cwd` {string} Current working directory of the worker process. \*\*Default:\*\* `undefined` (inherits from parent process). \* `serialization` {string} Specify the kind of serialization used for sending messages between processes. Possible values are `'json'` and `'advanced'`. See [Advanced serialization for `child\_process`][] for more details. \*\*Default:\*\* `false`. \* `silent` {boolean} Whether or not to send output to parent's stdio. \*\*Default:\*\* `false`. \* `stdio` {Array} Configures the stdio of forked processes. Because the cluster module relies on IPC to function, this configuration must contain an `'ipc'` entry. When this option is provided, it overrides `silent`. See [`child\_process.spawn()`][]'s [`stdio`][]. \* `uid` {number} Sets the user identity of the process. (See setuid(2).) \* `gid` {number} Sets the group identity of the process. (See setgid(2).) \* `inspectPort` {number|Function} Sets inspector port of worker. This can be a number, or a function that takes no arguments and returns a number. By default each worker gets its own port, incremented from the primary's `process.debugPort`. \* `windowsHide` {boolean} Hide the forked processes console window that would normally be created on Windows systems. \*\*Default:\*\* `false`. After calling [`.setupPrimary()`][] (or [`.fork()`][]) this settings object will contain the settings, including the default values. This object is not intended to be changed or set manually. ## `cluster.setupMaster([settings])` > Stability: 0 - Deprecated Deprecated alias for [`.setupPrimary()`][]. ## `cluster.setupPrimary([settings])` \* `settings` {Object} See [`cluster.settings`][]. `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in `cluster.settings`. Any settings changes only affect future calls to [`.fork()`][] and have no effect on workers that are already running. The only attribute of a worker that cannot be set via `.setupPrimary()` is the `env` passed to [`.fork()`][]. The defaults above apply to the first call only; the defaults for later calls are the current values at the time of `cluster.setupPrimary()` is called. ```mjs import cluster from 'node:cluster'; cluster.setupPrimary({ exec: 'worker.js', args: ['--use', 'https'], silent: true, }); cluster.fork(); // https worker cluster.setupPrimary({ exec: 'worker.js', args: ['--use',
https://github.com/nodejs/node/blob/main//doc/api/cluster.md
main
nodejs
[ -0.045197661966085434, -0.023718899115920067, -0.05521974712610245, 0.06823912262916565, 0.03414358198642731, -0.07076308876276016, 0.002979125827550888, 0.01882646605372429, 0.017950724810361862, 0.035067565739154816, -0.040204260498285294, 0.01782120391726494, -0.025545842945575714, -0.043720025569200516, -0.028468741104006767, -0.019451970234513283, 0.0071097747422754765, -0.041848231106996536, 0.025360092520713806, -0.07852115482091904, -0.018655862659215927, -0.0011670978274196386, -0.0010890514822676778, 0.02089376375079155, -0.06413572281599045, -0.04224767908453941, -0.027176976203918457, -0.05002733692526817, 0.04557881876826286, -0.0025236515793949366, -0.037600550800561905, 0.015783675014972687, -0.06343758851289749, -0.030071306973695755, 0.0780419185757637, 0.21707671880722046, 0.03471117839217186, -0.023064542561769485, -0.09240319579839706, -0.034183599054813385, 0.13303838670253754, 0.044808149337768555, -0.09933674335479736, -0.1103285402059555, -0.009221813641488552, 0.007417095359414816, -0.12487096339464188, -0.04580525681376457, -0.07026240229606628, -0.03083404339849949, 0.04299229755997658, -0.01885855756700039, 0.030705465003848076, 0.0635833591222763, 0.03299199417233467, 0.038989242166280746, 0.0906025767326355, -0.07066692411899567, -0.00283434079028666, 0.022971462458372116, 0.03248171880841255, -0.03227109834551811, -0.0034473733976483345, -0.02957463078200817, 0.05106514319777489, 0.037467461079359055, 0.010168936103582382, -0.0028282322455197573, 0.008982851170003414, -0.013458000496029854, -0.015658700838685036, 0.014577025547623634, -0.06648313254117966, -0.046897947788238525, -0.02734055370092392, 0.0017924882704392076, 0.04141680896282196, -0.034051477909088135, -0.05939394608139992, 0.010102606378495693, -0.05515896901488304, -0.04739849269390106, -0.004464752972126007, -0.0009580724872648716, -0.0032520575914531946, 0.05656510964035988, -0.02827303297817707, -0.07129915058612823, 0.10372000932693481, 0.013628780841827393, -0.1154707819223404, 0.07886238396167755, 0.0013410912360996008, -0.0021096349228173494, -0.014845876023173332, 0.059440724551677704, 0.013884341344237328, 0.02599901705980301, 0.006739431992173195, 0.03937084227800369, -0.009250779636204243, -0.01864926517009735, 0.020301315933465958, -0.06622958183288574, 0.009003364481031895, 0.03524269163608551, -0.050901368260383606, -0.02587006986141205, 0.020487649366259575, 0.004670623689889908, 0.011424150317907333, 0.02244560979306698, 0.030484912917017937, 0.06248661130666733, -0.037488628178834915, 0.07842499762773514, 0.11075112223625183, -0.02340126782655716, 0.04437058046460152, 0.041562918573617935, 0.14124146103858948, -0.003512831637635827, 0.01779133267700672, -0.012956369668245316, 0.01751750148832798, -0.024558257311582565, 0.012148985639214516, 2.5321213608467506e-33, 0.02964601293206215, -0.1508263498544693, 0.019975043833255768, 0.022342484444379807, 0.09456316381692886, -0.023175938054919243, -0.001618095557205379, -0.026129383593797684, -0.03859974071383476, -0.041959747672080994, -0.03162818029522896, 0.0003060901362914592, 0.030290735885500908, -0.05492338910698891, -0.006531028542667627, -0.04744815453886986, 0.11171269416809082, 0.04673675820231438, 0.016648616641759872, 0.02518398128449917, 0.06559473276138306, -0.003021444659680128, -0.09438998997211456, 0.05049885809421539, -0.0049414923414587975, 0.025485649704933167, -0.02931823395192623, -0.060898568481206894, 0.05745457857847214, 0.014987400732934475, -0.020005954429507256, 0.05702263116836548, -0.02154885232448578, 0.07779086381196976, -0.07621443271636963, 0.0441756471991539, -0.02185511402785778, 0.01182807981967926, -0.06840063631534576, -0.11133653670549393, -0.0262824185192585, 0.037400443106889725, -0.0038923765532672405, -0.026718327775597572, 0.019810108467936516, -0.10638372600078583, -0.01606316864490509, -0.03087645024061203, 0.08156134188175201, 0.006788516417145729, 0.01824081875383854, -0.02995304763317108, 0.13176919519901276, -0.02543826960027218, -0.007265023421496153, 0.05054320767521858, 0.004294848069548607, 0.02651658095419407, 0.021315284073352814, 0.024440031498670578, 0.008241419680416584, -0.02354194037616253, -0.08572988957166672, 0.04324861243367195, 0.047053683549165726, 0.04071903973817825, 0.015968937426805496, 0.04171261563897133, 0.030536307021975517, 0.004955649841576815, -0.08483926951885223, 0.09561973065137863, -0.004282995127141476, 0.06335335969924927, -0.010686286725103855, -0.0023244377225637436, -0.029059752821922302, -0.045391857624053955, -0.10806727409362793, 0.052049484103918076, 0.06822317093610764, -0.016100481152534485, -0.09165786951780319, -0.0037698359228670597, 0.05866424739360809, -0.0019779549911618233, -0.03577834367752075, 0.0098369549959898, -0.014475595206022263, 0.044950421899557114, -0.0346657857298851, -0.012476331554353237, 0.07303446531295776, 0.03899148851633072, -0.13790945708751678, -4.322811782197836e-33, 8.330894729624561e-7, -0.02362976036965847, -0.04613158851861954, 0.0465535894036293, -0.017952939495444298, -0.007520329672843218, 0.02720325067639351, -0.019603557884693146, -0.07258789241313934, -0.05444691330194473, -0.03785889595746994, -0.01506189163774252, 0.022442640736699104, 0.05584672465920448, -0.018649831414222717, 0.028483780100941658, 0.021416479721665382, -0.030874719843268394, 0.008277337066829205, 0.015222564339637756, -0.014309617690742016, -0.014960129745304585, -0.007877331227064133, 0.007254791911691427, -0.030181096866726875, 0.003251069225370884, -0.0680774450302124, -0.027455607429146767, -0.06425153464078903, -0.034571487456560135, -0.04989847168326378, -0.02096150442957878, -0.012323735281825066, 0.06680592149496078, 0.039187077432870865, -0.039808060973882675, -0.09112285077571869, -0.008393562398850918, 0.012702037580311298, -0.05820877104997635, 0.09724515676498413, 0.008727964013814926, -0.02533535100519657, -0.0075269173830747604, 0.016194019466638565, 0.0068000806495547295, 0.017233191058039665, 0.0170209351927042, -0.12766046822071075, 0.029902495443820953, -0.03005162999033928, -0.045087918639183044, -0.01889401488006115, 0.11190647631883621, -0.0191165991127491, 0.011960910633206367, 0.08527059108018875, 0.01652357541024685, -0.052191875874996185, -0.006526886485517025, 0.11885520070791245, -0.14255394041538239, 0.008572840131819248, 0.07146862894296646, 0.003399739507585764, -0.020585326477885246, -0.009038924239575863, -0.020059607923030853, -0.017622070387005806, 0.027288351207971573, 0.008830464445054531, 0.12064061313867569, -0.04844432696700096, 0.030853722244501114, -0.03830825164914131, 0.01778431609272957, -0.027663003653287888, -0.13411715626716614, -0.01546688936650753, 0.051902785897254944, -0.09348417073488235, 0.0273725762963295, -0.04196581244468689, 0.022323640063405037, 0.0288566742092371, 0.009649194777011871, 0.0591646172106266, 0.10268934071063995, 0.006122225895524025, 0.021680649369955063, -0.054742805659770966, -0.03928397595882416, -0.042990751564502716, 0.011184239760041237, -0.08786448836326599, -5.606381492384571e-8, 0.061716221272945404, 0.02501894161105156, -0.04325825721025467, -0.0012267433339729905, 0.022929590195417404, -0.042606860399246216, 0.037650298327207565, -0.02673536352813244, -0.03173871710896492, 0.054699450731277466, -0.020386215299367905, -0.03898899629712105, 0.044310927391052246, 0.031244512647390366, 0.04454348608851433, 0.03539452701807022, 0.06938276439905167, 0.05734238028526306, -0.030884472653269768, -0.10107021778821945, -0.01866903156042099, -0.050475332885980606, -0.06217339262366295, 0.07987906783819199, -0.07269708812236786, 0.002414037473499775, 0.050644852221012115, 0.02585490234196186, -0.04420710727572441, -0.07567458599805832, -0.0765295997262001, 0.02165922336280346, -0.0006425426108762622, 0.09339775145053864, -0.08339022845029831, 0.08931361138820648, -0.03169865533709526, 0.05273514240980148, 0.07107296586036682, 0.049028679728507996, 0.03975195437669754, 0.0959557518362999, -0.0804591178894043, 0.015726670622825623, 0.04031265899538994, 0.05671237036585808, -0.015311336144804955, 0.03718962520360947, -0.009226218797266483, 0.051638394594192505, -0.026126183569431305, -0.03448944911360741, 0.0006283356924541295, 0.03471262753009796, 0.014021084643900394, 0.0022091208957135677, 0.03313472867012024, -0.05223691835999489, 0.009758809581398964, 0.023625444620847702, 0.07089581340551376, -0.0422065369784832, 0.024310363456606865, -0.01902897097170353 ]
0.19266
to [`.fork()`][]. The defaults above apply to the first call only; the defaults for later calls are the current values at the time of `cluster.setupPrimary()` is called. ```mjs import cluster from 'node:cluster'; cluster.setupPrimary({ exec: 'worker.js', args: ['--use', 'https'], silent: true, }); cluster.fork(); // https worker cluster.setupPrimary({ exec: 'worker.js', args: ['--use', 'http'], }); cluster.fork(); // http worker ``` ```cjs const cluster = require('node:cluster'); cluster.setupPrimary({ exec: 'worker.js', args: ['--use', 'https'], silent: true, }); cluster.fork(); // https worker cluster.setupPrimary({ exec: 'worker.js', args: ['--use', 'http'], }); cluster.fork(); // http worker ``` This can only be called from the primary process. ## `cluster.worker` \* Type: {Object} A reference to the current worker object. Not available in the primary process. ```mjs import cluster from 'node:cluster'; if (cluster.isPrimary) { console.log('I am primary'); cluster.fork(); cluster.fork(); } else if (cluster.isWorker) { console.log(`I am worker #${cluster.worker.id}`); } ``` ```cjs const cluster = require('node:cluster'); if (cluster.isPrimary) { console.log('I am primary'); cluster.fork(); cluster.fork(); } else if (cluster.isWorker) { console.log(`I am worker #${cluster.worker.id}`); } ``` ## `cluster.workers` \* Type: {Object} A hash that stores the active worker objects, keyed by `id` field. This makes it easy to loop through all the workers. It is only available in the primary process. A worker is removed from `cluster.workers` after the worker has disconnected \_and\_ exited. The order between these two events cannot be determined in advance. However, it is guaranteed that the removal from the `cluster.workers` list happens before the last `'disconnect'` or `'exit'` event is emitted. ```mjs import cluster from 'node:cluster'; for (const worker of Object.values(cluster.workers)) { worker.send('big announcement to all workers'); } ``` ```cjs const cluster = require('node:cluster'); for (const worker of Object.values(cluster.workers)) { worker.send('big announcement to all workers'); } ``` [Advanced serialization for `child\_process`]: child\_process.md#advanced-serialization [Child Process module]: child\_process.md#child\_processforkmodulepath-args-options [`.fork()`]: #clusterforkenv [`.setupPrimary()`]: #clustersetupprimarysettings [`ChildProcess.send()`]: child\_process.md#subprocesssendmessage-sendhandle-options-callback [`child\_process.fork()`]: child\_process.md#child\_processforkmodulepath-args-options [`child\_process.spawn()`]: child\_process.md#child\_processspawncommand-args-options [`child\_process` event: `'exit'`]: child\_process.md#event-exit [`child\_process` event: `'message'`]: child\_process.md#event-message [`cluster.isPrimary`]: #clusterisprimary [`cluster.settings`]: #clustersettings [`disconnect()`]: child\_process.md#subprocessdisconnect [`kill()`]: process.md#processkillpid-signal [`process` event: `'message'`]: process.md#event-message [`server.close()`]: net.md#event-close [`stdio`]: child\_process.md#optionsstdio [`worker.exitedAfterDisconnect`]: #workerexitedafterdisconnect [`worker\_threads`]: worker\_threads.md
https://github.com/nodejs/node/blob/main//doc/api/cluster.md
main
nodejs
[ -0.016406970098614693, 0.06687887012958527, -0.02255602926015854, 0.029962124302983284, -0.01006921473890543, -0.0784103274345398, -0.028720416128635406, 0.052343595772981644, -0.002651629503816366, -0.024650409817695618, 0.01885261945426464, -0.020262902602553368, -0.01866035722196102, -0.012895177118480206, 0.04252801090478897, -0.046899545937776566, 0.02435399778187275, 0.0004274318052921444, 0.05007099732756615, -0.07266959547996521, -0.0033508199267089367, -0.03207245469093323, 0.007030166685581207, -0.03055289201438427, 0.0059409718960523605, -0.03877614438533783, -0.030861737206578255, -0.015209040604531765, 0.07172484695911407, 0.024610918015241623, 0.04553135111927986, 0.005193459801375866, -0.04943743348121643, -0.015618768520653248, -0.041059162467718124, 0.17921344935894012, -0.011345092207193375, -0.053552377969026566, -0.05278048291802406, 0.0031685931608080864, 0.0925372913479805, 0.05013759806752205, -0.05488470941781998, -0.11599547415971756, -0.03853143751621246, -0.006563859060406685, -0.05505022779107094, 0.04213709756731987, -0.06808342039585114, -0.01928802765905857, 0.04758709296584129, -0.006511187646538019, -0.0044762976467609406, -0.006623256020247936, -0.07560032606124878, 0.026847897097468376, 0.03552037477493286, 0.0488995723426342, 0.07344955950975418, 0.029202977195382118, -0.006938833277672529, -0.06993233412504196, 0.021966194733977318, -0.011454014107584953, 0.08639711141586304, -0.021564297378063202, 0.05839689075946808, 0.0018102446338161826, 0.010009418241679668, 0.033931534737348557, 0.03391559049487114, 0.004375495947897434, -0.01620725356042385, -0.045999228954315186, -0.05368434265255928, -0.044336095452308655, -0.039328619837760925, -0.011088903062045574, -0.04920351132750511, 0.03910987824201584, -0.04082016274333, -0.06903534382581711, 0.050599392503499985, 0.06478903442621231, -0.036002084612846375, 0.08239452540874481, -0.029759719967842102, -0.0027743536047637463, 0.10913105309009552, -0.03878782317042351, -0.08579462021589279, 0.024220621213316917, -0.09025507420301437, 0.0186084546148777, -0.02046562172472477, 0.06641124188899994, -0.0529017336666584, -0.027170229703187943, -0.027519715949892998, 0.034670211374759674, -0.007931696251034737, -0.11904794722795486, 0.05920087918639183, -0.00817361194640398, 0.029394078999757767, -0.0020312201231718063, -0.06806647032499313, 0.0038083605468273163, -0.003950964659452438, 0.0354984886944294, 0.042560696601867676, 0.05115235224366188, 0.011581974104046822, -0.003786404151469469, -0.021823247894644737, 0.029277333989739418, 0.1031261682510376, -0.062125492841005325, 0.03820903226733208, 0.06035532057285309, 0.09894319623708725, -0.015834100544452667, 0.03572941571474075, 0.019663702696561813, 0.01519436202943325, -0.016475696116685867, -0.0011625989573076367, 1.2122571101247891e-33, 0.04670681804418564, -0.10793066769838333, 0.04771723970770836, -0.011432121507823467, 0.07570549100637436, 0.0014607771299779415, 0.0027765536215156317, -0.012398059479892254, -0.07167460769414902, -0.050244711339473724, -0.001448184484615922, 0.010064613074064255, 0.04969673603773117, -0.046752799302339554, -0.0365859791636467, -0.0457393117249012, 0.07972895354032516, 0.030888037756085396, 0.10997285693883896, 0.042269010096788406, 0.060770176351070404, -0.0018635899759829044, -0.008395842276513577, 0.019340286031365395, -0.03907569870352745, -0.0009386555175296962, -0.002532276790589094, -0.02068610116839409, -0.029291238635778427, -0.010478018783032894, 0.04490981251001358, 0.09144073724746704, -0.06579676270484924, 0.009136778302490711, -0.027535729110240936, 0.004376584198325872, 0.01942942850291729, 0.03127382695674896, -0.10335256904363632, -0.060780707746744156, 0.03206099569797516, 0.05819501355290413, 0.06210935488343239, -0.040105219930410385, -0.006620356347411871, -0.07267351448535919, -0.07097143679857254, -0.033113401383161545, 0.11668213456869125, 0.0349104106426239, -0.03760774806141853, -0.011001707054674625, 0.091127410531044, -0.028807049617171288, 0.027089783921837807, 0.0686209574341774, -0.0384359285235405, -0.022975260391831398, -0.00705963559448719, -0.01521532703191042, -0.02909548394382, -0.06717465817928314, -0.10429749637842178, 0.04789986461400986, -0.018623245880007744, 0.046564970165491104, -0.008778797462582588, 0.0984872505068779, 0.015767548233270645, 0.038751084357500076, -0.050429824739694595, 0.0322728231549263, 0.021368645131587982, 0.04157271981239319, -0.02503390610218048, 0.05079694092273712, -0.03284980356693268, 0.04760216921567917, -0.0724424198269844, 0.016596609726548195, 0.06607078015804291, 0.051650270819664, -0.07559056580066681, 0.029976310208439827, 0.06231117993593216, 0.02905990369617939, -0.025199655443429947, -0.014974318444728851, 0.05409438535571098, 0.05164354294538498, 0.01631063036620617, -0.021230529993772507, 0.04127005115151405, 0.021672124043107033, -0.15793238580226898, -3.355970617382382e-33, 0.032484106719493866, 0.009358406066894531, -0.03683381900191307, 0.0665731281042099, 0.07461746782064438, 0.001490885391831398, 0.07789882272481918, -0.002770948689430952, -0.07117803394794464, 0.0250844806432724, -0.009921220131218433, 0.006673478987067938, -0.01573072373867035, 0.028205443173646927, -0.08301155269145966, 0.0465194433927536, 0.030482353642582893, -0.0036525214090943336, 0.07253386825323105, -0.0547824390232563, -0.062299199402332306, -0.04417474940419197, -0.0037648866418749094, 0.021220184862613678, -0.02453186921775341, -0.019689828157424927, -0.0733085498213768, -0.020671455189585686, -0.07805454730987549, -0.0692175030708313, -0.1258239597082138, 0.04115551337599754, -0.014342491514980793, 0.06734678894281387, 0.02726670913398266, -0.046357013285160065, -0.08461764454841614, 0.11656486243009567, 0.07864928245544434, -0.06559056788682938, 0.07581022381782532, -0.03861849755048752, -0.0822443813085556, 0.03397844731807709, 0.026674358174204826, -0.025101903825998306, 0.03154806047677994, -0.011502648703753948, -0.09460008889436722, -0.006056162528693676, -0.09215252846479416, -0.0668288841843605, -0.007052521221339703, 0.05405285209417343, -0.04325876012444496, -0.03276847302913666, 0.06936084479093552, 0.06833993643522263, 0.011551812291145325, 0.07977687567472458, 0.0568077526986599, -0.15687860548496246, -0.0262531116604805, 0.05530417710542679, -0.035906337201595306, -0.05702798441052437, -0.09049910306930542, -0.039724238216876984, 0.015952052548527718, 0.059302739799022675, -0.07216120511293411, 0.0635460615158081, 0.027125826105475426, -0.05646962672472, -0.029787275940179825, -0.060188230127096176, -0.0037379141431301832, -0.1040339320898056, 0.006532837171107531, 0.04171668738126755, -0.06592364609241486, 0.04656520113348961, -0.09762060642242432, 0.044721052050590515, 0.07027006894350052, 0.016338467597961426, 0.027440272271633148, 0.021796414628624916, 0.03317208215594292, 0.011667926795780659, -0.08123255521059036, -0.026317134499549866, -0.0011090922635048628, 0.00821376871317625, -0.026666007936000824, -4.603443315431832e-8, 0.04297204315662384, 0.013112231157720089, -0.0706336721777916, 0.0028613554313778877, 0.030007561668753624, 0.004149079788476229, -0.01142158918082714, -0.055203355848789215, -0.04313289001584053, -0.001772386021912098, -0.025424763560295105, 0.024111557751893997, 0.028800640255212784, 0.04857144132256508, -0.01859659142792225, 0.021970735862851143, 0.03745410963892937, 0.0008466436993330717, -0.02661040611565113, -0.07579241693019867, -0.0594555139541626, -0.02157507836818695, -0.02034895494580269, 0.10238398611545563, -0.023453978821635246, -0.010561835020780563, 0.052996277809143066, 0.046445541083812714, -0.02575552836060524, -0.011105612851679325, -0.14174884557724, 0.0022380759473890066, -0.013026132248342037, 0.03386906906962395, -0.05807855725288391, 0.00235408591106534, -0.12034789472818375, 0.04499292001128197, 0.09199352562427521, 0.03364037722349167, 0.0521981306374073, 0.08497391641139984, -0.03292098268866539, -0.0025105958338826895, 0.007958105765283108, 0.04962890222668648, -0.018395790830254555, 0.050680361688137054, 0.021152110770344734, 0.004643514286726713, 0.034862078726291656, -0.00564770819619298, -0.02685590274631977, 0.024251941591501236, 0.031229497864842415, -0.004786594770848751, 0.04697812348604202, -0.1142040342092514, 0.010905861854553223, 0.01357815507799387, 0.0785803571343422, -0.031113963574171066, 0.006753543857485056, -0.06666390597820282 ]
0.080684
# V8 The `node:v8` module exposes APIs that are specific to the version of [V8][] built into the Node.js binary. It can be accessed using: ```mjs import v8 from 'node:v8'; ``` ```cjs const v8 = require('node:v8'); ``` ## `v8.cachedDataVersionTag()` \* Returns: {integer} Returns an integer representing a version tag derived from the V8 version, command-line flags, and detected CPU features. This is useful for determining whether a [`vm.Script`][] `cachedData` buffer is compatible with this instance of V8. ```js console.log(v8.cachedDataVersionTag()); // 3947234607 // The value returned by v8.cachedDataVersionTag() is derived from the V8 // version, command-line flags, and detected CPU features. Test that the value // does indeed update when flags are toggled. v8.setFlagsFromString('--allow\_natives\_syntax'); console.log(v8.cachedDataVersionTag()); // 183726201 ``` ## `v8.getHeapCodeStatistics()` \* Returns: {Object} Get statistics about code and its metadata in the heap, see V8 [`GetHeapCodeAndMetadataStatistics`][] API. Returns an object with the following properties: \* `code\_and\_metadata\_size` {number} \* `bytecode\_and\_metadata\_size` {number} \* `external\_script\_source\_size` {number} \* `cpu\_profiler\_metadata\_size` {number} ```js { code\_and\_metadata\_size: 212208, bytecode\_and\_metadata\_size: 161368, external\_script\_source\_size: 1410794, cpu\_profiler\_metadata\_size: 0, } ``` ## `v8.getHeapSnapshot([options])` \* `options` {Object} \* `exposeInternals` {boolean} If true, expose internals in the heap snapshot. \*\*Default:\*\* `false`. \* `exposeNumericValues` {boolean} If true, expose numeric values in artificial fields. \*\*Default:\*\* `false`. \* Returns: {stream.Readable} A Readable containing the V8 heap snapshot. Generates a snapshot of the current V8 heap and returns a Readable Stream that may be used to read the JSON serialized representation. This JSON stream format is intended to be used with tools such as Chrome DevTools. The JSON schema is undocumented and specific to the V8 engine. Therefore, the schema may change from one version of V8 to the next. Creating a heap snapshot requires memory about twice the size of the heap at the time the snapshot is created. This results in the risk of OOM killers terminating the process. Generating a snapshot is a synchronous operation which blocks the event loop for a duration depending on the heap size. ```mjs // Print heap snapshot to the console import { getHeapSnapshot } from 'node:v8'; import process from 'node:process'; const stream = getHeapSnapshot(); stream.pipe(process.stdout); ``` ```js // Print heap snapshot to the console const v8 = require('node:v8'); const process = require('node:process'); const stream = v8.getHeapSnapshot(); stream.pipe(process.stdout); ``` ## `v8.getHeapSpaceStatistics()` \* Returns: {Object\[]} Returns statistics about the V8 heap spaces, i.e. the segments which make up the V8 heap. Neither the ordering of heap spaces, nor the availability of a heap space can be guaranteed as the statistics are provided via the V8 [`GetHeapSpaceStatistics`][] function and may change from one V8 version to the next. The value returned is an array of objects containing the following properties: \* `space\_name` {string} \* `space\_size` {number} \* `space\_used\_size` {number} \* `space\_available\_size` {number} \* `physical\_space\_size` {number} ```json [ { "space\_name": "new\_space", "space\_size": 2063872, "space\_used\_size": 951112, "space\_available\_size": 80824, "physical\_space\_size": 2063872 }, { "space\_name": "old\_space", "space\_size": 3090560, "space\_used\_size": 2493792, "space\_available\_size": 0, "physical\_space\_size": 3090560 }, { "space\_name": "code\_space", "space\_size": 1260160, "space\_used\_size": 644256, "space\_available\_size": 960, "physical\_space\_size": 1260160 }, { "space\_name": "map\_space", "space\_size": 1094160, "space\_used\_size": 201608, "space\_available\_size": 0, "physical\_space\_size": 1094160 }, { "space\_name": "large\_object\_space", "space\_size": 0, "space\_used\_size": 0, "space\_available\_size": 1490980608, "physical\_space\_size": 0 } ] ``` ## `v8.getHeapStatistics()` \* Returns: {Object} Returns an object with the following properties: \* `total\_heap\_size` {number} \* `total\_heap\_size\_executable` {number} \* `total\_physical\_size` {number} \* `total\_available\_size` {number} \* `used\_heap\_size` {number} \* `heap\_size\_limit` {number} \* `malloced\_memory` {number} \* `peak\_malloced\_memory` {number} \* `does\_zap\_garbage` {number} \* `number\_of\_native\_contexts` {number} \* `number\_of\_detached\_contexts` {number} \* `total\_global\_handles\_size` {number} \* `used\_global\_handles\_size` {number} \* `external\_memory` {number} \* `total\_allocated\_bytes` {number} `total\_heap\_size` The value of total\\_heap\\_size is the number of bytes V8 has allocated for the heap. This can grow if used\\_heap needs more memory. `total\_heap\_size\_executable` The value of
https://github.com/nodejs/node/blob/main//doc/api/v8.md
main
nodejs
[ -0.01427454873919487, 0.0024481150321662426, -0.009356596507132053, 0.02371092140674591, 0.09149491041898727, -0.03126636520028114, -0.04657551646232605, -0.0168913621455431, -0.034773558378219604, -0.055567417293787, -0.04972729831933975, -0.009350868873298168, -0.11099175363779068, -0.05252603068947792, 0.05254955589771271, -0.017762769013643265, 0.11051253229379654, 0.007803481537848711, 0.02317032217979431, -0.05933782085776329, -0.05399977043271065, 0.000009757521183928475, 0.02581595815718174, 0.017988793551921844, 0.06405738741159439, 0.012692649848759174, -0.054997775703668594, -0.011068218387663364, 0.05176568776369095, -0.014558698050677776, -0.023516608402132988, -0.04767782613635063, -0.04592854157090187, 0.016934024170041084, 0.014856627210974693, 0.0760173350572586, -0.05644868314266205, -0.11419802904129028, -0.04024449735879898, 0.026302684098482132, 0.0027391300536692142, 0.0934486985206604, -0.06046965718269348, -0.03700074553489685, 0.06841172277927399, 0.01611383631825447, -0.07624056190252304, 0.05387235805392265, -0.16085529327392578, -0.004562911577522755, 0.020182160660624504, -0.06263013184070587, -0.021443458274006844, -0.03212222084403038, -0.00713778380304575, -0.017891887575387955, -0.0379800908267498, 0.021582258865237236, 0.013269743882119656, 0.1143115684390068, -0.03191816061735153, -0.021987522020936012, 0.053576841950416565, -0.02218628115952015, 0.0456329807639122, -0.01700521633028984, 0.06193700060248375, -0.0878911241889, 0.026771308854222298, -0.014194447547197342, -0.033790163695812225, 0.03474128618836403, 0.056029681116342545, -0.024067016318440437, -0.07064834237098694, 0.0005305962986312807, -0.023963062092661858, 0.03380178287625313, 0.06339969485998154, -0.08330913633108139, -0.04255418851971626, -0.09568323194980621, -0.08175245672464371, 0.055713530629873276, -0.017127204686403275, 0.04596303403377533, 0.03813784569501877, 0.012676283717155457, 0.07506502419710159, 0.07372494786977768, -0.02762608975172043, -0.024971062317490578, -0.004905606620013714, 0.041566330939531326, -0.008883995935320854, 0.01575295440852642, 0.037666257470846176, 0.07086843252182007, 0.00862895231693983, 0.014636620879173279, -0.01028862502425909, 0.013495624996721745, 0.048554155975580215, 0.06307128071784973, 0.04277938976883888, 0.06287486851215363, 0.0018081727903336287, 0.006441437639296055, -0.007708580698817968, -0.03349009156227112, 0.06781662255525589, 0.058549314737319946, 0.025141751393675804, -0.06069564446806908, -0.026858877390623093, -0.059837229549884796, 0.048407938331365585, -0.06649073213338852, 0.0731511116027832, 0.14177174866199493, 0.10277862101793289, -0.013437504880130291, 0.03634526580572128, -0.02259622886776924, -0.018440740182995796, -0.010983851738274097, -0.01328913401812315, 1.1326127760817712e-33, 0.0024498908314853907, -0.03672055900096893, 0.0065771108493208885, 0.06916401535272598, 0.019411461427807808, 0.0026350996922701597, -0.0020222419407218695, 0.014328218065202236, -0.10701373219490051, 0.030696649104356766, -0.05434105172753334, 0.02496420592069626, -0.017810871824622154, 0.00863555446267128, 0.03044140338897705, 0.027976658195257187, 0.028600264340639114, -0.06053571403026581, 0.015989748761057854, 0.01829998753964901, 0.04308751970529556, 0.013154358603060246, -0.044492512941360474, 0.019978443160653114, 0.029093559831380844, 0.007877371273934841, 0.0014550407649949193, -0.008536453358829021, -0.0567588210105896, -0.0013989575672894716, 0.015444074757397175, 0.04136912152171135, -0.044604264199733734, 0.046019911766052246, -0.028119979426264763, -0.04393656924366951, -0.02890741266310215, -0.028511101379990578, -0.0652913898229599, 0.020342757925391197, 0.052811168134212494, 0.0711255669593811, -0.08005807548761368, -0.08876010775566101, -0.01253174152225256, -0.05356317386031151, -0.059654656797647476, -0.011320755816996098, 0.05235837399959564, -0.024594750255346298, -0.006265735253691673, 0.0462249219417572, 0.03521488234400749, -0.06308062374591827, 0.029934421181678772, 0.03223690763115883, 0.09533946961164474, -0.006853769533336163, 0.019118882715702057, 0.027127044275403023, 0.00981350801885128, -0.0021229239646345377, -0.006860884837806225, -0.010936354286968708, -0.035196494311094284, 0.07455102354288101, -0.019204281270503998, -0.013727794401347637, 0.027150942012667656, 0.034578364342451096, -0.01874159462749958, 0.0082297557964921, -0.0028759983833879232, 0.01978836953639984, 0.020585695281624794, -0.007138068787753582, -0.11432690918445587, -0.033532559871673584, -0.04402677342295647, -0.06142716482281685, 0.060542959719896317, -0.0035755247808992863, -0.04019056633114815, 0.06148861348628998, -0.009201643988490105, -0.043338384479284286, -0.04526679217815399, 0.0227101668715477, 0.08368096500635147, 0.07054327428340912, 0.08635056018829346, -0.041815340518951416, -0.0012277800124138594, -0.03927970305085182, -0.08921445906162262, -3.3225200889198104e-33, -0.030821971595287323, 0.015301164239645004, -0.07416288554668427, 0.15667679905891418, -0.08676905184984207, -0.07310495525598526, -0.007479168474674225, -0.04401373490691185, -0.04543978348374367, -0.04446624591946602, 0.0013355357805266976, 0.025712452828884125, -0.04403522610664368, 0.06520915776491165, 0.04321535304188728, 0.10110488533973694, -0.1256546974182129, -0.08549132943153381, 0.024597838521003723, 0.02513454109430313, -0.027853546664118767, 0.011697595939040184, 0.06761231273412704, 0.04390046373009682, 0.012592840008437634, -0.023745210841298103, -0.024879660457372665, -0.027425915002822876, 0.05791306123137474, -0.11284614354372025, -0.05409886687994003, 0.0795719176530838, -0.05447764694690704, 0.025879671797156334, 0.05518855154514313, -0.04561559483408928, 0.06683626025915146, 0.02260746993124485, 0.017664335668087006, 0.033716414123773575, 0.020346054807305336, 0.0058926683850586414, -0.03546842187643051, 0.031390927731990814, 0.010342450812458992, 0.06923386454582214, 0.04866711050271988, 0.01482311636209488, 0.017935860902071, -0.033777348697185516, 0.03228180855512619, -0.05801861733198166, 0.029988959431648254, 0.07653547078371048, -0.05539710074663162, -0.03977309539914131, -0.04506223648786545, -0.002462204545736313, 0.019783370196819305, 0.0703740268945694, 0.06384757906198502, -0.1010173112154007, -0.03252967819571495, -0.06569778919219971, -0.0431465283036232, -0.011740103363990784, -0.09805654734373093, -0.020742958411574364, 0.08971330523490906, 0.01128880213946104, -0.008616245351731777, -0.08701696246862411, 0.01653999090194702, -0.06447915732860565, -0.10355152189731598, -0.030851179733872414, 0.049994487315416336, -0.1290653795003891, 0.010549348779022694, -0.032374702394008636, -0.05200972780585289, 0.07466632127761841, 0.010124457068741322, -0.028864795342087746, 0.02659972943365574, 0.01312532089650631, -0.03922741115093231, 0.03697400912642479, -0.010578573681414127, -0.004449842963367701, 0.017280621454119682, 0.013521316461265087, -0.19341608881950378, -0.051714520901441574, -0.030292728915810585, -4.977873047096182e-8, 0.010167299769818783, -0.00576613238081336, -0.13326747715473175, 0.029387690126895905, 0.07444874197244644, 0.016303326934576035, 0.016662167385220528, 0.01142879854887724, 0.08116966485977173, 0.04588617384433746, 0.06750407814979553, 0.014827974140644073, 0.03272533416748047, 0.023288141936063766, 0.033475227653980255, 0.05739178881049156, -0.04461866244673729, 0.021441081538796425, -0.010045381262898445, 0.00898102205246687, -0.03816266730427742, 0.06254345178604126, -0.0022065038792788982, 0.025684863328933716, -0.014529945328831673, -0.10188830643892288, 0.004855395294725895, 0.08969803154468536, 0.01747840642929077, 0.010757762007415295, -0.0494837649166584, 0.0765552893280983, 0.050819337368011475, -0.06560569256544113, 0.047156743705272675, 0.03392947465181351, 0.0061984979547560215, 0.056043900549411774, 0.12024810165166855, 0.023699630051851273, 0.05138450115919113, -0.010836213827133179, -0.07443252205848694, 0.023802274838089943, -0.03412846475839615, -0.03719768673181534, -0.036654118448495865, -0.01086664292961359, -0.044538162648677826, -0.005350162740796804, 0.04021009802818298, -0.002670375630259514, -0.055077336728572845, 0.04170491546392441, -0.030371399596333504, -0.0479544922709465, 0.0021905351895838976, -0.07557830959558487, 0.004096492193639278, -0.038496922701597214, 0.05202609300613403, -0.03810799866914749, 0.10175084322690964, -0.0981316789984703 ]
0.060243
{number} \* `does\_zap\_garbage` {number} \* `number\_of\_native\_contexts` {number} \* `number\_of\_detached\_contexts` {number} \* `total\_global\_handles\_size` {number} \* `used\_global\_handles\_size` {number} \* `external\_memory` {number} \* `total\_allocated\_bytes` {number} `total\_heap\_size` The value of total\\_heap\\_size is the number of bytes V8 has allocated for the heap. This can grow if used\\_heap needs more memory. `total\_heap\_size\_executable` The value of total\\_heap\\_size\\_executable is the portion of the heap that can contain executable code, in bytes. This includes memory used by JIT-compiled code and any memory that must be kept executable. `total\_physical\_size` The value of total\\_physical\\_size is the actual physical memory used by the V8 heap, in bytes. This is the amount of memory that is committed (or in use) rather than reserved. `total\_available\_size` The value of total\\_available\\_size is the number of bytes of memory available to the V8 heap. This value represents how much more memory V8 can use before it exceeds the heap limit. `used\_heap\_size` The value of used\\_heap\\_size is number of bytes currently being used by V8’s JavaScript objects. This is the actual memory in use and does not include memory that has been allocated but not yet used. `heap\_size\_limit` The value of heap\\_size\\_limit is the maximum size of the V8 heap, in bytes (either the default limit, determined by system resources, or the value passed to the `--max\_old\_space\_size` option). `malloced\_memory` The value of malloced\\_memory is the number of bytes allocated through `malloc` by V8. `peak\_malloced\_memory` The value of peak\\_malloced\\_memory is the peak number of bytes allocated through `malloc` by V8 during the lifetime of the process. `does\_zap\_garbage` is a 0/1 boolean, which signifies whether the `--zap\_code\_space` option is enabled or not. This makes V8 overwrite heap garbage with a bit pattern. The RSS footprint (resident set size) gets bigger because it continuously touches all heap pages and that makes them less likely to get swapped out by the operating system. `number\_of\_native\_contexts` The value of native\\_context is the number of the top-level contexts currently active. Increase of this number over time indicates a memory leak. `number\_of\_detached\_contexts` The value of detached\\_context is the number of contexts that were detached and not yet garbage collected. This number being non-zero indicates a potential memory leak. `total\_global\_handles\_size` The value of total\\_global\\_handles\\_size is the total memory size of V8 global handles. `used\_global\_handles\_size` The value of used\\_global\\_handles\\_size is the used memory size of V8 global handles. `external\_memory` The value of external\\_memory is the memory size of array buffers and external strings. `total\_allocated\_bytes` The value of total allocated bytes since the Isolate creation ```js { total\_heap\_size: 7326976, total\_heap\_size\_executable: 4194304, total\_physical\_size: 7326976, total\_available\_size: 1152656, used\_heap\_size: 3476208, heap\_size\_limit: 1535115264, malloced\_memory: 16384, peak\_malloced\_memory: 1127496, does\_zap\_garbage: 0, number\_of\_native\_contexts: 1, number\_of\_detached\_contexts: 0, total\_global\_handles\_size: 8192, used\_global\_handles\_size: 3296, external\_memory: 318824 } ``` ## `v8.getCppHeapStatistics([detailLevel])` Retrieves [CppHeap][] statistics regarding memory consumption and utilization using the V8 [`CollectStatistics()`][] function which may change from one V8 version to the next. \* `detailLevel` {string|undefined}: \*\*Default:\*\* `'detailed'`. Specifies the level of detail in the returned statistics. Accepted values are: \* `'brief'`: Brief statistics contain only the top-level allocated and used memory statistics for the entire heap. \* `'detailed'`: Detailed statistics also contain a break down per space and page, as well as freelist statistics and object type histograms. It returns an object with a structure similar to the [`cppgc::HeapStatistics`][] object. See the [V8 documentation][`cppgc::HeapStatistics struct`] for more information about the properties of the object. ```js // Detailed ({ committed\_size\_bytes: 131072, resident\_size\_bytes: 131072, used\_size\_bytes: 152, space\_statistics: [ { name: 'NormalPageSpace0', committed\_size\_bytes: 0, resident\_size\_bytes: 0, used\_size\_bytes: 0, page\_stats: [{}], free\_list\_stats: {}, }, { name: 'NormalPageSpace1', committed\_size\_bytes: 131072, resident\_size\_bytes: 131072, used\_size\_bytes: 152, page\_stats: [{}], free\_list\_stats: {}, }, { name: 'NormalPageSpace2', committed\_size\_bytes: 0, resident\_size\_bytes: 0, used\_size\_bytes: 0, page\_stats: [{}], free\_list\_stats: {}, },
https://github.com/nodejs/node/blob/main//doc/api/v8.md
main
nodejs
[ -0.026216378435492516, 0.011359925381839275, -0.04742491990327835, 0.004414656665176153, -0.03175569698214531, -0.027966096997261047, 0.0929083377122879, 0.11493165045976639, 0.021582994610071182, -0.03239307552576065, -0.011326245032250881, -0.049907054752111435, 0.08154699951410294, -0.01850571483373642, -0.013659908436238766, 0.007435082923620939, -0.005424388684332371, -0.017970995977520943, -0.060474105179309845, 0.007954495027661324, 0.06579601764678955, 0.03657563030719757, 0.003884534817188978, -0.009316377341747284, -0.005707046017050743, 0.05022662878036499, -0.07915748655796051, 0.045192085206508636, 0.12280476093292236, -0.02529291622340679, 0.020394625142216682, 0.14371562004089355, 0.046134527772665024, -0.03059212490916252, 0.08545996248722076, 0.052443213760852814, -0.02033313550055027, -0.02187044359743595, -0.06889592856168747, 0.02991918846964836, 0.032774437218904495, 0.11746077239513397, -0.013162825256586075, 0.041616860777139664, 0.03702262416481972, 0.060024913400411606, -0.03883694112300873, 0.03938142955303192, -0.1144515872001648, -0.06095670908689499, 0.03175486624240875, 0.04655487462878227, -0.058390963822603226, 0.06251958757638931, 0.05732666328549385, -0.04070650041103363, 0.044384926557540894, -0.013239533640444279, -0.09638956189155579, 0.12030737847089767, -0.06565717607736588, 0.029214218258857727, -0.013894050382077694, -0.07943118363618851, -0.021239925175905228, -0.02479996532201767, 0.08371210843324661, -0.03799600154161453, -0.02950271964073181, 0.005037363618612289, -0.04867186397314072, 0.04497847706079483, -0.015348106622695923, 0.04329461604356766, -0.034264903515577316, -0.02298072725534439, -0.02231719344854355, 0.031841862946748734, -0.02446592226624489, -0.09491115808486938, 0.013370280154049397, -0.01608157716691494, -0.006859582848846912, -0.02176356501877308, -0.008768892847001553, 0.012632505036890507, 0.04137594997882843, -0.00004219531183480285, 0.011906137689948082, 0.05588410422205925, 0.01304191630333662, -0.006626718677580357, -0.018328802660107613, 0.03401884436607361, 0.07801208645105362, 0.03957232087850571, -0.013654121197760105, -0.002929010661318898, 0.031850386410951614, -0.004919868893921375, 0.04085967317223549, 0.03816480189561844, 0.07228787988424301, 0.054613690823316574, -0.02596398815512657, -0.043976545333862305, -0.043961819261312485, 0.05311154946684837, -0.002772353123873472, -0.01209218055009842, 0.06600424647331238, -0.05432911589741707, -0.031048808246850967, 0.004868329036980867, 0.051736317574977875, 0.0020537658128887415, 0.024374917149543762, -0.021867400035262108, 0.01795162633061409, 0.0055516790598630905, 0.015554358251392841, -0.0007894347072578967, -0.02117213048040867, -0.03679947555065155, -0.09486820548772812, -0.024902360513806343, -0.04570012539625168, -5.293303591656563e-33, -0.027017412707209587, -0.10895664244890213, -0.01901017129421234, 0.03247958794236183, -0.05523015931248665, 0.012573475018143654, -0.02748093008995056, 0.06016997620463371, 0.04876217991113663, 0.05879365652799606, -0.027350276708602905, 0.0475207082927227, 0.005603048950433731, 0.04745614156126976, 0.1076134517788887, 0.013356477953493595, -0.0033139155711978674, 0.06160551309585571, -0.03463951125741005, -0.0129021555185318, 0.02252986840903759, 0.09194780886173248, -0.0582895465195179, -0.002697394695132971, 0.017985938116908073, -0.0036426051519811153, -0.0026759847532957792, -0.03385751321911812, -0.053858064115047455, 0.0009913448011502624, -0.0031529536936432123, -0.04445797577500343, -0.07054034620523453, -0.015612670220434666, 0.12505249679088593, -0.05031554400920868, -0.04750705882906914, -0.01921321079134941, -0.026246119290590286, -0.07432407885789871, 0.022685131058096886, 0.021551892161369324, -0.04774025082588196, -0.017709549516439438, -0.08121666312217712, -0.08797786384820938, 0.008752238936722279, -0.027251096442341805, -0.014673823490738869, 0.010922707617282867, 0.034470170736312866, 0.030599230900406837, 0.06296251714229584, 0.03449811786413193, -0.010610757395625114, 0.04029998183250427, 0.0037201372906565666, -0.005985189229249954, 0.00980167742818594, 0.11428278684616089, -0.01969696395099163, 0.006789050996303558, 0.019443633034825325, 0.055355753749608994, 0.04405795782804489, 0.03180595859885216, 0.019156813621520996, -0.012706187553703785, 0.006792132742702961, 0.022074375301599503, -0.024945814162492752, -0.00025609537260606885, 0.06556317210197449, 0.045210592448711395, -0.05964123457670212, -0.003368319710716605, 0.08160088956356049, -0.050071459263563156, -0.09792222082614899, 0.0127061503008008, -0.007680914364755154, 0.018039574846625328, -0.015998907387256622, -0.049584291875362396, -0.06887991726398468, -0.0016798444557935, 0.03712065890431404, -0.06901658326387405, 0.014318003319203854, -0.011351780965924263, 0.08253274857997894, -0.0621652714908123, -0.07676887512207031, -0.06271278858184814, -0.1397472620010376, 2.1727152487797824e-33, 0.0198441743850708, 0.07074705511331558, -0.051641251891851425, 0.008842434734106064, -0.07220671325922012, -0.05407344922423363, 0.015968915075063705, 0.023443881422281265, -0.01664048805832863, -0.04790998995304108, -0.07014074921607971, 0.0992087572813034, 0.10487376153469086, 0.005345987621694803, 0.015679288655519485, 0.009002352133393288, -0.08612912893295288, -0.040677450597286224, -0.022793864831328392, 0.05570073425769806, 0.05049481987953186, -0.008914995938539505, 0.062130555510520935, -0.00909068901091814, -0.02772354707121849, -0.01930365152657032, -0.08265101164579391, -0.04844559729099274, 0.04221561923623085, -0.02468930557370186, 0.08040658384561539, -0.07662372291088104, -0.007672356441617012, 0.02677580714225769, -0.0589648112654686, -0.1401481181383133, 0.11829173564910889, -0.007306634448468685, -0.007775261532515287, -0.01988387480378151, 0.039690423756837845, 0.058018751442432404, 0.034946098923683167, 0.0029868250712752342, 0.0021271102596074343, 0.061571333557367325, -0.05633500963449478, -0.05661563575267792, 0.07852502912282944, -0.11525281518697739, 0.06014503911137581, 0.07067878544330597, -0.028657888993620872, 0.02154616080224514, -0.0165777038782835, -0.041841987520456314, 0.012444848194718361, 0.025718357414007187, 0.019060224294662476, -0.006517436355352402, 0.056691743433475494, -0.09316471219062805, -0.0629044845700264, -0.021428504958748817, -0.07329335808753967, 0.007671225816011429, -0.04106738045811653, -0.09160163998603821, -0.1033211275935173, -0.005220958963036537, -0.0666336640715599, 0.007639821618795395, -0.035760022699832916, -0.03712104260921478, -0.12267865985631943, 0.04669969528913498, -0.010592454113066196, -0.06955375522375107, 0.03957575932145119, -0.0014236036222428083, -0.048579227179288864, 0.04945666342973709, -0.011665035970509052, -0.0018126977374777198, -0.07943542301654816, -0.05890543758869171, -0.015602294355630875, 0.00998286809772253, -0.03265838325023651, -0.042942922562360764, 0.0002381671074545011, 0.009124997071921825, -0.0986616313457489, 0.03228552266955376, -0.005724103190004826, -4.526667751747482e-8, 0.054950326681137085, -0.08067169040441513, -0.00022487013484351337, 0.036085840314626694, 0.04943569377064705, -0.057656627148389816, 0.02112177200615406, 0.08843034505844116, 0.07137224078178406, 0.08663041144609451, 0.06448619067668915, -0.0009550365502946079, -0.110411636531353, -0.01919235847890377, 0.008363714441657066, 0.04219577834010124, -0.03818203881382942, -0.07816042006015778, 0.013212156482040882, -0.035440512001514435, 0.040806882083415985, -0.000059323556342860684, 0.00203887396492064, 0.021956223994493484, 0.011324366554617882, -0.07073826342821121, 0.04129495471715927, 0.10011831670999527, -0.03542696684598923, -0.026866117492318153, 0.11618351936340332, 0.04229030758142471, -0.016403276473283768, -0.023308325558900833, -0.03691139072179794, 0.018689585849642754, -0.009376388043165207, 0.067361019551754, 0.042340558022260666, 0.07501193135976791, -0.032162848860025406, -0.014136462472379208, -0.017700888216495514, 0.062192779034376144, 0.07441157847642899, 0.023231346160173416, -0.1165843978524208, 0.012088637799024582, -0.0738765075802803, -0.05629461258649826, 0.0335964672267437, 0.04078657180070877, -0.011363460682332516, 0.10327694565057755, 0.011330585926771164, 0.0017078957753255963, -0.048247985541820526, -0.028373071923851967, 0.009539581835269928, 0.09363175183534622, -0.05710029602050781, 0.03302177041769028, 0.05755883455276489, -0.04675164446234703 ]
0.172115
committed\_size\_bytes: 131072, resident\_size\_bytes: 131072, used\_size\_bytes: 152, space\_statistics: [ { name: 'NormalPageSpace0', committed\_size\_bytes: 0, resident\_size\_bytes: 0, used\_size\_bytes: 0, page\_stats: [{}], free\_list\_stats: {}, }, { name: 'NormalPageSpace1', committed\_size\_bytes: 131072, resident\_size\_bytes: 131072, used\_size\_bytes: 152, page\_stats: [{}], free\_list\_stats: {}, }, { name: 'NormalPageSpace2', committed\_size\_bytes: 0, resident\_size\_bytes: 0, used\_size\_bytes: 0, page\_stats: [{}], free\_list\_stats: {}, }, { name: 'NormalPageSpace3', committed\_size\_bytes: 0, resident\_size\_bytes: 0, used\_size\_bytes: 0, page\_stats: [{}], free\_list\_stats: {}, }, { name: 'LargePageSpace', committed\_size\_bytes: 0, resident\_size\_bytes: 0, used\_size\_bytes: 0, page\_stats: [{}], free\_list\_stats: {}, }, ], type\_names: [], detail\_level: 'detailed', }); ``` ```js // Brief ({ committed\_size\_bytes: 131072, resident\_size\_bytes: 131072, used\_size\_bytes: 128864, space\_statistics: [], type\_names: [], detail\_level: 'brief', }); ``` ## `v8.queryObjects(ctor[, options])` \* `ctor` {Function} The constructor that can be used to search on the prototype chain in order to filter target objects in the heap. \* `options` {undefined|Object} \* `format` {string} If it's `'count'`, the count of matched objects is returned. If it's `'summary'`, an array with summary strings of the matched objects is returned. \* Returns: {number|Array} This is similar to the [`queryObjects()` console API][] provided by the Chromium DevTools console. It can be used to search for objects that have the matching constructor on its prototype chain in the heap after a full garbage collection, which can be useful for memory leak regression tests. To avoid surprising results, users should avoid using this API on constructors whose implementation they don't control, or on constructors that can be invoked by other parties in the application. To avoid accidental leaks, this API does not return raw references to the objects found. By default, it returns the count of the objects found. If `options.format` is `'summary'`, it returns an array containing brief string representations for each object. The visibility provided in this API is similar to what the heap snapshot provides, while users can save the cost of serialization and parsing and directly filter the target objects during the search. Only objects created in the current execution context are included in the results. ```cjs const { queryObjects } = require('node:v8'); class A { foo = 'bar'; } console.log(queryObjects(A)); // 0 const a = new A(); console.log(queryObjects(A)); // 1 // [ "A { foo: 'bar' }" ] console.log(queryObjects(A, { format: 'summary' })); class B extends A { bar = 'qux'; } const b = new B(); console.log(queryObjects(B)); // 1 // [ "B { foo: 'bar', bar: 'qux' }" ] console.log(queryObjects(B, { format: 'summary' })); // Note that, when there are child classes inheriting from a constructor, // the constructor also shows up in the prototype chain of the child // classes's prototype, so the child classes's prototype would also be // included in the result. console.log(queryObjects(A)); // 3 // [ "B { foo: 'bar', bar: 'qux' }", 'A {}', "A { foo: 'bar' }" ] console.log(queryObjects(A, { format: 'summary' })); ``` ```mjs import { queryObjects } from 'node:v8'; class A { foo = 'bar'; } console.log(queryObjects(A)); // 0 const a = new A(); console.log(queryObjects(A)); // 1 // [ "A { foo: 'bar' }" ] console.log(queryObjects(A, { format: 'summary' })); class B extends A { bar = 'qux'; } const b = new B(); console.log(queryObjects(B)); // 1 // [ "B { foo: 'bar', bar: 'qux' }" ] console.log(queryObjects(B, { format: 'summary' })); // Note that, when there are child classes inheriting from a constructor, // the constructor also shows up in the prototype chain of the child // classes's prototype, so the child classes's prototype would also be // included in the result. console.log(queryObjects(A)); // 3 // [ "B { foo: 'bar', bar: 'qux' }", 'A {}', "A { foo: 'bar' }" ] console.log(queryObjects(A, { format: 'summary' }));
https://github.com/nodejs/node/blob/main//doc/api/v8.md
main
nodejs
[ -0.02634606510400772, 0.015548608265817165, -0.06456861644983292, -0.013318773359060287, 0.042755138128995895, -0.05566954240202904, 0.06636132299900055, 0.0003107838274445385, -0.011643852107226849, 0.07326237857341766, 0.08140271157026291, -0.056151002645492554, 0.086843341588974, -0.010254055261611938, -0.012005388736724854, 0.0018254787428304553, -0.13744354248046875, 0.029153402894735336, -0.04219957813620567, -0.022516833618283272, 0.011854815296828747, 0.09358153492212296, 0.03678978979587555, 0.007003091275691986, 0.06602039933204651, -0.0013646540464833379, -0.05733408033847809, 0.04794485494494438, 0.0005583470338024199, -0.07480043172836304, 0.029280154034495354, 0.09098637104034424, 0.07541490346193314, 0.05364639312028885, 0.15408948063850403, 0.04711972922086716, -0.0028481066692620516, -0.050669651478528976, -0.057478584349155426, 0.002624072600156069, 0.018864590674638748, 0.006178387440741062, -0.02464568428695202, 0.038159728050231934, -0.06487882137298584, -0.010638679377734661, -0.0502806082367897, -0.014555788598954678, -0.03938210755586624, -0.07238011062145233, -0.08896532654762268, 0.04882819205522537, -0.09347265958786011, 0.06493418663740158, 0.013034053146839142, -0.039069417864084244, -0.019057536497712135, -0.03720036894083023, -0.09514159709215164, -0.014800997450947762, 0.014614636078476906, 0.015842409804463387, -0.029385216534137726, -0.03254057466983795, -0.05405101180076599, 0.0023080629762262106, -0.054671719670295715, 0.06638146191835403, 0.03280176222324371, 0.011146157048642635, -0.1058180183172226, 0.08522918075323105, -0.12840387225151062, 0.05107280984520912, 0.01207799557596445, -0.06105518341064453, -0.05259210243821144, 0.013341555371880531, -0.03020089492201805, -0.09245774149894714, -0.09969110786914825, -0.09430332481861115, 0.03607752174139023, 0.06241336092352867, -0.024679092690348625, -0.011589057743549347, -0.04658174514770508, 0.03251228854060173, 0.0019536602776497602, -0.026117026805877686, -0.05778975039720535, -0.009069623425602913, 0.07715121656656265, 0.00003415371975279413, -0.035402484238147736, 0.07895311713218689, 0.01380663551390171, -0.034487392753362656, 0.028840601444244385, 0.10313612967729568, -0.037182532250881195, 0.024526415392756462, 0.042944300919771194, -0.008981115184724331, 0.024815279990434647, 0.029116230085492134, 0.024652065709233284, -0.023760125041007996, -0.032825928181409836, -0.05870920792222023, 0.002182611497119069, 0.00822585541754961, -0.05866072326898575, 0.011374109424650669, -0.0015268032439053059, 0.0066403658129274845, -0.10078518837690353, 0.04045955091714859, 0.024161241948604584, 0.1073332205414772, 0.12220368534326553, -0.005996594205498695, -0.010164214298129082, -0.0015372294001281261, -0.043550945818424225, -0.04925517365336418, -0.033127088099718094, -3.25014017221163e-34, 0.053424056619405746, -0.039200279861688614, -0.027775609865784645, 0.04816184192895889, 0.0234683807939291, 0.08589832484722137, -0.004930139984935522, 0.043791864067316055, -0.02039109356701374, 0.05443140119314194, -0.00790625624358654, 0.04986073821783066, -0.002787066390737891, 0.07233688235282898, 0.07075300067663193, -0.02199174277484417, 0.018615813925862312, 0.11616189032793045, -0.002210193080827594, -0.007289848290383816, 0.06297899037599564, 0.099540114402771, -0.0521397665143013, -0.00561895314604044, 0.04697999358177185, -0.03675486892461777, -0.09808000922203064, -0.058808356523513794, -0.01514056883752346, -0.007586309686303139, 0.02011450007557869, 0.02860185317695141, 0.05372584983706474, 0.009929771535098553, 0.0701948031783104, 0.02573988027870655, -0.01970677636563778, -0.055260442197322845, -0.03496610373258591, -0.04518284648656845, -0.0033895899541676044, 0.031740181148052216, -0.012561180628836155, -0.0012778649106621742, -0.02762834168970585, -0.0642801895737648, -0.02790454588830471, -0.0738503634929657, -0.006642687134444714, 0.04260801896452904, 0.002266120398417115, 0.04714716225862503, -0.04529637098312378, 0.04474121332168579, -0.08257972449064255, -0.08650131523609161, -0.024335568770766258, 0.049002405256032944, 0.025529976934194565, 0.051089655607938766, -0.05605342239141464, 0.06606943160295486, -0.005203264765441418, -0.03818240761756897, 0.012855048291385174, -0.021458923816680908, 0.031498730182647705, 0.0453873872756958, 0.03496304526925087, 0.04112764447927475, -0.04843464493751526, 0.02126806601881981, 0.010331140831112862, -0.006594894919544458, -0.11787192523479462, -0.06234956905245781, 0.027174538001418114, -0.11764274537563324, -0.06711950153112411, -0.04010327532887459, 0.03488999232649803, -0.10434664040803909, -0.07163317501544952, 0.002525955205783248, -0.00964625459164381, -0.0500105582177639, 0.03459514304995537, -0.04557957500219345, -0.03315410017967224, -0.078834667801857, -0.07415218651294708, 0.0024082367308437824, 0.026867346838116646, -0.12539498507976532, -0.10819415003061295, -3.323146407003608e-33, 0.011146456003189087, 0.0008034859201870859, 0.029334165155887604, -0.010232732631266117, -0.017213666811585426, -0.006355455610901117, 0.04540200158953667, 0.02411763370037079, 0.03598910942673683, -0.005761660635471344, -0.014138025231659412, 0.033733706921339035, 0.07460884749889374, -0.06315340846776962, 0.057496409863233566, 0.03707467392086983, -0.046196646988391876, -0.008120495826005936, -0.0425773486495018, -0.0014618393033742905, -0.05906832963228226, 0.09275615215301514, 0.02927488274872303, 0.09577286243438721, 0.009038894437253475, -0.02110283449292183, -0.03630759194493294, -0.0028859509620815516, 0.005823062267154455, 0.04572996869683266, -0.0005703204078599811, 0.0015287123387679458, -0.13019907474517822, 0.04118870198726654, 0.008466403931379318, -0.10484842956066132, -0.027056841179728508, 0.11929769068956375, -0.061254262924194336, 0.010394785553216934, 0.07676395773887634, 0.03186502680182457, -0.005885194521397352, 0.03212614357471466, -0.046273019164800644, -0.025397850200533867, 0.02532876469194889, -0.03138982132077217, 0.009356003254652023, -0.03938250243663788, 0.03848765417933464, -0.00824873335659504, -0.0031798304989933968, -0.014753207564353943, 0.03534445911645889, 0.0075243376195430756, -0.031692445278167725, 0.0032744407653808594, -0.04768909513950348, -0.06150060519576073, 0.005085973534733057, 0.0054028891026973724, -0.08040120452642441, 0.030512725934386253, 0.08330370485782623, -0.05110199376940727, -0.14287035167217255, -0.036698393523693085, -0.09005296230316162, 0.03197408840060234, 0.018744945526123047, 0.046213939785957336, -0.04759962111711502, -0.02198096551001072, -0.011334585025906563, 0.032728031277656555, 0.0036980637814849615, -0.03319307789206505, -0.009635156020522118, 0.07019190490245819, -0.06898190081119537, 0.04786986485123634, 0.012936897575855255, 0.00047886805259622633, -0.03191026300191879, -0.055800311267375946, -0.01733699068427086, 0.07544302940368652, 0.0050499713979661465, -0.01858416013419628, -0.005100914277136326, 0.031049711629748344, 0.034114085137844086, 0.055011529475450516, 0.051283542066812515, -3.7189181512076175e-8, -0.08427263796329498, -0.04494517669081688, -0.009676733054220676, 0.08016495406627655, 0.08722323924303055, 0.0213254913687706, 0.04477103054523468, 0.0432904027402401, 0.0017972876084968448, -0.030230632051825523, 0.09146398305892944, -0.004765463061630726, -0.058816321194171906, -0.053957875818014145, 0.045342523604631424, -0.019293874502182007, -0.0759713426232338, -0.002934699645265937, -0.05106408894062042, -0.021588576957583427, -0.012019721791148186, 0.013661814853549004, -0.006357836537063122, 0.004281046334654093, -0.04242180287837982, 0.006074634380638599, 0.047126952558755875, 0.061012737452983856, -0.007128773257136345, 0.04508616030216217, 0.11416728049516678, -0.04334487393498421, 0.04002277925610542, -0.06168140098452568, 0.011859139427542686, 0.00986497476696968, -0.009714914485812187, 0.0323251448571682, -0.030467599630355835, 0.010851314291357994, -0.03580557182431221, 0.04346441850066185, -0.01474267803132534, 0.08932767063379288, 0.07239548116922379, -0.10076446831226349, -0.0236160047352314, 0.04169386625289917, 0.06850598007440567, -0.10559870302677155, 0.008736271411180496, -0.018006641417741776, -0.017036501318216324, 0.04236522689461708, -0.03317708149552345, 0.05402278155088425, 0.05685606226325035, 0.1032850593328476, -0.03076951391994953, 0.014309949241578579, 0.053725969046354294, -0.017496787011623383, 0.006114785093814135, 0.015683313831686974 ]
0.101726
shows up in the prototype chain of the child // classes's prototype, so the child classes's prototype would also be // included in the result. console.log(queryObjects(A)); // 3 // [ "B { foo: 'bar', bar: 'qux' }", 'A {}', "A { foo: 'bar' }" ] console.log(queryObjects(A, { format: 'summary' })); ``` ## `v8.setFlagsFromString(flags)` \* `flags` {string} The `v8.setFlagsFromString()` method can be used to programmatically set V8 command-line flags. This method should be used with care. Changing settings after the VM has started may result in unpredictable behavior, including crashes and data loss; or it may simply do nothing. The V8 options available for a version of Node.js may be determined by running `node --v8-options`. Usage: ```mjs import { setFlagsFromString } from 'node:v8'; import { setInterval } from 'node:timers'; // setFlagsFromString to trace garbage collection events setFlagsFromString('--trace-gc'); // Trigger GC events by using some memory let arrays = []; const interval = setInterval(() => { for (let i = 0; i < 500; i++) { arrays.push(new Array(10000).fill(Math.random())); } if (arrays.length > 5000) { arrays = arrays.slice(-1000); } console.log(`\n\* Created ${arrays.length} arrays\n`); }, 100); // setFlagsFromString to stop tracing GC events after 1.5 seconds setTimeout(() => { setFlagsFromString('--notrace-gc'); console.log('\nStopped tracing!\n'); }, 1500); // Stop triggering GC events altogether after 2.5 seconds setTimeout(() => { clearInterval(interval); }, 2500); ``` ```cjs const { setFlagsFromString } = require('node:v8'); const { setInterval } = require('node:timers'); // setFlagsFromString to trace garbage collection events setFlagsFromString('--trace-gc'); // Trigger GC events by using some memory let arrays = []; const interval = setInterval(() => { for (let i = 0; i < 500; i++) { arrays.push(new Array(10000).fill(Math.random())); } if (arrays.length > 5000) { arrays = arrays.slice(-1000); } console.log(`\n\* Created ${arrays.length} arrays\n`); }, 100); // setFlagsFromString to stop tracing GC events after 1.5 seconds setTimeout(() => { console.log('\nStopped tracing!\n'); setFlagsFromString('--notrace-gc'); }, 1500); // Stop triggering GC events altogether after 2.5 seconds setTimeout(() => { clearInterval(interval); }, 2500); ``` ## `v8.stopCoverage()` The `v8.stopCoverage()` method allows the user to stop the coverage collection started by [`NODE\_V8\_COVERAGE`][], so that V8 can release the execution count records and optimize code. This can be used in conjunction with [`v8.takeCoverage()`][] if the user wants to collect the coverage on demand. ## `v8.takeCoverage()` The `v8.takeCoverage()` method allows the user to write the coverage started by [`NODE\_V8\_COVERAGE`][] to disk on demand. This method can be invoked multiple times during the lifetime of the process. Each time the execution counter will be reset and a new coverage report will be written to the directory specified by [`NODE\_V8\_COVERAGE`][]. When the process is about to exit, one last coverage will still be written to disk unless [`v8.stopCoverage()`][] is invoked before the process exits. ## `v8.writeHeapSnapshot([filename[,options]])` \* `filename` {string} The file path where the V8 heap snapshot is to be saved. If not specified, a file name with the pattern `'Heap-${yyyymmdd}-${hhmmss}-${pid}-${thread\_id}.heapsnapshot'` will be generated, where `{pid}` will be the PID of the Node.js process, `{thread\_id}` will be `0` when `writeHeapSnapshot()` is called from the main Node.js thread or the id of a worker thread. \* `options` {Object} \* `exposeInternals` {boolean} If true, expose internals in the heap snapshot. \*\*Default:\*\* `false`. \* `exposeNumericValues` {boolean} If true, expose numeric values in artificial fields. \*\*Default:\*\* `false`. \* Returns: {string} The filename where the snapshot was saved. Generates a snapshot of the current V8 heap and writes it to a JSON file. This file is intended to be used with tools such as Chrome DevTools. The JSON schema is undocumented and specific to the V8 engine, and may change from one version of V8 to the next. A heap snapshot is specific to a single V8 isolate.
https://github.com/nodejs/node/blob/main//doc/api/v8.md
main
nodejs
[ -0.07225476205348969, 0.07013271749019623, -0.009787851944565773, 0.07509446889162064, -0.05550144985318184, 0.025694718584418297, 0.010334349237382412, 0.050855617970228195, -0.020549563691020012, -0.0155415628105402, -0.04197714105248451, -0.008322087116539478, -0.04643123969435692, -0.04616253823041916, 0.07774624228477478, 0.060834623873233795, -0.013977717608213425, -0.0013536384794861078, -0.030815375968813896, -0.02560610882937908, 0.028726747259497643, 0.02131393738090992, 0.051121216267347336, 0.004486192017793655, -0.04072681441903114, 0.0335664339363575, -0.0408327579498291, -0.01606304943561554, 0.033801738172769547, -0.021264903247356415, -0.023968391120433807, 0.009340410120785236, -0.07797163724899292, 0.09071889519691467, -0.040642738342285156, 0.04041455313563347, 0.032633550465106964, -0.06664010882377625, -0.02583363465964794, -0.0178912952542305, 0.05917434021830559, 0.1065029501914978, -0.10742000490427017, -0.033541858196258545, 0.021653972566127777, 0.03434309363365173, -0.08891221880912781, -0.017250200733542442, -0.008411089889705181, -0.06025685742497444, 0.0034365856554359198, -0.06995991617441177, -0.020227355882525444, -0.006600288674235344, 0.011459839530289173, 0.0495891235768795, -0.051897719502449036, -0.013715196400880814, 0.04457439109683037, 0.05916941538453102, -0.08744208514690399, 0.056175656616687775, 0.0663447380065918, -0.006721199955791235, 0.07322563976049423, 0.0037111956626176834, 0.07213766872882843, 0.03762837126851082, 0.021310515701770782, 0.07419873028993607, -0.01805640012025833, 0.030968904495239258, 0.002725477796047926, 0.041746318340301514, -0.04432394728064537, 0.057014282792806625, -0.03192155808210373, -0.014833045192062855, -0.007533915340900421, -0.023342950269579887, -0.08929061144590378, -0.09006772935390472, -0.04081610217690468, 0.09952406585216522, -0.022526940330863, 0.07870582491159439, 0.021804070100188255, -0.13069875538349152, 0.024404512718319893, 0.057477958500385284, -0.13098563253879547, -0.11405352503061295, -0.0269126258790493, 0.03237088769674301, 0.00188786955550313, 0.039053212851285934, 0.013967187143862247, -0.05510127916932106, 0.033785879611968994, 0.029653767123818398, -0.005610832013189793, 0.02010674588382244, 0.1015305444598198, -0.0030998087022453547, -0.018340932205319405, 0.023903291672468185, -0.04369347542524338, -0.047024961560964584, -0.03638136759400368, -0.0035495352931320667, 0.0014364379458129406, 0.06977482885122299, -0.010899881832301617, -0.06141629070043564, -0.05195298045873642, -0.016584841534495354, 0.11763256788253784, -0.07539290189743042, 0.05542197450995445, 0.14075300097465515, 0.1580628901720047, 0.06391666829586029, 0.022289186716079712, -0.02516082301735878, 0.023075396195054054, -0.05124747008085251, -0.04337955638766289, 1.51232757344011e-33, 0.03811377286911011, -0.060306616127491, -0.008811530657112598, 0.0833459123969078, 0.03144924342632294, 0.09480353444814682, 0.03103262558579445, 0.09371048212051392, -0.0894840806722641, 0.07682929188013077, -0.036263033747673035, 0.020502762869000435, 0.008318332023918629, -0.08152014762163162, 0.08242376893758774, 0.022284822538495064, -0.022345809265971184, -0.029063601046800613, -0.04892190918326378, 0.017496468499302864, -0.05748379975557327, 0.011454266496002674, -0.009599793702363968, 0.04459092393517494, 0.04980773478746414, 0.0338829942047596, 0.0028541777282953262, 0.01756448484957218, -0.034703079611063004, -0.016614189371466637, -0.018114477396011353, 0.05708165466785431, -0.047249935567379, -0.004736300557851791, -0.05670757219195366, 0.0384114608168602, -0.015306703746318817, 0.04101165756583214, -0.12092304974794388, -0.0049290042370557785, 0.0008639497682452202, -0.019379300996661186, -0.019231216982007027, -0.03718291595578194, -0.0628720372915268, -0.07189033925533295, -0.004246316384524107, -0.0853237435221672, 0.047224946320056915, -0.010217048227787018, 0.0006460358272306621, 0.010835520923137665, -0.0026669788639992476, -0.021662330254912376, 0.05251672863960266, 0.012773849070072174, 0.06542565673589706, 0.043227773159742355, -0.05851292237639427, -0.030971597880125046, 0.05764981359243393, -0.012716056779026985, 0.011240629479289055, 0.02313070558011532, -0.04504690691828728, 0.053897224366664886, 0.01461558323353529, 0.00278372410684824, 0.04262729361653328, -0.005329686217010021, 0.014332297258079052, -0.0006943115149624646, -0.06506785750389099, -0.05435993894934654, 0.010762992314994335, -0.012492106296122074, -0.10135950148105621, -0.028126925230026245, -0.035252802073955536, -0.06697705388069153, 0.07967086136341095, -0.072661854326725, -0.018299642950296402, 0.09189699590206146, -0.0032378192991018295, -0.04530050605535507, 0.03978400677442551, 0.038025129586458206, 0.025727497413754463, -0.009280486963689327, -0.003163732588291168, -0.04127368703484535, -0.019097836688160896, -0.0847313329577446, -0.03738432005047798, -5.185012276613014e-33, 0.015869921073317528, 0.04736414551734924, -0.05123008042573929, 0.10747356712818146, -0.04980836063623428, -0.08629754185676575, -0.0444270521402359, 0.0019751954823732376, -0.051077477633953094, -0.007134219165891409, -0.04556671530008316, 0.038412369787693024, 0.012693095952272415, -0.0504455603659153, 0.031313806772232056, 0.04894641786813736, -0.11789331585168839, -0.12970097362995148, 0.05233483761548996, -0.03169664740562439, 0.017838716506958008, -0.013567754067480564, 0.042575735598802567, 0.0077894884161651134, -0.019174430519342422, -0.0704314187169075, -0.013715890236198902, -0.0024476053658872843, 0.05804513022303581, -0.07610213756561279, -0.039290785789489746, -0.032646846026182175, 0.008098294958472252, 0.043144576251506805, 0.0003563405480235815, -0.05771045759320259, 0.028195831924676895, 0.03765883669257164, 0.05486121401190758, -0.024358101189136505, 0.026162821799516678, 0.011548363603651524, -0.049878329038619995, 0.08906202763319016, -0.014691167511045933, 0.02357622981071472, 0.03503453731536865, 0.0055473120883107185, 0.06730840355157852, 0.004540711175650358, -0.006819710601121187, -0.07481006532907486, -0.005348750855773687, 0.05905342847108841, -0.09261179715394974, -0.06479174643754959, -0.025485387071967125, -0.08992303162813187, -0.006213551852852106, 0.09540554881095886, 0.009737555868923664, -0.07544372975826263, -0.058035995811223984, -0.04934615641832352, -0.06685684621334076, -0.03118792548775673, -0.08951080590486526, -0.01597430370748043, 0.09406834095716476, -0.033587146550416946, 0.01433565840125084, -0.019358977675437927, 0.03000137396156788, -0.058067645877599716, -0.061510324478149414, -0.009767590090632439, -0.000002910605417127954, -0.05521130561828613, 0.07546397298574448, 0.03496579825878143, -0.0421520359814167, -0.007187765557318926, 0.0008345858659595251, 0.06029738858342171, -0.01254559401422739, -0.01605365425348282, -0.016824238002300262, 0.10852079093456268, -0.044154658913612366, 0.017138579860329628, 0.03844539448618889, 0.026269545778632164, -0.08560878038406372, 0.005067601799964905, -0.0826026201248169, -6.061318202910115e-8, -0.0636831521987915, 0.027657322585582733, -0.09537933766841888, 0.07010355591773987, 0.09131082147359848, -0.003956829663366079, -0.03684789687395096, 0.1184883788228035, -0.010082022286951542, 0.07717783749103546, -0.019198229536414146, 0.057339027523994446, 0.05223606526851654, -0.011971297673881054, 0.028334416449069977, -0.007737716194242239, -0.024666618555784225, 0.03969176113605499, -0.04032638669013977, 0.047535113990306854, -0.02974478155374527, 0.020207032561302185, 0.02913849987089634, 0.045141804963350296, -0.04408133402466774, -0.0451948456466198, 0.02977817691862583, 0.0657038763165474, 0.008020676672458649, 0.08366971462965012, -0.07201975584030151, 0.09032658487558365, 0.024964092299342155, 0.007202510256320238, -0.048282161355018616, -0.040552835911512375, -0.03790612146258354, 0.021057570353150368, 0.07300229370594025, 0.04570768401026726, 0.05149593949317932, -0.053643371909856796, -0.10831335186958313, 0.048446156084537506, -0.048169899731874466, -0.03953825682401657, -0.002577410079538822, 0.022746289148926735, 0.036597806960344315, 0.026258589699864388, 0.008208028972148895, 0.024853507056832314, -0.06230832636356354, 0.043775565922260284, -0.032323937863111496, 0.005685352720320225, 0.038574542850255966, -0.09814413636922836, 0.013456713408231735, 0.014691898599267006, -0.013664951547980309, -0.01855149306356907, 0.03314981237053871, 0.02981214039027691 ]
0.039473
it to a JSON file. This file is intended to be used with tools such as Chrome DevTools. The JSON schema is undocumented and specific to the V8 engine, and may change from one version of V8 to the next. A heap snapshot is specific to a single V8 isolate. When using [worker threads][], a heap snapshot generated from the main thread will not contain any information about the workers, and vice versa. Creating a heap snapshot requires memory about twice the size of the heap at the time the snapshot is created. This results in the risk of OOM killers terminating the process. Generating a snapshot is a synchronous operation which blocks the event loop for a duration depending on the heap size. ```mjs import { writeHeapSnapshot } from 'node:v8'; import { Worker, isMainThread, parentPort } from 'node:worker\_threads'; import { fileURLToPath } from 'node:url'; if (isMainThread) { const \_\_filename = fileURLToPath(import.meta.url); const worker = new Worker(\_\_filename); worker.once('message', (filename) => { console.log(`worker heapdump: ${filename}`); // Now get a heapdump for the main thread. console.log(`main thread heapdump: ${writeHeapSnapshot()}`); }); // Tell the worker to create a heapdump. worker.postMessage('heapdump'); } else { parentPort.once('message', (message) => { if (message === 'heapdump') { // Generate a heapdump for the worker // and return the filename to the parent. parentPort.postMessage(writeHeapSnapshot()); } }); } ``` ```cjs const { writeHeapSnapshot } = require('node:v8'); const { Worker, isMainThread, parentPort } = require('node:worker\_threads'); if (isMainThread) { const worker = new Worker(\_\_filename); worker.once('message', (filename) => { console.log(`worker heapdump: ${filename}`); // Now get a heapdump for the main thread. console.log(`main thread heapdump: ${writeHeapSnapshot()}`); }); // Tell the worker to create a heapdump. worker.postMessage('heapdump'); } else { parentPort.once('message', (message) => { if (message === 'heapdump') { // Generate a heapdump for the worker // and return the filename to the parent. parentPort.postMessage(writeHeapSnapshot()); } }); } ``` ## `v8.setHeapSnapshotNearHeapLimit(limit)` \* `limit` {integer} The API is a no-op if `--heapsnapshot-near-heap-limit` is already set from the command line or the API is called more than once. `limit` must be a positive integer. See [`--heapsnapshot-near-heap-limit`][] for more information. ## Serialization API The serialization API provides means of serializing JavaScript values in a way that is compatible with the [HTML structured clone algorithm][]. The format is backward-compatible (i.e. safe to store to disk). Equal JavaScript values may result in different serialized output. ### `v8.serialize(value)` \* `value` {any} \* Returns: {Buffer} Uses a [`DefaultSerializer`][] to serialize `value` into a buffer. [`ERR\_BUFFER\_TOO\_LARGE`][] will be thrown when trying to serialize a huge object which requires buffer larger than [`buffer.constants.MAX\_LENGTH`][]. ### `v8.deserialize(buffer)` \* `buffer` {Buffer|TypedArray|DataView} A buffer returned by [`serialize()`][]. Uses a [`DefaultDeserializer`][] with default options to read a JS value from a buffer. ### Class: `v8.Serializer` #### `new Serializer()` Creates a new `Serializer` object. #### `serializer.writeHeader()` Writes out a header, which includes the serialization format version. #### `serializer.writeValue(value)` \* `value` {any} Serializes a JavaScript value and adds the serialized representation to the internal buffer. This throws an error if `value` cannot be serialized. #### `serializer.releaseBuffer()` \* Returns: {Buffer} Returns the stored internal buffer. This serializer should not be used once the buffer is released. Calling this method results in undefined behavior if a previous write has failed. #### `serializer.transferArrayBuffer(id, arrayBuffer)` \* `id` {integer} A 32-bit unsigned integer. \* `arrayBuffer` {ArrayBuffer} An `ArrayBuffer` instance. Marks an `ArrayBuffer` as having its contents transferred out of band. Pass the corresponding `ArrayBuffer` in the deserializing context to [`deserializer.transferArrayBuffer()`][]. #### `serializer.writeUint32(value)` \* `value` {integer} Write a raw 32-bit unsigned integer. For use inside of a custom [`serializer.\_writeHostObject()`][]. #### `serializer.writeUint64(hi, lo)` \* `hi` {integer} \* `lo` {integer} Write a raw 64-bit unsigned integer, split into high
https://github.com/nodejs/node/blob/main//doc/api/v8.md
main
nodejs
[ -0.1261870563030243, 0.059102777391672134, -0.04365032538771629, 0.0045703863725066185, 0.07337099313735962, -0.0868503674864769, -0.0626053661108017, 0.025648655369877815, 0.07009821385145187, -0.07074064761400223, -0.01607007533311844, 0.04417472332715988, -0.0409386083483696, -0.10186352580785751, -0.046982813626527786, 0.012059120461344719, -0.01054091565310955, -0.03784404695034027, 0.00455328356474638, -0.02850348688662052, 0.017415184527635574, -0.03136236220598221, -0.04261942580342293, 0.01362568512558937, 0.01948600448668003, 0.007581050507724285, -0.016438549384474754, 0.056343674659729004, 0.041372064501047134, -0.0035990793257951736, 0.05000193417072296, -0.05050569772720337, -0.008991789072751999, 0.0026299585588276386, 0.042377449572086334, 0.1450028419494629, -0.03321537375450134, -0.07463020831346512, -0.06532244384288788, 0.006818639580160379, 0.05439644679427147, 0.08006594330072403, -0.08628769218921661, -0.0018734832992777228, -0.005979414563626051, -0.006655099336057901, -0.06028928607702255, -0.021200133487582207, -0.04833367094397545, -0.011518759652972221, -0.0646037682890892, 0.001565976650454104, -0.0303663183003664, -0.004282115027308464, 0.027031581848859787, 0.041285477578639984, -0.013642489910125732, -0.033783018589019775, -0.035038743168115616, 0.05566094443202019, -0.018840091302990913, -0.018855730071663857, -0.006102255545556545, -0.007622241508215666, 0.14490380883216858, 0.0018623457290232182, 0.08107839524745941, 0.01233785878866911, 0.02122334949672222, -0.11713231354951859, -0.002261399058625102, 0.05832773819565773, -0.032624371349811554, 0.019133370369672775, -0.013535750098526478, -0.03222554177045822, -0.021932700648903847, -0.032180700451135635, -0.032515835016965866, -0.029377654194831848, 0.007428926881402731, -0.07548448443412781, 0.044182974845170975, -0.007006387691944838, -0.01338485348969698, 0.059278201311826706, 0.07865211367607117, -0.02835460565984249, 0.039564140141010284, 0.033322740346193314, -0.10378221422433853, -0.05864391103386879, -0.03327646479010582, 0.009134301915764809, 0.0625525638461113, 0.06433475017547607, 0.05735209211707115, 0.0790131613612175, -0.028416290879249573, 0.001900949515402317, 0.026495855301618576, 0.01298451703041792, 0.10319370776414871, -0.004338427446782589, 0.03721368685364723, -0.03801378235220909, -0.06750668585300446, 0.00750720826908946, -0.05621775612235069, -0.006175273563712835, 0.06701124459505081, 0.07315640896558762, 0.0036763011012226343, -0.04582624509930611, -0.011784734204411507, -0.02768234722316265, -0.015371033921837807, -0.05343347042798996, -0.017753243446350098, 0.12222830951213837, 0.12042240798473358, 0.02223767712712288, -0.08429765701293945, -0.014289048500359058, -0.043307121843099594, -0.06874357908964157, 0.03615664690732956, 3.232083431039298e-33, 0.04229399189352989, -0.08048374205827713, 0.022563178092241287, 0.022520113736391068, 0.06986924260854721, -0.010779406875371933, -0.004236421547830105, 0.0029530758038163185, -0.02242439053952694, -0.022539256140589714, -0.05392582342028618, 0.0036004316061735153, 0.04308228939771652, 0.009392733685672283, 0.04147212579846382, -0.02528095617890358, -0.04185016453266144, 0.01921282522380352, 0.01917594112455845, 0.04464246705174446, -0.040884509682655334, 0.000011771149729611352, -0.03920333832502365, 0.040615592151880264, -0.036077067255973816, 0.05948156118392944, -0.00435987813398242, -0.008884974755346775, -0.042597513645887375, 0.02496621012687683, 0.011587864719331264, 0.06059756502509117, -0.08652372658252716, 0.028023576363921165, 0.09885837882757187, -0.015743408352136612, -0.06754687428474426, -0.0781078115105629, -0.056775763630867004, -0.02278192527592182, 0.032993581146001816, 0.03213706240057945, -0.10403035581111908, -0.04407280683517456, -0.07574989646673203, -0.12309142202138901, -0.026749951764941216, -0.045472659170627594, 0.011713267304003239, 0.025318080559372902, 0.05447220802307129, 0.00851507019251585, 0.12579602003097534, -0.016354162245988846, 0.024181991815567017, 0.03631158918142319, 0.10457687079906464, -0.10848531872034073, -0.0029591417405754328, 0.07448316365480423, 0.005005314480513334, 0.008655987679958344, -0.010791253298521042, 0.05207681283354759, 0.0066408803686499596, 0.0026752164121717215, 0.00043732806807383895, 0.03137737140059471, 0.0684988722205162, 0.026638295501470566, 0.010365322232246399, 0.00887228548526764, 0.013280455023050308, -0.018990276381373405, -0.04560574144124985, 0.04093790054321289, -0.018539391458034515, 0.015055632218718529, -0.06540925055742264, -0.009580200538039207, 0.03980359807610512, -0.05602975934743881, -0.030257930979132652, -0.06565334647893906, -0.003815591800957918, 0.015442430973052979, -0.05157119780778885, -0.037344157695770264, 0.008841071277856827, 0.055756065994501114, 0.012657992541790009, -0.05021698772907257, -0.02581528201699257, -0.028810350224375725, -0.0811077356338501, -5.2845006083368426e-33, -0.023542193695902824, -0.047867391258478165, -0.10768111050128937, 0.09588766098022461, -0.0025958851911127567, 0.009850003756582737, -0.01492867898195982, 0.024119475856423378, -0.029126087203621864, 0.035985562950372696, -0.083159439265728, 0.031182998791337013, -0.011976104229688644, -0.011292129755020142, 0.05224598944187164, 0.03611026331782341, 0.029597198590636253, -0.11909965425729752, -0.06880220770835876, -0.029414759948849678, 0.015382175333797932, -0.030262792482972145, 0.1200033575296402, 0.049898963421583176, 0.043353207409381866, -0.009876979514956474, -0.0420951172709465, -0.07413201779127121, 0.04155529662966728, -0.08526387810707092, -0.04190704599022865, 0.007744967937469482, -0.015151052735745907, 0.0212174654006958, 0.05495613440871239, -0.03944789245724678, 0.06010962277650833, 0.05964411795139313, 0.09734484553337097, -0.026567166671156883, 0.06267479062080383, 0.05211075022816658, 0.02063532918691635, 0.057672686874866486, -0.014559724368155003, 0.08309347182512283, -0.014939234592020512, 0.012569147162139416, 0.01718224585056305, -0.02737625129520893, 0.024154119193553925, -0.012420205399394035, 0.04101105406880379, 0.06594520807266235, -0.012441489845514297, -0.051579900085926056, -0.0271002110093832, -0.06746406853199005, 0.025375358760356903, 0.027847204357385635, 0.06462983042001724, -0.08965302258729935, -0.07091111689805984, -0.030055537819862366, -0.03127344325184822, -0.03626095503568649, -0.08210646361112595, -0.05895359069108963, -0.07435394823551178, 0.02821793593466282, -0.008459399454295635, 0.01929073967039585, 0.054220568388700485, -0.019881192594766617, -0.09548299014568329, -0.0394383929669857, 0.015690404921770096, -0.09526901692152023, 0.017102112993597984, -0.03750573471188545, -0.03428688272833824, 0.03292108327150345, 0.020331718027591705, 0.04064440727233887, 0.029675757512450218, -0.064850352704525, -0.009604248218238354, 0.035627320408821106, 0.028354790061712265, -0.04193466901779175, -0.001451797317713499, 0.05966045707464218, -0.12465276569128036, 0.03310641273856163, 0.01713385432958603, -5.273092185120731e-8, 0.016794472932815552, -0.001512194867245853, -0.06684641540050507, 0.026092201471328735, 0.05435504764318466, -0.043221406638622284, 0.03282541409134865, 0.03014683909714222, 0.10663362592458725, 0.06378880143165588, 0.10364507138729095, -0.004967894870787859, -0.02645527385175228, -0.016576573252677917, 0.053067177534103394, 0.024049151688814163, 0.006753907073289156, 0.00041600066469982266, -0.03250500187277794, -0.035040780901908875, 0.05431828647851944, -0.02820078656077385, -0.04902597516775131, 0.0752626359462738, 0.031424470245838165, -0.019037965685129166, 0.09300341457128525, 0.0568748340010643, -0.02840208075940609, -0.09041264653205872, -0.08710088580846786, 0.05278964713215828, 0.024961113929748535, -0.01703096367418766, -0.06355292350053787, 0.0907464474439621, 0.04388589411973953, 0.008891072124242783, 0.060035791248083115, -0.047920819371938705, 0.0020440483931452036, 0.07581580430269241, -0.0404936857521534, 0.02566453628242016, -0.023429568856954575, 0.006083100102841854, -0.0937093198299408, 0.05461044982075691, -0.07123702019453049, 0.015144909732043743, -0.05837646499276161, -0.020782601088285446, 0.04087168723344803, 0.0992388054728508, -0.027081549167633057, -0.02095336839556694, 0.05768397077918053, -0.11600984632968903, 0.08070294559001923, 0.01133507490158081, 0.07259663194417953, 0.07064909487962723, 0.07720537483692169, 0.03702373057603836 ]
0.229463
transferred out of band. Pass the corresponding `ArrayBuffer` in the deserializing context to [`deserializer.transferArrayBuffer()`][]. #### `serializer.writeUint32(value)` \* `value` {integer} Write a raw 32-bit unsigned integer. For use inside of a custom [`serializer.\_writeHostObject()`][]. #### `serializer.writeUint64(hi, lo)` \* `hi` {integer} \* `lo` {integer} Write a raw 64-bit unsigned integer, split into high and low 32-bit parts. For use inside of a custom [`serializer.\_writeHostObject()`][]. #### `serializer.writeDouble(value)` \* `value` {number} Write a JS `number` value. For use inside of a custom [`serializer.\_writeHostObject()`][]. #### `serializer.writeRawBytes(buffer)` \* `buffer` {Buffer|TypedArray|DataView} Write raw bytes into the serializer's internal buffer. The deserializer will require a way to compute the length of the buffer. For use inside of a custom [`serializer.\_writeHostObject()`][]. #### `serializer.\_writeHostObject(object)` \* `object` {Object} This method is called to write some kind of host object, i.e. an object created by native C++ bindings. If it is not possible to serialize `object`, a suitable exception should be thrown. This method is not present on the `Serializer` class itself but can be provided by subclasses. #### `serializer.\_getDataCloneError(message)` \* `message` {string} This method is called to generate error objects that will be thrown when an object can not be cloned. This method defaults to the [`Error`][] constructor and can be overridden on subclasses. #### `serializer.\_getSharedArrayBufferId(sharedArrayBuffer)` \* `sharedArrayBuffer` {SharedArrayBuffer} This method is called when the serializer is going to serialize a `SharedArrayBuffer` object. It must return an unsigned 32-bit integer ID for the object, using the same ID if this `SharedArrayBuffer` has already been serialized. When deserializing, this ID will be passed to [`deserializer.transferArrayBuffer()`][]. If the object cannot be serialized, an exception should be thrown. This method is not present on the `Serializer` class itself but can be provided by subclasses. #### `serializer.\_setTreatArrayBufferViewsAsHostObjects(flag)` \* `flag` {boolean} \*\*Default:\*\* `false` Indicate whether to treat `TypedArray` and `DataView` objects as host objects, i.e. pass them to [`serializer.\_writeHostObject()`][]. ### Class: `v8.Deserializer` #### `new Deserializer(buffer)` \* `buffer` {Buffer|TypedArray|DataView} A buffer returned by [`serializer.releaseBuffer()`][]. Creates a new `Deserializer` object. #### `deserializer.readHeader()` Reads and validates a header (including the format version). May, for example, reject an invalid or unsupported wire format. In that case, an `Error` is thrown. #### `deserializer.readValue()` Deserializes a JavaScript value from the buffer and returns it. #### `deserializer.transferArrayBuffer(id, arrayBuffer)` \* `id` {integer} A 32-bit unsigned integer. \* `arrayBuffer` {ArrayBuffer|SharedArrayBuffer} An `ArrayBuffer` instance. Marks an `ArrayBuffer` as having its contents transferred out of band. Pass the corresponding `ArrayBuffer` in the serializing context to [`serializer.transferArrayBuffer()`][] (or return the `id` from [`serializer.\_getSharedArrayBufferId()`][] in the case of `SharedArrayBuffer`s). #### `deserializer.getWireFormatVersion()` \* Returns: {integer} Reads the underlying wire format version. Likely mostly to be useful to legacy code reading old wire format versions. May not be called before `.readHeader()`. #### `deserializer.readUint32()` \* Returns: {integer} Read a raw 32-bit unsigned integer and return it. For use inside of a custom [`deserializer.\_readHostObject()`][]. #### `deserializer.readUint64()` \* Returns: {integer\[]} Read a raw 64-bit unsigned integer and return it as an array `[hi, lo]` with two 32-bit unsigned integer entries. For use inside of a custom [`deserializer.\_readHostObject()`][]. #### `deserializer.readDouble()` \* Returns: {number} Read a JS `number` value. For use inside of a custom [`deserializer.\_readHostObject()`][]. #### `deserializer.readRawBytes(length)` \* `length` {integer} \* Returns: {Buffer} Read raw bytes from the deserializer's internal buffer. The `length` parameter must correspond to the length of the buffer that was passed to [`serializer.writeRawBytes()`][]. For use inside of a custom [`deserializer.\_readHostObject()`][]. #### `deserializer.\_readHostObject()` This method is called to read some kind of host object, i.e. an object that is created by native C++ bindings. If it is not possible to deserialize the data, a suitable exception should be thrown. This method is not present on the `Deserializer` class itself but can be provided
https://github.com/nodejs/node/blob/main//doc/api/v8.md
main
nodejs
[ 0.029637785628437996, 0.04120248183608055, -0.045957982540130615, -0.03425360098481178, -0.09226095676422119, -0.05126328021287918, 0.04836951196193695, 0.04558132216334343, -0.05824708566069603, -0.050937723368406296, -0.09385697543621063, -0.021390793845057487, -0.04197295382618904, -0.004401081707328558, 0.07323954999446869, -0.03664815053343773, 0.0011204779148101807, 0.07198495417833328, -0.12192656099796295, 0.018778802827000618, 0.08961702138185501, 0.019757162779569626, -0.026705710217356682, -0.057753391563892365, -0.012402552179992199, -0.001285895355977118, 0.038089800626039505, -0.0026342140045017004, 0.07387224584817886, 0.02847938798367977, -0.034781236201524734, 0.041523803025484085, -0.0041759926825761795, -0.012228749692440033, 0.022176386788487434, 0.042407866567373276, 0.055128518491983414, -0.09344520419836044, 0.0009934817207977176, -0.0038072029128670692, 0.14309121668338776, 0.06079530343413353, -0.06114806607365608, 0.022903714329004288, -0.07746391743421555, -0.0729706734418869, -0.05571999400854111, 0.0417739674448967, -0.09462457150220871, -0.007365487515926361, -0.005448191426694393, 0.032524336129426956, 0.027175383642315865, 0.09732484072446823, -0.053946442902088165, -0.08026716113090515, -0.03578204661607742, 0.006466249469667673, -0.003289523534476757, 0.03070693649351597, -0.0346858873963356, 0.011348860338330269, 0.01238335482776165, -0.06628964841365814, -0.031197896227240562, -0.05246765539050102, 0.03430267050862312, 0.020775213837623596, 0.0502302311360836, 0.007288792170584202, -0.013658441603183746, -0.027572795748710632, -0.05119825527071953, 0.027253830805420876, 0.03277428820729256, -0.0023357379250228405, 0.006871431600302458, 0.010759148746728897, -0.04784885048866272, -0.05672576278448105, 0.009298699907958508, -0.11169376969337463, -0.021375402808189392, 0.040490470826625824, 0.006122950930148363, 0.026179995387792587, -0.07928527891635895, 0.07096491754055023, -0.00010135295451618731, 0.022505994886159897, -0.0893181711435318, 0.030793016776442528, 0.006250598002225161, 0.009119884110987186, -0.008103842847049236, 0.007854748517274857, 0.04236288368701935, 0.028857575729489326, -0.041263286024332047, 0.055306870490312576, 0.01223152969032526, 0.0014729391550645232, 0.0018221490317955613, 0.040552761405706406, -0.03801053762435913, -0.029967615380883217, 0.04207577556371689, 0.07096482813358307, -0.1039363220334053, -0.017624638974666595, 0.0021845430601388216, 0.10550013184547424, -0.01749565824866295, 0.018224816769361496, 0.06507652252912521, 0.026442524045705795, -0.04966719076037407, 0.04676461219787598, -0.0010702344588935375, 0.03297511115670204, 0.06522524356842041, -0.04331722855567932, -0.031958021223545074, 0.0472475104033947, 0.046516675502061844, 0.017948754131793976, -0.037550147622823715, 3.1688069374765186e-33, 0.03466809540987015, 0.021297957748174667, 0.004046658519655466, 0.018094658851623535, -0.0029491044115275145, 0.013754678890109062, 0.007712408434599638, 0.07699281722307205, 0.016171563416719437, -0.008739760145545006, -0.05347560718655586, -0.02251570113003254, 0.015709590166807175, 0.061069633811712265, 0.022236289456486702, 0.002927503315731883, 0.018896836787462234, -0.022052347660064697, 0.1413201242685318, 0.034300547093153, 0.08437889814376831, 0.061002977192401886, -0.09125027805566788, 0.019433986395597458, -0.054944634437561035, 0.015829389914870262, -0.06277436017990112, -0.04021777957677841, -0.05075271427631378, 0.03789423778653145, -0.017870964482426643, 0.0402604378759861, 0.023105543106794357, -0.0398588590323925, 0.05853839963674545, -0.08896295726299286, -0.005212005227804184, 0.016286663711071014, -0.05590808019042015, -0.05595429614186287, -0.030372194945812225, -0.024853399023413658, -0.0853753462433815, 0.04917198792099953, -0.05175468698143959, -0.07053495198488235, -0.018648140132427216, -0.017464719712734222, 0.052152007818222046, -0.0006656018667854369, -0.01626598834991455, 0.056594595313072205, 0.032197218388319016, -0.046128030866384506, 0.05241967737674713, -0.07923053950071335, 0.06609513610601425, 0.07263686507940292, -0.005149207077920437, 0.007205875590443611, 0.025149796158075333, 0.08630110323429108, 0.04807585850358009, 0.005424077622592449, 0.041918184608221054, 0.04072333872318268, 0.008227151818573475, -0.013644956983625889, -0.058913689106702805, -0.019109008833765984, -0.1260698139667511, 0.10475590080022812, -0.030488070100545883, 0.06104735657572746, -0.03943047299981117, -0.018950054422020912, 0.005776650737971067, -0.0205659419298172, 0.007034631446003914, -0.09920484572649002, 0.04107099771499634, 0.04355532303452492, -0.06609027832746506, -0.014872743748128414, -0.043027833104133606, 0.05234906077384949, -0.0217116791754961, -0.06898729503154755, -0.01246186438947916, -0.03811798244714737, 0.015375832095742226, -0.04397581145167351, -0.004304598085582256, -0.13081258535385132, -0.018442921340465546, -5.618684468726003e-33, 0.027781836688518524, 0.05199906975030899, -0.017719050869345665, 0.06217949837446213, -0.05485186353325844, -0.09116017818450928, 0.0764462947845459, 0.08560870587825775, -0.027633417397737503, -0.013061873614788055, -0.0013550614239647985, 0.013874356634914875, 0.006234081462025642, -0.02121436968445778, -0.016837144270539284, -0.06414460390806198, -0.09382981806993484, -0.03231969103217125, 0.10202457755804062, -0.09944503754377365, 0.01639065332710743, 0.01372981071472168, 0.1131911426782608, 0.061428822576999664, -0.09218913316726685, -0.03799048811197281, -0.06970879435539246, 0.026745252311229706, -0.0027918422129005194, -0.021099459379911423, 0.026511535048484802, 0.03297455981373787, 0.05176954343914986, -0.07742562890052795, -0.04928454011678696, -0.057210374623537064, 0.036772046238183975, 0.028707759454846382, 0.025024564936757088, -0.008345944806933403, -0.02527729980647564, -0.08839316666126251, 0.020527906715869904, 0.019494852051138878, 0.029024796560406685, -0.03160100430250168, 0.004394556395709515, 0.033804748207330704, 0.005231143906712532, -0.05229563266038895, 0.08922652155160904, 0.01976056955754757, -0.043736182153224945, 0.03302208334207535, 0.07158355414867401, -0.0161807369440794, 0.07619070261716843, -0.09633839875459671, 0.07455573230981827, 0.022035080939531326, -0.026859594509005547, -0.024733135476708412, 0.007356811314821243, -0.07604900002479553, 0.04200762137770653, -0.02241244725883007, 0.016117868945002556, -0.058037981390953064, -0.027704430744051933, 0.04474068433046341, 0.015033376403152943, -0.05308457091450691, 0.02094070054590702, 0.10843692719936371, -0.020797312259674072, -0.06778056174516678, -0.047949086874723434, -0.0038361912593245506, -0.001919916132465005, 0.12132583558559418, -0.056774090975522995, 0.03524288907647133, -0.020206140354275703, 0.036917343735694885, 0.04622766748070717, -0.056766245514154434, 0.009732300415635109, 0.05766230449080467, -0.07659939676523209, -0.05764538422226906, -0.02985597960650921, 0.06121574342250824, -0.027071187272667885, -0.02847067266702652, 0.010085664689540863, -4.924148555573993e-8, -0.012791327200829983, -0.048872195184230804, -0.08740430325269699, 0.03649331256747246, -0.05220367759466171, -0.02390274964272976, -0.10651819407939911, -0.06700821965932846, 0.13090521097183228, -0.02114894613623619, -0.006411242764443159, -0.0059499540366232395, 0.009663412347435951, 0.0056855333968997, 0.0029404142405837774, 0.01288231648504734, 0.02925696410238743, -0.07666468620300293, -0.040246203541755676, -0.03228384628891945, 0.04344208538532257, -0.02185351774096489, -0.013046806678175926, -0.07784033566713333, 0.07455946505069733, -0.02193550020456314, 0.03482954949140549, 0.08574041724205017, -0.01262550801038742, -0.025902386754751205, -0.021708663552999496, -0.020243186503648758, 0.08269795775413513, 0.09329915791749954, -0.03872302174568176, 0.021562878042459488, -0.04471396282315254, 0.025371039286255836, 0.02521447464823723, -0.004559512250125408, 0.06948398798704147, -0.019021719694137573, -0.1293003261089325, 0.05764085799455643, 0.10589493811130524, -0.0408669076859951, -0.005710612051188946, 0.0999717265367508, -0.007252312730997801, 0.06382657587528229, -0.03408820182085037, 0.028415149077773094, 0.04513833299279213, 0.03707772120833397, -0.08521074056625366, -0.05855850502848625, -0.09313695132732391, -0.001984105445444584, 0.04102186858654022, 0.05202031880617142, 0.07144349068403244, 0.031002912670373917, -0.04838709533214569, -0.04701876640319824 ]
0.07916
This method is called to read some kind of host object, i.e. an object that is created by native C++ bindings. If it is not possible to deserialize the data, a suitable exception should be thrown. This method is not present on the `Deserializer` class itself but can be provided by subclasses. ### Class: `v8.DefaultSerializer` A subclass of [`Serializer`][] that serializes `TypedArray` (in particular [`Buffer`][]) and `DataView` objects as host objects, and only stores the part of their underlying `ArrayBuffer`s that they are referring to. ### Class: `v8.DefaultDeserializer` A subclass of [`Deserializer`][] corresponding to the format written by [`DefaultSerializer`][]. ## Promise hooks The `promiseHooks` interface can be used to track promise lifecycle events. To track \_all\_ async activity, see [`async\_hooks`][] which internally uses this module to produce promise lifecycle events in addition to events for other async resources. For request context management, see [`AsyncLocalStorage`][]. ```mjs import { promiseHooks } from 'node:v8'; // There are four lifecycle events produced by promises: // The `init` event represents the creation of a promise. This could be a // direct creation such as with `new Promise(...)` or a continuation such // as `then()` or `catch()`. It also happens whenever an async function is // called or does an `await`. If a continuation promise is created, the // `parent` will be the promise it is a continuation from. function init(promise, parent) { console.log('a promise was created', { promise, parent }); } // The `settled` event happens when a promise receives a resolution or // rejection value. This may happen synchronously such as when using // `Promise.resolve()` on non-promise input. function settled(promise) { console.log('a promise resolved or rejected', { promise }); } // The `before` event runs immediately before a `then()` or `catch()` handler // runs or an `await` resumes execution. function before(promise) { console.log('a promise is about to call a then handler', { promise }); } // The `after` event runs immediately after a `then()` handler runs or when // an `await` begins after resuming from another. function after(promise) { console.log('a promise is done calling a then handler', { promise }); } // Lifecycle hooks may be started and stopped individually const stopWatchingInits = promiseHooks.onInit(init); const stopWatchingSettleds = promiseHooks.onSettled(settled); const stopWatchingBefores = promiseHooks.onBefore(before); const stopWatchingAfters = promiseHooks.onAfter(after); // Or they may be started and stopped in groups const stopHookSet = promiseHooks.createHook({ init, settled, before, after, }); // Trigger the hooks by using promises const promiseLog = (word) => Promise.resolve(word).then(console.log); promiseLog('Hello'); promiseLog('World'); // To stop a hook, call the function returned at its creation. stopWatchingInits(); stopWatchingSettleds(); stopWatchingBefores(); stopWatchingAfters(); stopHookSet(); ``` ```cjs const { promiseHooks } = require('node:v8'); // There are four lifecycle events produced by promises: // The `init` event represents the creation of a promise. This could be a // direct creation such as with `new Promise(...)` or a continuation such // as `then()` or `catch()`. It also happens whenever an async function is // called or does an `await`. If a continuation promise is created, the // `parent` will be the promise it is a continuation from. function init(promise, parent) { console.log('a promise was created', { promise, parent }); } // The `settled` event happens when a promise receives a resolution or // rejection value. This may happen synchronously such as when using // `Promise.resolve()` on non-promise input. function settled(promise) { console.log('a promise resolved or rejected', { promise }); } // The `before` event runs immediately before a `then()` or `catch()` handler // runs or an `await` resumes execution. function before(promise) { console.log('a promise is about to call a then handler', { promise }); } // The `after` event runs immediately after a `then()`
https://github.com/nodejs/node/blob/main//doc/api/v8.md
main
nodejs
[ -0.046502526849508286, 0.04957348480820656, -0.03674545884132385, 0.017833609133958817, -0.06400738656520844, -0.04698161035776138, -0.0009581661433912814, 0.004276595544070005, -0.026247648522257805, -0.07884876430034637, -0.06324377655982971, -0.0024494058452546597, -0.08554283529520035, -0.022288745269179344, -0.04483754187822342, -0.020931301638484, 0.0214813482016325, -0.04135560989379883, -0.07547791302204132, 0.038245655596256256, 0.10984271764755249, 0.048868048936128616, -0.09717334806919098, -0.01046755537390709, -0.03360007703304291, 0.0736282467842102, -0.0073052747175097466, -0.0660787895321846, 0.033165544271469116, 0.0055687520653009415, -0.0233087707310915, -0.0361347496509552, -0.020339110866189003, 0.11145234107971191, -0.0565553642809391, 0.04396078735589981, 0.03466213122010231, -0.07960319519042969, 0.014963328838348389, 0.0007101658266037703, 0.10776423662900925, 0.07153177261352539, -0.12836727499961853, 0.027770871296525, -0.031981226056814194, -0.028723927214741707, -0.008265957236289978, -0.025527162477374077, -0.10871187597513199, -0.041984785348176956, -0.03431381657719612, 0.06899421662092209, -0.006986300926655531, 0.07307104766368866, 0.022811245173215866, -0.025092173367738724, -0.0038344331551343203, -0.001847002888098359, -0.028492966666817665, 0.07099932432174683, 0.014583876356482506, -0.02240873873233795, 0.022218167781829834, 0.04675890505313873, -0.03328340873122215, -0.034291014075279236, 0.05988235026597977, 0.04883347824215889, 0.12764129042625427, -0.04110359027981758, -0.0025354260578751564, -0.009209698997437954, 0.025091854855418205, 0.0530439130961895, 0.014057327061891556, 0.01299667451530695, -0.0051488084718585014, -0.054644130170345306, 0.022841529920697212, -0.10807007551193237, 0.06601013988256454, -0.02724483422935009, 0.002962677739560604, 0.055667925626039505, 0.012411543168127537, 0.08209073543548584, -0.09725593030452728, -0.02246388979256153, 0.005185223650187254, 0.017253810539841652, -0.0807291641831398, -0.07544473558664322, -0.12186631560325623, 0.06621840596199036, -0.046661242842674255, -0.015870526432991028, 0.03181476518511772, -0.05525922402739525, -0.010881018824875355, 0.029355918988585472, -0.014960329979658127, 0.06848151981830597, 0.07919401675462723, 0.039660368114709854, -0.00923927128314972, -0.07763468474149704, -0.012081712484359741, -0.05197630822658539, -0.14302772283554077, 0.021919630467891693, 0.005482118111103773, 0.08261825144290924, -0.019978400319814682, 0.027053063735365868, 0.011034203693270683, 0.004236611071974039, -0.06221519038081169, -0.008516496047377586, 0.029601702466607094, 0.03394013270735741, 0.06007935851812363, -0.027970707044005394, 0.037870123982429504, 0.014937336556613445, 0.021884774789214134, -0.019816873595118523, -0.10235479474067688, 1.5513944853412156e-33, 0.05757436528801918, -0.045761242508888245, -0.017010625451803207, 0.009369604289531708, 0.04307170957326889, -0.013713967986404896, 0.014357049018144608, 0.07629697024822235, 0.014139286242425442, 0.018778560683131218, 0.033143747597932816, -0.0034063353668898344, -0.010364044457674026, 0.07255356758832932, 0.037153735756874084, 0.04410455375909805, 0.014980677515268326, 0.034440211951732635, 0.021984193474054337, 0.058455538004636765, 0.03117307275533676, 0.07175382971763611, -0.025109240785241127, -0.00583288911730051, -0.02302287146449089, 0.00045600178418681026, -0.033937688916921616, 0.018439527601003647, 0.03233381733298302, 0.008746135979890823, -0.00037512602284550667, 0.006809636019170284, 0.02369135618209839, -0.012350534088909626, 0.08558586239814758, -0.037053972482681274, 0.024896565824747086, -0.015820452943444252, -0.09654785692691803, -0.0261544082313776, -0.015597510151565075, 0.025592705234885216, -0.06376428157091141, -0.02472699247300625, -0.07272369414567947, -0.09241710603237152, -0.05636923015117645, -0.0377260223031044, 0.0727606937289238, -0.030724894255399704, 0.026523711159825325, 0.009643922559916973, 0.02795054391026497, -0.028498956933617592, 0.02075289748609066, -0.02895907126367092, 0.04401107877492905, 0.03296353295445442, 0.030703630298376083, 0.00834115780889988, -0.03801528736948967, -0.08863373845815659, -0.02000335603952408, 0.014777546748518944, 0.019167063757777214, 0.05407010763883591, -0.053251393139362335, -0.05844961106777191, -0.011579959653317928, -0.002771774074062705, -0.03846687823534012, 0.028071949258446693, -0.06531780958175659, 0.03968588635325432, 0.022516313940286636, 0.05436300113797188, -0.06446236371994019, 0.004656082019209862, -0.005744983907788992, -0.06664416939020157, 0.03729981929063797, -0.02109648287296295, -0.0016950416611507535, 0.0835992768406868, -0.13104356825351715, 0.030971689149737358, 0.010168608278036118, -0.0681878998875618, 0.018771138042211533, -0.007363173644989729, -0.037172455340623856, -0.042869195342063904, -0.03179946169257164, -0.08227914571762085, -0.05408766120672226, -5.326475307552799e-33, 0.10528824478387833, -0.01898277923464775, -0.054925452917814255, 0.036464840173721313, -0.008945595473051071, 0.008688780479133129, 0.012180774472653866, 0.06738937646150589, -0.06025189161300659, -0.05566342920064926, 0.040892332792282104, 0.06084305793046951, 0.06699071824550629, 0.033665478229522705, 0.02525460720062256, 0.010899743065237999, -0.019703133031725883, -0.11053250730037689, -0.015530933625996113, -0.0693323090672493, 0.045457229018211365, 0.005459512118250132, 0.08554784953594208, -0.028403522446751595, -0.06386540830135345, -0.015484984964132309, -0.01361014973372221, 0.020822810009121895, 0.011751214973628521, -0.07794855535030365, 0.03321282938122749, 0.015705620869994164, -0.008085755631327629, -0.04335002601146698, -0.017908258363604546, 0.08394242078065872, 0.016632338985800743, 0.030240725725889206, -0.03644482046365738, -0.025721604004502296, 0.07246533036231995, 0.0126806003972888, -0.027195710688829422, -0.005627005826681852, 0.04165804386138916, -0.039114393293857574, 0.012071064673364162, 0.03408026695251465, 0.0638873353600502, -0.0483914390206337, 0.05651165917515755, -0.04597971960902214, -0.03665824979543686, 0.014685132540762424, 0.015609697438776493, 0.06024879962205887, 0.12164013087749481, -0.08342623710632324, 0.038775183260440826, 0.046716488897800446, -0.005941418465226889, -0.06582906097173691, -0.07763373106718063, -0.028995543718338013, -0.07988546788692474, -0.051381807774305344, 0.009678435511887074, -0.09521130472421646, 0.07392892986536026, 0.02468571811914444, 0.07944127172231674, -0.008003569208085537, -0.09230048209428787, 0.007016228977590799, -0.029137885197997093, -0.0846194475889206, -0.05711601302027702, -0.08093863725662231, 0.06902158260345459, 0.04548235982656479, -0.046080753207206726, -0.05303910747170448, 0.07704108208417892, 0.11414561420679092, 0.11525164544582367, -0.0704134926199913, 0.020777570083737373, 0.02150489203631878, -0.05651847645640373, 0.02138497866690159, -0.013595162890851498, 0.016352882608771324, -0.1416974812746048, 0.005624615121632814, -0.022018447518348694, -5.673348724144489e-8, -0.02529160864651203, -0.045011695474386215, -0.07167062163352966, 0.05710718408226967, 0.015755003318190575, -0.04867618530988693, -0.03186940774321556, -0.03867693245410919, 0.07470844686031342, -0.022057265043258667, 0.029207536950707436, -0.0034254570491611958, -0.014198408462107182, -0.03249010443687439, 0.039613477885723114, 0.017487792298197746, 0.04687439277768135, -0.0600694864988327, -0.057000599801540375, -0.042841605842113495, -0.0062967995181679726, -0.026324858888983727, -0.06900914013385773, -0.07547489553689957, 0.04334133118391037, 0.026205601170659065, 0.07140076905488968, 0.11108643561601639, 0.038364678621292114, 0.01988362707197666, -0.014918480068445206, 0.05275028944015503, 0.11316274851560593, 0.020178481936454773, 0.023177223280072212, 0.049921914935112, -0.007927617989480495, 0.02200170047581196, 0.052800945937633514, 0.006339491810649633, 0.04263405129313469, -0.025192130357027054, -0.025751354172825813, 0.0748053789138794, 0.06309054046869278, 0.05469652637839317, -0.010937324725091457, 0.07942768931388855, 0.032901011407375336, 0.050043147057294846, -0.01874566078186035, -0.0031970315612852573, -0.006043082103133202, 0.09634070843458176, -0.13501529395580292, -0.030138788744807243, -0.04828549548983574, -0.08745790272951126, 0.0344560407102108, 0.01927211321890354, 0.06542903184890747, 0.04596886783838272, 0.013246588408946991, -0.016859713941812515 ]
0.151553
or rejected', { promise }); } // The `before` event runs immediately before a `then()` or `catch()` handler // runs or an `await` resumes execution. function before(promise) { console.log('a promise is about to call a then handler', { promise }); } // The `after` event runs immediately after a `then()` handler runs or when // an `await` begins after resuming from another. function after(promise) { console.log('a promise is done calling a then handler', { promise }); } // Lifecycle hooks may be started and stopped individually const stopWatchingInits = promiseHooks.onInit(init); const stopWatchingSettleds = promiseHooks.onSettled(settled); const stopWatchingBefores = promiseHooks.onBefore(before); const stopWatchingAfters = promiseHooks.onAfter(after); // Or they may be started and stopped in groups const stopHookSet = promiseHooks.createHook({ init, settled, before, after, }); // Trigger the hooks by using promises const promisePrint = (word) => Promise.resolve(word).then(console.log); promisePrint('Hello'); promisePrint('World'); // To stop a hook, call the function returned at its creation. stopWatchingInits(); stopWatchingSettleds(); stopWatchingBefores(); stopWatchingAfters(); stopHookSet(); ``` ### `promiseHooks.onInit(init)` \* `init` {Function} The [`init` callback][] to call when a promise is created. \* Returns: {Function} Call to stop the hook. \*\*The `init` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.\*\* ```mjs import { promiseHooks } from 'node:v8'; const stop = promiseHooks.onInit((promise, parent) => {}); ``` ```cjs const { promiseHooks } = require('node:v8'); const stop = promiseHooks.onInit((promise, parent) => {}); ``` ### `promiseHooks.onSettled(settled)` \* `settled` {Function} The [`settled` callback][] to call when a promise is resolved or rejected. \* Returns: {Function} Call to stop the hook. \*\*The `settled` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.\*\* ```mjs import { promiseHooks } from 'node:v8'; const stop = promiseHooks.onSettled((promise) => {}); ``` ```cjs const { promiseHooks } = require('node:v8'); const stop = promiseHooks.onSettled((promise) => {}); ``` ### `promiseHooks.onBefore(before)` \* `before` {Function} The [`before` callback][] to call before a promise continuation executes. \* Returns: {Function} Call to stop the hook. \*\*The `before` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.\*\* ```mjs import { promiseHooks } from 'node:v8'; const stop = promiseHooks.onBefore((promise) => {}); ``` ```cjs const { promiseHooks } = require('node:v8'); const stop = promiseHooks.onBefore((promise) => {}); ``` ### `promiseHooks.onAfter(after)` \* `after` {Function} The [`after` callback][] to call after a promise continuation executes. \* Returns: {Function} Call to stop the hook. \*\*The `after` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop.\*\* ```mjs import { promiseHooks } from 'node:v8'; const stop = promiseHooks.onAfter((promise) => {}); ``` ```cjs const { promiseHooks } = require('node:v8'); const stop = promiseHooks.onAfter((promise) => {}); ``` ### `promiseHooks.createHook(callbacks)` \* `callbacks` {Object} The [Hook Callbacks][] to register \* `init` {Function} The [`init` callback][]. \* `before` {Function} The [`before` callback][]. \* `after` {Function} The [`after` callback][]. \* `settled` {Function} The [`settled` callback][]. \* Returns: {Function} Used for disabling hooks \*\*The hook callbacks must be plain functions. Providing async functions will throw as it would produce an infinite microtask loop.\*\* Registers functions to be called for different lifetime events of each promise. The callbacks `init()`/`before()`/`after()`/`settled()` are called for the respective events during a promise's lifetime. All callbacks are optional. For example, if only promise creation needs to be tracked, then only the `init` callback needs to be passed. The specifics of all functions that can be passed to `callbacks` is in the [Hook Callbacks][] section. ```mjs import { promiseHooks } from 'node:v8'; const stopAll = promiseHooks.createHook({ init(promise, parent) {}, }); ``` ```cjs const { promiseHooks } = require('node:v8'); const
https://github.com/nodejs/node/blob/main//doc/api/v8.md
main
nodejs
[ -0.07655179500579834, -0.0010457164607942104, 0.04754403978586197, 0.04741312190890312, 0.08091236650943756, 0.02681189589202404, -0.02976888231933117, 0.007287909742444754, 0.09424900263547897, -0.007415000349283218, -0.00307029252871871, 0.03446560725569725, -0.05421833321452141, -0.008732946589589119, -0.02442493475973606, -0.027376871556043625, -0.07230732589960098, 0.0032683545723557472, -0.0018691414734348655, -0.029906533658504486, 0.10629526525735855, -0.04697072505950928, 0.048685889691114426, 0.025536296889185905, -0.08163702487945557, -0.025214029476046562, -0.01916670612990856, -0.0680493637919426, 0.056377630680799484, 0.012255789712071419, -0.04186622053384781, -0.09183572232723236, -0.06722582131624222, -0.0034514148719608784, -0.08609864115715027, 0.07124575972557068, -0.028741946443915367, 0.02134282886981964, -0.03471990302205086, -0.011268486268818378, 0.010041695088148117, -0.004086100030690432, -0.12616275250911713, -0.02424459531903267, 0.044750045984983444, -0.04234737902879715, -0.04878561571240425, -0.01549955178052187, -0.05588843673467636, 0.05388004332780838, 0.022207463160157204, 0.0024106514174491167, -0.04621041193604469, 0.030853169038891792, 0.05184946581721306, 0.04003887251019478, 0.0014625125331804156, 0.009626034647226334, 0.04235066473484039, -0.00576423155143857, -0.033679086714982986, -0.07804717123508453, -0.018018309026956558, 0.06083762273192406, 0.05101107433438301, 0.07690999656915665, 0.02484532631933689, 0.026970865204930305, 0.08640595525503159, 0.0340438149869442, -0.0005295284208841622, 0.01906055398285389, -0.016309499740600586, 0.02532770298421383, -0.012578330002725124, -0.04055523872375488, -0.0016748537309467793, 0.021592939272522926, -0.025528134778141975, -0.010187339037656784, -0.044690221548080444, -0.05611845478415489, 0.000415666465414688, -0.01799512654542923, -0.02751927636563778, 0.07391993701457977, 0.015931908041238785, -0.07214828580617905, 0.04634249210357666, -0.05048307776451111, -0.03559942543506622, 0.031190747395157814, -0.10877149552106857, 0.06568994373083115, -0.03902910649776459, 0.01899060420691967, -0.00002085024243569933, 0.0453600212931633, 0.018348537385463715, -0.00423858780413866, 0.07651343941688538, -0.005641454365104437, -0.028030499815940857, -0.024715833365917206, 0.019297683611512184, -0.06103959679603577, -0.08461346477270126, -0.11384893208742142, -0.07462337613105774, 0.039475154131650925, 0.025593359023332596, 0.0009120363392867148, 0.07619025558233261, 0.0017263100016862154, 0.035020917654037476, 0.08668436855077744, 0.04133186116814613, 0.030221454799175262, 0.052775390446186066, 0.049420315772295, 0.1485043317079544, 0.07966890931129456, 0.12847794592380524, -0.08404296636581421, 0.040968652814626694, 0.05533740296959877, -0.021575944498181343, 2.599522186541985e-34, 0.021306112408638, -0.08526593446731567, -0.05942473188042641, 0.033302485942840576, -0.005487177520990372, 0.03055264800786972, -0.022257961332798004, 0.0683051124215126, -0.0681256428360939, 0.015722710639238358, 0.005561856087297201, -0.05976247787475586, -0.014117631129920483, -0.05652445927262306, 0.06342043727636337, -0.06943892687559128, 0.09088171273469925, -0.0968853086233139, -0.011432423256337643, 0.06363808363676071, -0.055168986320495605, -0.09054335951805115, -0.018960541114211082, 0.07581670582294464, 0.0017300484469160438, 0.0004725867765955627, -0.024943318217992783, 0.10163271427154541, -0.02960144728422165, -0.0177821833640337, 0.05096177011728287, -0.03196100890636444, -0.07566897571086884, -0.0030286856926977634, 0.021209977567195892, -0.0533575639128685, 0.003952577710151672, 0.013908317312598228, -0.08429732173681259, -0.11861615628004074, -0.05077530816197395, 0.06828998029232025, -0.07771378010511398, -0.04721452668309212, 0.02037169598042965, -0.16757649183273315, -0.014194706454873085, 0.01958361081779003, 0.10730955749750137, 0.019547762349247932, 0.08251942694187164, 0.03361974656581879, 0.09537244588136673, -0.029296189546585083, 0.023633351549506187, 0.08562006801366806, 0.006941736675798893, -0.017114371061325073, -0.07426758110523224, 0.0048644584603607655, 0.04279397055506706, -0.15266264975070953, -0.011327679269015789, -0.020578155294060707, -0.06560146808624268, 0.0619455985724926, -0.021310873329639435, -0.026238959282636642, -0.0615360401570797, -0.06096065416932106, -0.013177978806197643, -0.021894648671150208, 0.038561321794986725, 0.03578612580895424, 0.015261377207934856, 0.03529270365834236, -0.054239217191934586, 0.06681717187166214, -0.01627330668270588, -0.027834365144371986, 0.09324262291193008, -0.04429817199707031, -0.08440852910280228, 0.05658268555998802, -0.01421993039548397, 0.05193506181240082, -0.015367423184216022, -0.09598587453365326, 0.013055315241217613, 0.09729918092489243, -0.056496910750865936, 0.03875773772597313, 0.09571070969104767, -0.0018476573750376701, -0.017310304567217827, -4.498217947201584e-33, 0.09070702642202377, 0.008146648295223713, -0.028920339420437813, 0.001519689685665071, 0.041002847254276276, 0.021301250904798508, 0.01003300491720438, -0.03368448466062546, -0.03066418506205082, -0.04586293548345566, 0.03356044366955757, -0.004624117165803909, 0.0364312045276165, 0.07745319604873657, 0.007334392983466387, 0.036597348749637604, 0.0670388862490654, -0.00981188751757145, 0.05269334465265274, -0.0018835172522813082, 0.06675132364034653, -0.03869474306702614, -0.010807507671415806, -0.0071929083205759525, -0.025379056110978127, 0.06144575774669647, -0.007553476840257645, 0.026236047968268394, -0.049776218831539154, -0.03303596377372742, -0.0032504100818187, -0.06621424108743668, -0.007874527014791965, 0.09923350811004639, 0.05435086414217949, -0.06511431187391281, 0.0031873479019850492, 0.002054848475381732, -0.03598208352923393, -0.05833299830555916, 0.1414453089237213, -0.03267575055360794, 0.016213789582252502, -0.023610683158040047, -0.01070804987102747, -0.06992834806442261, 0.021590547636151314, -0.019675014540553093, -0.057421062141656876, -0.026959886774420738, -0.07513768970966339, -0.0002613101387396455, -0.05507507920265198, 0.025531243532896042, -0.034452397376298904, -0.019600452855229378, 0.010377567261457443, -0.08381543308496475, 0.023463444784283638, 0.007296623662114143, 0.00132776889950037, -0.06318626552820206, 0.03264062479138374, 0.044239889830350876, 0.022710582241415977, -0.012352182529866695, -0.03581703454256058, 0.002059334423393011, 0.09485630691051483, 0.0020304459612816572, 0.03701947256922722, 0.02221732959151268, -0.10257405042648315, -0.04394915699958801, -0.05060530826449394, -0.00612690020352602, -0.06117651239037514, -0.17917752265930176, 0.0443858839571476, -0.0035551327746361494, -0.056479427963495255, -0.03688669204711914, 0.008845227770507336, 0.016693012788891792, -0.0222184918820858, 0.040620941668748856, -0.03160792589187622, 0.014363851398229599, -0.0006037131533958018, 0.008938981220126152, -0.005849850829690695, 0.03638048842549324, -0.021218756213784218, -0.024145597591996193, -0.06783898174762726, -5.203854414048692e-8, -0.0012543958146125078, -0.019037464633584023, 0.03799939528107643, -0.0229489803314209, 0.011876099742949009, -0.046324439346790314, 0.030184991657733917, -0.057559385895729065, -0.0929742157459259, -0.04355386272072792, 0.033821213990449905, 0.06648323684930801, 0.0640888586640358, 0.007860591635107994, 0.03463432192802429, -0.0455569364130497, 0.00827682577073574, -0.006776971276849508, -0.04041776806116104, -0.023312116041779518, -0.04973163828253746, 0.031193824484944344, -0.021994486451148987, -0.023587243631482124, -0.022727670148015022, -0.016593564301729202, 0.09558721631765366, 0.09109704941511154, 0.018392570316791534, -0.013043543323874474, -0.0879814624786377, 0.0011083207791671157, 0.04381886124610901, 0.017254628241062164, 0.005609528627246618, 0.016078809276223183, -0.018613819032907486, -0.005068284459412098, 0.10842278599739075, 0.010909484699368477, 0.09492819756269455, -0.004757184535264969, -0.004356039222329855, 0.05257241055369377, 0.01726430468261242, -0.012919201515614986, 0.03578487038612366, -0.02516382746398449, 0.08107228577136993, 0.029077570885419846, -0.07881181687116623, -0.01235844288021326, -0.05017811432480812, 0.03119376115500927, -0.010949430987238884, -0.03219958394765854, 0.02134118042886257, -0.06404053419828415, -0.005428546108305454, -0.0372762605547905, 0.043440066277980804, -0.05160701274871826, 0.02042205072939396, -0.023649446666240692 ]
0.065934
then only the `init` callback needs to be passed. The specifics of all functions that can be passed to `callbacks` is in the [Hook Callbacks][] section. ```mjs import { promiseHooks } from 'node:v8'; const stopAll = promiseHooks.createHook({ init(promise, parent) {}, }); ``` ```cjs const { promiseHooks } = require('node:v8'); const stopAll = promiseHooks.createHook({ init(promise, parent) {}, }); ``` ### Hook callbacks Key events in the lifetime of a promise have been categorized into four areas: creation of a promise, before/after a continuation handler is called or around an await, and when the promise resolves or rejects. While these hooks are similar to those of [`async\_hooks`][] they lack a `destroy` hook. Other types of async resources typically represent sockets or file descriptors which have a distinct "closed" state to express the `destroy` lifecycle event while promises remain usable for as long as code can still reach them. Garbage collection tracking is used to make promises fit into the `async\_hooks` event model, however this tracking is very expensive and they may not necessarily ever even be garbage collected. Because promises are asynchronous resources whose lifecycle is tracked via the promise hooks mechanism, the `init()`, `before()`, `after()`, and `settled()` callbacks \_must not\_ be async functions as they create more promises which would produce an infinite loop. While this API is used to feed promise events into [`async\_hooks`][], the ordering between the two is undefined. Both APIs are multi-tenant and therefore could produce events in any order relative to each other. #### `init(promise, parent)` \* `promise` {Promise} The promise being created. \* `parent` {Promise} The promise continued from, if applicable. Called when a promise is constructed. This \_does not\_ mean that corresponding `before`/`after` events will occur, only that the possibility exists. This will happen if a promise is created without ever getting a continuation. #### `before(promise)` \* `promise` {Promise} Called before a promise continuation executes. This can be in the form of `then()`, `catch()`, or `finally()` handlers or an `await` resuming. The `before` callback will be called 0 to N times. The `before` callback will typically be called 0 times if no continuation was ever made for the promise. The `before` callback may be called many times in the case where many continuations have been made from the same promise. #### `after(promise)` \* `promise` {Promise} Called immediately after a promise continuation executes. This may be after a `then()`, `catch()`, or `finally()` handler or before an `await` after another `await`. #### `settled(promise)` \* `promise` {Promise} Called when the promise receives a resolution or rejection value. This may occur synchronously in the case of `Promise.resolve()` or `Promise.reject()`. ## Startup Snapshot API The `v8.startupSnapshot` interface can be used to add serialization and deserialization hooks for custom startup snapshots. ```console $ node --snapshot-blob snapshot.blob --build-snapshot entry.js # This launches a process with the snapshot $ node --snapshot-blob snapshot.blob ``` In the example above, `entry.js` can use methods from the `v8.startupSnapshot` interface to specify how to save information for custom objects in the snapshot during serialization and how the information can be used to synchronize these objects during deserialization of the snapshot. For example, if the `entry.js` contains the following script: ```cjs 'use strict'; const fs = require('node:fs'); const zlib = require('node:zlib'); const path = require('node:path'); const assert = require('node:assert'); const v8 = require('node:v8'); class BookShelf { storage = new Map(); // Reading a series of files from directory and store them into storage. constructor(directory, books) { for (const book of books) { this.storage.set(book, fs.readFileSync(path.join(directory, book))); } } static compressAll(shelf) { for (const [ book, content ] of shelf.storage) { shelf.storage.set(book, zlib.gzipSync(content)); } } static decompressAll(shelf) { for (const
https://github.com/nodejs/node/blob/main//doc/api/v8.md
main
nodejs
[ -0.1672494262456894, 0.06682723760604858, -0.012066060677170753, 0.07115746289491653, 0.05394500866532326, -0.03976816311478615, -0.07268034666776657, 0.05311406031250954, 0.058683089911937714, -0.045384809374809265, -0.0638669952750206, 0.02157789096236229, -0.028643207624554634, -0.06989254057407379, -0.0235919039696455, 0.051339562982320786, -0.045484982430934906, -0.0030681202188134193, -0.03879024460911751, -0.04020984470844269, 0.01711244136095047, -0.023555276915431023, 0.006889918819069862, 0.028800882399082184, -0.05198309198021889, -0.056198544800281525, -0.014634979888796806, -0.05525811016559601, 0.014199747703969479, 0.021244801580905914, -0.008789137937128544, -0.06059231236577034, -0.08841294050216675, 0.012839428149163723, -0.1243901178240776, 0.17230165004730225, -0.02307933382689953, -0.05180496722459793, -0.013462350703775883, -0.00877311360090971, 0.03601796180009842, 0.071194589138031, -0.08699739724397659, -0.05579916015267372, 0.07688923180103302, -0.009854745119810104, -0.04059907793998718, -0.04733569920063019, -0.08481957763433456, 0.025465382263064384, -0.01917772926390171, 0.06859281659126282, -0.0943441390991211, 0.05622449889779091, 0.0205204077064991, -0.05188608914613724, -0.011434894986450672, 0.03523319587111473, 0.0022398154251277447, 0.05147317796945572, 0.016766007989645004, -0.05902790650725365, 0.029012147337198257, 0.01464136689901352, 0.04915902391076088, 0.021905280649662018, -0.0057959966361522675, 0.010035968385636806, 0.039947863668203354, 0.03425692021846771, 0.0019628205336630344, -0.002873677760362625, 0.0020941596012562513, 0.0406174436211586, 0.018996739760041237, 0.032275982201099396, -0.02872302755713463, 0.04157926142215729, -0.029744526371359825, -0.015937037765979767, -0.013979589566588402, -0.021749068051576614, -0.008123818784952164, -0.04097653552889824, -0.04490359127521515, 0.09584678709506989, -0.041985753923654556, -0.04245305433869362, -0.019247019663453102, 0.03156029060482979, -0.038122497498989105, -0.07341606169939041, -0.14195550978183746, 0.031267859041690826, -0.014765321277081966, -0.009422880597412586, 0.026074087247252464, -0.027388613671064377, -0.043015286326408386, -0.04397881031036377, -0.020918434485793114, -0.015755759552121162, 0.06097782403230667, 0.013582330197095871, 0.0409260019659996, -0.0344056598842144, -0.035938408225774765, -0.11137540638446808, -0.038057491183280945, -0.005420086905360222, 0.010193021968007088, -0.014866640791296959, 0.053033020347356796, 0.020253708586096764, 0.046826399862766266, 0.0718688815832138, 0.047505371272563934, -0.052162446081638336, 0.10685091465711594, 0.08047059923410416, 0.09161675721406937, 0.09298335760831833, 0.06302807480096817, -0.004733368754386902, -0.05973631516098976, 0.039632100611925125, 0.004742099437862635, 4.145921555576175e-33, -0.014208657667040825, -0.04516524076461792, -0.01577300764620304, 0.056607894599437714, -0.006396791432052851, -0.03023650497198105, 0.01351749524474144, -0.0090486453846097, -0.05425009876489639, -0.02981608919799328, 0.025761457160115242, -0.027283314615488052, 0.003552192123606801, -0.04680302366614342, 0.024242591112852097, -0.0076371487230062485, 0.05600503459572792, -0.09000542014837265, 0.0043083252385258675, 0.062011174857616425, -0.012898805551230907, -0.019356416538357735, -0.03200334310531616, 0.021810708567500114, 0.05251023918390274, -0.021984761580824852, -0.011097400449216366, 0.05318868160247803, -0.061329104006290436, -0.01711932197213173, 0.032845158129930496, 0.03886379674077034, -0.07030130177736282, 0.019159965217113495, -0.046439267694950104, -0.04674002155661583, -0.06751667708158493, -0.03532404452562332, -0.11441300809383392, -0.08297107368707657, -0.05885878950357437, 0.07409723103046417, -0.11354905366897583, 0.005543124862015247, -0.007335413713008165, -0.11322221904993057, 0.010834206826984882, -0.04580564424395561, 0.08911323547363281, -0.019817495718598366, 0.03684188053011894, 0.0054658581502735615, 0.08222443610429764, -0.04996105656027794, 0.03786851093173027, 0.07275795936584473, 0.04134652763605118, -0.06301749497652054, -0.0012811357155442238, 0.0022264018189162016, 0.054119158536195755, -0.15217693150043488, -0.0008762712241150439, 0.019845906645059586, -0.03240847960114479, 0.02452806383371353, -0.09099247306585312, 0.05872464179992676, -0.062254197895526886, -0.01994733326137066, 0.01713179424405098, -0.026115885004401207, -0.02960493043065071, -0.02062371000647545, 0.009418468922376633, 0.07805885374546051, -0.07060996443033218, 0.017395924776792526, 0.0023947355803102255, -0.04315557703375816, 0.07213781028985977, -0.014494074508547783, -0.0630246102809906, 0.07651664316654205, 0.04781302064657211, 0.058218784630298615, 0.00034349370980635285, -0.10184179991483688, 0.05965837091207504, 0.09470321983098984, -0.026033099740743637, -0.056135233491659164, 0.015906477347016335, -0.04942147433757782, -0.07892988622188568, -7.834110019045967e-33, 0.07492320239543915, 0.05834787338972092, -0.052313849329948425, 0.06944220513105392, -0.029345186427235603, 0.05070865899324417, 0.0048380964435637, -0.044253911823034286, -0.020204223692417145, -0.04609736427664757, -0.0026449114084243774, 0.011869885958731174, 0.06500402092933655, 0.056113772094249725, 0.031170032918453217, -0.0012923575704917312, -0.017011255025863647, -0.014503151178359985, 0.03994851931929588, -0.03657779470086098, 0.0391923226416111, -0.021934354677796364, -0.0067556812427937984, 0.012870412319898605, -0.07883941382169724, -0.008782470598816872, -0.08250497281551361, 0.005682431627064943, 0.021357374265789986, -0.052015338093042374, -0.028873266652226448, -0.0031302913557738066, -0.03011147677898407, 0.0930052176117897, 0.0735958069562912, -0.08549560606479645, 0.02183704823255539, 0.03194030374288559, -0.01595863327383995, -0.1084880381822586, 0.15871253609657288, 0.004300712142139673, -0.043595459312200546, 0.011617418378591537, -0.000029311673642951064, -0.03458097577095032, 0.012584962882101536, -0.00015956324932631105, -0.005046382080763578, -0.01985861547291279, -0.07189535349607468, -0.03782298043370247, -0.025709116831421852, 0.085403673350811, -0.07086231559515, 0.02470565214753151, 0.08369520306587219, 0.0158431027084589, 0.10393692553043365, -0.0029087821021676064, -0.024021264165639877, -0.0744311586022377, 0.004430330824106932, -0.0071771941147744656, -0.05157693848013878, -0.010896353982388973, -0.06199153885245323, -0.018770353868603706, 0.10242471843957901, 0.030234094709157944, 0.03584953024983406, 0.029111823067069054, -0.009263473562896252, -0.04347895458340645, -0.04043499380350113, 0.000041442654037382454, -0.04709463566541672, -0.1818581074476242, 0.05378948897123337, 0.02860892191529274, -0.07799696177244186, 0.0033902146387845278, 0.020943207666277885, 0.09946386516094208, 0.025335296988487244, 0.006518792361021042, -0.011048421263694763, 0.015439962968230247, 0.006177283823490143, -0.005473806988447905, 0.015565038658678532, 0.02294728346168995, -0.13096323609352112, 0.013696959242224693, -0.028631895780563354, -6.428668086755351e-8, -0.004837649408727884, 0.0473477840423584, -0.007677754852920771, 0.03558053448796272, 0.008705276995897293, -0.06813833862543106, 0.04108908772468567, -0.0023729114327579737, -0.01946292072534561, 0.04341025650501251, 0.008673387579619884, -0.008986277505755424, 0.08556883782148361, -0.0017342261271551251, -0.04405638203024864, 0.03551248833537102, 0.01673457957804203, -0.020634615793824196, 0.024165086448192596, 0.005300852004438639, -0.05687936395406723, -0.00911263283342123, 0.017339853569865227, 0.062110744416713715, -0.004645138047635555, 0.010953318327665329, 0.07654787600040436, 0.10302980244159698, -0.018441053107380867, 0.011851937510073185, -0.04931819811463356, 0.0233615692704916, 0.019992459565401077, 0.08010965585708618, -0.05974573642015457, 0.011583753861486912, 0.008484493009746075, 0.028322111815214157, 0.07316646724939346, 0.019584575667977333, 0.03781820833683014, 0.012514050118625164, -0.019134508445858955, 0.04382282868027687, -0.011832104064524174, 0.04624779894948006, -0.013339961878955364, 0.01877605728805065, -0.028930742293596268, 0.06603166460990906, -0.032689131796360016, -0.028313124552369118, 0.00571463443338871, 0.05700068548321724, 0.054061517119407654, -0.03478637710213661, 0.03458569943904877, -0.03399200364947319, 0.021621230989694595, -0.018157824873924255, 0.037902262061834335, -0.024243827909231186, 0.1255997121334076, -0.04272190481424332 ]
0.10599
new Map(); // Reading a series of files from directory and store them into storage. constructor(directory, books) { for (const book of books) { this.storage.set(book, fs.readFileSync(path.join(directory, book))); } } static compressAll(shelf) { for (const [ book, content ] of shelf.storage) { shelf.storage.set(book, zlib.gzipSync(content)); } } static decompressAll(shelf) { for (const [ book, content ] of shelf.storage) { shelf.storage.set(book, zlib.gunzipSync(content)); } } } // \_\_dirname here is where the snapshot script is placed // during snapshot building time. const shelf = new BookShelf(\_\_dirname, [ 'book1.en\_US.txt', 'book1.es\_ES.txt', 'book2.zh\_CN.txt', ]); assert(v8.startupSnapshot.isBuildingSnapshot()); // On snapshot serialization, compress the books to reduce size. v8.startupSnapshot.addSerializeCallback(BookShelf.compressAll, shelf); // On snapshot deserialization, decompress the books. v8.startupSnapshot.addDeserializeCallback(BookShelf.decompressAll, shelf); v8.startupSnapshot.setDeserializeMainFunction((shelf) => { // process.env and process.argv are refreshed during snapshot // deserialization. const lang = process.env.BOOK\_LANG || 'en\_US'; const book = process.argv[1]; const name = `${book}.${lang}.txt`; console.log(shelf.storage.get(name)); }, shelf); ``` The resulted binary will get print the data deserialized from the snapshot during start up, using the refreshed `process.env` and `process.argv` of the launched process: ```console $ BOOK\_LANG=es\_ES node --snapshot-blob snapshot.blob book1 # Prints content of book1.es\_ES.txt deserialized from the snapshot. ``` Currently the application deserialized from a user-land snapshot cannot be snapshotted again, so these APIs are only available to applications that are not deserialized from a user-land snapshot. ### `v8.startupSnapshot.addSerializeCallback(callback[, data])` \* `callback` {Function} Callback to be invoked before serialization. \* `data` {any} Optional data that will be passed to the `callback` when it gets called. Add a callback that will be called when the Node.js instance is about to get serialized into a snapshot and exit. This can be used to release resources that should not or cannot be serialized or to convert user data into a form more suitable for serialization. Callbacks are run in the order in which they are added. ### `v8.startupSnapshot.addDeserializeCallback(callback[, data])` \* `callback` {Function} Callback to be invoked after the snapshot is deserialized. \* `data` {any} Optional data that will be passed to the `callback` when it gets called. Add a callback that will be called when the Node.js instance is deserialized from a snapshot. The `callback` and the `data` (if provided) will be serialized into the snapshot, they can be used to re-initialize the state of the application or to re-acquire resources that the application needs when the application is restarted from the snapshot. Callbacks are run in the order in which they are added. ### `v8.startupSnapshot.setDeserializeMainFunction(callback[, data])` \* `callback` {Function} Callback to be invoked as the entry point after the snapshot is deserialized. \* `data` {any} Optional data that will be passed to the `callback` when it gets called. This sets the entry point of the Node.js application when it is deserialized from a snapshot. This can be called only once in the snapshot building script. If called, the deserialized application no longer needs an additional entry point script to start up and will simply invoke the callback along with the deserialized data (if provided), otherwise an entry point script still needs to be provided to the deserialized application. ### `v8.startupSnapshot.isBuildingSnapshot()` \* Returns: {boolean} Returns true if the Node.js instance is run to build a snapshot. ## Class: `v8.GCProfiler` This API collects GC data in current thread. ### `new v8.GCProfiler()` Create a new instance of the `v8.GCProfiler` class. This API supports `using` syntax. ### `profiler.start()` Start collecting GC data. ### `profiler.stop()` Stop collecting GC data and return an object. The content of object is as follows. ```json { "version": 1, "startTime": 1674059033862, "statistics": [ { "gcType": "Scavenge", "beforeGC": { "heapStatistics": { "totalHeapSize": 5005312, "totalHeapSizeExecutable": 524288, "totalPhysicalSize": 5226496, "totalAvailableSize": 4341325216, "totalGlobalHandlesSize": 8192, "usedGlobalHandlesSize": 2112, "usedHeapSize": 4883840, "heapSizeLimit": 4345298944, "mallocedMemory": 254128, "externalMemory":
https://github.com/nodejs/node/blob/main//doc/api/v8.md
main
nodejs
[ -0.10670431703329086, 0.06575417518615723, -0.09203892946243286, 0.061658017337322235, 0.005144668743014336, -0.06368394941091537, -0.04573593661189079, 0.08545058965682983, -0.03574995696544647, 0.022457242012023926, 0.020533403381705284, 0.06283577531576157, 0.08625338971614838, 0.0009620334021747112, -0.05987457185983658, -0.052281808108091354, -0.11591663956642151, 0.056511349976062775, 0.0044698589481413364, 0.0170066449791193, -0.008095416240394115, 0.038972172886133194, 0.08256945013999939, -0.03818339854478836, 0.08018623292446136, -0.012443399988114834, -0.04015832394361496, -0.06433133035898209, -0.007165046408772469, -0.01747203804552555, 0.10029686242341995, -0.013119171373546124, -0.03128473088145256, 0.03981609269976616, 0.0816727727651596, 0.13820797204971313, 0.06165243685245514, -0.07106568664312363, -0.026594530791044235, -0.0048195733688771725, 0.012137994170188904, 0.15150977671146393, -0.11412152647972107, -0.008841021917760372, -0.04784904792904854, 0.03785070776939392, 0.05050623044371605, 0.02365114539861679, -0.02009519562125206, 0.03064974956214428, -0.10379298776388168, 0.01730467565357685, -0.1058676689863205, 0.04601431265473366, -0.004415343049913645, 0.13867837190628052, -0.042168065905570984, -0.037731971591711044, -0.02984776347875595, -0.0030180495232343674, 0.0007506878464482725, -0.029559172689914703, 0.02504926733672619, -0.018053902313113213, 0.051787834614515305, 0.04438277333974838, 0.07274635136127472, 0.10796438157558441, -0.0018937662243843079, -0.02765820547938347, -0.015883686020970345, 0.10499028861522675, -0.005367569625377655, 0.04055490344762802, -0.048850469291210175, -0.014546851627528667, -0.012485601007938385, -0.015051878057420254, 0.010559042915701866, -0.05950171872973442, -0.02112700417637825, -0.10884693264961243, 0.06244015321135521, -0.06483598798513412, -0.035073768347501755, 0.025598041713237762, -0.035016968846321106, -0.03722710534930229, -0.07781252264976501, -0.03686103969812393, 0.06655377894639969, -0.02491382695734501, 0.04632541537284851, 0.11048857122659683, -0.018412865698337555, 0.03360498324036598, 0.03975460305809975, 0.08394748717546463, 0.06987758725881577, 0.0069877090863883495, -0.005670680198818445, 0.054382938891649246, 0.09887401759624481, -0.06659789383411407, -0.013482979498803616, -0.07056063413619995, 0.054293833673000336, -0.04739917442202568, -0.13575223088264465, 0.004332618322223425, -0.03290240094065666, 0.060222215950489044, -0.0005095415399409831, -0.04460824280977249, -0.034821607172489166, 0.0013810471864417195, -0.01064841914921999, 0.033807422965765, 0.01345460768789053, 0.07562144100666046, 0.05681146681308746, 0.03664641082286835, 0.018360435962677002, -0.009495841339230537, -0.0021577030420303345, -0.04160815477371216, 0.013792294077575207, 2.8856130832901518e-33, -0.0014253135304898024, -0.022130444645881653, 0.013754636980593204, 0.11270008236169815, 0.019508235156536102, -0.008715487085282803, 0.06789751350879669, 0.043535102158784866, -0.11267922818660736, 0.03441547974944115, -0.09890491515398026, 0.018315086141228676, -0.04589157924056053, -0.03473537787795067, -0.05527310445904732, -0.01914983242750168, -0.0480208620429039, -0.006080683320760727, -0.005205446854233742, 0.026072729378938675, 0.07607882469892502, 0.021517222747206688, -0.014172866009175777, -0.034718044102191925, 0.033552493900060654, -0.05000246316194534, 0.04768580198287964, -0.02684745565056801, -0.06403551995754242, -0.017036903649568558, 0.0799574926495552, -0.03656033053994179, -0.033886540681123734, -0.03133685514330864, 0.07832877337932587, -0.016161467880010605, 0.019580643624067307, 0.00816473737359047, -0.11697790026664734, -0.0714002475142479, -0.014964336529374123, -0.021304577589035034, -0.05554616451263428, 0.028298527002334595, -0.08255189657211304, 0.005406908690929413, 0.006278150714933872, -0.03062594123184681, -0.028581030666828156, 0.00933078769594431, -0.004298229236155748, 0.012192564085125923, -0.07385753095149994, 0.020763209089636803, -0.022452250123023987, -0.004758508410304785, -0.047763172537088394, -0.06282864511013031, 0.07755296677350998, 0.03482327237725258, 0.0036039547994732857, 0.06773021072149277, 0.012553083710372448, 0.00783825758844614, 0.08103684335947037, 0.019313998520374298, -0.06824536621570587, 0.003984415903687477, 0.056689850986003876, -0.05373913794755936, -0.010963765904307365, -0.03815101459622383, 0.06823161244392395, -0.01455312967300415, 0.03589471057057381, -0.008148378692567348, -0.09149954468011856, 0.00202208012342453, -0.07924620807170868, -0.136113703250885, -0.006456627044826746, -0.07248008996248245, -0.0025754941161721945, 0.035537250339984894, -0.024453286081552505, 0.008826800622045994, -0.028259502723813057, -0.04733195900917053, 0.02754140831530094, -0.008802936412394047, 0.05201341211795807, -0.034323617815971375, 0.011268521659076214, -0.11731566488742828, 0.018398981541395187, -3.1936620308406866e-33, 0.11100658029317856, -0.03257698938250542, -0.0513438954949379, 0.026813453063368797, 0.02896757610142231, 0.014684556052088737, -0.0006921672611497343, -0.046328336000442505, -0.054895054548978806, -0.02390635944902897, -0.12799184024333954, 0.024095961824059486, 0.04508984833955765, -0.014037488959729671, -0.01924491859972477, -0.010653580538928509, 0.06226954609155655, -0.12256638705730438, 0.038255441933870316, -0.02026589773595333, -0.022389015182852745, -0.04159412533044815, 0.04130607470870018, 0.05380723625421524, 0.041344694793224335, 0.04277032986283302, -0.05149160325527191, 0.0017534535145387053, 0.010225178673863411, 0.011554555036127567, 0.015055195428431034, -0.004405831918120384, 0.008957545273005962, -0.03159813582897186, -0.036820102483034134, -0.08148825913667679, -0.015753017738461494, 0.09301500022411346, -0.04629388079047203, -0.030803445726633072, 0.0041656214743852615, 0.00010536799527471885, -0.04862115904688835, -0.08066114038228989, 0.04755530506372452, -0.019291654229164124, 0.03558673709630966, -0.0244689229875803, 0.015452133491635323, 0.001409004325978458, -0.00062441301997751, -0.006883527152240276, -0.043181583285331726, -0.048961341381073, 0.12281841039657593, 0.03740690276026726, -0.010918299667537212, -0.07177288085222244, -0.002836856059730053, 0.05001090094447136, 0.010240087285637856, -0.039380986243486404, 0.005645616911351681, -0.04298270493745804, -0.018702568486332893, -0.08021171391010284, -0.0697178840637207, -0.0337061770260334, 0.06374252587556839, 0.028997033834457397, -0.03970929607748985, 0.0604146271944046, 0.08335741609334946, -0.00037996427272446454, 0.014825823716819286, 0.030590936541557312, 0.038036130368709564, -0.03609756752848625, 0.0648169070482254, 0.014972335658967495, -0.027951255440711975, 0.017725083976984024, -0.027049364522099495, 0.11436237394809723, 0.023426134139299393, -0.04694788157939911, 0.033393874764442444, -0.018767623230814934, -0.0021418656688183546, -0.08140473067760468, -0.015834027901291847, 0.028360553085803986, -0.03481416776776314, -0.01571550965309143, 0.06161963567137718, -4.6112258900166125e-8, -0.08435535430908203, 0.011575210839509964, -0.03549588844180107, 0.04092217609286308, 0.0019690021872520447, -0.07080688327550888, 0.07079815864562988, 0.07166008651256561, 0.009811255149543285, -0.05856069549918175, 0.07595133781433105, -0.013107148930430412, 0.0417209155857563, -0.02853172831237316, -0.05128198489546776, 0.0006108898669481277, 0.048475563526153564, -0.014021338894963264, -0.022678658366203308, 0.06386353820562363, 0.0838421881198883, 0.001268555293790996, 0.01097090169787407, 0.11957412958145142, 0.07268619537353516, -0.001274831360206008, 0.08872302621603012, -0.053124718368053436, 0.03821643441915512, -0.025120817124843597, -0.006574430037289858, 0.01871606707572937, 0.08027426898479462, -0.03736257553100586, -0.04909826070070267, -0.015021655708551407, 0.021405963227152824, 0.05220451578497887, 0.01994604617357254, 0.014265763573348522, 0.005359091330319643, 0.03256421536207199, 0.015540342777967453, -0.003940656315535307, -0.0015547124203294516, -0.07572560757398605, -0.013278870843350887, 0.05998176708817482, 0.03562573343515396, 0.06989248842000961, -0.026824651286005974, 0.007589661981910467, -0.008575377985835075, 0.0507618710398674, 0.04354628548026085, -0.01773500256240368, 0.004991538356989622, -0.008321098051965237, 0.01769440993666649, -0.0006936559802852571, 0.0035792826674878597, -0.07832992076873779, -0.02591625042259693, 0.015930505469441414 ]
-0.016401
`profiler.stop()` Stop collecting GC data and return an object. The content of object is as follows. ```json { "version": 1, "startTime": 1674059033862, "statistics": [ { "gcType": "Scavenge", "beforeGC": { "heapStatistics": { "totalHeapSize": 5005312, "totalHeapSizeExecutable": 524288, "totalPhysicalSize": 5226496, "totalAvailableSize": 4341325216, "totalGlobalHandlesSize": 8192, "usedGlobalHandlesSize": 2112, "usedHeapSize": 4883840, "heapSizeLimit": 4345298944, "mallocedMemory": 254128, "externalMemory": 225138, "peakMallocedMemory": 181760 }, "heapSpaceStatistics": [ { "spaceName": "read\_only\_space", "spaceSize": 0, "spaceUsedSize": 0, "spaceAvailableSize": 0, "physicalSpaceSize": 0 } ] }, "cost": 1574.14, "afterGC": { "heapStatistics": { "totalHeapSize": 6053888, "totalHeapSizeExecutable": 524288, "totalPhysicalSize": 5500928, "totalAvailableSize": 4341101384, "totalGlobalHandlesSize": 8192, "usedGlobalHandlesSize": 2112, "usedHeapSize": 4059096, "heapSizeLimit": 4345298944, "mallocedMemory": 254128, "externalMemory": 225138, "peakMallocedMemory": 181760 }, "heapSpaceStatistics": [ { "spaceName": "read\_only\_space", "spaceSize": 0, "spaceUsedSize": 0, "spaceAvailableSize": 0, "physicalSpaceSize": 0 } ] } } ], "endTime": 1674059036865 } ``` Here's an example. ```mjs import { GCProfiler } from 'node:v8'; const profiler = new GCProfiler(); profiler.start(); setTimeout(() => { console.log(profiler.stop()); }, 1000); ``` ```cjs const { GCProfiler } = require('node:v8'); const profiler = new GCProfiler(); profiler.start(); setTimeout(() => { console.log(profiler.stop()); }, 1000); ``` ### `profiler[Symbol.dispose]()` Stop collecting GC data, and discard the profile. ## Class: `SyncCPUProfileHandle` ### `syncCpuProfileHandle.stop()` \* Returns: {string} Stopping collecting the profile and return the profile data. ### `syncCpuProfileHandle[Symbol.dispose]()` Stopping collecting the profile and the profile will be discarded. ## Class: `CPUProfileHandle` ### `cpuProfileHandle.stop()` \* Returns: {Promise} Stopping collecting the profile, then return a Promise that fulfills with an error or the profile data. ### `cpuProfileHandle[Symbol.asyncDispose]()` \* Returns: {Promise} Stopping collecting the profile and the profile will be discarded. ## Class: `HeapProfileHandle` ### `heapProfileHandle.stop()` \* Returns: {Promise} Stopping collecting the profile, then return a Promise that fulfills with an error or the profile data. ### `heapProfileHandle[Symbol.asyncDispose]()` \* Returns: {Promise} Stopping collecting the profile and the profile will be discarded. ## `v8.isStringOneByteRepresentation(content)` \* `content` {string} \* Returns: {boolean} V8 only supports `Latin-1/ISO-8859-1` and `UTF16` as the underlying representation of a string. If the `content` uses `Latin-1/ISO-8859-1` as the underlying representation, this function will return true; otherwise, it returns false. If this method returns false, that does not mean that the string contains some characters not in `Latin-1/ISO-8859-1`. Sometimes a `Latin-1` string may also be represented as `UTF16`. ```mjs import { isStringOneByteRepresentation } from 'node:v8'; import { Buffer } from 'node:buffer'; const Encoding = { latin1: 1, utf16le: 2, }; const buffer = Buffer.alloc(100); function writeString(input) { if (isStringOneByteRepresentation(input)) { console.log(`input: '${input}'`); buffer.writeUint8(Encoding.latin1); buffer.writeUint32LE(input.length, 1); buffer.write(input, 5, 'latin1'); console.log(`decoded: '${buffer.toString('latin1', 5, 5 + input.length)}'\n`); } else { console.log(`input: '${input}'`); buffer.writeUint8(Encoding.utf16le); buffer.writeUint32LE(input.length \* 2, 1); buffer.write(input, 5, 'utf16le'); console.log(`decoded: '${buffer.toString('utf16le', 5, 5 + input.length \* 2)}'`); } } writeString('hello'); writeString('你好'); ``` ```cjs const { isStringOneByteRepresentation } = require('node:v8'); const { Buffer } = require('node:buffer'); const Encoding = { latin1: 1, utf16le: 2, }; const buffer = Buffer.alloc(100); function writeString(input) { if (isStringOneByteRepresentation(input)) { console.log(`input: '${input}'`); buffer.writeUint8(Encoding.latin1); buffer.writeUint32LE(input.length, 1); buffer.write(input, 5, 'latin1'); console.log(`decoded: '${buffer.toString('latin1', 5, 5 + input.length)}'\n`); } else { console.log(`input: '${input}'`); buffer.writeUint8(Encoding.utf16le); buffer.writeUint32LE(input.length \* 2, 1); buffer.write(input, 5, 'utf16le'); console.log(`decoded: '${buffer.toString('utf16le', 5, 5 + input.length \* 2)}'`); } } writeString('hello'); writeString('你好'); ``` ## `v8.startCpuProfile()` \* Returns: {SyncCPUProfileHandle} Starting a CPU profile then return a `SyncCPUProfileHandle` object. This API supports `using` syntax. ```cjs const handle = v8.startCpuProfile(); const profile = handle.stop(); console.log(profile); ``` [CppHeap]: https://v8docs.nodesource.com/node-22.4/d9/dc4/classv8\_1\_1\_cpp\_heap.html [HTML structured clone algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web\_Workers\_API/Structured\_clone\_algorithm [Hook Callbacks]: #hook-callbacks [V8]: https://developers.google.com/v8/ [`--heapsnapshot-near-heap-limit`]: cli.md#--heapsnapshot-near-heap-limitmax\_count [`AsyncLocalStorage`]: async\_context.md#class-asynclocalstorage [`Buffer`]: buffer.md [`CollectStatistics()`]: https://v8docs.nodesource.com/node-22.4/d9/dc4/classv8\_1\_1\_cpp\_heap.html#a3a5d09567758e608fffde50eeabc2feb [`DefaultDeserializer`]: #class-v8defaultdeserializer [`DefaultSerializer`]: #class-v8defaultserializer [`Deserializer`]: #class-v8deserializer [`ERR\_BUFFER\_TOO\_LARGE`]: errors.md#err\_buffer\_too\_large [`Error`]: errors.md#class-error [`GetHeapCodeAndMetadataStatistics`]: https://v8docs.nodesource.com/node-13.2/d5/dda/classv8\_1\_1\_isolate.html#a6079122af17612ef54ef3348ce170866 [`GetHeapSpaceStatistics`]: https://v8docs.nodesource.com/node-13.2/d5/dda/classv8\_1\_1\_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4 [`NODE\_V8\_COVERAGE`]: cli.md#node\_v8\_coveragedir [`Serializer`]: #class-v8serializer [`after` callback]: #afterpromise [`async\_hooks`]: async\_hooks.md [`before` callback]: #beforepromise [`buffer.constants.MAX\_LENGTH`]: buffer.md#bufferconstantsmax\_length [`cppgc::HeapStatistics struct`]: https://v8docs.nodesource.com/node-22.4/df/d2f/structcppgc\_1\_1\_heap\_statistics.html [`cppgc::HeapStatistics`]: https://v8docs.nodesource.com/node-22.4/d7/d51/heap-statistics\_8h\_source.html [`deserializer.\_readHostObject()`]: #deserializer\_readhostobject [`deserializer.transferArrayBuffer()`]: #deserializertransferarraybufferid-arraybuffer [`init` callback]: #initpromise-parent [`queryObjects()` console API]: https://developer.chrome.com/docs/devtools/console/utilities#queryObjects-function [`serialize()`]: #v8serializevalue [`serializer.\_getSharedArrayBufferId()`]: #serializer\_getsharedarraybufferidsharedarraybuffer [`serializer.\_writeHostObject()`]: #serializer\_writehostobjectobject [`serializer.releaseBuffer()`]: #serializerreleasebuffer [`serializer.transferArrayBuffer()`]: #serializertransferarraybufferid-arraybuffer [`serializer.writeRawBytes()`]: #serializerwriterawbytesbuffer
https://github.com/nodejs/node/blob/main//doc/api/v8.md
main
nodejs
[ -0.028004853054881096, 0.0407753512263298, -0.07409477233886719, 0.0343547984957695, -0.01125272549688816, -0.0807352289557457, 0.017644934356212616, 0.06400709599256516, -0.0445697121322155, 0.003650505095720291, -0.021506771445274353, -0.06145292893052101, -0.043760109692811966, 0.001944294199347496, -0.02883256785571575, -0.005437755491584539, 0.0066725388169288635, 0.0359027236700058, -0.03434554114937782, -0.08523474633693695, 0.008719358593225479, 0.08460421115159988, 0.03379245847463608, -0.023652248084545135, -0.0036859570536762476, 0.06845279783010483, -0.08020885288715363, -0.023669905960559845, 0.020135365426540375, 0.002918222453445196, 0.06007597967982292, -0.03343253582715988, -0.009816518053412437, 0.01890629529953003, 0.06475132703781128, 0.07837134599685669, -0.061475250869989395, -0.04303034767508507, 0.0438961535692215, -0.05194005370140076, 0.05936575308442116, 0.08838371932506561, -0.111788310110569, 0.021627558395266533, 0.009614360518753529, -0.0338350273668766, -0.07688399404287338, -0.023793742060661316, -0.03672606125473976, 0.012500456534326077, 0.015634724870324135, 0.0060471645556390285, -0.05749119445681572, 0.019906988367438316, 0.041078560054302216, 0.06893111765384674, 0.0028892362024635077, -0.01778392866253853, 0.010350772179663181, 0.03533904254436493, -0.06549300998449326, -0.040544066578149796, -0.07776597887277603, -0.07654882967472076, -0.00537498202174902, -0.054762210696935654, 0.059873033314943314, 0.018471814692020416, 0.012819241732358932, -0.009919089265167713, 0.04158654436469078, 0.054907456040382385, -0.038280658423900604, -0.000611059193033725, 0.0316784605383873, 0.03682059794664383, -0.07389146834611893, 0.009358590468764305, 0.04141872376203537, -0.054410964250564575, 0.03257991746068001, -0.07366164028644562, 0.046384409070014954, 0.036385130137205124, -0.038164108991622925, -0.014640195295214653, 0.031704217195510864, 0.0644126906991005, 0.04362596198916435, 0.010721507482230663, -0.02886999025940895, 0.05277436971664429, -0.03250383213162422, 0.02843601256608963, -0.027236612513661385, 0.010072551667690277, -0.02176736295223236, -0.05681990087032318, 0.04018707573413849, 0.031183065846562386, -0.019792990759015083, -0.008465735241770744, 0.14775435626506805, 0.08040900528430939, 0.010388260707259178, -0.06247715279459953, -0.021801000460982323, 0.07505518198013306, -0.06107437238097191, 0.035329509526491165, -0.004734943620860577, 0.11943849176168442, -0.033145561814308167, 0.004339293111115694, 0.013389565981924534, 0.02619798481464386, 0.008294247090816498, 0.001742429449222982, -0.06998079270124435, 0.08976156264543533, 0.159977987408638, -0.006143308710306883, 0.03540324419736862, -0.0017755756853148341, -0.052772533148527145, 0.0067581734620034695, 0.010720746591687202, 1.1012633519357986e-32, 0.03709821030497551, -0.16754032671451569, 0.08532548695802689, -0.048102378845214844, -0.04995649307966232, 0.034875452518463135, -0.035088054835796356, 0.07799216359853745, 0.07351341843605042, -0.0027040797285735607, -0.07535488158464432, 0.034560345113277435, -0.01644054614007473, 0.06056494638323784, 0.035214368253946304, 0.0003264271072112024, 0.019126446917653084, 0.05470447614789009, -0.05725356191396713, -0.005059970077127218, 0.027939539402723312, -0.028766917064785957, -0.027297433465719223, -0.019329367205500603, -0.020994070917367935, 0.03227109834551811, -0.0167999267578125, -0.03396829590201378, -0.012009640224277973, 0.01479671522974968, 0.03312913700938225, -0.03157380595803261, -0.05204133316874504, 0.06283736228942871, 0.10391491651535034, -0.024468494579195976, -0.027376355603337288, -0.016695771366357803, -0.03560939431190491, -0.1233024001121521, -0.0504537895321846, -0.01562870852649212, -0.03611717373132706, -0.04633896425366402, -0.1260402947664261, -0.09699379652738571, 0.023396963253617287, -0.061638616025447845, -0.04534835368394852, 0.0579468235373497, 0.06527408957481384, 0.027660401538014412, -0.05088818445801735, 0.05671737715601921, -0.05761134997010231, 0.010537415742874146, 0.057535044848918915, 0.03283597528934479, 0.004566585179418325, 0.033292606472969055, 0.026323843747377396, 0.09383939951658249, 0.010344208218157291, -0.02756224013864994, 0.029200593009591103, -0.06578413397073746, -0.08077891916036606, 0.01776965893805027, -0.038204774260520935, 0.09677741676568985, 0.02613615244626999, 0.03772755339741707, 0.0688529834151268, 0.006829679943621159, -0.024225885048508644, -0.047411274164915085, 0.021696683019399643, 0.0486651211977005, -0.12298212200403214, -0.04010821506381035, 0.09069904685020447, 0.0035153941716998816, -0.013703715056180954, -0.1219511404633522, -0.047569118440151215, 0.009828515350818634, 0.014228706248104572, -0.07863075286149979, -0.007703376933932304, 0.03204713016748428, -0.028696108609437943, -0.014807564206421375, -0.08802759647369385, -0.04046550765633583, -0.16261397302150726, -1.0854364225279304e-32, 0.04916508495807648, -0.03683392331004143, 0.06006158888339996, 0.005958750378340483, 0.04810519143939018, -0.06206652522087097, 0.021443301811814308, 0.059970494359731674, 0.009441814385354519, 0.004798815120011568, 0.03049970231950283, -0.013828149996697903, 0.020339859649538994, 0.021422788500785828, 0.07969027757644653, 0.03791147843003273, -0.06762043386697769, -0.05440034717321396, -0.021328743547201157, -0.014560528099536896, 0.022394603118300438, -0.03864089772105217, 0.031663574278354645, -0.03284168243408203, -0.06652573496103287, -0.08906041085720062, -0.033178918063640594, -0.027861079201102257, 0.01714659482240677, -0.016009708866477013, 0.024967240169644356, 0.03927306830883026, -0.06966490298509598, -0.033575188368558884, 0.03580603003501892, -0.10395240783691406, 0.04306136816740036, 0.037029411643743515, -0.030317947268486023, 0.001032059546560049, 0.08122742921113968, 0.07299051433801651, -0.051132019609212875, 0.01718795672059059, 0.0871710255742073, -0.017875397577881813, 0.010945170186460018, 0.04073510691523552, 0.04934733733534813, -0.03447290509939194, 0.029546566307544708, 0.025454290211200714, 0.01761677674949169, 0.0285233985632658, 0.0371013842523098, 0.006474072113633156, 0.05273708701133728, -0.11621558666229248, -0.02269137091934681, -0.048956308513879776, 0.026729518547654152, -0.0923829898238182, -0.029022639617323875, -0.0364939384162426, 0.06957082450389862, -0.03183060884475708, 0.075927734375, -0.051631223410367966, -0.07445989549160004, 0.03470762446522713, -0.0322721041738987, -0.02763797901570797, -0.02749107964336872, -0.03178868815302849, -0.023509591817855835, 0.005780948791652918, -0.057895727455616, -0.075809545814991, 0.05914948135614395, -0.017514333128929138, 0.03165512904524803, 0.06920047104358673, 0.02144167758524418, 0.052828945219516754, 0.0770271047949791, -0.07571550458669662, -0.06124207377433777, 0.021427933126688004, -0.013077261857688427, 0.0012211385183036327, -0.01757413148880005, -0.014546817168593407, -0.012008469551801682, 0.11101536452770233, -0.008791119791567326, -6.191546475520227e-8, -0.07160327583551407, -0.03533077612519264, -0.05703473463654518, 0.06645384430885315, 0.07371769845485687, 0.03885175660252571, -0.007409474812448025, 0.06830939650535583, 0.04439914971590042, -0.02244114689528942, 0.12079645693302155, 0.038459934294223785, -0.09416797757148743, -0.0027382068801671267, -0.0054564340971410275, -0.06573619693517685, -0.03569585084915161, 0.0027495212852954865, 0.006935429759323597, 0.019796835258603096, 0.0036646262742578983, -0.02020263485610485, -0.0029622381553053856, -0.01732485741376877, 0.010854491032660007, -0.02449687384068966, 0.0752534419298172, 0.06727845221757889, -0.009306064806878567, -0.07099296897649765, 0.006607468705624342, 0.007577689830213785, 0.06647269427776337, -0.08052042126655579, -0.0007602011901326478, 0.04368935897946358, 0.010218474082648754, 0.0790204405784607, 0.011429793201386929, 0.05668007209897041, 0.06102493405342102, 0.08079347014427185, -0.04282435402274132, 0.07467596977949142, 0.05634981766343117, 0.007538162637501955, -0.022652139887213707, 0.10876211524009705, 0.05886945128440857, 0.02732437290251255, -0.01959446258842945, -0.08196894824504852, -0.05309279263019562, 0.025122767314314842, -0.060280852019786835, -0.05856756865978241, -0.012509932741522789, 0.008856924250721931, -0.01934080757200718, 0.039995595812797546, 0.0108721274882555, -0.03106588125228882, -0.04766802489757538, 0.040371816605329514 ]
0.01048
[`ERR\_BUFFER\_TOO\_LARGE`]: errors.md#err\_buffer\_too\_large [`Error`]: errors.md#class-error [`GetHeapCodeAndMetadataStatistics`]: https://v8docs.nodesource.com/node-13.2/d5/dda/classv8\_1\_1\_isolate.html#a6079122af17612ef54ef3348ce170866 [`GetHeapSpaceStatistics`]: https://v8docs.nodesource.com/node-13.2/d5/dda/classv8\_1\_1\_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4 [`NODE\_V8\_COVERAGE`]: cli.md#node\_v8\_coveragedir [`Serializer`]: #class-v8serializer [`after` callback]: #afterpromise [`async\_hooks`]: async\_hooks.md [`before` callback]: #beforepromise [`buffer.constants.MAX\_LENGTH`]: buffer.md#bufferconstantsmax\_length [`cppgc::HeapStatistics struct`]: https://v8docs.nodesource.com/node-22.4/df/d2f/structcppgc\_1\_1\_heap\_statistics.html [`cppgc::HeapStatistics`]: https://v8docs.nodesource.com/node-22.4/d7/d51/heap-statistics\_8h\_source.html [`deserializer.\_readHostObject()`]: #deserializer\_readhostobject [`deserializer.transferArrayBuffer()`]: #deserializertransferarraybufferid-arraybuffer [`init` callback]: #initpromise-parent [`queryObjects()` console API]: https://developer.chrome.com/docs/devtools/console/utilities#queryObjects-function [`serialize()`]: #v8serializevalue [`serializer.\_getSharedArrayBufferId()`]: #serializer\_getsharedarraybufferidsharedarraybuffer [`serializer.\_writeHostObject()`]: #serializer\_writehostobjectobject [`serializer.releaseBuffer()`]: #serializerreleasebuffer [`serializer.transferArrayBuffer()`]: #serializertransferarraybufferid-arraybuffer [`serializer.writeRawBytes()`]: #serializerwriterawbytesbuffer [`settled` callback]: #settledpromise [`v8.stopCoverage()`]: #v8stopcoverage [`v8.takeCoverage()`]: #v8takecoverage [`vm.Script`]: vm.md#new-vmscriptcode-options [worker threads]: worker\_threads.md
https://github.com/nodejs/node/blob/main//doc/api/v8.md
main
nodejs
[ -0.07822724431753159, 0.034732237458229065, -0.07327505946159363, -0.036289043724536896, 0.06746739894151688, -0.1101527065038681, -0.03077465109527111, 0.023694608360528946, -0.06775940954685211, -0.026108518242836, 0.07462766021490097, -0.03925761952996254, -0.05424071475863457, -0.0835050493478775, 0.0043538520112633705, -0.0031301621347665787, -0.004890568554401398, -0.014715340919792652, -0.06228024512529373, 0.01791543886065483, 0.01851959340274334, 0.08482406288385391, -0.046950411051511765, 0.041606079787015915, -0.07384910434484482, 0.03601273521780968, -0.02552218548953533, -0.030307019129395485, -0.035768598318099976, -0.046581484377384186, 0.04222523793578148, 0.0012649280251935124, -0.06739621609449387, 0.004560384433716536, 0.1655193716287613, 0.15079541504383087, -0.028160426765680313, -0.05155358836054802, -0.059630464762449265, 0.006913722958415747, 0.09652172774076462, 0.0660378634929657, 0.02496558427810669, -0.014941778033971786, 0.024896685034036636, -0.0637795627117157, -0.11241864413022995, -0.07005967944860458, 0.03866301476955414, -0.09600116312503815, -0.03840726613998413, 0.015977250412106514, 0.034226756542921066, -0.0028910168912261724, 0.013705086894333363, -0.029710877686738968, 0.04858509078621864, -0.01041903905570507, -0.013303620740771294, 0.055795203894376755, -0.022894416004419327, -0.008907747454941273, 0.016746971756219864, -0.055049195885658264, 0.002068732865154743, 0.0002080890699289739, 0.02845006063580513, 0.013188090175390244, 0.027720319107174873, 0.04024478793144226, -0.09024374186992645, 0.044707756489515305, -0.042749132961034775, 0.06629952788352966, 0.04499884694814682, 0.07969902455806732, -0.029327331110835075, -0.012888114899396896, 0.03980733081698418, -0.1310819387435913, -0.025051046162843704, -0.06586872786283493, 0.020264768972992897, 0.024043621495366096, -0.021850258111953735, 0.09624364227056503, -0.0407395139336586, -0.004405387677252293, 0.08205989748239517, 0.008256406523287296, -0.04728083312511444, 0.06617169082164764, -0.05777009204030037, 0.051000386476516724, 0.002739270217716694, 0.05646238848567009, 0.04708521440625191, -0.03253159672021866, 0.05332661047577858, 0.08162511885166168, -0.050897061824798584, -0.04028305038809776, 0.015031509101390839, 0.059879519045352936, -0.056119516491889954, -0.04708211496472359, -0.032017797231674194, -0.012959195300936699, 0.017750784754753113, -0.023898117244243622, 0.0043875835835933685, 0.06324370950460434, -0.011212548241019249, -0.00487474724650383, 0.09537677466869354, -0.01787424087524414, 0.04991919547319412, -0.04894105717539787, 0.010238771326839924, 0.08447884768247604, 0.09191534668207169, -0.0482744462788105, 0.0006114272982813418, 0.024377411231398582, 0.017174551263451576, -0.1177944540977478, 0.004296903032809496, 4.044549861497138e-33, 0.04394692927598953, -0.08653527498245239, 0.0005100948619656265, 0.05416852980852127, 0.09832567721605301, -0.017728080973029137, 0.030293947085738182, -0.028193511068820953, -0.030591923743486404, 0.03372873365879059, -0.07750602811574936, -0.0510949045419693, -0.005967309698462486, -0.012340760789811611, 0.005132010672241449, -0.01450354140251875, 0.04899851977825165, 0.08053503930568695, -0.04319469630718231, -0.004209928680211306, 0.06694641709327698, 0.0414123497903347, 0.016954125836491585, -0.014661302790045738, -0.021655838936567307, 0.06334548443555832, 0.01587499864399433, -0.029117748141288757, 0.06814592331647873, 0.03800385445356369, 0.02111172117292881, -0.019441159442067146, -0.01751994900405407, 0.055083032697439194, 0.026587162166833878, -0.00047412526328116655, -0.019532624632120132, 0.004703046288341284, -0.14140531420707703, -0.0608300119638443, -0.046461548656225204, 0.04309064894914627, 0.0007374188280664384, 0.0026783589273691177, 0.022783339023590088, -0.10428962111473083, -0.0938417837023735, -0.02137533202767372, 0.01592974364757538, 0.007997628301382065, -0.02380719594657421, -0.0016015480505302548, 0.039311863481998444, -0.08666542172431946, -0.03183230012655258, -0.0470624640583992, 0.07113955169916153, 0.05035845935344696, 0.009648687206208706, 0.036367956548929214, 0.01707288809120655, 0.07696039974689484, -0.030359266325831413, -0.05738097056746483, 0.03536784276366234, -0.038743432611227036, -0.04673631861805916, -0.05554525926709175, 0.0062889764085412025, 0.018016772344708443, -0.04170830547809601, 0.01850678026676178, 0.04516131803393364, 0.04298603907227516, 0.002792555373162031, -0.05819476768374443, -0.013513782061636448, -0.04357057437300682, -0.10193461924791336, -0.03761148080229759, -0.008375636301934719, -0.04765652120113373, -0.0028055808506906033, -0.06628412753343582, -0.1079404428601265, -0.03769700229167938, 0.011214068159461021, 0.019448116421699524, -0.0008763826917856932, 0.05730742961168289, 0.020765667781233788, -0.08092911541461945, -0.0172312892973423, -0.04030999913811684, -0.09004565328359604, -6.574245295877379e-33, 0.03549112379550934, 0.014843336306512356, -0.009851311333477497, -0.04141891002655029, -0.006764543708413839, -0.034621432423591614, -0.03639870882034302, 0.08102422952651978, -0.033470313996076584, -0.02908046916127205, 0.0012802109122276306, 0.015813114121556282, 0.039591435343027115, -0.06984461098909378, 0.027731511741876602, 0.06389728933572769, -0.05625002831220627, -0.07109759747982025, 0.03320666030049324, 0.07937953621149063, 0.008568662218749523, 0.049406055361032486, 0.056823231279850006, 0.04079592972993851, -0.05041254311800003, -0.03817688301205635, 0.013011139817535877, 0.09075392782688141, 0.03632801026105881, -0.05057603493332863, 0.007534764241427183, 0.07630503177642822, -0.10375357419252396, 0.07098117470741272, -0.0014465419808402658, -0.01172616146504879, 0.0218820758163929, -0.043221842497587204, 0.022755907848477364, -0.007471682038158178, 0.09373179078102112, 0.007992971688508987, -0.08019796013832092, -0.022830314934253693, 0.006284705828875303, 0.049074843525886536, 0.008786853402853012, 0.037607643753290176, 0.040580302476882935, -0.020560303702950478, 0.006391563918441534, -0.07953975349664688, 0.008997604250907898, 0.07191307842731476, 0.012545837089419365, 0.012318887747824192, 0.08120937645435333, 0.04864169657230377, -0.0742339938879013, 0.01942046731710434, 0.04864536598324776, -0.052521005272865295, -0.09955994784832001, -0.001363294548355043, -0.021560855209827423, 0.015912625938653946, -0.059569939970970154, -0.04152912646532059, 0.03662322089076042, 0.022430438548326492, 0.009355592541396618, 0.06448017805814743, -0.021112609654664993, -0.015643132850527763, 0.021995587274432182, -0.03796103969216347, -0.05418865755200386, -0.06506621092557907, 0.052712541073560715, 0.08561670035123825, -0.12446802854537964, 0.0880521908402443, 0.02409498579800129, 0.08101223409175873, 0.07661525160074234, -0.0520828552544117, 0.046127431094646454, 0.05691172555088997, -0.01359582506120205, -0.06851224601268768, 0.017787765711545944, -0.03170168399810791, -0.018690509721636772, 0.06539016962051392, -0.031189478933811188, -5.6921578561741626e-8, -0.026252886280417442, -0.04116124287247658, -0.039828985929489136, 0.02361449785530567, 0.05362307280302048, -0.04212012141942978, -0.07627023011445999, -0.005517260637134314, 0.08108730614185333, 0.035304196178913116, 0.025262469425797462, 0.05190621316432953, 0.046104464679956436, -0.04945194721221924, -0.02079896815121174, -0.04909946024417877, -0.05416538193821907, 0.05482744053006172, -0.017419511452317238, -0.07491575926542282, 0.019224006682634354, -0.06610459089279175, 0.017544420436024666, -0.03615744411945343, 0.03460393473505974, -0.0048121013678610325, 0.025715164840221405, 0.08204536885023117, 0.0001988562144106254, -0.0061940462328493595, -0.07723938673734665, 0.005763714667409658, 0.02054256573319435, -0.07983183115720749, 0.012451785616576672, 0.0755138248205185, 0.05520756170153618, 0.05682048946619034, 0.058407269418239594, 0.002587272087112069, 0.010209858417510986, 0.008652794174849987, -0.06541403383016586, 0.034125857055187225, 0.05168849974870682, -0.04128625988960266, -0.076897993683815, 0.10458259284496307, 0.08329300582408905, 0.006294292863458395, -0.014216981828212738, -0.045357659459114075, -0.04822288081049919, 0.026457607746124268, -0.07269628345966339, -0.07438076287508011, -0.03368797525763512, -0.09847033023834229, -0.03356609866023064, 0.04358207806944847, 0.08570542186498642, -0.023594800382852554, 0.02562008984386921, 0.007414977066218853 ]
0.106799
# Command-line API Node.js comes with a variety of CLI options. These options expose built-in debugging, multiple ways to execute scripts, and other helpful runtime options. To view this documentation as a manual page in a terminal, run `man node`. ## Synopsis `node [options] [V8 options] [ | -e "script" | -] [--] [arguments]` `node inspect [ | -e "script" | :] …` `node --v8-options` Execute without arguments to start the [REPL][]. For more info about `node inspect`, see the [debugger][] documentation. ## Program entry point The program entry point is a specifier-like string. If the string is not an absolute path, it's resolved as a relative path from the current working directory. That entry point string is then resolved as if it's been requested by `require()` from the current working directory. If no corresponding file is found, an error is thrown. By default, the resolved path is also loaded as if it's been requested by `require()`, unless one of the conditions below apply—then it's loaded as if it's been requested by `import()`: \* The program was started with a command-line flag that forces the entry point to be loaded with ECMAScript module loader, such as `--import`. \* The file has an `.mjs`, `.mts` or `.wasm` extension. \* The file does not have a `.cjs` extension, and the nearest parent `package.json` file contains a top-level [`"type"`][] field with a value of `"module"`. See [module resolution and loading][] for more details. ## Options > Stability: 2 - Stable All options, including V8 options, allow words to be separated by both dashes (`-`) or underscores (`\_`). For example, `--pending-deprecation` is equivalent to `--pending\_deprecation`. If an option that takes a single value (such as `--max-http-header-size`) is passed more than once, then the last passed value is used. Options from the command line take precedence over options passed through the [`NODE\_OPTIONS`][] environment variable. ### `-` Alias for stdin. Analogous to the use of `-` in other command-line utilities, meaning that the script is read from stdin, and the rest of the options are passed to that script. ### `--` Indicate the end of node options. Pass the rest of the arguments to the script. If no script filename or eval/print script is supplied prior to this, then the next argument is used as a script filename. ### `--abort-on-uncaught-exception` Aborting instead of exiting causes a core file to be generated for post-mortem analysis using a debugger (such as `lldb`, `gdb`, and `mdb`). If this flag is passed, the behavior can still be set to not abort through [`process.setUncaughtExceptionCaptureCallback()`][] (and through usage of the `node:domain` module that uses it). ### `--allow-addons` > Stability: 1.1 - Active development When using the [Permission Model][], the process will not be able to use native addons by default. Attempts to do so will throw an `ERR\_DLOPEN\_DISABLED` unless the user explicitly passes the `--allow-addons` flag when starting Node.js. Example: ```cjs // Attempt to require an native addon require('nodejs-addon-example'); ``` ```console $ node --permission --allow-fs-read=\* index.js node:internal/modules/cjs/loader:1319 return process.dlopen(module, path.toNamespacedPath(filename)); ^ Error: Cannot load native addon because loading addons is disabled. at Module.\_extensions..node (node:internal/modules/cjs/loader:1319:18) at Module.load (node:internal/modules/cjs/loader:1091:32) at Module.\_load (node:internal/modules/cjs/loader:938:12) at Module.require (node:internal/modules/cjs/loader:1115:19) at require (node:internal/modules/helpers:130:18) at Object. (/home/index.js:1:15) at Module.\_compile (node:internal/modules/cjs/loader:1233:14) at Module.\_extensions..js (node:internal/modules/cjs/loader:1287:10) at Module.load (node:internal/modules/cjs/loader:1091:32) at Module.\_load (node:internal/modules/cjs/loader:938:12) { code: 'ERR\_DLOPEN\_DISABLED' } ``` ### `--allow-child-process` > Stability: 1.1 - Active development When using the [Permission Model][], the process will not be able to spawn any child process by default. Attempts to do so will throw an `ERR\_ACCESS\_DENIED` unless the user explicitly passes the `--allow-child-process` flag when starting Node.js. Example: ```js const childProcess = require('node:child\_process'); // Attempt to bypass the
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.09739749133586884, 0.009656929410994053, 0.015872124582529068, 0.03692946955561638, 0.0986974760890007, -0.07805822044610977, -0.04566112533211708, 0.0632219985127449, 0.017580118030309677, -0.016064481809735298, -0.060120921581983566, 0.013840461149811745, -0.008513516746461391, -0.05555746704339981, 0.030650557950139046, 0.011331374756991863, 0.009872100315988064, -0.03783910721540451, 0.06501808017492294, -0.021888045594096184, 0.007205687463283539, -0.002611702773720026, -0.05550577864050865, -0.0300868209451437, -0.06810466945171356, -0.004662920720875263, -0.016409581527113914, 0.0032475339248776436, 0.004533973056823015, 0.01641957461833954, -0.009072558954358101, 0.025113621726632118, -0.015240686945617199, 0.032134272158145905, -0.02251235395669937, 0.18749967217445374, 0.04147280380129814, -0.06872007995843887, -0.03834056109189987, 0.020184215158224106, 0.05369388312101364, 0.10466934740543365, -0.05665982514619827, -0.07605226337909698, 0.02903807908296585, -0.08712547272443771, -0.10046600550413132, -0.05710415914654732, -0.09899315983057022, -0.016309112310409546, -0.009792348369956017, -0.014376060105860233, 0.008674843236804008, -0.0963750034570694, -0.012857310473918915, 0.03262175992131233, -0.028162628412246704, 0.0402383953332901, 0.05360415577888489, 0.08802886307239532, 0.006644433829933405, -0.009838789701461792, 0.028994491323828697, 0.0076981401070952415, 0.071509949862957, 0.021115457639098167, 0.02377026341855526, 0.00003613634908106178, 0.04613565653562546, 0.00813244003802538, -0.0021259798668324947, 0.03544162958860397, -0.10834930092096329, -0.022107450291514397, -0.05090471729636192, -0.00828514713793993, 0.001986982999369502, 0.032648034393787384, -0.04202176630496979, -0.06824039667844772, -0.05014129355549812, -0.02404611185193062, 0.0006447334308177233, 0.1339835524559021, -0.06233976036310196, 0.1282525509595871, -0.006594064645469189, -0.000054385185649152845, 0.12304188311100006, 0.13565485179424286, -0.06294727325439453, -0.12433217465877533, -0.09325581789016724, 0.0075849732384085655, 0.04085575416684151, 0.07495207339525223, 0.0028399014845490456, -0.0007310654036700726, -0.03535487502813339, -0.024691881611943245, -0.00548681803047657, -0.006937691941857338, 0.054064180701971054, -0.06895894557237625, 0.021333716809749603, 0.02869863249361515, -0.001269604661501944, -0.052717357873916626, 0.005655295215547085, -0.0015915300464257598, 0.004152256995439529, 0.026261083781719208, 0.02005862072110176, -0.014265242964029312, 0.0362481027841568, 0.024021664634346962, 0.11243052780628204, -0.033262237906455994, 0.08590362221002579, 0.10647702217102051, 0.09852706640958786, 0.04422520473599434, -0.017330747097730637, 0.019020089879631996, 0.026146836578845978, -0.04657774046063423, 0.02741195634007454, 9.575744122401362e-34, 0.029782740399241447, -0.07758549600839615, 0.0668804794549942, 0.0746694877743721, 0.02853310853242874, -0.03803575783967972, 0.02635916694998741, 0.030752744525671005, -0.12968333065509796, 0.04330044984817505, 0.037197295576334, 0.02906399965286255, 0.035187315195798874, -0.011634735390543938, 0.015494492836296558, 0.03161969408392906, 0.0024457694962620735, -0.012559982016682625, -0.04431004822254181, -0.005160228349268436, 0.006953216623514891, -0.05542399361729622, -0.030195893719792366, 0.030387118458747864, 0.02508927322924137, -0.006733713671565056, -0.013325218111276627, 0.03514016419649124, 0.02316581830382347, -0.01680087484419346, -0.007352415006607771, 0.02852749638259411, -0.039296869188547134, 0.07932355999946594, 0.021329281851649284, 0.0010124610271304846, -0.049582574516534805, 0.03885434567928314, -0.09127417951822281, 0.02823483571410179, -0.0007529730210080743, 0.025560319423675537, -0.0740664005279541, -0.0067450786009430885, 0.007656240835785866, -0.07209974527359009, -0.09408463537693024, -0.047295477241277695, 0.028775565326213837, 0.06919459998607635, -0.04567885771393776, 0.0845969170331955, 0.09298937767744064, -0.03792328014969826, 0.004085717722773552, 0.011556250043213367, 0.015492008998990059, -0.09297961741685867, -0.01798841916024685, 0.024636253714561462, 0.1012134775519371, 0.01847788318991661, -0.054037317633628845, 0.02285303920507431, 0.0026332552079111338, 0.012693963944911957, -0.08923784643411636, -0.03313826769590378, 0.051664356142282486, 0.08105077594518661, -0.05488269031047821, 0.013899479992687702, 0.05755995959043503, 0.022974984720349312, 0.07147775590419769, -0.008410735987126827, -0.07914997637271881, -0.0036525335162878036, 0.02980322390794754, 0.015990102663636208, 0.02882796712219715, -0.05748351290822029, -0.01659863069653511, -0.002561776665970683, 0.038276031613349915, -0.015019416809082031, -0.06673429906368256, -0.0024359168019145727, 0.03921228274703026, -0.02687576599419117, 0.10809548199176788, -0.04401915520429611, -0.07600069046020508, -0.04303577169775963, -0.05843425169587135, -4.490785149484541e-33, 0.02695409022271633, -0.01585037261247635, -0.020207080990076065, 0.06114264205098152, -0.08653269708156586, -0.07354281097650528, -0.08350557833909988, -0.05596037209033966, 0.05531381815671921, 0.014714709483087063, -0.09659840166568756, 0.07472658902406693, -0.008963791653513908, 0.05381058156490326, 0.041188716888427734, 0.046615611761808395, -0.1120099350810051, -0.06352928280830383, 0.03230757638812065, -0.020605172961950302, 0.008084380999207497, -0.017579512670636177, 0.08434708416461945, 0.0015478003770112991, -0.023424947634339333, -0.06765326112508774, 0.025147590786218643, -0.005722575820982456, -0.0377349816262722, -0.08558232337236404, -0.025099100545048714, 0.0557093620300293, -0.04434874653816223, 0.06710716336965561, 0.013104925863444805, -0.04233736917376518, 0.0016999588115140796, 0.08182404190301895, 0.07302666455507278, -0.04598894715309143, 0.03189188614487648, -0.0327158197760582, 0.029717857018113136, 0.005276098847389221, 0.018151719123125076, 0.03230167180299759, -0.023171842098236084, 0.04744372144341469, -0.048858046531677246, -0.04611719027161598, -0.04811954125761986, 0.0014120468404144049, 0.03661676496267319, 0.037055790424346924, -0.04878140613436699, -0.05297150835394859, -0.014526596292853355, 0.03813239559531212, 0.03354848176240921, 0.05472717434167862, 0.05090620368719101, -0.0478697195649147, -0.0645538717508316, -0.002637626836076379, -0.12303175777196884, -0.062166158109903336, -0.07356845587491989, -0.01913064904510975, 0.012146987952291965, -0.033986110240221024, -0.04299813136458397, -0.046266645193099976, 0.002354888478294015, -0.02786947973072529, -0.04095611721277237, 0.019186077639460564, -0.014969978481531143, -0.1736680269241333, -0.02872459962964058, 0.049932148307561874, -0.0069470833986997604, 0.05003385990858078, -0.043987710028886795, 0.01388187799602747, -0.0007647757302038372, -0.0014463854022324085, -0.06022593006491661, 0.07299423217773438, 0.0010495487367734313, 0.002433167304843664, 0.03093794360756874, 0.02355911023914814, -0.09569160640239716, 0.006613960023969412, -0.05568140000104904, -5.896432142549202e-8, -0.04670223966240883, 0.005880518816411495, -0.06148109957575798, 0.003571499604731798, 0.027975216507911682, 0.029257813468575478, 0.03611494228243828, 0.03599319979548454, 0.05488007515668869, 0.06747517734766006, 0.0021412328351289034, -0.0013960637152194977, -0.012005702592432499, 0.006279484834522009, -0.008629470132291317, 0.05522538721561432, 0.016026804223656654, 0.04418833181262016, 0.0014711663825437427, 0.003225485095754266, -0.004268963355571032, -0.00635368749499321, -0.04554491490125656, 0.10637801885604858, -0.03234473243355751, -0.07582423090934753, 0.023527411743998528, 0.08239220082759857, -0.08120918273925781, -0.06144838407635689, -0.0594136044383049, 0.09177043288946152, 0.03891521319746971, -0.024520592764019966, 0.0015839373227208853, 0.05003371462225914, 0.029164845123887062, -0.023222310468554497, 0.04933277517557144, -0.003013163572177291, 0.01459543127566576, 0.06338154524564743, -0.0045777978375554085, -0.032620370388031006, -0.05289306119084358, 0.006876036059111357, 0.04200143739581108, 0.041255153715610504, -0.015746701508760452, -0.03195458650588989, 0.032669056206941605, -0.007856006734073162, -0.06778845936059952, 0.039670541882514954, -0.024778082966804504, 0.06766980141401291, -0.008239655755460262, -0.12678879499435425, -0.013100109063088894, 0.04422488063573837, -0.007555934134870768, 0.03805806115269661, 0.08825357258319855, -0.026498058810830116 ]
0.098987
Active development When using the [Permission Model][], the process will not be able to spawn any child process by default. Attempts to do so will throw an `ERR\_ACCESS\_DENIED` unless the user explicitly passes the `--allow-child-process` flag when starting Node.js. Example: ```js const childProcess = require('node:child\_process'); // Attempt to bypass the permission childProcess.spawn('node', ['-e', 'require("fs").writeFileSync("/new-file", "example")']); ``` ```console $ node --permission --allow-fs-read=\* index.js node:internal/child\_process:388 const err = this.\_handle.spawn(options); ^ Error: Access to this API has been restricted at ChildProcess.spawn (node:internal/child\_process:388:28) at node:internal/main/run\_main\_module:17:47 { code: 'ERR\_ACCESS\_DENIED', permission: 'ChildProcess' } ``` The `child\_process.fork()` API inherits the execution arguments from the parent process. This means that if Node.js is started with the Permission Model enabled and the `--allow-child-process` flag is set, any child process created using `child\_process.fork()` will automatically receive all relevant Permission Model flags. This behavior also applies to `child\_process.spawn()`, but in that case, the flags are propagated via the `NODE\_OPTIONS` environment variable rather than directly through the process arguments. ### `--allow-fs-read` This flag configures file system read permissions using the [Permission Model][]. The valid arguments for the `--allow-fs-read` flag are: \* `\*` - To allow all `FileSystemRead` operations. \* Multiple paths can be allowed using multiple `--allow-fs-read` flags. Example `--allow-fs-read=/folder1/ --allow-fs-read=/folder1/` Examples can be found in the [File System Permissions][] documentation. The initializer module and custom `--require` modules has a implicit read permission. ```console $ node --permission -r custom-require.js -r custom-require-2.js index.js ``` \* The `custom-require.js`, `custom-require-2.js`, and `index.js` will be by default in the allowed read list. ```js process.has('fs.read', 'index.js'); // true process.has('fs.read', 'custom-require.js'); // true process.has('fs.read', 'custom-require-2.js'); // true ``` ### `--allow-fs-write` This flag configures file system write permissions using the [Permission Model][]. The valid arguments for the `--allow-fs-write` flag are: \* `\*` - To allow all `FileSystemWrite` operations. \* Multiple paths can be allowed using multiple `--allow-fs-write` flags. Example `--allow-fs-write=/folder1/ --allow-fs-write=/folder1/` Paths delimited by comma (`,`) are no longer allowed. When passing a single flag with a comma a warning will be displayed. Examples can be found in the [File System Permissions][] documentation. ### `--allow-inspector` > Stability: 1.0 - Early development When using the [Permission Model][], the process will not be able to connect through inspector protocol. Attempts to do so will throw an `ERR\_ACCESS\_DENIED` unless the user explicitly passes the `--allow-inspector` flag when starting Node.js. Example: ```js const { Session } = require('node:inspector/promises'); const session = new Session(); session.connect(); ``` ```console $ node --permission index.js Error: connect ERR\_ACCESS\_DENIED Access to this API has been restricted. Use --allow-inspector to manage permissions. code: 'ERR\_ACCESS\_DENIED', } ``` ### `--allow-net` > Stability: 1.1 - Active development When using the [Permission Model][], the process will not be able to access network by default. Attempts to do so will throw an `ERR\_ACCESS\_DENIED` unless the user explicitly passes the `--allow-net` flag when starting Node.js. Example: ```js const http = require('node:http'); // Attempt to bypass the permission const req = http.get('http://example.com', () => {}); req.on('error', (err) => { console.log('err', err); }); ``` ```console $ node --permission index.js Error: connect ERR\_ACCESS\_DENIED Access to this API has been restricted. Use --allow-net to manage permissions. code: 'ERR\_ACCESS\_DENIED', } ``` ### `--allow-wasi` > Stability: 1.1 - Active development When using the [Permission Model][], the process will not be capable of creating any WASI instances by default. For security reasons, the call will throw an `ERR\_ACCESS\_DENIED` unless the user explicitly passes the flag `--allow-wasi` in the main Node.js process. Example: ```js const { WASI } = require('node:wasi'); // Attempt to bypass the permission new WASI({ version: 'preview1', // Attempt to mount the whole filesystem preopens: { '/': '/', }, }); ``` ```console $ node --permission --allow-fs-read=\* index.js Error: Access to this
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.05153023079037666, 0.03635808452963829, -0.06324741989374161, 0.043434321880340576, 0.08686351031064987, -0.05859539285302162, -0.026600485667586327, 0.09412673860788345, -0.001301117823459208, 0.0916210412979126, -0.026966748759150505, 0.044367466121912, -0.0335785336792469, 0.053064193576574326, 0.03868316113948822, 0.04590858146548271, 0.02992417849600315, -0.030508417636156082, 0.04281063377857208, -0.051012761890888214, 0.03219806030392647, -0.0042749615386128426, 0.05154740437865257, -0.02830115333199501, 0.0005027457373216748, -0.05008285865187645, -0.031205980107188225, -0.021808920428156853, 0.0535072460770607, 0.01041132491081953, 0.008924252353608608, -0.08137878030538559, 0.0059440163895487785, -0.06586470454931259, -0.038345180451869965, 0.09210944175720215, 0.030890436843037605, -0.1478935331106186, -0.009784839116036892, 0.0022787682246416807, 0.0937853530049324, 0.11748392134904861, -0.0856967344880104, -0.06858566403388977, 0.0020458512008190155, -0.023171301931142807, -0.03555981442332268, -0.05705435574054718, -0.03841160237789154, -0.002550194039940834, -0.024882055819034576, -0.005004694685339928, 0.032096974551677704, -0.04607856646180153, -0.06444942951202393, -0.026501286774873734, 0.03587410971522331, -0.032032888382673264, 0.0769636407494545, 0.033159732818603516, -0.044717855751514435, -0.05635175481438637, -0.013422480784356594, -0.09123755991458893, -0.014372756704688072, 0.03710916265845299, -0.04658069461584091, 0.005458501633256674, -0.006034676916897297, 0.04274188354611397, 0.09460622817277908, 0.06997589021921158, -0.08161021769046783, -0.018553320318460464, 0.008240862749516964, -0.0677783340215683, -0.012975690886378288, 0.047835562378168106, -0.0035631898790597916, -0.038744475692510605, -0.04306737706065178, -0.006638914346694946, 0.04608617722988129, -0.027526743710041046, -0.1178358793258667, 0.11517542600631714, 0.0035989931784570217, -0.005496955942362547, 0.0662163496017456, 0.03692910075187683, -0.045945990830659866, 0.004455951042473316, -0.034374553710222244, 0.07092131674289703, 0.08022444695234299, -0.032251857221126556, 0.030540434643626213, 0.029578911140561104, -0.05751855671405792, -0.04111526906490326, -0.018831588327884674, 0.020437059924006462, -0.0020645398180931807, 0.049769915640354156, 0.07358579337596893, -0.0030403262935578823, -0.011920182965695858, -0.033711936324834824, -0.0761413499712944, 0.008282570168375969, -0.013636068440973759, 0.009731790982186794, 0.028176743537187576, 0.028486236929893494, 0.034474991261959076, -0.016809672117233276, 0.04286608844995499, -0.057187050580978394, 0.01228394452482462, 0.11071213334798813, 0.1404460221529007, 0.036105334758758545, -0.010385368950664997, 0.06267787516117096, 0.03383224084973335, -0.10949467867612839, -0.04011283069849014, 4.187014909535503e-34, 0.04622650146484375, -0.045847706496715546, 0.049897730350494385, 0.12312305718660355, 0.09185568988323212, -0.0023902866523712873, -0.005071648862212896, -0.0002239202003693208, -0.11985129117965698, 0.015342475846409798, -0.033044710755348206, -0.04242635890841484, 0.019088754430413246, -0.08381032943725586, 0.051966581493616104, 0.01198438461869955, 0.0709223598241806, -0.06389277428388596, 0.07053022086620331, 0.0743633359670639, -0.034805066883563995, -0.042001817375421524, -0.02569539099931717, 0.07130155712366104, 0.010204573161900043, -0.009092157706618309, -0.057531725615262985, 0.011515378020703793, 0.0954820066690445, -0.014660198241472244, 0.039421409368515015, 0.02821062132716179, 0.01271696388721466, 0.0050021070055663586, -0.02765241637825966, -0.028631607070565224, 0.012443442828953266, 0.0499919094145298, -0.08022937923669815, -0.04481745511293411, 0.02686980925500393, -0.0034000547602772713, -0.053393442183732986, 0.020440511405467987, -0.05584116280078888, -0.02764885686337948, -0.09877718240022659, -0.0031270503532141447, 0.000616326171439141, 0.08231816440820694, -0.07747840881347656, 0.044530268758535385, 0.01914988085627556, -0.07578794658184052, 0.07815245538949966, 0.005883031524717808, -0.06420979648828506, -0.06531370431184769, -0.04156193509697914, -0.05231895670294762, 0.10463349521160126, 0.002256718697026372, -0.004679330158978701, 0.0637991651892662, -0.005652420222759247, -0.07309024035930634, 0.011310247704386711, -0.02000983990728855, 0.0672137439250946, 0.018060721457004547, -0.09340135753154755, 0.01033715158700943, -0.023283766582608223, -0.01550255250185728, -0.03391766548156738, -0.039936911314725876, 0.05944046378135681, -0.04066860303282738, -0.022086139768362045, -0.007574342656880617, 0.025648610666394234, -0.046845197677612305, -0.06246760115027428, -0.020028388127684593, -0.006800388917326927, -0.02271350286900997, -0.10664927959442139, 0.07265231013298035, 0.03642595186829567, -0.02869567461311817, 0.051554977893829346, -0.04091531038284302, 0.007992046885192394, -0.03342418745160103, -0.08257604390382767, -3.733899030669455e-33, 0.07467780262231827, -0.06254582107067108, -0.09950893372297287, -0.0314655639231205, 0.020314766094088554, -0.051020681858062744, 0.00451547559350729, -0.061865899711847305, 0.017310306429862976, 0.008698378689587116, -0.08302013576030731, 0.06356343626976013, 0.029458221048116684, 0.04460043087601662, -0.05554244667291641, -0.03423082083463669, -0.08583850413560867, -0.0030170262325555086, 0.04926687479019165, -0.019687602296471596, -0.04989511892199516, 0.0490533672273159, 0.07536802440881729, 0.07663260400295258, 0.004060293082147837, -0.03169085457921028, -0.10857029259204865, 0.024804817512631416, -0.05467432737350464, -0.021835658699274063, -0.0760347992181778, -0.002342397579923272, 0.020596995949745178, 0.06507856398820877, -0.034302495419979095, -0.08569341152906418, -0.05428313463926315, 0.12365567684173584, 0.06084283068776131, -0.06969134509563446, 0.03903871774673462, 0.000801281479652971, 0.06598994135856628, -0.03642585501074791, 0.015462491661310196, 0.0400056391954422, 0.09353096783161163, -0.03995547816157341, -0.0630524754524231, -0.009405510500073433, -0.024865267798304558, -0.01565941423177719, 0.0979209914803505, 0.02361302636563778, 0.03391284868121147, -0.018002044409513474, 0.05750511959195137, -0.02578708902001381, 0.08348124474287033, 0.0313565619289875, 0.14267660677433014, -0.019619926810264587, -0.07253073155879974, -0.0032529172021895647, -0.053513575345277786, -0.03251007944345474, -0.07668935507535934, 0.03321811556816101, 0.08701284974813461, 0.035510722547769547, -0.022366030141711235, 0.043620724231004715, 0.014088802970945835, 0.02184981293976307, 0.013993686065077782, -0.007740735542029142, -0.036292169243097305, -0.07740611582994461, -0.049181751906871796, 0.051669832319021225, -0.03054836578667164, 0.029048630967736244, -0.04641680419445038, 0.038318026810884476, 0.0038001423235982656, -0.014994516968727112, 0.00899411179125309, -0.043662600219249725, -0.009366333484649658, 0.024127250537276268, 0.015913236886262894, -0.01938740350306034, -0.05756448209285736, -0.05828140303492546, -0.028126828372478485, -5.365345501218144e-8, 0.0259962510317564, 0.011402235366404057, -0.08866211771965027, 0.017456239089369774, 0.029743121936917305, -0.06854089349508286, 0.003126006806269288, -0.020605579018592834, 0.03262658789753914, 0.06852420419454575, -0.07761544734239578, -0.015150566585361958, 0.020481105893850327, -0.01749803125858307, 0.016169890761375427, -0.02068660594522953, 0.03551618009805679, 0.036354128271341324, 0.04309862479567528, -0.030810587108135223, 0.01606975682079792, 0.010500017553567886, -0.0015035361284390092, 0.04508562386035919, -0.038535136729478836, -0.06011345982551575, 0.03482714295387268, -0.06368851661682129, -0.069181889295578, 0.030425554141402245, -0.028081825003027916, -0.023334523662924767, 0.032121121883392334, 0.06713874638080597, -0.055705733597278595, -0.057694192975759506, -0.0220920592546463, 0.007009528111666441, 0.01729685068130493, -0.023156948387622833, 0.043792206794023514, 0.10781370848417282, 0.031430136412382126, -0.010061905719339848, -0.08829215168952942, -0.008015862666070461, 0.052940890192985535, 0.021781163290143013, 0.048165176063776016, 0.017061026766896248, 0.0406944677233696, 0.009831363335251808, -0.04919435828924179, 0.0462152473628521, 0.06742537021636963, 0.0663185864686966, 0.024008633568882942, -0.01729695498943329, -0.01144302450120449, 0.02346080169081688, 0.0915774255990982, 0.07428070157766342, 0.051371607929468155, 0.01290040835738182 ]
0.076808
the flag `--allow-wasi` in the main Node.js process. Example: ```js const { WASI } = require('node:wasi'); // Attempt to bypass the permission new WASI({ version: 'preview1', // Attempt to mount the whole filesystem preopens: { '/': '/', }, }); ``` ```console $ node --permission --allow-fs-read=\* index.js Error: Access to this API has been restricted at node:internal/main/run\_main\_module:30:49 { code: 'ERR\_ACCESS\_DENIED', permission: 'WASI', } ``` ### `--allow-worker` > Stability: 1.1 - Active development When using the [Permission Model][], the process will not be able to create any worker threads by default. For security reasons, the call will throw an `ERR\_ACCESS\_DENIED` unless the user explicitly pass the flag `--allow-worker` in the main Node.js process. Example: ```js const { Worker } = require('node:worker\_threads'); // Attempt to bypass the permission new Worker(\_\_filename); ``` ```console $ node --permission --allow-fs-read=\* index.js Error: Access to this API has been restricted at node:internal/main/run\_main\_module:17:47 { code: 'ERR\_ACCESS\_DENIED', permission: 'WorkerThreads' } ``` ### `--build-sea=config` > Stability: 1.1 - Active development Generates a [single executable application][] from a JSON configuration file. The argument must be a path to the configuration file. If the path is not absolute, it is resolved relative to the current working directory. For configuration fields, cross-platform notes, and asset APIs, see the [single executable application][] documentation. ### `--build-snapshot` Generates a snapshot blob when the process exits and writes it to disk, which can be loaded later with `--snapshot-blob`. When building the snapshot, if `--snapshot-blob` is not specified, the generated blob will be written, by default, to `snapshot.blob` in the current working directory. Otherwise it will be written to the path specified by `--snapshot-blob`. ```console $ echo "globalThis.foo = 'I am from the snapshot'" > snapshot.js # Run snapshot.js to initialize the application and snapshot the # state of it into snapshot.blob. $ node --snapshot-blob snapshot.blob --build-snapshot snapshot.js $ echo "console.log(globalThis.foo)" > index.js # Load the generated snapshot and start the application from index.js. $ node --snapshot-blob snapshot.blob index.js I am from the snapshot ``` The [`v8.startupSnapshot` API][] can be used to specify an entry point at snapshot building time, thus avoiding the need of an additional entry script at deserialization time: ```console $ echo "require('v8').startupSnapshot.setDeserializeMainFunction(() => console.log('I am from the snapshot'))" > snapshot.js $ node --snapshot-blob snapshot.blob --build-snapshot snapshot.js $ node --snapshot-blob snapshot.blob I am from the snapshot ``` For more information, check out the [`v8.startupSnapshot` API][] documentation. The snapshot currently only supports loding a single entrypoint during the snapshot building process, which can load built-in modules, but not additional user-land modules. Users can bundle their applications into a single script with their bundler of choice before building a snapshot. As it's complicated to ensure the serializablility of all built-in modules, which are also growing over time, only a subset of the built-in modules are well tested to be serializable during the snapshot building process. The Node.js core test suite checks that a few fairly complex applications can be snapshotted. The list of built-in modules being [captured by the built-in snapshot of Node.js][] is considered supported. When the snapshot builder encounters a built-in module that cannot be serialized, it may crash the snapshot building process. In that case a typical workaround would be to delay loading that module until runtime, using either [`v8.startupSnapshot.setDeserializeMainFunction()`][] or [`v8.startupSnapshot.addDeserializeCallback()`][]. If serialization for an additional module during the snapshot building process is needed, please file a request in the [Node.js issue tracker][] and link to it in the [tracking issue for user-land snapshots][]. ### `--build-snapshot-config` Specifies the path to a JSON configuration file which configures snapshot creation behavior. The following options are currently supported: \* `builder` {string} Required. Provides the name to the
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.0773150622844696, 0.06681662052869797, -0.0561392679810524, 0.025755861774086952, 0.10642768442630768, -0.06949856877326965, -0.04891955852508545, 0.014704798348248005, -0.035335950553417206, 0.03244296833872795, -0.003857828676700592, 0.07330888509750366, -0.042312946170568466, 0.01793433353304863, 0.016804149374365807, 0.022783271968364716, 0.07153674215078354, -0.05964124575257301, -0.04103224352002144, -0.002679095370694995, 0.03633182495832443, 0.011921513825654984, -0.009355537593364716, -0.0157207902520895, -0.02840418741106987, -0.07199876755475998, -0.06628578156232834, 0.002940174425020814, 0.060676511377096176, 0.018512720242142677, -0.024181343615055084, -0.05002613365650177, -0.03333449736237526, -0.015065884217619896, -0.01407307293266058, 0.15261390805244446, 0.0027769310399889946, -0.16935698688030243, -0.01698698103427887, -0.015886852517724037, 0.044363800436258316, 0.1049647256731987, -0.07775181531906128, -0.06249237433075905, 0.007234863005578518, -0.03706050664186478, -0.01549439411610365, -0.07894810289144516, -0.011676263995468616, -0.0003132843121420592, -0.03597752004861832, 0.0441703237593174, 0.06349993497133255, -0.07327394932508469, 0.02025408297777176, -0.004398615099489689, 0.006480750627815723, -0.013520490378141403, 0.024222295731306076, 0.08318056166172028, 0.006255436688661575, -0.0628432109951973, 0.05986648052930832, -0.07694198936223984, -0.0029762357007712126, 0.010097304359078407, -0.05106382071971893, -0.02932906150817871, -0.03267759457230568, 0.004198865965008736, 0.05190644413232803, 0.04531465098261833, -0.07403349876403809, -0.007171220146119595, 0.032562579959630966, -0.030676040798425674, -0.04007462412118912, 0.010253636166453362, 0.02309044636785984, -0.04905492812395096, -0.020774271339178085, -0.03340579941868782, 0.05609538033604622, 0.01859579049050808, -0.08127780258655548, 0.10371781885623932, -0.03976563364267349, 0.0328994058072567, 0.13868741691112518, 0.03873729705810547, -0.02419629879295826, -0.03749335929751396, -0.021825840696692467, 0.05525148659944534, 0.1114596575498581, -0.07779514789581299, 0.05702627822756767, 0.06091336905956268, -0.06989748775959015, 0.027445228770375252, -0.022873468697071075, -0.04633230343461037, 0.017287522554397583, 0.038977041840553284, 0.0024008951149880886, -0.018767140805721283, 0.01178502943366766, -0.0098119443282485, -0.06638173758983612, 0.014923525042831898, 0.040140051394701004, 0.013500573113560677, 0.025339709594845772, -0.03661300241947174, -0.007823362946510315, 0.02806870825588703, 0.0574568547308445, -0.042098160833120346, 0.013733859173953533, 0.11622168123722076, 0.10290148109197617, 0.026213310658931732, 0.0187575351446867, 0.04770864546298981, 0.02617003209888935, -0.04832718148827553, -0.015835030004382133, -2.111646847886626e-33, 0.037977948784828186, -0.023178990930318832, 0.03134848177433014, 0.07121409475803375, 0.08248601108789444, -0.05557292327284813, 0.01988850347697735, 0.01296329963952303, -0.1082659661769867, -0.005915468093007803, 0.009726094081997871, 0.013336914591491222, 0.015525968745350838, -0.05315256491303444, 0.07994258403778076, -0.01109337154775858, 0.10842889547348022, -0.021888867020606995, 0.05809054523706436, 0.004682501778006554, 0.0019384862389415503, -0.07756973057985306, -0.021311694756150246, 0.028095297515392303, -0.03924811631441116, -0.008742117322981358, -0.026956841349601746, -0.007312515284866095, 0.12152131646871567, 0.004653635434806347, 0.01760985143482685, 0.036049820482730865, 0.015049123205244541, 0.030510444194078445, -0.038228344172239304, 0.03934211656451225, -0.02362925373017788, 0.036303386092185974, -0.0884905755519867, -0.02510121464729309, 0.042398497462272644, 0.06799681484699249, -0.08083144575357437, -0.02232498489320278, -0.021720485761761665, -0.056527283042669296, -0.08187821507453918, -0.03490740433335304, -0.02843853086233139, 0.04002003371715546, -0.10475531965494156, 0.06296446919441223, 0.03079838678240776, -0.08118368685245514, 0.0795244574546814, -0.023356590420007706, 0.04194764792919159, -0.017630809918045998, -0.010581094771623611, -0.010333653539419174, 0.0497976616024971, 0.04158427566289902, 0.02498297207057476, 0.09885036200284958, -0.016805116087198257, 0.0001493240997660905, -0.042974669486284256, -0.005348688457161188, 0.06084822118282318, 0.05178724601864815, -0.12940914928913116, -0.018284954130649567, 0.02224007062613964, 0.03820936754345894, -0.0931347981095314, 0.006962957791984081, -0.013951597735285759, -0.019637512043118477, -0.021633943542838097, -0.0677621066570282, 0.07667333632707596, -0.055039480328559875, -0.027834735810756683, 0.0026220667641609907, -0.033163584768772125, -0.013708168640732765, -0.08369510620832443, 0.06271417438983917, 0.04875686392188072, -0.002004893496632576, 0.09893080592155457, -0.02516304701566696, 0.037961579859256744, -0.04993656650185585, -0.10323584824800491, -1.607355363280049e-33, -0.018014851957559586, -0.056342076510190964, -0.09908346831798553, -0.0239824578166008, 0.020614050328731537, -0.028652479872107506, -0.032924771308898926, -0.05989138036966324, 0.00988106057047844, 0.006689959671348333, -0.024352464824914932, 0.027866177260875702, 0.05909863859415054, 0.032634202390909195, -0.019391454756259918, 0.030713336542248726, -0.10348259657621384, -0.01509890053421259, 0.010751653462648392, 0.03312687203288078, -0.03069481998682022, 0.08301488310098648, 0.08276547491550446, 0.04474172741174698, -0.03580815717577934, 0.02500162646174431, -0.07683590054512024, -0.013309932313859463, -0.03532426431775093, -0.06119201332330704, -0.052332814782857895, -0.008824363350868225, -0.05646659433841705, 0.05754569172859192, 0.03197893127799034, -0.07770451158285141, -0.09338327497243881, 0.07887930423021317, 0.018020816147327423, -0.0660153180360794, 0.05080690234899521, 0.013932695612311363, 0.04749367758631706, 0.010597672313451767, -0.03444496914744377, -0.011281149461865425, 0.013424433767795563, -0.05652889609336853, -0.04222976416349411, -0.03950845077633858, -0.05590410530567169, -0.06893105059862137, 0.13901592791080475, 0.03863086923956871, -0.0018068838398903608, -0.03661644458770752, 0.04391540586948395, -0.03176238015294075, 0.023323098197579384, 0.031060591340065002, 0.12332416325807571, -0.07347823679447174, -0.07335939258337021, 0.0078293327242136, -0.028568651527166367, -0.07803364843130112, -0.0778234675526619, -0.012940090149641037, 0.10351365059614182, 0.009545629844069481, 0.03202138841152191, 0.003872138448059559, 0.06734303385019302, 0.08808605372905731, 0.012101412750780582, 0.020291514694690704, -0.040046028792858124, -0.05928585305809975, -0.06088348478078842, 0.07430655509233475, -0.11245159059762955, 0.03351924568414688, -0.02678021788597107, 0.04420818015933037, 0.06438783556222916, -0.03418158367276192, -0.010034982115030289, 0.012215869501233101, 0.006297678221017122, -0.02526647225022316, 0.015083550475537777, -0.021463774144649506, -0.06124046817421913, -0.0146249458193779, -0.022918859496712685, -5.0970992759857836e-8, 0.030780769884586334, -0.06783894449472427, -0.12023933231830597, 0.006001501809805632, 0.05700168386101723, -0.06156288459897041, 0.0027068329509347677, -0.01838219165802002, 0.028027363121509552, 0.12370173633098602, 0.005738611798733473, 0.012114865705370903, 0.0035617181565612555, -0.05208359658718109, -0.010785944759845734, 0.0036297491751611233, -0.015262452885508537, 0.0649719312787056, 0.01521624717861414, -0.05582942068576813, -0.014367219060659409, -0.028318464756011963, -0.011045723222196102, 0.00010757763811852783, -0.0276358500123024, -0.03425004333257675, 0.05859348177909851, -0.01192497555166483, -0.05413065850734711, 0.03434582054615021, -0.08530014008283615, 0.003681282280012965, 0.009401340037584305, 0.022020740434527397, -0.09416740387678146, 0.029350554570555687, 0.018181992694735527, 0.015208396129310131, 0.029318014159798622, -0.025158068165183067, 0.052265465259552, 0.08104051649570465, 0.008320494554936886, 0.03400281444191933, -0.025540679693222046, -0.004905553534626961, 0.011261864565312862, 0.05661405250430107, 0.04171432554721832, -0.03506141155958176, -0.02860209159553051, 0.01957794278860092, -0.04134932905435562, 0.08750662207603455, 0.02920907735824585, 0.062314826995134354, -0.017011113464832306, -0.0006472572567872703, -0.04461785778403282, -0.003223900217562914, 0.1133466437458992, 0.006682836916297674, 0.01880275085568428, 0.002145184203982353 ]
0.161485
please file a request in the [Node.js issue tracker][] and link to it in the [tracking issue for user-land snapshots][]. ### `--build-snapshot-config` Specifies the path to a JSON configuration file which configures snapshot creation behavior. The following options are currently supported: \* `builder` {string} Required. Provides the name to the script that is executed before building the snapshot, as if [`--build-snapshot`][] had been passed with `builder` as the main script name. \* `withoutCodeCache` {boolean} Optional. Including the code cache reduces the time spent on compiling functions included in the snapshot at the expense of a bigger snapshot size and potentially breaking portability of the snapshot. When using this flag, additional script files provided on the command line will not be executed and instead be interpreted as regular command line arguments. ### `-c`, `--check` Syntax check the script without executing. ### `--completion-bash` Print source-able bash completion script for Node.js. ```bash node --completion-bash > node\_bash\_completion source node\_bash\_completion ``` ### `-C condition`, `--conditions=condition` Provide custom [conditional exports][] resolution conditions. Any number of custom string condition names are permitted. The default Node.js conditions of `"node"`, `"default"`, `"import"`, and `"require"` will always apply as defined. For example, to run a module with "development" resolutions: ```bash node -C development app.js ``` ### `--cpu-prof` Starts the V8 CPU profiler on start up, and writes the CPU profile to disk before exit. If `--cpu-prof-dir` is not specified, the generated profile is placed in the current working directory. If `--cpu-prof-name` is not specified, the generated profile is named `CPU.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.cpuprofile`. ```console $ node --cpu-prof index.js $ ls \*.cpuprofile CPU.20190409.202950.15293.0.0.cpuprofile ``` If `--cpu-prof-name` is specified, the provided value is used as a template for the file name. The following placeholder is supported and will be substituted at runtime: \* `${pid}` — the current process ID ```console $ node --cpu-prof --cpu-prof-name 'CPU.${pid}.cpuprofile' index.js $ ls \*.cpuprofile CPU.15293.cpuprofile ``` ### `--cpu-prof-dir` Specify the directory where the CPU profiles generated by `--cpu-prof` will be placed. The default value is controlled by the [`--diagnostic-dir`][] command-line option. ### `--cpu-prof-interval` Specify the sampling interval in microseconds for the CPU profiles generated by `--cpu-prof`. The default is 1000 microseconds. ### `--cpu-prof-name` Specify the file name of the CPU profile generated by `--cpu-prof`. ### `--diagnostic-dir=directory` Set the directory to which all diagnostic output files are written. Defaults to current working directory. Affects the default output directory of: \* [`--cpu-prof-dir`][] \* [`--heap-prof-dir`][] \* [`--redirect-warnings`][] ### `--disable-proto=mode` Disable the `Object.prototype.\_\_proto\_\_` property. If `mode` is `delete`, the property is removed entirely. If `mode` is `throw`, accesses to the property throw an exception with the code `ERR\_PROTO\_ACCESS`. ### `--disable-sigusr1` Disable the ability of starting a debugging session by sending a `SIGUSR1` signal to the process. ### `--disable-warning=code-or-type` > Stability: 1.1 - Active development Disable specific process warnings by `code` or `type`. Warnings emitted from [`process.emitWarning()`][emit\_warning] may contain a `code` and a `type`. This option will not-emit warnings that have a matching `code` or `type`. List of [deprecation warnings][]. The Node.js core warning types are: `DeprecationWarning` and `ExperimentalWarning` For example, the following script will not emit [DEP0025 `require('node:sys')`][DEP0025 warning] when executed with `node --disable-warning=DEP0025`: ```mjs import sys from 'node:sys'; ``` ```cjs const sys = require('node:sys'); ``` For example, the following script will emit the [DEP0025 `require('node:sys')`][DEP0025 warning], but not any Experimental Warnings (such as [ExperimentalWarning: `vm.measureMemory` is an experimental feature][] in <=v21) when executed with `node --disable-warning=ExperimentalWarning`: ```mjs import sys from 'node:sys'; import vm from 'node:vm'; vm.measureMemory(); ``` ```cjs const sys = require('node:sys'); const vm = require('node:vm'); vm.measureMemory(); ``` ### `--disable-wasm-trap-handler` By default, Node.js enables trap-handler-based WebAssembly bound checks. As a result, V8 does not need to insert inline bound checks int the code
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.04304787144064903, 0.03300947695970535, -0.01300489529967308, 0.012096880935132504, 0.07538261264562607, -0.08149848133325577, -0.0405847430229187, -0.017454788088798523, -0.017984604462981224, 0.04774501919746399, -0.001330367405898869, 0.010790613479912281, -0.013161703944206238, -0.0557437390089035, 0.029566897079348564, 0.02855556644499302, -0.04127385467290878, -0.01321558840572834, 0.03871527314186096, -0.02087690308690071, -0.07715460658073425, -0.06319905817508698, 0.05931466445326805, 0.016166146844625473, 0.07999318838119507, -0.06508680433034897, -0.049440138041973114, 0.02064211666584015, -0.012124228291213512, 0.030016979202628136, 0.0637981966137886, 0.05461570620536804, 0.006385208107531071, 0.008272027596831322, 0.045208293944597244, 0.1512472927570343, -0.003915539477020502, -0.020532963797450066, -0.063885897397995, -0.020030228421092033, -0.014707120135426521, 0.08498132228851318, -0.02184389717876911, -0.022782757878303528, -0.010828247293829918, -0.0016883303178474307, -0.0370236299932003, -0.06885369122028351, -0.09112300723791122, -0.027851851657032967, -0.02602648362517357, -0.04727688059210777, -0.005699611268937588, -0.09149784594774246, -0.006149410270154476, 0.05122735723853111, -0.053938258439302444, 0.05516402795910835, 0.03383940830826759, 0.040192581713199615, 0.003951639868319035, -0.01889791712164879, -0.012443178333342075, -0.05949397385120392, 0.06709859520196915, 0.052820030599832535, -0.006497519556432962, -0.015597246587276459, 0.016745714470744133, 0.0828951969742775, 0.03416423499584198, 0.053212955594062805, -0.026358745992183685, -0.057291194796562195, -0.050545986741781235, 0.001765793771483004, 0.005370707716792822, 0.020000627264380455, -0.009087462909519672, -0.05763918161392212, -0.0923483744263649, -0.10788732767105103, -0.05654171109199524, 0.03870881348848343, -0.03746587410569191, 0.11500336974859238, 0.03216277062892914, 0.01109938882291317, 0.08744540065526962, -0.008405693806707859, -0.04550257697701454, -0.06447486579418182, 0.018752049654722214, -0.010178516618907452, -0.03379572927951813, 0.022851746529340744, -0.001655715168453753, 0.06088554486632347, -0.05258067324757576, -0.02552937902510166, -0.03206205740571022, -0.0072159781120717525, 0.06352158635854721, -0.045589275658130646, 0.07007350772619247, 0.058738984167575836, -0.003470781957730651, -0.02140684612095356, 0.007523276377469301, 0.04144516587257385, -0.00003512970943120308, 0.07648617029190063, -0.004052416421473026, -0.04138318821787834, 0.011230609379708767, 0.0431949645280838, 0.08281370252370834, -0.08415175974369049, 0.05535056069493294, 0.06217474117875099, 0.1433200091123581, 0.043315641582012177, -0.03524423763155937, -0.006043614353984594, 0.018045637756586075, -0.06149706244468689, 0.0727221742272377, 3.404493554816387e-33, 0.08446682244539261, 0.01757005788385868, 0.034031450748443604, 0.06302408128976822, 0.06963010132312775, -0.03630083426833153, 0.05817988142371178, -0.010659771040081978, -0.09888842701911926, 0.029455577954649925, 0.001243858365342021, 0.015356572344899178, -0.02825661562383175, 0.050559189170598984, -0.00772317498922348, -0.008026647381484509, -0.009380810894072056, -0.04571543261408806, 0.039812829345464706, 0.026963774114847183, -0.0067065563052892685, -0.057719260454177856, -0.07511842250823975, 0.06532390415668488, 0.00021923839813098311, -0.05438723415136337, 0.1119108647108078, 0.06516057997941971, -0.051041994243860245, -0.0020360792987048626, -0.015992477536201477, 0.037580087780952454, -0.0017887682188302279, 0.010572374798357487, 0.031890615820884705, -0.03975863382220268, -0.05749817565083504, 0.02386813797056675, -0.09864270687103271, 0.04307900369167328, 0.058701734989881516, 0.08078760653734207, -0.11121395975351334, -0.06216857582330704, -0.010447708889842033, -0.11223854869604111, -0.024937257170677185, -0.008262707851827145, 0.110129714012146, 0.07098748534917831, 0.008874654769897461, 0.060514841228723526, 0.06244862452149391, -0.06040017306804657, 0.006311209872364998, -0.0395415760576725, 0.03566642105579376, -0.133835107088089, -0.004568796139210463, -0.0028584436513483524, 0.0251093041151762, -0.04603465273976326, 0.019489958882331848, -0.013937007635831833, -0.011649980209767818, 0.05512986332178116, -0.015474311076104641, 0.07495968043804169, 0.016766073182225227, 0.03689505159854889, -0.009045872837305069, -0.03687189891934395, -0.006528885569423437, -0.01712418720126152, 0.0530957393348217, -0.027581095695495605, -0.07545263320207596, 0.06995418667793274, -0.012213838286697865, 0.031144391745328903, 0.028697792440652847, -0.021393822506070137, -0.09249555319547653, 0.03962463140487671, 0.06829898059368134, -0.027936996892094612, -0.02570353075861931, -0.005862891674041748, -0.04444323107600212, 0.0584687665104866, -0.0016461057821288705, -0.07326841354370117, 0.013723728246986866, -0.07409671694040298, -0.09200653433799744, -5.543921925987752e-33, -0.027712831273674965, -0.035673703998327255, -0.09300769120454788, 0.03889703378081322, -0.056483205407857895, -0.066688671708107, -0.012995707802474499, -0.05183393508195877, 0.04797236621379852, -0.04000663384795189, -0.0929398387670517, -0.002198243048042059, -0.02600136026740074, -0.014146164990961552, -0.041006363928318024, 0.04733218997716904, -0.05454374849796295, -0.1527862697839737, 0.016258031129837036, 0.011322778649628162, 0.04743609204888344, 0.008843828924000263, 0.08470233529806137, 0.10849956423044205, -0.051443491131067276, -0.023422162979841232, -0.0016530833672732115, -0.011328608728945255, 0.03978532552719116, -0.1049274206161499, -0.02686212956905365, 0.034324824810028076, -0.044746480882167816, 0.00630860636010766, 0.0026322314515709877, -0.07075978815555573, 0.007997719570994377, 0.10849041491746902, 0.004576188512146473, -0.027236836031079292, 0.005746688228100538, 0.008982181549072266, -0.02139771170914173, 0.0473751500248909, 0.02369288168847561, 0.0081520089879632, 0.0742841511964798, 0.03037399798631668, -0.0765421986579895, 0.012724608182907104, -0.012526334263384342, 0.008966416120529175, -0.008634279482066631, 0.06699629127979279, 0.010696133598685265, -0.046276602894067764, 0.0041842348873615265, 0.008616041392087936, 0.04246295243501663, 0.06146646663546562, 0.026698719710111618, -0.09147542715072632, -0.016081707552075386, -0.08936956524848938, -0.06480763852596283, -0.03778183087706566, -0.1083180159330368, 0.02134633995592594, -0.011332823894917965, -0.0017792531289160252, -0.052884869277477264, -0.07589847594499588, 0.046633459627628326, -0.005775904282927513, -0.12359394133090973, -0.0403330959379673, 0.06238441541790962, -0.05535918101668358, 0.04906954616308212, 0.06627090275287628, -0.0441695936024189, 0.052050039172172546, -0.019791075959801674, -0.009210842661559582, 0.037735503166913986, -0.0035233262460678816, -0.1106424555182457, 0.023905042558908463, 0.03119620867073536, 0.010970345698297024, -0.006517312489449978, 0.00857493095099926, -0.037685852497816086, -0.030484138056635857, -0.023494645953178406, -6.202026270329952e-8, -0.023933688178658485, 0.06265199184417725, -0.12226895242929459, 0.0013731223298236728, 0.0007547893328592181, -0.03259914740920067, 0.05814119428396225, 0.07163042575120926, 0.06751103699207306, -0.02393263764679432, 0.1371869593858719, 0.012156834825873375, -0.023561717942357063, 0.047413747757673264, -0.023377100005745888, -0.043519143015146255, -0.008393296040594578, 0.08674544095993042, -0.020032206550240517, 0.02317349798977375, -0.042067430913448334, 0.005453897640109062, -0.051874853670597076, 0.033828526735305786, -0.01445382833480835, 0.0056279865093529224, 0.015230013057589531, 0.010128170251846313, -0.00035676799598149955, -0.010444926097989082, -0.04061684384942055, 0.08030868321657181, 0.07183805108070374, -0.05320528522133827, -0.026047425344586372, 0.0019870796240866184, 0.04879559203982353, 0.036021143198013306, 0.06650907546281815, -0.013392079621553421, 0.003146040951833129, 0.10173135250806808, -0.04998385161161423, -0.0008710201364010572, -0.07377511262893677, -0.018899375572800636, 0.023269254714250565, 0.03812752664089203, -0.011630119755864143, -0.011272644624114037, 0.03840817138552666, -0.05086507275700569, -0.024351637810468674, 0.05579732358455658, 0.04808090999722481, 0.01625552400946617, 0.0028333966620266438, -0.07191025465726852, 0.1274701952934265, 0.032641515135765076, 0.10287173092365265, -0.07026357203722, -0.008709823712706566, 0.002467129146680236 ]
-0.008199
with `node --disable-warning=ExperimentalWarning`: ```mjs import sys from 'node:sys'; import vm from 'node:vm'; vm.measureMemory(); ``` ```cjs const sys = require('node:sys'); const vm = require('node:vm'); vm.measureMemory(); ``` ### `--disable-wasm-trap-handler` By default, Node.js enables trap-handler-based WebAssembly bound checks. As a result, V8 does not need to insert inline bound checks int the code compiled from WebAssembly which may speedup WebAssembly execution significantly, but this optimization requires allocating a big virtual memory cage (currently 10GB). If the Node.js process does not have access to a large enough virtual memory address space due to system configurations or hardware limitations, users won't be able to run any WebAssembly that involves allocation in this virtual memory cage and will see an out-of-memory error. ```console $ ulimit -v 5000000 $ node -p "new WebAssembly.Memory({ initial: 10, maximum: 100 });" [eval]:1 new WebAssembly.Memory({ initial: 10, maximum: 100 }); ^ RangeError: WebAssembly.Memory(): could not allocate memory at [eval]:1:1 at runScriptInThisContext (node:internal/vm:209:10) at node:internal/process/execution:118:14 at [eval]-wrapper:6:24 at runScript (node:internal/process/execution:101:62) at evalScript (node:internal/process/execution:136:3) at node:internal/main/eval\_string:49:3 ``` `--disable-wasm-trap-handler` disables this optimization so that users can at least run WebAssembly (with less optimal performance) when the virtual memory address space available to their Node.js process is lower than what the V8 WebAssembly memory cage needs. ### `--disallow-code-generation-from-strings` Make built-in language features like `eval` and `new Function` that generate code from strings throw an exception instead. This does not affect the Node.js `node:vm` module. ### `--dns-result-order=order` Set the default value of `order` in [`dns.lookup()`][] and [`dnsPromises.lookup()`][]. The value could be: \* `ipv4first`: sets default `order` to `ipv4first`. \* `ipv6first`: sets default `order` to `ipv6first`. \* `verbatim`: sets default `order` to `verbatim`. The default is `verbatim` and [`dns.setDefaultResultOrder()`][] have higher priority than `--dns-result-order`. ### `--enable-fips` Enable FIPS-compliant crypto at startup. (Requires Node.js to be built against FIPS-compatible OpenSSL.) ### `--enable-source-maps` Enable [Source Map][] support for stack traces. When using a transpiler, such as TypeScript, stack traces thrown by an application reference the transpiled code, not the original source position. `--enable-source-maps` enables caching of Source Maps and makes a best effort to report stack traces relative to the original source file. Overriding `Error.prepareStackTrace` may prevent `--enable-source-maps` from modifying the stack trace. Call and return the results of the original `Error.prepareStackTrace` in the overriding function to modify the stack trace with source maps. ```js const originalPrepareStackTrace = Error.prepareStackTrace; Error.prepareStackTrace = (error, trace) => { // Modify error and trace and format stack trace with // original Error.prepareStackTrace. return originalPrepareStackTrace(error, trace); }; ``` Note, enabling source maps can introduce latency to your application when `Error.stack` is accessed. If you access `Error.stack` frequently in your application, take into account the performance implications of `--enable-source-maps`. ### `--entry-url` > Stability: 1 - Experimental When present, Node.js will interpret the entry point as a URL, rather than a path. Follows [ECMAScript module][] resolution rules. Any query parameter or hash in the URL will be accessible via [`import.meta.url`][]. ```bash node --entry-url 'file:///path/to/file.js?queryparams=work#and-hashes-too' node --entry-url 'file.ts?query#hash' node --entry-url 'data:text/javascript,console.log("Hello")' ``` ### `--env-file-if-exists=file` Behavior is the same as [`--env-file`][], but an error is not thrown if the file does not exist. ### `--env-file=file` Loads environment variables from a file relative to the current directory, making them available to applications on `process.env`. The [environment variables which configure Node.js][environment\_variables], such as `NODE\_OPTIONS`, are parsed and applied. If the same variable is defined in the environment and in the file, the value from the environment takes precedence. You can pass multiple `--env-file` arguments. Subsequent files override pre-existing variables defined in previous files. An error is thrown if the file does not exist. ```bash node --env-file=.env --env-file=.development.env index.js ``` The format of the file should be one line per key-value
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.005351564381271601, 0.07273954153060913, 0.0008328428957611322, 0.07132675498723984, 0.09486866742372513, -0.05517199635505676, -0.031183971092104912, 0.017011437565088272, -0.04406961053609848, 0.0267030019313097, -0.042936619371175766, 0.010782729834318161, -0.03736443445086479, -0.0530376061797142, -0.0042766984552145, 0.011384953744709492, 0.07757759094238281, 0.06331520527601242, 0.01639612391591072, 0.026395920664072037, -0.011842952109873295, -0.035906530916690826, 0.038410484790802, 0.025546664372086525, -0.05354843661189079, -0.034888867288827896, -0.08550173789262772, 0.002167796017602086, 0.0652429461479187, -0.08102935552597046, 0.011413062922656536, -0.024860559031367302, -0.09057877212762833, 0.0476757250726223, 0.029858699068427086, 0.12774839997291565, -0.07085617631673813, -0.12344285100698471, -0.09398292750120163, -0.01153732929378748, 0.0365104004740715, 0.13619977235794067, -0.04768671095371246, -0.008354106917977333, 0.006956073455512524, -0.0007891429122537374, -0.040464580059051514, -0.02118426188826561, -0.07086668163537979, -0.057849787175655365, -0.007871340028941631, -0.0065794396214187145, 0.02517872489988804, -0.006839016918092966, -0.011227796785533428, -0.02905244566500187, -0.012077530845999718, -0.04157561436295509, 0.01927265152335167, 0.11081323027610779, -0.02799152582883835, -0.02729787863790989, 0.08138971030712128, -0.03562486544251442, 0.018313545733690262, 0.07798706740140915, 0.05494033172726631, 0.003631388768553734, -0.029428783804178238, 0.07696495950222015, -0.023996058851480484, 0.012469049543142319, -0.037895169109106064, 0.06398021429777145, -0.042544834315776825, 0.007604173384606838, -0.041803691536188126, -0.012781405821442604, 0.006566268391907215, 0.011426547542214394, -0.06751476973295212, -0.05427803099155426, -0.022978179156780243, 0.022077806293964386, -0.032159868627786636, 0.10350159555673599, 0.0028437443543225527, -0.03550101816654205, 0.06482177972793579, -0.018604451790452003, -0.06772681325674057, -0.05250832810997963, -0.031220829114317894, 0.05049766227602959, 0.058066949248313904, -0.04295622184872627, 0.058690641075372696, 0.03651523217558861, -0.051164060831069946, -0.004084632731974125, 0.016377439722418785, 0.05320478603243828, 0.06171705573797226, 0.04255887120962143, 0.020233290269970894, -0.00950775295495987, 0.00876904558390379, 0.05133650451898575, -0.0062829433009028435, -0.011490076780319214, 0.0549144484102726, 0.05256105586886406, 0.09402389079332352, 0.01193889882415533, 0.011745581403374672, 0.008626366034150124, 0.09058836847543716, -0.0813245102763176, 0.06685754656791687, 0.10736627131700516, 0.07343682646751404, 0.03933939337730408, 0.051859159022569656, 0.011613366194069386, 0.008676637895405293, -0.07343263924121857, -0.02064688503742218, 4.300193434178092e-33, 0.017652757465839386, -0.04528333246707916, -0.02033945918083191, 0.034688808023929596, 0.05505383759737015, -0.01039823330938816, -0.014088818803429604, 0.01943681202828884, -0.10964271426200867, 0.05815770477056503, -0.014340141788125038, -0.058068595826625824, 0.03321109339594841, -0.013837081380188465, 0.10606871545314789, -0.015185235999524593, 0.03838016092777252, -0.022084347903728485, 0.032478731125593185, 0.00931550469249487, -0.03752122446894646, -0.10644875466823578, -0.05438515543937683, 0.006490396335721016, -0.023743486031889915, -0.03193764016032219, -0.03804336488246918, 0.05741950124502182, 0.05660313740372658, 0.0005707640084438026, -0.021793894469738007, 0.06182123348116875, -0.04880301281809807, 0.07940918207168579, 0.039101142436265945, -0.07459749281406403, -0.07590676844120026, -0.022628024220466614, -0.10951675474643707, -0.051794685423374176, 0.028647975996136665, 0.07332980632781982, -0.03856943920254707, -0.05840187519788742, -0.03321797028183937, -0.12791363894939423, -0.030531156808137894, -0.05750884860754013, 0.05426362529397011, -0.012977647595107555, 0.030048318207263947, 0.05015302449464798, 0.02917267009615898, 0.016511064022779465, 0.02543799765408039, 0.03524180129170418, 0.09652440249919891, -0.04636700451374054, -0.014501234516501427, 0.08510279655456543, -0.01291737426072359, -0.046804279088974, -0.0287521593272686, 0.04603814333677292, 0.0021329333540052176, 0.024711010977625847, -0.0572088323533535, 0.023263445124030113, -0.025889180600643158, -0.014144659973680973, -0.03725443407893181, -0.08862000703811646, 0.020315323024988174, 0.022748814895749092, -0.031382594257593155, 0.000041966843127738684, -0.00875597819685936, -0.020874785259366035, -0.025965692475438118, -0.05288379266858101, 0.10572465509176254, -0.026370784267783165, 0.013751438818871975, -0.0024142591282725334, -0.00926737580448389, -0.10318482667207718, -0.04902128875255585, -0.011188843287527561, 0.04498109593987465, 0.036864347755908966, 0.04683459922671318, -0.03988638147711754, 0.03380359336733818, -0.06146999076008797, -0.1465703547000885, -5.8490953204825875e-33, -0.03424283489584923, 0.025559887290000916, -0.05920923128724098, 0.10030834376811981, -0.0580022856593132, -0.03301403671503067, 0.0032776035368442535, -0.03720924258232117, -0.03053150698542595, -0.04497303441166878, -0.04821717366576195, 0.013250027783215046, 0.04324387386441231, 0.05327536165714264, 0.008248724974691868, 0.07268407940864563, -0.01936919614672661, -0.1272454559803009, 0.02761675789952278, 0.0004584183043334633, 0.027304867282509804, 0.03034764714539051, 0.09886902570724487, -0.007355651818215847, -0.04439379274845123, 0.018534360453486443, -0.041549570858478546, 0.013502135872840881, -0.03283312916755676, -0.042855530977249146, -0.05251431092619896, 0.08275303244590759, -0.025511985644698143, -0.005409078672528267, 0.048150546848773956, -0.1265554577112198, 0.004774049855768681, 0.11443398147821426, 0.04270060732960701, -0.0597415529191494, 0.0790894478559494, 0.06528842449188232, -0.07341014593839645, 0.00630986038595438, 0.006456132046878338, 0.03935161605477333, -0.03249870985746384, -0.026397814974188805, 0.06226862221956253, 0.015327461063861847, -0.10300785303115845, 0.0031054012943059206, 0.03507459908723831, 0.05229513719677925, -0.0786726102232933, -0.033359937369823456, -0.0009132695267908275, 0.004540926311165094, 0.08046936988830566, 0.01893741823732853, 0.0631302148103714, -0.08978202193975449, -0.04974318668246269, -0.07031413912773132, 0.00758346077054739, 0.004808677360415459, -0.11793732643127441, -0.004402839113026857, 0.05243446305394173, 0.043791066855192184, 0.011751694604754448, 0.014425667934119701, 0.022228538990020752, -0.004582532215863466, -0.07051287591457367, 0.008320750668644905, 0.015181519091129303, -0.11677615344524384, 0.022418903186917305, -0.010119354352355003, -0.055628903210163116, 0.08306912332773209, -0.02678927406668663, -0.0013146500568836927, -0.014238778501749039, -0.017763329669833183, -0.07366982847452164, 0.016328910365700722, -0.030397260561585426, 0.019982339814305305, 0.008125966414809227, -0.04543415829539299, -0.10077900439500809, -0.019780686125159264, -0.01414523459970951, -5.349081533267963e-8, -0.0022930640261620283, -0.005501973442733288, -0.06764335930347443, 0.0283471941947937, 0.07800885289907455, -0.029003899544477463, -0.0005121146677993238, 0.05952722579240799, 0.07134620100259781, 0.09857272356748581, 0.05466149374842644, 0.038489148020744324, -0.03851214796304703, 0.03495720028877258, 0.026131577789783478, 0.010164972394704819, -0.052407559007406235, 0.00995349045842886, -0.04529518261551857, -0.028049267828464508, -0.01598263531923294, 0.019824469462037086, -0.011068444699048996, 0.10794535279273987, 0.006773608271032572, -0.09656213968992233, 0.05645248666405678, 0.04991504177451134, -0.013982337899506092, -0.02982126548886299, -0.08574800938367844, 0.08428404480218887, -0.012726997025310993, 0.005933488253504038, -0.041480761021375656, 0.05660850927233696, -0.042353302240371704, 0.06009684130549431, 0.03929160162806511, 0.005046927370131016, 0.0023727943189442158, 0.0704459697008133, -0.019501080736517906, 0.02250070497393608, 0.004387260414659977, -0.0027260202914476395, -0.0597684420645237, 0.041396357119083405, -0.008849059231579304, -0.012409638613462448, 0.05404128506779671, 0.00278274598531425, -0.057395078241825104, 0.07831446081399918, -0.020084312185645103, -0.0540006048977375, 0.03522957116365433, -0.06574007868766785, -0.026199733838438988, 0.04558838903903961, 0.040128983557224274, -0.03475356101989746, 0.06893990188837051, -0.07770559191703796 ]
0.097525
file, the value from the environment takes precedence. You can pass multiple `--env-file` arguments. Subsequent files override pre-existing variables defined in previous files. An error is thrown if the file does not exist. ```bash node --env-file=.env --env-file=.development.env index.js ``` The format of the file should be one line per key-value pair of environment variable name and value separated by `=`: ```text PORT=3000 ``` Any text after a `#` is treated as a comment: ```text # This is a comment PORT=3000 # This is also a comment ``` Values can start and end with the following quotes: `` ` ``, `"` or `'`. They are omitted from the values. ```text USERNAME="nodejs" # will result in `nodejs` as the value. ``` Multi-line values are supported: ```text MULTI\_LINE="THIS IS A MULTILINE" # will result in `THIS IS\nA MULTILINE` as the value. ``` Export keyword before a key is ignored: ```text export USERNAME="nodejs" # will result in `nodejs` as the value. ``` If you want to load environment variables from a file that may not exist, you can use the [`--env-file-if-exists`][] flag instead. ### `-e`, `--eval "script"` Evaluate the following argument as JavaScript. The modules which are predefined in the REPL can also be used in `script`. On Windows, using `cmd.exe` a single quote will not work correctly because it only recognizes double `"` for quoting. In Powershell or Git bash, both `'` and `"` are usable. It is possible to run code containing inline types unless the [`--no-strip-types`][] flag is provided. ### `--experimental-addon-modules` > Stability: 1.0 - Early development Enable experimental import support for `.node` addons. ### `--experimental-config-file=config` > Stability: 1.0 - Early development If present, Node.js will look for a configuration file at the specified path. Node.js will read the configuration file and apply the settings. The configuration file should be a JSON file with the following structure. `vX.Y.Z` in the `$schema` must be replaced with the version of Node.js you are using. ```json { "$schema": "https://nodejs.org/dist/vX.Y.Z/docs/node-config-schema.json", "nodeOptions": { "import": [ "amaro/strip" ], "watch-path": "src", "watch-preserve-output": true }, "test": { "test-isolation": "process" }, "watch": { "watch-preserve-output": true } } ``` The configuration file supports namespace-specific options: \* The `nodeOptions` field contains CLI flags that are allowed in [`NODE\_OPTIONS`][]. \* Namespace fields like `test`, `watch`, and `permission` contain configuration specific to that subsystem. When a namespace is present in the configuration file, Node.js automatically enables the corresponding flag (e.g., `--test`, `--watch`, `--permission`). This allows you to configure subsystem-specific options without explicitly passing the flag on the command line. For example: ```json { "test": { "test-isolation": "process" } } ``` is equivalent to: ```bash node --test --test-isolation=process ``` To disable the automatic flag while still using namespace options, you can explicitly set the flag to `false` within the namespace: ```json { "test": { "test": false, "test-isolation": "process" } } ``` No-op flags are not supported. Not all V8 flags are currently supported. It is possible to use the [official JSON schema](../node-config-schema.json) to validate the configuration file, which may vary depending on the Node.js version. Each key in the configuration file corresponds to a flag that can be passed as a command-line argument. The value of the key is the value that would be passed to the flag. For example, the configuration file above is equivalent to the following command-line arguments: ```bash node --import amaro/strip --watch-path=src --watch-preserve-output --test-isolation=process ``` The priority in configuration is as follows: 1. NODE\\_OPTIONS and command-line options 2. Configuration file 3. Dotenv NODE\\_OPTIONS Values in the configuration file will not override the values in the environment variables and command-line options, but will override the values in the `NODE\_OPTIONS` env file parsed
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.0232466422021389, 0.0035346283111721277, -0.0036785064730793238, -0.01784619316458702, 0.04783504456281662, -0.039960697293281555, 0.0006632617441937327, 0.06020278111100197, 0.017613278701901436, 0.054095011204481125, -0.032820988446474075, 0.02152932435274124, 0.036118216812610626, -0.014238421805202961, 0.09313751012086868, 0.0927911102771759, -0.05743902921676636, -0.03489625081419945, 0.013560102321207523, -0.0439947247505188, 0.030250832438468933, 0.049580130726099014, 0.06422574073076248, -0.0063151088543236256, -0.00887618213891983, -0.015636272728443146, -0.015787798911333084, 0.06966299563646317, -0.02774471789598465, 0.01825680211186409, -0.010416308417916298, 0.05882124975323677, -0.022366005927324295, 0.052000757306814194, -0.00020447142014745623, 0.1404086798429489, -0.0016780865844339132, -0.05530920624732971, -0.1049659326672554, 0.02377476915717125, 0.045340120792388916, 0.07881107181310654, -0.06947848200798035, -0.1049543097615242, 0.044297054409980774, -0.03985830023884773, -0.08956970274448395, -0.02973465994000435, -0.03504151478409767, -0.05703160539269447, -0.0019535429310053587, -0.041160088032484055, -0.040102142840623856, -0.07758773863315582, 0.010168671607971191, 0.016058526933193207, -0.03235883265733719, 0.04541763290762901, 0.0907617136836052, 0.03415495157241821, 0.03176702931523323, -0.01566942036151886, 0.0189348254352808, -0.017682699486613274, 0.051718056201934814, -0.023082245141267776, -0.07959683239459991, 0.059051211923360825, -0.05241459235548973, 0.08006789535284042, -0.02709997072815895, 0.030593741685152054, -0.09737971425056458, -0.0534755177795887, -0.08093567937612534, -0.025546815246343613, -0.0012260209769010544, 0.018717115744948387, -0.04140986129641533, 0.02109346352517605, -0.06160677224397659, -0.07232706248760223, -0.08453008532524109, 0.0598413310945034, -0.04966527968645096, 0.03453146666288376, -0.014746456407010555, -0.021444234997034073, 0.062071848660707474, 0.07178091257810593, -0.10551755130290985, -0.12036558985710144, 0.018171409144997597, 0.05464157462120056, 0.017352530732750893, 0.1218024417757988, -0.007032821886241436, 0.06207000091671944, 0.02973746508359909, -0.04358599707484245, 0.007807910442352295, -0.029773574322462082, 0.07721725106239319, -0.005276828538626432, 0.05567699298262596, -0.023854808881878853, 0.05890532210469246, 0.008592037484049797, 0.00011831467418232933, 0.014284441247582436, -0.00027305353432893753, 0.03467194736003876, 0.004055770579725504, -0.05010830983519554, 0.02630249410867691, 0.00882275216281414, 0.10564638674259186, -0.05000307410955429, 0.0822126716375351, 0.12759412825107574, 0.09980840981006622, -0.004331206437200308, -0.030924350023269653, 0.0647897720336914, 0.05292484909296036, -0.010884586721658707, 0.0863528624176979, 2.648566749594168e-33, 0.006998167373239994, -0.10356761515140533, 0.04570629075169563, 0.07436178624629974, 0.048911407589912415, 0.05060438811779022, 0.021992675960063934, -0.025993136689066887, -0.11167290806770325, 0.021287936717271805, -0.04098675772547722, 0.005295750219374895, -0.00027241979842074215, 0.020432978868484497, -0.05766534432768822, 0.04011078551411629, 0.04931708797812462, -0.02595772221684456, 0.06664220243692398, -0.004254709463566542, 0.035616517066955566, -0.05694529414176941, -0.05739334225654602, 0.06217283383011818, 0.01010269857943058, -0.08973775058984756, 0.04438478872179985, -0.049866240471601486, 0.019971434026956558, -0.05737235024571419, 0.06133013218641281, -0.0077278511598706245, 0.05047681927680969, 0.057722970843315125, 0.007933359593153, -0.018766596913337708, 0.04290033504366875, 0.062074918299913406, -0.10648801177740097, 0.047988198697566986, 0.019409846514463425, 0.08925975859165192, -0.05036991834640503, 0.019670864567160606, -0.003319046925753355, -0.013149873353540897, -0.019237399101257324, -0.002205377910286188, 0.01820896752178669, -0.007520519662648439, -0.053118545562028885, 0.06501588225364685, 0.05741246044635773, -0.08649260550737381, 0.0649462416768074, -0.02777457982301712, 0.012201917357742786, -0.09259061515331268, -0.1050465926527977, -0.05944562330842018, -0.018010089173913002, 0.024747947230935097, 0.01905735209584236, 0.004833833314478397, 0.07362877577543259, -0.01248867902904749, 0.06563974171876907, 0.056285224854946136, 0.010319427587091923, -0.0005591834196820855, -0.09057886153459549, -0.026855241507291794, 0.018128028139472008, 0.0165532436221838, 0.01139876339584589, -0.011687411926686764, -0.0727054625749588, -0.0024297654163092375, 0.057084646075963974, -0.02654813788831234, -0.017341265454888344, -0.021312078461050987, -0.09323783963918686, 0.09643301367759705, 0.07898057252168655, 0.008892915211617947, -0.04836316034197807, -0.030726298689842224, 0.05186969041824341, -0.0010467725805938244, 0.052131280303001404, 0.007924224250018597, -0.024393709376454353, -0.12478496879339218, -0.12006782740354538, -5.20727871101148e-33, -0.008319386281073093, 0.01862012781202793, -0.08967231959104538, 0.0541859045624733, -0.032858703285455704, -0.004154916387051344, 0.010574785061180592, -0.0012362508568912745, 0.06299856305122375, 0.0011324210790917277, -0.08349510282278061, 0.05691893398761749, 0.08427359163761139, -0.008532707579433918, -0.03054026886820793, 0.03217357024550438, -0.12354173511266708, -0.012596620246767998, 0.05192871764302254, -0.07890479266643524, -0.06147583946585655, 0.006535972002893686, 0.11545239388942719, 0.07168649882078171, -0.030345113947987556, -0.025930048897862434, 0.027365095913410187, -0.014060333371162415, -0.0556008405983448, -0.03725440427660942, -0.018277060240507126, 0.02082161046564579, -0.027910364791750908, 0.0961616188287735, -0.05951463058590889, -0.07772607356309891, -0.030888887122273445, -0.008939632214605808, 0.061195533722639084, -0.004447889048606157, 0.024841908365488052, 0.02273944579064846, -0.021758083254098892, -0.005995572544634342, -0.05091078206896782, 0.03689369931817055, 0.022237280383706093, 0.03106071613729, -0.033444084227085114, -0.04828355461359024, -0.016870042309165, -0.05079428479075432, -0.00004891062053502537, 0.02637414261698723, 0.0074673243798315525, -0.1036006510257721, -0.041427887976169586, 0.048614662140607834, -0.0057000345550477505, 0.014578168280422688, 0.055801864713430405, -0.042401574552059174, -0.03376839682459831, -0.018040422350168228, -0.11480630934238434, -0.022177129983901978, -0.06542272865772247, 0.010591255500912666, 0.010115484707057476, -0.09351318329572678, 0.014313525520265102, -0.05253378301858902, -0.030153285712003708, -0.00454922067001462, -0.006278018932789564, 0.0020042923279106617, 0.010526526719331741, -0.05792655050754547, 0.004379298537969589, 0.084695003926754, -0.03705175966024399, 0.07931723445653915, -0.09225109219551086, 0.01596955768764019, 0.0268779955804348, -0.04831162840127945, -0.05387384817004204, 0.11200562864542007, 0.011043509468436241, 0.04620178043842316, 0.01768389530479908, 0.021418707445263863, -0.07089074701070786, -0.03663945570588112, -0.056264542043209076, -4.916829610124296e-8, -0.013169189915060997, -0.009323012083768845, -0.09842468798160553, -0.005485005676746368, -0.04809432476758957, -0.006712805479764938, 0.050796028226614, 0.018572645261883736, 0.06801041960716248, 0.06628823280334473, 0.04835905879735947, 0.019876988604664803, -0.012060122564435005, 0.040576811879873276, -0.03984170779585838, 0.01899159885942936, 0.06492859870195389, 0.06019144877791405, -0.001467277412302792, 0.04012329503893852, 0.017478948459029198, 0.06210833042860031, -0.1062774658203125, 0.03313813358545303, 0.05644730105996132, -0.012428228743374348, -0.0060587660409510136, 0.01824294775724411, -0.062104731798172, -0.04185511916875839, -0.02907242439687252, -0.002388200256973505, 0.002636493416503072, -0.03506099060177803, -0.06634320318698883, -0.036374282091856, 0.06010627746582031, 0.01992172561585903, 0.09678134322166443, 0.015174603089690208, -0.06875009089708328, 0.015628909692168236, -0.05999767780303955, -0.027566760778427124, -0.11407388001680374, -0.0527113638818264, -0.0018849845509976149, 0.04835822805762291, 0.001918708672747016, -0.007644223049283028, 0.01861603744328022, -0.03434836119413376, -0.012879764661192894, -0.01377753634005785, 0.02447274886071682, 0.062090788036584854, -0.003547579748556018, -0.042953941971063614, -0.009570653550326824, -0.03282831236720085, 0.002697252668440342, -0.008023140951991081, -0.014292262494564056, -0.021690024062991142 ]
-0.014789
--watch-path=src --watch-preserve-output --test-isolation=process ``` The priority in configuration is as follows: 1. NODE\\_OPTIONS and command-line options 2. Configuration file 3. Dotenv NODE\\_OPTIONS Values in the configuration file will not override the values in the environment variables and command-line options, but will override the values in the `NODE\_OPTIONS` env file parsed by the `--env-file` flag. Keys cannot be duplicated within the same or different namespaces. The configuration parser will throw an error if the configuration file contains unknown keys or keys that cannot be used in a namespace. Node.js will not sanitize or perform validation on the user-provided configuration, so \*\*NEVER\*\* use untrusted configuration files. ### `--experimental-default-config-file` > Stability: 1.0 - Early development If the `--experimental-default-config-file` flag is present, Node.js will look for a `node.config.json` file in the current working directory and load it as a as configuration file. ### `--experimental-eventsource` Enable exposition of [EventSource Web API][] on the global scope. ### `--experimental-import-meta-resolve` Enable experimental `import.meta.resolve()` parent URL support, which allows passing a second `parentURL` argument for contextual resolution. Previously gated the entire `import.meta.resolve` feature. ### `--experimental-inspector-network-resource` > Stability: 1.1 - Active Development Enable experimental support for inspector network resources. ### `--experimental-loader=module` > This flag is discouraged and may be removed in a future version of Node.js. > Please use > [`--import` with `register()`][preloading asynchronous module customization hooks] instead. Specify the `module` containing exported [asynchronous module customization hooks][]. `module` may be any string accepted as an [`import` specifier][]. This feature requires `--allow-worker` if used with the [Permission Model][]. ### `--experimental-network-inspection` > Stability: 1 - Experimental Enable experimental support for the network inspection with Chrome DevTools. ### `--experimental-print-required-tla` If the ES module being `require()`'d contains top-level `await`, this flag allows Node.js to evaluate the module, try to locate the top-level awaits, and print their location to help users find them. ### `--experimental-quic` > Stability: 1.1 - Active development Enable experimental support for the QUIC protocol. ### `--experimental-sea-config` > Stability: 1 - Experimental Use this flag to generate a blob that can be injected into the Node.js binary to produce a [single executable application][]. See the documentation about [this configuration][`--experimental-sea-config`] for details. ### `--experimental-shadow-realm` Use this flag to enable [ShadowRealm][] support. ### `--experimental-storage-inspection` > Stability: 1.1 - Active Development Enable experimental support for storage inspection ### `--experimental-test-coverage` When used in conjunction with the `node:test` module, a code coverage report is generated as part of the test runner output. If no tests are run, a coverage report is not generated. See the documentation on [collecting code coverage from tests][] for more details. ### `--experimental-test-module-mocks` > Stability: 1.0 - Early development Enable module mocking in the test runner. This feature requires `--allow-worker` if used with the [Permission Model][]. ### `--experimental-transform-types` > Stability: 1.2 - Release candidate Enables the transformation of TypeScript-only syntax into JavaScript code. Implies `--enable-source-maps`. ### `--experimental-vm-modules` Enable experimental ES Module support in the `node:vm` module. ### `--experimental-wasi-unstable-preview1` Enable experimental WebAssembly System Interface (WASI) support. ### `--experimental-worker-inspection` > Stability: 1.1 - Active Development Enable experimental support for the worker inspection with Chrome DevTools. ### `--expose-gc` > Stability: 1 - Experimental. This flag is inherited from V8 and is subject to > change upstream. This flag will expose the gc extension from V8. ```js if (globalThis.gc) { globalThis.gc(); } ``` ### `--force-context-aware` Disable loading native addons that are not [context-aware][]. ### `--force-fips` Force FIPS-compliant crypto on startup. (Cannot be disabled from script code.) (Same requirements as `--enable-fips`.) ### `--force-node-api-uncaught-exceptions-policy` Enforces `uncaughtException` event on Node-API asynchronous callbacks. To prevent from an existing add-on from crashing the process, this flag is not enabled by default. In the future, this flag will be enabled by default to
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.07445719838142395, -0.03870951756834984, -0.005042227450758219, 0.02358456701040268, 0.10229051858186722, -0.06502923369407654, 0.0005859466618858278, 0.0013273084769025445, -0.040441159158945084, 0.034323178231716156, 0.014225440099835396, 0.04788611829280853, 0.019692135974764824, -0.036057762801647186, 0.037079401314258575, 0.0316818431019783, 0.01725846156477928, -0.03681253641843796, -0.027224551886320114, 0.03359583392739296, -0.016659362241625786, -0.07667161524295807, 0.0349394716322422, -0.048610933125019073, -0.07822689414024353, -0.0111493319272995, -0.038366660475730896, 0.09144358336925507, -0.026202423498034477, -0.05463137477636337, 0.03964803367853165, 0.018708068877458572, -0.04210599511861801, -0.011384345591068268, 0.032791636884212494, 0.12264174222946167, 0.027852121740579605, -0.08669503778219223, -0.0779951736330986, 0.018245263025164604, 0.06532986462116241, 0.05114450305700302, -0.040459733456373215, -0.07383209466934204, -0.053489893674850464, 0.01482002530246973, -0.05410144850611687, -0.05781598389148712, -0.06974878162145615, -0.040200699120759964, -0.020176908001303673, -0.03257852792739868, 0.012325235642492771, -0.07788357138633728, 0.02666989527642727, 0.029384806752204895, -0.01562049612402916, 0.05187832564115524, 0.05150670185685158, 0.018176494166254997, 0.025628577917814255, -0.00085259327897802, -0.052649129182100296, -0.017786722630262375, -0.04413476586341858, 0.054535724222660065, -0.04634137824177742, 0.038926925510168076, 0.056815337389707565, 0.06363881379365921, -0.0308533888310194, 0.04385088011622429, -0.01323937252163887, -0.0792405903339386, -0.060113389045000076, 0.04112555459141731, -0.045336153358221054, -0.03181450441479683, -0.0333082340657711, -0.10316522419452667, -0.041187502443790436, -0.07913114875555038, -0.0018097871216014028, 0.07474381476640701, -0.04939328506588936, 0.07344284653663635, -0.013182544149458408, -0.04538671299815178, 0.10290949046611786, 0.023048579692840576, -0.06356516480445862, -0.09433185309171677, -0.0021999103482812643, -0.0014971432974562049, 0.05823016166687012, 0.11072579771280289, 0.022699372842907906, 0.07359220087528229, -0.029429202899336815, -0.026600472629070282, -0.0168534554541111, -0.06837352365255356, 0.040519338101148605, 0.011801280081272125, 0.056977733969688416, -0.03772858902812004, -0.014022876508533955, -0.002111270325258374, 0.08112211525440216, 0.08001197874546051, 0.0008479348616674542, 0.09671083092689514, 0.05769946426153183, -0.05309481918811798, -0.02556866779923439, 0.03756359592080116, 0.08308367431163788, 0.000315983546897769, 0.05613046884536743, 0.14037923514842987, 0.0643242746591568, 0.015057691372931004, 0.020878981798887253, 0.03483286872506142, 0.06564961373806, 0.014115598984062672, -0.004218639340251684, 2.1143064038553614e-33, -0.0037756464444100857, -0.09120795130729675, 0.006836849730461836, 0.03601289168000221, 0.03102416731417179, 0.02826167829334736, 0.03641587495803833, 0.023191986605525017, -0.061177149415016174, 0.041469670832157135, 0.03981702774763107, -0.03627721965312958, -0.05622648447751999, -0.017415417358279228, 0.01958708092570305, 0.01952565275132656, 0.047578658908605576, 0.04240288957953453, 0.032793838530778885, -0.04067956283688545, 0.011373315937817097, 0.02241029217839241, -0.10401356220245361, 0.010821050964295864, 0.022149579599499702, -0.10910022258758545, 0.027437057346105576, -0.006667399778962135, 0.011428539641201496, -0.0212186798453331, 0.035662222653627396, 0.012358464300632477, 0.06460008025169373, 0.0902717337012291, 0.01259187888354063, -0.0021861570421606302, -0.0689125806093216, 0.06663474440574646, -0.15468594431877136, 0.0055465735495090485, 0.029539043083786964, 0.06860745698213577, -0.048440203070640564, -0.014821465127170086, 0.005093147978186607, -0.06166486069560051, 0.014965444803237915, -0.00034989049891009927, 0.10247498005628586, -0.08238227665424347, -0.004076703451573849, 0.046386852860450745, 0.03420686721801758, -0.07399041950702667, 0.00891086831688881, -0.016275260597467422, 0.007983455434441566, -0.06305677443742752, -0.030034806579351425, -0.024318750947713852, 0.019961919635534286, -0.0007540370570495725, 0.007966927252709866, 0.014141942374408245, 0.07067026197910309, 0.013844089582562447, -0.00520091038197279, -0.0785861611366272, 0.027646556496620178, 0.035795655101537704, -0.09215763211250305, -0.019626108929514885, -0.08599025756120682, 0.01470972504466772, 0.034355372190475464, -0.04201750457286835, 0.013874662108719349, 0.01603510044515133, 0.05239364504814148, -0.052465565502643585, 0.00806384440511465, 0.021054264158010483, -0.017668530344963074, 0.08913450688123703, 0.0016408656956627965, -0.04223542660474777, -0.06315102428197861, -0.019718999043107033, 0.0252241138368845, -0.04944649711251259, 0.1491609364748001, -0.047966666519641876, -0.014266744256019592, -0.08201667666435242, -0.13350632786750793, -3.702409373720849e-33, -0.02322244457900524, -0.030154839158058167, 0.018440406769514084, 0.07405537366867065, -0.0215869452804327, -0.00022443081252276897, -0.06488765776157379, -0.0730024129152298, 0.07068340480327606, -0.005073382053524256, -0.007734988816082478, -0.013151794672012329, 0.04949507489800453, -0.014727071858942509, -0.06271007657051086, 0.0374523401260376, -0.08444041013717651, -0.022155873477458954, 0.05832001939415932, -0.02826133370399475, 0.0018958259606733918, -0.007138940971344709, 0.07727111130952835, 0.07315538078546524, 0.016213851049542427, -0.04608553275465965, -0.05986040085554123, 0.02915087528526783, -0.0013860079925507307, -0.04931768774986267, -0.03534833714365959, 0.09708444029092789, -0.035436809062957764, 0.061848755925893784, -0.02283058874309063, -0.09482798725366592, -0.042214833199977875, 0.06259424984455109, 0.046064749360084534, 0.017940498888492584, 0.008353552781045437, 0.06439026445150375, -0.05338028818368912, 0.0024183967616409063, 0.00943663064390421, 0.041891176253557205, 0.04639744758605957, -0.0013086273102089763, -0.04821421578526497, -0.04415786266326904, -0.06038105487823486, -0.05465582385659218, -0.04853786900639534, 0.0011810576543211937, 0.02836279384791851, -0.018325744196772575, 0.010901865549385548, 0.08247088640928268, -0.035834889858961105, 0.031522467732429504, 0.12390368431806564, -0.055800627917051315, -0.05204978585243225, 0.04178497940301895, -0.0541006475687027, 0.09692662954330444, -0.07592695206403732, 0.03076336532831192, 0.03460904583334923, -0.0675538033246994, -0.02665199525654316, -0.0752885639667511, -0.04164612293243408, -0.004870976321399212, 0.0021297545172274113, -0.06252922117710114, 0.08995073288679123, -0.09848295152187347, 0.012575073167681694, 0.06696018576622009, -0.09917397052049637, 0.04550756886601448, -0.10055550932884216, -0.007607182953506708, -0.009363110177218914, 0.08869844675064087, -0.01818794570863247, 0.08588577806949615, 0.04293452203273773, 0.04319200664758682, 0.0011290248949080706, 0.021759599447250366, -0.061052899807691574, -0.007239924278110266, -0.010345556773245335, -5.100578803762801e-8, 0.006874615792185068, -0.022318324074149132, -0.0913134515285492, 0.031280361115932465, -0.03757883235812187, -0.026448626071214676, 0.042489685118198395, -0.040087856352329254, 0.03565974533557892, 0.08058560639619827, 0.016029393300414085, -0.009811539202928543, -0.01651795394718647, -0.019146917387843132, -0.01729804277420044, -0.03794995695352554, 0.019626911729574203, 0.08976909518241882, -0.0386112704873085, 0.02938978001475334, 0.018347879871726036, 0.03755810856819153, -0.035357944667339325, 0.07347588241100311, 0.03990669921040535, -0.020439988002181053, 0.06727403402328491, 0.011675790883600712, 0.041742224246263504, 0.07033070176839828, -0.03111572191119194, 0.011501980014145374, 0.017533404752612114, -0.026552045717835426, -0.1039048284292221, 0.004889913834631443, -0.053005483001470566, 0.04986545071005821, 0.09836278110742569, 0.059223756194114685, -0.017086602747440338, 0.03827657923102379, -0.014288359321653843, 0.010766295716166496, -0.08713851124048233, -0.04589744284749031, 0.09076134115457535, 0.008197512477636337, 0.04372743144631386, -0.04601367190480232, 0.021053548902273178, 0.024558164179325104, 0.014750061556696892, 0.03370756283402443, 0.06358907371759415, 0.05174929276108742, 0.021081553772091866, -0.025476209819316864, -0.002071450697258115, -0.049085285514593124, 0.04078206792473793, -0.09141691774129868, -0.00928780809044838, -0.03831639885902405 ]
-0.004658
crypto on startup. (Cannot be disabled from script code.) (Same requirements as `--enable-fips`.) ### `--force-node-api-uncaught-exceptions-policy` Enforces `uncaughtException` event on Node-API asynchronous callbacks. To prevent from an existing add-on from crashing the process, this flag is not enabled by default. In the future, this flag will be enabled by default to enforce the correct behavior. ### `--frozen-intrinsics` > Stability: 1 - Experimental Enable experimental frozen intrinsics like `Array` and `Object`. Only the root context is supported. There is no guarantee that `globalThis.Array` is indeed the default intrinsic reference. Code may break under this flag. To allow polyfills to be added, [`--require`][] and [`--import`][] both run before freezing intrinsics. ### `--heap-prof` Starts the V8 heap profiler on start up, and writes the heap profile to disk before exit. If `--heap-prof-dir` is not specified, the generated profile is placed in the current working directory. If `--heap-prof-name` is not specified, the generated profile is named `Heap.${yyyymmdd}.${hhmmss}.${pid}.${tid}.${seq}.heapprofile`. ```console $ node --heap-prof index.js $ ls \*.heapprofile Heap.20190409.202950.15293.0.001.heapprofile ``` ### `--heap-prof-dir` Specify the directory where the heap profiles generated by `--heap-prof` will be placed. The default value is controlled by the [`--diagnostic-dir`][] command-line option. ### `--heap-prof-interval` Specify the average sampling interval in bytes for the heap profiles generated by `--heap-prof`. The default is 512 \\* 1024 bytes. ### `--heap-prof-name` Specify the file name of the heap profile generated by `--heap-prof`. ### `--heapsnapshot-near-heap-limit=max\_count` Writes a V8 heap snapshot to disk when the V8 heap usage is approaching the heap limit. `count` should be a non-negative integer (in which case Node.js will write no more than `max\_count` snapshots to disk). When generating snapshots, garbage collection may be triggered and bring the heap usage down. Therefore multiple snapshots may be written to disk before the Node.js instance finally runs out of memory. These heap snapshots can be compared to determine what objects are being allocated during the time consecutive snapshots are taken. It's not guaranteed that Node.js will write exactly `max\_count` snapshots to disk, but it will try its best to generate at least one and up to `max\_count` snapshots before the Node.js instance runs out of memory when `max\_count` is greater than `0`. Generating V8 snapshots takes time and memory (both memory managed by the V8 heap and native memory outside the V8 heap). The bigger the heap is, the more resources it needs. Node.js will adjust the V8 heap to accommodate the additional V8 heap memory overhead, and try its best to avoid using up all the memory available to the process. When the process uses more memory than the system deems appropriate, the process may be terminated abruptly by the system, depending on the system configuration. ```console $ node --max-old-space-size=100 --heapsnapshot-near-heap-limit=3 index.js Wrote snapshot to Heap.20200430.100036.49580.0.001.heapsnapshot Wrote snapshot to Heap.20200430.100037.49580.0.002.heapsnapshot Wrote snapshot to Heap.20200430.100038.49580.0.003.heapsnapshot <--- Last few GCs ---> [49580:0x110000000] 4826 ms: Mark-sweep 130.6 (147.8) -> 130.5 (147.8) MB, 27.4 / 0.0 ms (average mu = 0.126, current mu = 0.034) allocation failure scavenge might not succeed [49580:0x110000000] 4845 ms: Mark-sweep 130.6 (147.8) -> 130.6 (147.8) MB, 18.8 / 0.0 ms (average mu = 0.088, current mu = 0.031) allocation failure scavenge might not succeed <--- JS stacktrace ---> FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory .... ``` ### `--heapsnapshot-signal=signal` Enables a signal handler that causes the Node.js process to write a heap dump when the specified signal is received. `signal` must be a valid signal name. Disabled by default. ```console $ node --heapsnapshot-signal=SIGUSR2 index.js & $ ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND node 1 5.5 6.1 787252 247004 ? Ssl 16:43
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.08263234049081802, 0.0151361133903265, -0.06875486671924591, 0.06854761391878128, 0.06450310349464417, -0.04304318502545357, -0.016192246228456497, 0.03587329387664795, -0.04666890203952789, -0.025332942605018616, -0.05005316808819771, 0.03905145823955536, 0.0020819338969886303, 0.04517173022031784, -0.008359487168490887, 0.025788940489292145, -0.0014038843801245093, -0.008347216062247753, 0.03196846321225166, -0.024771718308329582, 0.05733555555343628, -0.07243359088897705, 0.04783329740166664, 0.0035839462652802467, -0.059546057134866714, -0.056384555995464325, -0.07209726423025131, 0.018544767051935196, 0.004324918147176504, -0.02071257308125496, -0.010618152096867561, 0.05599373206496239, 0.016926562413573265, -0.023298490792512894, 0.0075109172612428665, 0.17589640617370605, -0.006313020829111338, -0.05454067513346672, -0.06312193721532822, -0.03426560387015343, 0.09626507759094238, -0.026441562920808792, -0.10621106624603271, -0.05166104808449745, -0.044381096959114075, -0.029368789866566658, 0.004292207304388285, -0.039517998695373535, -0.012603772804141045, -0.02610848844051361, 0.03596959635615349, -0.01849803328514099, 0.045095235109329224, -0.013333798386156559, -0.027521375566720963, 0.06197408214211464, 0.0023301115725189447, 0.01884596049785614, 0.007831557653844357, -0.019886096939444542, -0.009820438921451569, 0.014277094975113869, 0.05140933766961098, 0.036714933812618256, 0.06382201611995697, 0.16097211837768555, 0.02646459825336933, -0.007875362411141396, -0.011460419744253159, 0.09652586281299591, 0.052966345101594925, 0.047798529267311096, -0.002459659706801176, 0.05461984500288963, -0.0022847475484013557, 0.052082981914281845, -0.07554009556770325, -0.06044980138540268, -0.004518989007920027, -0.033304981887340546, -0.020524470135569572, -0.09408864378929138, 0.038335900753736496, -0.03508850187063217, -0.05960915610194206, 0.11783622205257416, 0.030448975041508675, -0.02525336481630802, 0.054506365209817886, 0.03427775949239731, 0.0036267645191401243, -0.02590692602097988, -0.0878792330622673, 0.03895718604326248, 0.054519105702638626, 0.008311251178383827, -0.01329013705253601, -0.07987776398658752, -0.09967851638793945, -0.06313015520572662, 0.024801502004265785, -0.009389061480760574, 0.050175394862890244, 0.01822843961417675, 0.09239955246448517, 0.002272573299705982, -0.025003518909215927, -0.0591048039495945, -0.0791231170296669, 0.022918792441487312, 0.019278498366475105, 0.06574567407369614, 0.04616860672831535, 0.03783569484949112, -0.0412278026342392, 0.12060610949993134, 0.01574544794857502, -0.0056714159436523914, 0.028642334043979645, 0.09391630440950394, 0.09444842487573624, 0.06724732369184494, 0.01175711676478386, 0.021696830168366432, -0.04163474962115288, -0.055116862058639526, -0.025302033871412277, -4.988119360573181e-34, 0.015647482126951218, -0.11842893809080124, 0.04042230546474457, -0.01172054372727871, 0.044834401458501816, -0.06043501943349838, 0.04406318813562393, -0.00420005340129137, -0.11159364134073257, 0.0014841955853626132, -0.044113170355558395, -0.008233889006078243, 0.030429909005761147, -0.034825701266527176, 0.06504117697477341, -0.05872521921992302, 0.06453131884336472, -0.006663613952696323, 0.05311296507716179, -0.018642622977495193, 0.029331117868423462, 0.017291206866502762, -0.00855772104114294, 0.011599264107644558, -0.0031791627407073975, 0.044885169714689255, -0.02375178225338459, 0.015297796577215195, 0.03703860193490982, 0.029721857979893684, -0.048868101090192795, 0.01963689737021923, -0.07695071399211884, 0.09047675132751465, 0.0051136501133441925, -0.01230398565530777, -0.10311299562454224, -0.00667699845507741, -0.08535043150186539, -0.03739794343709946, 0.10749385505914688, 0.040181297808885574, 0.012742006219923496, -0.04664778336882591, -0.0015454066451638937, -0.04005962982773781, -0.07112396508455276, -0.027775082737207413, 0.0384138859808445, 0.07532178610563278, -0.025655671954154968, 0.04673393815755844, -0.07324280589818954, -0.13299089670181274, 0.054215144366025925, -0.08143248409032822, -0.03684404864907265, -0.042125411331653595, -0.02956196665763855, -0.018925758078694344, 0.018025707453489304, -0.04807949438691139, -0.039244379848241806, -0.04328889399766922, -0.01938428170979023, 0.017444565892219543, -0.02248157188296318, -0.009638721123337746, -0.09285824745893478, 0.051923323422670364, -0.025569472461938858, 0.012949609197676182, 0.023539626970887184, 0.09067600965499878, 0.0605693981051445, -0.013502201996743679, -0.018813777714967728, -0.059541214257478714, -0.06526687741279602, -0.0161490049213171, 0.08375543355941772, -0.017992420122027397, -0.01582120545208454, 0.02345859259366989, 0.010966658592224121, 0.01463706698268652, 0.017100589349865913, 0.04152302443981171, 0.0022893683053553104, -0.04513441026210785, 0.07009478658437729, -0.04503225162625313, 0.05776398628950119, -0.10429590940475464, -0.18236775696277618, -2.010263582535073e-33, 0.02526739612221718, -0.07159221917390823, -0.013362866826355457, 0.10707581788301468, 0.008818450383841991, -0.016988355666399002, -0.03796274587512016, -0.02457975596189499, 0.05231539160013199, -0.0037314537912607193, -0.05693741515278816, 0.01750127598643303, 0.059573400765657425, -0.01132782083004713, 0.05779419094324112, 0.025041846558451653, -0.1343638002872467, 0.015955284237861633, 0.03679843246936798, -0.008098728023469448, 0.009622474201023579, 0.0023154306691139936, 0.00776942353695631, 0.07261167466640472, 0.050502605736255646, -0.03457869589328766, -0.0972985178232193, 0.048489879816770554, -0.022677838802337646, -0.007282014470547438, -0.028786133974790573, 0.08353612571954727, -0.05227474868297577, 0.05574405938386917, -0.0030437142122536898, -0.060912612825632095, -0.030587907880544662, 0.02930503338575363, 0.022719716653227806, -0.03801191598176956, 0.08011796325445175, -0.0027294433675706387, -0.058591216802597046, -0.007368342950940132, 0.005873281508684158, -0.028623826801776886, 0.00604177825152874, -0.0436999686062336, -0.000609265174716711, -0.014265194535255432, -0.06481292098760605, 0.014795038849115372, 0.06751243025064468, -0.01106814295053482, 0.02004384621977806, -0.023967495188117027, 0.030895616859197617, 0.06754498183727264, -0.03007984533905983, -0.005482723470777273, 0.05178166925907135, -0.04840092733502388, 0.028668634593486786, -0.03887605667114258, 0.014768138527870178, 0.01586935482919216, -0.08181139081716537, -0.0038092443719506264, -0.035459842532873154, 0.027653470635414124, 0.06483384221792221, -0.023936720564961433, -0.02841709554195404, -0.0027595125138759613, -0.07931528985500336, -0.03761788085103035, -0.011675677262246609, -0.11920233815908432, -0.020777394995093346, 0.014427976682782173, -0.04187937453389168, 0.0720907598733902, -0.031114662066102028, 0.05890565365552902, 0.032526783645153046, -0.0896167904138565, 0.025742217898368835, 0.062143195420503616, -0.009154069237411022, 0.04027888551354408, 0.02906671352684498, 0.023684637621045113, -0.06494462490081787, 0.09247948974370956, 0.023251837119460106, -5.6174641827055893e-8, 0.010481307283043861, 0.023577667772769928, -0.14387711882591248, 0.054846394807100296, 0.08289778977632523, -0.0024997841101139784, 0.04558583348989487, -0.0075462739914655685, -0.022641129791736603, 0.011645885184407234, 0.024452203884720802, -0.010273643769323826, 0.028714774176478386, 0.014458212070167065, 0.019675424322485924, 0.04306464269757271, -0.05782609060406685, 0.03789402171969414, -0.015362187288701534, -0.06557069718837738, -0.035294659435749054, 0.03944260627031326, -0.10962674766778946, 0.009104426950216293, 0.030219778418540955, 0.02685704454779625, 0.09500641375780106, -0.028644545003771782, 0.025211449712514877, 0.05610102787613869, -0.07619356364011765, -0.034554626792669296, 0.03610658273100853, 0.02142082341015339, -0.07497700303792953, 0.05648929253220558, -0.029278650879859924, 0.04360508918762207, 0.06067069247364998, 0.019940802827477455, 0.018109947443008423, 0.05887947604060173, -0.0026301019825041294, -0.0103360740467906, 0.0325646847486496, 0.00658678961917758, -0.05379612371325493, 0.0666595920920372, 0.013440452516078949, 0.08207989484071732, -0.007140212692320347, 0.05017680302262306, -0.04599887877702713, 0.05064194276928902, 0.035676926374435425, 0.023370997980237007, -0.03819693252444267, -0.09664629399776459, 0.035209715366363525, 0.020166093483567238, -0.016480883583426476, -0.046736814081668854, 0.11721938103437424, -0.042549025267362595 ]
0.088895
to write a heap dump when the specified signal is received. `signal` must be a valid signal name. Disabled by default. ```console $ node --heapsnapshot-signal=SIGUSR2 index.js & $ ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND node 1 5.5 6.1 787252 247004 ? Ssl 16:43 0:02 node --heapsnapshot-signal=SIGUSR2 index.js $ kill -USR2 1 $ ls Heap.20190718.133405.15554.0.001.heapsnapshot ``` ### `-h`, `--help` Print node command-line options. The output of this option is less detailed than this document. ### `--icu-data-dir=file` Specify ICU data load path. (Overrides `NODE\_ICU\_DATA`.) ### `--import=module` > Stability: 1 - Experimental Preload the specified module at startup. If the flag is provided several times, each module will be executed sequentially in the order they appear, starting with the ones provided in [`NODE\_OPTIONS`][]. Follows [ECMAScript module][] resolution rules. Use [`--require`][] to load a [CommonJS module][]. Modules preloaded with `--require` will run before modules preloaded with `--import`. Modules are preloaded into the main thread as well as any worker threads, forked processes, or clustered processes. ### `--input-type=type` This configures Node.js to interpret `--eval` or `STDIN` input as CommonJS or as an ES module. Valid values are `"commonjs"`, `"module"`, `"module-typescript"` and `"commonjs-typescript"`. The `"-typescript"` values are not available with the flag `--no-strip-types`. The default is no value, or `"commonjs"` if `--no-experimental-detect-module` is passed. If `--input-type` is not provided, Node.js will try to detect the syntax with the following steps: 1. Run the input as CommonJS. 2. If step 1 fails, run the input as an ES module. 3. If step 2 fails with a SyntaxError, strip the types. 4. If step 3 fails with an error code [`ERR\_UNSUPPORTED\_TYPESCRIPT\_SYNTAX`][] or [`ERR\_INVALID\_TYPESCRIPT\_SYNTAX`][], throw the error from step 2, including the TypeScript error in the message, else run as CommonJS. 5. If step 4 fails, run the input as an ES module. To avoid the delay of multiple syntax detection passes, the `--input-type=type` flag can be used to specify how the `--eval` input should be interpreted. The REPL does not support this option. Usage of `--input-type=module` with [`--print`][] will throw an error, as `--print` does not support ES module syntax. ### `--insecure-http-parser` Enable leniency flags on the HTTP parser. This may allow interoperability with non-conformant HTTP implementations. When enabled, the parser will accept the following: \* Invalid HTTP headers values. \* Invalid HTTP versions. \* Allow message containing both `Transfer-Encoding` and `Content-Length` headers. \* Allow extra data after message when `Connection: close` is present. \* Allow extra transfer encodings after `chunked` has been provided. \* Allow `\n` to be used as token separator instead of `\r\n`. \* Allow `\r\n` not to be provided after a chunk. \* Allow spaces to be present after a chunk size and before `\r\n`. All the above will expose your application to request smuggling or poisoning attack. Avoid using this option. #### Warning: binding inspector to a public IP:port combination is insecure Binding the inspector to a public IP (including `0.0.0.0`) with an open port is insecure, as it allows external hosts to connect to the inspector and perform a [remote code execution][] attack. If specifying a host, make sure that either: \* The host is not accessible from public networks. \* A firewall disallows unwanted connections on the port. \*\*More specifically, `--inspect=0.0.0.0` is insecure if the port (`9229` by default) is not firewall-protected.\*\* See the [debugging security implications][] section for more information. ### `--inspect-brk[=[host:]port]` Activate inspector on `host:port` and break at start of user script. Default `host:port` is `127.0.0.1:9229`. If port `0` is specified, a random available port will be used. See [V8 Inspector integration for Node.js][] for further explanation on Node.js debugger. ### `--inspect-port=[host:]port`
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.006514724809676409, 0.04524349048733711, -0.04972080513834953, 0.028815489262342453, 0.034124817699193954, -0.07328484207391739, -0.037773650139570236, 0.083222396671772, 0.005510972812771797, 0.012031431309878826, -0.026931868866086006, -0.037373658269643784, -0.013689126819372177, -0.05282703414559364, -0.006254144944250584, 0.012533309869468212, -0.021590622141957283, -0.014763197861611843, 0.0725247785449028, -0.0843648761510849, 0.023717444390058517, 0.04468190670013428, -0.015288416296243668, -0.04581211507320404, -0.052240997552871704, -0.0009659468196332455, -0.02963150478899479, 0.03395888954401016, 0.04308461397886276, -0.003089365316554904, 0.060676053166389465, 0.027860093861818314, 0.007884039543569088, -0.0010126498527824879, 0.08807969093322754, 0.14620232582092285, -0.04205849766731262, -0.06796884536743164, -0.07051655650138855, -0.030321091413497925, 0.11861111223697662, 0.028871390968561172, -0.05798397585749626, -0.0027960743755102158, -0.06814310699701309, -0.010297976434230804, -0.10040393471717834, 0.011043195612728596, -0.024435799568891525, -0.04180821403861046, -0.011915230192244053, 0.013253179378807545, 0.037848036736249924, 0.047688473016023636, -0.008081973530352116, 0.018148204311728477, 0.026955220848321915, -0.04705086722970009, -0.031756531447172165, -0.016877491027116776, -0.04660587012767792, 0.006431044545024633, 0.0015443199081346393, -0.10143114626407623, 0.0488903634250164, 0.10237005352973938, 0.059868261218070984, 0.0374639555811882, 0.020514655858278275, 0.03517403081059456, -0.01536888163536787, 0.0018363529816269875, -0.10346042364835739, -0.02487741969525814, -0.03966987505555153, 0.008483672514557838, 0.0021330099552869797, -0.057768046855926514, -0.0694284737110138, -0.08280981332063675, -0.05616873502731323, -0.036343593150377274, -0.034862201660871506, -0.0851484090089798, -0.06741318106651306, 0.13132314383983612, -0.018267158418893814, 0.02129545621573925, 0.07645319402217865, -0.06436240673065186, -0.04980635643005371, -0.014841961674392223, -0.0691681057214737, 0.015840845182538033, 0.051396023482084274, 0.03192056715488434, 0.015295547433197498, 0.05063484236598015, -0.02167704701423645, -0.0018746211426332593, 0.042377762496471405, 0.06832528859376907, -0.04489767923951149, 0.013652598485350609, -0.013624927960336208, -0.009893381968140602, -0.038973912596702576, 0.02310199663043022, -0.07975480705499649, 0.064024917781353, 0.05460145324468613, 0.11373864859342575, 0.019784433767199516, 0.01338905654847622, 0.08916006237268448, 0.0008614654070697725, 0.041107647120952606, 0.021679682657122612, -0.06618118286132812, 0.009423588402569294, 0.07254466414451599, -0.03561422601342201, -0.12917734682559967, 0.03535853326320648, 0.0027823715936392546, -0.06711510568857193, 0.02095603756606579, 6.593347079078241e-33, 0.02300661988556385, -0.005196216981858015, 0.03939112648367882, -0.0322127602994442, -0.015412317588925362, -0.011411773040890694, -0.02863353118300438, 0.02159988507628441, 0.002266795840114355, 0.10116776823997498, -0.11938513070344925, -0.0656135305762291, -0.057104047387838364, -0.010784517042338848, 0.010105271823704243, -0.06517158448696136, -0.0025064507499337196, -0.00898029562085867, 0.019402682781219482, -0.004770016297698021, 0.012400384992361069, -0.005567559506744146, -0.07155421376228333, -0.05392264574766159, 0.007479533553123474, 0.06885646283626556, -0.022299649193882942, -0.017751561477780342, -0.013734822161495686, -0.017780140042304993, -0.030192486941814423, 0.003462146734818816, -0.07949972152709961, -0.016168255358934402, 0.0841192901134491, -0.08800823241472244, -0.08900562673807144, 0.07459480315446854, -0.11787954717874527, -0.03282344713807106, 0.051610831171274185, 0.04591464251279831, -0.09002694487571716, -0.032568950206041336, -0.015225864015519619, -0.0353931188583374, -0.04472176358103752, -0.04814457520842552, 0.10808082669973373, -0.01616690680384636, 0.04139433801174164, 0.0001628029567655176, -0.04772918298840523, 0.007221803534775972, 0.05145270377397537, 0.018081866204738617, 0.08239666372537613, -0.07217726111412048, 0.05655952915549278, 0.13897164165973663, 0.055442485958337784, -0.0064605786465108395, 0.01629544608294964, 0.04587273672223091, 0.01817590743303299, 0.0026847280096262693, -0.005710273515433073, 0.025974871590733528, -0.02310335449874401, 0.09670192003250122, -0.03807903826236725, 0.06828390806913376, 0.043968625366687775, 0.014814522117376328, 0.04326651990413666, -0.014376123435795307, -0.007683060597628355, 0.006525128148496151, -0.011870157904922962, 0.006000462453812361, 0.08474677056074142, -0.09828956425189972, -0.01761619932949543, -0.07283733040094376, 0.08300330489873886, 0.014998719096183777, -0.031084725633263588, -0.041036929935216904, -0.013539778999984264, -0.013864350505173206, -0.030513882637023926, -0.0047812447883188725, 0.025061819702386856, -0.09271282702684402, -0.21834824979305267, -8.026291590461903e-33, -0.02330438233911991, 0.03810682147741318, -0.01748146302998066, 0.03556365519762039, -0.0373353511095047, 0.0032998244278132915, 0.010773446410894394, 0.009626748971641064, -0.026469845324754715, 0.08039987832307816, -0.028907019644975662, 0.009563939645886421, 0.023105597123503685, 0.016035279259085655, 0.03959781676530838, 0.051931560039520264, -0.022612037137150764, -0.09233030676841736, -0.03777873143553734, 0.05167360231280327, 0.017165180295705795, 0.004825252573937178, 0.02323381043970585, 0.009535904973745346, -0.03868201747536659, -0.03844039514660835, 0.085932657122612, 0.019325656816363335, 0.02496357448399067, -0.05757678672671318, 0.006301601883023977, 0.03126054257154465, -0.01080236490815878, 0.02805495262145996, 0.0535491481423378, -0.0680905357003212, 0.05966857448220253, 0.025899114087224007, -0.02338634803891182, 0.03070158325135708, 0.060471996665000916, 0.11901192367076874, -0.09097456932067871, 0.05323482304811478, -0.045827753841876984, -0.0027858756948262453, -0.02778778411448002, 0.012966226786375046, 0.013845598325133324, -0.05213619023561478, -0.003039863659068942, -0.03347352147102356, 0.007557957898825407, 0.06593465059995651, 0.047485679388046265, -0.0157802514731884, 0.031044073402881622, 0.00031743323779664934, 0.014187809079885483, -0.061350610107183456, 0.029728803783655167, -0.11430705338716507, -0.06974442303180695, -0.11280402541160583, 0.05665522813796997, -0.05273239687085152, 0.004387573804706335, -0.07406511157751083, -0.07668713480234146, 0.08898181468248367, 0.017212990671396255, 0.022623538970947266, 0.028136270120739937, -0.01714443787932396, -0.06134629249572754, 0.02753373235464096, -0.07402084767818451, -0.05716555938124657, 0.03661404550075531, -0.030660467222332954, -0.059664905071258545, 0.000456110603408888, 0.014729376882314682, 0.02881421335041523, 0.005688269156962633, 0.017333976924419403, -0.02106490172445774, 0.03519821539521217, 0.022390639409422874, -0.06454414129257202, 0.012865835800766945, 0.01095027569681406, -0.01406115386635065, 0.07830515503883362, 0.03495513275265694, -6.089558013400165e-8, 0.004439567681401968, -0.06304536759853363, -0.0604005791246891, 0.05051523447036743, 0.005617150105535984, -0.03918683901429176, 0.0446942001581192, -0.004433831200003624, 0.037934839725494385, 0.034784018993377686, 0.03321819007396698, -0.017801469191908836, -0.0640123039484024, -0.016171718016266823, 0.062138259410858154, -0.001984604401513934, -0.011332285590469837, 0.008382044732570648, 0.016101205721497536, -0.08285965025424957, 0.03940388932824135, 0.022978423163294792, 0.012744973413646221, 0.00286241271533072, 0.02072802558541298, -0.029003415256738663, 0.07612249255180359, 0.060187652707099915, -0.03105948492884636, -0.08255912363529205, 0.01813787780702114, 0.004556273575872183, 0.014136216603219509, -0.03311704844236374, 0.016307471320033073, 0.04736166447401047, 0.05611535161733627, 0.03722664713859558, 0.1429097056388855, 0.07579921931028366, -0.09636976569890976, 0.1129346564412117, -0.0785401239991188, 0.023836525157094002, 0.03503013029694557, 0.05498168244957924, -0.02239980176091194, 0.024703308939933777, 0.003838850650936365, 0.0029616181273013353, -0.0032892958261072636, -0.027415253221988678, 0.006521514616906643, 0.029355308040976524, 0.04164088889956474, 0.038731396198272705, -0.09919779002666473, -0.045329734683036804, 0.011930701322853565, 0.045466456562280655, 0.11092355102300644, 0.027215059846639633, 0.006570451892912388, -0.028280111029744148 ]
0.148727
[debugging security implications][] section for more information. ### `--inspect-brk[=[host:]port]` Activate inspector on `host:port` and break at start of user script. Default `host:port` is `127.0.0.1:9229`. If port `0` is specified, a random available port will be used. See [V8 Inspector integration for Node.js][] for further explanation on Node.js debugger. ### `--inspect-port=[host:]port` Set the `host:port` to be used when the inspector is activated. Useful when activating the inspector by sending the `SIGUSR1` signal. Except when [`--disable-sigusr1`][] is passed. Default host is `127.0.0.1`. If port `0` is specified, a random available port will be used. See the [security warning][] below regarding the `host` parameter usage. ### `--inspect-publish-uid=stderr,http` Specify ways of the inspector web socket url exposure. By default inspector websocket url is available in stderr and under `/json/list` endpoint on `http://host:port/json/list`. ### `--inspect-wait[=[host:]port]` Activate inspector on `host:port` and wait for debugger to be attached. Default `host:port` is `127.0.0.1:9229`. If port `0` is specified, a random available port will be used. See [V8 Inspector integration for Node.js][] for further explanation on Node.js debugger. ### `--inspect[=[host:]port]` Activate inspector on `host:port`. Default is `127.0.0.1:9229`. If port `0` is specified, a random available port will be used. V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug and profile Node.js instances. The tools attach to Node.js instances via a tcp port and communicate using the [Chrome DevTools Protocol][]. See [V8 Inspector integration for Node.js][] for further explanation on Node.js debugger. ### `-i`, `--interactive` Opens the REPL even if stdin does not appear to be a terminal. ### `--jitless` > Stability: 1 - Experimental. This flag is inherited from V8 and is subject to > change upstream. Disable [runtime allocation of executable memory][jitless]. This may be required on some platforms for security reasons. It can also reduce attack surface on other platforms, but the performance impact may be severe. ### `--localstorage-file=file` > Stability: 1.2 - Release candidate. The file used to store `localStorage` data. If the file does not exist, it is created the first time `localStorage` is accessed. The same file may be shared between multiple Node.js processes concurrently. ### `--max-http-header-size=size` Specify the maximum size, in bytes, of HTTP headers. Defaults to 16 KiB. ### `--max-old-space-size-percentage=percentage` Sets the maximum memory size of V8's old memory section as a percentage of available system memory. This flag takes precedence over `--max-old-space-size` when both are specified. The `percentage` parameter must be a number greater than 0 and up to 100, representing the percentage of available system memory to allocate to the V8 heap. \*\*Note:\*\* This flag utilizes `--max-old-space-size`, which may be unreliable on 32-bit platforms due to integer overflow issues. ```bash # Using 50% of available system memory node --max-old-space-size-percentage=50 index.js # Using 75% of available system memory node --max-old-space-size-percentage=75 index.js ``` ### `--napi-modules` This option is a no-op. It is kept for compatibility. ### `--network-family-autoselection-attempt-timeout` Sets the default value for the network family autoselection attempt timeout. For more information, see [`net.getDefaultAutoSelectFamilyAttemptTimeout()`][]. ### `--no-addons` Disable the `node-addons` exports condition as well as disable loading native addons. When `--no-addons` is specified, calling `process.dlopen` or requiring a native C++ addon will fail and throw an exception. ### `--no-async-context-frame` Disables the use of [`AsyncLocalStorage`][] backed by `AsyncContextFrame` and uses the prior implementation which relied on async\\_hooks. The previous model is retained for compatibility with Electron and for cases where the context flow may differ. However, if a difference in flow is found please report it. ### `--no-deprecation` Silence deprecation warnings. ### `--no-experimental-detect-module` Disable using [syntax detection][] to determine module type. ### `--no-experimental-global-navigator` > Stability: 1 - Experimental Disable exposition of [Navigator API][] on the global scope. ### `--no-experimental-repl-await` Use this
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.02762986719608307, 0.0556359738111496, -0.028045712038874626, 0.02681136503815651, 0.06061095744371414, -0.1002504751086235, -0.028148716315627098, 0.009627006016671658, -0.0006354228826239705, -0.011176960542798042, 0.002623428590595722, 0.0019349493086338043, -0.029525669291615486, -0.058425478637218475, -0.004334823228418827, -0.012972264550626278, 0.04601620137691498, -0.10274157673120499, 0.05630411580204964, -0.013007848523557186, -0.055982381105422974, -0.015098701231181622, -0.029928026720881462, -0.03870208188891411, -0.10272985696792603, -0.07018338888883591, 0.003909256774932146, 0.073251873254776, 0.03910627216100693, -0.020448172464966774, -0.0043458701111376286, -0.009707280434668064, -0.03021237440407276, 0.031128646805882454, -0.04407772794365883, 0.08565480262041092, 0.08093974739313126, -0.08473838120698929, -0.11198689788579941, 0.029416857287287712, 0.10230325907468796, 0.010921490378677845, -0.059529613703489304, -0.029512615874409676, -0.02109377458691597, -0.06855672597885132, -0.1069893017411232, -0.011632693000137806, -0.06784170120954514, -0.02157372422516346, -0.023283137008547783, 0.03748823329806328, 0.008016835898160934, 0.009302912279963493, 0.00801578164100647, -0.011825214140117168, -0.022882426157593727, 0.005368342157453299, 0.0365740992128849, 0.07920466363430023, 0.009655604138970375, 0.01136662345379591, 0.055511411279439926, -0.062051668763160706, 0.0034359158016741276, 0.001591112813912332, 0.009979420341551304, 0.002654098439961672, 0.02450704760849476, 0.05820757523179054, 0.011253842152655125, -0.026866136118769646, -0.08969632536172867, -0.01676373928785324, -0.005377080757170916, -0.007885109633207321, -0.081759013235569, -0.055050160735845566, -0.013978480361402035, -0.047672808170318604, -0.056371089071035385, -0.09820152074098587, -0.030958715826272964, 0.062220845371484756, -0.06860682368278503, 0.12037840485572815, -0.046459171921014786, -0.05514921620488167, 0.07347679883241653, 0.03191240876913071, -0.03871900960803032, -0.04486507922410965, -0.05013792961835861, 0.03383680433034897, 0.03872893750667572, 0.0342608205974102, -0.003371130907908082, 0.03411995247006416, -0.058396581560373306, 0.02483096718788147, 0.020662834867835045, -0.032698601484298706, -0.003553991438820958, 0.027589110657572746, 0.0018527040956541896, -0.01999485492706299, 0.014550619758665562, -0.06832081824541092, 0.025528257712721825, -0.004981080070137978, 0.0411040335893631, 0.09083602577447891, 0.0427330918610096, 0.008235192857682705, -0.010577257722616196, 0.09608569741249084, 0.09243854880332947, 0.01952587254345417, 0.04109612852334976, 0.08946222811937332, 0.11177302896976471, 0.026977594941854477, -0.02101673185825348, 0.036502327769994736, 0.03633040189743042, -0.022928858175873756, 0.09202917665243149, 9.011774993655445e-34, 0.05529119819402695, -0.011466871947050095, -0.0289036612957716, 0.021601803600788116, 0.07999619841575623, -0.009527260437607765, 0.06655179709196091, 0.06704159826040268, -0.055855024605989456, 0.043295640498399734, -0.015249148942530155, 0.038326457142829895, 0.00397613225504756, -0.054885052144527435, 0.017148738726973534, 0.09410101920366287, 0.028920160606503487, 0.008599106222391129, 0.04736485704779625, 0.02011616714298725, 0.053332261741161346, -0.15793712437152863, -0.05095908045768738, 0.020989594981074333, 0.04183366522192955, 0.04110484942793846, -0.07439504563808441, 0.05382669344544411, -0.005421552807092667, 0.02070392668247223, 0.03309212252497673, 0.08026842027902603, -0.007022577337920666, 0.05759388208389282, 0.024031976237893105, -0.06661837548017502, -0.0036896090023219585, 0.031817223876714706, -0.09653715044260025, 0.03771011903882027, 0.006250554695725441, -0.02587731182575226, -0.07047633826732635, -0.03431830555200577, -0.001217592740431428, -0.05223409831523895, -0.0784493237733841, -0.05632290244102478, 0.08103206753730774, -0.0023330070544034243, -0.05259932950139046, 0.0058615249581635, 0.008657746016979218, 0.026627101004123688, 0.03535408526659012, 0.028667394071817398, 0.01907835528254509, -0.022531986236572266, -0.06107184663414955, 0.018294235691428185, -0.008514387533068657, 0.045363713055849075, -0.034482065588235855, 0.06944511085748672, 0.041398946195840836, 0.011469303630292416, -0.020489085465669632, 0.03433454781770706, 0.0013375950511544943, -0.004922966472804546, -0.10722944140434265, 0.018118372187018394, -0.025332482531666756, 0.008306360803544521, -0.04125412926077843, 0.00008170966611942276, -0.0804813876748085, 0.03233383223414421, 0.06276454776525497, -0.022304555401206017, 0.0614415779709816, -0.012296153232455254, -0.0008324089576490223, 0.04617602750658989, 0.004382763523608446, -0.02284741774201393, -0.04766350984573364, 0.015405043959617615, -0.004300781991332769, 0.04776812717318535, 0.04594395309686661, 0.020460685715079308, 0.05183619633316994, -0.08099697530269623, -0.12963660061359406, -4.651878201399089e-33, -0.09088557213544846, -0.015186713077127934, -0.09022627770900726, 0.03634880483150482, -0.0911700651049614, -0.03585020825266838, 0.030742214992642403, -0.030339421704411507, 0.05743246525526047, 0.013772197999060154, 0.02393938973546028, 0.051527708768844604, 0.007351967506110668, -0.0020538822282105684, -0.03594275936484337, 0.07202623039484024, -0.11253253370523453, -0.055692438036203384, 0.0008634236874058843, -0.0005427187425084412, 0.02055014856159687, 0.017941033467650414, 0.09371758997440338, -0.0050566475838422775, -0.13515914976596832, -0.029505683109164238, 0.04868609830737114, -0.03173316270112991, -0.07283076643943787, -0.07262258231639862, 0.0017130998894572258, 0.062413137406110764, 0.004495815373957157, 0.09321479499340057, 0.004606897942721844, -0.03189738094806671, 0.026910074055194855, 0.08767654746770859, 0.06320856511592865, -0.016941802576184273, 0.07338394224643707, 0.06031933054327965, 0.012547742575407028, 0.06305328756570816, -0.060415975749492645, 0.05267677828669548, -0.013376014307141304, 0.0044116610661149025, -0.027480071410536766, 0.009353721514344215, -0.0529622957110405, 0.0009807333117350936, 0.08633015304803848, 0.03445243090391159, -0.08976572751998901, 0.0021651042625308037, 0.020449457690119743, -0.0027469091583043337, -0.028404993936419487, 0.14176438748836517, 0.1002194806933403, -0.0748259648680687, -0.10197684913873672, 0.022462915629148483, -0.024643540382385254, -0.042197294533252716, -0.07827189564704895, 0.06493829190731049, 0.13402877748012543, -0.06573021411895752, 0.027292339131236076, -0.0369865819811821, 0.01234433613717556, -0.0202693622559309, -0.03459068387746811, -0.019962061196565628, 0.011683769524097443, -0.1195649802684784, 0.0011690343962982297, 0.0702400878071785, -0.05486418306827545, 0.07041891664266586, -0.07951667159795761, -0.07752358168363571, 0.011851117014884949, -0.013201547786593437, -0.0352700911462307, 0.08789733052253723, 0.05738770589232445, 0.011330622248351574, -0.03209775686264038, 0.03544628247618675, -0.10365374386310577, -0.05891730263829231, -0.0011481560068205, -4.841264811261681e-8, 0.0030234374571591616, 0.015495584346354008, -0.0883147120475769, 0.001497190329246223, -0.009877979755401611, -0.04861694574356079, -0.04157606139779091, -0.013201658613979816, -0.010150233283638954, 0.03392501547932625, -0.020610932260751724, 0.02994782105088234, -0.02821016125380993, -0.02962411940097809, 0.05402740091085434, -0.03692543879151344, 0.0027941830921918154, 0.005596244242042303, -0.04269418492913246, -0.030592693015933037, 0.014923343434929848, -0.02015981450676918, -0.0056572165340185165, 0.036340076476335526, -0.05146981403231621, -0.07819891721010208, 0.03248682618141174, 0.019673045724630356, -0.03596656024456024, 0.033210981637239456, -0.07657432556152344, 0.06656793504953384, 0.02262238599359989, 0.0545647069811821, -0.07091479748487473, 0.05433238670229912, -0.0808085948228836, -0.03337312862277031, 0.07291757315397263, -0.009650916792452335, 0.03257742151618004, -0.017870912328362465, -0.07659552246332169, -0.023282792419195175, -0.06546904891729355, 0.017295587807893753, 0.05512849614024162, 0.003714381717145443, 0.11146782338619232, 0.032765086740255356, -0.023077577352523804, -0.051594700664281845, 0.036460187286138535, 0.028101816773414612, 0.03029349446296692, 0.05771651864051819, -0.03409970924258232, -0.08070125430822372, -0.003181526670232415, 0.02031359262764454, 0.029172109439969063, 0.053243670612573624, 0.035614971071481705, -0.016251258552074432 ]
0.109834
context flow may differ. However, if a difference in flow is found please report it. ### `--no-deprecation` Silence deprecation warnings. ### `--no-experimental-detect-module` Disable using [syntax detection][] to determine module type. ### `--no-experimental-global-navigator` > Stability: 1 - Experimental Disable exposition of [Navigator API][] on the global scope. ### `--no-experimental-repl-await` Use this flag to disable top-level await in REPL. ### `--no-experimental-require-module` > Stability: 3 - Legacy: Use [`--no-require-module`][] instead. Legacy alias for [`--no-require-module`][]. ### `--no-experimental-sqlite` Disable the experimental [`node:sqlite`][] module. ### `--no-experimental-websocket` Disable exposition of {WebSocket} on the global scope. ### `--no-experimental-webstorage` > Stability: 1.2 - Release candidate. Disable [`Web Storage`][] support. ### `--no-extra-info-on-fatal-exception` Hide extra information on fatal exception that causes exit. ### `--no-force-async-hooks-checks` Disables runtime checks for `async\_hooks`. These will still be enabled dynamically when `async\_hooks` is enabled. ### `--no-global-search-paths` Do not search modules from global paths like `$HOME/.node\_modules` and `$NODE\_PATH`. ### `--no-network-family-autoselection` Disables the family autoselection algorithm unless connection options explicitly enables it. ### `--no-require-module` Disable support for loading a synchronous ES module graph in `require()`. See [Loading ECMAScript modules using `require()`][]. ### `--no-strip-types` Disable type-stripping for TypeScript files. For more information, see the [TypeScript type-stripping][] documentation. ### `--no-warnings` Silence all process warnings (including deprecations). ### `--node-memory-debug` Enable extra debug checks for memory leaks in Node.js internals. This is usually only useful for developers debugging Node.js itself. ### `--openssl-config=file` Load an OpenSSL configuration file on startup. Among other uses, this can be used to enable FIPS-compliant crypto if Node.js is built against FIPS-enabled OpenSSL. ### `--openssl-legacy-provider` Enable OpenSSL 3.0 legacy provider. For more information please see [OSSL\\_PROVIDER-legacy][OSSL\_PROVIDER-legacy]. ### `--openssl-shared-config` Enable OpenSSL default configuration section, `openssl\_conf` to be read from the OpenSSL configuration file. The default configuration file is named `openssl.cnf` but this can be changed using the environment variable `OPENSSL\_CONF`, or by using the command line option `--openssl-config`. The location of the default OpenSSL configuration file depends on how OpenSSL is being linked to Node.js. Sharing the OpenSSL configuration may have unwanted implications and it is recommended to use a configuration section specific to Node.js which is `nodejs\_conf` and is default when this option is not used. ### `--pending-deprecation` Emit pending deprecation warnings. Pending deprecations are generally identical to a runtime deprecation with the notable exception that they are turned \_off\_ by default and will not be emitted unless either the `--pending-deprecation` command-line flag, or the `NODE\_PENDING\_DEPRECATION=1` environment variable, is set. Pending deprecations are used to provide a kind of selective "early warning" mechanism that developers may leverage to detect deprecated API usage. ### `--permission` Enable the Permission Model for current process. When enabled, the following permissions are restricted: \* File System - manageable through [`--allow-fs-read`][], [`--allow-fs-write`][] flags \* Network - manageable through [`--allow-net`][] flag \* Child Process - manageable through [`--allow-child-process`][] flag \* Worker Threads - manageable through [`--allow-worker`][] flag \* WASI - manageable through [`--allow-wasi`][] flag \* Addons - manageable through [`--allow-addons`][] flag ### `--preserve-symlinks` Instructs the module loader to preserve symbolic links when resolving and caching modules. By default, when Node.js loads a module from a path that is symbolically linked to a different on-disk location, Node.js will dereference the link and use the actual on-disk "real path" of the module as both an identifier and as a root path to locate other dependency modules. In most cases, this default behavior is acceptable. However, when using symbolically linked peer dependencies, as illustrated in the example below, the default behavior causes an exception to be thrown if `moduleA` attempts to require `moduleB` as a peer dependency: ```text {appDir} ├── app │ ├── index.js │ └── node\_modules │ ├── moduleA -> {appDir}/moduleA │ └── moduleB │ ├── index.js
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.06886866688728333, -0.021275635808706284, -0.031676169484853745, 0.0310799740254879, 0.08580896258354187, -0.09220320731401443, -0.013526036404073238, -0.033072274178266525, -0.056200865656137466, -0.04899083450436592, 0.015402408316731453, -0.061025965958833694, -0.00020789624250028282, 0.01644059084355831, 0.044560402631759644, 0.06134704872965813, 0.07509153336286545, -0.014888940379023552, 0.022193366661667824, -0.0025811069644987583, -0.011794151738286018, 0.010333072394132614, 0.05060179904103279, 0.02103010006248951, -0.05017350614070892, -0.009004793129861355, -0.10045218467712402, -0.0014347441028803587, 0.04950965940952301, -0.01042301394045353, 0.06284689158201218, 0.11904006451368332, -0.0784100666642189, 0.01819716952741146, 0.02171412669122219, 0.04849968105554581, -0.029534103348851204, -0.02915419079363346, -0.061597585678100586, 0.009620207361876965, 0.0420420877635479, 0.04603626951575279, -0.09617684781551361, -0.002423482248559594, -0.03987837955355644, -0.1473737508058548, -0.03899291157722473, -0.056214746087789536, -0.09293516725301743, 0.031192069873213768, -0.04403046891093254, -0.051774680614471436, -0.046612877398729324, -0.053321804851293564, 0.025068409740924835, 0.007619756273925304, 0.03835288807749748, 0.06855156272649765, 0.03221855312585831, 0.04999030381441116, 0.026794379577040672, -0.05027250945568085, -0.044104691594839096, -0.04083592817187309, -0.03626197576522827, 0.05126219987869263, -0.006138004828244448, -0.014058073051273823, 0.15785250067710876, 0.004991468507796526, -0.04096292704343796, -0.01724117062985897, -0.020760048180818558, -0.020415520295500755, -0.0037248036824166775, -0.037097327411174774, 0.031120941042900085, 0.00973200798034668, -0.023290438577532768, -0.0856454074382782, -0.0013944586971774697, -0.06198354437947273, -0.03389540687203407, 0.005682365037500858, -0.0030776429921388626, 0.053778428584337234, 0.04524637386202812, -0.024113750085234642, 0.05859699100255966, 0.035771697759628296, -0.002097473945468664, -0.06263062357902527, -0.011731934733688831, 0.0723414272069931, 0.06085846573114395, -0.002656901255249977, -0.029728015884757042, -0.013430592603981495, -0.05192555859684944, 0.0625801831483841, 0.008060663007199764, -0.037759698927402496, -0.021178502589464188, 0.06373053044080734, -0.04862809553742409, -0.015051266178488731, 0.05036459118127823, 0.026661712676286697, -0.025788404047489166, 0.0013099892530590296, -0.01053061243146658, 0.05542733520269394, 0.08799023926258087, -0.01736265979707241, -0.08884021639823914, 0.058280978351831436, -0.0066714114509522915, -0.0023172677028924227, 0.06120826676487923, 0.152386873960495, 0.1091538742184639, 0.046396754682064056, 0.030186044052243233, -0.08989118039608002, 0.035281311720609665, 0.01238255575299263, 0.00793337170034647, 3.313514332824573e-33, 0.03363538905978203, -0.034924253821372986, -0.0609426312148571, 0.08509993553161621, 0.08860127627849579, 0.04249012842774391, 0.10150045156478882, 0.010999982245266438, -0.06413915753364563, -0.04000880941748619, 0.05753052979707718, 0.011647295206785202, -0.12915216386318207, -0.00669139763340354, 0.031804729253053665, -0.04715763404965401, 0.036542829126119614, -0.028376350179314613, 0.061041127890348434, 0.04440111666917801, 0.041572440415620804, -0.04730222374200821, -0.07575614005327225, -0.08729517459869385, 0.05350445210933685, 0.026222633197903633, -0.011566276662051678, 0.06963671743869781, -0.057354629039764404, 0.07000647485256195, -0.02733985334634781, 0.0023283178452402353, -0.022098010405898094, 0.08445543050765991, -0.004490291699767113, -0.06652386486530304, -0.0604083389043808, -0.003961976617574692, -0.049952659755945206, -0.026517407968640327, -0.06785454601049423, 0.07435593008995056, -0.09979376941919327, -0.012476027011871338, -0.0009426139877177775, -0.14260928332805634, -0.009073489345610142, 0.000019568888092180714, 0.09081023931503296, -0.015218024142086506, 0.0022276383824646473, 0.04587463662028313, 0.032057423144578934, -0.06300244480371475, 0.03327770158648491, -0.0700719952583313, 0.014225998893380165, 0.057584650814533234, -0.015992021188139915, -0.002472326159477234, -0.029055846855044365, -0.03218787908554077, -0.08160088211297989, 0.017421459779143333, 0.10434627532958984, 0.10692738741636276, -0.12151867151260376, -0.05169409513473511, -0.00936983898282051, -0.0068518551997840405, -0.0704977810382843, 0.040582917630672455, -0.03243451192975044, 0.057634953409433365, -0.018670441582798958, -0.06458503752946854, 0.007122201845049858, 0.06983181834220886, 0.005465792957693338, -0.024223387241363525, -0.006787048187106848, 0.06257375329732895, -0.04912639781832695, 0.09388696402311325, 0.0017797835171222687, -0.031549107283353806, -0.01954442448914051, -0.02005208656191826, 0.007037567440420389, 0.018423520028591156, 0.04012751951813698, -0.009414664469659328, 0.04766497761011124, -0.06830286979675293, -0.03762305527925491, -3.530434917537533e-33, -0.031171850860118866, 0.028712937608361244, -0.030494146049022675, 0.10523100197315216, -0.017644338309764862, -0.03295322135090828, 0.047505933791399, -0.017416201531887054, 0.017624398693442345, 0.021618789061903954, 0.04476514458656311, 0.04618021845817566, -0.003778208512812853, 0.0056834411807358265, 0.0018172492273151875, 0.07637246698141098, -0.04214480519294739, -0.13217775523662567, 0.054968465119600296, -0.0019022098276764154, 0.04274849593639374, 0.09888520836830139, -0.08386001735925674, -0.002641387516632676, -0.021754100918769836, -0.0193569865077734, -0.02531350404024124, -0.013813577592372894, 0.02710263431072235, -0.044576261192560196, 0.055588725954294205, 0.06732040643692017, -0.041456080973148346, -0.0171889029443264, 0.021983694285154343, -0.0008589977514930069, -0.012195500545203686, 0.07459789514541626, -0.04588272422552109, -0.01612423174083233, 0.08837234228849411, 0.011135700158774853, -0.024288978427648544, -0.013850701041519642, 0.024992303922772408, 0.04065124690532684, 0.050276804715394974, -0.05464477837085724, -0.011135517619550228, -0.01966627687215805, 0.0009335653739981353, -0.00020590954227373004, -0.038815680891275406, -0.028408469632267952, -0.016372960060834885, -0.03857335448265076, 0.08990740776062012, -0.017695089802145958, -0.03796838968992233, -0.031702056527137756, 0.116762675344944, -0.03865225613117218, -0.0011144529562443495, -0.04293912649154663, 0.023211602121591568, -0.034718651324510574, -0.09076739847660065, 0.08749362081289291, 0.09347789734601974, -0.022701239213347435, 0.036769479513168335, 0.009361987002193928, -0.06431910395622253, -0.028008926659822464, 0.03545789420604706, 0.05270732566714287, -0.01491603534668684, -0.03242458775639534, 0.04613613709807396, 0.056898605078458786, -0.09299119561910629, 0.11038991063833237, -0.004292656201869249, -0.05127505585551262, 0.0657741129398346, 0.03140391409397125, -0.07479113340377808, 0.0825934037566185, 0.0012280875816941261, 0.046641357243061066, 0.0003829981724265963, -0.06626495718955994, -0.06735967099666595, 0.052299633622169495, 0.018938222900032997, -5.598829844188913e-8, -0.02921234257519245, -0.03753339499235153, -0.0848420187830925, 0.0058169434778392315, 0.04033789411187172, 0.028417740017175674, -0.009130855090916157, 0.004505530931055546, 0.03715360909700394, 0.019867844879627228, -0.02262120507657528, 0.0470617450773716, -0.0028506761882454157, 0.009679125621914864, 0.020501239225268364, 0.03255201503634453, 0.004821465350687504, 0.0652952715754509, -0.06458444148302078, -0.06807588785886765, 0.005454579368233681, 0.06374877691268921, -0.04967967048287392, 0.0002578199782874435, -0.058927811682224274, -0.04794473946094513, 0.10957624763250351, 0.07937507331371307, 0.00865932460874319, -0.05911533907055855, -0.04821876809000969, -0.008650842122733593, -0.04824772849678993, -0.06308042258024216, -0.04375304654240608, 0.05718494579195976, 0.025332804769277573, -0.0031320336274802685, 0.06980780512094498, 0.03336739540100098, 0.019536085426807404, -0.04793880507349968, -0.05290824547410011, 0.019959760829806328, -0.04261947050690651, 0.018956750631332397, -0.014755476266145706, -0.00975557416677475, -0.038171134889125824, 0.00028307264437898993, 0.03647905960679054, -0.00997188687324524, -0.0474495105445385, 0.060839273035526276, 0.03549034520983696, 0.07606788724660873, 0.0319330133497715, -0.07740631699562073, -0.038499750196933746, -0.03677447885274887, 0.06365634500980377, -0.006324253510683775, 0.07070606201887131, -0.05535929277539253 ]
0.08286
symbolically linked peer dependencies, as illustrated in the example below, the default behavior causes an exception to be thrown if `moduleA` attempts to require `moduleB` as a peer dependency: ```text {appDir} ├── app │ ├── index.js │ └── node\_modules │ ├── moduleA -> {appDir}/moduleA │ └── moduleB │ ├── index.js │ └── package.json └── moduleA ├── index.js └── package.json ``` The `--preserve-symlinks` command-line flag instructs Node.js to use the symlink path for modules as opposed to the real path, allowing symbolically linked peer dependencies to be found. Note, however, that using `--preserve-symlinks` can have other side effects. Specifically, symbolically linked \_native\_ modules can fail to load if those are linked from more than one location in the dependency tree (Node.js would see those as two separate modules and would attempt to load the module multiple times, causing an exception to be thrown). The `--preserve-symlinks` flag does not apply to the main module, which allows `node --preserve-symlinks node\_module/.bin/` to work. To apply the same behavior for the main module, also use `--preserve-symlinks-main`. ### `--preserve-symlinks-main` Instructs the module loader to preserve symbolic links when resolving and caching the main module (`require.main`). This flag exists so that the main module can be opted-in to the same behavior that `--preserve-symlinks` gives to all other imports; they are separate flags, however, for backward compatibility with older Node.js versions. `--preserve-symlinks-main` does not imply `--preserve-symlinks`; use `--preserve-symlinks-main` in addition to `--preserve-symlinks` when it is not desirable to follow symlinks before resolving relative paths. See [`--preserve-symlinks`][] for more information. ### `-p`, `--print "script"` Identical to `-e` but prints the result. ### `--prof` Generate V8 profiler output. ### `--prof-process` Process V8 profiler output generated using the V8 option `--prof`. ### `--redirect-warnings=file` Write process warnings to the given file instead of printing to stderr. The file will be created if it does not exist, and will be appended to if it does. If an error occurs while attempting to write the warning to the file, the warning will be written to stderr instead. The `file` name may be an absolute path. If it is not, the default directory it will be written to is controlled by the [`--diagnostic-dir`][] command-line option. ### `--report-compact` Write reports in a compact format, single-line JSON, more easily consumable by log processing systems than the default multi-line format designed for human consumption. ### `--report-dir=directory`, `--report-directory=directory` Location at which the report will be generated. ### `--report-exclude-env` When `--report-exclude-env` is passed the diagnostic report generated will not contain the `environmentVariables` data. ### `--report-exclude-network` Exclude `header.networkInterfaces` from the diagnostic report. By default this is not set and the network interfaces are included. ### `--report-filename=filename` Name of the file to which the report will be written. If the filename is set to `'stdout'` or `'stderr'`, the report is written to the stdout or stderr of the process respectively. ### `--report-on-fatalerror` Enables the report to be triggered on fatal errors (internal errors within the Node.js runtime such as out of memory) that lead to termination of the application. Useful to inspect various diagnostic data elements such as heap, stack, event loop state, resource consumption etc. to reason about the fatal error. ### `--report-on-signal` Enables report to be generated upon receiving the specified (or predefined) signal to the running Node.js process. The signal to trigger the report is specified through `--report-signal`. ### `--report-signal=signal` Sets or resets the signal for report generation (not supported on Windows). Default signal is `SIGUSR2`. ### `--report-uncaught-exception` Enables report to be generated when the process exits due to an uncaught exception. Useful when inspecting the JavaScript stack in conjunction with native stack and other runtime environment data. ###
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.06348460912704468, -0.06615040451288223, 0.03798411041498184, 0.014842653647065163, 0.11375734955072403, -0.016611212864518166, -0.03783433884382248, -0.010153009556233883, -0.0035379233304411173, 0.00953387375921011, 0.10230279713869095, 0.045232534408569336, 0.004923170432448387, 0.05460140481591225, 0.08628326654434204, 0.11358735710382462, 0.03621537238359451, 0.04844672232866287, 0.01057459320873022, 0.07259301841259003, 0.004225373268127441, -0.023059973493218422, 0.010086235590279102, 0.0020850745495408773, 0.00030113861430436373, -0.086504265666008, -0.009462361223995686, 0.004430880304425955, 0.02923773042857647, -0.00824642926454544, 0.010172608308494091, 0.07010367512702942, -0.1823360174894333, -0.017231151461601257, 0.042925864458084106, 0.14271411299705505, -0.0027714292518794537, -0.116335429251194, 0.003921181429177523, -0.07123057544231415, 0.07608909159898758, 0.0953206941485405, -0.043688736855983734, -0.06997677683830261, -0.07920994609594345, -0.08947739005088806, -0.02425110712647438, 0.006549956277012825, -0.08275403827428818, -0.0362127423286438, 0.0042464472353458405, -0.028174331411719322, -0.002680427161976695, -0.032587748020887375, 0.023878002539277077, 0.07689914852380753, -0.0317683070898056, 0.03723916783928871, -0.0070188166573643684, 0.13243645429611206, 0.04410216957330704, 0.03462408855557442, 0.0000379772245651111, -0.09329488128423691, 0.04090952128171921, 0.01493125967681408, 0.0014875998022034764, -0.00894749816507101, 0.02977505885064602, 0.05540500208735466, 0.012018730863928795, -0.004717295523732901, -0.013376626186072826, 0.03698950260877609, -0.0712711438536644, -0.037957563996315, 0.0008256154251284897, 0.06942287087440491, -0.06517338007688522, -0.07118412107229233, -0.03599682077765465, 0.012830312363803387, 0.03075491450726986, 0.029463179409503937, -0.029586423188447952, -0.00002206695899076294, 0.006895497906953096, 0.012842755764722824, 0.0604841411113739, 0.0552578829228878, -0.00675472104921937, -0.1064581647515297, 0.08518943935632706, 0.003521507605910301, 0.10358744114637375, -0.04248721897602081, 0.010283524170517921, 0.05909959599375725, -0.014776927419006824, -0.0019332395168021321, 0.02697157859802246, 0.0007259075646288693, 0.03447677940130234, 0.01742168888449669, 0.024184996262192726, -0.0007082420052029192, -0.08327043801546097, -0.06769946962594986, -0.0024449911434203386, 0.006446202285587788, -0.0010678364196792245, 0.033799909055233, 0.014807619154453278, -0.07843699306249619, -0.07712104171514511, -0.03463303670287132, 0.06191542372107506, 0.011229795403778553, 0.04688004404306412, 0.032358743250370026, 0.0008086720481514931, 0.025824999436736107, 0.11102936416864395, -0.028653588145971298, 0.06106092780828476, -0.042612090706825256, -0.0707240104675293, 4.291352981975939e-33, 0.044069163501262665, -0.03390079736709595, 0.0023790698032826185, 0.012495790608227253, 0.04702165350317955, -0.0360262468457222, 0.03811560198664665, 0.028578663244843483, -0.07177039980888367, -0.0344519205391407, -0.07758783549070358, 0.02270195633172989, -0.04113732650876045, -0.008520727045834064, -0.004747686441987753, -0.00990174151957035, 0.009523647837340832, -0.03493271768093109, 0.03672449663281441, 0.04954998195171356, -0.022411316633224487, 0.006280145142227411, 0.02667427435517311, 0.03557765856385231, -0.017153218388557434, -0.004111177753657103, 0.047695644199848175, -0.04513760283589363, 0.06617892533540726, 0.006913875695317984, -0.004385342821478844, 0.05699511989951134, 0.04855451360344887, 0.03360123932361603, 0.02052905783057213, 0.020921465009450912, -0.051030442118644714, -0.0231598112732172, -0.10842056572437286, -0.008711088448762894, 0.048941370099782944, 0.09450369328260422, -0.026684371754527092, 0.03549730032682419, 0.043253157287836075, -0.05558208003640175, -0.03334520757198334, -0.05070825666189194, -0.021623412147164345, -0.08125454187393188, -0.0021584085188806057, 0.02613494172692299, 0.07801826298236847, 0.008455195464193821, 0.00909509602934122, -0.06674262881278992, -0.023546166718006134, -0.025544213131070137, 0.010633692145347595, -0.0401109904050827, 0.04571465030312538, -0.07350628077983856, -0.02226852998137474, 0.06376589834690094, 0.0005468133604153991, 0.09811385720968246, -0.03137682378292084, -0.03610798716545105, -0.02329470030963421, 0.026711586862802505, -0.05351180583238602, 0.04742283374071121, -0.02668284811079502, 0.0019476860761642456, -0.04789181053638458, -0.03769642859697342, -0.08657000958919525, -0.062461864203214645, 0.04833294823765755, -0.04487747326493263, -0.046585436910390854, -0.06368377804756165, 0.021405527368187904, 0.025684859603643417, 0.011462773196399212, -0.06504806131124496, -0.04631833732128143, -0.06072501093149185, -0.028797704726457596, -0.06527694314718246, 0.08286333084106445, -0.023600038141012192, -0.03420928493142128, -0.031257253140211105, -0.009614330716431141, -7.53026089240573e-33, 0.03985720872879028, 0.012705122120678425, 0.046601541340351105, 0.04304656758904457, -0.029014797881245613, -0.049908317625522614, -0.051574479788541794, -0.07007575780153275, 0.03415681794285774, 0.0367937795817852, -0.10341782867908478, 0.03056865744292736, 0.05969493091106415, 0.022936420515179634, 0.007226311601698399, 0.09816019982099533, -0.0659538209438324, -0.027070757001638412, 0.04571801424026489, -0.00995678175240755, 0.020098719745874405, 0.06374749541282654, 0.05727928504347801, -0.0022728017065674067, 0.01639464870095253, -0.05646362155675888, -0.057664886116981506, -0.06098286807537079, -0.06108695641160011, -0.031680576503276825, 0.043269552290439606, 0.045969054102897644, -0.03486056625843048, -0.10895787179470062, -0.04748114198446274, 0.0411219447851181, -0.11287659406661987, 0.006058161612600088, -0.027200208976864815, -0.07768198847770691, 0.005651222076267004, -0.011874314397573471, -0.04263315722346306, -0.03847074881196022, -0.01016889326274395, -0.07789039611816406, -0.06834544986486435, 0.01152139250189066, -0.025331513956189156, -0.06304258853197098, -0.03924902528524399, 0.02810584008693695, 0.04744236171245575, -0.027146855369210243, -0.0023889276199042797, 0.007716787979006767, -0.019079891964793205, 0.10558708757162094, 0.02280322276055813, 0.02331703156232834, 0.09093103557825089, -0.09235458821058273, -0.03453192114830017, -0.0323963388800621, -0.07451673597097397, -0.05488831549882889, -0.022935936227440834, -0.03891325742006302, 0.0813945084810257, 0.021874090656638145, 0.015695128589868546, 0.09184623509645462, -0.040615398436784744, 0.02208414115011692, -0.05498845502734184, 0.057165149599313736, -0.009683128446340561, 0.015210210345685482, 0.014228618703782558, -0.019981559365987778, -0.08813424408435822, 0.05028839036822319, -0.0031472521368414164, 0.01436082273721695, 0.031110191717743874, -0.06874457001686096, 0.06615682691335678, 0.020941702648997307, 0.008028426207602024, 0.01145234052091837, 0.053878795355558395, -0.021085279062390327, -0.013053566217422485, 0.01789298839867115, -0.04191441088914871, -5.481399156792577e-8, 0.017435811460018158, 0.018923945724964142, -0.1893998682498932, -0.007534131407737732, 0.028588280081748962, -0.041906677186489105, 0.05997024103999138, 0.12993299961090088, 0.04855123907327652, 0.039818573743104935, -0.020783711224794388, 0.0806565135717392, -0.09305014461278915, 0.039337530732154846, -0.0445924736559391, 0.046177491545677185, -0.0176808200776577, 0.04436347261071205, -0.03280084580183029, 0.018253520131111145, -0.03671596944332123, 0.019966835156083107, -0.03393154591321945, 0.1308249533176422, -0.04364464432001114, -0.03213177248835564, 0.047528479248285294, 0.08470704406499863, 0.013182762078940868, -0.005820147227495909, -0.029449861496686935, -0.008211728185415268, -0.07988999038934708, -0.015045966021716595, -0.045474573969841, 0.039786022156476974, -0.014341367408633232, -0.013648848049342632, 0.08669749647378922, 0.045664481818675995, 0.01682003028690815, -0.030555276200175285, -0.0007081340881995857, 0.03170653432607651, 0.0353386215865612, -0.021314242854714394, -0.05807482823729515, 0.041329577565193176, -0.06081358343362808, 0.010703650303184986, 0.04941688850522041, 0.0413004532456398, -0.13034862279891968, -0.024248477071523666, 0.029857531189918518, 0.012043481692671776, -0.028431572020053864, 0.04959704354405403, -0.013334300369024277, -0.07027728110551834, 0.029304198920726776, -0.010495572350919247, 0.06782060116529465, -0.0810110941529274 ]
-0.02738
`--report-signal=signal` Sets or resets the signal for report generation (not supported on Windows). Default signal is `SIGUSR2`. ### `--report-uncaught-exception` Enables report to be generated when the process exits due to an uncaught exception. Useful when inspecting the JavaScript stack in conjunction with native stack and other runtime environment data. ### `-r`, `--require module` Preload the specified module at startup. Follows `require()`'s module resolution rules. `module` may be either a path to a file, or a node module name. Modules preloaded with `--require` will run before modules preloaded with `--import`. Modules are preloaded into the main thread as well as any worker threads, forked processes, or clustered processes. ### `--run` This runs a specified command from a package.json's `"scripts"` object. If a missing `"command"` is provided, it will list the available scripts. `--run` will traverse up to the root directory and finds a `package.json` file to run the command from. `--run` prepends `./node\_modules/.bin` for each ancestor of the current directory, to the `PATH` in order to execute the binaries from different folders where multiple `node\_modules` directories are present, if `ancestor-folder/node\_modules/.bin` is a directory. `--run` executes the command in the directory containing the related `package.json`. For example, the following command will run the `test` script of the `package.json` in the current folder: ```console $ node --run test ``` You can also pass arguments to the command. Any argument after `--` will be appended to the script: ```console $ node --run test -- --verbose ``` #### Intentional limitations `node --run` is not meant to match the behaviors of `npm run` or of the `run` commands of other package managers. The Node.js implementation is intentionally more limited, in order to focus on top performance for the most common use cases. Some features of other `run` implementations that are intentionally excluded are: \* Running `pre` or `post` scripts in addition to the specified script. \* Defining package manager-specific environment variables. #### Environment variables The following environment variables are set when running a script with `--run`: \* `NODE\_RUN\_SCRIPT\_NAME`: The name of the script being run. For example, if `--run` is used to run `test`, the value of this variable will be `test`. \* `NODE\_RUN\_PACKAGE\_JSON\_PATH`: The path to the `package.json` that is being processed. ### `--secure-heap-min=n` When using `--secure-heap`, the `--secure-heap-min` flag specifies the minimum allocation from the secure heap. The minimum value is `2`. The maximum value is the lesser of `--secure-heap` or `2147483647`. The value given must be a power of two. ### `--secure-heap=n` Initializes an OpenSSL secure heap of `n` bytes. When initialized, the secure heap is used for selected types of allocations within OpenSSL during key generation and other operations. This is useful, for instance, to prevent sensitive information from leaking due to pointer overruns or underruns. The secure heap is a fixed size and cannot be resized at runtime so, if used, it is important to select a large enough heap to cover all application uses. The heap size given must be a power of two. Any value less than 2 will disable the secure heap. The secure heap is disabled by default. The secure heap is not available on Windows. See [`CRYPTO\_secure\_malloc\_init`][] for more details. ### `--snapshot-blob=path` > Stability: 1 - Experimental When used with `--build-snapshot`, `--snapshot-blob` specifies the path where the generated snapshot blob is written to. If not specified, the generated blob is written to `snapshot.blob` in the current working directory. When used without `--build-snapshot`, `--snapshot-blob` specifies the path to the blob that is used to restore the application state. When loading a snapshot, Node.js checks that: 1. The version, architecture, and platform of the running Node.js binary are
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.07987790554761887, -0.04558609426021576, -0.07359546422958374, 0.06861962378025055, 0.03509029746055603, -0.0442989207804203, -0.059533439576625824, 0.06491228938102722, -0.04206512123346329, -0.05123322457075119, 0.03508845716714859, 0.026564106345176697, -0.033381782472133636, -0.01396976038813591, 0.08598312735557556, 0.05598016083240509, 0.04109387844800949, -0.08661670237779617, 0.04535220190882683, -0.09461423754692078, 0.047587405890226364, 0.007104671560227871, 0.02538481168448925, -0.024080077186226845, -0.03207593411207199, -0.06877096742391586, -0.011611973866820335, 0.031549472361803055, 0.042759284377098083, -0.0144894327968359, 0.0325690321624279, 0.01650605909526348, 0.05290704220533371, 0.034920647740364075, 0.007650153245776892, 0.1377524882555008, 0.025569070130586624, -0.07055860012769699, -0.08624298125505447, -0.04720254987478256, 0.10122925043106079, -0.00922846607863903, -0.061214957386255264, -0.027649400755763054, -0.0804622694849968, -0.059911638498306274, -0.13442212343215942, -0.02980494126677513, -0.12275109440088272, -0.0212632417678833, -0.05142711475491524, -0.0007377162110060453, 0.006289404816925526, 0.008776466362178326, 0.005189375951886177, 0.02153291366994381, -0.045221734791994095, 0.001412840560078621, 0.003041093470528722, 0.02562800794839859, -0.029265213757753372, -0.010473815724253654, -0.02379734441637993, 0.0021662507206201553, 0.011913465335965157, 0.06070695072412491, 0.02716965414583683, -0.05059501528739929, 0.11065133661031723, 0.0010156239150092006, -0.09849648177623749, -0.04399646818637848, -0.08111349493265152, 0.010253474116325378, -0.037283122539520264, -0.051368363201618195, -0.013757879845798016, 0.03777826577425003, -0.021697411313652992, -0.0906451866030693, -0.07630173116922379, -0.01511109247803688, -0.06272625178098679, 0.01044186856597662, 0.022713420912623405, 0.1063687652349472, 0.025663122534751892, 0.005021720193326473, 0.05865003913640976, 0.0009076131973415613, -0.10072596371173859, -0.07999100536108017, -0.05654151365160942, 0.11059053242206573, -0.08520545810461044, 0.027236919850111008, 0.013034258969128132, 0.009391807951033115, 0.006789783947169781, 0.02543996274471283, 0.02805541269481182, 0.01819695346057415, 0.038633815944194794, 0.05323392525315285, -0.07229871302843094, -0.0742478221654892, -0.07885207235813141, 0.05256855487823486, 0.0017532724887132645, 0.032361950725317, 0.07178771495819092, 0.029552556574344635, 0.06441070139408112, -0.06708640605211258, 0.034896496683359146, 0.062408410012722015, 0.03830725699663162, 0.0796237587928772, 0.03613033890724182, 0.08316868543624878, 0.07675053179264069, -0.03613972291350365, -0.03089243918657303, -0.0029635578393936157, 0.08817692846059799, -0.015719756484031677, -0.028822721913456917, 7.663417770060009e-34, 0.041328418999910355, -0.031074989587068558, -0.0010165654821321368, 0.06708426028490067, 0.031903840601444244, 0.03267160803079605, -0.00862487405538559, 0.010111328214406967, -0.06699760258197784, 0.09242725372314453, -0.01717870868742466, 0.031256191432476044, -0.06142575293779373, 0.07371833175420761, 0.033168889582157135, -0.04433717206120491, 0.05034167692065239, -0.01905629225075245, 0.011929960921406746, 0.008443968370556831, 0.042464304715394974, 0.0011144854361191392, -0.050892092287540436, 0.04296809807419777, 0.0813654437661171, 0.08636206388473511, -0.014262381941080093, 0.02553262747824192, -0.03561853617429733, 0.014326820150017738, 0.014704753644764423, 0.03050771914422512, -0.015192145481705666, 0.040854260325431824, 0.03591727465391159, -0.05710544064640999, -0.06401534378528595, 0.022362539544701576, -0.09363463521003723, -0.024806562811136246, 0.04737403243780136, 0.07650671899318695, -0.08574414253234863, -0.07863316684961319, 0.013489452190697193, -0.12418866157531738, -0.04949755594134331, 0.026935767382383347, 0.10806857794523239, -0.015810756012797356, 0.022580882534384727, 0.020478630438447, 0.014097526669502258, 0.015998417511582375, 0.025535577908158302, 0.0404532290995121, 0.0004230892227496952, -0.040767744183540344, 0.019519148394465446, 0.02176535688340664, 0.061264518648386, -0.045106951147317886, -0.03393504023551941, 0.0702589675784111, 0.06364474445581436, -0.019890407100319862, -0.02551276981830597, -0.051854126155376434, -0.07557239383459091, 0.10367380082607269, -0.06464362889528275, 0.07892833650112152, -0.026800651103258133, -0.034250859171152115, 0.03555895760655403, -0.02696114219725132, -0.06021682545542717, -0.01091791968792677, -0.02913534641265869, 0.0491107814013958, 0.06043866649270058, -0.02696784771978855, -0.033908795565366745, -0.0222023855894804, 0.03489385545253754, 0.04998447746038437, -0.025669315829873085, -0.019662613049149513, -0.014242783188819885, -0.03731578588485718, 0.030152328312397003, 0.016695240512490273, -0.011516373604536057, -0.014293545857071877, -0.1336212158203125, -5.120525758552857e-33, -0.01618310995399952, 0.06713685393333435, -0.03256809338927269, 0.0474855862557888, -0.07962404936552048, -0.013569139875471592, -0.023121032863855362, -0.04781215265393257, -0.0035836491733789444, 0.04148257523775101, -0.013989490456879139, -0.03310566395521164, 0.012721902690827847, 0.035361431539058685, -0.023523276671767235, 0.07368389517068863, -0.01982714794576168, -0.06886664777994156, -0.002188728889450431, -0.01645013503730297, -0.03567282855510712, 0.05214671418070793, 0.027558719739317894, -0.03594725951552391, -0.05467263609170914, -0.06414353102445602, 0.05610619857907295, 0.06173695996403694, -0.06915576756000519, -0.03691984713077545, 0.026415156200528145, 0.04493503272533417, -0.029329627752304077, -0.011368069797754288, 0.007402004674077034, -0.03198700025677681, 0.06648995727300644, 0.07012348622083664, 0.009637805633246899, 0.009976603090763092, 0.09494071453809738, 0.07805757969617844, -0.009172906167805195, 0.059645380824804306, -0.06769311428070068, -0.027686314657330513, 0.007365390658378601, 0.006897293496876955, -0.1051488071680069, -0.04037388414144516, -0.055497754365205765, -0.021016327664256096, 0.030352048575878143, -0.0020282657351344824, -0.0757049098610878, 0.003931200131773949, 0.023625213652849197, 0.010882910341024399, -0.030577413737773895, -0.010921893641352654, 0.032124970108270645, -0.09844698756933212, -0.059682559221982956, -0.06053166463971138, 0.006753614638000727, -0.019124658778309822, -0.03864884003996849, -0.03734923526644707, 0.10614827275276184, -0.026650942862033844, 0.020602997392416, 0.003832946065813303, -0.013491850346326828, -0.02310427650809288, -0.052244365215301514, 0.004984908737242222, -0.052859678864479065, -0.09153148531913757, -0.017739564180374146, 0.040568672120571136, -0.03890693560242653, -0.026244979351758957, 0.0062708803452551365, -0.039575573056936264, 0.003328995779156685, -0.0017266488866880536, 0.0362657867372036, 0.09603690356016159, 0.0293798316270113, -0.025180747732520103, -0.01253724005073309, 0.08005843311548233, -0.01461156364530325, 0.02063465677201748, 0.033898428082466125, -5.598387176064534e-8, -0.026612022891640663, -0.06473325192928314, -0.13069961965084076, -0.040581393986940384, 0.05309942737221718, 0.02369491010904312, 0.057598672807216644, -0.005469672381877899, -0.020646238699555397, 0.013016793876886368, 0.022018833085894585, 0.010676193982362747, -0.09641680866479874, 0.02122296579182148, 0.03991493955254555, 0.024535072967410088, 0.0038057437632232904, 0.11865077167749405, -0.042001087218523026, -0.047334153205156326, -0.03385607525706291, -0.003744984045624733, 0.022394515573978424, 0.057160884141922, -0.008047292940318584, -0.05970507487654686, 0.10626523941755295, 0.11629605293273926, -0.015907175838947296, -0.018327323719859123, -0.07704088091850281, 0.032021358609199524, 0.0666477382183075, -0.028996175155043602, -0.05372793599963188, 0.044344186782836914, 0.006373541429638863, -0.030970200896263123, 0.11495424062013626, 0.017812710255384445, 0.006392503622919321, 0.10119294375181198, -0.07543520629405975, 0.042091067880392075, -0.0496797151863575, -0.004752442706376314, -0.07850279659032822, -0.0645584911108017, -0.018315700814127922, -0.01242904458194971, 0.009798489511013031, 0.024669768288731575, -0.043192822486162186, 0.040901005268096924, 0.005336659494787455, 0.061433251947164536, -0.017666691914200783, -0.0913471132516861, -0.024737387895584106, -0.01081625372171402, 0.00794482696801424, 0.05145172402262688, 0.04924536496400833, -0.07764766365289688 ]
0.219901
the generated blob is written to `snapshot.blob` in the current working directory. When used without `--build-snapshot`, `--snapshot-blob` specifies the path to the blob that is used to restore the application state. When loading a snapshot, Node.js checks that: 1. The version, architecture, and platform of the running Node.js binary are exactly the same as that of the binary that generates the snapshot. 2. The V8 flags and CPU features are compatible with that of the binary that generates the snapshot. If they don't match, Node.js refuses to load the snapshot and exits with status code 1. ### `--test` Starts the Node.js command line test runner. This flag cannot be combined with `--watch-path`, `--check`, `--eval`, `--interactive`, or the inspector. See the documentation on [running tests from the command line][] for more details. ### `--test-concurrency` The maximum number of test files that the test runner CLI will execute concurrently. If `--test-isolation` is set to `'none'`, this flag is ignored and concurrency is one. Otherwise, concurrency defaults to `os.availableParallelism() - 1`. ### `--test-coverage-branches=threshold` > Stability: 1 - Experimental Require a minimum percent of covered branches. If code coverage does not reach the threshold specified, the process will exit with code `1`. ### `--test-coverage-exclude` > Stability: 1 - Experimental Excludes specific files from code coverage using a glob pattern, which can match both absolute and relative file paths. This option may be specified multiple times to exclude multiple glob patterns. If both `--test-coverage-exclude` and `--test-coverage-include` are provided, files must meet \*\*both\*\* criteria to be included in the coverage report. By default all the matching test files are excluded from the coverage report. Specifying this option will override the default behavior. ### `--test-coverage-functions=threshold` > Stability: 1 - Experimental Require a minimum percent of covered functions. If code coverage does not reach the threshold specified, the process will exit with code `1`. ### `--test-coverage-include` > Stability: 1 - Experimental Includes specific files in code coverage using a glob pattern, which can match both absolute and relative file paths. This option may be specified multiple times to include multiple glob patterns. If both `--test-coverage-exclude` and `--test-coverage-include` are provided, files must meet \*\*both\*\* criteria to be included in the coverage report. ### `--test-coverage-lines=threshold` > Stability: 1 - Experimental Require a minimum percent of covered lines. If code coverage does not reach the threshold specified, the process will exit with code `1`. ### `--test-force-exit` Configures the test runner to exit the process once all known tests have finished executing even if the event loop would otherwise remain active. ### `--test-global-setup=module` > Stability: 1.0 - Early development Specify a module that will be evaluated before all tests are executed and can be used to setup global state or fixtures for tests. See the documentation on [global setup and teardown][] for more details. ### `--test-isolation=mode` Configures the type of test isolation used in the test runner. When `mode` is `'process'`, each test file is run in a separate child process. When `mode` is `'none'`, all test files run in the same process as the test runner. The default isolation mode is `'process'`. This flag is ignored if the `--test` flag is not present. See the [test runner execution model][] section for more information. ### `--test-name-pattern` A regular expression that configures the test runner to only execute tests whose name matches the provided pattern. See the documentation on [filtering tests by name][] for more details. If both `--test-name-pattern` and `--test-skip-pattern` are supplied, tests must satisfy \*\*both\*\* requirements in order to be executed. ### `--test-only` Configures the test runner to only execute top level tests that have the `only` option set. This flag
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.03587837517261505, 0.0013476796448230743, 0.007083067204803228, 0.03046620450913906, 0.09743665158748627, -0.06210750713944435, -0.07929160445928574, -0.008295689709484577, -0.000205046875635162, -0.04346930980682373, -0.05112502723932266, 0.021990833804011345, -0.015509998425841331, -0.05022250488400459, -0.008015003986656666, 0.014654980972409248, 0.027597809210419655, -0.010005597956478596, 0.0000656575066386722, 0.040906500071287155, -0.05869428440928459, -0.014957246370613575, 0.06742265075445175, 0.034834254533052444, 0.03543835133314133, 0.005117164924740791, -0.03112032264471054, 0.0013530602445825934, 0.021490463986992836, -0.03766724094748497, 0.06645698100328445, -0.037607330828905106, 0.029622018337249756, 0.0003052454558201134, 0.05347833037376404, 0.12754380702972412, 0.037983763962984085, -0.08228849619626999, -0.08278443664312363, -0.009365900419652462, 0.024011608213186264, 0.03912568464875221, -0.026882372796535492, -0.0023620270658284426, 0.019737483933568, 0.00921654887497425, -0.03935672715306282, -0.006219692062586546, -0.07533769309520721, -0.03144940733909607, -0.033086322247982025, -0.06478942930698395, -0.021759267896413803, -0.004709244705736637, -0.011484882794320583, 0.052457451820373535, -0.04642140492796898, 0.04041977599263191, 0.058964721858501434, 0.10695651173591614, -0.02268722653388977, 0.003910306375473738, 0.03526148945093155, -0.030682867392897606, 0.084730364382267, 0.05942535027861595, 0.0024735047481954098, -0.05875495821237564, -0.005269154440611601, -0.02593250572681427, 0.05935605615377426, 0.038331497460603714, -0.03572310879826546, 0.007910855114459991, -0.10008824616670609, 0.017952043563127518, 0.0030702119693160057, 0.007373712491244078, -0.05898245424032211, -0.022639278322458267, -0.06630350649356842, -0.14499571919441223, -0.008938082493841648, 0.04244358092546463, -0.06622248142957687, 0.09117081761360168, 0.017688771709799767, -0.05340002104640007, 0.001057059969753027, 0.0442407988011837, -0.03916902840137482, -0.03411760926246643, -0.047535646706819534, 0.03574766591191292, 0.03298462927341461, -0.0036610611714422703, 0.010073495097458363, 0.1039707288146019, 0.030258508399128914, -0.03494245931506157, -0.04261273145675659, -0.008932285942137241, 0.104762963950634, -0.005628424230962992, 0.04378899186849594, 0.02326437272131443, -0.017039671540260315, -0.03855230286717415, 0.0488237701356411, -0.02280110865831375, 0.058898475021123886, 0.06018216535449028, 0.026962177827954292, -0.009905203245580196, 0.013980203308165073, -0.031580470502376556, -0.02322595752775669, -0.017852244898676872, -0.014218988828361034, 0.12534217536449432, 0.10676873475313187, 0.03522998094558716, -0.012522784061729908, -0.01890546828508377, -0.009361788630485535, -0.026887567713856697, 0.030543142929673195, -1.407770014163856e-33, 0.0414765439927578, -0.09163977950811386, 0.06403087079524994, 0.10391445457935333, 0.04684557020664215, -0.012722142040729523, 0.0073404461145401, -0.02591880038380623, -0.1086103618144989, 0.019209472462534904, -0.04764935374259949, -0.0012232691515237093, 0.024310827255249023, 0.038111161440610886, 0.047633666545152664, 0.0037970494013279676, -0.03111887350678444, -0.08194517344236374, -0.0049332366324961185, 0.06815365701913834, -0.00650061946362257, -0.012596857734024525, -0.09528963267803192, 0.008846643380820751, -0.05241077393293381, -0.045156218111515045, 0.11107837408781052, 0.03247087821364403, 0.017212124541401863, -0.005410830490291119, -0.048729926347732544, 0.06375698000192642, -0.05843392759561539, 0.026727331802248955, -0.012321737594902515, -0.017513783648610115, -0.05430217832326889, 0.013092909939587116, -0.13498668372631073, 0.05090535804629326, 0.035581301897764206, 0.08252300322055817, -0.12133228778839111, -0.016635380685329437, 0.005210886709392071, -0.131618469953537, -0.03454574570059776, -0.07269333302974701, 0.0632615014910698, 0.059457823634147644, 0.024407224729657173, 0.013522883877158165, 0.05461704358458519, -0.09414109587669373, -0.009291175752878189, -0.009675055742263794, 0.08156222105026245, -0.09729142487049103, -0.024086222052574158, 0.07049408555030823, 0.09446313232183456, 0.03008163906633854, -0.028948647901415825, 0.024464478716254234, -0.00436016358435154, 0.04310872033238411, -0.012085190042853355, -0.011911776848137379, 0.017550401389598846, 0.040573425590991974, -0.008883104659616947, -0.03410942852497101, 0.015685580670833588, -0.016868289560079575, 0.04095618054270744, 0.0015769214369356632, -0.062767393887043, 0.04329853877425194, -0.023132815957069397, -0.051344387233257294, 0.07849615067243576, -0.05113786458969116, -0.022536510601639748, -0.011757795698940754, -0.004248232115060091, -0.0024261530488729477, -0.08516291528940201, -0.02079549804329872, 0.04357666149735451, -0.016098063439130783, 0.11123275756835938, -0.05373022332787514, -0.02806360274553299, -0.02722618728876114, -0.07029885798692703, -8.873164005884342e-34, 0.00979856587946415, -0.01822112686932087, -0.11762919276952744, 0.10412521660327911, -0.04249095544219017, -0.034276656806468964, 0.014230607077479362, -0.04636307433247566, -0.05237598344683647, 0.018758930265903473, -0.07261645793914795, -0.007225786801427603, -0.011464381590485573, 0.004501682706177235, -0.0486786924302578, -0.005510065704584122, -0.0031643614638596773, -0.12758886814117432, -0.018909242004156113, -0.035651564598083496, 0.009539631195366383, 0.01394243910908699, 0.118428073823452, 0.04865236207842827, -0.04239058867096901, 0.00000361640854862344, -0.012202265672385693, -0.035411760210990906, 0.08687084913253784, -0.08152718096971512, 0.018211519345641136, 0.057349011301994324, -0.005452731158584356, 0.031205646693706512, 0.04992591589689255, -0.05138632655143738, -0.03037688136100769, 0.023157678544521332, 0.09951286762952805, -0.09244100749492645, -0.015246117487549782, 0.023207789286971092, 0.03250139579176903, 0.02592984400689602, 0.03706446662545204, 0.10844095796346664, 0.05509156361222267, -0.007648858241736889, -0.006426301784813404, -0.058115195482969284, -0.012069841846823692, 0.01845458149909973, 0.0343305878341198, 0.09328797459602356, -0.028092093765735626, -0.09807053953409195, -0.06328295916318893, 0.0049147033132612705, 0.02100732922554016, 0.05912378057837486, 0.08612758666276932, -0.022339092567563057, -0.0066046565771102905, -0.02384602092206478, -0.09462698549032211, -0.021878909319639206, -0.10049162060022354, 0.02883371338248253, 0.018043166026473045, 0.022203611209988594, -0.06843975186347961, -0.0031834477558732033, 0.07073240727186203, -0.004481350537389517, -0.08219987154006958, -0.010299482382833958, -0.028505122289061546, -0.11143847554922104, -0.0033259226474910975, 0.009262237697839737, -0.06873051822185516, 0.09455054253339767, -0.07069005817174911, 0.028063751757144928, 0.044109463691711426, 0.007341273594647646, -0.038017746061086655, 0.020057909190654755, 0.013634861446917057, 0.020407389849424362, 0.054567351937294006, 0.0017772612627595663, -0.08751028776168823, -0.00005711875928682275, 0.04321747645735741, -5.201037822644139e-8, 0.0037880081217736006, 0.01970405876636505, -0.11077271401882172, 0.020685050636529922, 0.028544235974550247, -0.007768074981868267, 0.026888642460107803, -0.0027031702920794487, 0.09909828007221222, 0.02990667149424553, -0.006731376517564058, -0.016122257336974144, -0.05617702752351761, 0.007985744625329971, -0.0041267056949436665, 0.018124999478459358, 0.03303686901926994, 0.0028336048126220703, 0.05451507866382599, 0.021013332530856133, 0.006695702206343412, -0.029994608834385872, -0.04105108976364136, 0.10717479139566422, -0.05452684685587883, -0.012163670733571053, 0.0556337796151638, 0.02434363402426243, 0.011883865110576153, -0.043064799159765244, -0.022225212305784225, 0.06560810655355453, 0.036486055701971054, -0.07310447096824646, -0.031210588291287422, 0.04571264609694481, 0.028136206790804863, 0.05492149293422699, 0.09843466430902481, 0.00012659520143643022, 0.0030828863382339478, 0.03658692166209221, 0.012971675023436546, -0.03325711190700531, -0.082012839615345, -0.06030983477830887, -0.03479709476232529, 0.03387407958507538, -0.07169171422719955, -0.024826038628816605, 0.08258970826864243, -0.0813596174120903, -0.08423478156328201, 0.06267675757408142, 0.049835748970508575, 0.00983364973217249, 0.012778179720044136, -0.1155981719493866, 0.03618210554122925, 0.018760547041893005, 0.09523355960845947, -0.020181957632303238, 0.0446634478867054, -0.0016401178436353803 ]
0.060558
provided pattern. See the documentation on [filtering tests by name][] for more details. If both `--test-name-pattern` and `--test-skip-pattern` are supplied, tests must satisfy \*\*both\*\* requirements in order to be executed. ### `--test-only` Configures the test runner to only execute top level tests that have the `only` option set. This flag is not necessary when test isolation is disabled. ### `--test-reporter` A test reporter to use when running tests. See the documentation on [test reporters][] for more details. ### `--test-reporter-destination` The destination for the corresponding test reporter. See the documentation on [test reporters][] for more details. ### `--test-rerun-failures` A path to a file allowing the test runner to persist the state of the test suite between runs. The test runner will use this file to determine which tests have already succeeded or failed, allowing for re-running of failed tests without having to re-run the entire test suite. The test runner will create this file if it does not exist. See the documentation on [test reruns][] for more details. ### `--test-shard` Test suite shard to execute in a format of `/`, where \* `index` is a positive integer, index of divided parts. \* `total` is a positive integer, total of divided part. This command will divide all tests files into `total` equal parts, and will run only those that happen to be in an `index` part. For example, to split your tests suite into three parts, use this: ```bash node --test --test-shard=1/3 node --test --test-shard=2/3 node --test --test-shard=3/3 ``` ### `--test-skip-pattern` A regular expression that configures the test runner to skip tests whose name matches the provided pattern. See the documentation on [filtering tests by name][] for more details. If both `--test-name-pattern` and `--test-skip-pattern` are supplied, tests must satisfy \*\*both\*\* requirements in order to be executed. ### `--test-timeout` A number of milliseconds the test execution will fail after. If unspecified, subtests inherit this value from their parent. The default value is `Infinity`. ### `--test-update-snapshots` Regenerates the snapshot files used by the test runner for [snapshot testing][]. ### `--throw-deprecation` Throw errors for deprecations. ### `--title=title` Set `process.title` on startup. ### `--tls-cipher-list=list` Specify an alternative default TLS cipher list. Requires Node.js to be built with crypto support (default). ### `--tls-keylog=file` Log TLS key material to a file. The key material is in NSS `SSLKEYLOGFILE` format and can be used by software (such as Wireshark) to decrypt the TLS traffic. ### `--tls-max-v1.2` Set [`tls.DEFAULT\_MAX\_VERSION`][] to 'TLSv1.2'. Use to disable support for TLSv1.3. ### `--tls-max-v1.3` Set default [`tls.DEFAULT\_MAX\_VERSION`][] to 'TLSv1.3'. Use to enable support for TLSv1.3. ### `--tls-min-v1.0` Set default [`tls.DEFAULT\_MIN\_VERSION`][] to 'TLSv1'. Use for compatibility with old TLS clients or servers. ### `--tls-min-v1.1` Set default [`tls.DEFAULT\_MIN\_VERSION`][] to 'TLSv1.1'. Use for compatibility with old TLS clients or servers. ### `--tls-min-v1.2` Set default [`tls.DEFAULT\_MIN\_VERSION`][] to 'TLSv1.2'. This is the default for 12.x and later, but the option is supported for compatibility with older Node.js versions. ### `--tls-min-v1.3` Set default [`tls.DEFAULT\_MIN\_VERSION`][] to 'TLSv1.3'. Use to disable support for TLSv1.2, which is not as secure as TLSv1.3. ### `--trace-deprecation` Print stack traces for deprecations. ### `--trace-env` Print information about any access to environment variables done in the current Node.js instance to stderr, including: \* The environment variable reads that Node.js does internally. \* Writes in the form of `process.env.KEY = "SOME VALUE"`. \* Reads in the form of `process.env.KEY`. \* Definitions in the form of `Object.defineProperty(process.env, 'KEY', {...})`. \* Queries in the form of `Object.hasOwn(process.env, 'KEY')`, `process.env.hasOwnProperty('KEY')` or `'KEY' in process.env`. \* Deletions in the form of `delete process.env.KEY`. \* Enumerations inf the form of `...process.env` or `Object.keys(process.env)`. Only the names of the environment variables being accessed are printed.
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.048033423721790314, -0.0075866226106882095, -0.036125849932432175, 0.0812135636806488, 0.06234278157353401, -0.030678903684020042, 0.058026786893606186, -0.04657023027539253, -0.032800063490867615, -0.03852611780166626, 0.061453353613615036, 0.02154536545276642, 0.02897695265710354, 0.011189090088009834, 0.026196762919425964, -0.049221307039260864, 0.009223000146448612, 0.02548673190176487, -0.0007593452464789152, -0.06501118838787079, 0.036219287663698196, 0.0113802095875144, -0.007583889644593, -0.0060791433788836, -0.048151325434446335, 0.003225691383704543, -0.09514692425727844, -0.01575140468776226, 0.0215196143835783, -0.02319139800965786, 0.028891265392303467, -0.030333999544382095, -0.05589200556278229, 0.10651333630084991, 0.06650581955909729, -0.04091921076178551, 0.01811893843114376, 0.04679475724697113, -0.03608011454343796, 0.012543851509690285, 0.04244385287165642, -0.04642214998602867, -0.041819605976343155, -0.034052278846502304, -0.037791796028614044, -0.050119370222091675, -0.06669562309980392, -0.017987072467803955, -0.05725395679473877, -0.014933016151189804, -0.016263050958514214, -0.06192486733198166, -0.024203917011618614, 0.0518551766872406, 0.07644975185394287, -0.011718724854290485, 0.03753911331295967, 0.0182601660490036, -0.0019853601697832346, 0.02462824061512947, -0.035714566707611084, -0.04118836671113968, -0.047879915684461594, -0.009578992612659931, -0.01718287542462349, 0.03165479749441147, -0.02835271507501602, 0.04281049594283104, 0.10122990608215332, 0.037404511123895645, -0.08742672950029373, 0.06219671666622162, 0.01711188070476055, 0.03785837069153786, 0.04712895303964615, 0.019616855308413506, 0.00873114075511694, -0.0024296974297612906, -0.01998993568122387, -0.06087817624211311, -0.047857049852609634, -0.13929033279418945, -0.02361215092241764, -0.031930241733789444, -0.031681716442108154, 0.10872539132833481, 0.04588238149881363, -0.03281963989138603, 0.018927838653326035, -0.04104269668459892, -0.03443679213523865, -0.11882707476615906, -0.015483327209949493, 0.0037458136212080717, 0.045459356158971786, -0.02657206915318966, 0.02521105855703354, 0.007471531629562378, 0.09968641400337219, -0.008350877091288567, 0.027548648416996002, -0.05515625700354576, 0.09392160177230835, 0.0047140782698988914, -0.02018113061785698, -0.06857046484947205, -0.011358832940459251, -0.14922331273555756, 0.021105840802192688, -0.012050531804561615, -0.011422630399465561, 0.045603152364492416, 0.07470105588436127, -0.04055701196193695, -0.022555140778422356, 0.011371422559022903, -0.03386460989713669, 0.05157742649316788, -0.050917938351631165, 0.05696914345026016, -0.004887612070888281, 0.01914324425160885, 0.012027294375002384, -0.026641353964805603, 0.05661198869347572, 0.10162994265556335, 0.013115040957927704, 2.200368386040892e-33, 0.072968028485775, -0.05365950986742973, -0.0483916737139225, 0.02453666925430298, 0.018692152574658394, 0.05498618260025978, 0.03966940566897392, 0.05905069783329964, 0.007600986398756504, 0.05977968871593475, 0.012169227004051208, -0.0682436153292656, -0.007395751308649778, -0.009595418348908424, 0.005170498974621296, 0.07645025104284286, 0.04709077626466751, -0.054234039038419724, -0.04013160988688469, 0.059770405292510986, 0.04969976469874382, -0.007598309777677059, -0.07045657187700272, -0.010533010587096214, -0.087350994348526, -0.03755524754524231, -0.0020854983013123274, -0.009294308722019196, 0.005001782905310392, 0.02783590741455555, -0.07694125920534134, 0.019040590152144432, -0.0067842984572052956, 0.156101793050766, 0.04468987137079239, 0.04113597050309181, -0.09713473170995712, 0.00518457219004631, 0.02493881806731224, 0.06258461624383926, -0.01260717399418354, -0.01642945595085621, -0.026068324223160744, 0.014207234606146812, 0.025435054674744606, -0.09450331330299377, -0.08496690541505814, -0.03381621092557907, 0.07859009504318237, -0.06272877007722855, 0.034508202224969864, 0.0737033411860466, 0.016279757022857666, -0.10206862539052963, 0.02182062342762947, -0.012129303999245167, 0.004556868690997362, -0.044173724949359894, -0.013388420455157757, 0.05369975045323372, 0.01188020408153534, -0.008780584670603275, -0.06839894503355026, 0.129177987575531, 0.03130453824996948, 0.00857675913721323, -0.024350536987185478, -0.07576370984315872, -0.006620859727263451, 0.011012790724635124, -0.023940270766615868, -0.038222555071115494, -0.031030457466840744, -0.04161176085472107, 0.07263922691345215, -0.021252039819955826, 0.048569150269031525, 0.03722855821251869, 0.021517600864171982, -0.04167843610048294, 0.022949932143092155, -0.022447973489761353, -0.043877165764570236, -0.015299086458981037, -0.037584319710731506, 0.00036388871376402676, -0.05485351011157036, -0.048255905508995056, -0.04673225060105324, -0.17851263284683228, 0.0801365077495575, -0.0062970067374408245, -0.039189305156469345, -0.05764155089855194, 0.07039676606655121, -3.929467127841713e-33, 0.034090738743543625, 0.07102728635072708, -0.04046855494379997, -0.013566015288233757, -0.03128093108534813, -0.04111948981881142, 0.06988085061311722, -0.0866028219461441, -0.0021059580612927675, -0.0013125495752319694, -0.07132664322853088, -0.07188791781663895, 0.03277036175131798, -0.024288536980748177, -0.0916183590888977, -0.003071391023695469, -0.05044546723365784, -0.0681493729352951, -0.08807793259620667, -0.0216370802372694, 0.018228724598884583, 0.015055585652589798, 0.01838109828531742, -0.0013763871975243092, -0.03820490092039108, -0.04051865264773369, 0.005365096032619476, 0.04474373161792755, 0.07256754487752914, -0.04589873552322388, 0.021209433674812317, 0.04659683257341385, 0.013491791673004627, 0.010060066357254982, 0.003012412926182151, -0.044931311160326004, -0.008329411968588829, 0.07244636863470078, 0.03120034746825695, 0.0781555324792862, 0.051500868052244186, 0.07759173959493637, 0.0035984073765575886, 0.03015671670436859, 0.021049581468105316, 0.14985568821430206, 0.017047438770532608, -0.02751072868704796, -0.09094143658876419, -0.025504734367132187, -0.06434637308120728, -0.005522673483937979, -0.0761159360408783, 0.02360638417303562, -0.014925464056432247, 0.01851092278957367, -0.05789133533835411, 0.04908223822712898, -0.12093273550271988, 0.0451589934527874, 0.08746135979890823, 0.030618678778409958, -0.0038830344565212727, 0.1016845777630806, -0.05291648209095001, 0.016071783378720284, 0.0018646249081939459, 0.023383693769574165, 0.07593207061290741, -0.010129057802259922, -0.017795145511627197, 0.04578786715865135, 0.025855714455246925, -0.0396205373108387, 0.02227337658405304, 0.05203038826584816, -0.08498261123895645, -0.06925872713327408, -0.00645264470949769, 0.05519675090909004, -0.08586949110031128, -0.03350983187556267, -0.10602985322475433, 0.10523390024900436, 0.05232502520084381, 0.10135983675718307, -0.008515361696481705, 0.0799107700586319, 0.05835508182644844, -0.04059658199548721, 0.08260355144739151, -0.008817164227366447, 0.004416013602167368, -0.04700133204460144, -0.0041954913176596165, -6.050021994497001e-8, -0.017030278220772743, -0.08001592755317688, -0.0346694253385067, 0.038531314581632614, -0.017604446038603783, 0.03227479010820389, 0.04884050413966179, -0.01604851521551609, -0.007692471146583557, 0.07223416864871979, -0.044420260936021805, 0.034114524722099304, -0.018083322793245316, -0.005936884321272373, 0.03826431930065155, -0.0048150066286325455, 0.10128495842218399, 0.055262330919504166, -0.036717530339956284, 0.0004665025626309216, -0.029957206919789314, -0.04299154877662659, -0.04039460048079491, 0.11673915386199951, -0.04190113767981529, 0.014271662570536137, 0.09587125480175018, -0.010695863515138626, 0.006905792746692896, -0.030990123748779297, 0.004811898805201054, -0.02372768335044384, -0.05950633063912392, -0.03059062547981739, -0.03509301319718361, 0.13580337166786194, 0.049300666898489, 0.03822740912437439, 0.021454261615872383, 0.08083152770996094, 0.001933482475578785, -0.008788688108325005, 0.022910257801413536, 0.06189578026533127, -0.028498593717813492, -0.05979245528578758, -0.04472057521343231, -0.06768900901079178, -0.003642386058345437, -0.04182605445384979, -0.02928658202290535, -0.01558590680360794, 0.016665052622556686, 0.050459641963243484, -0.005136681254953146, 0.06203366070985794, 0.04255547747015953, -0.02029351331293583, -0.07606299221515656, 0.0034535296726971865, 0.09382401406764984, 0.0038329451344907284, 0.07533570379018784, -0.00669851852580905 ]
0.104966
\* Definitions in the form of `Object.defineProperty(process.env, 'KEY', {...})`. \* Queries in the form of `Object.hasOwn(process.env, 'KEY')`, `process.env.hasOwnProperty('KEY')` or `'KEY' in process.env`. \* Deletions in the form of `delete process.env.KEY`. \* Enumerations inf the form of `...process.env` or `Object.keys(process.env)`. Only the names of the environment variables being accessed are printed. The values are not printed. To print the stack trace of the access, use `--trace-env-js-stack` and/or `--trace-env-native-stack`. ### `--trace-env-js-stack` In addition to what `--trace-env` does, this prints the JavaScript stack trace of the access. ### `--trace-env-native-stack` In addition to what `--trace-env` does, this prints the native stack trace of the access. ### `--trace-event-categories` A comma separated list of categories that should be traced when trace event tracing is enabled using `--trace-events-enabled`. ### `--trace-event-file-pattern` Template string specifying the filepath for the trace event data, it supports `${rotation}` and `${pid}`. ### `--trace-events-enabled` Enables the collection of trace event tracing information. ### `--trace-exit` Prints a stack trace whenever an environment is exited proactively, i.e. invoking `process.exit()`. ### `--trace-require-module=mode` Prints information about usage of [Loading ECMAScript modules using `require()`][]. When `mode` is `all`, all usage is printed. When `mode` is `no-node-modules`, usage from the `node\_modules` folder is excluded. ### `--trace-sigint` Prints a stack trace on SIGINT. ### `--trace-sync-io` Prints a stack trace whenever synchronous I/O is detected after the first turn of the event loop. ### `--trace-tls` Prints TLS packet trace information to `stderr`. This can be used to debug TLS connection problems. ### `--trace-uncaught` Print stack traces for uncaught exceptions; usually, the stack trace associated with the creation of an `Error` is printed, whereas this makes Node.js also print the stack trace associated with throwing the value (which does not need to be an `Error` instance). Enabling this option may affect garbage collection behavior negatively. ### `--trace-warnings` Print stack traces for process warnings (including deprecations). ### `--track-heap-objects` Track heap object allocations for heap snapshots. ### `--unhandled-rejections=mode` Using this flag allows to change what should happen when an unhandled rejection occurs. One of the following modes can be chosen: \* `throw`: Emit [`unhandledRejection`][]. If this hook is not set, raise the unhandled rejection as an uncaught exception. This is the default. \* `strict`: Raise the unhandled rejection as an uncaught exception. If the exception is handled, [`unhandledRejection`][] is emitted. \* `warn`: Always trigger a warning, no matter if the [`unhandledRejection`][] hook is set or not but do not print the deprecation warning. \* `warn-with-error-code`: Emit [`unhandledRejection`][]. If this hook is not set, trigger a warning, and set the process exit code to 1. \* `none`: Silence all warnings. If a rejection happens during the command line entry point's ES module static loading phase, it will always raise it as an uncaught exception. ### `--use-bundled-ca`, `--use-openssl-ca` Use bundled Mozilla CA store as supplied by current Node.js version or use OpenSSL's default CA store. The default store is selectable at build-time. The bundled CA store, as supplied by Node.js, is a snapshot of Mozilla CA store that is fixed at release time. It is identical on all supported platforms. Using OpenSSL store allows for external modifications of the store. For most Linux and BSD distributions, this store is maintained by the distribution maintainers and system administrators. OpenSSL CA store location is dependent on configuration of the OpenSSL library but this can be altered at runtime using environment variables. See `SSL\_CERT\_DIR` and `SSL\_CERT\_FILE`. ### `--use-env-proxy` > Stability: 1.1 - Active Development When enabled, Node.js parses the `HTTP\_PROXY`, `HTTPS\_PROXY` and `NO\_PROXY` environment variables during startup, and tunnels requests over the specified proxy. This is equivalent to setting the [`NODE\_USE\_ENV\_PROXY=1`][] environment variable. When both are set, `--use-env-proxy` takes precedence.
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.03361153602600098, -0.011108286678791046, -0.09307156503200531, 0.021818848326802254, 0.013404428027570248, -0.07833433151245117, 0.08395715057849884, 0.037469297647476196, -0.022093044593930244, -0.025049282237887383, -0.003870608052238822, -0.047328464686870575, 0.01190454326570034, -0.054305948317050934, -0.007329688873142004, 0.06614036858081818, -0.059104595333337784, -0.029189953580498695, -0.02577178180217743, -0.028152180835604668, 0.04341137409210205, 0.02763429656624794, 0.013708728365600109, -0.00898903701454401, 0.008769246749579906, -0.01593790575861931, -0.03894755244255066, 0.03551401197910309, 0.04915226995944977, 0.004861885216087103, 0.0323331281542778, -0.008506221696734428, -0.0325310043990612, 0.008465893566608429, 0.14225508272647858, 0.13277527689933777, 0.06358998268842697, -0.0945458710193634, -0.014529564417898655, -0.0289956945925951, 0.06326210498809814, 0.060024090111255646, -0.09980417788028717, -0.053380247205495834, -0.011112907901406288, -0.006107852328568697, -0.09775615483522415, -0.034608643501996994, -0.09037231653928757, -0.031773701310157776, 0.005838267970830202, 0.06243033707141876, -0.05552828684449196, -0.05619035288691521, 0.010722547769546509, 0.008385499939322472, 0.023660453036427498, -0.027418149635195732, 0.0057168337516486645, 0.0019033115822821856, -0.04911523312330246, -0.011794783174991608, 0.004892433062195778, 0.00616106204688549, 0.0173884816467762, 0.010139424353837967, -0.03961262106895447, -0.01458346750587225, 0.017437458038330078, -0.04149507358670235, -0.1047067940235138, 0.005634014960378408, -0.03144460916519165, -0.06822777539491653, -0.06213969364762306, 0.0003499386948533356, -0.05051714926958084, 0.019216949120163918, -0.04018016159534454, -0.10759326070547104, 0.001033908105455339, -0.022559408098459244, -0.027248309925198555, 0.1121232658624649, 0.006084457505494356, 0.07112188637256622, -0.006451294291764498, -0.08354953676462173, 0.07673879712820053, 0.10180694609880447, -0.02561493031680584, -0.13612988591194153, -0.02498696744441986, 0.05599801242351532, 0.07072974741458893, 0.03422660380601883, 0.03580845147371292, 0.009817501530051231, 0.03146521747112274, 0.03455177694559097, -0.06352248042821884, -0.013224693946540356, 0.061797864735126495, -0.019065789878368378, -0.012380197644233704, 0.032296594232320786, 0.019052937626838684, -0.0008123816805891693, -0.022676018998026848, 0.0027151526883244514, -0.02600850537419319, 0.04114728420972824, 0.03216283768415451, 0.039536792784929276, 0.09429839253425598, 0.01608424447476864, 0.08833985030651093, -0.042197491973638535, 0.05892765522003174, 0.07705410569906235, 0.08507346361875534, -0.006214786786586046, 0.00468725198879838, -0.01541291456669569, -0.007026306819170713, 0.022350909188389778, -0.006652463227510452, 2.24818962566791e-35, 0.0057314010336995125, -0.09237854182720184, 0.011060819029808044, 0.027835510671138763, 0.012069578282535076, 0.09695162624120712, 0.018765348941087723, 0.020206157118082047, -0.023659465834498405, 0.06987378001213074, -0.03539400175213814, 0.11879156529903412, -0.05602101609110832, -0.07747891545295715, 0.04030577093362808, 0.07547447830438614, 0.06059914082288742, 0.05176885053515434, -0.002313882578164339, 0.04299720376729965, 0.046544548124074936, -0.005097000394016504, -0.07146766781806946, 0.06683166325092316, 0.027810515835881233, -0.016646994277834892, -0.04553135111927986, 0.04061685875058174, -0.05492264777421951, -0.01068782526999712, 0.10881508141756058, -0.01484841201454401, -0.03280985355377197, 0.039585091173648834, 0.04433891922235489, -0.04750877618789673, 0.09399208426475525, 0.02006044238805771, -0.09932193160057068, -0.03677169606089592, -0.005879867821931839, -0.039658937603235245, -0.029002374038100243, -0.020259849727153778, -0.09266120940446854, -0.08930452913045883, -0.07742591202259064, 0.03438801318407059, 0.06198737025260925, -0.000011239601008128375, -0.055781684815883636, 0.061309944838285446, 0.018536066636443138, -0.11220142245292664, 0.06926757842302322, -0.05980011820793152, 0.020394356921315193, 0.01196376234292984, -0.0065485043451189995, 0.01442765910178423, -0.021387390792369843, 0.09886349737644196, 0.013063976541161537, 0.0026877550408244133, 0.014145128428936005, -0.019531182944774628, -0.012468604370951653, 0.018089188262820244, 0.04638507217168808, 0.01588740386068821, -0.08230385929346085, 0.07868269830942154, 0.04671335220336914, 0.05917348712682724, 0.08416114747524261, -0.0508294440805912, -0.047316085547208786, -0.009865392930805683, -0.025305934250354767, -0.03133354336023331, -0.010119940154254436, 0.03642509877681732, -0.07763427495956421, 0.05710463598370552, 0.03147386386990547, 0.007071696687489748, -0.0778411403298378, -0.024446111172437668, 0.024434244260191917, 0.03926732763648033, -0.0008629804360680282, -0.053846120834350586, -0.023839741945266724, -0.06120869517326355, -0.1875094771385193, -4.685087018835772e-33, 0.014348641037940979, 0.0018769646994769573, -0.016063785180449486, -0.045855503529310226, -0.059655893594026566, -0.012413370423018932, -0.01359045971184969, 0.007263758685439825, 0.025119250640273094, -0.028904935345053673, 0.017144110053777695, 0.06696651875972748, 0.07027076929807663, 0.006704907864332199, 0.10113497078418732, 0.0629633441567421, -0.08854307979345322, -0.04187783598899841, 0.0538555271923542, -0.03761380910873413, -0.00828759279102087, 0.032937437295913696, 0.06336422264575958, 0.07263258844614029, -0.06802588701248169, -0.026655884459614754, -0.004281394183635712, -0.011417911387979984, 0.016553442925214767, 0.01375699881464243, -0.0011547530302777886, 0.026152336969971657, -0.06994059681892395, 0.12418651580810547, -0.0660427138209343, -0.1495337188243866, 0.0007820722530595958, 0.023372897878289223, -0.0034870197996497154, -0.05574001744389534, 0.051356710493564606, -0.011561072431504726, -0.026925360783934593, -0.015291832387447357, -0.0349431075155735, 0.043146394193172455, 0.031126750633120537, 0.014840512536466122, 0.03289085999131203, -0.08950946480035782, 0.11448725312948227, -0.06383509933948517, 0.012410948984324932, 0.05372752994298935, -0.03637406602501869, 0.07869560271501541, 0.056583505123853683, -0.07426641136407852, 0.002009949181228876, -0.007353831082582474, 0.0634956955909729, -0.04151685908436775, -0.052936386317014694, 0.02057587169110775, -0.05963286757469177, -0.02380245178937912, -0.05116366967558861, -0.027818135917186737, -0.012963492423295975, -0.10367094725370407, -0.030947592109441757, -0.11255213618278503, -0.024007761850953102, -0.02152383327484131, 0.005362845957279205, 0.0267245564609766, -0.06577948480844498, -0.11095211654901505, 0.017555922269821167, 0.06133135035634041, -0.03998851031064987, 0.023266365751624107, -0.056074924767017365, -0.039065126329660416, 0.013113968074321747, -0.06241188943386078, -0.09406208246946335, 0.03042479231953621, 0.02949528954923153, 0.03390925005078316, 0.046632349491119385, 0.0077757807448506355, -0.12672212719917297, 0.010530050843954086, -0.03558211028575897, -5.437236794136879e-8, 0.0014740665210410953, -0.016730142757296562, -0.037723880261182785, -0.022332116961479187, 0.009777555242180824, -0.02099623717367649, 0.0476064458489418, 0.0463525764644146, 0.04142145439982414, 0.03766179829835892, -0.002484462456777692, 0.03516017273068428, -0.015928801149129868, 0.010720020160079002, -0.011553389951586723, -0.02527758665382862, -0.02356133610010147, 0.10137168318033218, -0.0012176260352134705, -0.005501734558492899, 0.02683606557548046, -0.07112036645412445, -0.005551556125283241, 0.023645251989364624, -0.023826103657484055, -0.07810656726360321, 0.04987893998622894, 0.01213239599019289, 0.012246004305779934, 0.01893610879778862, -0.013056050054728985, 0.03482244163751602, 0.04859573394060135, 0.02579568140208721, -0.04828239232301712, 0.0000666492705931887, -0.011043253354728222, -0.006817827466875315, 0.026689397171139717, 0.14146111905574799, -0.021128123626112938, 0.02314644679427147, -0.048292435705661774, 0.02854643203318119, -0.041616544127464294, -0.008264747448265553, -0.058806080371141434, 0.06415675580501556, 0.030851012095808983, -0.024184158071875572, -0.052403826266527176, 0.0017725311918184161, -0.029517419636249542, 0.07305903732776642, -0.06357059627771378, 0.06434222310781479, 0.02057190239429474, -0.07270046323537827, -0.017108764499425888, 0.022869594395160675, -0.001338248373940587, 0.00442725233733654, 0.028515484184026718, -0.02208491787314415 ]
0.03498
environment variables. See `SSL\_CERT\_DIR` and `SSL\_CERT\_FILE`. ### `--use-env-proxy` > Stability: 1.1 - Active Development When enabled, Node.js parses the `HTTP\_PROXY`, `HTTPS\_PROXY` and `NO\_PROXY` environment variables during startup, and tunnels requests over the specified proxy. This is equivalent to setting the [`NODE\_USE\_ENV\_PROXY=1`][] environment variable. When both are set, `--use-env-proxy` takes precedence. ### `--use-largepages=mode` Re-map the Node.js static code to large memory pages at startup. If supported on the target system, this will cause the Node.js static code to be moved onto 2 MiB pages instead of 4 KiB pages. The following values are valid for `mode`: \* `off`: No mapping will be attempted. This is the default. \* `on`: If supported by the OS, mapping will be attempted. Failure to map will be ignored and a message will be printed to standard error. \* `silent`: If supported by the OS, mapping will be attempted. Failure to map will be ignored and will not be reported. ### `--use-system-ca` Node.js uses the trusted CA certificates present in the system store along with the `--use-bundled-ca` option and the `NODE\_EXTRA\_CA\_CERTS` environment variable. On platforms other than Windows and macOS, this loads certificates from the directory and file trusted by OpenSSL, similar to `--use-openssl-ca`, with the difference being that it caches the certificates after first load. On Windows and macOS, the certificate trust policy is similar to [Chromium's policy for locally trusted certificates][], but with some differences: On macOS, the following settings are respected: \* Default and System Keychains \* Trust: \* Any certificate where the “When using this certificate” flag is set to “Always Trust” or \* Any certificate where the “Secure Sockets Layer (SSL)” flag is set to “Always Trust”. \* The certificate must also be valid, with "X.509 Basic Policy" set to “Always Trust”. On Windows, the following settings are respected: \* Local Machine (accessed via `certlm.msc`) \* Trust: \* Trusted Root Certification Authorities \* Trusted People \* Enterprise Trust -> Enterprise -> Trusted Root Certification Authorities \* Enterprise Trust -> Enterprise -> Trusted People \* Enterprise Trust -> Group Policy -> Trusted Root Certification Authorities \* Enterprise Trust -> Group Policy -> Trusted People \* Current User (accessed via `certmgr.msc`) \* Trust: \* Trusted Root Certification Authorities \* Enterprise Trust -> Group Policy -> Trusted Root Certification Authorities On Windows and macOS, Node.js would check that the user settings for the trusted certificates do not forbid them for TLS server authentication before using them. Node.js currently does not support distrust/revocation of certificates from another source based on system settings. On other systems, Node.js loads certificates from the default certificate file (typically `/etc/ssl/cert.pem`) and default certificate directory (typically `/etc/ssl/certs`) that the version of OpenSSL that Node.js links to respects. This typically works with the convention on major Linux distributions and other Unix-like systems. If the overriding OpenSSL environment variables (typically `SSL\_CERT\_FILE` and `SSL\_CERT\_DIR`, depending on the configuration of the OpenSSL that Node.js links to) are set, the specified paths will be used to load certificates instead. These environment variables can be used as workarounds if the conventional paths used by the version of OpenSSL Node.js links to are not consistent with the system configuration that the users have for some reason. ### `--v8-options` Print V8 command-line options. ### `--v8-pool-size=num` Set V8's thread pool size which will be used to allocate background jobs. If set to `0` then Node.js will choose an appropriate size of the thread pool based on an estimate of the amount of parallelism. The amount of parallelism refers to the number of computations that can be carried out simultaneously in a given machine. In general, it's the same as the
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.01093796081840992, 0.037815485149621964, 0.05373664200305939, 0.034889791160821915, 0.022079115733504295, -0.04724730923771858, -0.08137696981430054, 0.030095938593149185, -0.021100513637065887, 0.03864559903740883, -0.04765349254012108, 0.10972821712493896, 0.016090644523501396, 0.0014928440796211362, 0.04145704209804535, 0.046972207725048065, 0.01977718062698841, 0.05782851204276085, 0.008516216650605202, 0.002179123926907778, 0.022081611678004265, -0.03344923257827759, 0.031678229570388794, -0.012836390174925327, -0.05178205668926239, -0.03723464533686638, -0.08035880327224731, -0.0085036875680089, 0.04484805464744568, -0.04445471614599228, 0.02503189630806446, 0.051554352045059204, -0.10317908227443695, -0.004140224773436785, -0.05256951227784157, 0.09453973919153214, 0.005026144906878471, -0.07520247250795364, -0.06712526082992554, -0.016733063384890556, 0.1262313276529312, 0.06236526742577553, -0.03635341301560402, -0.0416395403444767, 0.01130546536296606, -0.010356846265494823, 0.00872795283794403, -0.0395236536860466, -0.04865188151597977, -0.05070821940898895, 0.011008666828274727, -0.027982249855995178, -0.024372506886720657, -0.022927291691303253, -0.07534438371658325, -0.021662037819623947, -0.008371991105377674, 0.038219649344682693, 0.06516857445240021, 0.14022788405418396, 0.0065149408765137196, -0.01619061455130577, 0.06858488917350769, 0.009699586778879166, 0.017511749640107155, 0.017412513494491577, -0.018704595044255257, 0.03069058619439602, -0.003935851156711578, 0.09078404307365417, 0.009716875851154327, 0.04516437649726868, -0.05860544741153717, -0.043681781738996506, -0.041569653898477554, -0.12125777453184128, -0.027714896947145462, -0.049691133201122284, 0.014063042588531971, -0.06818453967571259, -0.005426926538348198, -0.08402757346630096, -0.019961753860116005, 0.033256933093070984, -0.030693430453538895, 0.04029817506670952, -0.00029570431797765195, -0.05170663818717003, 0.07876691222190857, 0.06111760437488556, -0.0006660538492724299, -0.05173797532916069, 0.01789877563714981, 0.06094302237033844, 0.012762811966240406, 0.024531662464141846, 0.02027733623981476, 0.03435945138335228, 0.007442300207912922, -0.058463048189878464, 0.02444261685013771, 0.023522567003965378, 0.10474023222923279, -0.0012173224240541458, -0.006216137204319239, -0.05411113426089287, 0.05304631590843201, 0.027461567893624306, -0.0020305283833295107, 0.016688743606209755, 0.04870660603046417, 0.005606133956462145, 0.01894175447523594, -0.07245391607284546, -0.08453306555747986, 0.030279498547315598, 0.06609337031841278, -0.042080558836460114, 0.08417874574661255, 0.11205728352069855, 0.04715694487094879, 0.013643265701830387, 0.013707153499126434, 0.01679978519678116, -0.000032643376471241936, -0.022752365097403526, 0.049335185438394547, 1.5523444317134738e-33, 0.04728451371192932, -0.050790924578905106, 0.017540322616696358, 0.12100149691104889, 0.06857389211654663, -0.02669026143848896, 0.06927905976772308, 0.012510194443166256, -0.07511954754590988, 0.027481915429234505, 0.021305864676833153, 0.01992041803896427, -0.0275894645601511, 0.04781929776072502, -0.0017284322530031204, -0.011439288966357708, 0.02886809967458248, -0.021872220560908318, 0.056620042771101, 0.013063455931842327, 0.012695122510194778, -0.06728408485651016, -0.010702988132834435, 0.000778962392359972, 0.052128974348306656, -0.04644615575671196, 0.059550292789936066, 0.02003471739590168, -0.03771360218524933, -0.0156796183437109, 0.04719820246100426, 0.04893195629119873, 0.006798273883759975, 0.04198167100548744, 0.07677296549081802, 0.021845770999789238, 0.08110418915748596, 0.018951307982206345, -0.09662699699401855, 0.01539459079504013, 0.00445766793563962, 0.07427845895290375, -0.0021969329100102186, -0.015150160528719425, -0.04202646389603615, -0.1185944601893425, -0.030162855982780457, -0.06158224120736122, 0.09852917492389679, 0.041380077600479126, -0.028875228017568588, 0.0491032637655735, 0.01074717566370964, -0.057992976158857346, 0.07989383488893509, -0.02647644467651844, -0.03810563683509827, -0.06488741934299469, -0.08756314218044281, -0.013085040263831615, -0.02921239845454693, -0.05580851063132286, -0.025808561593294144, -0.018227659165859222, 0.0716562420129776, 0.04919799417257309, -0.005454082041978836, 0.09208682924509048, -0.07774115353822708, -0.010117130354046822, -0.0315498411655426, -0.04539225250482559, 0.0591636523604393, -0.0013949095737189054, -0.0032675147522240877, 0.047521091997623444, -0.08210638910531998, 0.0415165051817894, -0.022151345387101173, -0.02139890007674694, 0.04306172952055931, -0.02027115412056446, -0.038234855979681015, 0.06468209624290466, 0.008981251157820225, 0.01624935306608677, -0.021088024601340294, 0.0234929621219635, 0.06210761517286301, 0.020447297021746635, 0.09602649509906769, 0.03780768811702728, 0.046017374843358994, -0.00047144334530457854, -0.14833872020244598, -3.418974543192564e-33, -0.020327283069491386, -0.009657439775764942, -0.05216822400689125, 0.09152525663375854, -0.01420655194669962, -0.0464029498398304, 0.005556488409638405, 0.04170574992895126, 0.02290281280875206, 0.056349560618400574, -0.06353980302810669, 0.006766280625015497, 0.09029892086982727, -0.007755443919450045, -0.05464736372232437, 0.02043803036212921, -0.06943882256746292, 0.0025152761954814196, 0.0192682184278965, -0.013094793073832989, -0.046199455857276917, 0.009774922393262386, 0.05272170156240463, 0.06705724447965622, -0.017703114077448845, 0.006406895350664854, -0.082687608897686, -0.02586892433464527, -0.08471881598234177, -0.018793649971485138, -0.030379487201571465, 0.002988900290802121, -0.018479861319065094, 0.03545838221907616, -0.061194296926259995, -0.07994961738586426, -0.08054158091545105, 0.08415934443473816, 0.049331072717905045, -0.11360859125852585, -0.003020175965502858, -0.025545289739966393, -0.016153808683156967, -0.02823798358440399, 0.0980992242693901, -0.005831061862409115, -0.01784936897456646, -0.03231519088149071, 0.008044887334108353, 0.013219932094216347, -0.02815658040344715, 0.03540811687707901, -0.0007810536189936101, 0.022517330944538116, 0.003157684113830328, -0.0836513489484787, -0.09690794348716736, 0.08350484073162079, 0.00611130241304636, 0.003261416917666793, 0.07670614868402481, -0.07611608505249023, -0.046506866812705994, -0.011767443269491196, -0.06389105319976807, 0.002720271237194538, -0.17270393669605255, 0.017519982531666756, 0.05022631958127022, -0.003289880696684122, -0.07669111341238022, -0.05236365646123886, -0.0065403105691075325, -0.02948043681681156, -0.07555332034826279, -0.04039924591779709, 0.09458396583795547, -0.12965525686740875, 0.0036195609718561172, 0.0566764734685421, -0.04879520833492279, 0.10165441781282425, -0.12706038355827332, -0.013552514836192131, 0.006914444267749786, 0.01326256524771452, -0.07338210195302963, 0.0005600048461928964, 0.009221133776009083, 0.012906602583825588, -0.010523078963160515, 0.03068346530199051, -0.14059533178806305, -0.028436219319701195, -0.009370838291943073, -5.1910454601511447e-8, 0.02914341725409031, 0.08454474061727524, -0.07354786992073059, -0.026062889024615288, 0.004579809959977865, -0.04098975285887718, 0.0923423171043396, 0.00875423476099968, 0.0664687380194664, 0.09071087837219238, 0.016414295881986618, -0.007594572380185127, 0.024363838136196136, -0.016788532957434654, -0.02152233012020588, 0.029006781056523323, 0.0007351713138632476, 0.03002181276679039, 0.009348243474960327, -0.019646847620606422, 0.01033846940845251, -0.008549690246582031, -0.04977813735604286, 0.16174905002117157, -0.011176162399351597, -0.0024608075618743896, 0.041243910789489746, 0.026110531762242317, -0.018747784197330475, -0.02306458353996277, -0.1076766699552536, -0.001451937947422266, -0.02665523998439312, 0.0013187305303290486, -0.05672360956668854, 0.04066077992320061, -0.05127653107047081, 0.01064186543226242, 0.0706789568066597, 0.05576541647315025, -0.004382999148219824, 0.02684066630899906, 0.045507289469242096, -0.003136478364467621, -0.08550426363945007, -0.03535694628953934, -0.02317904308438301, 0.09482340514659882, -0.017192641273140907, 0.038326483219861984, 0.015201883390545845, -0.07036156207323074, -0.035277366638183594, -0.026852967217564583, 0.02119344100356102, -0.008680952712893486, 0.03175899758934975, -0.048005182296037674, -0.04303688928484917, -0.017380738630890846, 0.022051723673939705, -0.06048206612467766, -0.005717145279049873, -0.06294582039117813 ]
-0.010788
set to `0` then Node.js will choose an appropriate size of the thread pool based on an estimate of the amount of parallelism. The amount of parallelism refers to the number of computations that can be carried out simultaneously in a given machine. In general, it's the same as the amount of CPUs, but it may diverge in environments such as VMs or containers. ### `-v`, `--version` Print node's version. ### `--watch` Starts Node.js in watch mode. When in watch mode, changes in the watched files cause the Node.js process to restart. By default, watch mode will watch the entry point and any required or imported module. Use `--watch-path` to specify what paths to watch. This flag cannot be combined with `--check`, `--eval`, `--interactive`, or the REPL. Note: The `--watch` flag requires a file path as an argument and is incompatible with `--run` or inline script input, as `--run` takes precedence and ignores watch mode. If no file is provided, Node.js will exit with status code `9`. ```bash node --watch index.js ``` ### `--watch-kill-signal` > Stability: 1.1 - Active Development Customizes the signal sent to the process on watch mode restarts. ```bash node --watch --watch-kill-signal SIGINT test.js ``` ### `--watch-path` Starts Node.js in watch mode and specifies what paths to watch. When in watch mode, changes in the watched paths cause the Node.js process to restart. This will turn off watching of required or imported modules, even when used in combination with `--watch`. This flag cannot be combined with `--check`, `--eval`, `--interactive`, `--test`, or the REPL. Note: Using `--watch-path` implicitly enables `--watch`, which requires a file path and is incompatible with `--run`, as `--run` takes precedence and ignores watch mode. ```bash node --watch-path=./src --watch-path=./tests index.js ``` This option is only supported on macOS and Windows. An `ERR\_FEATURE\_UNAVAILABLE\_ON\_PLATFORM` exception will be thrown when the option is used on a platform that does not support it. ### `--watch-preserve-output` Disable the clearing of the console when watch mode restarts the process. ```bash node --watch --watch-preserve-output test.js ``` ### `--zero-fill-buffers` Automatically zero-fills all newly allocated [`Buffer`][] instances. ## Environment variables > Stability: 2 - Stable ### `FORCE\_COLOR=[1, 2, 3]` The `FORCE\_COLOR` environment variable is used to enable ANSI colorized output. The value may be: \* `1`, `true`, or the empty string `''` indicate 16-color support, \* `2` to indicate 256-color support, or \* `3` to indicate 16 million-color support. When `FORCE\_COLOR` is used and set to a supported value, both the `NO\_COLOR`, and `NODE\_DISABLE\_COLORS` environment variables are ignored. Any other value will result in colorized output being disabled. ### `NODE\_COMPILE\_CACHE=dir` Enable the [module compile cache][] for the Node.js instance. See the documentation of [module compile cache][] for details. ### `NODE\_COMPILE\_CACHE\_PORTABLE=1` When set to 1, the [module compile cache][] can be reused across different directory locations as long as the module layout relative to the cache directory remains the same. ### `NODE\_DEBUG=module[,…]` `','`-separated list of core modules that should print debug information. ### `NODE\_DEBUG\_NATIVE=module[,…]` `','`-separated list of core C++ modules that should print debug information. ### `NODE\_DISABLE\_COLORS=1` When set, colors will not be used in the REPL. ### `NODE\_DISABLE\_COMPILE\_CACHE=1` > Stability: 1.1 - Active Development Disable the [module compile cache][] for the Node.js instance. See the documentation of [module compile cache][] for details. ### `NODE\_EXTRA\_CA\_CERTS=file` When set, the well known "root" CAs (like VeriSign) will be extended with the extra certificates in `file`. The file should consist of one or more trusted certificates in PEM format. A message will be emitted (once) with [`process.emitWarning()`][emit\_warning] if the file is missing or malformed, but any errors are otherwise ignored. Neither the well known nor extra certificates are
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.04046914353966713, -0.05505605414509773, -0.020821332931518555, 0.05134427547454834, 0.10201586782932281, -0.04048175364732742, -0.05100882798433304, -0.040996525436639786, 0.09005311876535416, 0.01188813429325819, -0.07071755081415176, 0.057252123951911926, -0.03208073973655701, -0.07925216853618622, -0.051067039370536804, -0.0369480662047863, 0.07517222315073013, -0.012212233617901802, -0.008046424016356468, -0.0476357564330101, 0.005442656576633453, -0.10598974674940109, 0.06756694614887238, -0.01563749648630619, -0.0770806074142456, -0.005256102420389652, -0.06566430628299713, -0.023220660164952278, 0.0010227205930277705, -0.010553937405347824, -0.03257523477077484, -0.036317870020866394, -0.02991270273923874, 0.020995592698454857, -0.015228010714054108, 0.07302521914243698, -0.01146033313125372, -0.11035656183958054, -0.10651834309101105, 0.020773902535438538, 0.04218772426247597, 0.050850652158260345, -0.06481629610061646, -0.025595825165510178, 0.014268343336880207, 0.010897397994995117, -0.1054922416806221, 0.015126337297260761, -0.02810591831803322, -0.02817734144628048, -0.04583940654993057, -0.0773797556757927, -0.0017605582252144814, -0.0647735595703125, 0.024785883724689484, 0.007441891357302666, 0.015885628759860992, -0.016072135418653488, 0.02054964005947113, 0.07986383140087128, -0.008954018354415894, -0.06526662409305573, 0.014280272647738457, -0.006305503658950329, 0.04674871638417244, 0.02134334295988083, -0.023535719141364098, 0.006108914501965046, 0.04258834943175316, -0.0011451790342107415, 0.03976992517709732, 0.065411776304245, -0.028043460100889206, -0.011241603642702103, -0.10436437278985977, -0.08104561269283295, 0.01880049705505371, -0.03903794661164284, -0.020850151777267456, -0.011293391697108746, -0.0716271847486496, -0.040034856647253036, -0.009624868631362915, 0.026722365990281105, -0.06558485329151154, 0.002070856746286154, 0.0063039385713636875, -0.0031825231853872538, 0.038065966218709946, 0.02616308629512787, -0.035024456679821014, 0.030055047944188118, -0.08114942908287048, 0.032275665551424026, 0.01914755441248417, 0.11910529434680939, -0.03362974897027016, 0.10304565727710724, -0.011604340746998787, -0.03757385537028313, 0.04297882318496704, 0.000016016427252907306, 0.06974557787179947, -0.013413609936833382, 0.057419728487730026, -0.010748443193733692, 0.0008244879427365959, 0.037870682775974274, -0.012077709659934044, 0.039469555020332336, 0.10687711089849472, 0.05805286765098572, 0.06897623091936111, 0.014274908229708672, -0.031822480261325836, 0.04232476279139519, 0.060417283326387405, -0.02897682972252369, 0.003807714907452464, 0.21562959253787994, 0.12727908790111542, 0.05519159138202667, -0.005215814802795649, -0.06834262609481812, 0.09217595309019089, 0.0017859290819615126, 0.007468164432793856, -1.1284874194095619e-35, -0.011226850561797619, -0.028049064800143242, 0.024710286408662796, 0.023027576506137848, -0.015357449650764465, 0.021625768393278122, 0.03668259456753731, -0.006202458404004574, -0.09893423318862915, 0.041390642523765564, -0.004606645554304123, 0.018817728385329247, -0.03192208707332611, 0.033663030713796616, 0.0338217131793499, -0.05439554899930954, 0.09521321207284927, -0.0480322390794754, 0.0293089859187603, -0.03747738525271416, 0.02066424861550331, -0.08315375447273254, -0.0799412652850151, 0.07034061849117279, 0.021109063178300858, -0.08504948019981384, 0.026407672092318535, -0.025659775361418724, -0.022233230993151665, 0.013353831134736538, 0.02016414888203144, 0.04812585934996605, -0.04498221352696419, 0.037557151168584824, -0.02708202786743641, -0.011499105952680111, -0.048309311270713806, 0.049999915063381195, -0.050610318779945374, -0.032162174582481384, -0.042651258409023285, 0.08194021135568619, -0.05543899908661842, -0.08864039927721024, -0.08086705207824707, -0.09827244281768799, -0.01630369760096073, -0.007364435587078333, 0.01823875866830349, 0.01812656596302986, 0.09032650291919708, 0.01572071574628353, 0.02891058847308159, -0.03052593395113945, 0.05903126299381256, 0.07693172991275787, 0.0634545311331749, -0.03261329233646393, -0.022479277104139328, 0.09182132035493851, 0.047723136842250824, -0.05022924765944481, -0.02393851988017559, 0.04882294312119484, -0.01521331537514925, 0.06012444198131561, 0.013462597504258156, -0.037767961621284485, -0.01127482671290636, 0.07467014342546463, -0.09114675223827362, 0.00435258075594902, 0.014771293848752975, 0.04665572941303253, 0.013553730212152004, 0.0039049233309924603, -0.04613638296723366, -0.05194133520126343, -0.015627706423401833, 0.01139699388295412, 0.017549846321344376, 0.003984455950558186, -0.00009358846000395715, 0.03388981148600578, -0.008403521962463856, -0.03684445098042488, -0.05520099028944969, 0.028680244460701942, 0.042511336505413055, -0.053742896765470505, 0.1243337094783783, -0.04056648164987564, 0.053276289254426956, -0.10456597059965134, -0.1241409182548523, -2.6824244766467038e-33, -0.06829936802387238, -0.08519792556762695, -0.03314529359340668, 0.05782701075077057, 0.016757221892476082, -0.04812239482998848, -0.10860973596572876, -0.03944956138730049, 0.010671957395970821, 0.018733207136392593, -0.027983564883470535, -0.025346962735056877, -0.018480585888028145, 0.07817515730857849, -0.0003865115577355027, 0.03412207216024399, -0.001914267078973353, -0.02681300975382328, 0.046972427517175674, -0.009177766740322113, -0.03092612512409687, -0.03559805080294609, 0.14806923270225525, -0.03120020590722561, 0.019115222617983818, -0.02781832590699196, -0.024098003283143044, -0.04984867200255394, 0.027782686054706573, -0.05643078684806824, -0.0575157068669796, -0.04533972218632698, 0.0025586839765310287, 0.12354978173971176, 0.05432983115315437, -0.015507522039115429, 0.01632610522210598, 0.04525741562247276, 0.06740418076515198, -0.011930993758141994, 0.047692492604255676, 0.029447447508573532, 0.013432417064905167, -0.031029624864459038, -0.013928371481597424, 0.007262337487190962, -0.07110616564750671, 0.040558457374572754, -0.05801229923963547, -0.07003413140773773, -0.09517297148704529, 0.010521911084651947, 0.03434285521507263, 0.07815353572368622, -0.021052243188023567, -0.0658544972538948, 0.012540241703391075, 0.03536781296133995, 0.03729955852031708, 0.021078331395983696, 0.09736515581607819, -0.10221647471189499, -0.07986123114824295, 0.034564364701509476, -0.025745125487446785, 0.04966481775045395, -0.03457340970635414, -0.02333460934460163, 0.062120165675878525, 0.008138606324791908, 0.03287407383322716, 0.08675990253686905, -0.06311199814081192, -0.015708982944488525, -0.08416584134101868, -0.013258588500320911, -0.006517022382467985, -0.06916148960590363, -0.030317557975649834, 0.020606255158782005, -0.02369457669556141, 0.11141233146190643, 0.008387082256376743, -0.03720230981707573, -0.003383306320756674, 0.05951089411973953, -0.001272526802495122, 0.054891180247068405, 0.03596911579370499, 0.01005785632878542, -0.030481969937682152, 0.00428323820233345, -0.07762026786804199, -0.02237056754529476, -0.021432388573884964, -5.396270097435263e-8, 0.002369946101680398, -0.0056090890429914, -0.044992655515670776, 0.05525374412536621, 0.04652433469891548, -0.03064577281475067, -0.006190599408000708, 0.0013320253929123282, 0.018364708870649338, 0.1286354959011078, 0.07435080409049988, -0.03004842810332775, 0.025519810616970062, -0.026607638224959373, 0.06923636794090271, 0.0004979692166671157, 0.04374676197767258, 0.023290596902370453, 0.0004949880531057715, 0.0012168483808636665, 0.028038013726472855, 0.027074100449681282, -0.04936232417821884, 0.13313235342502594, -0.02134040929377079, -0.05673794448375702, 0.058531492948532104, 0.0037871352396905422, -0.03431238606572151, -0.060519762337207794, -0.062244124710559845, 0.05051735043525696, -0.02732039801776409, -0.03411504998803139, -0.024988196790218353, -0.02549973875284195, -0.04420037195086479, 0.005284892860800028, 0.11053808778524399, 0.05883333832025528, -0.021181786432862282, 0.0000784579970058985, 0.04350968077778816, 0.007280394434928894, 0.0071328203193843365, -0.05750018730759621, 0.026847437024116516, -0.04164091497659683, 0.036544330418109894, -0.0524480864405632, 0.05301368609070778, -0.012357096187770367, -0.03064689412713051, 0.04145784303545952, 0.01987615041434765, 0.07889721542596817, 0.024031993001699448, -0.06601214408874512, -0.04166164994239807, -0.011781342327594757, 0.045862097293138504, -0.008259791880846024, -0.027291717007756233, -0.07395540922880173 ]
0.081726
be extended with the extra certificates in `file`. The file should consist of one or more trusted certificates in PEM format. A message will be emitted (once) with [`process.emitWarning()`][emit\_warning] if the file is missing or malformed, but any errors are otherwise ignored. Neither the well known nor extra certificates are used when the `ca` options property is explicitly specified for a TLS or HTTPS client or server. This environment variable is ignored when `node` runs as setuid root or has Linux file capabilities set. The `NODE\_EXTRA\_CA\_CERTS` environment variable is only read when the Node.js process is first launched. Changing the value at runtime using `process.env.NODE\_EXTRA\_CA\_CERTS` has no effect on the current process. ### `NODE\_ICU\_DATA=file` Data path for ICU (`Intl` object) data. Will extend linked-in data when compiled with small-icu support. ### `NODE\_NO\_WARNINGS=1` When set to `1`, process warnings are silenced. ### `NODE\_OPTIONS=options...` A space-separated list of command-line options. `options...` are interpreted before command-line options, so command-line options will override or compound after anything in `options...`. Node.js will exit with an error if an option that is not allowed in the environment is used, such as `-p` or a script file. If an option value contains a space, it can be escaped using double quotes: ```bash NODE\_OPTIONS='--require "./my path/file.js"' ``` A singleton flag passed as a command-line option will override the same flag passed into `NODE\_OPTIONS`: ```bash # The inspector will be available on port 5555 NODE\_OPTIONS='--inspect=localhost:4444' node --inspect=localhost:5555 ``` A flag that can be passed multiple times will be treated as if its `NODE\_OPTIONS` instances were passed first, and then its command-line instances afterwards: ```bash NODE\_OPTIONS='--require "./a.js"' node --require "./b.js" # is equivalent to: node --require "./a.js" --require "./b.js" ``` Node.js options that are allowed are in the following list. If an option supports both --XX and --no-XX variants, they are both supported but only one is included in the list below. \* `--allow-addons` \* `--allow-child-process` \* `--allow-fs-read` \* `--allow-fs-write` \* `--allow-inspector` \* `--allow-net` \* `--allow-wasi` \* `--allow-worker` \* `--conditions`, `-C` \* `--cpu-prof-dir` \* `--cpu-prof-interval` \* `--cpu-prof-name` \* `--cpu-prof` \* `--diagnostic-dir` \* `--disable-proto` \* `--disable-sigusr1` \* `--disable-warning` \* `--disable-wasm-trap-handler` \* `--dns-result-order` \* `--enable-fips` \* `--enable-network-family-autoselection` \* `--enable-source-maps` \* `--entry-url` \* `--experimental-abortcontroller` \* `--experimental-addon-modules` \* `--experimental-detect-module` \* `--experimental-eventsource` \* `--experimental-import-meta-resolve` \* `--experimental-json-modules` \* `--experimental-loader` \* `--experimental-modules` \* `--experimental-print-required-tla` \* `--experimental-quic` \* `--experimental-require-module` \* `--experimental-shadow-realm` \* `--experimental-specifier-resolution` \* `--experimental-test-isolation` \* `--experimental-top-level-await` \* `--experimental-transform-types` \* `--experimental-vm-modules` \* `--experimental-wasi-unstable-preview1` \* `--force-context-aware` \* `--force-fips` \* `--force-node-api-uncaught-exceptions-policy` \* `--frozen-intrinsics` \* `--heap-prof-dir` \* `--heap-prof-interval` \* `--heap-prof-name` \* `--heap-prof` \* `--heapsnapshot-near-heap-limit` \* `--heapsnapshot-signal` \* `--http-parser` \* `--icu-data-dir` \* `--import` \* `--input-type` \* `--insecure-http-parser` \* `--inspect-brk` \* `--inspect-port`, `--debug-port` \* `--inspect-publish-uid` \* `--inspect-wait` \* `--inspect` \* `--localstorage-file` \* `--max-http-header-size` \* `--max-old-space-size-percentage` \* `--napi-modules` \* `--network-family-autoselection-attempt-timeout` \* `--no-addons` \* `--no-async-context-frame` \* `--no-deprecation` \* `--no-experimental-global-navigator` \* `--no-experimental-repl-await` \* `--no-experimental-sqlite` \* `--no-experimental-strip-types` \* `--no-experimental-websocket` \* `--no-experimental-webstorage` \* `--no-extra-info-on-fatal-exception` \* `--no-force-async-hooks-checks` \* `--no-global-search-paths` \* `--no-network-family-autoselection` \* `--no-strip-types` \* `--no-warnings` \* `--no-webstorage` \* `--node-memory-debug` \* `--openssl-config` \* `--openssl-legacy-provider` \* `--openssl-shared-config` \* `--pending-deprecation` \* `--permission` \* `--preserve-symlinks-main` \* `--preserve-symlinks` \* `--prof-process` \* `--redirect-warnings` \* `--report-compact` \* `--report-dir`, `--report-directory` \* `--report-exclude-env` \* `--report-exclude-network` \* `--report-filename` \* `--report-on-fatalerror` \* `--report-on-signal` \* `--report-signal` \* `--report-uncaught-exception` \* `--require-module` \* `--require`, `-r` \* `--secure-heap-min` \* `--secure-heap` \* `--snapshot-blob` \* `--test-coverage-branches` \* `--test-coverage-exclude` \* `--test-coverage-functions` \* `--test-coverage-include` \* `--test-coverage-lines` \* `--test-global-setup` \* `--test-isolation` \* `--test-name-pattern` \* `--test-only` \* `--test-reporter-destination` \* `--test-reporter` \* `--test-rerun-failures` \* `--test-shard` \* `--test-skip-pattern` \* `--throw-deprecation` \* `--title` \* `--tls-cipher-list` \* `--tls-keylog` \* `--tls-max-v1.2` \* `--tls-max-v1.3` \* `--tls-min-v1.0` \* `--tls-min-v1.1` \* `--tls-min-v1.2` \* `--tls-min-v1.3` \* `--trace-deprecation` \* `--trace-env-js-stack` \* `--trace-env-native-stack` \* `--trace-env` \* `--trace-event-categories` \* `--trace-event-file-pattern` \* `--trace-events-enabled` \* `--trace-exit` \* `--trace-require-module` \* `--trace-sigint` \* `--trace-sync-io` \* `--trace-tls`
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.0347762405872345, 0.05685168504714966, -0.0009600024786777794, 0.06840389966964722, 0.09686112403869629, -0.06376434117555618, -0.027231091633439064, 0.11553123593330383, 0.004288611002266407, -0.01355817262083292, 0.013190023601055145, -0.030703498050570488, 0.058927081525325775, 0.02100262977182865, 0.02691696211695671, -0.0042485338635742664, -0.07157599925994873, 0.016955096274614334, 0.01877366006374359, -0.08379637449979782, 0.005503413267433643, -0.015862245112657547, 0.018647795543074608, 0.02027943916618824, -0.07350663095712662, -0.0773845985531807, -0.002257050946354866, 0.06405292451381683, -0.01925574243068695, 0.0004023379588034004, 0.047739844769239426, 0.034518513828516006, -0.04012732952833176, 0.006077618338167667, -0.005263357888907194, 0.09669210016727448, 0.06135561689734459, -0.0000979071410256438, -0.07185714691877365, -0.06231170520186424, 0.17537803947925568, 0.031894054263830185, -0.02377915009856224, -0.02984672412276268, 0.02054181694984436, -0.02285860851407051, -0.03227386623620987, -0.16537001729011536, -0.08763015270233154, -0.024167858064174652, 0.02549859881401062, 0.002412564819678664, -0.023035205900669098, 0.015433689579367638, -0.06859273463487625, -0.03814966231584549, -0.04987950995564461, 0.033303841948509216, 0.007656016852706671, 0.05328567698597908, 0.011811361648142338, -0.049384959042072296, 0.014424843713641167, -0.012137186713516712, 0.0009329597814939916, 0.040276121348142624, -0.04006010666489601, 0.045343779027462006, -0.027037639170885086, 0.07036998867988586, 0.05090334638953209, 0.030188361182808876, -0.036896511912345886, -0.041255466639995575, -0.03995842486619949, -0.056464649736881256, -0.08935171365737915, -0.043259188532829285, -0.025506461039185524, -0.054037027060985565, -0.029153453186154366, -0.02514798380434513, -0.003970643971115351, 0.0037705160211771727, -0.04415519908070564, 0.0760127380490303, 0.04433758929371834, -0.01631276309490204, 0.01139513123780489, 0.03793518245220184, 0.04255451634526253, -0.08719690889120102, -0.020515911281108856, 0.07416204363107681, 0.09978550672531128, 0.0632999837398529, 0.015840787440538406, -0.030288103967905045, 0.04452995955944061, -0.06466854363679886, -0.001745473244227469, 0.008427701890468597, -0.011203550733625889, 0.025192826986312866, 0.02124047465622425, 0.0402555912733078, -0.013650840148329735, 0.016795407980680466, 0.013760596513748169, 0.014633957296609879, 0.084969162940979, 0.04018731787800789, -0.02761067822575569, -0.09023506939411163, -0.01731054112315178, 0.10869629681110382, 0.04487333819270134, -0.025369232520461082, 0.056644219905138016, 0.0760154128074646, -0.006463308352977037, -0.0400804840028286, -0.03297785669565201, 0.03423085808753967, 0.024203287437558174, -0.0746815875172615, 0.032538630068302155, 5.316560747387582e-33, 0.00023979258548934013, 0.007542780134826899, 0.006110715214163065, 0.0011600404977798462, 0.07492668181657791, -0.00042200987809337676, 0.06164528429508209, -0.029928119853138924, -0.10330365598201752, -0.010749009437859058, -0.019273728132247925, 0.07996772974729538, -0.027490148320794106, -0.02487017959356308, -0.041463352739810944, -0.03729836270213127, -0.0004253180231899023, -0.003172188298776746, 0.08849934488534927, 0.03942828252911568, 0.058684658259153366, -0.01752946339547634, -0.023968864232301712, 0.0797322541475296, 0.07712727040052414, 0.010088646784424782, 0.039400968700647354, 0.04116204008460045, -0.007753452751785517, -0.03234327957034111, 0.05622914806008339, 0.04929855093359947, 0.022952178493142128, 0.05026021599769592, 0.012195369228720665, 0.013636883348226547, 0.07254302501678467, 0.038519661873579025, -0.09039781987667084, -0.0008141010766848922, 0.08737142384052277, 0.027997177094221115, 0.013331413269042969, 0.057385750114917755, -0.04677944630384445, -0.019842639565467834, -0.023618262261152267, -0.10868962854146957, 0.0840790793299675, 0.01078072376549244, -0.044131260365247726, 0.03680937737226486, -0.013907051645219326, -0.09030864387750626, 0.05751847103238106, -0.06523256003856659, -0.04238387197256088, -0.055722132325172424, -0.09615626186132431, -0.07872487604618073, 0.0182304959744215, -0.048625607043504715, -0.052528660744428635, 0.0037837971467524767, 0.02143760956823826, 0.04888803884387016, -0.01414155587553978, -0.005711818113923073, -0.057123057544231415, -0.05629510432481766, -0.12559448182582855, -0.01356551144272089, 0.04497843608260155, -0.01948973536491394, 0.04532337933778763, -0.018004216253757477, -0.042241595685482025, 0.04175123572349548, 0.025784168392419815, -0.06368713080883026, -0.012103763408958912, -0.05110812932252884, 0.009443334303796291, 0.07287565618753433, 0.037515077739953995, 0.00830258522182703, -0.08566364645957947, 0.052468109875917435, -0.006417702883481979, 0.01045285351574421, 0.020325668156147003, 0.03228919953107834, 0.04357675462961197, 0.06079311668872833, -0.1907808929681778, -5.7798032345794754e-33, 0.0031437280122190714, -0.018383288756012917, 0.03330883011221886, 0.0762951672077179, -0.01032373495399952, -0.0060733831487596035, -0.03438154235482216, 0.04089118167757988, 0.04649139568209648, 0.011645658873021603, -0.00824563205242157, -0.03455964848399162, 0.08250176906585693, -0.02637341059744358, -0.045664411038160324, 0.021373219788074493, -0.09138192981481552, 0.03893614932894707, 0.006459701806306839, -0.0005741955246776342, 0.05832016095519066, 0.01771218329668045, 0.04956058785319328, 0.01897394470870495, 0.022102229297161102, 0.04627099260687828, -0.024221083149313927, 0.00266117206774652, -0.04799376428127289, -0.09290128201246262, -0.04849035665392876, 0.002135366667062044, -0.034963458776474, 0.06159384548664093, -0.038437675684690475, -0.09320449829101562, 0.02802078239619732, 0.010888373479247093, 0.015107282437384129, 0.035572271794080734, 0.016637111082673073, 0.010499569587409496, -0.10051321983337402, 0.0527644157409668, 0.06769130378961563, 0.0035284447949379683, 0.0062035927549004555, 0.02683660201728344, -0.026784729212522507, 0.027462653815746307, -0.028086762875318527, -0.033926643431186676, 0.0208514966070652, 0.0507730171084404, 0.013125468045473099, -0.03669280931353569, 0.038243118673563004, 0.0747060775756836, -0.047628793865442276, -0.014641507528722286, 0.1023411974310875, -0.09521172940731049, -0.04152080416679382, -0.02181146666407585, -0.04119742289185524, 0.033881545066833496, -0.106828473508358, -0.0004767911450471729, 0.03742620348930359, -0.0021736326161772013, -0.006813313812017441, -0.05836953595280647, -0.07932261377573013, -0.08141825348138809, -0.021426700055599213, -0.007020879536867142, 0.015093781985342503, -0.1727645993232727, 0.0036581859458237886, 0.05550280958414078, -0.036813557147979736, 0.03154627978801727, -0.031117575243115425, 0.0728563666343689, 0.09026051312685013, 0.01747324876487255, 0.027118535712361336, 0.008500001393258572, 0.03343277424573898, 0.061673082411289215, -0.05973442271351814, 0.07578131556510925, -0.0074012791737914085, -0.007085888646543026, -0.039972901344299316, -5.5004356624976936e-8, -0.013996833004057407, 0.006115401163697243, -0.16351984441280365, -0.011275983415544033, 0.029520975425839424, -0.032189060002565384, 0.012581114657223225, -0.04706497862935066, 0.026968227699398994, 0.025065865367650986, 0.010346757248044014, -0.06412323564291, -0.008832970634102821, 0.014247464947402477, 0.024074416607618332, -0.018743246793746948, 0.005969935096800327, 0.014490187168121338, 0.020420486107468605, 0.002774781547486782, 0.018221348524093628, 0.0025458720047026873, -0.027523204684257507, 0.09641748666763306, -0.011199872940778732, 0.037338338792324066, 0.10208015888929367, 0.0352708138525486, -0.055130042135715485, -0.0025652083568274975, -0.16689403355121613, -0.05495670437812805, 0.03316181153059006, 0.030081534758210182, -0.0074776592664420605, 0.08621430397033691, 0.02840586006641388, -0.04934347793459892, 0.044911667704582214, 0.0944933295249939, 0.004063988104462624, 0.05549517646431923, -0.047662243247032166, 0.026440676301717758, -0.04365438222885132, -0.0016323656309396029, -0.04019550234079361, 0.008626306429505348, 0.004677439574152231, 0.030608516186475754, 0.05187980458140373, -0.031637050211429596, -0.020095909014344215, -0.026614120230078697, -0.08884403854608536, 0.06909852474927902, 0.01609012857079506, -0.019820785149931908, -0.0059148408472537994, -0.023995492607355118, 0.04040053114295006, -0.1291927546262741, 0.02572919800877571, -0.05338957533240318 ]
0.063953
\* `--test-rerun-failures` \* `--test-shard` \* `--test-skip-pattern` \* `--throw-deprecation` \* `--title` \* `--tls-cipher-list` \* `--tls-keylog` \* `--tls-max-v1.2` \* `--tls-max-v1.3` \* `--tls-min-v1.0` \* `--tls-min-v1.1` \* `--tls-min-v1.2` \* `--tls-min-v1.3` \* `--trace-deprecation` \* `--trace-env-js-stack` \* `--trace-env-native-stack` \* `--trace-env` \* `--trace-event-categories` \* `--trace-event-file-pattern` \* `--trace-events-enabled` \* `--trace-exit` \* `--trace-require-module` \* `--trace-sigint` \* `--trace-sync-io` \* `--trace-tls` \* `--trace-uncaught` \* `--trace-warnings` \* `--track-heap-objects` \* `--unhandled-rejections` \* `--use-bundled-ca` \* `--use-env-proxy` \* `--use-largepages` \* `--use-openssl-ca` \* `--use-system-ca` \* `--v8-pool-size` \* `--watch-kill-signal` \* `--watch-path` \* `--watch-preserve-output` \* `--watch` \* `--zero-fill-buffers` V8 options that are allowed are: \* `--abort-on-uncaught-exception` \* `--disallow-code-generation-from-strings` \* `--enable-etw-stack-walking` \* `--expose-gc` \* `--interpreted-frames-native-stack` \* `--jitless` \* `--max-old-space-size` \* `--max-semi-space-size` \* `--perf-basic-prof-only-functions` \* `--perf-basic-prof` \* `--perf-prof-unwinding-info` \* `--perf-prof` \* `--stack-trace-limit` `--perf-basic-prof-only-functions`, `--perf-basic-prof`, `--perf-prof-unwinding-info`, and `--perf-prof` are only available on Linux. `--enable-etw-stack-walking` is only available on Windows. ### `NODE\_PATH=path[:…]` `':'`-separated list of directories prefixed to the module search path. On Windows, this is a `';'`-separated list instead. ### `NODE\_PENDING\_DEPRECATION=1` When set to `1`, emit pending deprecation warnings. Pending deprecations are generally identical to a runtime deprecation with the notable exception that they are turned \_off\_ by default and will not be emitted unless either the `--pending-deprecation` command-line flag, or the `NODE\_PENDING\_DEPRECATION=1` environment variable, is set. Pending deprecations are used to provide a kind of selective "early warning" mechanism that developers may leverage to detect deprecated API usage. ### `NODE\_PENDING\_PIPE\_INSTANCES=instances` Set the number of pending pipe instance handles when the pipe server is waiting for connections. This setting applies to Windows only. ### `NODE\_PRESERVE\_SYMLINKS=1` When set to `1`, instructs the module loader to preserve symbolic links when resolving and caching modules. ### `NODE\_REDIRECT\_WARNINGS=file` When set, process warnings will be emitted to the given file instead of printing to stderr. The file will be created if it does not exist, and will be appended to if it does. If an error occurs while attempting to write the warning to the file, the warning will be written to stderr instead. This is equivalent to using the `--redirect-warnings=file` command-line flag. ### `NODE\_REPL\_EXTERNAL\_MODULE=file` Path to a Node.js module which will be loaded in place of the built-in REPL. Overriding this value to an empty string (`''`) will use the built-in REPL. ### `NODE\_REPL\_HISTORY=file` Path to the file used to store the persistent REPL history. The default path is `~/.node\_repl\_history`, which is overridden by this variable. Setting the value to an empty string (`''` or `' '`) disables persistent REPL history. ### `NODE\_SKIP\_PLATFORM\_CHECK=value` If `value` equals `'1'`, the check for a supported platform is skipped during Node.js startup. Node.js might not execute correctly. Any issues encountered on unsupported platforms will not be fixed. ### `NODE\_TEST\_CONTEXT=value` If `value` equals `'child'`, test reporter options will be overridden and test output will be sent to stdout in the TAP format. If any other value is provided, Node.js makes no guarantees about the reporter format used or its stability. ### `NODE\_TLS\_REJECT\_UNAUTHORIZED=value` If `value` equals `'0'`, certificate validation is disabled for TLS connections. This makes TLS, and HTTPS by extension, insecure. The use of this environment variable is strongly discouraged. ### `NODE\_USE\_ENV\_PROXY=1` > Stability: 1.1 - Active Development When enabled, Node.js parses the `HTTP\_PROXY`, `HTTPS\_PROXY` and `NO\_PROXY` environment variables during startup, and tunnels requests over the specified proxy. This can also be enabled using the [`--use-env-proxy`][] command-line flag. When both are set, `--use-env-proxy` takes precedence. ### `NODE\_USE\_SYSTEM\_CA=1` Node.js uses the trusted CA certificates present in the system store along with the `--use-bundled-ca` option and the `NODE\_EXTRA\_CA\_CERTS` environment variable. This can also be enabled using the [`--use-system-ca`][] command-line flag. When both are set, `--use-system-ca` takes precedence. ### `NODE\_V8\_COVERAGE=dir` When set, Node.js will begin outputting [V8 JavaScript code coverage][] and [Source Map][]
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.030475890263915062, 0.005415796302258968, -0.0446663573384285, -0.05070013925433159, 0.01127202995121479, -0.09770385175943375, -0.019629213958978653, -0.0650893822312355, 0.028212469071149826, -0.023755580186843872, 0.041666947305202484, -0.03709592670202255, 0.01287213247269392, -0.029349472373723984, 0.015926506370306015, -0.0015550663229078054, -0.061520833522081375, -0.0364818274974823, -0.01606050133705139, -0.08861387521028519, -0.025949392467737198, -0.03462835028767586, -0.06357354670763016, -0.04325864464044571, -0.07921575009822845, -0.030983682721853256, -0.06569220870733261, 0.09097180515527725, -0.056402258574962616, -0.050062648952007294, -0.011148516088724136, -0.03658473491668701, -0.0557229109108448, 0.036485228687524796, 0.07840541750192642, 0.04253449663519859, 0.04431666433811188, 0.009237450547516346, -0.07204809784889221, -0.023364923894405365, 0.04524826258420944, -0.06827983260154724, -0.06045274809002876, 0.014974613673985004, -0.010899853892624378, -0.08003482967615128, -0.06890250742435455, -0.06971744447946548, -0.05962333455681801, -0.03868153318762779, -0.022010881453752518, 0.029781626537442207, 0.0024086732883006334, -0.0038756942376494408, -0.003888578386977315, 0.014899663627147675, -0.07436123490333557, 0.06393779814243317, 0.0800263062119484, 0.005581431090831757, 0.019120650365948677, 0.009937118738889694, -0.05440499261021614, 0.04610452800989151, -0.006707076448947191, -0.019042296335101128, 0.010301763191819191, -0.04000532254576683, 0.05026226490736008, 0.07742193341255188, -0.13812227547168732, 0.03809080645442009, -0.0615091472864151, 0.03531252220273018, -0.04467952623963356, 0.06018523871898651, -0.04925553500652313, -0.049344293773174286, -0.10040440410375595, -0.11507716774940491, -0.035353563725948334, -0.10920343548059464, -0.023568112403154373, 0.02945411391556263, -0.02693942002952099, 0.09406208992004395, -0.06397875398397446, -0.057503290474414825, 0.02965201810002327, 0.00828599277883768, 0.02443055249750614, -0.04889531061053276, 0.0030140350572764874, 0.061038512736558914, 0.05065769702196121, 0.11758241802453995, 0.02182069979608059, 0.060861703008413315, -0.0028185502160340548, 0.0275101400911808, -0.0013347368221729994, -0.051261987537145615, 0.03430664911866188, -0.06378516554832458, -0.01829337887465954, 0.026666143909096718, -0.008833233267068863, 0.026840662583708763, 0.00016069086268544197, -0.03554784506559372, 0.0007452861173078418, 0.03292076662182808, 0.02538229152560234, -0.058549292385578156, 0.07446791976690292, 0.08376489579677582, -0.012755592353641987, 0.06584692001342773, -0.019357088953256607, 0.09129504859447479, 0.06299179047346115, 0.030571896582841873, -0.018854612484574318, -0.016946125775575638, -0.005733182188123465, -0.0017298685852438211, 0.04285728186368942, 3.774277261620201e-33, 0.06774032115936279, -0.07238467782735825, -0.03790300711989403, 0.0668904259800911, 0.08068086951971054, 0.06606384366750717, 0.057367730885744095, 0.005972330924123526, -0.0955553650856018, 0.09569928795099258, 0.014603478834033012, -0.045955173671245575, -0.05819449946284294, -0.04606902226805687, 0.08109874278306961, -0.003991384990513325, 0.07920125871896744, -0.0301304180175066, -0.0006144492072053254, 0.046186111867427826, 0.05083818733692169, -0.06828690320253372, -0.013816813006997108, -0.026810338720679283, 0.01021520234644413, 0.007444377057254314, 0.025514518842101097, 0.02566082403063774, 0.012969248928129673, 0.0009767623851075768, 0.06940391659736633, -0.03770795464515686, -0.05735579878091812, 0.01463212352246046, 0.055595170706510544, 0.047825105488300323, -0.000288451265078038, 0.05525701120495796, -0.03328431025147438, -0.02789481356739998, -0.0053659649565815926, -0.022035839036107063, -0.07956767827272415, -0.027306515723466873, 0.023816587403416634, -0.05294409394264221, -0.09052016586065292, -0.05622010678052902, 0.02904297038912773, 0.021169384941458702, -0.033826857805252075, 0.03572414070367813, -0.023541774600744247, -0.09409487247467041, 0.07525384426116943, -0.01889447495341301, -0.011164512485265732, 0.01620381511747837, -0.028710007667541504, 0.08296459168195724, -0.033613476902246475, 0.018755599856376648, -0.12163599580526352, 0.005014363676309586, 0.07317845523357391, 0.004759586416184902, 0.03690318018198013, -0.01654048264026642, -0.053431037813425064, 0.08338038623332977, -0.08734773844480515, 0.036202989518642426, 0.14926663041114807, 0.0688161700963974, 0.06756774336099625, -0.03411225602030754, -0.04703349620103836, 0.013361509889364243, 0.02288820594549179, -0.07245393097400665, -0.01197290513664484, -0.015217278152704239, -0.023202916607260704, 0.030858218669891357, -0.00413057766854763, 0.055427368730306625, -0.07008352875709534, -0.008552459068596363, 0.0001200391780002974, -0.012537380680441856, -0.01720256730914116, 0.009180999360978603, -0.010641169734299183, -0.10644368082284927, -0.12292896211147308, -7.55811790446831e-33, -0.00874037854373455, 0.01514402311295271, -0.00929019320756197, 0.008443532511591911, -0.0008545464370399714, -0.00053446862148121, -0.02564900368452072, 0.015055752359330654, 0.008953006938099861, 0.053578849881887436, 0.04278240725398064, -0.02347829006612301, 0.10585435479879379, -0.04910705238580704, -0.02428419515490532, 0.01150755025446415, -0.09505157917737961, -0.07190726697444916, 0.018781717866659164, -0.04896244406700134, -0.04860008880496025, 0.1282815933227539, 0.0006931520765647292, 0.12376806139945984, -0.030150409787893295, -0.014908243902027607, 0.006123244296759367, 0.03128168359398842, -0.03114767000079155, 0.018026456236839294, 0.083041250705719, 0.039347611367702484, -0.012651187367737293, 0.03778928145766258, -0.02721971459686756, -0.07242663204669952, -0.024564726278185844, 0.05250232666730881, 0.0732569694519043, 0.0024508442729711533, 0.0663815587759018, -0.05186111852526665, -0.019069485366344452, -0.08360987156629562, -0.02536056563258171, 0.03374302759766579, 0.0534726120531559, 0.005569926463067532, -0.05566293001174927, -0.02942591905593872, -0.0030056284740567207, -0.05986101180315018, 0.01999032497406006, 0.03814490884542465, 0.07847052067518234, 0.07013324648141861, -0.02677987702190876, 0.03278496116399765, -0.07100516557693481, -0.0010303986491635442, 0.04749085009098053, -0.027428265661001205, -0.020079277455806732, 0.0311210248619318, 0.07246484607458115, -0.006590868812054396, -0.08594749122858047, 0.03632345423102379, 0.002825136762112379, -0.02557818777859211, -0.053040917962789536, -0.01068167295306921, -0.04977383837103844, -0.058098021894693375, 0.087948277592659, -0.10788819193840027, -0.05303201079368591, -0.06103351339697838, 0.032319068908691406, 0.09304483234882355, -0.05882137268781662, 0.00597708486020565, -0.08480960875749588, 0.04087916016578674, 0.055811066180467606, -0.03066261298954487, -0.018472040072083473, 0.09401793032884598, 0.05166901275515556, -0.008555972948670387, 0.018735958263278008, 0.07052566856145859, -0.011353353038430214, 0.028455529361963272, 0.04292258992791176, -4.517275442594837e-8, 0.007577341049909592, -0.036729808896780014, -0.0624871626496315, 0.04899263381958008, 0.0333578996360302, 0.06876476109027863, 0.021620789542794228, 0.012038747780025005, -0.045612286776304245, -0.046857256442308426, -0.04098672792315483, 0.017690051347017288, -0.06360261142253876, -0.001436099293641746, -0.023013578727841377, -0.018978964537382126, -0.07426992058753967, 0.0326894074678421, -0.008015302941203117, -0.1204252615571022, 0.03857169672846794, -0.03624039888381958, -0.05896151438355446, 0.01668417826294899, -0.009817812591791153, 0.012794537469744682, 0.09763384610414505, 0.058837708085775375, -0.0424504354596138, 0.052132997661828995, -0.07031979411840439, -0.04302588105201721, 0.01658865064382553, -0.0739498883485794, -0.04507801681756973, 0.049411606043577194, -0.07303154468536377, 0.009303390048444271, 0.05201803892850876, 0.036836616694927216, -0.01088607870042324, 0.04626184701919556, 0.0631663128733635, 0.07303573191165924, -0.022306108847260475, -0.050419069826602936, -0.06018209829926491, 0.06321871280670166, 0.03768202289938927, -0.04572979733347893, -0.017227334901690483, 0.018383540213108063, 0.04488992318511009, 0.025283249095082283, -0.016623802483081818, 0.06312835961580276, 0.047570887953042984, -0.04949071258306503, -0.0271108727902174, -0.0014035019557923079, 0.11036378890275955, -0.05195428803563118, 0.04549180716276169, -0.01697787456214428 ]
0.024385
trusted CA certificates present in the system store along with the `--use-bundled-ca` option and the `NODE\_EXTRA\_CA\_CERTS` environment variable. This can also be enabled using the [`--use-system-ca`][] command-line flag. When both are set, `--use-system-ca` takes precedence. ### `NODE\_V8\_COVERAGE=dir` When set, Node.js will begin outputting [V8 JavaScript code coverage][] and [Source Map][] data to the directory provided as an argument (coverage information is written as JSON to files with a `coverage` prefix). `NODE\_V8\_COVERAGE` will automatically propagate to subprocesses, making it easier to instrument applications that call the `child\_process.spawn()` family of functions. `NODE\_V8\_COVERAGE` can be set to an empty string, to prevent propagation. #### Coverage output Coverage is output as an array of [ScriptCoverage][] objects on the top-level key `result`: ```json { "result": [ { "scriptId": "67", "url": "internal/tty.js", "functions": [] } ] } ``` #### Source map cache > Stability: 1 - Experimental If found, source map data is appended to the top-level key `source-map-cache` on the JSON coverage object. `source-map-cache` is an object with keys representing the files source maps were extracted from, and values which include the raw source-map URL (in the key `url`), the parsed Source Map v3 information (in the key `data`), and the line lengths of the source file (in the key `lineLengths`). ```json { "result": [ { "scriptId": "68", "url": "file:///absolute/path/to/source.js", "functions": [] } ], "source-map-cache": { "file:///absolute/path/to/source.js": { "url": "./path-to-map.json", "data": { "version": 3, "sources": [ "file:///absolute/path/to/original.js" ], "names": [ "Foo", "console", "info" ], "mappings": "MAAMA,IACJC,YAAaC", "sourceRoot": "./" }, "lineLengths": [ 13, 62, 38, 27 ] } } } ``` ### `NO\_COLOR=` [`NO\_COLOR`][] is an alias for `NODE\_DISABLE\_COLORS`. The value of the environment variable is arbitrary. ### `OPENSSL\_CONF=file` Load an OpenSSL configuration file on startup. Among other uses, this can be used to enable FIPS-compliant crypto if Node.js is built with `./configure --openssl-fips`. If the [`--openssl-config`][] command-line option is used, the environment variable is ignored. ### `SSL\_CERT\_DIR=dir` If `--use-openssl-ca` is enabled, or if `--use-system-ca` is enabled on platforms other than macOS and Windows, this overrides and sets OpenSSL's directory containing trusted certificates. Be aware that unless the child environment is explicitly set, this environment variable will be inherited by any child processes, and if they use OpenSSL, it may cause them to trust the same CAs as node. ### `SSL\_CERT\_FILE=file` If `--use-openssl-ca` is enabled, or if `--use-system-ca` is enabled on platforms other than macOS and Windows, this overrides and sets OpenSSL's file containing trusted certificates. Be aware that unless the child environment is explicitly set, this environment variable will be inherited by any child processes, and if they use OpenSSL, it may cause them to trust the same CAs as node. ### `TZ` The `TZ` environment variable is used to specify the timezone configuration. While Node.js does not support all of the various [ways that `TZ` is handled in other environments][], it does support basic [timezone IDs][] (such as `'Etc/UTC'`, `'Europe/Paris'`, or `'America/New\_York'`). It may support a few other abbreviations or aliases, but these are strongly discouraged and not guaranteed. ```console $ TZ=Europe/Dublin node -pe "new Date().toString()" Wed May 12 2021 20:30:48 GMT+0100 (Irish Standard Time) ``` ### `UV\_THREADPOOL\_SIZE=size` Set the number of threads used in libuv's threadpool to `size` threads. Asynchronous system APIs are used by Node.js whenever possible, but where they do not exist, libuv's threadpool is used to create asynchronous node APIs based on synchronous system APIs. Node.js APIs that use the threadpool are: \* all `fs` APIs, other than the file watcher APIs and those that are explicitly synchronous \* asynchronous crypto APIs such as `crypto.pbkdf2()`, `crypto.scrypt()`, `crypto.randomBytes()`, `crypto.randomFill()`, `crypto.generateKeyPair()` \* `dns.lookup()` \* all `zlib` APIs, other than those that are
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.10669520497322083, 0.05516975373029709, -0.043926503509283066, 0.04334355518221855, 0.09046096354722977, -0.07642489671707153, 0.013065214268863201, 0.06062498316168785, -0.008325004950165749, -0.01285951491445303, -0.008465454913675785, 0.002026037545874715, 0.05327534303069115, 0.00921645574271679, 0.0059202248230576515, -0.027408946305513382, 0.023521993309259415, 0.014312991872429848, 0.018826892599463463, -0.0969240739941597, -0.036210253834724426, 0.016189303249120712, 0.008743894286453724, 0.0057113636285066605, -0.04112114757299423, -0.06565819680690765, -0.03656723350286484, -0.01175861805677414, 0.004055582452565432, -0.006526237819343805, 0.060978829860687256, -0.03930069878697395, 0.001598685747012496, -0.02235857956111431, 0.02511492930352688, 0.11582295596599579, 0.048503343015909195, -0.08926008641719818, -0.06369960308074951, -0.01338907703757286, 0.10057894885540009, 0.08430014550685883, -0.049946922808885574, -0.002249034121632576, -0.0412510484457016, -0.05379766225814819, -0.06684840470552444, -0.07996764779090881, -0.06982523202896118, -0.013119355775415897, 0.0016871595289558172, -0.03885635733604431, -0.023672597482800484, -0.02786138653755188, -0.07338996231555939, -0.014027903787791729, -0.025947734713554382, 0.0333804115653038, 0.0013630582252517343, 0.07742816209793091, 0.012803361751139164, -0.039569754153490067, -0.01990921050310135, 0.0021443257573992014, 0.022578924894332886, 0.054460182785987854, -0.02809600532054901, 0.04069973900914192, 0.004782107193022966, 0.023722195997834206, 0.008963673375546932, 0.07767488062381744, 0.0093141570687294, -0.007131180260330439, -0.02487361431121826, -0.021205153316259384, -0.07845374196767807, -0.026236409321427345, -0.0047094691544771194, -0.10473179072141647, -0.029131902381777763, -0.06461914628744125, -0.0034667206928133965, 0.06249542906880379, -0.07343506067991257, 0.12365004420280457, 0.04763046279549599, -0.009457500651478767, 0.09896187484264374, 0.028080111369490623, -0.013514197431504726, -0.04566911607980728, -0.017025910317897797, 0.03926585614681244, 0.010660352185368538, 0.04751250520348549, 0.04573856294155121, -0.02945348247885704, 0.08794387429952621, -0.04186337813735008, 0.01029252354055643, -0.019223732873797417, 0.05575810372829437, -0.026945987716317177, 0.02954859659075737, 0.048777587711811066, -0.0738566666841507, -0.013289892114698887, 0.016923442482948303, 0.030057087540626526, 0.039626337587833405, 0.07061874866485596, -0.008481206372380257, -0.029040591791272163, -0.005691056605428457, 0.06731785088777542, 0.0624178983271122, -0.015664998441934586, 0.07179547846317291, 0.13037557899951935, 0.11861498653888702, 0.013750404119491577, -0.0088381078094244, -0.01590372435748577, 0.06396322697401047, -0.0612618662416935, 0.04787610471248627, 1.3068045084843258e-33, 0.027764534577727318, -0.06540098786354065, 0.018921930342912674, 0.05712006241083145, 0.0797840803861618, 0.025640113279223442, 0.06272710114717484, -0.006105321459472179, -0.07535873353481293, 0.05573680251836777, -0.049785323441028595, 0.08242033421993256, -0.05765165388584137, -0.07411506772041321, 0.010134248994290829, 0.04071579501032829, -0.02611495368182659, -0.03356429934501648, -0.002252803649753332, 0.08447891473770142, 0.06020468473434448, -0.004250845871865749, -0.037779800593853, 0.073760487139225, 0.019628165289759636, -0.04352954775094986, 0.008189883083105087, 0.06399451941251755, 0.00026236841222271323, 0.012120545841753483, 0.026723645627498627, 0.06694118678569794, -0.0202453825622797, 0.1158686950802803, 0.025603430345654488, 0.030992476269602776, 0.02089606039226055, 0.002941200975328684, -0.06467965990304947, 0.02322637476027012, 0.07364995032548904, -0.016014711931347847, -0.028261594474315643, 0.018397066742181778, -0.0317440927028656, -0.10129168629646301, -0.09983597695827484, -0.11178615689277649, 0.07987833023071289, 0.02362956665456295, -0.03161649778485298, 0.03515779599547386, 0.040054842829704285, -0.1137893795967102, 0.046144794672727585, -0.05832283943891525, -0.005516129080206156, -0.07056624442338943, -0.03361022099852562, -0.0230792798101902, 0.006264622323215008, 0.005851833149790764, -0.04515109956264496, 0.004434478469192982, -0.01529229711741209, -0.05764860287308693, 0.041370321065187454, -0.05160188674926758, -0.02732996642589569, 0.0430164709687233, -0.035724468529224396, 0.05569583550095558, 0.00011193360842298716, 0.01917155459523201, 0.01760304532945156, -0.010348305106163025, -0.034655630588531494, 0.06039316952228546, -0.0019469099352136254, -0.036174383014440536, 0.04192129895091057, -0.04179875925183296, -0.08152606338262558, 0.05606519430875778, 0.04719934239983559, 0.01338253915309906, -0.08261143416166306, 0.08064242452383041, -0.021768497303128242, -0.026653170585632324, 0.06219266355037689, -0.04376525059342384, 0.030949091538786888, -0.03825147822499275, -0.10714901238679886, -3.839474219078636e-33, 0.054907333105802536, -0.018483182415366173, 0.025649962946772575, 0.07191092520952225, -0.08308940380811691, -0.06520600616931915, 0.0029664537869393826, -0.049632761627435684, 0.01466132141649723, 0.032714031636714935, -0.08796641230583191, 0.016099506989121437, 0.04680490866303444, -0.002200345043092966, 0.014854309149086475, 0.009692693129181862, -0.09171592444181442, -0.028490744531154633, 0.018805256113409996, -0.05990409106016159, -0.029964545741677284, 0.02428569830954075, 0.04333951696753502, 0.05707353353500366, -0.003914279397577047, -0.08193086832761765, -0.08063844591379166, 0.01608157716691494, 0.009448448196053505, -0.02971324324607849, -0.06622276455163956, 0.0620664581656456, -0.03902038186788559, 0.03478110209107399, -0.06814098358154297, -0.10239994525909424, 0.02173924632370472, 0.07351409643888474, 0.06802376359701157, -0.02728959731757641, -0.013624897226691246, -0.05028500780463219, -0.039146725088357925, 0.029506143182516098, 0.043819114565849304, 0.056877341121435165, 0.03968213498592377, 0.005109043326228857, 0.004552517086267471, -0.006039746105670929, -0.030737239867448807, -0.016788046807050705, -0.01687917485833168, 0.017403073608875275, -0.03623931109905243, -0.04709610342979431, -0.013462013565003872, 0.02881968766450882, -0.06046541407704353, 0.0756814256310463, 0.09941885620355606, -0.07781223207712173, -0.022869668900966644, -0.043188296258449554, -0.11365736275911331, 0.02486480586230755, -0.11349746584892273, 0.0343533419072628, 0.10590272396802902, -0.021738721057772636, -0.013895012438297272, -0.05603601410984993, -0.003122869413346052, -0.057887665927410126, -0.05691402032971382, -0.03510329872369766, 0.01062418520450592, -0.14317968487739563, 0.03586426004767418, 0.0850350633263588, -0.013845877721905708, 0.07102355360984802, -0.06612025946378708, 0.053059451282024384, 0.08047574758529663, -0.03891319781541824, 0.011907891370356083, -0.03979269787669182, 0.027543623000383377, 0.0008764158119447529, 0.003058404428884387, 0.06890170276165009, -0.0915474221110344, -0.05189638212323189, -0.020179202780127525, -5.452355011925647e-8, -0.01400366984307766, 0.04676508530974388, -0.13328079879283905, 0.0146739911288023, 0.06687868386507034, 0.011565390042960644, 0.006225427612662315, 0.040871765464544296, 0.04717166721820831, 0.05132755637168884, 0.0061490293592214584, -0.043161600828170776, 0.017706871032714844, 0.008092195726931095, -0.0212562195956707, 0.048990629613399506, -0.0030915492679923773, 0.08042749017477036, -0.003934284206479788, 0.008369080722332, 0.027823511511087418, -0.012899139896035194, -0.01878933794796467, 0.1036372110247612, -0.04318181052803993, -0.0018672242294996977, 0.08197903633117676, 0.040326498448848724, 0.014843825250864029, -0.007683929987251759, -0.11471156775951385, -0.034507714211940765, -0.00755770830437541, -0.032488804310560226, -0.043296072632074356, 0.017395952716469765, -0.006331225391477346, -0.011613785289227962, 0.09515928477048874, 0.016190791502594948, 0.020428204908967018, 0.08864174783229828, -0.048067644238471985, 0.0451151467859745, -0.05749005824327469, -0.015342148952186108, -0.02776590920984745, 0.0492200143635273, -0.017358096316456795, 0.0005462481058202684, 0.048684705048799515, -0.056590840220451355, -0.0386863648891449, 0.05416080355644226, -0.06358765065670013, 0.016648100689053535, 0.02355450764298439, -0.07056902348995209, -0.00308020762167871, 0.026680195704102516, -0.03050614893436432, -0.025390947237610817, 0.13447777926921844, -0.048838406801223755 ]
0.093261
based on synchronous system APIs. Node.js APIs that use the threadpool are: \* all `fs` APIs, other than the file watcher APIs and those that are explicitly synchronous \* asynchronous crypto APIs such as `crypto.pbkdf2()`, `crypto.scrypt()`, `crypto.randomBytes()`, `crypto.randomFill()`, `crypto.generateKeyPair()` \* `dns.lookup()` \* all `zlib` APIs, other than those that are explicitly synchronous Because libuv's threadpool has a fixed size, it means that if for whatever reason any of these APIs takes a long time, other (seemingly unrelated) APIs that run in libuv's threadpool will experience degraded performance. In order to mitigate this issue, one potential solution is to increase the size of libuv's threadpool by setting the `'UV\_THREADPOOL\_SIZE'` environment variable to a value greater than `4` (its current default value). However, setting this from inside the process using `process.env.UV\_THREADPOOL\_SIZE=size` is not guranteed to work as the threadpool would have been created as part of the runtime initialisation much before user code is run. For more information, see the [libuv threadpool documentation][]. ## Useful V8 options V8 has its own set of CLI options. Any V8 CLI option that is provided to `node` will be passed on to V8 to handle. V8's options have \_no stability guarantee\_. The V8 team themselves don't consider them to be part of their formal API, and reserve the right to change them at any time. Likewise, they are not covered by the Node.js stability guarantees. Many of the V8 options are of interest only to V8 developers. Despite this, there is a small set of V8 options that are widely applicable to Node.js, and they are documented here: ### `--abort-on-uncaught-exception` ### `--disallow-code-generation-from-strings` ### `--enable-etw-stack-walking` ### `--expose-gc` ### `--harmony-shadow-realm` ### `--heap-snapshot-on-oom` ### `--interpreted-frames-native-stack` ### `--jitless` ### `--max-old-space-size=SIZE` (in MiB) Sets the max memory size of V8's old memory section. As memory consumption approaches the limit, V8 will spend more time on garbage collection in an effort to free unused memory. On a machine with 2 GiB of memory, consider setting this to 1536 (1.5 GiB) to leave some memory for other uses and avoid swapping. ```bash node --max-old-space-size=1536 index.js ``` ### `--max-semi-space-size=SIZE` (in MiB) Sets the maximum [semi-space][] size for V8's [scavenge garbage collector][] in MiB (mebibytes). Increasing the max size of a semi-space may improve throughput for Node.js at the cost of more memory consumption. Since the young generation size of the V8 heap is three times (see [`YoungGenerationSizeFromSemiSpaceSize`][] in V8) the size of the semi-space, an increase of 1 MiB to semi-space applies to each of the three individual semi-spaces and causes the heap size to increase by 3 MiB. The throughput improvement depends on your workload (see [#42511][]). The default value depends on the memory limit. For example, on 64-bit systems with a memory limit of 512 MiB, the max size of a semi-space defaults to 1 MiB. For memory limits up to and including 2GiB, the default max size of a semi-space will be less than 16 MiB on 64-bit systems. To get the best configuration for your application, you should try different max-semi-space-size values when running benchmarks for your application. For example, benchmark on a 64-bit systems: ```bash for MiB in 16 32 64 128; do node --max-semi-space-size=$MiB index.js done ``` ### `--perf-basic-prof` ### `--perf-basic-prof-only-functions` ### `--perf-prof` ### `--perf-prof-unwinding-info` ### `--prof` ### `--security-revert` ### `--stack-trace-limit=limit` The maximum number of stack frames to collect in an error's stack trace. Setting it to 0 disables stack trace collection. The default value is 10. ```bash node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12 ``` [#42511]: https://github.com/nodejs/node/issues/42511 [Chrome DevTools Protocol]: https://chromedevtools.github.io/devtools-protocol/ [Chromium's policy for locally trusted certificates]: https://chromium.googlesource.com/chromium/src/+/main/net/data/ssl/chrome\_root\_store/faq.md#does-the-chrome-certificate-verifier-consider-local-trust-decisions [CommonJS module]: modules.md [DEP0025 warning]: deprecations.md#dep0025-requirenodesys [ECMAScript
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.05711369216442108, -0.030586810782551765, -0.03234759345650673, 0.01634591445326805, 0.11317341774702072, -0.08592820167541504, -0.0651525929570198, -0.0370827317237854, 0.09767676144838333, -0.03492950275540352, -0.06749533116817474, 0.05371616408228874, 0.008724899031221867, -0.0630459189414978, -0.00467814551666379, -0.07816203683614731, -0.001538377720862627, -0.028622353449463844, -0.021871192380785942, 0.032581623643636703, -0.03603636100888252, -0.05358794331550598, 0.02808607928454876, 0.011900022625923157, -0.04175714775919914, -0.07271932810544968, -0.049841590225696564, -0.05121021345257759, -0.026560401543974876, 0.00989061314612627, 0.036813803017139435, 0.040156394243240356, -0.05052100121974945, -0.04436046630144119, 0.021931519731879234, 0.09754005074501038, -0.01827131398022175, -0.04664615914225578, -0.11153075098991394, 0.004153700079768896, 0.04973559454083443, 0.038954462856054306, -0.041456691920757294, 0.010247218422591686, -0.0833616778254509, 0.08030491322278976, 0.05848978832364082, -0.003769237780943513, -0.022609340026974678, -0.05808142572641373, -0.038990553468465805, 0.018070759251713753, -0.008477438241243362, -0.06394977122545242, -0.0085816765204072, 0.02468734420835972, -0.030702047049999237, 0.04205342009663582, 0.0007386536453850567, 0.0771055743098259, -0.01992032863199711, 0.027863312512636185, 0.005265816114842892, 0.07391920685768127, 0.07240983098745346, 0.07110155373811722, 0.09403311461210251, 0.0074355704709887505, 0.009484665468335152, -0.007869898341596127, 0.028671687468886375, 0.12877947092056274, -0.027851710096001625, 0.07884497940540314, -0.03428913280367851, -0.029672453179955482, -0.013430221937596798, -0.05522772669792175, -0.006958882790058851, -0.10625701397657394, -0.04040183499455452, -0.07017920166254044, 0.06957801431417465, 0.015598000027239323, 0.0005776315229013562, -0.024554740637540817, -0.0075179655104875565, -0.08114925026893616, -0.012258971109986305, 0.030797267332673073, 0.10002901405096054, 0.0339135006070137, -0.02344038523733616, 0.05102486535906792, 0.08206629008054733, 0.08781851083040237, 0.08984989672899246, 0.058463919907808304, -0.0520428828895092, -0.01009861659258604, 0.01876644790172577, -0.01116166915744543, 0.030275406315922737, 0.025448966771364212, 0.06775315850973129, 0.03965900465846062, 0.02392796240746975, 0.010565054602921009, -0.08043443411588669, 0.03540017455816269, 0.11634806543588638, 0.02972874417901039, 0.03133608400821686, -0.009441874921321869, -0.019908994436264038, 0.06185505539178848, 0.01541063655167818, -0.05526430159807205, -0.030708208680152893, 0.1548461616039276, 0.05296904221177101, 0.04324579983949661, -0.015291458927094936, -0.025013063102960587, -0.008182727731764317, 0.039241254329681396, -0.007610907778143883, 4.924465790463177e-33, -0.06413791328668594, -0.05109657347202301, 0.019470276311039925, -0.06411024183034897, -0.04384509101510048, -0.0028980409260839224, 0.044784560799598694, 0.014742878265678883, -0.06175168976187706, -0.0033299666829407215, -0.04884880408644676, -0.024188773706555367, 0.01628345064818859, -0.0673774927854538, -0.005826187320053577, -0.05939614027738571, 0.018971186131238937, -0.007608282845467329, -0.024996159598231316, 0.05335185304284096, 0.06001615896821022, -0.05661122500896454, 0.0010540661169216037, 0.002203066600486636, -0.00319098774343729, -0.010892640799283981, 0.04697050526738167, -0.03552031144499779, -0.036711107939481735, 0.003923677373677492, 0.015909776091575623, -0.02915407158434391, -0.03340069204568863, 0.04660524055361748, 0.005667741876095533, -0.030316850170493126, -0.004290868993848562, -0.03904617205262184, -0.0812007263302803, -0.11413171142339706, 0.0050360653549432755, 0.04571763053536415, -0.10602738708257675, -0.019577311351895332, -0.02077067457139492, -0.025900285691022873, -0.06528305262327194, -0.027674594894051552, -0.06118571758270264, 0.07581614702939987, 0.10327047109603882, 0.0615791454911232, -0.08138784766197205, -0.0336032509803772, 0.015306424349546432, -0.043396979570388794, 0.06420580297708511, -0.041069988161325455, -0.01772620901465416, 0.09087201207876205, 0.02280971221625805, -0.03304065763950348, -0.03420928865671158, -0.003346762852743268, 0.041468702256679535, 0.021240131929516792, 0.04277334734797478, -0.007776145823299885, -0.0484754852950573, 0.008732526563107967, -0.023397833108901978, 0.011678523384034634, 0.025936413556337357, 0.019950907677412033, 0.07913517951965332, -0.011049977503716946, -0.07426169514656067, -0.028745559975504875, -0.0439881831407547, -0.0571318119764328, 0.029424626380205154, 0.02943827584385872, 0.03495222330093384, 0.04751882329583168, -0.040259044617414474, -0.029149938374757767, -0.02385491132736206, -0.054401133209466934, -0.04005344212055206, -0.06224007532000542, 0.08756668120622635, -0.02542767859995365, 0.08311604708433151, -0.0789513811469078, -0.11600103229284286, -5.626568729742159e-33, -0.022655462846159935, -0.1375579684972763, 0.011620055884122849, 0.09576073288917542, 0.06216186285018921, 0.03846940025687218, -0.07814738154411316, 0.013083781115710735, 0.0010260625276714563, -0.031199632212519646, -0.04032493010163307, -0.060168541967868805, 0.017016731202602386, -0.032706476747989655, 0.09613563865423203, 0.048184316605329514, 0.06729551404714584, 0.016957484185695648, 0.04676562547683716, -0.01704009808599949, 0.018470950424671173, 0.05108422040939331, 0.09378869831562042, -0.0090089812874794, 0.02428305521607399, -0.03906163573265076, -0.06590667366981506, -0.0015957840951159596, 0.04975562542676926, -0.04321211203932762, -0.05324215814471245, 0.06014304980635643, -0.06347350776195526, 0.00639520026743412, -0.007745738606899977, -0.007532474584877491, -0.03804970905184746, 0.011090991087257862, 0.03822273015975952, -0.014097029343247414, 0.09071061760187149, -0.02109997719526291, -0.016256680712103844, -0.054817453026771545, 0.01258578896522522, -0.029437018558382988, -0.12378043681383133, -0.04061900079250336, 0.003355667693540454, 0.038528650999069214, -0.0011822935193777084, -0.029594141989946365, 0.013178551569581032, 0.054363470524549484, 0.04251653701066971, 0.02441062405705452, -0.03642505779862404, 0.04482379928231239, 0.024393970146775246, 0.01904652826488018, 0.06320255249738693, -0.05441349744796753, -0.04451654478907585, 0.004126796033233404, 0.06418820470571518, 0.043429818004369736, -0.007064110599458218, -0.0034303050488233566, 0.061757612973451614, 0.03755753114819527, 0.07242686301469803, 0.016455503180623055, -0.05557449534535408, 0.0404956191778183, -0.07454613596200943, -0.008957329206168652, 0.09309840947389603, -0.06744667142629623, -0.0317780040204525, 0.04194175451993942, -0.03670487925410271, 0.11885850876569748, 0.029233895242214203, 0.044412761926651, -0.0008384919492527843, -0.02383926697075367, 0.01924576424062252, 0.02321556769311428, 0.05801534652709961, 0.02161562442779541, 0.026957256719470024, -0.03552556782960892, -0.015129112638533115, 0.0276581272482872, 0.04087580740451813, -4.9406523316974926e-8, 0.030830658972263336, 0.020222501829266548, -0.09250778704881668, 0.07213396579027176, 0.03946889564394951, -0.013448866084218025, -0.06898823380470276, 0.04687909781932831, -0.019222471863031387, 0.0468025840818882, 0.15121154487133026, -0.05529738590121269, -0.0026375316083431244, -0.04259742423892021, 0.064530149102211, 0.03080875240266323, -0.06788058578968048, -0.021591469645500183, -0.039559803903102875, -0.047389134764671326, 0.028158970177173615, 0.004650420043617487, -0.11251021176576614, 0.030757224187254906, -0.06131278723478317, -0.038488246500492096, 0.07839388400316238, -0.027752136811614037, 0.038742467761039734, -0.07620979845523834, -0.12740212678909302, -0.010842359624803066, -0.006952287629246712, -0.0821286290884018, -0.01685347408056259, 0.05186809226870537, -0.10594974458217621, -0.03917817398905754, 0.09016045928001404, 0.10862075537443161, -0.03050348535180092, 0.027428749948740005, 0.08463329076766968, 0.005751678720116615, -0.00213731755502522, -0.053839925676584244, -0.05884074792265892, 0.028349049389362335, 0.034093379974365234, 0.0323675312101841, -0.008389784954488277, -0.011845095083117485, -0.05905621871352196, 0.02423202432692051, -0.0011653954861685634, 0.040916215628385544, 0.021082021296024323, -0.09486399590969086, 0.01912541501224041, -0.02929694391787052, 0.020395560190081596, -0.021539177745580673, 0.0012331103207543492, -0.004044621251523495 ]
-0.073609
to collect in an error's stack trace. Setting it to 0 disables stack trace collection. The default value is 10. ```bash node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12 ``` [#42511]: https://github.com/nodejs/node/issues/42511 [Chrome DevTools Protocol]: https://chromedevtools.github.io/devtools-protocol/ [Chromium's policy for locally trusted certificates]: https://chromium.googlesource.com/chromium/src/+/main/net/data/ssl/chrome\_root\_store/faq.md#does-the-chrome-certificate-verifier-consider-local-trust-decisions [CommonJS module]: modules.md [DEP0025 warning]: deprecations.md#dep0025-requirenodesys [ECMAScript module]: esm.md#modules-ecmascript-modules [EventSource Web API]: https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events [ExperimentalWarning: `vm.measureMemory` is an experimental feature]: vm.md#vmmeasurememoryoptions [File System Permissions]: permissions.md#file-system-permissions [Loading ECMAScript modules using `require()`]: modules.md#loading-ecmascript-modules-using-require [Module resolution and loading]: packages.md#module-resolution-and-loading [Navigator API]: globals.md#navigator [Node.js issue tracker]: https://github.com/nodejs/node/issues [OSSL\_PROVIDER-legacy]: https://www.openssl.org/docs/man3.0/man7/OSSL\_PROVIDER-legacy.html [Permission Model]: permissions.md#permission-model [REPL]: repl.md [ScriptCoverage]: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-ScriptCoverage [ShadowRealm]: https://github.com/tc39/proposal-shadowrealm [Source Map]: https://tc39.es/ecma426/ [TypeScript type-stripping]: typescript.md#type-stripping [V8 Inspector integration for Node.js]: debugger.md#v8-inspector-integration-for-nodejs [V8 JavaScript code coverage]: https://v8project.blogspot.com/2017/12/javascript-code-coverage.html [`"type"`]: packages.md#type [`--allow-addons`]: #--allow-addons [`--allow-child-process`]: #--allow-child-process [`--allow-fs-read`]: #--allow-fs-read [`--allow-fs-write`]: #--allow-fs-write [`--allow-net`]: #--allow-net [`--allow-wasi`]: #--allow-wasi [`--allow-worker`]: #--allow-worker [`--build-snapshot`]: #--build-snapshot [`--cpu-prof-dir`]: #--cpu-prof-dir [`--diagnostic-dir`]: #--diagnostic-dirdirectory [`--disable-sigusr1`]: #--disable-sigusr1 [`--env-file-if-exists`]: #--env-file-if-existsfile [`--env-file`]: #--env-filefile [`--experimental-sea-config`]: single-executable-applications.md#1-generating-single-executable-preparation-blobs [`--heap-prof-dir`]: #--heap-prof-dir [`--import`]: #--importmodule [`--no-require-module`]: #--no-require-module [`--no-strip-types`]: #--no-strip-types [`--openssl-config`]: #--openssl-configfile [`--preserve-symlinks`]: #--preserve-symlinks [`--print`]: #-p---print-script [`--redirect-warnings`]: #--redirect-warningsfile [`--require`]: #-r---require-module [`--use-env-proxy`]: #--use-env-proxy [`--use-system-ca`]: #--use-system-ca [`AsyncLocalStorage`]: async\_context.md#class-asynclocalstorage [`Buffer`]: buffer.md#class-buffer [`CRYPTO\_secure\_malloc\_init`]: https://www.openssl.org/docs/man3.0/man3/CRYPTO\_secure\_malloc\_init.html [`ERR\_INVALID\_TYPESCRIPT\_SYNTAX`]: errors.md#err\_invalid\_typescript\_syntax [`ERR\_UNSUPPORTED\_TYPESCRIPT\_SYNTAX`]: errors.md#err\_unsupported\_typescript\_syntax [`NODE\_OPTIONS`]: #node\_optionsoptions [`NODE\_USE\_ENV\_PROXY=1`]: #node\_use\_env\_proxy1 [`NO\_COLOR`]: https://no-color.org [`Web Storage`]: https://developer.mozilla.org/en-US/docs/Web/API/Web\_Storage\_API [`YoungGenerationSizeFromSemiSpaceSize`]: https://chromium.googlesource.com/v8/v8.git/+/refs/tags/10.3.129/src/heap/heap.cc#328 [`dns.lookup()`]: dns.md#dnslookuphostname-options-callback [`dns.setDefaultResultOrder()`]: dns.md#dnssetdefaultresultorderorder [`dnsPromises.lookup()`]: dns.md#dnspromiseslookuphostname-options [`import.meta.url`]: esm.md#importmetaurl [`import` specifier]: esm.md#import-specifiers [`net.getDefaultAutoSelectFamilyAttemptTimeout()`]: net.md#netgetdefaultautoselectfamilyattempttimeout [`node:sqlite`]: sqlite.md [`process.setUncaughtExceptionCaptureCallback()`]: process.md#processsetuncaughtexceptioncapturecallbackfn [`tls.DEFAULT\_MAX\_VERSION`]: tls.md#tlsdefault\_max\_version [`tls.DEFAULT\_MIN\_VERSION`]: tls.md#tlsdefault\_min\_version [`unhandledRejection`]: process.md#event-unhandledrejection [`v8.startupSnapshot.addDeserializeCallback()`]: v8.md#v8startupsnapshotadddeserializecallbackcallback-data [`v8.startupSnapshot.setDeserializeMainFunction()`]: v8.md#v8startupsnapshotsetdeserializemainfunctioncallback-data [`v8.startupSnapshot` API]: v8.md#startup-snapshot-api [asynchronous module customization hooks]: module.md#asynchronous-customization-hooks [captured by the built-in snapshot of Node.js]: https://github.com/nodejs/node/blob/b19525a33cc84033af4addd0f80acd4dc33ce0cf/test/parallel/test-bootstrap-modules.js#L24 [collecting code coverage from tests]: test.md#collecting-code-coverage [conditional exports]: packages.md#conditional-exports [context-aware]: addons.md#context-aware-addons [debugger]: debugger.md [debugging security implications]: https://nodejs.org/en/docs/guides/debugging-getting-started/#security-implications [deprecation warnings]: deprecations.md#list-of-deprecated-apis [emit\_warning]: process.md#processemitwarningwarning-options [environment\_variables]: #environment-variables\_1 [filtering tests by name]: test.md#filtering-tests-by-name [global setup and teardown]: test.md#global-setup-and-teardown [jitless]: https://v8.dev/blog/jitless [libuv threadpool documentation]: https://docs.libuv.org/en/latest/threadpool.html [module compile cache]: module.md#module-compile-cache [preloading asynchronous module customization hooks]: module.md#registration-of-asynchronous-customization-hooks [remote code execution]: https://www.owasp.org/index.php/Code\_Injection [running tests from the command line]: test.md#running-tests-from-the-command-line [scavenge garbage collector]: https://v8.dev/blog/orinoco-parallel-scavenger [security warning]: #warning-binding-inspector-to-a-public-ipport-combination-is-insecure [semi-space]: https://www.memorymanagement.org/glossary/s.html#semi.space [single executable application]: single-executable-applications.md [snapshot testing]: test.md#snapshot-testing [syntax detection]: packages.md#syntax-detection [test reporters]: test.md#test-reporters [test reruns]: test.md#rerunning-failed-tests [test runner execution model]: test.md#test-runner-execution-model [timezone IDs]: https://en.wikipedia.org/wiki/List\_of\_tz\_database\_time\_zones [tracking issue for user-land snapshots]: https://github.com/nodejs/node/issues/44014 [ways that `TZ` is handled in other environments]: https://www.gnu.org/software/libc/manual/html\_node/TZ-Variable.html
https://github.com/nodejs/node/blob/main//doc/api/cli.md
main
nodejs
[ -0.061953697353601456, -0.014622336253523827, -0.0010002140188589692, 0.011314456351101398, 0.07437188178300858, -0.04667187109589577, -0.07036430388689041, 0.034633442759513855, 0.011593002825975418, -0.06288126111030579, 0.014568667858839035, -0.07142815738916397, 0.016104158014059067, -0.029615070670843124, -0.03245105221867561, 0.04984624683856964, -0.03566008806228638, 0.016686085611581802, 0.02233879268169403, -0.04241575673222542, -0.03817287087440491, -0.04963931068778038, -0.016272298991680145, 0.0312113706022501, -0.034469928592443466, -0.024665558710694313, -0.10956369340419769, -0.02874697372317314, 0.00808678101748228, -0.004149633459746838, 0.06268475949764252, -0.013482707552611828, -0.0004398251185193658, -0.016852043569087982, 0.013188178651034832, 0.107050821185112, -0.029334811493754387, -0.0210303645581007, -0.07208839803934097, 0.00856279768049717, 0.09658417105674744, 0.037686485797166824, -0.029814450070261955, -0.05027937889099121, -0.030956361442804337, -0.116875559091568, -0.010873420163989067, -0.081744484603405, -0.0640387162566185, -0.004303976893424988, 0.03628269582986832, 0.016320429742336273, 0.029110008850693703, -0.06146929785609245, -0.09066828340291977, 0.07419388741254807, -0.05217985436320305, 0.012700631283223629, 0.11607984453439713, 0.09912967681884766, -0.03505726158618927, -0.03888656944036484, 0.023062599822878838, -0.024854229763150215, 0.035659924149513245, 0.07462756335735321, 0.005515521392226219, -0.022771507501602173, -0.006636154837906361, 0.11275855451822281, 0.01872180961072445, 0.019606156274676323, -0.07389162480831146, 0.03003593161702156, -0.0009514305274933577, -0.00007786404603393748, -0.058748889714479446, -0.06931296736001968, -0.01276780292391777, -0.05029217526316643, -0.056058384478092194, -0.03524486720561981, 0.03583243489265442, 0.05050293356180191, -0.004717023111879826, 0.11725102365016937, -0.004903371911495924, 0.005516266915947199, 0.014265097677707672, 0.06263768672943115, 0.02815127559006214, -0.06614868342876434, -0.014799761585891247, 0.09640847146511078, 0.039603572338819504, 0.04881017655134201, 0.03289395570755005, 0.007936154492199421, -0.0033625394571572542, -0.034377194941043854, 0.058716364204883575, -0.0031160186044871807, 0.02911851927638054, -0.04126596078276634, -0.0016133359167724848, 0.0064862375147640705, -0.004962825682014227, 0.017486559227108955, -0.02876446209847927, 0.009245846420526505, 0.07817666232585907, 0.011989286169409752, 0.00902540609240532, -0.07346298545598984, 0.018916476517915726, 0.0905836969614029, 0.06951940804719925, -0.016765423119068146, 0.07715238630771637, 0.0908413901925087, 0.005842255428433418, 0.014215129427611828, -0.016374174505472183, -0.062441386282444, 0.018871959298849106, -0.05976910516619682, 0.045013926923274994, 4.347197779847629e-33, 0.06947045773267746, -0.02575373463332653, 0.0016933236038312316, -0.04265477880835533, 0.029433151707053185, 0.02619107812643051, 0.009428718127310276, -0.01038494985550642, -0.06576410681009293, 0.00710146501660347, 0.08699072897434235, 0.062375254929065704, -0.0482633113861084, -0.09439267963171005, 0.012283863499760628, 0.04627005010843277, 0.03184385970234871, 0.01589803211390972, 0.03526591509580612, -0.02396203577518463, -0.0014764787629246712, -0.09546034038066864, 0.01310868188738823, 0.014149202033877373, 0.01938071846961975, 0.022195685654878616, -0.014432580210268497, 0.09425275027751923, -0.009559957310557365, 0.01276903785765171, -0.024256251752376556, 0.041428644210100174, 0.04371612146496773, 0.03903144225478172, 0.0692850723862648, 0.02323257178068161, 0.0076857274398207664, 0.01643252559006214, -0.05614408105611801, -0.0058297282084822655, 0.03151964768767357, -0.02540399692952633, -0.025236232206225395, 0.07144652307033539, -0.002551188226789236, -0.11431578546762466, -0.052295707166194916, -0.0673026517033577, 0.049372851848602295, 0.04616990312933922, -0.08187296241521835, 0.020481739193201065, 0.018321173265576363, -0.10689274966716766, 0.04099121317267418, -0.05564283952116966, -0.0005435500061139464, -0.010799847543239594, -0.04193075746297836, 0.006953408941626549, 0.018401650711894035, -0.007784812245517969, -0.08930902183055878, 0.004735382739454508, 0.013836696743965149, -0.006654412019997835, -0.013131937943398952, 0.029419150203466415, -0.12253494560718536, -0.023777680471539497, -0.03466862067580223, 0.024114180356264114, 0.06389693170785904, 0.024135855957865715, 0.01719203218817711, -0.06042453274130821, -0.008730879053473473, 0.03510911017656326, 0.02937774918973446, -0.055337533354759216, 0.017907053232192993, -0.03193959221243858, 0.019315196201205254, -0.013040350750088692, 0.010995828546583652, 0.05563090741634369, -0.021352771669626236, 0.024770613759756088, -0.010060708969831467, 0.13770918548107147, -0.02456429786980152, -0.019182879477739334, 0.008331451565027237, -0.0006195034948177636, -0.14946943521499634, -4.9116613509048604e-33, -0.06495413929224014, -0.002764918142929673, -0.01572006195783615, 0.087058424949646, -0.013198197819292545, -0.07476527243852615, -0.0104549964889884, 0.04263192415237427, 0.05962409824132919, 0.016292497515678406, -0.022130146622657776, -0.004518911242485046, 0.04075508937239647, 0.024291973561048508, 0.012817497365176678, 0.04846617579460144, -0.06141740083694458, -0.017993571236729622, 0.0116517823189497, -0.10527150332927704, 0.030148768797516823, -0.016123343259096146, 0.02449820190668106, 0.1442917138338089, -0.033573441207408905, 0.01587861031293869, -0.03164549544453621, -0.0510098896920681, 0.02576887235045433, -0.03881656751036644, -0.018359405919909477, 0.0701407939195633, -0.02708486281335354, 0.08982986211776733, -0.012211905792355537, -0.08493795990943909, -0.02857852354645729, 0.033704690635204315, 0.12160443514585495, -0.037173062562942505, -0.02327970787882805, 0.0016749621136114001, -0.027000052854418755, -0.012894566170871258, 0.07392030209302902, -0.023894954472780228, 0.060714270919561386, 0.018644023686647415, 0.036785587668418884, -0.02650364488363266, -0.048671454191207886, -0.030797500163316727, 0.036187756806612015, 0.08498643338680267, -0.007868790067732334, 0.03258978947997093, 0.01727626472711563, -0.004520209971815348, 0.030136533081531525, -0.09269695729017258, 0.011093581095337868, -0.0556098036468029, -0.14169049263000488, 0.06013108417391777, 0.04349210485816002, 0.07593457400798798, -0.07696838676929474, 0.02184327132999897, 0.03542482480406761, 0.08645205944776535, -0.046906329691410065, -0.04929522052407265, -0.008406829088926315, -0.08284913003444672, -0.030848916620016098, 0.005074784625321627, 0.010253985412418842, -0.08429090678691864, -0.0012181248748674989, -0.0006717941723763943, 0.032272398471832275, 0.04625120013952255, 0.01618560031056404, -0.06880851089954376, 0.06038716435432434, -0.028860757127404213, -0.06571873277425766, 0.06316492706537247, 0.01866917870938778, 0.072848841547966, 0.00835100281983614, -0.01655827835202217, -0.07091071456670761, -0.027374068275094032, 0.00033544295001775026, -5.117419377143051e-8, 0.032688338309526443, 0.04902159050107002, -0.1300903558731079, -0.009038940072059631, 0.1557704657316208, -0.0023887876886874437, 0.02205083519220352, -0.04224904626607895, 0.010386020876467228, 0.03687287122011185, -0.01916210725903511, 0.014857076108455658, -0.04432443529367447, -0.0019066625973209739, 0.03680485114455223, 0.012215333990752697, -0.05220675840973854, 0.04552605003118515, 0.005528489593416452, -0.02797495387494564, 0.0014619033318012953, -0.02855563536286354, 0.012688393704593182, 0.09644512087106705, -0.052040938287973404, 0.022148845717310905, 0.08323325216770172, 0.13671715557575226, -0.03068639151751995, 0.03365128114819527, -0.11677524447441101, -0.0369335301220417, -0.0516810417175293, -0.059225596487522125, 0.025863133370876312, 0.07483416795730591, -0.014270969666540623, -0.06751679629087448, 0.014943530783057213, 0.04598624259233475, 0.03902142122387886, 0.04584015905857086, 0.002027677372097969, 0.03218051418662071, -0.07519112527370453, -0.03667953237891197, -0.08448368310928345, 0.07717147469520569, 0.10018640756607056, -0.023356346413493156, -0.048699814826250076, -0.09666551649570465, -0.030853327363729477, 0.0524410754442215, -0.06503218412399292, -0.0032222934532910585, 0.01928090676665306, -0.07516705244779587, -0.029271433129906654, -0.031951066106557846, 0.055952928960323334, -0.023523064330220222, 0.1163836196064949, -0.008477864786982536 ]
-0.056511
# Crypto > Stability: 2 - Stable The `node:crypto` module provides cryptographic functionality that includes a set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions. ```mjs const { createHmac } = await import('node:crypto'); const secret = 'abcdefg'; const hash = createHmac('sha256', secret) .update('I love cupcakes') .digest('hex'); console.log(hash); // Prints: // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e ``` ```cjs const { createHmac } = require('node:crypto'); const secret = 'abcdefg'; const hash = createHmac('sha256', secret) .update('I love cupcakes') .digest('hex'); console.log(hash); // Prints: // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e ``` ## 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 `crypto` or calling `require('node:crypto')` will result in an error being thrown. When using CommonJS, the error thrown can be caught using try/catch: ```cjs let crypto; try { crypto = require('node:crypto'); } catch (err) { console.error('crypto 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 crypto; try { crypto = await import('node:crypto'); } catch (err) { console.error('crypto support is disabled!'); } ``` ## Asymmetric key types The following table lists the asymmetric key types recognized by the [`KeyObject`][] API: | Key Type | Description | OID | | ---------------------------------- | ------------------ | ----------------------- | | `'dh'` | Diffie-Hellman | 1.2.840.113549.1.3.1 | | `'dsa'` | DSA | 1.2.840.10040.4.1 | | `'ec'` | Elliptic curve | 1.2.840.10045.2.1 | | `'ed25519'` | Ed25519 | 1.3.101.112 | | `'ed448'` | Ed448 | 1.3.101.113 | | `'ml-dsa-44'`[^openssl35] | ML-DSA-44 | 2.16.840.1.101.3.4.3.17 | | `'ml-dsa-65'`[^openssl35] | ML-DSA-65 | 2.16.840.1.101.3.4.3.18 | | `'ml-dsa-87'`[^openssl35] | ML-DSA-87 | 2.16.840.1.101.3.4.3.19 | | `'ml-kem-512'`[^openssl35] | ML-KEM-512 | 2.16.840.1.101.3.4.4.1 | | `'ml-kem-768'`[^openssl35] | ML-KEM-768 | 2.16.840.1.101.3.4.4.2 | | `'ml-kem-1024'`[^openssl35] | ML-KEM-1024 | 2.16.840.1.101.3.4.4.3 | | `'rsa-pss'` | RSA PSS | 1.2.840.113549.1.1.10 | | `'rsa'` | RSA | 1.2.840.113549.1.1.1 | | `'slh-dsa-sha2-128f'`[^openssl35] | SLH-DSA-SHA2-128f | 2.16.840.1.101.3.4.3.21 | | `'slh-dsa-sha2-128s'`[^openssl35] | SLH-DSA-SHA2-128s | 2.16.840.1.101.3.4.3.20 | | `'slh-dsa-sha2-192f'`[^openssl35] | SLH-DSA-SHA2-192f | 2.16.840.1.101.3.4.3.23 | | `'slh-dsa-sha2-192s'`[^openssl35] | SLH-DSA-SHA2-192s | 2.16.840.1.101.3.4.3.22 | | `'slh-dsa-sha2-256f'`[^openssl35] | SLH-DSA-SHA2-256f | 2.16.840.1.101.3.4.3.25 | | `'slh-dsa-sha2-256s'`[^openssl35] | SLH-DSA-SHA2-256s | 2.16.840.1.101.3.4.3.24 | | `'slh-dsa-shake-128f'`[^openssl35] | SLH-DSA-SHAKE-128f | 2.16.840.1.101.3.4.3.27 | | `'slh-dsa-shake-128s'`[^openssl35] | SLH-DSA-SHAKE-128s | 2.16.840.1.101.3.4.3.26 | | `'slh-dsa-shake-192f'`[^openssl35] | SLH-DSA-SHAKE-192f | 2.16.840.1.101.3.4.3.29 | | `'slh-dsa-shake-192s'`[^openssl35] | SLH-DSA-SHAKE-192s | 2.16.840.1.101.3.4.3.28 | | `'slh-dsa-shake-256f'`[^openssl35] | SLH-DSA-SHAKE-256f | 2.16.840.1.101.3.4.3.31 | | `'slh-dsa-shake-256s'`[^openssl35] | SLH-DSA-SHAKE-256s | 2.16.840.1.101.3.4.3.30 | | `'x25519'` | X25519 | 1.3.101.110 | | `'x448'` | X448 | 1.3.101.111 | ## Class: `Certificate` SPKAC is a Certificate Signing Request mechanism originally implemented by Netscape and was specified formally as part of HTML5's `keygen` element. `` is deprecated since [HTML 5.2][] and new projects should not use this element anymore. The `node:crypto` module provides the `Certificate` class for working with SPKAC data. The most common usage is handling output generated by the HTML5 `` element. Node.js uses [OpenSSL's SPKAC implementation][] internally. ### Static method: `Certificate.exportChallenge(spkac[, encoding])` \* `spkac` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `encoding` {string} The [encoding][] of the `spkac` string. \* Returns: {Buffer} The challenge component of the `spkac` data structure, which includes a public key and a challenge. ```mjs const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string ``` ```cjs const { Certificate
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.045105841010808945, 0.04560168832540512, -0.011013273149728775, 0.019839169457554817, 0.04667208343744278, -0.030177831649780273, 0.004481151234358549, 0.024999480694532394, 0.0134150804951787, -0.01930825598537922, -0.007253631949424744, -0.007269340101629496, 0.01763385348021984, -0.03744516149163246, 0.05310282111167908, 0.0008973354124464095, -0.057703014463186264, 0.02665908820927143, -0.06420022994279861, -0.0066564432345330715, 0.03177488222718239, -0.1280645877122879, 0.01930827647447586, -0.0065003870986402035, -0.026403846219182014, 0.000316966965328902, 0.023350536823272705, 0.06799031049013138, -0.013056879863142967, -0.08390553295612335, 0.10861393064260483, 0.041512630879879, -0.03331262990832329, 0.006944131106138229, -0.03776342794299126, 0.12911780178546906, 0.04474319517612457, -0.08548130095005035, 0.024525964632630348, -0.06385699659585953, -0.009333834052085876, 0.010670916177332401, -0.03840171918272972, -0.003181666601449251, -0.011182948015630245, 0.03430953249335289, -0.04600471258163452, 0.049974225461483, -0.02373095043003559, -0.006995184812694788, -0.007383844815194607, -0.038823217153549194, -0.010443850420415401, -0.005454818718135357, -0.028532300144433975, -0.01279036421328783, -0.08054231107234955, -0.01562407985329628, 0.043525055050849915, -0.022620676085352898, 0.020879153162240982, 0.03502483293414116, 0.06960705667734146, 0.014744918793439865, 0.0644012838602066, -0.02231842651963234, -0.022834869101643562, -0.01408400945365429, -0.002413907554000616, 0.06140441447496414, -0.023570293560624123, -0.00845581665635109, -0.02663096785545349, 0.027298010885715485, -0.036514606326818466, 0.0445096381008625, -0.045187827199697495, -0.08720315247774124, -0.02627047896385193, 0.05018002539873123, -0.11152265220880508, -0.043397970497608185, -0.006338836625218391, 0.047003280371427536, 0.0029418484773486853, 0.04540477320551872, 0.04114406928420067, -0.05714356526732445, 0.004069199785590172, 0.023049868643283844, 0.0174079779535532, 0.008621512912213802, 0.011321771889925003, 0.012311681173741817, 0.03131825849413872, -0.005524564068764448, 0.07322955131530762, 0.04465526342391968, -0.05598778277635574, 0.06883285194635391, -0.04769265279173851, 0.07768142223358154, 0.009267076849937439, -0.033668264746665955, 0.10535161197185516, 0.036843087524175644, -0.04792523384094238, 0.022427694872021675, 0.014529058709740639, -0.003675912506878376, 0.009886233136057854, -0.014653397724032402, -0.028136972337961197, -0.057514626532793045, -0.010168773122131824, 0.041802745312452316, -0.017117490991950035, -0.016182808205485344, 0.03153946250677109, 0.09362903237342834, 0.07881870120763779, 0.053363073617219925, 0.036985259503126144, 0.017293544486165047, -0.09969308972358704, -0.041968781501054764, -0.019050393253564835, 9.742463384152533e-33, -0.05434646084904671, -0.0244558397680521, 0.04228438436985016, 0.0768367275595665, 0.01173910591751337, 0.014646138995885849, 0.01648690365254879, 0.021597350016236305, -0.15302444994449615, 0.037654150277376175, -0.07684255391359329, -0.005316650029271841, -0.0030994589906185865, -0.018874404951930046, 0.04431614279747009, -0.08085623383522034, 0.05651276558637619, -0.06175891309976578, 0.024324342608451843, 0.03674899786710739, 0.03879876434803009, -0.004439860582351685, 0.07742880284786224, -0.0962834358215332, -0.024496756494045258, 0.04341208189725876, 0.033485911786556244, 0.010541566647589207, 0.05474761873483658, -0.0017166582401841879, 0.04367969557642937, 0.06465473771095276, 0.0030767922289669514, 0.0022670228499919176, 0.008340800181031227, -0.0018240336794406176, -0.055292706936597824, -0.005320461001247168, -0.04627833142876625, -0.07990362495183945, 0.0513472706079483, 0.01907159574329853, -0.03575315326452255, -0.01837378740310669, -0.004466061480343342, -0.02302802912890911, -0.01387153659015894, -0.010684933513402939, 0.06115884333848953, -0.042042993009090424, -0.006319763604551554, 0.0787685364484787, -0.07857660204172134, -0.009504461660981178, 0.042692940682172775, -0.1092693880200386, 0.06816012412309647, -0.022043544799089432, -0.05469335988163948, 0.018228309229016304, 0.00635173125192523, 0.0424310676753521, -0.04684583470225334, -0.06514685600996017, -0.03179566562175751, 0.03284263238310814, -0.0036067338660359383, 0.026899076998233795, -0.029917335137724876, 0.08972997218370438, -0.04702313244342804, 0.051296234130859375, 0.028052441775798798, 0.011007745750248432, -0.020820947363972664, -0.010266760364174843, -0.07544967532157898, 0.006115834694355726, 0.025521650910377502, -0.04590810090303421, 0.07926075905561447, 0.003556983545422554, -0.04237974062561989, 0.04795979708433151, -0.029285624623298645, 0.02742312103509903, -0.02519608661532402, -0.02974313497543335, -0.028061462566256523, 0.04847123101353645, -0.025486579164862633, -0.004141031298786402, 0.062289781868457794, -0.1184273287653923, -0.10944787412881851, -9.954794398109501e-33, -0.036235496401786804, -0.020372912287712097, -0.06684979051351547, 0.11155075579881668, -0.008907057344913483, -0.04499856382608414, -0.05565841123461723, 0.008567852899432182, 0.015572025440633297, 0.03555518388748169, 0.039826709777116776, -0.027094893157482147, 0.08056791126728058, 0.00863434188067913, 0.07267025113105774, 0.0018390084151178598, -0.05209772661328316, 0.07419208437204361, 0.016304291784763336, -0.05060375854372978, -0.06671509891748428, 0.09877577424049377, -0.06238870322704315, 0.06745840609073639, 0.03259976953268051, 0.06398683041334152, -0.008891178295016289, 0.015967857092618942, 0.039591234177351, 0.006627152673900127, -0.048492658883333206, 0.01583535224199295, -0.05448161065578461, 0.006941865663975477, 0.012289929203689098, -0.10897903889417648, -0.06835190206766129, 0.06915424764156342, 0.05380960553884506, -0.00031734214280731976, 0.04308810085058212, -0.025718582794070244, -0.012472513131797314, 0.04346546158194542, 0.014457957819104195, -0.03735734894871712, -0.009222582913935184, 0.12695780396461487, 0.08499313145875931, 0.03223891928792, -0.01577240414917469, -0.10077915340662003, -0.04196543991565704, -0.017221126705408096, 0.03927481919527054, 0.049671925604343414, -0.06898514926433563, 0.044416557997465134, 0.006741083227097988, -0.0003133674035780132, -0.01235909853130579, -0.03383823484182358, 0.07077895849943161, -0.0026131023187190294, 0.04780273139476776, 0.02154145948588848, -0.14103969931602478, -0.040286626666784286, 0.03638117015361786, 0.03067714534699917, -0.008931613527238369, 0.052296992391347885, -0.00893472321331501, -0.026155157014727592, 0.07004750519990921, -0.06506814062595367, -0.035152025520801544, -0.03614269196987152, 0.09132339805364609, 0.028601326048374176, -0.07353638112545013, 0.08958140015602112, -0.038413967937231064, 0.04044567421078682, 0.11445693671703339, -0.08145670592784882, 0.04331664368510246, 0.010201612487435341, -0.08538231253623962, 0.0034362568985670805, -0.01182450633496046, 0.09759965538978577, -0.032176874577999115, -0.009603338316082954, 0.09049522131681442, -6.27083522886096e-8, 0.0007370100356638432, -0.08108089119195938, -0.11050932854413986, -0.04344700276851654, 0.0800323635339737, 0.03205159679055214, -0.04797402024269104, -0.17804422974586487, -0.005074795801192522, -0.022646185010671616, 0.0629134476184845, 0.04603169858455658, -0.04422752931714058, -0.06631846725940704, -0.05055814981460571, 0.006341056898236275, -0.10426541417837143, 0.018518589437007904, -0.04639473184943199, -0.1064501404762268, -0.046025339514017105, 0.013809858821332455, 0.007172258570790291, -0.0005479215760715306, -0.0028017940931022167, -0.022399887442588806, 0.08877331018447876, 0.05049939081072807, -0.04376071318984032, 0.025177834555506706, -0.03106001578271389, -0.062457866966724396, 0.054771460592746735, -0.052075307816267014, -0.004287589341402054, 0.08838053047657013, -0.10129065066576004, -0.008161346428096294, 0.09900257736444473, 0.03028450906276703, 0.02939015068113804, 0.010742905549705029, -0.02998996526002884, 0.03438187390565872, -0.07269549369812012, -0.036311082541942596, 0.07559968531131744, 0.039598263800144196, -0.06569791585206985, 0.030980022624135017, -0.0594242662191391, 0.0013046212261542678, -0.0024104572366923094, -0.023127013817429543, 0.010581960901618004, 0.020985517650842667, -0.0120299207046628, -0.07373959571123123, 0.049240242689847946, -0.01839342713356018, 0.07217620313167572, -0.07531271874904633, 0.14005206525325775, -0.0400010347366333 ]
0.051164
string. \* Returns: {Buffer} The challenge component of the `spkac` data structure, which includes a public key and a challenge. ```mjs const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string ``` ```cjs const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string ``` ### Static method: `Certificate.exportPublicKey(spkac[, encoding])` \* `spkac` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `encoding` {string} The [encoding][] of the `spkac` string. \* Returns: {Buffer} The public key component of the `spkac` data structure, which includes a public key and a challenge. ```mjs const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as ``` ```cjs const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as ``` ### Static method: `Certificate.verifySpkac(spkac[, encoding])` \* `spkac` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `encoding` {string} The [encoding][] of the `spkac` string. \* Returns: {boolean} `true` if the given `spkac` data structure is valid, `false` otherwise. ```mjs import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false ``` ```cjs const { Buffer } = require('node:buffer'); const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false ``` ### Legacy API > Stability: 0 - Deprecated As a legacy interface, it is possible to create new instances of the `crypto.Certificate` class as illustrated in the examples below. #### `new crypto.Certificate()` Instances of the `Certificate` class can be created using the `new` keyword or by calling `crypto.Certificate()` as a function: ```mjs const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate(); ``` ```cjs const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate(); ``` #### `certificate.exportChallenge(spkac[, encoding])` \* `spkac` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `encoding` {string} The [encoding][] of the `spkac` string. \* Returns: {Buffer} The challenge component of the `spkac` data structure, which includes a public key and a challenge. ```mjs const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string ``` ```cjs const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string ``` #### `certificate.exportPublicKey(spkac[, encoding])` \* `spkac` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `encoding` {string} The [encoding][] of the `spkac` string. \* Returns: {Buffer} The public key component of the `spkac` data structure, which includes a public key and a challenge. ```mjs const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as ``` ```cjs const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as ``` #### `certificate.verifySpkac(spkac[, encoding])` \* `spkac` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `encoding` {string} The [encoding][] of the `spkac` string. \* Returns: {boolean} `true` if the given `spkac` data structure is valid, `false` otherwise. ```mjs import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false ``` ```cjs const { Buffer } = require('node:buffer'); const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false ``` ## Class: `Cipheriv` \* Extends: {stream.Transform} Instances of the `Cipheriv`
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.007587343920022249, 0.06839065253734589, -0.0715939924120903, 0.04394374042749405, -0.029765181243419647, 0.02333923988044262, 0.04233410954475403, 0.031306736171245575, 0.04462626576423645, -0.05037236213684082, -0.03881245478987694, -0.10336101800203323, -0.005096593406051397, 0.05276067182421684, 0.011436804197728634, -0.04762599989771843, -0.053763508796691895, -0.011771081015467644, -0.020307043567299843, -0.007577788084745407, 0.052121397107839584, -0.06278882920742035, -0.025305138900876045, -0.029535699635744095, 0.06326135247945786, -0.025392761453986168, 0.03482821583747864, 0.009281948208808899, -0.008082198910415173, 0.006339129526168108, 0.03572564199566841, -0.03864523395895958, -0.024821573868393898, 0.016403181478381157, 0.013357214629650116, 0.16645866632461548, -0.017876241356134415, -0.06192554533481598, 0.06330005079507828, -0.005052041262388229, 0.025789950042963028, 0.05488128587603569, -0.08272451162338257, 0.003203996457159519, 0.05509817600250244, 0.0829325020313263, -0.03882231190800667, -0.06956876069307327, -0.023759711533784866, 0.004064677283167839, -0.05714114010334015, 0.02552765980362892, -0.022431207820773125, -0.0354129858314991, 0.014351100660860538, -0.052848342806100845, -0.0169881172478199, 0.06101270765066147, 0.036867253482341766, 0.00067445810418576, 0.008592046797275543, -0.0977291539311409, 0.04719533398747444, 0.07857006043195724, 0.02578655071556568, -0.07640862464904785, -0.0053340415470302105, 0.012982144951820374, -0.025928929448127747, -0.011817211285233498, -0.06250286847352982, 0.009036814793944359, -0.03363482281565666, 0.054439105093479156, 0.01600298099219799, -0.005500324070453644, -0.08333290368318558, -0.03970657289028168, -0.011940834112465382, 0.0130271902307868, 0.06655417382717133, -0.049190595746040344, -0.04167841747403145, 0.07256047427654266, 0.06120261177420616, 0.07614457607269287, 0.011961781419813633, 0.007236840203404427, -0.020353280007839203, 0.0841795951128006, -0.012105325236916542, -0.025404293090105057, -0.0073004672303795815, 0.10436604917049408, 0.006731500383466482, 0.038327865302562714, 0.02979297935962677, 0.032626718282699585, -0.034909166395664215, -0.003556143958121538, -0.02093777246773243, -0.018572041764855385, 0.03419167548418045, -0.061057765036821365, -0.02198116108775139, -0.035721126943826675, -0.0050214603543281555, -0.09061698615550995, 0.05256747081875801, 0.010420724749565125, 0.019700126722455025, 0.050265632569789886, -0.03243686258792877, -0.040665533393621445, -0.04308195784687996, 0.05905599519610405, -0.0315503291785717, -0.05851205438375473, 0.04520079493522644, 0.02885565534234047, 0.042264629155397415, -0.05283594876527786, -0.020940471440553665, 0.05160912871360779, -0.04846528172492981, 0.006748199928551912, 0.06316415965557098, 2.041920563757679e-33, 0.022427434101700783, -0.03138807415962219, -0.003718805266544223, -0.004457930568605661, -0.04412524029612541, -0.010397903621196747, 0.04089930281043053, -0.029201695695519447, -0.047225698828697205, -0.05741804093122482, -0.06534820795059204, 0.021364351734519005, -0.009589524008333683, -0.017379164695739746, -0.011378249153494835, 0.007652346044778824, 0.042063672095537186, -0.04271739721298218, -0.012988835573196411, 0.06995124369859695, 0.08223739266395569, 0.020020365715026855, 0.045145560055971146, -0.01213913969695568, 0.004110550973564386, -0.027950430288910866, 0.04568290337920189, -0.07744287699460983, -0.019956300035119057, -0.021733049303293228, -0.019811686128377914, -0.030210809782147408, 0.004150629509240389, 0.030106212943792343, 0.08826985955238342, -0.01794588752090931, 0.1153423860669136, 0.01809987612068653, -0.14904743432998657, -0.005487007088959217, -0.014543425291776657, -0.029201971367001534, 0.018418338149785995, 0.04259359836578369, 0.01684962399303913, -0.08737936615943909, -0.033601272851228714, -0.09377329796552658, 0.04425855353474617, 0.019966090098023415, -0.059070806950330734, 0.070986807346344, -0.0052693565376102924, -0.020307010039687157, 0.025884374976158142, -0.07649415731430054, 0.08698612451553345, -0.0473414808511734, -0.09824109077453613, 0.00024571892572566867, -0.08133865892887115, 0.013365685008466244, 0.07403627038002014, -0.007635895162820816, -0.02781294845044613, -0.0013812921242788434, -0.0454624705016613, -0.02897030860185623, -0.026521911844611168, -0.056807778775691986, -0.04074321314692497, -0.04272959753870964, 0.030699046328663826, -0.006350518204271793, -0.04368986189365387, 0.042096320539712906, -0.08361031860113144, 0.04752708598971367, -0.02077544294297695, -0.08621932566165924, 0.0091450409963727, 0.002677388023585081, -0.02341902069747448, 0.057138726115226746, -0.02170552872121334, 0.050431132316589355, -0.0062249028123915195, -0.07657080143690109, 0.07273803651332855, 0.0012553100241348147, -0.03163653984665871, 0.026272008195519447, -0.017103655263781548, -0.03139684349298477, -0.04435352608561516, -3.9514161787654576e-33, 0.06467990577220917, 0.0007284344173967838, -0.04798018932342529, 0.06294721364974976, 0.014740834012627602, -0.01311654131859541, 0.04318540170788765, 0.05305523797869682, -0.030002068728208542, 0.04368000105023384, -0.02781691402196884, -0.024644799530506134, 0.07104889303445816, 0.013992054387927055, 0.06968477368354797, -0.05026882886886597, -0.02453180029988289, 0.16257816553115845, 0.03869808092713356, -0.0663895532488823, 0.014606157317757607, 0.05401463061571121, -0.01075747236609459, 0.03389495983719826, 0.04107564315199852, 0.056237414479255676, 0.006961904000490904, 0.0401424914598465, -0.005401698872447014, -0.006312661338597536, -0.017005188390612602, 0.05748380720615387, -0.058543380349874496, 0.0976574495434761, -0.057341087609529495, -0.05858989432454109, 0.039908889681100845, 0.025680450722575188, 0.030123919248580933, 0.03419584780931473, 0.055589642375707626, -0.05410408601164818, -0.05058716982603073, 0.06637924909591675, 0.06716501712799072, -0.06288882344961166, 0.03326297178864479, 0.0488528311252594, 0.07795868068933487, 0.021399743854999542, 0.0864063948392868, -0.030163399875164032, -0.08262646943330765, -0.024497395381331444, -0.01783079095184803, 0.012739565223455429, -0.11787175387144089, 0.033135589212179184, 0.03747781366109848, -0.00024468539049848914, -0.02575734257698059, -0.01636570505797863, 0.07320083677768707, -0.03882233425974846, 0.008502088487148285, 0.04417575150728226, -0.05126069858670235, 0.03309394046664238, 0.03704604506492615, -0.042919907718896866, -0.029034573584794998, 0.0049831680953502655, -0.03344003111124039, 0.03468514606356621, 0.057309284806251526, -0.033995646983385086, -0.09319378435611725, -0.009952045977115631, 0.13343000411987305, 0.1197296679019928, -0.012755234725773335, 0.0503137931227684, 0.0016818094300106168, 0.0781136080622673, 0.17518791556358337, -0.015460539609193802, -0.025625545531511307, -0.039126113057136536, -0.061103496700525284, -0.03213850408792496, 0.04883741959929466, 0.11443581432104111, -0.07929724454879761, 0.045735377818346024, 0.06491275131702423, -4.450332369287935e-8, -0.0137671809643507, -0.03286904841661453, -0.14552722871303558, -0.03522884100675583, 0.0183709766715765, -0.06778675317764282, -0.041200559586286545, -0.17874404788017273, 0.00863852072507143, -0.08857016265392303, -0.01420624926686287, -0.09853971004486084, -0.034333523362874985, -0.0407591238617897, -0.03208573907613754, -0.0000901221574167721, -0.01928878389298916, 0.029167871922254562, -0.03387785702943802, -0.002144766505807638, 0.052472472190856934, -0.04631660878658295, -0.07253023982048035, 0.030723974108695984, -0.027156274765729904, 0.01901603862643242, 0.03757545351982117, 0.11145880073308945, 0.0775362178683281, -0.028278561308979988, -0.04131552577018738, -0.043702371418476105, 0.022461161017417908, -0.024730995297431946, -0.03302201256155968, 0.05761869251728058, 0.007143850438296795, -0.04099724441766739, 0.0620231106877327, 0.13505704700946808, 0.032929934561252594, -0.03814220800995827, -0.009756016544997692, 0.05333252251148224, -0.10028157383203506, 0.0023709565866738558, -0.06486345827579498, 0.015689317137002945, 0.0571904294192791, 0.020070025697350502, -0.0008289471152238548, -0.08542513102293015, -0.056377582252025604, 0.018000956624746323, -0.042068663984537125, 0.0012717266799882054, -0.04011329635977745, -0.04060966521501541, -0.012148300185799599, -0.005098687019199133, 0.05372561141848564, -0.010437991470098495, 0.03747493028640747, -0.01504071056842804 ]
-0.005751
Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false ``` ```cjs const { Buffer } = require('node:buffer'); const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false ``` ## Class: `Cipheriv` \* Extends: {stream.Transform} Instances of the `Cipheriv` class are used to encrypt data. The class can be used in one of two ways: \* As a [stream][] that is both readable and writable, where plain unencrypted data is written to produce encrypted data on the readable side, or \* Using the [`cipher.update()`][] and [`cipher.final()`][] methods to produce the encrypted data. The [`crypto.createCipheriv()`][] method is used to create `Cipheriv` instances. `Cipheriv` objects are not to be created directly using the `new` keyword. Example: Using `Cipheriv` objects as streams: ```mjs const { scrypt, randomFill, createCipheriv, } = await import('node:crypto'); const algorithm = 'aes-192-cbc'; const password = 'Password used to generate key'; // First, we'll generate the key. The key length is dependent on the algorithm. // In this case for aes192, it is 24 bytes (192 bits). scrypt(password, 'salt', 24, (err, key) => { if (err) throw err; // Then, we'll generate a random initialization vector randomFill(new Uint8Array(16), (err, iv) => { if (err) throw err; // Once we have the key and iv, we can create and use the cipher... const cipher = createCipheriv(algorithm, key, iv); let encrypted = ''; cipher.setEncoding('hex'); cipher.on('data', (chunk) => encrypted += chunk); cipher.on('end', () => console.log(encrypted)); cipher.write('some clear text data'); cipher.end(); }); }); ``` ```cjs const { scrypt, randomFill, createCipheriv, } = require('node:crypto'); const algorithm = 'aes-192-cbc'; const password = 'Password used to generate key'; // First, we'll generate the key. The key length is dependent on the algorithm. // In this case for aes192, it is 24 bytes (192 bits). scrypt(password, 'salt', 24, (err, key) => { if (err) throw err; // Then, we'll generate a random initialization vector randomFill(new Uint8Array(16), (err, iv) => { if (err) throw err; // Once we have the key and iv, we can create and use the cipher... const cipher = createCipheriv(algorithm, key, iv); let encrypted = ''; cipher.setEncoding('hex'); cipher.on('data', (chunk) => encrypted += chunk); cipher.on('end', () => console.log(encrypted)); cipher.write('some clear text data'); cipher.end(); }); }); ``` Example: Using `Cipheriv` and piped streams: ```mjs import { createReadStream, createWriteStream, } from 'node:fs'; import { pipeline, } from 'node:stream'; const { scrypt, randomFill, createCipheriv, } = await import('node:crypto'); const algorithm = 'aes-192-cbc'; const password = 'Password used to generate key'; // First, we'll generate the key. The key length is dependent on the algorithm. // In this case for aes192, it is 24 bytes (192 bits). scrypt(password, 'salt', 24, (err, key) => { if (err) throw err; // Then, we'll generate a random initialization vector randomFill(new Uint8Array(16), (err, iv) => { if (err) throw err; const cipher = createCipheriv(algorithm, key, iv); const input = createReadStream('test.js'); const output = createWriteStream('test.enc'); pipeline(input, cipher, output, (err) => { if (err) throw err; }); }); }); ``` ```cjs const { createReadStream, createWriteStream, } = require('node:fs'); const { pipeline, } = require('node:stream'); const { scrypt, randomFill, createCipheriv, } = require('node:crypto'); const algorithm = 'aes-192-cbc'; const password = 'Password used to generate key'; // First, we'll generate the key. The key length is dependent on the algorithm. // In this case for aes192, it is 24 bytes (192 bits). scrypt(password, 'salt', 24, (err, key) => { if (err) throw err; // Then, we'll generate a random initialization vector randomFill(new Uint8Array(16), (err, iv) => { if (err) throw err; const cipher = createCipheriv(algorithm, key, iv); const input = createReadStream('test.js'); const output = createWriteStream('test.enc'); pipeline(input, cipher,
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.06794054806232452, 0.10507914423942566, -0.05483988672494888, 0.03562932088971138, 0.030929572880268097, -0.032878924161195755, 0.008182700723409653, 0.023927848786115646, 0.03721451759338379, -0.08982635289430618, -0.011170436628162861, -0.03564438223838806, -0.007207697257399559, 0.05703552067279816, 0.00489743473008275, -0.1065736785531044, -0.050472427159547806, 0.04494109004735947, -0.01620291732251644, -0.055091775953769684, 0.02595050446689129, -0.10393845289945602, -0.04292500764131546, -0.03485231101512909, -0.009845446795225143, -0.007700599264353514, 0.017182467505335808, -0.012206287123262882, 0.020983176305890083, -0.02150442823767662, 0.05307944864034653, -0.01539810374379158, -0.05693257972598076, 0.021377883851528168, -0.09358211606740952, 0.0887378379702568, -0.0015294661279767752, -0.05076388642191887, 0.05147691071033478, -0.003512220922857523, 0.03618761897087097, 0.019496172666549683, -0.08350095897912979, -0.009477133862674236, 0.037975143641233444, 0.04063183069229126, -0.09515313059091568, -0.04769366979598999, -0.0831255316734314, 0.012258789502084255, -0.036802738904953, 0.012715869583189487, -0.04416292533278465, 0.052712686359882355, -0.08006709814071655, -0.017474951222538948, -0.041616424918174744, 0.07525579631328583, 0.06673446297645569, -0.008416421711444855, 0.008605429902672768, -0.05180400609970093, 0.014121166430413723, 0.07316256314516068, 0.007610459811985493, -0.07006879895925522, -0.0059368181973695755, 0.0267889853566885, 0.011127202771604061, 0.051639582961797714, -0.02989013120532036, 0.04101448506116867, 0.05413283407688141, 0.05113080516457558, -0.016478873789310455, -0.06790080666542053, -0.04382363706827164, -0.006697741337120533, -0.05568937212228775, 0.02634752169251442, 0.04374794661998749, -0.04191455617547035, -0.06434614956378937, 0.07378684729337692, 0.0006523291813209653, 0.07793176919221878, 0.04125034436583519, -0.0294254869222641, -0.015670886263251305, 0.048284657299518585, 0.05962938442826271, 0.0283830389380455, -0.05372888222336769, 0.03888687118887901, -0.01179527398198843, 0.05341079458594322, -0.014389542862772942, -0.01641414687037468, 0.013408665545284748, 0.019337212666869164, -0.05470649525523186, -0.015888692811131477, 0.0421333871781826, -0.017438018694519997, 0.03451087325811386, -0.0063278768211603165, -0.032721471041440964, -0.03617806360125542, 0.01232687197625637, 0.042033202946186066, 0.04836418107151985, 0.011118334718048573, -0.012766564264893532, -0.054304614663124084, -0.005026211030781269, 0.08484693616628647, -0.007234650664031506, -0.007097356021404266, 0.06212378665804863, 0.07849065214395523, 0.03931237757205963, -0.02643429860472679, 0.005063316784799099, 0.03517661616206169, -0.011576492339372635, -0.05189036577939987, 0.037323374301195145, 7.317724901621337e-33, 0.047714270651340485, -0.06109841912984848, -0.01219344325363636, 0.06428174674510956, -0.04385047033429146, 0.015205753035843372, 0.023206569254398346, -0.021435225382447243, -0.13338129222393036, -0.006181078031659126, 0.019993096590042114, 0.0354432538151741, -0.027072083204984665, -0.0271445345133543, -0.0035797487944364548, 0.06923022121191025, 0.0301120076328516, -0.03536146506667137, 0.0024910657666623592, 0.043308909982442856, 0.09896684437990189, -0.008014417253434658, 0.027932265773415565, 0.020721351727843285, 0.02061881124973297, -0.011632176116108894, 0.03151261433959007, 0.012504196725785732, -0.028538260608911514, -0.021682336926460266, 0.04389440640807152, 0.039023060351610184, 0.0010330983204767108, 0.061575960367918015, 0.07912475615739822, 0.0261277724057436, 0.11543441563844681, -0.0037653211038559675, -0.09675221890211105, -0.0687854066491127, 0.022234098985791206, -0.035606130957603455, 0.018400076776742935, 0.018934236839413643, 0.023510467261075974, -0.060400061309337616, -0.049865733832120895, -0.054568253457546234, 0.0970766693353653, 0.05267073214054108, -0.05099820718169212, 0.04316267371177673, -0.061406757682561874, -0.023257503286004066, 0.06345024704933167, -0.04770126938819885, 0.044814057648181915, 0.04769549518823624, -0.08844377100467682, 0.007104188669472933, -0.036948733031749725, -0.022737273946404457, -0.056322433054447174, -0.06616705656051636, -0.04176599532365799, 0.034414757043123245, -0.11997657269239426, -0.054399359971284866, 0.009471366181969643, -0.06800884008407593, -0.0957331508398056, -0.01507541723549366, 0.01633911021053791, 0.05813609063625336, -0.006543498951941729, 0.03160056844353676, -0.11243488639593124, 0.06643319875001907, -0.032843995839357376, -0.06918225437402725, 0.015987081453204155, 0.014217413030564785, 0.015307825990021229, 0.09023319184780121, -0.002793138148263097, 0.03070218302309513, -0.017238235101103783, -0.0049249567091465, 0.0448077954351902, 0.03609881177544594, -0.039311062544584274, 0.04818793013691902, 0.0366862453520298, -0.04958327114582062, -0.0776258111000061, -8.160134111930498e-33, 0.02214183285832405, 0.00009260595834348351, -0.0746772289276123, 0.12012523412704468, -0.02015603892505169, -0.008084333501756191, -0.012140159495174885, 0.03041011653840542, 0.007973793894052505, 0.05911530554294586, -0.007038898766040802, -0.015224304981529713, 0.07769551128149033, 0.01320683117955923, 0.044758111238479614, -0.0100869694724679, -0.02863573282957077, 0.028993338346481323, -0.03806493431329727, -0.010714853182435036, 0.018579691648483276, 0.07327162474393845, 0.028676750138401985, 0.05941348522901535, 0.02969217486679554, 0.04990953207015991, -0.02257010154426098, 0.05024050176143646, -0.021964073181152344, -0.014084113761782646, -0.035381026566028595, 0.013469415716826916, -0.05908230319619179, 0.10234354436397552, -0.014037820510566235, -0.12814325094223022, 0.048094894737005234, 0.05393006280064583, 0.005823201034218073, 0.017664501443505287, 0.017186634242534637, -0.07451055198907852, -0.06730622053146362, 0.0016611868049949408, 0.015548995696008205, -0.10108105093240738, 0.08153361082077026, 0.07310882210731506, 0.06611227244138718, -0.0005279289907775819, 0.021411603316664696, -0.06517722457647324, -0.016443151980638504, 0.04823785275220871, 0.026852985844016075, 0.009120313450694084, 0.009804562665522099, 0.0227127093821764, 0.055129293352365494, 0.03611461818218231, 0.020861921831965446, -0.05463193729519844, -0.013788418844342232, -0.04029114916920662, 0.004038589540868998, 0.04489125311374664, -0.0761939138174057, 0.03752346709370613, 0.07016164809465408, -0.00001039033304550685, -0.002459718845784664, -0.005973676219582558, -0.00820143148303032, -0.09864156693220139, 0.0689748153090477, -0.029037654399871826, -0.036757901310920715, -0.05446503683924675, 0.05398376286029816, 0.06433387845754623, -0.005679979454725981, 0.02503156289458275, -0.031647492200136185, 0.05204058438539505, 0.13551785051822662, -0.0008822245872579515, -0.03087720461189747, -0.12100403010845184, -0.04528412967920303, -0.01398962177336216, -0.004104130901396275, 0.09630808979272842, -0.08461160212755203, 0.00576168205589056, 0.11594853550195694, -5.1599705841454124e-8, -0.017177632078528404, -0.021987587213516235, -0.13047152757644653, -0.0130159305408597, 0.062126725912094116, -0.05521182715892792, 0.01201994065195322, -0.16494417190551758, -0.01893560215830803, -0.03723713010549545, -0.050144441425800323, -0.0415356270968914, 0.043004751205444336, -0.04733942076563835, 0.03775680437684059, -0.011691709980368614, -0.02741221897304058, -0.02329063042998314, -0.02965656667947769, 0.02255973592400551, 0.01156886201351881, -0.08376066386699677, -0.06930553913116455, 0.0976259782910347, -0.023539697751402855, 0.007873711176216602, 0.07915402203798294, 0.0615784227848053, 0.007672267034649849, 0.026886234059929848, -0.12202705442905426, -0.04593066871166229, 0.06111118569970131, 0.007181352004408836, 0.052079323679208755, 0.07220382243394852, -0.02241525426506996, 0.011446679942309856, 0.06994161009788513, 0.15701252222061157, 0.021426234394311905, -0.021984204649925232, -0.030954862013459206, 0.06322786957025528, -0.10141068696975708, 0.01787000149488449, -0.010027365759015083, -0.006228410638868809, 0.012371761724352837, 0.06018713116645813, -0.055264443159103394, -0.053386107087135315, -0.09053900092840195, -0.023584645241498947, -0.11719435453414917, -0.000021924231987213716, 0.006273959763348103, -0.049818266183137894, -0.05043896287679672, -0.02195698395371437, 0.04977155849337578, 0.004778940696269274, 0.06484811007976532, -0.0475861020386219 ]
0.032708
is 24 bytes (192 bits). scrypt(password, 'salt', 24, (err, key) => { if (err) throw err; // Then, we'll generate a random initialization vector randomFill(new Uint8Array(16), (err, iv) => { if (err) throw err; const cipher = createCipheriv(algorithm, key, iv); const input = createReadStream('test.js'); const output = createWriteStream('test.enc'); pipeline(input, cipher, output, (err) => { if (err) throw err; }); }); }); ``` Example: Using the [`cipher.update()`][] and [`cipher.final()`][] methods: ```mjs const { scrypt, randomFill, createCipheriv, } = await import('node:crypto'); const algorithm = 'aes-192-cbc'; const password = 'Password used to generate key'; // First, we'll generate the key. The key length is dependent on the algorithm. // In this case for aes192, it is 24 bytes (192 bits). scrypt(password, 'salt', 24, (err, key) => { if (err) throw err; // Then, we'll generate a random initialization vector randomFill(new Uint8Array(16), (err, iv) => { if (err) throw err; const cipher = createCipheriv(algorithm, key, iv); let encrypted = cipher.update('some clear text data', 'utf8', 'hex'); encrypted += cipher.final('hex'); console.log(encrypted); }); }); ``` ```cjs const { scrypt, randomFill, createCipheriv, } = require('node:crypto'); const algorithm = 'aes-192-cbc'; const password = 'Password used to generate key'; // First, we'll generate the key. The key length is dependent on the algorithm. // In this case for aes192, it is 24 bytes (192 bits). scrypt(password, 'salt', 24, (err, key) => { if (err) throw err; // Then, we'll generate a random initialization vector randomFill(new Uint8Array(16), (err, iv) => { if (err) throw err; const cipher = createCipheriv(algorithm, key, iv); let encrypted = cipher.update('some clear text data', 'utf8', 'hex'); encrypted += cipher.final('hex'); console.log(encrypted); }); }); ``` ### `cipher.final([outputEncoding])` \* `outputEncoding` {string} The [encoding][] of the return value. \* Returns: {Buffer | string} Any remaining enciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a [`Buffer`][] is returned. Once the `cipher.final()` method has been called, the `Cipheriv` object can no longer be used to encrypt data. Attempts to call `cipher.final()` more than once will result in an error being thrown. ### `cipher.getAuthTag()` \* Returns: {Buffer} When using an authenticated encryption mode (`GCM`, `CCM`, `OCB`, and `chacha20-poly1305` are currently supported), the `cipher.getAuthTag()` method returns a [`Buffer`][] containing the \_authentication tag\_ that has been computed from the given data. The `cipher.getAuthTag()` method should only be called after encryption has been completed using the [`cipher.final()`][] method. If the `authTagLength` option was set during the `cipher` instance's creation, this function will return exactly `authTagLength` bytes. ### `cipher.setAAD(buffer[, options])` \* `buffer` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `options` {Object} [`stream.transform` options][] \* `plaintextLength` {number} \* `encoding` {string} The string encoding to use when `buffer` is a string. \* Returns: {Cipheriv} The same `Cipheriv` instance for method chaining. When using an authenticated encryption mode (`GCM`, `CCM`, `OCB`, and `chacha20-poly1305` are currently supported), the `cipher.setAAD()` method sets the value used for the \_additional authenticated data\_ (AAD) input parameter. The `plaintextLength` option is optional for `GCM` and `OCB`. When using `CCM`, the `plaintextLength` option must be specified and its value must match the length of the plaintext in bytes. See [CCM mode][]. The `cipher.setAAD()` method must be called before [`cipher.update()`][]. ### `cipher.setAutoPadding([autoPadding])` \* `autoPadding` {boolean} \*\*Default:\*\* `true` \* Returns: {Cipheriv} The same `Cipheriv` instance for method chaining. When using block encryption algorithms, the `Cipheriv` class will automatically add padding to the input data to the appropriate block size. To disable the default padding call `cipher.setAutoPadding(false)`. When `autoPadding` is `false`, the length of the entire input data must be a multiple of the cipher's block size or [`cipher.final()`][] will throw an error. Disabling automatic padding is useful for non-standard padding, for instance using `0x0` instead of PKCS
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.06533931195735931, 0.03343429043889046, -0.04644768312573433, 0.01057180855423212, -0.03949761018157005, -0.05570809915661812, 0.02650598995387554, 0.022575460374355316, 0.029172413051128387, -0.04160997271537781, -0.0563325360417366, -0.010476337745785713, 0.08862262219190598, -0.002815999323502183, -0.06826354563236237, -0.0441131591796875, -0.12862704694271088, 0.047220949083566666, -0.03444124758243561, -0.08916982263326645, 0.06946845352649689, -0.07740394026041031, 0.04115136340260506, -0.025203604251146317, -0.033089395612478256, 0.0274288821965456, 0.09202802926301956, 0.051783110946416855, -0.011280595324933529, -0.022567762061953545, 0.08032648265361786, -0.006982144434005022, 0.009897048585116863, -0.012086428701877594, -0.08184843510389328, 0.06009890139102936, -0.06908092647790909, -0.036677632480859756, 0.0020351235289126635, -0.026400098577141762, -0.05135133117437363, 0.039899684488773346, -0.036400336772203445, 0.07140936702489853, 0.03978556767106056, 0.033457402139902115, -0.041984543204307556, 0.0027318100910633802, -0.00605125492438674, 0.013726618140935898, 0.0032069950830191374, 0.027727121487259865, -0.005133452359586954, 0.016162563115358353, -0.05701270326972008, -0.03936402499675751, -0.06688562035560608, -0.031083829700946808, 0.04912376403808594, -0.03725448623299599, 0.016089115291833878, 0.03173188120126724, 0.07291179150342941, 0.06220365688204765, 0.05554293096065521, -0.002957141026854515, 0.04555020108819008, 0.02203173004090786, -0.014995580539107323, 0.04471471533179283, -0.02358335256576538, 0.041886236518621445, -0.032949432730674744, 0.090955451130867, -0.016529422253370285, 0.00859074853360653, -0.046655550599098206, -0.07034540176391602, -0.0451229028403759, 0.12149471789598465, -0.06927024573087692, -0.07792893797159195, 0.047629255801439285, 0.06325125694274902, 0.05402973294258118, 0.08614850789308548, 0.03151789307594299, 0.019193265587091446, 0.027824118733406067, 0.02777097374200821, 0.010335960425436497, -0.019227394834160805, -0.055406659841537476, 0.06351926177740097, 0.04611734300851822, 0.05278148874640465, 0.038805749267339706, -0.026242924854159355, -0.12136564403772354, 0.049258701503276825, -0.004702405538409948, -0.004158071707934141, 0.029001358896493912, -0.04266597703099251, 0.1512395590543747, 0.026038048788905144, 0.07586032152175903, -0.002261047950014472, -0.04670114442706108, 0.023304754868149757, 0.03308267518877983, 0.06251047551631927, 0.012884577736258507, 0.007264879532158375, 0.0429394394159317, 0.04187803715467453, -0.03236567601561546, 0.01025041937828064, -0.009837533347308636, 0.14136244356632233, 0.07222886383533478, 0.04254844784736633, -0.09084367007017136, 0.05099352076649666, -0.012370807118713856, -0.0032347540836781263, 0.001352140330709517, 5.6610581013372696e-33, -0.01323341578245163, -0.033571429550647736, -0.008671539835631847, 0.0780574306845665, -0.006838112138211727, 0.017067793756723404, 0.07984170317649841, 0.040133506059646606, -0.1415368914604187, -0.008804408833384514, -0.07535210251808167, -0.033495139330625534, 0.05112104490399361, -0.024682993069291115, 0.008116652257740498, -0.041935890913009644, 0.09507773071527481, -0.06471589207649231, 0.07059004157781601, -0.036641139537096024, 0.016961773857474327, -0.021405072882771492, 0.0610697977244854, -0.05364478379487991, -0.02821304090321064, -0.015304457396268845, 0.007964588701725006, -0.027489887550473213, 0.01841636933386326, -0.009227457456290722, -0.002945978194475174, -0.0028372635133564472, -0.08306588232517242, -0.000026781175620271824, 0.00996535923331976, -0.06494376063346863, 0.07566725462675095, 0.04196295142173767, -0.09198929369449615, -0.06605900824069977, 0.038163922727108, -0.009306938387453556, -0.004060111008584499, -0.012919219210743904, -0.020901938900351524, -0.008329539559781551, -0.022712547332048416, -0.04303847253322601, 0.08318055421113968, 0.04116145893931389, -0.013356512412428856, 0.049841947853565216, -0.08506780117750168, -0.040756527334451675, 0.03132079914212227, -0.02882828190922737, 0.07353398203849792, -0.03772464767098427, -0.05566256120800972, 0.030964717268943787, -0.03834104537963867, 0.03700190782546997, -0.03573198616504669, -0.011974707245826721, 0.0007335080881603062, -0.022875569760799408, -0.024012353271245956, -0.06906607002019882, -0.0044195279479026794, -0.01418844424188137, -0.06016774848103523, -0.016247905790805817, 0.014950760640203953, 0.06157125532627106, -0.09001791477203369, 0.04103124141693115, -0.0765681117773056, -0.010040263645350933, 0.0054322499781847, -0.09415944665670395, 0.09397932887077332, 0.023524338379502296, -0.0531596913933754, 0.06971659511327744, 0.04219167307019234, 0.027980471029877663, -0.03433479741215706, -0.028441591188311577, 0.016418108716607094, 0.02154601365327835, -0.00945389922708273, -0.06068325787782669, 0.07352175563573837, -0.151506245136261, -0.07400674372911453, -7.179414032251679e-33, -0.054475340992212296, 0.02033204957842827, -0.04511384293437004, 0.11391188204288483, 0.004361990839242935, -0.013569305650889874, 0.03290201723575592, 0.027725407853722572, 0.0009968560189008713, -0.00990233849734068, -0.04668945074081421, 0.029335444793105125, 0.12617410719394684, 0.01051423791795969, 0.07068228721618652, -0.008660320192575455, -0.08025291562080383, 0.07960864901542664, 0.020311938598752022, -0.015211965888738632, -0.05994940549135208, 0.057125888764858246, -0.0008898555533960462, 0.033851418644189835, 0.008673190139234066, 0.047603096812963486, 0.013274011202156544, 0.06938732415437698, -0.02134002186357975, -0.0459420420229435, -0.05269836634397507, 0.03152620419859886, -0.0338711217045784, 0.06146945804357529, -0.05141806975007057, -0.08235836029052734, 0.06348101794719696, 0.04147296026349068, -0.013668231666088104, -0.03567679971456528, 0.04639720171689987, -0.024349302053451538, 0.013732933439314365, 0.01574312523007393, -0.01668420247733593, -0.002712374785915017, 0.03456505015492439, 0.06546156108379364, 0.03865307569503784, 0.017669377848505974, -0.001561072887852788, -0.06329108029603958, -0.08619559556245804, -0.004149874206632376, 0.03502989560365677, -0.010869257152080536, -0.08324770629405975, -0.02730172500014305, 0.05436117947101593, 0.0246137585490942, 0.013969925232231617, -0.04929500073194504, 0.05739510804414749, -0.07615013420581818, 0.05573096498847008, -0.05586270987987518, -0.16090530157089233, 0.06184098869562149, 0.0017741232877597213, 0.05655466765165329, 0.03737543523311615, 0.019958853721618652, 0.02906007692217827, -0.01774960570037365, 0.07513359934091568, -0.11409175395965576, -0.05179848521947861, -0.07271316647529602, 0.01751755364239216, -0.00025787996128201485, -0.005170470103621483, 0.05746160447597504, -0.04451649263501167, 0.06140119954943657, 0.03787893429398537, -0.05828310549259186, 0.10492563992738724, -0.0716208666563034, 0.013817771337926388, -0.012542814947664738, -0.023035714402794838, 0.08351518958806992, -0.05868788808584213, 0.041389551013708115, 0.0957837924361229, -5.233037114749095e-8, 0.007587433326989412, -0.017590448260307312, -0.08324502408504486, 0.055395711213350296, 0.030738476663827896, -0.013538412749767303, -0.00215407507494092, -0.1126597449183464, -0.002655472606420517, -0.12352053076028824, 0.04404200613498688, -0.02950185537338257, -0.015407012775540352, 0.01795058697462082, 0.0012274585897102952, 0.03809450566768646, -0.08311154693365097, -0.009086653590202332, -0.016790246590971947, -0.09153752774000168, 0.024467412382364273, -0.01954604871571064, -0.05171540006995201, 0.03639774024486542, 0.044116489589214325, 0.02243962697684765, 0.016568953171372414, 0.03118666261434555, 0.005383775103837252, 0.00919543020427227, -0.07180073857307434, -0.06974047422409058, 0.07462194561958313, -0.03606398031115532, -0.0389024093747139, 0.02479332871735096, -0.06593223661184311, -0.02517768181860447, 0.1002480760216713, 0.013155892491340637, 0.00712675740942359, -0.004010453354567289, -0.01773771271109581, 0.01701817847788334, -0.10889696329832077, -0.009797966107726097, 0.010542212054133415, 0.018793579190969467, 0.026500694453716278, -0.011981775984168053, 0.00930514745414257, -0.0572635717689991, 0.00042875009239651263, -0.013855520635843277, 0.019010653719305992, -0.009266052395105362, -0.01917116343975067, -0.08286944031715393, -0.007651646621525288, 0.03692943602800369, 0.04112279415130615, 0.03638601303100586, -0.036433443427085876, -0.07718472927808762 ]
0.050304
block size. To disable the default padding call `cipher.setAutoPadding(false)`. When `autoPadding` is `false`, the length of the entire input data must be a multiple of the cipher's block size or [`cipher.final()`][] will throw an error. Disabling automatic padding is useful for non-standard padding, for instance using `0x0` instead of PKCS padding. The `cipher.setAutoPadding()` method must be called before [`cipher.final()`][]. ### `cipher.update(data[, inputEncoding][, outputEncoding])` \* `data` {string|Buffer|TypedArray|DataView} \* `inputEncoding` {string} The [encoding][] of the data. \* `outputEncoding` {string} The [encoding][] of the return value. \* Returns: {Buffer | string} Updates the cipher with `data`. If the `inputEncoding` argument is given, the `data` argument is a string using the specified encoding. If the `inputEncoding` argument is not given, `data` must be a [`Buffer`][], `TypedArray`, or `DataView`. If `data` is a [`Buffer`][], `TypedArray`, or `DataView`, then `inputEncoding` is ignored. The `outputEncoding` specifies the output format of the enciphered data. If the `outputEncoding` is specified, a string using the specified encoding is returned. If no `outputEncoding` is provided, a [`Buffer`][] is returned. The `cipher.update()` method can be called multiple times with new data until [`cipher.final()`][] is called. Calling `cipher.update()` after [`cipher.final()`][] will result in an error being thrown. ## Class: `Decipheriv` \* Extends: {stream.Transform} Instances of the `Decipheriv` class are used to decrypt data. The class can be used in one of two ways: \* As a [stream][] that is both readable and writable, where plain encrypted data is written to produce unencrypted data on the readable side, or \* Using the [`decipher.update()`][] and [`decipher.final()`][] methods to produce the unencrypted data. The [`crypto.createDecipheriv()`][] method is used to create `Decipheriv` instances. `Decipheriv` objects are not to be created directly using the `new` keyword. Example: Using `Decipheriv` objects as streams: ```mjs import { Buffer } from 'node:buffer'; const { scryptSync, createDecipheriv, } = await import('node:crypto'); const algorithm = 'aes-192-cbc'; const password = 'Password used to generate key'; // Key length is dependent on the algorithm. In this case for aes192, it is // 24 bytes (192 bits). // Use the async `crypto.scrypt()` instead. const key = scryptSync(password, 'salt', 24); // The IV is usually passed along with the ciphertext. const iv = Buffer.alloc(16, 0); // Initialization vector. const decipher = createDecipheriv(algorithm, key, iv); let decrypted = ''; decipher.on('readable', () => { let chunk; while (null !== (chunk = decipher.read())) { decrypted += chunk.toString('utf8'); } }); decipher.on('end', () => { console.log(decrypted); // Prints: some clear text data }); // Encrypted with same algorithm, key and iv. const encrypted = 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; decipher.write(encrypted, 'hex'); decipher.end(); ``` ```cjs const { scryptSync, createDecipheriv, } = require('node:crypto'); const { Buffer } = require('node:buffer'); const algorithm = 'aes-192-cbc'; const password = 'Password used to generate key'; // Key length is dependent on the algorithm. In this case for aes192, it is // 24 bytes (192 bits). // Use the async `crypto.scrypt()` instead. const key = scryptSync(password, 'salt', 24); // The IV is usually passed along with the ciphertext. const iv = Buffer.alloc(16, 0); // Initialization vector. const decipher = createDecipheriv(algorithm, key, iv); let decrypted = ''; decipher.on('readable', () => { let chunk; while (null !== (chunk = decipher.read())) { decrypted += chunk.toString('utf8'); } }); decipher.on('end', () => { console.log(decrypted); // Prints: some clear text data }); // Encrypted with same algorithm, key and iv. const encrypted = 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; decipher.write(encrypted, 'hex'); decipher.end(); ``` Example: Using `Decipheriv` and piped streams: ```mjs import { createReadStream, createWriteStream, } from 'node:fs'; import { Buffer } from 'node:buffer'; const { scryptSync, createDecipheriv, } = await import('node:crypto'); const algorithm = 'aes-192-cbc'; const password = 'Password used to generate key'; // Use the async `crypto.scrypt()` instead. const key = scryptSync(password, 'salt',
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.03558743745088577, 0.09481607377529144, -0.07609202712774277, 0.041143015027046204, -0.12737204134464264, -0.02768033742904663, 0.006087576039135456, 0.01951397955417633, -0.0015862234868109226, -0.04811432585120201, -0.05705655366182327, 0.013489198870956898, 0.030737295746803284, -0.027768772095441818, -0.10305377840995789, -0.05387644097208977, -0.056565769016742706, -0.036055441945791245, -0.01787685789167881, -0.032224301248788834, 0.010124598629772663, -0.00038285661139525473, 0.0683271661400795, -0.021934153512120247, -0.010003886185586452, 0.058470387011766434, -0.005135583225637674, -0.013633686117827892, 0.01213464979082346, 0.025623152032494545, 0.00273416331037879, -0.029045287519693375, 0.08080587536096573, 0.0503513440489769, -0.04048856347799301, -0.024284545332193375, -0.04739200323820114, -0.0004591788456309587, -0.0091327503323555, -0.009315173141658306, -0.032111648470163345, -0.00575030455365777, -0.06723597645759583, -0.04168175160884857, -0.02963215857744217, 0.01801791973412037, -0.027388853952288628, -0.03288508951663971, -0.0894717425107956, -0.03702026233077049, 0.06175081059336662, 0.08711913228034973, -0.03478230535984039, -0.0004811643448192626, 0.027050744742155075, -0.07671917974948883, -0.015439574606716633, 0.08437106013298035, 0.07006128132343292, -0.0016152027528733015, -0.0009707791032269597, 0.035692185163497925, 0.01861986517906189, 0.11936593055725098, -0.007687615696340799, 0.05711331218481064, 0.05813987925648689, -0.006619506981223822, 0.03138083592057228, 0.046611469238996506, -0.04358028620481491, 0.08208382874727249, -0.05588021129369736, 0.0485600121319294, 0.032077688723802567, -0.04446271061897278, -0.023628804832696915, 0.004948118701577187, 0.011636916548013687, -0.0055291373282670975, 0.02325061336159706, -0.11720267683267593, -0.0057837930507957935, 0.13715089857578278, -0.007931873202323914, 0.028707163408398628, -0.05032417178153992, -0.007094056811183691, 0.029790934175252914, 0.046249136328697205, 0.10152094066143036, -0.05753884091973305, -0.015762722119688988, 0.14314141869544983, -0.03859008476138115, -0.0032872415613383055, -0.004064364358782768, -0.0019485473167151213, -0.12747062742710114, -0.014651309698820114, 0.010673661716282368, -0.04142193868756294, -0.010281812399625778, 0.03890565410256386, 0.06506383419036865, -0.009533533826470375, 0.09725397080183029, -0.04612475633621216, -0.023173663765192032, -0.0011721624759957194, 0.034730296581983566, 0.005009686574339867, -0.05762004852294922, -0.02211001329123974, -0.014192360453307629, 0.0584774948656559, -0.01853429526090622, 0.05805058032274246, -0.016063669696450233, 0.11435551196336746, 0.05289100483059883, 0.01718355529010296, -0.08638901263475418, -0.0403599813580513, 0.023448476567864418, -0.025977129116654396, 0.03433127701282501, 4.9426767693513065e-33, 0.024941030889749527, -0.03700781986117363, 0.002854905789718032, -0.04448236525058746, -0.029160600155591965, 0.033388521522283554, -0.009083147160708904, 0.07370942831039429, 0.026712333783507347, -0.0164311695843935, 0.002130639972165227, -0.05808963626623154, 0.03222968056797981, 0.0004740980511996895, -0.00495432922616601, 0.06271913647651672, 0.09222213923931122, -0.024124598130583763, -0.007633760571479797, 0.046359796077013016, 0.0980742871761322, 0.05859401077032089, 0.0744660496711731, -0.021951092407107353, -0.06560519337654114, -0.02412416785955429, -0.040313851088285446, -0.02040228433907032, -0.08755169063806534, 0.03789914399385452, -0.10409823060035706, -0.0798858031630516, -0.028134649619460106, 0.04927968233823776, -0.016208073124289513, -0.019018247723579407, 0.0436079166829586, -0.010565604083240032, -0.04718060791492462, -0.009901047684252262, -0.004563412629067898, -0.03228268027305603, -0.05249946936964989, 0.0006000589928589761, -0.007076915353536606, -0.05424671247601509, 0.00662668701261282, -0.03061646781861782, -0.08703251928091049, 0.051028817892074585, 0.017613152042031288, 0.05679113045334816, -0.03618219867348671, -0.057971417903900146, -0.06294580549001694, -0.07436393201351166, 0.08218386769294739, -0.04252541810274124, 0.00543061550706625, -0.02046898379921913, -0.07884112745523453, -0.043755266815423965, 0.030819421634078026, -0.00814238004386425, 0.02325611189007759, 0.01917050965130329, 0.09927304834127426, -0.06436026096343994, -0.10680418461561203, -0.07614219188690186, -0.09550648182630539, -0.023958571255207062, 0.0523223802447319, 0.055013831704854965, -0.06762644648551941, 0.01750769652426243, -0.062073640525341034, -0.0075044878758490086, -0.05367998778820038, -0.059043411165475845, 0.05315060168504715, -0.009541613049805164, 0.05764772742986679, -0.032113030552864075, -0.011093023233115673, -0.000532349746208638, 0.06597710400819778, -0.000323992659104988, 0.05319906026124954, -0.0056664119474589825, 0.0024152654223144054, -0.06704830378293991, 0.02519666776061058, -0.08893907815217972, -0.04109669849276543, -4.95825353886764e-33, 0.06778701394796371, 0.00580383837223053, -0.13164228200912476, 0.04853381589055061, -0.03899235650897026, -0.01162794977426529, 0.05121954157948494, 0.10408717393875122, 0.03502703085541725, -0.10788607597351074, 0.01547558419406414, -0.01255315262824297, 0.08786261081695557, -0.02164159156382084, 0.013078564777970314, 0.04240059480071068, -0.07755955308675766, 0.0936177596449852, 0.02584262192249298, -0.0417543426156044, -0.0055133625864982605, -0.07904067635536194, 0.004537585657089949, 0.0790637657046318, 0.011996444314718246, -0.00394503865391016, -0.032082702964544296, 0.05784275755286217, 0.06272745132446289, 0.02174820750951767, -0.03233940526843071, 0.059384189546108246, 0.014879883266985416, -0.025489119812846184, -0.0619637668132782, -0.015349562279880047, 0.05518905445933342, 0.035398051142692566, 0.022783376276493073, 0.07401975244283676, 0.1203673705458641, -0.01519465446472168, -0.043525367975234985, 0.01697227731347084, 0.07551714032888412, -0.037647295743227005, -0.04573739692568779, 0.08128882944583893, -0.005481063853949308, -0.07106868922710419, 0.037924863398075104, 0.05983373522758484, 0.041232313960790634, 0.07149578630924225, 0.07561557739973068, 0.0475192591547966, 0.01198792178183794, -0.003923676908016205, 0.04336514323949814, 0.007472541183233261, -0.034821126610040665, -0.07745293527841568, 0.05985831841826439, -0.041379962116479874, 0.06737574934959412, 0.03821536898612976, -0.0691554918885231, 0.036232609301805496, -0.007880661636590958, 0.009082169272005558, 0.03683381527662277, -0.028414733707904816, 0.010186120867729187, 0.029718639329075813, -0.005782491527497768, -0.0024520757142454386, 0.026990007609128952, -0.11171713471412659, 0.07327421009540558, 0.07390523701906204, -0.04062894359230995, 0.03783862665295601, 0.04912911728024483, 0.1030912920832634, 0.030310336500406265, 0.01165998075157404, 0.008138490840792656, 0.038341883569955826, -0.06611528247594833, -0.0314134918153286, -0.025527523830533028, 0.0537605844438076, -0.030292820185422897, 0.04920408874750137, 0.08063570410013199, -5.403295588735091e-8, -0.006612402852624655, -0.04848777502775192, -0.0716419517993927, 0.10980737954378128, 0.046028610318899155, -0.016352271661162376, -0.043633997440338135, -0.019181987270712852, 0.05582524836063385, -0.09338077157735825, 0.01802019588649273, -0.0021419303957372904, 0.003342892974615097, -0.048708606511354446, -0.012240618467330933, 0.06437833607196808, -0.040481194853782654, -0.07073686271905899, -0.038801971822977066, -0.057812049984931946, 0.050638679414987564, -0.07808083295822144, -0.09145800024271011, -0.04684760421514511, 0.09415145218372345, -0.027159741148352623, 0.010964563116431236, 0.03315195068717003, -0.035224225372076035, -0.022382304072380066, -0.053790636360645294, -0.05464807525277138, 0.07701237499713898, -0.030007706955075264, 0.003842271165922284, 0.05789719149470329, 0.009649503976106644, -0.06710736453533173, 0.06075020879507065, 0.10612692683935165, -0.00471950089558959, -0.0017436412163078785, -0.026950594037771225, -0.010007624514400959, -0.07725836336612701, 0.00023142348800320178, 0.06793002039194107, 0.0873698890209198, -0.03367936983704567, 0.025256218388676643, 0.05689077451825142, 0.016466284170746803, 0.016356300562620163, -0.0379762277007103, -0.04864151403307915, 0.019114580005407333, -0.0360298790037632, -0.0489954873919487, -0.0029453025199472904, 0.033867232501506805, -0.019518785178661346, 0.02414458803832531, 0.014085249975323677, -0.028783584013581276 ]
-0.059764
Using `Decipheriv` and piped streams: ```mjs import { createReadStream, createWriteStream, } from 'node:fs'; import { Buffer } from 'node:buffer'; const { scryptSync, createDecipheriv, } = await import('node:crypto'); const algorithm = 'aes-192-cbc'; const password = 'Password used to generate key'; // Use the async `crypto.scrypt()` instead. const key = scryptSync(password, 'salt', 24); // The IV is usually passed along with the ciphertext. const iv = Buffer.alloc(16, 0); // Initialization vector. const decipher = createDecipheriv(algorithm, key, iv); const input = createReadStream('test.enc'); const output = createWriteStream('test.js'); input.pipe(decipher).pipe(output); ``` ```cjs const { createReadStream, createWriteStream, } = require('node:fs'); const { scryptSync, createDecipheriv, } = require('node:crypto'); const { Buffer } = require('node:buffer'); const algorithm = 'aes-192-cbc'; const password = 'Password used to generate key'; // Use the async `crypto.scrypt()` instead. const key = scryptSync(password, 'salt', 24); // The IV is usually passed along with the ciphertext. const iv = Buffer.alloc(16, 0); // Initialization vector. const decipher = createDecipheriv(algorithm, key, iv); const input = createReadStream('test.enc'); const output = createWriteStream('test.js'); input.pipe(decipher).pipe(output); ``` Example: Using the [`decipher.update()`][] and [`decipher.final()`][] methods: ```mjs import { Buffer } from 'node:buffer'; const { scryptSync, createDecipheriv, } = await import('node:crypto'); const algorithm = 'aes-192-cbc'; const password = 'Password used to generate key'; // Use the async `crypto.scrypt()` instead. const key = scryptSync(password, 'salt', 24); // The IV is usually passed along with the ciphertext. const iv = Buffer.alloc(16, 0); // Initialization vector. const decipher = createDecipheriv(algorithm, key, iv); // Encrypted using same algorithm, key and iv. const encrypted = 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; let decrypted = decipher.update(encrypted, 'hex', 'utf8'); decrypted += decipher.final('utf8'); console.log(decrypted); // Prints: some clear text data ``` ```cjs const { scryptSync, createDecipheriv, } = require('node:crypto'); const { Buffer } = require('node:buffer'); const algorithm = 'aes-192-cbc'; const password = 'Password used to generate key'; // Use the async `crypto.scrypt()` instead. const key = scryptSync(password, 'salt', 24); // The IV is usually passed along with the ciphertext. const iv = Buffer.alloc(16, 0); // Initialization vector. const decipher = createDecipheriv(algorithm, key, iv); // Encrypted using same algorithm, key and iv. const encrypted = 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; let decrypted = decipher.update(encrypted, 'hex', 'utf8'); decrypted += decipher.final('utf8'); console.log(decrypted); // Prints: some clear text data ``` ### `decipher.final([outputEncoding])` \* `outputEncoding` {string} The [encoding][] of the return value. \* Returns: {Buffer | string} Any remaining deciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a [`Buffer`][] is returned. Once the `decipher.final()` method has been called, the `Decipheriv` object can no longer be used to decrypt data. Attempts to call `decipher.final()` more than once will result in an error being thrown. ### `decipher.setAAD(buffer[, options])` \* `buffer` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `options` {Object} [`stream.transform` options][] \* `plaintextLength` {number} \* `encoding` {string} String encoding to use when `buffer` is a string. \* Returns: {Decipheriv} The same Decipher for method chaining. When using an authenticated encryption mode (`GCM`, `CCM`, `OCB`, and `chacha20-poly1305` are currently supported), the `decipher.setAAD()` method sets the value used for the \_additional authenticated data\_ (AAD) input parameter. The `options` argument is optional for `GCM`. When using `CCM`, the `plaintextLength` option must be specified and its value must match the length of the ciphertext in bytes. See [CCM mode][]. The `decipher.setAAD()` method must be called before [`decipher.update()`][]. When passing a string as the `buffer`, please consider [caveats when using strings as inputs to cryptographic APIs][]. ### `decipher.setAuthTag(buffer[, encoding])` \* `buffer` {string|Buffer|ArrayBuffer|TypedArray|DataView} \* `encoding` {string} String encoding to use when `buffer` is a string. \* Returns: {Decipheriv} The same Decipher for method chaining. When using an authenticated encryption mode (`GCM`, `CCM`, `OCB`, and `chacha20-poly1305` are currently supported), the `decipher.setAuthTag()` method is used to pass in the received \_authentication tag\_. If no
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.015339481644332409, 0.03151896595954895, -0.06225341930985451, 0.006155358161777258, -0.046936046332120895, -0.05734813213348389, -0.03140530735254288, 0.08468722552061081, -0.006655425764620304, -0.03309580311179161, -0.06504616886377335, -0.05560685321688652, 0.05517987161874771, 0.016933785751461983, -0.05702633038163185, -0.06984332948923111, -0.05988825485110283, 0.08122533559799194, 0.019443735480308533, -0.07433751970529556, 0.06902206689119339, -0.07590213418006897, 0.01921139471232891, -0.02887280285358429, 0.009178318083286285, 0.02240179292857647, 0.04536141827702522, 0.025412825867533684, 0.028734993189573288, 0.014685860835015774, 0.07903589308261871, -0.0025433460250496864, -0.02288876660168171, 0.009342851117253304, -0.0829707607626915, 0.08694080263376236, 0.00880877673625946, -0.054836075752973557, -0.011091092601418495, -0.017416052520275116, 0.025294819846749306, 0.05471859127283096, -0.05421396717429161, 0.025031043216586113, 0.03985662758350372, 0.007753794081509113, -0.053329624235630035, 0.047704100608825684, -0.014901062473654747, 0.03575555980205536, -0.007527668960392475, 0.0069338916800916195, -0.057583775371313095, 0.05298437923192978, -0.0978039875626564, -0.01927867718040943, -0.049499303102493286, 0.005914265755563974, 0.06398313492536545, -0.06432805955410004, -0.00798758864402771, 0.027561765164136887, 0.09950572997331619, 0.06321947276592255, 0.052582889795303345, 0.03799764811992645, -0.02160327136516571, 0.05440059304237366, 0.016431067138910294, 0.02775665558874607, -0.009973904117941856, 0.0005617575370706618, -0.015155474655330181, 0.028795422986149788, -0.06360727548599243, -0.0015383196296170354, -0.03698728606104851, -0.0019842402543872595, -0.0855218917131424, 0.08929076790809631, -0.019915880635380745, -0.07461312413215637, 0.001395073952153325, 0.030955394729971886, 0.01206349115818739, 0.10367494821548462, -0.0024564513005316257, -0.026992419734597206, -0.025831962004303932, 0.07573436200618744, 0.009658657014369965, -0.008096630685031414, -0.10844617336988449, 0.03846457228064537, 0.07483099400997162, 0.02591695263981819, 0.004756440408527851, 0.03554033115506172, -0.05889810249209404, -0.008990813978016376, -0.03676823899149895, 0.020770922303199768, -0.01500355638563633, -0.008979056030511856, 0.08834545314311981, 0.04066162556409836, 0.0648280531167984, -0.06012486293911934, -0.05815422162413597, -0.006833440624177456, -0.009485065005719662, 0.07497212290763855, 0.020423343405127525, 0.009539335034787655, 0.07725303620100021, 0.09415610134601593, 0.023949412629008293, -0.027493737637996674, 0.044137679040431976, 0.14124847948551178, 0.029425371438264847, 0.00008992488437797874, -0.07217840105295181, 0.05703110620379448, 0.0014500290853902698, 0.0071313707157969475, 0.03129071742296219, 3.717444313809851e-33, -0.05462564900517464, -0.04743210971355438, -0.0013884255895391107, 0.04516810178756714, -0.012210273183882236, 0.03010808676481247, 0.12676429748535156, 0.019903400912880898, -0.1544949859380722, -0.012812656350433826, -0.11515744775533676, -0.0727100521326065, 0.0652376040816307, -0.035096608102321625, -0.015023110434412956, -0.05569295585155487, 0.07493286579847336, -0.07085874676704407, 0.04733027517795563, 0.030733825638890266, 0.07410655915737152, -0.009564751759171486, 0.041762158274650574, -0.06118413433432579, -0.025626128539443016, -0.04334055632352829, -0.001510015339590609, -0.011058355681598186, 0.036453843116760254, 0.0018944889307022095, 0.009334289468824863, 0.007127857767045498, -0.04622214287519455, -0.016080966219305992, 0.006142343860119581, -0.024058934301137924, 0.09388657659292221, 0.02117854356765747, -0.08730144053697586, -0.04951847717165947, -0.007660030387341976, -0.02846970409154892, -0.006996425334364176, -0.004204911179840565, -0.030414573848247528, -0.03744799271225929, -0.07625563442707062, -0.06574743986129761, 0.058022938668727875, 0.03451693430542946, -0.01208752952516079, 0.04488397762179375, -0.11088623106479645, -0.0941586047410965, 0.04098498076200485, -0.056736789643764496, 0.02620818093419075, -0.014008625410497189, -0.04864257201552391, 0.03801237791776657, -0.08293808996677399, 0.04201721027493477, -0.0565730519592762, 0.003653690218925476, 0.0249331071972847, -0.006626715883612633, -0.057239752262830734, -0.06545371562242508, -0.0019751833751797676, -0.025680163875222206, -0.08882515132427216, -0.024556312710046768, 0.005383198615163565, 0.0455482080578804, 0.016299869865179062, 0.08673624694347382, -0.08338295668363571, -0.0248978603631258, 0.0024904932361096144, -0.09060775488615036, 0.08796405047178268, 0.0715106651186943, -0.026262041181325912, 0.06622314453125, 0.042760562151670456, -0.009775775484740734, -0.054384320974349976, -0.01711580529808998, 0.06788910925388336, -0.014389007352292538, -0.0054215542040765285, -0.011028830893337727, 0.04760449379682541, -0.11741284281015396, -0.056684598326683044, -4.8728873024010026e-33, -0.0034733819775283337, 0.011797760613262653, -0.055200282484292984, 0.11106036603450775, -0.0009586113155819476, 0.01551225408911705, 0.03034130483865738, 0.0000822347283246927, 0.015996349975466728, 0.04239998757839203, -0.01957601122558117, 0.016083715483546257, 0.06639599800109863, 0.03390932455658913, 0.042284633964300156, -0.020515840500593185, -0.035667676478624344, 0.03185063228011131, 0.09000319987535477, -0.0607958547770977, -0.07117176055908203, 0.04380055516958237, 0.05396779254078865, 0.016133764758706093, 0.01421036571264267, 0.05567337945103645, 0.001784850494004786, 0.08278806507587433, -0.01979130692780018, -0.04598649963736534, -0.062363702803850174, 0.02788708172738552, -0.024701299145817757, 0.05640699341893196, -0.07138385623693466, -0.04302004724740982, 0.018805108964443207, 0.06147840991616249, 0.026486152783036232, -0.027992883697152138, 0.04085679352283478, -0.0467708520591259, -0.001373651553876698, -0.02755269967019558, -0.014745809137821198, 0.00519982585683465, -0.00797685794532299, 0.08387129008769989, 0.04540921375155449, 0.012935739010572433, -0.004993715323507786, -0.030260886996984482, -0.05051077902317047, 0.04773706942796707, 0.045264117419719696, -0.015618236735463142, -0.01950959675014019, 0.011610256507992744, 0.04706038534641266, -0.0051176100969314575, 0.045923661440610886, -0.03685460612177849, 0.032901011407375336, -0.07948705554008484, 0.07331667095422745, -0.03509192541241646, -0.09138455986976624, 0.04027252271771431, 0.012090818025171757, 0.012730794958770275, -0.00177858117967844, 0.011991786770522594, 0.043152280151844025, 0.03159952163696289, 0.05842549726366997, -0.09690370410680771, -0.05550326779484749, -0.06438861787319183, 0.036910530179739, 0.028251109644770622, -0.005009662825614214, 0.07529056817293167, -0.07321549952030182, 0.0804227665066719, 0.10430166125297546, -0.03874833881855011, 0.038201961666345596, -0.029846448451280594, -0.036437198519706726, -0.018415018916130066, -0.001473990036174655, 0.03528350219130516, -0.13280121982097626, -0.016325531527400017, 0.15376120805740356, -4.71919783251451e-8, -0.006325267720967531, -0.004322049207985401, -0.09962043911218643, 0.06330035626888275, 0.004076418001204729, -0.011708298698067665, -0.054457150399684906, -0.12133275717496872, 0.043810028582811356, -0.10674558579921722, -0.004778007045388222, -0.07360471040010452, 0.05634437873959541, -0.008697488345205784, 0.008459456264972687, 0.03167647123336792, -0.05405351519584656, -0.08716858923435211, 0.014536214992403984, -0.08878901600837708, 0.06716513633728027, -0.035436078906059265, -0.07409081608057022, 0.07330532371997833, 0.044201985001564026, 0.005417404230684042, 0.05055176094174385, 0.027586935088038445, 0.009969053789973259, 0.009381189942359924, -0.07654403895139694, -0.041624680161476135, 0.08177076280117035, -0.023134902119636536, -0.012472568079829216, 0.01167417224496603, -0.06530825048685074, -0.0041151633486151695, 0.08869200199842453, 0.05224817618727684, 0.005506438668817282, 0.00704610301181674, -0.0008237184374593198, 0.0006452855886891484, -0.062391247600317, 0.01860027387738228, 0.018369024619460106, 0.06272159516811371, 0.0019148181891068816, 0.06643020361661911, -0.0023477349895983934, -0.039740949869155884, 0.00586509658023715, 0.007707793731242418, 0.03531193360686302, -0.03377445414662361, -0.030965695157647133, -0.13718928396701813, -0.01983761414885521, 0.008547509089112282, 0.03482391685247421, 0.008367729373276234, 0.019327029585838318, -0.06893569231033325 ]
0.010139
{string|Buffer|ArrayBuffer|TypedArray|DataView} \* `encoding` {string} String encoding to use when `buffer` is a string. \* Returns: {Decipheriv} The same Decipher for method chaining. When using an authenticated encryption mode (`GCM`, `CCM`, `OCB`, and `chacha20-poly1305` are currently supported), the `decipher.setAuthTag()` method is used to pass in the received \_authentication tag\_. If no tag is provided, or if the cipher text has been tampered with, [`decipher.final()`][] will throw, indicating that the cipher text should be discarded due to failed authentication. If the tag length is invalid according to [NIST SP 800-38D][] or does not match the value of the `authTagLength` option, `decipher.setAuthTag()` will throw an error. The `decipher.setAuthTag()` method must be called before [`decipher.update()`][] for `CCM` mode or before [`decipher.final()`][] for `GCM` and `OCB` modes and `chacha20-poly1305`. `decipher.setAuthTag()` can only be called once. When passing a string as the authentication tag, please consider [caveats when using strings as inputs to cryptographic APIs][]. ### `decipher.setAutoPadding([autoPadding])` \* `autoPadding` {boolean} \*\*Default:\*\* `true` \* Returns: {Decipheriv} The same Decipher for method chaining. When data has been encrypted without standard block padding, calling `decipher.setAutoPadding(false)` will disable automatic padding to prevent [`decipher.final()`][] from checking for and removing padding. Turning auto padding off will only work if the input data's length is a multiple of the ciphers block size. The `decipher.setAutoPadding()` method must be called before [`decipher.final()`][]. ### `decipher.update(data[, inputEncoding][, outputEncoding])` \* `data` {string|Buffer|TypedArray|DataView} \* `inputEncoding` {string} The [encoding][] of the `data` string. \* `outputEncoding` {string} The [encoding][] of the return value. \* Returns: {Buffer | string} Updates the decipher with `data`. If the `inputEncoding` argument is given, the `data` argument is a string using the specified encoding. If the `inputEncoding` argument is not given, `data` must be a [`Buffer`][]. If `data` is a [`Buffer`][] then `inputEncoding` is ignored. The `outputEncoding` specifies the output format of the enciphered data. If the `outputEncoding` is specified, a string using the specified encoding is returned. If no `outputEncoding` is provided, a [`Buffer`][] is returned. The `decipher.update()` method can be called multiple times with new data until [`decipher.final()`][] is called. Calling `decipher.update()` after [`decipher.final()`][] will result in an error being thrown. Even if the underlying cipher implements authentication, the authenticity and integrity of the plaintext returned from this function may be uncertain at this time. For authenticated encryption algorithms, authenticity is generally only established when the application calls [`decipher.final()`][]. ## Class: `DiffieHellman` The `DiffieHellman` class is a utility for creating Diffie-Hellman key exchanges. Instances of the `DiffieHellman` class can be created using the [`crypto.createDiffieHellman()`][] function. ```mjs import assert from 'node:assert'; const { createDiffieHellman, } = await import('node:crypto'); // Generate Alice's keys... const alice = createDiffieHellman(2048); const aliceKey = alice.generateKeys(); // Generate Bob's keys... const bob = createDiffieHellman(alice.getPrime(), alice.getGenerator()); const bobKey = bob.generateKeys(); // Exchange and generate the secret... const aliceSecret = alice.computeSecret(bobKey); const bobSecret = bob.computeSecret(aliceKey); // OK assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); ``` ```cjs const assert = require('node:assert'); const { createDiffieHellman, } = require('node:crypto'); // Generate Alice's keys... const alice = createDiffieHellman(2048); const aliceKey = alice.generateKeys(); // Generate Bob's keys... const bob = createDiffieHellman(alice.getPrime(), alice.getGenerator()); const bobKey = bob.generateKeys(); // Exchange and generate the secret... const aliceSecret = alice.computeSecret(bobKey); const bobSecret = bob.computeSecret(aliceKey); // OK assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); ``` ### `diffieHellman.computeSecret(otherPublicKey[, inputEncoding][, outputEncoding])` \* `otherPublicKey` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `inputEncoding` {string} The [encoding][] of an `otherPublicKey` string. \* `outputEncoding` {string} The [encoding][] of the return value. \* Returns: {Buffer | string} Computes the shared secret using `otherPublicKey` as the other party's public key and returns the computed shared secret. The supplied key is interpreted using the specified `inputEncoding`, and secret is encoded using specified `outputEncoding`. If the `inputEncoding` is not provided, `otherPublicKey` is expected to be a [`Buffer`][], `TypedArray`,
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.030071089044213295, 0.04721904546022415, -0.057323429733514786, -0.02281981147825718, -0.09644872695207596, -0.07230991125106812, 0.06261099874973297, -0.008245707489550114, -0.025923414155840874, -0.05820401385426521, 0.005499797407537699, -0.01998094469308853, 0.07703744620084763, 0.009199399501085281, -0.03394870087504387, -0.015975430607795715, 0.005065660923719406, -0.002631045877933502, 0.004311520140618086, 0.004904158413410187, 0.034432798624038696, -0.061829376965761185, -0.005878807511180639, 0.00475349510088563, 0.015880102291703224, 0.01525639183819294, 0.05177375301718712, 0.004869699943810701, 0.01596461981534958, 0.022980475798249245, 0.05113884434103966, -0.004522299859672785, -0.002257370622828603, 0.09167090803384781, -0.04895299673080444, -0.0072472067549824715, 0.03989119082689285, -0.03497212007641792, -0.03163069486618042, -0.07067862153053284, -0.004657024517655373, 0.03796391934156418, -0.08887217938899994, 0.054823752492666245, -0.00007251021452248096, 0.004511270206421614, -0.049670182168483734, 0.0037087330128997564, -0.10345244407653809, -0.005812236573547125, 0.04802151024341583, 0.04615778475999832, -0.014932096935808659, 0.1004742905497551, -0.0506163127720356, -0.020448951050639153, -0.10651331394910812, 0.02524702623486519, 0.05900447443127632, -0.024586036801338196, -0.028342843055725098, 0.026815682649612427, -0.010705471970140934, 0.10206778347492218, -0.021159140393137932, 0.04353027045726776, 0.03821622580289841, -0.029523421078920364, 0.027017859742045403, 0.010010924190282822, -0.03441466763615608, -0.03136967122554779, -0.04692140221595764, 0.007331381551921368, -0.0515957847237587, 0.05966585502028465, 0.011049055494368076, -0.03825827315449715, -0.02205992490053177, -0.059655364602804184, 0.02035919949412346, -0.03479577973484993, 0.0877024307847023, 0.14069068431854248, 0.07777152955532074, 0.019192852079868317, -0.05942422151565552, 0.023443788290023804, -0.010079803876578808, 0.044883813709020615, 0.08217934519052505, 0.04246635362505913, -0.007718173786997795, 0.0403098464012146, -0.04071974381804466, 0.004838819149881601, -0.0019109962740913033, 0.004104786552488804, -0.09095709770917892, 0.040350209921598434, -0.04908905178308487, -0.010720629245042801, 0.007346280850470066, -0.06950976699590683, 0.029269272461533546, 0.05738455802202225, 0.07572586834430695, -0.06566338241100311, 0.037611328065395355, 0.02434682659804821, 0.014205717481672764, 0.029132701456546783, -0.020405279472470284, -0.038707878440618515, 0.025187082588672638, 0.1023700162768364, -0.05716991052031517, 0.03553890809416771, -0.0208097156137228, 0.09090480208396912, -0.005587537307292223, -0.01826663874089718, -0.044149577617645264, -0.04642548784613609, -0.055831294506788254, -0.021290915086865425, 0.02117621712386608, 5.8130274803795134e-33, -0.005339676979929209, -0.062198128551244736, -0.016230162233114243, 0.019522545859217644, -0.035214416682720184, 0.04353030398488045, 0.019742721691727638, 0.018553080037236214, -0.05802348628640175, -0.01729394495487213, 0.032014619559049606, -0.04830021411180496, 0.038446761667728424, 0.01154126413166523, -0.010552442632615566, 0.10139138251543045, 0.05557098612189293, -0.012498126365244389, 0.02275770716369152, 0.08316704630851746, 0.06562584638595581, 0.024380501359701157, 0.06667326390743256, -0.060042403638362885, 0.014914623461663723, 0.01641199178993702, -0.005107587203383446, -0.03790127858519554, 0.03617505729198456, 0.039858128875494, -0.04522186145186424, -0.08469948917627335, -0.0018773095216602087, 0.029264964163303375, 0.018607495352625847, -0.014833961613476276, 0.09410508722066879, -0.03660508990287781, -0.06247502565383911, -0.10547526925802231, -0.045726653188467026, -0.04483989253640175, -0.008969396352767944, -0.08611617237329483, -0.002563980408012867, -0.03955404832959175, -0.01720474846661091, -0.031030863523483276, -0.023456808179616928, 0.11074570566415787, -0.01978735253214836, 0.0337517149746418, -0.10851313173770905, -0.04630272462964058, -0.03590533882379532, -0.10261224955320358, -0.0008555934764444828, 0.012081533670425415, 0.008254717104136944, -0.039323147386312485, -0.0214784424751997, -0.01291939988732338, -0.03446124494075775, -0.07885059714317322, 0.03898647800087929, 0.06018209457397461, 0.0008582124719396234, -0.03787222132086754, -0.057485681027173996, 0.012173663824796677, -0.1015988290309906, -0.012484489940106869, -0.009446743875741959, 0.07420160621404648, -0.03448757901787758, -0.044734466820955276, -0.06105204299092293, -0.02029692754149437, 0.014279763214290142, 0.03667245805263519, 0.01748163439333439, -0.011292725801467896, -0.02680804766714573, 0.060716841369867325, -0.07714783400297165, 0.0010844373609870672, 0.0542878732085228, -0.03546759486198425, 0.0015748448204249144, 0.02495534159243107, 0.004109908360987902, -0.04885481297969818, 0.04307083040475845, -0.053098469972610474, -0.02318905107676983, -6.72325316383952e-33, 0.02049916796386242, -0.050596293061971664, -0.08379404991865158, 0.05355648323893547, 0.011943673714995384, -0.05936620011925697, 0.06314856559038162, 0.11254880577325821, 0.012071793898940086, -0.10981541872024536, 0.043614745140075684, 0.00824123527854681, 0.00893731601536274, 0.04024268686771393, 0.10076174139976501, 0.0336453877389431, -0.06929696351289749, 0.05432606488466263, 0.054784681648015976, -0.011654527857899666, -0.018035508692264557, 0.020031044259667397, -0.025042444467544556, 0.07214603573083878, 0.04823743551969528, 0.04800086468458176, 0.04630790650844574, 0.02146856300532818, 0.078599713742733, -0.020628320053219795, -0.0032299149315804243, 0.10958604514598846, -0.04124210774898529, 0.04292726889252663, -0.05879921466112137, -0.031237876042723656, 0.051899563521146774, 0.08177674561738968, -0.04138613119721413, 0.012970350682735443, 0.07361367344856262, -0.03427448496222496, -0.034979548305273056, 0.03221677243709564, 0.07807905972003937, -0.06492430716753006, -0.024280060082674026, 0.061395011842250824, 0.008055062033236027, -0.0006499736336991191, 0.12292959541082382, -0.05284035950899124, 0.01314540021121502, 0.031780872493982315, 0.02343955636024475, 0.01708187349140644, 0.08065474778413773, -0.036658551543951035, -0.028400225564837456, -0.056711651384830475, -0.04462180286645889, -0.04622000828385353, 0.08663804084062576, -0.01739451102912426, 0.03485282137989998, 0.06388992071151733, -0.062842458486557, 0.021012838929891586, -0.02401304803788662, 0.013884221203625202, 0.018735161051154137, -0.06586061418056488, 0.019669370725750923, 0.03183163329958916, 0.021729405969381332, -0.008384887129068375, -0.032363906502723694, -0.046694643795490265, 0.014765076339244843, 0.05533112585544586, 0.021534843370318413, -0.015882443636655807, 0.03031180240213871, 0.16497495770454407, 0.09151327610015869, -0.07625215500593185, -0.038103945553302765, 0.012883049435913563, -0.036358341574668884, -0.0033857563976198435, -0.046946343034505844, 0.010615670122206211, -0.06109864264726639, 0.06665631383657455, 0.05651502311229706, -5.819978099452783e-8, -0.07344229519367218, -0.07941746711730957, -0.10660231113433838, 0.018504951149225235, -0.0014266164507716894, 0.088453508913517, -0.06094122678041458, -0.1797717809677124, -0.010370505042374134, -0.09869534522294998, 0.06895706057548523, -0.0004565600829664618, -0.03388996049761772, -0.0009690820006653666, -0.05225555598735809, 0.01236829161643982, -0.012036354281008244, -0.1287427395582199, -0.012749752961099148, -0.05893342196941376, -0.03520278260111809, -0.030957523733377457, -0.09651662409305573, 0.00031508703250437975, 0.006870011333376169, 0.06831078231334686, -0.013123816810548306, 0.08498987555503845, -0.04979999363422394, 0.01116931438446045, 0.011534436605870724, -0.0062700617127120495, 0.05846408009529114, -0.04384799674153328, -0.017251070588827133, 0.07548845559358597, 0.004147709812968969, -0.06284241378307343, 0.11471955478191376, 0.02036171965301037, 0.043093789368867874, 0.02734205685555935, -0.010618380270898342, -0.030520204454660416, 0.0010294715175405145, -0.03970954194664955, 0.08389269560575485, 0.02354101464152336, 0.003640285925939679, 0.056819282472133636, -0.029083985835313797, -0.05685122311115265, -0.07717375457286835, 0.0633406937122345, -0.044950421899557114, -0.03719134256243706, -0.008006800897419453, -0.14014850556850433, 0.046285878866910934, -0.011181258596479893, 0.057292308658361435, -0.01228038128465414, 0.04712293669581413, -0.06708171218633652 ]
-0.041197
| string} Computes the shared secret using `otherPublicKey` as the other party's public key and returns the computed shared secret. The supplied key is interpreted using the specified `inputEncoding`, and secret is encoded using specified `outputEncoding`. If the `inputEncoding` is not provided, `otherPublicKey` is expected to be a [`Buffer`][], `TypedArray`, or `DataView`. If `outputEncoding` is given a string is returned; otherwise, a [`Buffer`][] is returned. ### `diffieHellman.generateKeys([encoding])` \* `encoding` {string} The [encoding][] of the return value. \* Returns: {Buffer | string} Generates private and public Diffie-Hellman key values unless they have been generated or computed already, and returns the public key in the specified `encoding`. This key should be transferred to the other party. If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. This function is a thin wrapper around [`DH\_generate\_key()`][]. In particular, once a private key has been generated or set, calling this function only updates the public key but does not generate a new private key. ### `diffieHellman.getGenerator([encoding])` \* `encoding` {string} The [encoding][] of the return value. \* Returns: {Buffer | string} Returns the Diffie-Hellman generator in the specified `encoding`. If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. ### `diffieHellman.getPrime([encoding])` \* `encoding` {string} The [encoding][] of the return value. \* Returns: {Buffer | string} Returns the Diffie-Hellman prime in the specified `encoding`. If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. ### `diffieHellman.getPrivateKey([encoding])` \* `encoding` {string} The [encoding][] of the return value. \* Returns: {Buffer | string} Returns the Diffie-Hellman private key in the specified `encoding`. If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. ### `diffieHellman.getPublicKey([encoding])` \* `encoding` {string} The [encoding][] of the return value. \* Returns: {Buffer | string} Returns the Diffie-Hellman public key in the specified `encoding`. If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. ### `diffieHellman.setPrivateKey(privateKey[, encoding])` \* `privateKey` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `encoding` {string} The [encoding][] of the `privateKey` string. Sets the Diffie-Hellman private key. If the `encoding` argument is provided, `privateKey` is expected to be a string. If no `encoding` is provided, `privateKey` is expected to be a [`Buffer`][], `TypedArray`, or `DataView`. This function does not automatically compute the associated public key. Either [`diffieHellman.setPublicKey()`][] or [`diffieHellman.generateKeys()`][] can be used to manually provide the public key or to automatically derive it. ### `diffieHellman.setPublicKey(publicKey[, encoding])` \* `publicKey` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `encoding` {string} The [encoding][] of the `publicKey` string. Sets the Diffie-Hellman public key. If the `encoding` argument is provided, `publicKey` is expected to be a string. If no `encoding` is provided, `publicKey` is expected to be a [`Buffer`][], `TypedArray`, or `DataView`. ### `diffieHellman.verifyError` A bit field containing any warnings and/or errors resulting from a check performed during initialization of the `DiffieHellman` object. The following values are valid for this property (as defined in `node:constants` module): \* `DH\_CHECK\_P\_NOT\_SAFE\_PRIME` \* `DH\_CHECK\_P\_NOT\_PRIME` \* `DH\_UNABLE\_TO\_CHECK\_GENERATOR` \* `DH\_NOT\_SUITABLE\_GENERATOR` ## Class: `DiffieHellmanGroup` The `DiffieHellmanGroup` class takes a well-known modp group as its argument. It works the same as `DiffieHellman`, except that it does not allow changing its keys after creation. In other words, it does not implement `setPublicKey()` or `setPrivateKey()` methods. ```mjs const { createDiffieHellmanGroup } = await import('node:crypto'); const dh = createDiffieHellmanGroup('modp16'); ``` ```cjs const { createDiffieHellmanGroup } = require('node:crypto'); const dh = createDiffieHellmanGroup('modp16'); ``` The following groups are supported: \* `'modp14'` (2048 bits, [RFC 3526][] Section 3) \* `'modp15'` (3072 bits, [RFC 3526][] Section 4) \* `'modp16'` (4096 bits, [RFC 3526][] Section 5) \* `'modp17'` (6144 bits, [RFC 3526][] Section 6) \* `'modp18'` (8192 bits, [RFC 3526][] Section 7) The following groups are still supported but deprecated (see [Caveats][]):
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.04676452651619911, 0.009864358231425285, -0.02536650374531746, -0.029820913448929787, -0.07132168859243393, -0.051038458943367004, 0.0718829482793808, -0.06476699560880661, 0.019918300211429596, -0.047729477286338806, 0.037698157131671906, -0.021369153633713722, 0.02566414326429367, -0.061670802533626556, -0.01023019663989544, 0.022835748270154, 0.008713115006685257, -0.04148153215646744, -0.07845380157232285, -0.06984470784664154, 0.09573168307542801, 0.0009225120884366333, -0.005078379530459642, -0.024304566904902458, 0.0029510583262890577, 0.061895910650491714, 0.04277138411998749, 0.030515672639012337, 0.02967781387269497, -0.0065511795692145824, 0.052314840257167816, -0.05356619879603386, -0.05930906906723976, 0.05454408377408981, -0.05452670902013779, 0.1014576405286789, -0.006221756339073181, -0.016004236415028572, 0.08982197195291519, -0.017055131494998932, 0.011802762746810913, -0.03769193962216377, -0.05846351385116577, 0.029932664707303047, -0.09293282777070999, 0.09248765558004379, -0.05379265919327736, 0.07387998700141907, -0.10240822285413742, -0.05270317941904068, 0.019208522513508797, 0.07903441786766052, -0.03529781848192215, 0.06750572472810745, 0.03471048176288605, -0.021690715104341507, -0.0400032177567482, 0.02577519789338112, -0.016833405941724777, 0.026154259219765663, -0.0727953240275383, -0.0009257934289053082, 0.0033015781082212925, 0.04652516916394234, 0.028487032279372215, -0.08099213987588882, 0.08930234611034393, -0.005113969556987286, 0.02001098170876503, -0.10760527104139328, -0.0009928602958098054, -0.009952131658792496, 0.008487154729664326, -0.03684043511748314, -0.022845709696412086, 0.019636671990156174, -0.02219819277524948, -0.03164118155837059, -0.008442231453955173, -0.08090758323669434, 0.08319580554962158, 0.0008811978041194379, 0.05031014233827591, 0.09371087700128555, 0.06352339684963226, 0.041405193507671356, -0.08439302444458008, 0.069172702729702, -0.014286953024566174, 0.009293638169765472, -0.03071814402937889, -0.03141484782099724, -0.049516476690769196, 0.07492103427648544, 0.03371661528944969, 0.003984410781413317, 0.04067098721861839, 0.009821631945669651, -0.09709705412387848, 0.0500679612159729, -0.04072599485516548, 0.07610408961772919, 0.09366476535797119, -0.11504201591014862, 0.010457208380103111, 0.018992962315678596, -0.0012279998045414686, -0.01575896143913269, 0.016076797619462013, 0.018130850046873093, -0.002089583547785878, 0.0440816804766655, 0.0176226906478405, -0.0073582809418439865, 0.016430005431175232, 0.06031084805727005, -0.030603764578700066, 0.0364348329603672, 0.04846913740038872, 0.00014382158406078815, -0.014977004379034042, 0.01999123953282833, 0.00446659792214632, 0.08329323679208755, -0.07178813964128494, -0.0345999151468277, -0.023010659962892532, 1.3435378804280569e-33, -0.0025494585279375315, -0.007971588522195816, -0.03651381656527519, -0.03047225996851921, -0.06462661176919937, 0.06828556209802628, -0.030995052307844162, 0.028523879125714302, -0.046221524477005005, -0.02220126800239086, -0.012206041254103184, -0.05638720095157623, 0.05348510667681694, 0.015332449227571487, 0.0009389886981807649, 0.03365042433142662, 0.029249267652630806, 0.04783777520060539, 0.0753001943230629, 0.053757209330797195, 0.05498531088232994, 0.1451435089111328, -0.000012152984709246084, -0.029352804645895958, -0.035173285752534866, 0.03442535176873207, 0.02545783855021, -0.0561562143266201, 0.011280293576419353, 0.024052998051047325, 0.0459473691880703, -0.01737784780561924, 0.04020658880472183, -0.07461393624544144, 0.019675908610224724, -0.014575695618987083, 0.017353102564811707, -0.05479872226715088, -0.054449036717414856, -0.09697438031435013, -0.04119893163442612, -0.022222647443413734, -0.060200098901987076, -0.0555361732840538, -0.018731577321887016, -0.04281638190150261, -0.07020717114210129, 0.042417269200086594, -0.030304914340376854, -0.025179805234074593, 0.03614562377333641, -0.019033601507544518, -0.06404076516628265, -0.007948351092636585, -0.05732662230730057, -0.04350163787603378, 0.037858277559280396, -0.02360285073518753, 0.04897956922650337, 0.09994286298751831, -0.041440773755311966, 0.08430898189544678, -0.00042849351302720606, -0.01123119331896305, -0.026804571971297264, 0.024879736825823784, 0.014699190855026245, -0.07223597168922424, 0.055519312620162964, 0.03407154604792595, -0.10892345011234283, 0.014976209960877895, -0.06720928102731705, 0.04996988922357559, -0.018396954983472824, 0.003409020835533738, -0.08577563613653183, -0.06917016953229904, 0.0556320920586586, -0.04153883829712868, 0.05185355246067047, 0.029301997274160385, 0.024785270914435387, 0.039812617003917694, -0.10503687709569931, 0.00044412887655198574, -0.08494727313518524, -0.059270795434713364, -0.06840451806783676, 0.013058780692517757, -0.019587622955441475, -0.08688493072986603, -0.03541331738233566, -0.04775967821478844, 0.05765557661652565, -5.681490397206469e-33, -0.0162041075527668, 0.04528869315981865, -0.10126974433660507, 0.02538789063692093, 0.02164413593709469, -0.01016523502767086, 0.027343934401869774, -0.017640994861721992, -0.06077828258275986, -0.02516758069396019, -0.026185594499111176, 0.03646121546626091, 0.05695294961333275, -0.03470559045672417, 0.06695018708705902, 0.04143616557121277, -0.057344142347574234, 0.05572489649057388, 0.0486447773873806, 0.003156034741550684, 0.07826056331396103, 0.032241299748420715, 0.05615466833114624, 0.10791730880737305, 0.004635241348296404, 0.0473235584795475, 0.04337463155388832, -0.0010181211400777102, 0.0865766704082489, 0.04576864093542099, -0.007893231697380543, 0.027192872017621994, -0.06934912502765656, -0.035743728280067444, -0.10388408601284027, -0.06017417460680008, -0.059641335159540176, 0.03254534676671028, -0.0037043201737105846, 0.04067934677004814, 0.046407829970121384, 0.03736208379268646, 0.070553258061409, -0.019989624619483948, -0.018097015097737312, -0.021378763020038605, -0.011545302346348763, 0.029991604387760162, 0.014977404847741127, -0.07188994437456131, 0.0923970639705658, 0.008353123441338539, -0.08037625998258591, -0.03290114179253578, -0.008618100546300411, 0.04614274203777313, -0.03766108676791191, 0.017567118629813194, 0.0181758813560009, -0.06266874819993973, -0.040162645280361176, -0.07803553342819214, 0.017236709594726562, 0.08594284951686859, -0.04705622419714928, -0.062206290662288666, -0.026036720722913742, -0.06610585749149323, 0.0684363916516304, -0.014594798907637596, 0.012705203145742416, -0.03067362681031227, 0.06187770888209343, -0.02195587195456028, 0.05989253893494606, 0.015017644502222538, -0.08404332399368286, -0.023281116038560867, -0.010847131721675396, 0.11863049119710922, 0.01604454778134823, 0.057901106774806976, 0.03677957504987717, 0.03111974149942398, 0.09113094210624695, -0.06773541122674942, 0.08868979662656784, 0.01580137573182583, -0.08278637379407883, -0.05136431008577347, 0.005430975463241339, 0.09767183661460876, -0.11505565792322159, 0.001322268508374691, 0.07431907206773758, -6.046177247753803e-8, 0.014604408293962479, -0.042744725942611694, -0.006561751943081617, 0.003937060944736004, -0.05369037017226219, -0.06391844898462296, -0.021770736202597618, -0.050968021154403687, 0.010781614109873772, -0.07486458122730255, 0.07570505887269974, 0.003780229715630412, -0.05070698261260986, -0.010774010792374611, -0.006859054788947105, -0.02544746734201908, -0.03659117966890335, -0.10269345343112946, -0.013602030463516712, -0.07858427613973618, 0.016827721148729324, -0.12615646421909332, -0.057932622730731964, -0.033409614115953445, -0.053505100309848785, 0.041084468364715576, 0.013727590441703796, 0.013943306170403957, -0.0143099594861269, 0.04269270971417427, 0.13122452795505524, -0.021608546376228333, 0.02650333382189274, -0.01526999194175005, -0.03693315014243126, 0.06640402972698212, -0.05484785512089729, -0.0394606739282608, 0.0727977454662323, 0.13944381475448608, 0.01004842296242714, -0.016581257805228233, 0.005300713237375021, 0.04165022075176239, 0.03469851240515709, -0.0033125837799161673, 0.10684716701507568, 0.008512872271239758, -0.03379449248313904, 0.06965102255344391, -0.0033060028217732906, -0.057604700326919556, -0.028694164007902145, -0.020976271480321884, -0.034140072762966156, -0.01178179681301117, -0.09695760905742645, -0.025921713560819626, 0.03971140459179878, -0.024864470586180687, 0.044095881283283234, 0.020700890570878983, 0.02212338149547577, 0.002494342625141144 ]
0.007865
\* `'modp14'` (2048 bits, [RFC 3526][] Section 3) \* `'modp15'` (3072 bits, [RFC 3526][] Section 4) \* `'modp16'` (4096 bits, [RFC 3526][] Section 5) \* `'modp17'` (6144 bits, [RFC 3526][] Section 6) \* `'modp18'` (8192 bits, [RFC 3526][] Section 7) The following groups are still supported but deprecated (see [Caveats][]): \* `'modp1'` (768 bits, [RFC 2409][] Section 6.1) \* `'modp2'` (1024 bits, [RFC 2409][] Section 6.2) \* `'modp5'` (1536 bits, [RFC 3526][] Section 2) These deprecated groups might be removed in future versions of Node.js. ## Class: `ECDH` The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH) key exchanges. Instances of the `ECDH` class can be created using the [`crypto.createECDH()`][] function. ```mjs import assert from 'node:assert'; const { createECDH, } = await import('node:crypto'); // Generate Alice's keys... const alice = createECDH('secp521r1'); const aliceKey = alice.generateKeys(); // Generate Bob's keys... const bob = createECDH('secp521r1'); const bobKey = bob.generateKeys(); // Exchange and generate the secret... const aliceSecret = alice.computeSecret(bobKey); const bobSecret = bob.computeSecret(aliceKey); assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); // OK ``` ```cjs const assert = require('node:assert'); const { createECDH, } = require('node:crypto'); // Generate Alice's keys... const alice = createECDH('secp521r1'); const aliceKey = alice.generateKeys(); // Generate Bob's keys... const bob = createECDH('secp521r1'); const bobKey = bob.generateKeys(); // Exchange and generate the secret... const aliceSecret = alice.computeSecret(bobKey); const bobSecret = bob.computeSecret(aliceKey); assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); // OK ``` ### Static method: `ECDH.convertKey(key, curve[, inputEncoding[, outputEncoding[, format]]])` \* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `curve` {string} \* `inputEncoding` {string} The [encoding][] of the `key` string. \* `outputEncoding` {string} The [encoding][] of the return value. \* `format` {string} \*\*Default:\*\* `'uncompressed'` \* Returns: {Buffer | string} Converts the EC Diffie-Hellman public key specified by `key` and `curve` to the format specified by `format`. The `format` argument specifies point encoding and can be `'compressed'`, `'uncompressed'` or `'hybrid'`. The supplied key is interpreted using the specified `inputEncoding`, and the returned key is encoded using the specified `outputEncoding`. Use [`crypto.getCurves()`][] to obtain a list of available curve names. On recent OpenSSL releases, `openssl ecparam -list\_curves` will also display the name and description of each available elliptic curve. If `format` is not specified the point will be returned in `'uncompressed'` format. If the `inputEncoding` is not provided, `key` is expected to be a [`Buffer`][], `TypedArray`, or `DataView`. Example (uncompressing a key): ```mjs const { createECDH, ECDH, } = await import('node:crypto'); const ecdh = createECDH('secp256k1'); ecdh.generateKeys(); const compressedKey = ecdh.getPublicKey('hex', 'compressed'); const uncompressedKey = ECDH.convertKey(compressedKey, 'secp256k1', 'hex', 'hex', 'uncompressed'); // The converted key and the uncompressed public key should be the same console.log(uncompressedKey === ecdh.getPublicKey('hex')); ``` ```cjs const { createECDH, ECDH, } = require('node:crypto'); const ecdh = createECDH('secp256k1'); ecdh.generateKeys(); const compressedKey = ecdh.getPublicKey('hex', 'compressed'); const uncompressedKey = ECDH.convertKey(compressedKey, 'secp256k1', 'hex', 'hex', 'uncompressed'); // The converted key and the uncompressed public key should be the same console.log(uncompressedKey === ecdh.getPublicKey('hex')); ``` ### `ecdh.computeSecret(otherPublicKey[, inputEncoding][, outputEncoding])` \* `otherPublicKey` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `inputEncoding` {string} The [encoding][] of the `otherPublicKey` string. \* `outputEncoding` {string} The [encoding][] of the return value. \* Returns: {Buffer | string} Computes the shared secret using `otherPublicKey` as the other party's public key and returns the computed shared secret. The supplied key is interpreted using specified `inputEncoding`, and the returned secret is encoded using the specified `outputEncoding`. If the `inputEncoding` is not provided, `otherPublicKey` is expected to be a [`Buffer`][], `TypedArray`, or `DataView`. If `outputEncoding` is given a string will be returned; otherwise a [`Buffer`][] is returned. `ecdh.computeSecret` will throw an `ERR\_CRYPTO\_ECDH\_INVALID\_PUBLIC\_KEY` error when `otherPublicKey` lies outside of the elliptic curve. Since `otherPublicKey` is usually supplied from a remote user over an insecure network, be sure to handle this exception accordingly. ### `ecdh.generateKeys([encoding[, format]])` \* `encoding` {string} The
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.08323830366134644, 0.03768079727888107, 0.06545790284872055, -0.03381650149822235, 0.08132858574390411, -0.050915829837322235, -0.048986054956912994, -0.03189641982316971, -0.03823881596326828, -0.007172496989369392, 0.0012319142697378993, 0.03602224960923195, -0.03666647523641586, 0.031676825135946274, 0.06593070924282074, 0.02166086621582508, -0.02724519558250904, 0.017042694613337517, -0.008512106724083424, -0.0505804717540741, -0.016190027818083763, 0.05160665884613991, -0.04808104410767555, -0.013452108949422836, 0.01580236293375492, 0.02114497683942318, -0.06793215125799179, 0.055942464619874954, 0.06057961285114288, -0.0070871212519705296, -0.011629221960902214, 0.026375247165560722, -0.017734451219439507, -0.005377623252570629, -0.025325506925582886, 0.1226496696472168, 0.05396495386958122, -0.04491904377937317, 0.0015292027965188026, 0.018452487885951996, 0.006564507260918617, 0.052231818437576294, -0.02538679540157318, -0.04061590135097504, -0.020586583763360977, 0.0012077337596565485, -0.04517649486660957, 0.026446256786584854, -0.09339015930891037, -0.037982501089572906, 0.10078327357769012, 0.026103222742676735, 0.032818011939525604, 0.04210402071475983, 0.03635144606232643, -0.08858441561460495, -0.1163291335105896, 0.02179238200187683, -0.004195274319499731, 0.06671269983053207, -0.07151181995868683, -0.013767308555543423, -0.035382986068725586, -0.05132422223687172, -0.0011065152939409018, 0.02051321230828762, 0.0802207887172699, -0.053582146763801575, 0.0030860062688589096, 0.06684628129005432, -0.08768848329782486, -0.011389586143195629, -0.06529270857572556, 0.0802495926618576, -0.04967852309346199, 0.04262610152363777, 0.029567385092377663, -0.01834808848798275, -0.03937220945954323, -0.07723408192396164, -0.01379634439945221, -0.00368420104496181, 0.0782274380326271, 0.05296572670340538, 0.007070362102240324, 0.006802954711019993, -0.029381822794675827, 0.005532235838472843, -0.052040114998817444, 0.046189263463020325, -0.068062424659729, -0.028320394456386566, 0.08324720710515976, 0.10722280293703079, 0.02110554836690426, 0.044438693672418594, 0.04515131562948227, -0.005170620512217283, -0.014846722595393658, 0.03974989801645279, -0.025145649909973145, 0.08620582520961761, -0.07362035661935806, -0.0763128399848938, -0.029209163039922714, -0.043366700410842896, -0.03225213289260864, 0.043700896203517914, 0.04905971884727478, 0.029445389285683632, -0.019094886258244514, 0.03199075534939766, -0.039729803800582886, -0.15712787210941315, -0.01215168833732605, -0.09865881502628326, -0.03744899481534958, -0.02903728559613228, 0.060119278728961945, 0.0878908634185791, 0.04052216559648514, 0.010134993121027946, -0.021795403212308884, 0.05987485870718956, 0.015661753714084625, -0.03033931367099285, -0.0579833984375, 4.7978360288628305e-33, 0.030210455879569054, 0.03873632475733757, 0.007514579221606255, 0.03535466641187668, -0.002033298136666417, 0.02396145835518837, -0.014213156886398792, 0.061143673956394196, -0.10910160839557648, -0.04493115842342377, -0.014524905011057854, -0.0162307508289814, 0.0019239167449995875, -0.04117526486515999, 0.11470036208629608, -0.06204180046916008, 0.03379696607589722, 0.004227159079164267, 0.10832280665636063, -0.007491272408515215, -0.07282787561416626, 0.08370251208543777, 0.010583790019154549, 0.04729113727807999, 0.011478321626782417, 0.05815154314041138, 0.00760085741057992, -0.02490573562681675, 0.04936668276786804, 0.03353974223136902, 0.006201248150318861, 0.021855898201465607, -0.11292057484388351, -0.002426637103781104, -0.0037712359335273504, 0.00020245480118319392, -0.015875838696956635, -0.06806272268295288, -0.07224977016448975, -0.044722624123096466, 0.004410130903124809, 0.08700855821371078, -0.08213341236114502, 0.010319918394088745, 0.050967536866664886, -0.08330585807561874, -0.001640558009967208, 0.0001353297266177833, 0.0264283400028944, -0.039475902915000916, -0.027619367465376854, 0.055696118623018265, 0.04814733564853668, -0.10246516019105911, 0.0034363188315182924, -0.10332295298576355, 0.02691139280796051, -0.00709680886939168, 0.0017568387556821108, 0.05635390430688858, 0.07119663804769516, 0.08796070516109467, -0.010390170849859715, -0.03784744068980217, -0.0026751665864139795, 0.05438600853085518, -0.023417804390192032, -0.03999263420701027, -0.02983582764863968, 0.02234494499862194, -0.0510205514729023, 0.04759318009018898, 0.05219832435250282, 0.10175161808729172, 0.002686073537915945, -0.038902707397937775, 0.005607833620160818, -0.02403232455253601, 0.08205600827932358, -0.005518106743693352, -0.030568528920412064, -0.012942091561853886, -0.011135485954582691, 0.0027040650602430105, 0.04216786101460457, -0.0920838788151741, 0.019941259175539017, 0.008815445937216282, 0.08909530937671661, 0.01900605857372284, 0.013589956797659397, -0.08377913385629654, 0.0029194692615419626, -0.007833477109670639, -0.10232343524694443, -5.8449612537875394e-33, -0.01711191236972809, 0.05124763771891594, -0.12985928356647491, 0.08751196414232254, -0.04774392768740654, -0.06837482005357742, 0.03996981680393219, -0.015602026134729385, 0.054472021758556366, 0.01593730039894581, 0.08900268375873566, -0.029972488060593605, 0.09490301460027695, -0.04084012284874916, 0.03373051807284355, -0.021564114838838577, -0.17897525429725647, -0.012455019168555737, 0.024106165394186974, 0.0013432445703074336, 0.055463504046201706, 0.032163649797439575, -0.03559255972504616, 0.0640595480799675, 0.06471700966358185, 0.006189681589603424, -0.06843021512031555, -0.023123711347579956, 0.016358109191060066, -0.04500703141093254, -0.056139446794986725, 0.031299520283937454, -0.012851517647504807, -0.027257943525910378, -0.01998472958803177, -0.04626883566379547, -0.04962907359004021, 0.10161343961954117, 0.048401862382888794, -0.06165781989693642, 0.013233178295195103, 0.03357936069369316, 0.010138828307390213, 0.06280355155467987, 0.01182889100164175, -0.002797877648845315, 0.041237618774175644, 0.07062843441963196, 0.05553460866212845, -0.013901611790060997, 0.0020023987162858248, -0.016355369240045547, 0.0017404773971065879, -0.02184952422976494, 0.022553160786628723, -0.008595307357609272, -0.05289001017808914, 0.0379074402153492, 0.0806855782866478, 0.011067033745348454, 0.027473021298646927, -0.04660631716251373, 0.046342041343450546, 0.08267546445131302, 0.0419810526072979, -0.06088076904416084, -0.08265358954668045, -0.04473382607102394, 0.009763656184077263, -0.033282067626714706, -0.003543719882145524, -0.04112621769309044, 0.014658903703093529, -0.04651188105344772, 0.035736069083213806, -0.010704214684665203, 0.042300790548324585, 0.04519723728299141, -0.03540501743555069, 0.06015147641301155, -0.005621061660349369, 0.13488973677158356, -0.015788564458489418, 0.0315561443567276, 0.013252823613584042, -0.012218471616506577, 0.04034839943051338, 0.08211860060691833, -0.056300073862075806, -0.013061238452792168, -0.008736515417695045, 0.055030155926942825, 0.012788772583007812, 0.0832061842083931, -0.01093079149723053, -4.822832977424696e-8, -0.006435480434447527, 0.0038759594317525625, -0.05218389257788658, -0.07797800004482269, 0.06551651656627655, -0.02062651887536049, -0.03809715434908867, 0.025832200422883034, 0.05238790065050125, -0.0010862518101930618, 0.09628955274820328, 0.048389121890068054, -0.05564090982079506, -0.08988942205905914, 0.009584088809788227, -0.008739285171031952, -0.046296387910842896, -0.007591562811285257, -0.04248090460896492, 0.03709939122200012, -0.03425278514623642, -0.023078881204128265, -0.012784740887582302, -0.03449370712041855, -0.04483281448483467, -0.05608244985342026, -0.009553706273436546, -0.0065735867246985435, 0.013402813114225864, -0.03614412620663643, -0.08827687799930573, 0.03272423520684242, 0.039634209126234055, -0.07470382004976273, -0.03552279248833656, 0.06299477815628052, -0.1029253900051117, 0.005261272192001343, 0.023147039115428925, 0.04474825784564018, 0.038996435701847076, -0.14655150473117828, -0.07146024703979492, 0.05029567703604698, 0.08700685948133469, -0.0011452795006334782, 0.010422768071293831, 0.054753419011831284, -0.1016804575920105, -0.02623065747320652, 0.004793285392224789, -0.004715085495263338, -0.006972422357648611, -0.034004081040620804, 0.009402948431670666, 0.06684921681880951, -0.07214684784412384, -0.09621728211641312, 0.057130198925733566, -0.05537664145231247, 0.03881412744522095, -0.02166786789894104, 0.0362488254904747, -0.005168847274035215 ]
0.089857
string will be returned; otherwise a [`Buffer`][] is returned. `ecdh.computeSecret` will throw an `ERR\_CRYPTO\_ECDH\_INVALID\_PUBLIC\_KEY` error when `otherPublicKey` lies outside of the elliptic curve. Since `otherPublicKey` is usually supplied from a remote user over an insecure network, be sure to handle this exception accordingly. ### `ecdh.generateKeys([encoding[, format]])` \* `encoding` {string} The [encoding][] of the return value. \* `format` {string} \*\*Default:\*\* `'uncompressed'` \* Returns: {Buffer | string} Generates private and public EC Diffie-Hellman key values, and returns the public key in the specified `format` and `encoding`. This key should be transferred to the other party. The `format` argument specifies point encoding and can be `'compressed'` or `'uncompressed'`. If `format` is not specified, the point will be returned in `'uncompressed'` format. If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. ### `ecdh.getPrivateKey([encoding])` \* `encoding` {string} The [encoding][] of the return value. \* Returns: {Buffer | string} The EC Diffie-Hellman in the specified `encoding`. If `encoding` is specified, a string is returned; otherwise a [`Buffer`][] is returned. ### `ecdh.getPublicKey([encoding][, format])` \* `encoding` {string} The [encoding][] of the return value. \* `format` {string} \*\*Default:\*\* `'uncompressed'` \* Returns: {Buffer | string} The EC Diffie-Hellman public key in the specified `encoding` and `format`. The `format` argument specifies point encoding and can be `'compressed'` or `'uncompressed'`. If `format` is not specified the point will be returned in `'uncompressed'` format. If `encoding` is specified, a string is returned; otherwise a [`Buffer`][] is returned. ### `ecdh.setPrivateKey(privateKey[, encoding])` \* `privateKey` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `encoding` {string} The [encoding][] of the `privateKey` string. Sets the EC Diffie-Hellman private key. If `encoding` is provided, `privateKey` is expected to be a string; otherwise `privateKey` is expected to be a [`Buffer`][], `TypedArray`, or `DataView`. If `privateKey` is not valid for the curve specified when the `ECDH` object was created, an error is thrown. Upon setting the private key, the associated public point (key) is also generated and set in the `ECDH` object. ### `ecdh.setPublicKey(publicKey[, encoding])` > Stability: 0 - Deprecated \* `publicKey` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `encoding` {string} The [encoding][] of the `publicKey` string. Sets the EC Diffie-Hellman public key. If `encoding` is provided `publicKey` is expected to be a string; otherwise a [`Buffer`][], `TypedArray`, or `DataView` is expected. There is not normally a reason to call this method because `ECDH` only requires a private key and the other party's public key to compute the shared secret. Typically either [`ecdh.generateKeys()`][] or [`ecdh.setPrivateKey()`][] will be called. The [`ecdh.setPrivateKey()`][] method attempts to generate the public point/key associated with the private key being set. Example (obtaining a shared secret): ```mjs const { createECDH, createHash, } = await import('node:crypto'); const alice = createECDH('secp256k1'); const bob = createECDH('secp256k1'); // This is a shortcut way of specifying one of Alice's previous private // keys. It would be unwise to use such a predictable private key in a real // application. alice.setPrivateKey( createHash('sha256').update('alice', 'utf8').digest(), ); // Bob uses a newly generated cryptographically strong // pseudorandom key pair bob.generateKeys(); const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); // aliceSecret and bobSecret should be the same shared secret value console.log(aliceSecret === bobSecret); ``` ```cjs const { createECDH, createHash, } = require('node:crypto'); const alice = createECDH('secp256k1'); const bob = createECDH('secp256k1'); // This is a shortcut way of specifying one of Alice's previous private // keys. It would be unwise to use such a predictable private key in a real // application. alice.setPrivateKey( createHash('sha256').update('alice', 'utf8').digest(), ); // Bob uses a newly generated cryptographically strong // pseudorandom key pair bob.generateKeys(); const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); // aliceSecret and bobSecret should be the same shared secret value
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.004890092648565769, 0.06269903481006622, -0.07677289843559265, -0.01970561593770981, -0.045357879251241684, -0.05255180597305298, 0.004913360811769962, -0.005038426723331213, 0.05594657361507416, -0.08732935041189194, 0.086647629737854, -0.08439770340919495, 0.05983024463057518, -0.09299162030220032, 0.05240515619516373, -0.031204329803586006, 0.01671992801129818, -0.028683524578809738, -0.022232702001929283, -0.08178599178791046, 0.0845944881439209, -0.016428595408797264, 0.01103232055902481, 0.028584783896803856, -0.045175615698099136, -0.013175456784665585, 0.02691374160349369, 0.10031295567750931, -0.03575458005070686, -0.02793390117585659, 0.05421259254217148, -0.13160569965839386, -0.058493103832006454, 0.03113435208797455, 0.035706277936697006, 0.13777652382850647, 0.012431742623448372, -0.05264874920248985, 0.061204466968774796, 0.003962185233831406, 0.04230375215411186, -0.056192707270383835, -0.04029623046517372, -0.02218431979417801, 0.0014007063582539558, 0.05829200893640518, -0.016862407326698303, 0.06909230351448059, -0.09609775245189667, -0.020325029268860817, 0.057126015424728394, 0.027387479320168495, -0.031497400254011154, 0.029779795557260513, 0.014224827289581299, 0.017755113542079926, -0.01603594981133938, 0.04889797419309616, 0.0005686961812898517, -0.027845151722431183, -0.009128693491220474, 0.006371177267283201, -0.013301161117851734, 0.02189704030752182, 0.014976216480135918, -0.0491800494492054, 0.09674452990293503, -0.057670287787914276, -0.029973160475492477, -0.054029736667871475, -0.0639912560582161, -0.07758528739213943, -0.049286793917417526, 0.06254559755325317, 0.033367838710546494, 0.014422377571463585, -0.09762623906135559, -0.03383079543709755, -0.014949662610888481, 0.011252636089920998, 0.059516791254282, -0.06658632308244705, -0.024632643908262253, 0.020727749913930893, 0.051424913108348846, -0.006653913296759129, -0.04158206284046173, 0.03381043300032616, 0.0018702253000810742, 0.04933300241827965, 0.0040266127325594425, -0.056153301149606705, -0.009137644432485104, 0.06794192641973495, 0.03809545934200287, 0.022982262074947357, 0.054291728883981705, 0.016969306394457817, -0.050360970199108124, 0.009283604100346565, 0.00613904045894742, 0.06362884491682053, 0.038771532475948334, -0.12372229248285294, 0.03708109259605408, 0.027449892833828926, 0.00019375469128135592, 0.058152079582214355, 0.04256804659962654, -0.03486109524965286, -0.038670431822538376, -0.067493736743927, 0.04514363780617714, -0.06989071518182755, 0.0249018557369709, 0.106257863342762, -0.05967267230153084, 0.011658295057713985, -0.020188817754387856, 0.01751984842121601, 0.023438768461346626, -0.007066039368510246, 0.013994374312460423, 0.06768471002578735, -0.12403111904859543, -0.044644054025411606, 0.010440858080983162, -3.438627764109544e-35, -0.009802580811083317, -0.010393518023192883, 0.008501371368765831, -0.08984331041574478, -0.034011419862508774, 0.10338689386844635, -0.06622736155986786, 0.03777620568871498, -0.019643886014819145, -0.06670957058668137, -0.03605568781495094, -0.08833394944667816, 0.09009641408920288, 0.011635973118245602, -0.018697695806622505, 0.006935551762580872, 0.03159298002719879, 0.0626683458685875, 0.06727070361375809, 0.05241004750132561, 0.028809214010834694, 0.05434873700141907, 0.02022898569703102, -0.018314719200134277, -0.023808229714632034, 0.062022868543863297, 0.01768186315894127, -0.03401914983987808, 0.0044338698498904705, 0.02937869168817997, 0.011822112835943699, -0.015098021365702152, -0.013508088886737823, -0.07050812244415283, 0.014971449039876461, 0.02815740369260311, 0.07223726063966751, -0.007962653413414955, -0.08410990238189697, -0.06159086152911186, 0.005554581992328167, 0.005880224518477917, 0.0010224797297269106, 0.009292914532124996, -0.0058257607743144035, -0.016504717990756035, 0.0033091427758336067, 0.06060624122619629, 0.027322376146912575, -0.04208279401063919, -0.006243324372917414, -0.030751170590519905, 0.04041662812232971, -0.021553663536906242, 0.015454663895070553, -0.03093000315129757, 0.0014996218960732222, -0.017648551613092422, -0.025673367083072662, 0.03695791959762573, -0.01699875295162201, 0.10207904130220413, -0.009358764626085758, -0.03498205542564392, -0.0446799136698246, 0.047734253108501434, 0.059951622039079666, -0.014817262068390846, -0.0092666856944561, -0.0076371836476027966, -0.07115050405263901, 0.01709970459342003, -0.0074138343334198, 0.04962995648384094, -0.04676346480846405, -0.023127112537622452, -0.07475695759057999, -0.02193855121731758, 0.05853605270385742, -0.024855129420757294, -0.021081391721963882, 0.03419286012649536, -0.013517643325030804, 0.02197697013616562, -0.0439213328063488, 0.03185289725661278, -0.0329403355717659, 0.0035582093987613916, 0.024122273549437523, 0.008189024403691292, -0.019186735153198242, -0.07578650116920471, -0.07871897518634796, -0.002333089942112565, 0.01535608246922493, -4.1648466472824293e-33, -0.0024465606547892094, 0.006805311422795057, -0.11314345896244049, 0.040912926197052, 0.015184033662080765, 0.029541565105319023, 0.05785031244158745, 0.013175643049180508, -0.020222971215844154, 0.018862565979361534, -0.026927854865789413, -0.05320105701684952, 0.08545496314764023, -0.10686890780925751, 0.12890376150608063, -0.023738136515021324, -0.15375372767448425, 0.06318112462759018, 0.042210523039102554, 0.023538926616311073, 0.054853226989507675, -0.04886463284492493, 0.019497418776154518, 0.06658089905977249, 0.04563187435269356, 0.04434953257441521, -0.007280916906893253, -0.023771090433001518, 0.02545100450515747, 0.009552042931318283, -0.001870315638370812, 0.056606732308864594, -0.08295301347970963, 0.008549763821065426, -0.10417821258306503, 0.004387002903968096, -0.014291117899119854, 0.028302591294050217, 0.03157653287053108, 0.03032505512237549, 0.050217386335134506, 0.03275502845644951, 0.03531145676970482, 0.002435090020298958, 0.03670564293861389, 0.04185442999005318, -0.02827083319425583, 0.053966179490089417, 0.006425417494028807, -0.001847311737947166, 0.045267824083566666, 0.002379670040681958, -0.05454409867525101, -0.015889611095190048, -0.036062754690647125, 0.052707258611917496, -0.10409419238567352, 0.07517401874065399, -0.028832411393523216, -0.09129126369953156, -0.08048776537179947, -0.06512317806482315, 0.049946531653404236, 0.08866279572248459, -0.02574373222887516, -0.10280855745077133, -0.034099824726581573, -0.034619078040122986, 0.04073599725961685, -0.06253235042095184, -0.029919994994997978, -0.052721813321113586, 0.04607153683900833, -0.03946412727236748, 0.06682197749614716, 0.018866976723074913, -0.08353308588266373, 0.030577098950743675, -0.0028646080754697323, 0.09309704601764679, 0.029687674716114998, 0.13365283608436584, 0.0463532991707325, 0.0420103557407856, 0.08809037506580353, -0.08402620255947113, 0.06646081060171127, 0.016053471714258194, -0.09219134598970413, -0.047063641250133514, -0.007441949099302292, 0.05752004310488701, -0.08210860192775726, 0.0556454099714756, 0.06908708810806274, -5.7171085643403785e-8, -0.009554510936141014, 0.02755378745496273, 0.02791948802769184, 0.0065374416299164295, -0.028518280014395714, -0.030722593888640404, -0.015964966267347336, -0.06677255034446716, 0.014527146704494953, -0.05490782856941223, 0.011505382135510445, -0.052585091441869736, -0.05691983178257942, 0.0034397486597299576, -0.07172080129384995, -0.00481698801741004, -0.024821609258651733, -0.024284759536385536, -0.006176893133670092, -0.057972270995378494, 0.02635500766336918, -0.10885122418403625, -0.06318335980176926, -0.009921940974891186, -0.0008517118985764682, 0.049138959497213364, 0.018765607848763466, 0.03844689205288887, -0.04822462797164917, -0.015934254974126816, 0.10018230229616165, -0.07720169425010681, -0.010817388072609901, -0.029640914872288704, -0.11660291254520416, 0.05130657181143761, -0.07311435788869858, 0.010693675838410854, 0.038833849132061005, 0.1137303039431572, -0.027388736605644226, -0.05595119670033455, -0.041864048689603806, 0.010725395753979683, 0.04683366417884827, -0.021966423839330673, 0.06928147375583649, 0.07487312704324722, -0.03788328170776367, 0.06606004387140274, -0.04539930820465088, -0.11928686499595642, 0.030795255675911903, -0.05510476604104042, 0.013837638311088085, -0.004928356967866421, -0.07888871431350708, -0.03949922323226929, 0.0797066017985344, 0.033848248422145844, 0.10246354341506958, 0.007971594110131264, 0.05722159147262573, 0.00946206133812666 ]
0.013592
such a predictable private key in a real // application. alice.setPrivateKey( createHash('sha256').update('alice', 'utf8').digest(), ); // Bob uses a newly generated cryptographically strong // pseudorandom key pair bob.generateKeys(); const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); // aliceSecret and bobSecret should be the same shared secret value console.log(aliceSecret === bobSecret); ``` ## Class: `Hash` \* Extends: {stream.Transform} The `Hash` class is a utility for creating hash digests of data. It can be used in one of two ways: \* As a [stream][] that is both readable and writable, where data is written to produce a computed hash digest on the readable side, or \* Using the [`hash.update()`][] and [`hash.digest()`][] methods to produce the computed hash. The [`crypto.createHash()`][] method is used to create `Hash` instances. `Hash` objects are not to be created directly using the `new` keyword. Example: Using `Hash` objects as streams: ```mjs const { createHash, } = await import('node:crypto'); const hash = createHash('sha256'); hash.on('readable', () => { // Only one element is going to be produced by the // hash stream. const data = hash.read(); if (data) { console.log(data.toString('hex')); // Prints: // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 } }); hash.write('some data to hash'); hash.end(); ``` ```cjs const { createHash, } = require('node:crypto'); const hash = createHash('sha256'); hash.on('readable', () => { // Only one element is going to be produced by the // hash stream. const data = hash.read(); if (data) { console.log(data.toString('hex')); // Prints: // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 } }); hash.write('some data to hash'); hash.end(); ``` Example: Using `Hash` and piped streams: ```mjs import { createReadStream } from 'node:fs'; import { stdout } from 'node:process'; const { createHash } = await import('node:crypto'); const hash = createHash('sha256'); const input = createReadStream('test.js'); input.pipe(hash).setEncoding('hex').pipe(stdout); ``` ```cjs const { createReadStream } = require('node:fs'); const { createHash } = require('node:crypto'); const { stdout } = require('node:process'); const hash = createHash('sha256'); const input = createReadStream('test.js'); input.pipe(hash).setEncoding('hex').pipe(stdout); ``` Example: Using the [`hash.update()`][] and [`hash.digest()`][] methods: ```mjs const { createHash, } = await import('node:crypto'); const hash = createHash('sha256'); hash.update('some data to hash'); console.log(hash.digest('hex')); // Prints: // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 ``` ```cjs const { createHash, } = require('node:crypto'); const hash = createHash('sha256'); hash.update('some data to hash'); console.log(hash.digest('hex')); // Prints: // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 ``` ### `hash.copy([options])` \* `options` {Object} [`stream.transform` options][] \* Returns: {Hash} Creates a new `Hash` object that contains a deep copy of the internal state of the current `Hash` object. The optional `options` argument controls stream behavior. For XOF hash functions such as `'shake256'`, the `outputLength` option can be used to specify the desired output length in bytes. An error is thrown when an attempt is made to copy the `Hash` object after its [`hash.digest()`][] method has been called. ```mjs // Calculate a rolling hash. const { createHash, } = await import('node:crypto'); const hash = createHash('sha256'); hash.update('one'); console.log(hash.copy().digest('hex')); hash.update('two'); console.log(hash.copy().digest('hex')); hash.update('three'); console.log(hash.copy().digest('hex')); // Etc. ``` ```cjs // Calculate a rolling hash. const { createHash, } = require('node:crypto'); const hash = createHash('sha256'); hash.update('one'); console.log(hash.copy().digest('hex')); hash.update('two'); console.log(hash.copy().digest('hex')); hash.update('three'); console.log(hash.copy().digest('hex')); // Etc. ``` ### `hash.digest([encoding])` \* `encoding` {string} The [encoding][] of the return value. \* Returns: {Buffer | string} Calculates the digest of all of the data passed to be hashed (using the [`hash.update()`][] method). If `encoding` is provided a string will be returned; otherwise a [`Buffer`][] is returned. The `Hash` object can not be used again after `hash.digest()` method has been called. Multiple calls will cause an error to be thrown. ### `hash.update(data[, inputEncoding])` \* `data` {string|Buffer|TypedArray|DataView} \* `inputEncoding` {string} The [encoding][] of the `data` string. Updates the hash content with the given `data`, the encoding of which is given in `inputEncoding`. If `encoding` is not provided, and the `data` is a string, an
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.054829273372888565, 0.029701337218284607, -0.08857705444097519, -0.018015366047620773, -0.04953012987971306, 0.03460370749235153, 0.030217735096812248, -0.011209140531718731, 0.02884804643690586, 0.029704764485359192, -0.039638422429561615, 0.01786734163761139, 0.08273676037788391, -0.05491375923156738, 0.043886199593544006, -0.0005077014793641865, -0.04688321053981781, 0.014219827018678188, -0.08439551293849945, -0.0221786517649889, 0.07820939272642136, -0.08190511912107468, 0.02619258500635624, 0.004583797417581081, 0.03824663162231445, -0.03825352340936661, 0.09024371206760406, 0.029920289292931557, 0.014654479920864105, -0.009514041244983673, 0.108906090259552, -0.02392951026558876, -0.09151989966630936, -0.07300961762666702, -0.12164375931024551, 0.12623032927513123, -0.017718451097607613, -0.014730257913470268, 0.02288421429693699, -0.054016824811697006, -0.003102218499407172, 0.05662424862384796, -0.12573587894439697, -0.009478254243731499, -0.1104854941368103, 0.060794178396463394, -0.03892223909497261, 0.04196516424417496, -0.01807548850774765, 0.013336180709302425, -0.013132397085428238, -0.02783588133752346, 0.013895406387746334, -0.03003077395260334, -0.028781332075595856, 0.03504430130124092, -0.0898749828338623, -0.006293566897511482, 0.03885466977953911, -0.04650186374783516, -0.04006402939558029, -0.023244677111506462, 0.06953882426023483, 0.0026642694137990475, 0.03632882237434387, -0.0037210385780781507, 0.0547482930123806, -0.03656543418765068, 0.023273061960935593, -0.06295309960842133, -0.025139998644590378, 0.03871247172355652, -0.027844181284308434, -0.022144407033920288, -0.053237032145261765, 0.0004076676850672811, -0.0716116651892662, -0.022882942110300064, -0.03451540693640709, 0.09381664544343948, -0.0756397694349289, -0.033003468066453934, 0.08701635152101517, 0.031383663415908813, 0.012102046050131321, 0.0647517591714859, 0.051767706871032715, 0.007595309056341648, -0.026557404547929764, 0.059709545224905014, -0.11156578361988068, -0.030287107452750206, 0.05351325869560242, 0.013441544026136398, 0.12919944524765015, 0.050166498869657516, 0.014413081109523773, 0.023438870906829834, -0.025793513283133507, 0.05399478226900101, -0.0027068136259913445, 0.06129515916109085, 0.018059853464365005, -0.06713051348924637, 0.15228812396526337, 0.06943052262067795, -0.0264010950922966, 0.011256727389991283, -0.030313830822706223, -0.024036603048443794, 0.07360249012708664, 0.03049970418214798, -0.0316464938223362, -0.0531320683658123, -0.008243532851338387, 0.15908390283584595, -0.028874509036540985, -0.0025930365081876516, -0.04037635773420334, 0.0021720740478485823, 0.03152904286980629, -0.0009642326040193439, -0.01125261839479208, 0.04358125478029251, -0.028753386810421944, -0.01968366838991642, -0.025631794705986977, 5.52230936032193e-33, -0.009502962231636047, 0.015181648544967175, 0.04363364726305008, 0.009123122319579124, -0.029698677361011505, 0.07836584001779556, -0.005924260709434748, 0.02401096373796463, -0.050537437200546265, -0.047962889075279236, -0.0036287205293774605, 0.016260702162981033, 0.03535815328359604, -0.031374868005514145, 0.0374993160367012, -0.018172230571508408, 0.018250027671456337, -0.001356076099909842, 0.04798128828406334, -0.012243865057826042, 0.0856471061706543, 0.06646377593278885, 0.014271637424826622, -0.11142192780971527, -0.03978794068098068, 0.026669615879654884, 0.04611704871058464, -0.017950713634490967, 0.02176760695874691, -0.0014935802901163697, 0.060131072998046875, 0.0910770520567894, 0.0038915742188692093, 0.016815224662423134, 0.019359175115823746, -0.07420176267623901, -0.029153604060411453, 0.016595076769590378, -0.05681206285953522, -0.045582037419080734, 0.14306721091270447, -0.022778751328587532, -0.01735515706241131, -0.03390621021389961, -0.04750719293951988, -0.06080220639705658, 0.008574760518968105, 0.02216471917927265, 0.05932221561670303, 0.014084160327911377, -0.012746673077344894, 0.09042567014694214, -0.0389673113822937, -0.04896010830998421, -0.015419146977365017, -0.05153151974081993, 0.10071642696857452, -0.03201602026820183, -0.028431810438632965, 0.05119412764906883, -0.0179506354033947, 0.065239317715168, 0.05826147645711899, 0.017451800405979156, -0.0424925796687603, 0.003937186673283577, 0.032394956797361374, -0.06238856911659241, 0.04935426265001297, -0.033051591366529465, -0.048399053514003754, 0.01550285704433918, -0.036684781312942505, -0.0039816806092858315, -0.055669572204351425, -0.019157912582159042, -0.03942648321390152, -0.036701589822769165, -0.016692480072379112, -0.04028942063450813, 0.05926472693681717, 0.014089624397456646, -0.05155472084879875, 0.07772999256849289, -0.08368772268295288, 0.004814684856683016, -0.05963713303208351, -0.04502691701054573, -0.09029769897460938, 0.02118385024368763, 0.007614852860569954, -0.027713509276509285, -0.038489967584609985, -0.018379144370555878, -0.04151533171534538, -8.169895123146138e-33, 0.010683771222829819, -0.024562932550907135, -0.030162855982780457, 0.12393709272146225, 0.05210597813129425, -0.0492420494556427, 0.017371559515595436, 0.01212973054498434, -0.03970353677868843, -0.01384004671126604, -0.03675033897161484, 0.03646678477525711, 0.05037691444158554, -0.005941617302596569, 0.06472965329885483, 0.003717294428497553, 0.012886667624115944, 0.0034925404470413923, -0.02917645126581192, -0.05366768687963486, -0.019151389598846436, 0.07051421701908112, -0.02346516214311123, 0.09199625998735428, 0.06908774375915527, 0.04456791281700134, 0.014205529354512691, 0.031572505831718445, 0.02027944289147854, -0.009327101521193981, -0.09133162349462509, 0.07792318612337112, -0.031828004866838455, -0.09030593931674957, -0.05600498989224434, -0.11574062705039978, 0.0009332905756309628, 0.08442117273807526, 0.0315605103969574, 0.04832522198557854, 0.007408804260194302, -0.0362093523144722, 0.03380723297595978, 0.0037645073607563972, 0.02258387766778469, -0.024278223514556885, -0.007614903151988983, 0.041357725858688354, 0.05502329394221306, 0.0903366282582283, 0.020528282970190048, -0.04018837958574295, -0.02971656806766987, 0.015685072168707848, 0.009179016575217247, -0.007359541021287441, -0.04772595316171646, -0.007310047280043364, 0.013020860031247139, 0.04235602542757988, 0.018611520528793335, -0.03755291923880577, 0.07387363165616989, 0.08667971938848495, -0.0033688871189951897, -0.03928602486848831, -0.0981016680598259, -0.07962888479232788, 0.0979522317647934, 0.03766076639294624, -0.006919979117810726, -0.05562874674797058, 0.01616760529577732, -0.024613013491034508, 0.09531205147504807, -0.06313550472259521, -0.015653448179364204, -0.03671645745635033, 0.04730301350355148, 0.033291205763816833, 0.005181929562240839, 0.035299088805913925, 0.02841363474726677, -0.03907424956560135, 0.11891324073076248, -0.050999924540519714, 0.04403383657336235, -0.043218739330768585, -0.06768227368593216, -0.002680231584236026, -0.029151031747460365, 0.07217856496572495, -0.151627779006958, -0.07247061282396317, 0.018251309171319008, -6.09085759606387e-8, 0.03059310093522072, 0.012458591721951962, -0.04928614944219589, 0.05433930829167366, 0.040628861635923386, -0.05787224695086479, -0.04042050987482071, -0.08986733853816986, 0.0032761432230472565, 0.011535043828189373, -0.0265041533857584, -0.007324146572500467, 0.031050460413098335, -0.054810650646686554, -0.028567906469106674, -0.002460782416164875, -0.09203465282917023, -0.0374106727540493, -0.03078269772231579, -0.0663510411977768, -0.02539508230984211, -0.09656430035829544, -0.019660338759422302, 0.014496915973722935, -0.007471817079931498, -0.016970276832580566, 0.1054130420088768, 0.032628558576107025, 0.05316177383065224, 0.07412591576576233, -0.06837710738182068, -0.012223375961184502, 0.03383331373333931, -0.04926072061061859, -0.0717034786939621, 0.06310068070888519, -0.03416173532605171, 0.022303374484181404, 0.04732697084546089, 0.058414194732904434, 0.027300333604216576, 0.017298223450779915, -0.05379166081547737, -0.003265341045334935, -0.07606402039527893, -0.013495054095983505, 0.0638769194483757, 0.04090782254934311, -0.0166860930621624, 0.04995351657271385, -0.032929427921772, 0.026380762457847595, -0.05116109922528267, -0.05054374039173126, -0.008683024905622005, 0.038109343498945236, -0.06985373795032501, -0.11625556647777557, 0.07998556643724442, 0.03721010684967041, 0.026257866993546486, -0.004822421818971634, -0.056723639369010925, -0.05023342743515968 ]
-0.01906
will cause an error to be thrown. ### `hash.update(data[, inputEncoding])` \* `data` {string|Buffer|TypedArray|DataView} \* `inputEncoding` {string} The [encoding][] of the `data` string. Updates the hash content with the given `data`, the encoding of which is given in `inputEncoding`. If `encoding` is not provided, and the `data` is a string, an encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or `DataView`, then `inputEncoding` is ignored. This can be called many times with new data as it is streamed. ## Class: `Hmac` \* Extends: {stream.Transform} The `Hmac` class is a utility for creating cryptographic HMAC digests. It can be used in one of two ways: \* As a [stream][] that is both readable and writable, where data is written to produce a computed HMAC digest on the readable side, or \* Using the [`hmac.update()`][] and [`hmac.digest()`][] methods to produce the computed HMAC digest. The [`crypto.createHmac()`][] method is used to create `Hmac` instances. `Hmac` objects are not to be created directly using the `new` keyword. Example: Using `Hmac` objects as streams: ```mjs const { createHmac, } = await import('node:crypto'); const hmac = createHmac('sha256', 'a secret'); hmac.on('readable', () => { // Only one element is going to be produced by the // hash stream. const data = hmac.read(); if (data) { console.log(data.toString('hex')); // Prints: // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e } }); hmac.write('some data to hash'); hmac.end(); ``` ```cjs const { createHmac, } = require('node:crypto'); const hmac = createHmac('sha256', 'a secret'); hmac.on('readable', () => { // Only one element is going to be produced by the // hash stream. const data = hmac.read(); if (data) { console.log(data.toString('hex')); // Prints: // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e } }); hmac.write('some data to hash'); hmac.end(); ``` Example: Using `Hmac` and piped streams: ```mjs import { createReadStream } from 'node:fs'; import { stdout } from 'node:process'; const { createHmac, } = await import('node:crypto'); const hmac = createHmac('sha256', 'a secret'); const input = createReadStream('test.js'); input.pipe(hmac).pipe(stdout); ``` ```cjs const { createReadStream, } = require('node:fs'); const { createHmac, } = require('node:crypto'); const { stdout } = require('node:process'); const hmac = createHmac('sha256', 'a secret'); const input = createReadStream('test.js'); input.pipe(hmac).pipe(stdout); ``` Example: Using the [`hmac.update()`][] and [`hmac.digest()`][] methods: ```mjs const { createHmac, } = await import('node:crypto'); const hmac = createHmac('sha256', 'a secret'); hmac.update('some data to hash'); console.log(hmac.digest('hex')); // Prints: // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e ``` ```cjs const { createHmac, } = require('node:crypto'); const hmac = createHmac('sha256', 'a secret'); hmac.update('some data to hash'); console.log(hmac.digest('hex')); // Prints: // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e ``` ### `hmac.digest([encoding])` \* `encoding` {string} The [encoding][] of the return value. \* Returns: {Buffer | string} Calculates the HMAC digest of all of the data passed using [`hmac.update()`][]. If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned; The `Hmac` object can not be used again after `hmac.digest()` has been called. Multiple calls to `hmac.digest()` will result in an error being thrown. ### `hmac.update(data[, inputEncoding])` \* `data` {string|Buffer|TypedArray|DataView} \* `inputEncoding` {string} The [encoding][] of the `data` string. Updates the `Hmac` content with the given `data`, the encoding of which is given in `inputEncoding`. If `encoding` is not provided, and the `data` is a string, an encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or `DataView`, then `inputEncoding` is ignored. This can be called many times with new data as it is streamed. ## Class: `KeyObject` Node.js uses a `KeyObject` class to represent a symmetric or asymmetric key, and each kind of key exposes different functions. The [`crypto.createSecretKey()`][], [`crypto.createPublicKey()`][] and [`crypto.createPrivateKey()`][] methods are used to create `KeyObject` instances. `KeyObject` objects are not to be created directly using the `new` keyword. Most applications should consider using the new `KeyObject` API instead of passing keys as strings or `Buffer`s due
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.022206304594874382, 0.013034257106482983, -0.007185811176896095, -0.051883891224861145, -0.08235129714012146, -0.06379544734954834, 0.06284788995981216, -0.05436001718044281, 0.013994917273521423, -0.04976179078221321, -0.02741328813135624, 0.07027637213468552, 0.05790899321436882, 0.015410305932164192, -0.012347087264060974, 0.006205975078046322, -0.05928124114871025, -0.0319819301366806, -0.10226374119520187, -0.022712593898177147, 0.03614835441112518, 0.02496659941971302, 0.027887718752026558, 0.027987167239189148, -0.030448054894804955, 0.09492538124322891, 0.03753297030925751, -0.02188689261674881, 0.02423904836177826, -0.03250601887702942, 0.00956160482019186, 0.03737146407365799, -0.03885268792510033, 0.03506327047944069, -0.07658851891756058, 0.08436544984579086, 0.04926831275224686, -0.02899021841585636, -0.06506318598985672, -0.07269547134637833, 0.029988614842295647, 0.004195863846689463, -0.13553811609745026, 0.02745949849486351, -0.11518940329551697, 0.03466944396495819, 0.004271707031875849, -0.05848478898406029, -0.06623657047748566, 0.006949535571038723, -0.022113367915153503, -0.007623863406479359, 0.007402601186186075, 0.07087673991918564, -0.0016542384400963783, -0.04623532295227051, -0.06369781494140625, 0.03407326713204384, 0.03834226727485657, -0.051313918083906174, -0.05124833807349205, -0.0010603740811347961, 0.05664757266640663, 0.0318254679441452, 0.022709263488650322, -0.07804220169782639, 0.026529958471655846, 0.02312762849032879, 0.04663868248462677, -0.06864377111196518, -0.017089268192648888, -0.011332019232213497, -0.02903163619339466, 0.028638187795877457, -0.0013164881384000182, -0.01958336867392063, 0.04227416217327118, -0.07859380543231964, 0.0372755266726017, -0.021828290075063705, -0.01978486031293869, -0.10383249074220657, -0.014648796990513802, 0.08390326052904129, 0.05558514595031738, -0.013614699244499207, -0.07488082349300385, 0.018914172425866127, -0.051785558462142944, 0.03996068239212036, -0.031012266874313354, -0.0007626541773788631, 0.05688808485865593, 0.08663474768400192, 0.05285680666565895, 0.02456606924533844, 0.015571918338537216, 0.047002747654914856, -0.035526592284440994, 0.07381708174943924, 0.005547874607145786, 0.06373213231563568, 0.004882052540779114, -0.007015169598162174, 0.02852378599345684, -0.07363270223140717, 0.024411754682660103, 0.04147102311253548, -0.028302708640694618, -0.020853286609053612, 0.06240987032651901, -0.004150211811065674, -0.04826562851667404, -0.03917640447616577, -0.08777981251478195, 0.032190460711717606, -0.061313215643167496, 0.030027443543076515, -0.09680860489606857, 0.042648568749427795, 0.048482395708560944, -0.01024552807211876, 0.004435752518475056, -0.014396121725440025, 0.01938958466053009, -0.048900049179792404, -0.03845931217074394, 1.0881032335008623e-33, 0.010725780390202999, -0.02936730533838272, -0.022991714999079704, 0.01944122090935707, -0.007216535974293947, -0.008003477938473225, 0.010253455489873886, 0.02667689323425293, 0.04544341191649437, -0.06163956969976425, -0.051595184952020645, -0.005703706759959459, 0.009490860626101494, -0.00541712949052453, 0.012335790321230888, 0.004010937176644802, 0.05012401193380356, 0.041926804929971695, -0.027871515601873398, 0.08981554955244064, 0.09442611038684845, 0.06744211912155151, 0.0003647469566203654, -0.1148257777094841, -0.08570470660924911, 0.037059541791677475, -0.021756231784820557, -0.06196020916104317, 0.03629729896783829, 0.02163434959948063, -0.024437617510557175, -0.03485095128417015, 0.030683409422636032, -0.009398235008120537, 0.04193964973092079, -0.05556740239262581, 0.0400201678276062, -0.01760195568203926, -0.07859035581350327, -0.09501268714666367, 0.046747926622629166, -0.008902634494006634, -0.020864393562078476, -0.017795691266655922, -0.025825275108218193, -0.05673535540699959, -0.06316077709197998, 0.032947588711977005, -0.06752105802297592, 0.03701562434434891, -0.011896454729139805, 0.02776733972132206, -0.026588574051856995, -0.012565914541482925, -0.04525693506002426, -0.014788451604545116, 0.047166600823402405, -0.03164295852184296, 0.007177842780947685, 0.013515131548047066, -0.052250608801841736, 0.08969467133283615, 0.05098050460219383, 0.0512787401676178, 0.01762421987950802, -0.036897893995046616, 0.06975476443767548, 0.026658423244953156, 0.009919807314872742, 0.04845231771469116, -0.09023001044988632, 0.0539860799908638, -0.06343545764684677, 0.08184287697076797, -0.0192013680934906, -0.051561880856752396, -0.10373599827289581, -0.022509092465043068, -0.030991239473223686, 0.013008044101297855, 0.12192166596651077, -0.04573657736182213, -0.023185579106211662, 0.10841818898916245, -0.05915675312280655, 0.05773739889264107, 0.023946518078446388, -0.05439469590783119, -0.03918113932013512, 0.0062364935874938965, 0.0016494597075507045, -0.05279555544257164, -0.011499045416712761, -0.18323074281215668, -0.0008855109917931259, -4.169664704752862e-33, 0.06242047995328903, -0.031371962279081345, -0.08970955014228821, 0.062111955136060715, -0.01906226947903633, -0.042244620621204376, 0.08498509228229523, 0.10785555094480515, -0.04600178077816963, -0.09305568784475327, -0.028079792857170105, 0.026237813755869865, 0.004483014345169067, -0.04984702914953232, -0.007059737108647823, 0.005449995398521423, -0.07316028326749802, -0.02903755009174347, -0.015848375856876373, -0.03445864096283913, -0.05021057277917862, -0.00958906952291727, 0.03436993062496185, 0.06110018864274025, -0.028463974595069885, -0.0016264483565464616, 0.02617107704281807, 0.042550090700387955, 0.08283184468746185, 0.01837855949997902, -0.030386781319975853, 0.06079181656241417, -0.05020400509238243, -0.01799236796796322, -0.04398588091135025, -0.03616664186120033, 0.10425154119729996, 0.030521385371685028, -0.00020731094991788268, 0.050347212702035904, 0.10337838530540466, 0.01077305432409048, -0.0347331166267395, 0.03647799417376518, 0.0499139279127121, -0.03224184736609459, -0.06028703972697258, 0.08311372250318527, -0.010277491062879562, -0.027983061969280243, 0.10657812654972076, -0.01002888660877943, -0.020895447582006454, 0.011429555714130402, 0.08065130561590195, 0.007509743329137564, 0.040213800966739655, -0.05090705677866936, -0.03205990791320801, 0.004924003034830093, -0.10251723229885101, -0.07822147011756897, 0.012043681927025318, -0.0011850292794406414, -0.040715791285037994, -0.016762733459472656, -0.05613178387284279, -0.08554483205080032, 0.0704096257686615, -0.011971415020525455, 0.04333100467920303, -0.016462458297610283, -0.021734558045864105, -0.01774498075246811, 0.06645265966653824, -0.04637384042143822, -0.009594614617526531, -0.03847355395555496, 0.07737183570861816, 0.05862685665488243, -0.06399364769458771, 0.03176456317305565, 0.043720874935388565, 0.0882258415222168, 0.15512900054454803, -0.01372283510863781, 0.03353225439786911, 0.026439515873789787, -0.08669956028461456, -0.0604906864464283, -0.0180512722581625, 0.10573189705610275, -0.10919608920812607, 0.01770968921482563, -0.03457176312804222, -5.153762927534444e-8, -0.04674685746431351, -0.0312039852142334, -0.051574353128671646, 0.08375785499811172, 0.04160851985216141, 0.01804293505847454, -0.1020096018910408, -0.07243964076042175, 0.0719134509563446, -0.04291475936770439, 0.037594206631183624, 0.031151359900832176, -0.028959279879927635, -0.05509285256266594, -0.009432576596736908, 0.02532125450670719, 0.00022300459386315197, -0.002867980394512415, -0.017360810190439224, -0.02719416469335556, -0.03210972249507904, 0.01742904633283615, -0.08316857367753983, -0.023222018033266068, 0.05470500513911247, 0.04542221501469612, 0.07082881033420563, 0.04280732572078705, -0.014395983889698982, -0.07379432767629623, 0.04635884240269661, 0.011745324358344078, 0.09450781345367432, -0.026132289320230484, -0.006783571559935808, -0.019173482432961464, 0.04948658496141434, 0.0006066672503948212, 0.02219916693866253, 0.04830028861761093, 0.03233879804611206, 0.031135916709899902, -0.083558589220047, 0.018879245966672897, 0.006216481328010559, -0.04088409245014191, -0.010467277839779854, 0.10336954146623611, -0.016466863453388214, 0.038951288908720016, 0.04716728255152702, 0.04360838979482651, 0.01750255562365055, -0.05081099271774292, 0.012376838363707066, -0.005281753838062286, 0.01435150671750307, -0.1455075740814209, 0.03761141002178192, 0.023209135979413986, 0.10975146293640137, -0.002712119370698929, -0.0021603568457067013, -0.036624204367399216 ]
-0.002648
and each kind of key exposes different functions. The [`crypto.createSecretKey()`][], [`crypto.createPublicKey()`][] and [`crypto.createPrivateKey()`][] methods are used to create `KeyObject` instances. `KeyObject` objects are not to be created directly using the `new` keyword. Most applications should consider using the new `KeyObject` API instead of passing keys as strings or `Buffer`s due to improved security features. `KeyObject` instances can be passed to other threads via [`postMessage()`][]. The receiver obtains a cloned `KeyObject`, and the `KeyObject` does not need to be listed in the `transferList` argument. ### Static method: `KeyObject.from(key)` \* `key` {CryptoKey} \* Returns: {KeyObject} Example: Converting a `CryptoKey` instance to a `KeyObject`: ```mjs const { KeyObject } = await import('node:crypto'); const { subtle } = globalThis.crypto; const key = await subtle.generateKey({ name: 'HMAC', hash: 'SHA-256', length: 256, }, true, ['sign', 'verify']); const keyObject = KeyObject.from(key); console.log(keyObject.symmetricKeySize); // Prints: 32 (symmetric key size in bytes) ``` ```cjs const { KeyObject } = require('node:crypto'); const { subtle } = globalThis.crypto; (async function() { const key = await subtle.generateKey({ name: 'HMAC', hash: 'SHA-256', length: 256, }, true, ['sign', 'verify']); const keyObject = KeyObject.from(key); console.log(keyObject.symmetricKeySize); // Prints: 32 (symmetric key size in bytes) })(); ``` ### `keyObject.asymmetricKeyDetails` \* Type: {Object} \* `modulusLength` {number} Key size in bits (RSA, DSA). \* `publicExponent` {bigint} Public exponent (RSA). \* `hashAlgorithm` {string} Name of the message digest (RSA-PSS). \* `mgf1HashAlgorithm` {string} Name of the message digest used by MGF1 (RSA-PSS). \* `saltLength` {number} Minimal salt length in bytes (RSA-PSS). \* `divisorLength` {number} Size of `q` in bits (DSA). \* `namedCurve` {string} Name of the curve (EC). This property exists only on asymmetric keys. Depending on the type of the key, this object contains information about the key. None of the information obtained through this property can be used to uniquely identify a key or to compromise the security of the key. For RSA-PSS keys, if the key material contains a `RSASSA-PSS-params` sequence, the `hashAlgorithm`, `mgf1HashAlgorithm`, and `saltLength` properties will be set. Other key details might be exposed via this API using additional attributes. ### `keyObject.asymmetricKeyType` \* Type: {string} For asymmetric keys, this property represents the type of the key. See the supported [asymmetric key types][]. This property is `undefined` for unrecognized `KeyObject` types and symmetric keys. ### `keyObject.equals(otherKeyObject)` \* `otherKeyObject` {KeyObject} A `KeyObject` with which to compare `keyObject`. \* Returns: {boolean} Returns `true` or `false` depending on whether the keys have exactly the same type, value, and parameters. This method is not [constant time](https://en.wikipedia.org/wiki/Timing\_attack). ### `keyObject.export([options])` \* `options` {Object} \* Returns: {string | Buffer | Object} For symmetric keys, the following encoding options can be used: \* `format` {string} Must be `'buffer'` (default) or `'jwk'`. For public keys, the following encoding options can be used: \* `type` {string} Must be one of `'pkcs1'` (RSA only) or `'spki'`. \* `format` {string} Must be `'pem'`, `'der'`, or `'jwk'`. For private keys, the following encoding options can be used: \* `type` {string} Must be one of `'pkcs1'` (RSA only), `'pkcs8'` or `'sec1'` (EC only). \* `format` {string} Must be `'pem'`, `'der'`, or `'jwk'`. \* `cipher` {string} If specified, the private key will be encrypted with the given `cipher` and `passphrase` using PKCS#5 v2.0 password based encryption. \* `passphrase` {string | Buffer} The passphrase to use for encryption, see `cipher`. The result type depends on the selected encoding format, when PEM the result is a string, when DER it will be a buffer containing the data encoded as DER, when [JWK][] it will be an object. When [JWK][] encoding format was selected, all other encoding options are ignored. PKCS#1, SEC1, and PKCS#8 type keys can be encrypted by using a combination of the
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.053336553275585175, 0.0014972541248425841, -0.05225919187068939, 0.05411120504140854, -0.010966004803776741, -0.036883044987916946, 0.06977055221796036, 0.012575982138514519, 0.0356866680085659, -0.027689173817634583, -0.011817989870905876, -0.0059398021548986435, 0.04948573186993599, -0.025545759126544, 0.06881971657276154, 0.0166691392660141, 0.03535166382789612, 0.0058981068432331085, -0.029331082478165627, -0.015370207838714123, 0.0691704973578453, -0.08752425760030746, -0.017126239836215973, 0.001172421034425497, -0.02206665463745594, -0.05998644232749939, 0.027043646201491356, 0.006931650452315807, 0.03293915092945099, 0.013197561725974083, 0.035957470536231995, -0.01432447973638773, -0.041254401206970215, 0.06106482073664665, -0.11553816497325897, 0.15812212228775024, 0.06825733184814453, -0.04225977510213852, -0.015467055141925812, -0.04504898563027382, 0.08936650305986404, 0.034061215817928314, -0.12488031387329102, -0.000981879304163158, -0.015988405793905258, 0.03707512468099594, -0.031605787575244904, 0.03333190828561783, -0.05499452352523804, -0.10250438749790192, -0.042014192789793015, 0.0008953834185376763, -0.07130079716444016, 0.06338518112897873, -0.09431614726781845, 0.043807949870824814, -0.003405354218557477, -0.010941606014966965, 0.047757577151060104, -0.04836098104715347, -0.011856119148433208, 0.049217019230127335, 0.09783893078565598, 0.03518661856651306, 0.05628352239727974, -0.005812779068946838, -0.060651037842035294, -0.011359287425875664, 0.06293325871229172, 0.003648761659860611, 0.00705268420279026, -0.026386186480522156, -0.0030912342481315136, 0.012122094631195068, -0.021852044388651848, -0.059775106608867645, -0.030924756079912186, -0.0033199044410139322, -0.0908253937959671, 0.02943013422191143, 0.0021353864576667547, -0.0932907983660698, 0.0037156592588871717, -0.004026835784316063, 0.01595122180879116, 0.0859561413526535, 0.005817732308059931, -0.026733744889497757, -0.0561150461435318, 0.0764424055814743, -0.028960172086954117, -0.041528716683387756, -0.004484424367547035, 0.040122706443071365, 0.058631639927625656, -0.004237689543515444, 0.015044976957142353, -0.021850794553756714, -0.03088795207440853, -0.010311455465853214, -0.02457771822810173, -0.00248095765709877, -0.02021164819598198, -0.07053467631340027, 0.08478016406297684, 0.07506398856639862, -0.048177167773246765, -0.15445095300674438, -0.029237551614642143, 0.018765341490507126, -0.01998281478881836, 0.14584843814373016, -0.030493395403027534, 0.02605535089969635, -0.01043805293738842, 0.09390030056238174, -0.05124391242861748, 0.03210849687457085, 0.032581452280282974, 0.1798158586025238, 0.09230541437864304, -0.02144790068268776, 0.027798380702733994, -0.040622465312480927, -0.06772065162658691, -0.0046119075268507, -0.03662002459168434, 3.9574549136508224e-33, 0.00787881389260292, -0.038020845502614975, 0.007921875454485416, -0.0035957011859863997, 0.02457485720515251, 0.08431212604045868, 0.07750328630208969, 0.05123119428753853, 0.007074256427586079, -0.051763299852609634, -0.08558913320302963, 0.01625691168010235, 0.022029858082532883, -0.030192246660590172, -0.01355170551687479, -0.0167835783213377, -0.02065916359424591, 0.03941456601023674, 0.07096018642187119, 0.025295475497841835, 0.03524509072303772, 0.05738820508122444, 0.0024248575791716576, 0.033200837671756744, 0.02807420678436756, 0.038589298725128174, -0.022554146125912666, 0.005859081167727709, -0.018627731129527092, 0.02514270693063736, -0.08791044354438782, 0.06792548298835754, -0.07042399793863297, 0.0019222282571718097, -0.0023600407876074314, -0.010393132455646992, 0.04192414507269859, -0.05034637823700905, -0.0815158560872078, -0.17540699243545532, 0.043628644198179245, -0.04495949298143387, -0.08735895156860352, -0.021123094484210014, -0.030703188851475716, -0.05501417815685272, -0.05011998116970062, -0.0016942991642281413, 0.10306311398744583, 0.10718253254890442, -0.03528363257646561, -0.02102869376540184, -0.034036483615636826, -0.0946865901350975, 0.023862123489379883, -0.08542350679636002, 0.02771998755633831, -0.022183647379279137, 0.05358803644776344, 0.0022106224205344915, -0.03532733395695686, 0.02607828564941883, -0.002005096059292555, 0.009875365532934666, 0.06154004484415054, 0.030671460554003716, 0.001069605234079063, 0.005201435182243586, -0.045062869787216187, 0.03281077742576599, -0.018827136605978012, 0.04649912193417549, -0.12701566517353058, 0.07770182937383652, 0.007421400398015976, -0.008031867444515228, -0.07392168045043945, -0.07935793697834015, 0.030971674248576164, -0.04297025501728058, 0.03990604355931282, 0.10597648471593857, -0.06273435801267624, 0.02507382445037365, -0.04478417709469795, 0.09681686013936996, -0.03925928473472595, -0.03497105464339256, 0.014826595783233643, -0.01400992926210165, -0.017859088256955147, 0.012573393993079662, -0.05238059535622597, -0.05197715759277344, -0.09559222310781479, -6.526387982119527e-33, 0.03708937019109726, -0.03236766904592514, -0.07922498881816864, 0.11503227055072784, -0.030111169442534447, -0.018186073750257492, -0.04813597723841667, 0.009820215404033661, -0.0057486118748784065, 0.011466694064438343, -0.08073955774307251, -0.05217279866337776, 0.10168210417032242, -0.028762660920619965, 0.07349781692028046, -0.051994215697050095, -0.09157922118902206, 0.0187764223664999, 0.022887591272592545, -0.0585254542529583, -0.02927127480506897, 0.003033065004274249, -0.011471257545053959, 0.02179681695997715, -0.01940283738076687, -0.03388470783829689, -0.06323093175888062, 0.07464247941970825, 0.0542505644261837, -0.06264743208885193, 0.006209295243024826, 0.06588452309370041, -0.027951670810580254, 0.00425676628947258, -0.06340917199850082, -0.028225796297192574, -0.00001997435356315691, 0.06433520466089249, 0.09535800665616989, 0.005246243439614773, 0.07766356319189072, -0.020549779757857323, 0.02684229053556919, -0.027937671169638634, -0.0101469112560153, -0.03406728804111481, -0.0051580313593149185, 0.01019143033772707, 0.08595678210258484, 0.048298321664333344, 0.0694335326552391, -0.0822470411658287, -0.07781441509723663, -0.03286972641944885, -0.059266097843647, 0.024524439126253128, 0.007828187197446823, 0.019450055435299873, 0.09063903987407684, -0.03655235469341278, 0.02617005631327629, -0.028902074322104454, 0.04500587657094002, 0.008650923147797585, 0.016472788527607918, -0.03527926653623581, -0.014829393476247787, -0.035276953130960464, 0.02596687711775303, 0.02235838957130909, 0.05076701566576958, -0.003007704857736826, 0.0066582742147147655, -0.028188427910208702, -0.01845628023147583, -0.032685693353414536, -0.025280391797423363, -0.0816429853439331, 0.03705216571688652, 0.003354319604113698, -0.01854941062629223, 0.01652165874838829, 0.07127314805984497, 0.078689344227314, -0.018126754090189934, 0.0006599683547392488, 0.05384460464119911, -0.006556032691150904, -0.04459446296095848, -0.00564350001513958, -0.007276291958987713, 0.032255347818136215, -0.06028188019990921, 0.02111206203699112, 0.029096784070134163, -5.257063051544719e-8, 0.0013268381590023637, 0.0624983087182045, -0.06364890187978745, 0.0552007257938385, -0.0068482509814202785, -0.02369975857436657, -0.0939696654677391, -0.050827257335186005, 0.027196606621146202, -0.037384286522865295, -0.027247365564107895, -0.02588893659412861, 0.03648647665977478, -0.004392299801111221, 0.003246534150093794, 0.05784496292471886, -0.06793876737356186, -0.021544555202126503, 0.011777522042393684, -0.05701101943850517, 0.05156766623258591, -0.050746046006679535, -0.01297073531895876, 0.014194382354617119, 0.015070948749780655, 0.043447256088256836, 0.050353165715932846, 0.10038198530673981, 0.002529669087380171, 0.010473151691257954, -0.05675486475229263, -0.03715416043996811, 0.07751671224832535, 0.02492000162601471, -0.04481884092092514, 0.033721983432769775, -0.1246010810136795, -0.04057885333895683, 0.03857184946537018, 0.0009743561968207359, 0.010571456514298916, -0.050417281687259674, -0.05156881362199783, 0.029495157301425934, -0.05182422697544098, 0.02259669452905655, -0.0078382333740592, 0.05629928410053253, -0.05173714831471443, 0.06570155173540115, -0.02570243366062641, -0.02337539754807949, 0.0026864365208894014, 0.02213427983224392, -0.030733516439795494, 0.08197998255491257, 0.03447292372584343, -0.11179936677217484, 0.09698911011219025, -0.03468898683786392, 0.03136448189616203, 0.0372522696852684, 0.03542463853955269, 0.006737056653946638 ]
0.092371
is a string, when DER it will be a buffer containing the data encoded as DER, when [JWK][] it will be an object. When [JWK][] encoding format was selected, all other encoding options are ignored. PKCS#1, SEC1, and PKCS#8 type keys can be encrypted by using a combination of the `cipher` and `format` options. The PKCS#8 `type` can be used with any `format` to encrypt any key algorithm (RSA, EC, or DH) by specifying a `cipher`. PKCS#1 and SEC1 can only be encrypted by specifying a `cipher` when the PEM `format` is used. For maximum compatibility, use PKCS#8 for encrypted private keys. Since PKCS#8 defines its own encryption mechanism, PEM-level encryption is not supported when encrypting a PKCS#8 key. See [RFC 5208][] for PKCS#8 encryption and [RFC 1421][] for PKCS#1 and SEC1 encryption. ### `keyObject.symmetricKeySize` \* Type: {number} For secret keys, this property represents the size of the key in bytes. This property is `undefined` for asymmetric keys. ### `keyObject.toCryptoKey(algorithm, extractable, keyUsages)` \* `algorithm` {string|Algorithm|RsaHashedImportParams|EcKeyImportParams|HmacImportParams} \* `extractable` {boolean} \* `keyUsages` {string\[]} See [Key usages][]. \* Returns: {CryptoKey} Converts a `KeyObject` instance to a `CryptoKey`. ### `keyObject.type` \* Type: {string} Depending on the type of this `KeyObject`, this property is either `'secret'` for secret (symmetric) keys, `'public'` for public (asymmetric) keys or `'private'` for private (asymmetric) keys. ## Class: `Sign` \* Extends: {stream.Writable} The `Sign` class is a utility for generating signatures. It can be used in one of two ways: \* As a writable [stream][], where data to be signed is written and the [`sign.sign()`][] method is used to generate and return the signature, or \* Using the [`sign.update()`][] and [`sign.sign()`][] methods to produce the signature. The [`crypto.createSign()`][] method is used to create `Sign` instances. The argument is the string name of the hash function to use. `Sign` objects are not to be created directly using the `new` keyword. Example: Using `Sign` and [`Verify`][] objects as streams: ```mjs const { generateKeyPairSync, createSign, createVerify, } = await import('node:crypto'); const { privateKey, publicKey } = generateKeyPairSync('ec', { namedCurve: 'sect239k1', }); const sign = createSign('SHA256'); sign.write('some data to sign'); sign.end(); const signature = sign.sign(privateKey, 'hex'); const verify = createVerify('SHA256'); verify.write('some data to sign'); verify.end(); console.log(verify.verify(publicKey, signature, 'hex')); // Prints: true ``` ```cjs const { generateKeyPairSync, createSign, createVerify, } = require('node:crypto'); const { privateKey, publicKey } = generateKeyPairSync('ec', { namedCurve: 'sect239k1', }); const sign = createSign('SHA256'); sign.write('some data to sign'); sign.end(); const signature = sign.sign(privateKey, 'hex'); const verify = createVerify('SHA256'); verify.write('some data to sign'); verify.end(); console.log(verify.verify(publicKey, signature, 'hex')); // Prints: true ``` Example: Using the [`sign.update()`][] and [`verify.update()`][] methods: ```mjs const { generateKeyPairSync, createSign, createVerify, } = await import('node:crypto'); const { privateKey, publicKey } = generateKeyPairSync('rsa', { modulusLength: 2048, }); const sign = createSign('SHA256'); sign.update('some data to sign'); sign.end(); const signature = sign.sign(privateKey); const verify = createVerify('SHA256'); verify.update('some data to sign'); verify.end(); console.log(verify.verify(publicKey, signature)); // Prints: true ``` ```cjs const { generateKeyPairSync, createSign, createVerify, } = require('node:crypto'); const { privateKey, publicKey } = generateKeyPairSync('rsa', { modulusLength: 2048, }); const sign = createSign('SHA256'); sign.update('some data to sign'); sign.end(); const signature = sign.sign(privateKey); const verify = createVerify('SHA256'); verify.update('some data to sign'); verify.end(); console.log(verify.verify(publicKey, signature)); // Prints: true ``` ### `sign.sign(privateKey[, outputEncoding])` \* `privateKey` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey} \* `dsaEncoding` {string} \* `padding` {integer} \* `saltLength` {integer} \* `outputEncoding` {string} The [encoding][] of the return value. \* Returns: {Buffer | string} Calculates the signature on all the data passed through using either [`sign.update()`][] or [`sign.write()`][stream-writable-write]. If `privateKey` is not a [`KeyObject`][], this function behaves as if `privateKey` had been passed to [`crypto.createPrivateKey()`][]. If it is an object, the following additional properties can be passed: \* `dsaEncoding` {string} For DSA and
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.046170443296432495, 0.03280679136514664, -0.07464156299829483, -0.006295972503721714, -0.020872341468930244, -0.023949231952428818, 0.02861313708126545, 0.0721406415104866, 0.07895146310329437, -0.009724101051688194, -0.05437164381146431, -0.05720023065805435, 0.0009579717880114913, -0.004905954003334045, 0.032541465014219284, -0.07123728841543198, 0.015573485754430294, 0.07336010038852692, 0.0003921627067029476, -0.0016059299232438207, 0.03834948688745499, -0.049744706600904465, 0.04791989549994469, -0.014138237573206425, -0.07131071388721466, 0.025722719728946686, 0.0985729843378067, 0.1262764036655426, -0.03652285784482956, -0.018197238445281982, 0.00985794235020876, -0.11863775551319122, -0.020506851375102997, 0.08637608587741852, -0.025487825274467468, 0.0517580509185791, 0.0015852529322728515, -0.05602419748902321, 0.0183962881565094, -0.029233291745185852, -0.007899331860244274, -0.01269557699561119, -0.07812948524951935, 0.026306629180908203, -0.0009273777832277119, 0.04805365577340126, -0.01917303539812565, 0.022367140278220177, -0.13710017502307892, -0.06748255342245102, 0.030624523758888245, 0.06165919080376625, -0.1029438003897667, 0.06557924300432205, -0.010570967569947243, -0.05356931313872337, -0.13797879219055176, 0.07078532874584198, 0.022982437163591385, 0.043757665902376175, -0.0694594532251358, -0.00004565435301628895, -0.0056684184819459915, 0.0628357082605362, -0.041254788637161255, -0.017391594126820564, 0.05848899856209755, -0.013551341369748116, 0.022003304213285446, 0.0077886092476546764, -0.08756347000598907, -0.07583969831466675, -0.02394060045480728, 0.03540782257914543, 0.02359832637012005, 0.031430236995220184, -0.032329022884368896, 0.029072945937514305, -0.04423719272017479, -0.0796218141913414, -0.011222158558666706, -0.09301451593637466, -0.046453967690467834, 0.047413140535354614, -0.039290040731430054, 0.007868671789765358, -0.017090629786252975, 0.0360318087041378, -0.05109841749072075, 0.05924328416585922, 0.13322308659553528, 0.010641288943588734, 0.061854295432567596, 0.04421307519078255, 0.06445064395666122, 0.01479403767734766, -0.0181119367480278, 0.0350576750934124, 0.027075445279479027, -0.03805035352706909, -0.04581884294748306, -0.004307309631258249, -0.0548178069293499, 0.04849575087428093, 0.013338757678866386, -0.00474206218495965, 0.04662853851914406, 0.00027641537599265575, -0.004807174205780029, -0.0003269778098911047, -0.0460193008184433, 0.04161111265420914, -0.06467385590076447, -0.0666036531329155, -0.03838329389691353, 0.005665142089128494, -0.12549351155757904, 0.008513523265719414, 0.09139648079872131, 0.08952873945236206, -0.01290801540017128, -0.048586923629045486, -0.0743335410952568, 0.029420318081974983, -0.08595938980579376, -0.028403086587786674, -0.010731643997132778, 6.267401597378422e-33, -0.022569844499230385, -0.012450970709323883, 0.042892664670944214, -0.04171805456280708, -0.092377208173275, 0.05630071833729744, 0.018607212230563164, -0.035338643938302994, -0.024314284324645996, -0.005330613814294338, -0.027199845761060715, -0.013988234102725983, -0.007401409093290567, -0.03142216056585312, 0.0018478641286492348, 0.06218692660331726, -0.01747691072523594, -0.009361694566905499, 0.019213886931538582, 0.022882796823978424, 0.045382533222436905, 0.06402461230754852, 0.06713982671499252, -0.020569883286952972, -0.018530331552028656, 0.03237535059452057, 0.018934424966573715, -0.043918244540691376, -0.01533496007323265, 0.009820663370192051, -0.09166564792394638, -0.04150935262441635, -0.04340372607111931, -0.04499982297420502, 0.049345143139362335, 0.022965528070926666, 0.07194125652313232, 0.017829956486821175, -0.03469054400920868, -0.03256552666425705, 0.03131736069917679, -0.020752418786287308, 0.012550948187708855, 0.028621232137084007, -0.018334614112973213, -0.013298389501869678, -0.05773260444402695, 0.06153596565127373, -0.02256525680422783, 0.05093321204185486, 0.009907649829983711, 0.01956234872341156, -0.04410381615161896, -0.010129544883966446, 0.05130797252058983, -0.05000418797135353, 0.09925724565982819, -0.040119070559740067, -0.12244521081447601, -0.004069318994879723, -0.006024625618010759, 0.034163400530815125, 0.08128499239683151, -0.09427208453416824, 0.021453162655234337, 0.008657247759401798, -0.03368619456887245, 0.0061457036063075066, -0.07256273180246353, 0.000824176415335387, -0.07857084274291992, 0.0882764607667923, 0.02238060161471367, 0.06216806173324585, -0.02426919899880886, 0.035189464688301086, -0.05639663711190224, 0.053647615015506744, 0.02549271285533905, 0.02760820835828781, -0.0127640962600708, 0.07664758712053299, 0.0030024144798517227, 0.002657306147739291, -0.04473557695746422, 0.003022481920197606, -0.04164142906665802, -0.03994962200522423, 0.04780145362019539, -0.009326386265456676, 0.04577954113483429, -0.0048359171487390995, 0.01629140041768551, -0.013812240213155746, -0.04418361932039261, -8.554818095162589e-33, -0.008339799009263515, 0.044633328914642334, -0.0856478214263916, 0.09821249544620514, -0.036835309118032455, 0.008772105909883976, -0.010075580328702927, -0.008402900770306587, 0.05596235394477844, 0.030110839754343033, 0.0014710359973832965, -0.018541237339377403, 0.09826337546110153, -0.09908269345760345, 0.06100016087293625, -0.02254577726125717, -0.13843663036823273, 0.0911049023270607, 0.03623650595545769, -0.025113176554441452, -0.048274893313646317, 0.005582063924521208, 0.003421266097575426, 0.07198050618171692, 0.11319578438997269, -0.004326376598328352, -0.0323910228908062, 0.10275550186634064, 0.010127193294465542, 0.02593264915049076, 0.024037709459662437, -0.01140775065869093, -0.005219059996306896, 0.015768006443977356, -0.12759819626808167, -0.10530897974967957, -0.016165731474757195, -0.04047464579343796, 0.030624637380242348, -0.021698683500289917, 0.05757564306259155, 0.010919109918177128, 0.024848008528351784, 0.04406687617301941, 0.014368548057973385, 0.007834596559405327, 0.05657225102186203, 0.07143289595842361, 0.014461609534919262, 0.001979441149160266, 0.06645296514034271, 0.040086351335048676, -0.014638258144259453, -0.014560784213244915, 0.05020596832036972, 0.0718928724527359, -0.08703373372554779, 0.07388954609632492, -0.005710414610803127, 0.025593137368559837, 0.05182871222496033, -0.012428639456629753, 0.10286258161067963, 0.04007067158818245, 0.009022517129778862, -0.04361315071582794, 0.01995111256837845, -0.03328986093401909, -0.06442242115736008, -0.03657010570168495, 0.08538477122783661, -0.040355972945690155, -0.02417725697159767, -0.019633499905467033, 0.03222808241844177, 0.009320775978267193, -0.04684048146009445, -0.004534443840384483, -0.0158767681568861, 0.07218966633081436, 0.010558976791799068, 0.08414487540721893, -0.03696029260754585, 0.11214781552553177, 0.07525546103715897, 0.014901205897331238, 0.03787468373775482, -0.03917637839913368, -0.0815807580947876, -0.02993040531873703, 0.026306157931685448, -0.014454332180321217, -0.008830100297927856, 0.12812528014183044, 0.03133148327469826, -5.4070579125209406e-8, -0.011039762757718563, -0.061696842312812805, -0.13842615485191345, -0.00870603509247303, -0.022345522418618202, -0.02110976167023182, -0.10361135005950928, -0.09603966027498245, 0.006128585431724787, -0.04625515639781952, 0.04820328950881958, -0.06776494532823563, -0.03815041109919548, 0.024091418832540512, 0.014849021099507809, 0.012736094184219837, 0.013297714293003082, -0.03921367973089218, -0.003976651467382908, -0.03704352304339409, -0.021998252719640732, -0.06408331543207169, -0.07486025243997574, -0.0012288326397538185, 0.07247617840766907, 0.08869000524282455, -0.03159860521554947, 0.05174071341753006, 0.045208148658275604, 0.04124128445982933, -0.0018494164105504751, -0.07012741267681122, 0.04697912931442261, -0.03551846742630005, 0.006505114492028952, 0.05601152032613754, -0.03279345855116844, 0.044397737830877304, 0.0332825593650341, 0.03921477869153023, 0.031023560091853142, -0.08769196271896362, -0.0948181301355362, 0.056845955550670624, -0.004815623629838228, 0.050241295248270035, 0.016450854018330574, 0.013793766498565674, -0.12160702049732208, 0.031629033386707306, 0.003071643877774477, -0.04900355637073517, 0.016558362171053886, -0.07449201494455338, -0.06264117360115051, 0.06384126842021942, -0.051089804619550705, 0.012969370000064373, 0.02373056858778, -0.0686507523059845, 0.041550274938344955, -0.009503146633505821, 0.012988145463168621, 0.0017560934647917747 ]
0.039911
string} Calculates the signature on all the data passed through using either [`sign.update()`][] or [`sign.write()`][stream-writable-write]. If `privateKey` is not a [`KeyObject`][], this function behaves as if `privateKey` had been passed to [`crypto.createPrivateKey()`][]. If it is an object, the following additional properties can be passed: \* `dsaEncoding` {string} For DSA and ECDSA, this option specifies the format of the generated signature. It can be one of the following: \* `'der'` (default): DER-encoded ASN.1 signature structure encoding `(r, s)`. \* `'ieee-p1363'`: Signature format `r || s` as proposed in IEEE-P1363. \* `padding` {integer} Optional padding value for RSA, one of the following: \* `crypto.constants.RSA\_PKCS1\_PADDING` (default) \* `crypto.constants.RSA\_PKCS1\_PSS\_PADDING` `RSA\_PKCS1\_PSS\_PADDING` will use MGF1 with the same hash function used to sign the message as specified in section 3.1 of [RFC 4055][], unless an MGF1 hash function has been specified as part of the key in compliance with section 3.3 of [RFC 4055][]. \* `saltLength` {integer} Salt length for when padding is `RSA\_PKCS1\_PSS\_PADDING`. The special value `crypto.constants.RSA\_PSS\_SALTLEN\_DIGEST` sets the salt length to the digest size, `crypto.constants.RSA\_PSS\_SALTLEN\_MAX\_SIGN` (default) sets it to the maximum permissible value. If `outputEncoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. The `Sign` object can not be again used after `sign.sign()` method has been called. Multiple calls to `sign.sign()` will result in an error being thrown. ### `sign.update(data[, inputEncoding])` \* `data` {string|Buffer|TypedArray|DataView} \* `inputEncoding` {string} The [encoding][] of the `data` string. Updates the `Sign` content with the given `data`, the encoding of which is given in `inputEncoding`. If `encoding` is not provided, and the `data` is a string, an encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or `DataView`, then `inputEncoding` is ignored. This can be called many times with new data as it is streamed. ## Class: `Verify` \* Extends: {stream.Writable} The `Verify` class is a utility for verifying signatures. It can be used in one of two ways: \* As a writable [stream][] where written data is used to validate against the supplied signature, or \* Using the [`verify.update()`][] and [`verify.verify()`][] methods to verify the signature. The [`crypto.createVerify()`][] method is used to create `Verify` instances. `Verify` objects are not to be created directly using the `new` keyword. See [`Sign`][] for examples. ### `verify.update(data[, inputEncoding])` \* `data` {string|Buffer|TypedArray|DataView} \* `inputEncoding` {string} The [encoding][] of the `data` string. Updates the `Verify` content with the given `data`, the encoding of which is given in `inputEncoding`. If `inputEncoding` is not provided, and the `data` is a string, an encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or `DataView`, then `inputEncoding` is ignored. This can be called many times with new data as it is streamed. ### `verify.verify(object, signature[, signatureEncoding])` \* `object` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey} \* `dsaEncoding` {string} \* `padding` {integer} \* `saltLength` {integer} \* `signature` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `signatureEncoding` {string} The [encoding][] of the `signature` string. \* Returns: {boolean} `true` or `false` depending on the validity of the signature for the data and public key. Verifies the provided data using the given `object` and `signature`. If `object` is not a [`KeyObject`][], this function behaves as if `object` had been passed to [`crypto.createPublicKey()`][]. If it is an object, the following additional properties can be passed: \* `dsaEncoding` {string} For DSA and ECDSA, this option specifies the format of the signature. It can be one of the following: \* `'der'` (default): DER-encoded ASN.1 signature structure encoding `(r, s)`. \* `'ieee-p1363'`: Signature format `r || s` as proposed in IEEE-P1363. \* `padding` {integer} Optional padding value for RSA, one of the following: \* `crypto.constants.RSA\_PKCS1\_PADDING` (default) \* `crypto.constants.RSA\_PKCS1\_PSS\_PADDING` `RSA\_PKCS1\_PSS\_PADDING` will use MGF1 with the same hash function used to verify the message
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.07935930788516998, 0.08151252567768097, -0.08738037198781967, 0.020280994474887848, -0.015545346774160862, -0.06518682837486267, 0.0004977489588782191, 0.09859813749790192, 0.04231856018304825, -0.05201256647706032, 0.019166164100170135, -0.0021719199139624834, -0.002337930491194129, -0.058063920587301254, 0.05644996836781502, -0.035970255732536316, -0.04013318568468094, 0.005605858284980059, -0.023447509855031967, -0.008262268267571926, 0.05700613930821419, 0.024173807352781296, 0.012499330565333366, 0.012531674467027187, 0.03056846372783184, 0.03874173015356064, 0.1335417628288269, 0.1075270026922226, 0.035735029727220535, 0.018414819613099098, 0.01880122721195221, -0.016272496432065964, 0.014657559804618359, 0.015047588385641575, 0.08241740614175797, 0.09334880858659744, 0.0969507098197937, -0.053399134427309036, 0.010731040500104427, -0.006559357512742281, 0.042959295213222504, -0.00598983746021986, -0.07674857974052429, -0.0124675827100873, -0.0385303795337677, 0.0411812961101532, -0.042922861874103546, 0.05423816293478012, -0.10923432558774948, -0.057333607226610184, 0.06127646192908287, -0.002080706413835287, -0.05388754606246948, 0.03174697607755661, 0.020057879388332367, -0.023477308452129364, -0.022840840741991997, -0.03329075500369072, 0.017621085047721863, -0.08079653978347778, -0.025884488597512245, 0.01079218927770853, 0.03539247065782547, 0.014987473376095295, 0.0020147229079157114, 0.03532044216990471, 0.0025208292063325644, -0.06504523009061813, 0.004077914636582136, -0.007719177752733231, -0.052823517471551895, -0.03525794297456741, -0.0166573915630579, 0.05380077660083771, -0.003531628055498004, -0.017801817506551743, -0.07281580567359924, 0.023951919749379158, -0.0003386446041986346, -0.06214025989174843, -0.02250705286860466, -0.1153702437877655, -0.03990178927779198, 0.03227097541093826, 0.02684568613767624, 0.11601386219263077, 0.003961928654462099, -0.01857268251478672, 0.003036362351849675, 0.11657469719648361, 0.03963088616728783, -0.025290904566645622, -0.005904099438339472, -0.01899515837430954, -0.009849864058196545, 0.032021891325712204, 0.019025420770049095, 0.03864064812660217, 0.011512404307723045, 0.005182200111448765, -0.04877796396613121, 0.0364619717001915, -0.004871684592217207, -0.07253993302583694, 0.08121790736913681, 0.06131063029170036, -0.010883173905313015, -0.07709895074367523, 0.014645103365182877, -0.03293947875499725, -0.0424470379948616, -0.02704515866935253, -0.06756730377674103, -0.015116609632968903, -0.03249780461192131, 0.06612462550401688, -0.08160778880119324, 0.08041030168533325, -0.021830452606081963, 0.006511712446808815, 0.04557989165186882, -0.07718271762132645, -0.05474141240119934, 0.047540586441755295, -0.05945318937301636, -0.04040712118148804, -0.04261200502514839, 3.968412357710409e-33, 0.05881157144904137, 0.019999325275421143, -0.04070315510034561, -0.05186999961733818, -0.002251763129606843, 0.02614513412117958, 0.0056832339614629745, 0.030950047075748444, -0.007151775062084198, 0.03787863999605179, -0.0664929673075676, 0.021476034075021744, 0.0347398966550827, -0.0465494766831398, 0.02772391028702259, 0.014934168197214603, 0.04107208549976349, -0.06016352027654648, 0.04460825026035309, 0.061006881296634674, 0.1490941345691681, 0.028184758499264717, 0.055050138384103775, -0.025969456881284714, -0.03142651543021202, 0.015552984550595284, 0.010456421412527561, -0.028853876516222954, 0.03159569203853607, 0.006589650642126799, -0.06046266481280327, -0.04370947182178497, -0.027626194059848785, -0.03983469679951668, 0.057039421051740646, -0.025847019627690315, 0.03535673767328262, -0.01701592281460762, -0.06995677947998047, 0.00035414929152466357, 0.07096441835165024, -0.040969688445329666, -0.04372477903962135, -0.013613920658826828, -0.030138429254293442, 0.023010998964309692, -0.03611835837364197, 0.06354659050703049, 0.1313726007938385, 0.02777840942144394, 0.005143043585121632, -0.030908802524209023, 0.011490494012832642, -0.021466592326760292, 0.02447049878537655, -0.11211750656366348, 0.011371721513569355, -0.04023092985153198, -0.03035917691886425, 0.020562460646033287, -0.057223331183195114, 0.08068051934242249, 0.03881281986832619, -0.02431062050163746, 0.01434644591063261, 0.03416081890463829, 0.04516477882862091, 0.009027634747326374, -0.024713486433029175, -0.052344758063554764, -0.032023366540670395, -0.006357764825224876, -0.1150786429643631, 0.06753968447446823, -0.04055821895599365, -0.06365328282117844, -0.023577503859996796, 0.020808586850762367, 0.040083255618810654, -0.004770099651068449, -0.050201211124658585, 0.14321038126945496, 0.0034015425480902195, 0.04438753426074982, 0.04373104125261307, -0.017233092337846756, -0.07105047255754471, -0.039462462067604065, -0.08127550780773163, -0.06259866803884506, -0.005824429448693991, -0.05850539728999138, -0.031313296407461166, 0.00823645293712616, -0.06011490523815155, -6.536821963851013e-33, -0.003113522892817855, -0.03225133568048477, -0.04074942693114281, 0.08675825595855713, -0.056172486394643784, -0.032808925956487656, -0.02476612664759159, 0.09193208068609238, 0.044064246118068695, -0.04248807579278946, 0.005577386356890202, -0.04938634857535362, 0.03822870925068855, -0.05916514992713928, 0.08355255424976349, -0.048524029552936554, -0.15274183452129364, 0.04963836073875427, 0.008640165440738201, -0.048505958169698715, 0.0007555704796686769, 0.01274863351136446, 0.05362474173307419, 0.08028054237365723, 0.03476576879620552, 0.0057095750235021114, 0.024364402517676353, 0.05207960680127144, -0.04131057485938072, 0.009739743545651436, -0.006321168504655361, 0.09332197159528732, -0.06574784964323044, -0.041733674705028534, -0.08478105068206787, -0.06974233686923981, -0.0055987942032516, 0.050117127597332, 0.052643824368715286, 0.016013601794838905, 0.046344757080078125, 0.05979606881737709, 0.03140146657824516, 0.08002186566591263, 0.021107789129018784, 0.010781434364616871, 0.016081295907497406, 0.0693824291229248, -0.033128522336483, 0.024149158969521523, 0.12986956536769867, -0.07368436455726624, 0.013093238696455956, 0.03546880930662155, 0.037473954260349274, 0.09263826161623001, -0.011045929044485092, 0.01743861846625805, 0.021079186350107193, -0.01622803322970867, 0.04305361956357956, -0.04771469533443451, 0.0802488774061203, 0.0547005757689476, -0.016141697764396667, -0.05875099450349808, 0.029145095497369766, -0.04882611706852913, -0.025233415886759758, -0.018703030422329903, 0.07153266668319702, -0.05367400497198105, -0.0953081026673317, 0.03423787280917168, -0.043292395770549774, -0.06201101094484329, -0.045642875134944916, 0.01715012826025486, 0.03607475012540817, 0.06111738458275795, -0.03223518282175064, 0.06876875460147858, -0.035062190145254135, 0.05700547993183136, 0.012872954830527306, -0.018636012449860573, 0.07845322787761688, -0.037346966564655304, -0.07050435245037079, 0.03700317442417145, -0.03592811897397041, 0.040058765560388565, -0.018333595246076584, 0.12761718034744263, -0.01570032350718975, -5.665264168897011e-8, -0.03229938820004463, -0.003787119872868061, -0.0677744597196579, -0.01570097915828228, 0.04443036764860153, -0.0446508564054966, -0.04317920282483101, -0.1272774338722229, 0.021043529734015465, -0.11794500052928925, 0.045124053955078125, -0.032481443136930466, -0.0789603739976883, -0.06661016494035721, -0.0664806142449379, -0.0042364029213786125, -0.03672783821821213, 0.025294985622167587, -0.05855686962604523, -0.09008128196001053, 0.099860779941082, -0.08661088347434998, -0.08106499910354614, -0.01947784051299095, 0.042438555508852005, 0.033339764922857285, 0.06970251351594925, 0.06650445610284805, 0.026662619784474373, -0.014773673377931118, 0.050489217042922974, -0.047753170132637024, 0.11582788079977036, -0.01380367111414671, -0.057662609964609146, -0.014006245881319046, -0.012127098627388477, -0.0046841297298669815, 0.04536188393831253, 0.096549853682518, -0.019226135686039925, -0.02706308849155903, -0.04233424738049507, -0.0018805236322805285, -0.05653897672891617, -0.009681547991931438, 0.014692554250359535, 0.07700317353010178, -0.045996617525815964, 0.03590340539813042, 0.041573502123355865, -0.07949583232402802, 0.004910367075353861, -0.015695730224251747, -0.08134905993938446, 0.00999385491013527, -0.03789718821644783, 0.018315955996513367, 0.026786433532834053, -0.0349331870675087, 0.05189310386776924, -0.016384456306695938, 0.014244983904063702, 0.026528889313340187 ]
0.064436
(default): DER-encoded ASN.1 signature structure encoding `(r, s)`. \* `'ieee-p1363'`: Signature format `r || s` as proposed in IEEE-P1363. \* `padding` {integer} Optional padding value for RSA, one of the following: \* `crypto.constants.RSA\_PKCS1\_PADDING` (default) \* `crypto.constants.RSA\_PKCS1\_PSS\_PADDING` `RSA\_PKCS1\_PSS\_PADDING` will use MGF1 with the same hash function used to verify the message as specified in section 3.1 of [RFC 4055][], unless an MGF1 hash function has been specified as part of the key in compliance with section 3.3 of [RFC 4055][]. \* `saltLength` {integer} Salt length for when padding is `RSA\_PKCS1\_PSS\_PADDING`. The special value `crypto.constants.RSA\_PSS\_SALTLEN\_DIGEST` sets the salt length to the digest size, `crypto.constants.RSA\_PSS\_SALTLEN\_AUTO` (default) causes it to be determined automatically. The `signature` argument is the previously calculated signature for the data, in the `signatureEncoding`. If a `signatureEncoding` is specified, the `signature` is expected to be a string; otherwise `signature` is expected to be a [`Buffer`][], `TypedArray`, or `DataView`. The `verify` object can not be used again after `verify.verify()` has been called. Multiple calls to `verify.verify()` will result in an error being thrown. Because public keys can be derived from private keys, a private key may be passed instead of a public key. ## Class: `X509Certificate` Encapsulates an X509 certificate and provides read-only access to its information. ```mjs const { X509Certificate } = await import('node:crypto'); const x509 = new X509Certificate('{... pem encoded cert ...}'); console.log(x509.subject); ``` ```cjs const { X509Certificate } = require('node:crypto'); const x509 = new X509Certificate('{... pem encoded cert ...}'); console.log(x509.subject); ``` ### `new X509Certificate(buffer)` \* `buffer` {string|TypedArray|Buffer|DataView} A PEM or DER encoded X509 Certificate. ### `x509.ca` \* Type: {boolean} Will be `true` if this is a Certificate Authority (CA) certificate. ### `x509.checkEmail(email[, options])` \* `email` {string} \* `options` {Object} \* `subject` {string} `'default'`, `'always'`, or `'never'`. \*\*Default:\*\* `'default'`. \* Returns: {string|undefined} Returns `email` if the certificate matches, `undefined` if it does not. Checks whether the certificate matches the given email address. If the `'subject'` option is undefined or set to `'default'`, the certificate subject is only considered if the subject alternative name extension either does not exist or does not contain any email addresses. If the `'subject'` option is set to `'always'` and if the subject alternative name extension either does not exist or does not contain a matching email address, the certificate subject is considered. If the `'subject'` option is set to `'never'`, the certificate subject is never considered, even if the certificate contains no subject alternative names. ### `x509.checkHost(name[, options])` \* `name` {string} \* `options` {Object} \* `subject` {string} `'default'`, `'always'`, or `'never'`. \*\*Default:\*\* `'default'`. \* `wildcards` {boolean} \*\*Default:\*\* `true`. \* `partialWildcards` {boolean} \*\*Default:\*\* `true`. \* `multiLabelWildcards` {boolean} \*\*Default:\*\* `false`. \* `singleLabelSubdomains` {boolean} \*\*Default:\*\* `false`. \* Returns: {string|undefined} Returns a subject name that matches `name`, or `undefined` if no subject name matches `name`. Checks whether the certificate matches the given host name. If the certificate matches the given host name, the matching subject name is returned. The returned name might be an exact match (e.g., `foo.example.com`) or it might contain wildcards (e.g., `\*.example.com`). Because host name comparisons are case-insensitive, the returned subject name might also differ from the given `name` in capitalization. If the `'subject'` option is undefined or set to `'default'`, the certificate subject is only considered if the subject alternative name extension either does not exist or does not contain any DNS names. This behavior is consistent with [RFC 2818][] ("HTTP Over TLS"). If the `'subject'` option is set to `'always'` and if the subject alternative name extension either does not exist or does not contain a matching DNS name, the certificate subject is considered. If the `'subject'` option is set to `'never'`, the certificate
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.1110038086771965, -0.00916339922696352, -0.06454005837440491, -0.020155945792794228, 0.04965484142303467, -0.06655053794384003, 0.033108361065387726, 0.044960152357816696, 0.028390953317284584, -0.06080930307507515, 0.03767556697130203, 0.04794229567050934, 0.05454939976334572, 0.007998626679182053, -0.0032466582488268614, -0.09350840002298355, -0.01266952883452177, 0.05131741613149643, -0.014935423620045185, 0.04692135006189346, 0.05739996209740639, 0.023934707045555115, 0.08596614003181458, -0.023623712360858917, 0.035350117832422256, 0.021307189017534256, 0.020526807755231857, 0.07306402921676636, 0.018316615372896194, -0.04070309177041054, 0.015606979839503765, 0.028737159445881844, 0.05243481695652008, 0.03178577870130539, 0.07898420095443726, 0.09732969850301743, 0.07208077609539032, -0.03923118859529495, 0.018179159611463547, 0.0118504473939538, -0.02569621242582798, 0.007072723004966974, -0.00516143161803484, -0.0036573915276676416, 0.01173100620508194, 0.012488634325563908, -0.001004107529297471, 0.02848268859088421, -0.039599694311618805, -0.03401093930006027, 0.0835636556148529, 0.05641337111592293, -0.03380062058568001, 0.08061625808477402, 0.07286220788955688, -0.07951053977012634, -0.1427288055419922, 0.01773279346525669, -0.03436297923326492, 0.025242382660508156, -0.06069239601492882, 0.005189449526369572, -0.006118656601756811, -0.00030250614508986473, 0.054183490574359894, 0.04728124290704727, -0.002869256539270282, -0.129167377948761, -0.04554497450590134, 0.01823105849325657, -0.1090475544333458, -0.014261127449572086, -0.08788356184959412, 0.08505287021398544, -0.039328090846538544, 0.08634889125823975, -0.05584367737174034, 0.024829979985952377, -0.045666784048080444, -0.09349361807107925, -0.047391925007104874, -0.07097878307104111, 0.017645569518208504, -0.002066639717668295, 0.03816310688853264, -0.006948595866560936, -0.0006932404357939959, 0.03107842057943344, -0.00012497787247411907, 0.05663874000310898, 0.11746796220541, 0.0030136725399643183, 0.010225393809378147, 0.07508333772420883, -0.003811617847532034, 0.004100852180272341, -0.025965750217437744, 0.055884767323732376, -0.02793039008975029, 0.03377397730946541, -0.04142524674534798, 0.02889283001422882, 0.022582747042179108, -0.025409666821360588, 0.051186155527830124, 0.024908466264605522, -0.05278961732983589, -0.03155088052153587, 0.030438046902418137, 0.009924727492034435, -0.008486890234053135, -0.011595776304602623, -0.08806182444095612, -0.04665923863649368, -0.039201393723487854, 0.028237855061888695, -0.07620403915643692, 0.0604587160050869, 0.010302562266588211, -0.014258922077715397, 0.003925422206521034, -0.06026404723525047, -0.08530145138502121, 0.049582477658987045, -0.039506133645772934, -0.010632172226905823, -0.0640186220407486, 4.6982878203955066e-33, -0.04238100349903107, 0.08245564997196198, 0.023616118356585503, -0.026962850242853165, -0.046357203274965286, 0.02582738921046257, -0.00445581553503871, -0.012085787951946259, 0.030398724600672722, 0.013297490775585175, -0.04876597970724106, 0.0244704969227314, 0.028119605034589767, -0.06715209037065506, -0.006592211779206991, -0.015450025908648968, 0.032864395529031754, -0.03734293207526207, 0.07137960195541382, 0.016965867951512337, 0.05574608966708183, 0.03148181736469269, 0.07885724306106567, -0.0317041389644146, -0.0008486339938826859, 0.008022015914320946, 0.008574957959353924, -0.09768251329660416, 0.023613987490534782, 0.008092548698186874, -0.06161954998970032, -0.050874289125204086, -0.009892977774143219, -0.032197874039411545, 0.018204258754849434, -0.020334461703896523, 0.03206571191549301, -0.04915187135338783, -0.09921076148748398, -0.007403475232422352, 0.029276534914970398, 0.014644780196249485, -0.05615423992276192, 0.0554979108273983, -0.0001353039697278291, -0.06591824442148209, 0.012261629104614258, 0.02133621647953987, 0.030088070780038834, 0.015920888632535934, 0.0351920984685421, 0.02399703487753868, 0.022986769676208496, -0.027301175519824028, 0.00947511661797762, -0.09613131731748581, 0.05492189899086952, -0.048303842544555664, -0.018420590087771416, 0.04175421595573425, -0.00802538264542818, -0.023674488067626953, 0.06187564134597778, -0.052735183387994766, 0.05024542659521103, 0.017394866794347763, -0.003172378521412611, 0.001306509249843657, -0.02955389954149723, -0.007978060282766819, -0.04498268663883209, -0.01612022891640663, -0.039319075644016266, 0.10126718133687973, -0.09022132307291031, -0.025503648445010185, 0.0033989346120506525, 0.046376075595617294, 0.06353882700204849, -0.024052632972598076, -0.08744263648986816, 0.11106191575527191, -0.024852130562067032, 0.05784289911389351, -0.0679459497332573, -0.015598434023559093, 0.005704734940081835, -0.05018855258822441, -0.0916261151432991, -0.06318584829568863, 0.05253460630774498, 0.013377425260841846, 0.02038619853556156, 0.017481917515397072, -0.04576190933585167, -5.844223263740414e-33, -0.013494964689016342, -0.016603155061602592, -0.059086333960294724, 0.07485618442296982, -0.12725448608398438, -0.019242051988840103, 0.08761931210756302, 0.023474330082535744, -0.011185170151293278, -0.012560658156871796, 0.0724707767367363, -0.07916003465652466, 0.037580762058496475, -0.10354092717170715, 0.04683825373649597, -0.06516130268573761, -0.10447028279304504, 0.13317570090293884, 0.0007606878643855453, 0.01597084291279316, 0.06656627357006073, 0.044356971979141235, -0.012674009427428246, 0.08481868356466293, -0.01085975393652916, 0.04237249866127968, 0.06363048404455185, -0.0013639956014230847, -0.05780491977930069, 0.011308891698718071, 0.007850943133234978, 0.08076527714729309, -0.037587977945804596, -0.08178823441267014, -0.048640284687280655, -0.05960431322455406, -0.0042703161016106606, -0.0015291633317247033, 0.026343300938606262, 0.062133144587278366, 0.060101207345724106, 0.07510562241077423, 0.03559667244553566, 0.0602724514901638, -0.005268275272101164, -0.024944771081209183, 0.050827521830797195, 0.04558084160089493, 0.047694578766822815, -0.037141282111406326, 0.06804168224334717, -0.011351180262863636, -0.03357598930597305, -0.002030101604759693, 0.0496169850230217, 0.05227034538984299, -0.0813961923122406, 0.03548392653465271, -0.011318671517074108, -0.010928753763437271, 0.030537530779838562, -0.02088717743754387, 0.062082063406705856, -0.002875568810850382, -0.005214502103626728, -0.015385680831968784, 0.06292035430669785, -0.09232959896326065, 0.012100647203624249, 0.039660729467868805, 0.0262270700186491, -0.036156050860881805, 0.002097627380862832, 0.02648642472922802, 0.007572807837277651, -0.006193016655743122, 0.045074425637722015, 0.04570018872618675, 0.02844928950071335, -0.010682052932679653, -0.08360090106725693, 0.09393033385276794, -0.09825154393911362, 0.0563790537416935, 0.03421158343553543, -0.027582816779613495, 0.0786871612071991, 0.016470085829496384, -0.038991205394268036, -0.012492973357439041, 0.04884469136595726, 0.02947939746081829, 0.012007294222712517, 0.14557655155658722, -0.02306990511715412, -5.293943772244347e-8, -0.027982722967863083, -0.05819329246878624, -0.044168129563331604, -0.06978840380907059, 0.04105796664953232, 0.04061223194003105, -0.04414286091923714, -0.11197127401828766, 0.02483189105987549, -0.08225296437740326, 0.07981011271476746, -0.0015069639775902033, -0.060476429760456085, -0.09227980673313141, -0.04718312621116638, -0.010049799457192421, -0.07592444866895676, 0.02077166549861431, -0.05354352667927742, -0.07614284008741379, 0.04382796213030815, -0.028712017461657524, -0.06315108388662338, -0.056477051228284836, 0.04945966973900795, 0.004048044793307781, -0.02071518450975418, 0.09638319164514542, -0.017653517425060272, -0.036808665841817856, 0.050224561244249344, -0.06580561399459839, 0.07410908490419388, -0.11794120073318481, -0.0060151140205562115, -0.00006843291339464486, 0.019638726487755775, 0.03150724619626999, 0.05128294974565506, 0.0523877888917923, -0.06122715771198273, -0.12422467768192291, -0.006729232147336006, -0.010528047569096088, -0.043911971151828766, 0.042011797428131104, -0.012627474032342434, 0.1045503169298172, -0.10265134274959564, 0.05236021429300308, 0.06853611022233963, -0.06020452082157135, -0.001789382193237543, -0.048070989549160004, -0.01894686557352543, 0.011281721293926239, -0.03313751518726349, -0.012213782407343388, 0.04592084884643555, -0.041237346827983856, 0.033397335559129715, -0.04608780890703201, -0.05489542707800865, 0.023577431216835976 ]
0.029054
is consistent with [RFC 2818][] ("HTTP Over TLS"). If the `'subject'` option is set to `'always'` and if the subject alternative name extension either does not exist or does not contain a matching DNS name, the certificate subject is considered. If the `'subject'` option is set to `'never'`, the certificate subject is never considered, even if the certificate contains no subject alternative names. ### `x509.checkIP(ip)` \* `ip` {string} \* Returns: {string|undefined} Returns `ip` if the certificate matches, `undefined` if it does not. Checks whether the certificate matches the given IP address (IPv4 or IPv6). Only [RFC 5280][] `iPAddress` subject alternative names are considered, and they must match the given `ip` address exactly. Other subject alternative names as well as the subject field of the certificate are ignored. ### `x509.checkIssued(otherCert)` \* `otherCert` {X509Certificate} \* Returns: {boolean} Checks whether this certificate was potentially issued by the given `otherCert` by comparing the certificate metadata. This is useful for pruning a list of possible issuer certificates which have been selected using a more rudimentary filtering routine, i.e. just based on subject and issuer names. Finally, to verify that this certificate's signature was produced by a private key corresponding to `otherCert`'s public key use [`x509.verify(publicKey)`][] with `otherCert`'s public key represented as a [`KeyObject`][] like so ```js if (!x509.verify(otherCert.publicKey)) { throw new Error('otherCert did not issue x509'); } ``` ### `x509.checkPrivateKey(privateKey)` \* `privateKey` {KeyObject} A private key. \* Returns: {boolean} Checks whether the public key for this certificate is consistent with the given private key. ### `x509.fingerprint` \* Type: {string} The SHA-1 fingerprint of this certificate. Because SHA-1 is cryptographically broken and because the security of SHA-1 is significantly worse than that of algorithms that are commonly used to sign certificates, consider using [`x509.fingerprint256`][] instead. ### `x509.fingerprint256` \* Type: {string} The SHA-256 fingerprint of this certificate. ### `x509.fingerprint512` \* Type: {string} The SHA-512 fingerprint of this certificate. Because computing the SHA-256 fingerprint is usually faster and because it is only half the size of the SHA-512 fingerprint, [`x509.fingerprint256`][] may be a better choice. While SHA-512 presumably provides a higher level of security in general, the security of SHA-256 matches that of most algorithms that are commonly used to sign certificates. ### `x509.infoAccess` \* Type: {string} A textual representation of the certificate's authority information access extension. This is a line feed separated list of access descriptions. Each line begins with the access method and the kind of the access location, followed by a colon and the value associated with the access location. After the prefix denoting the access method and the kind of the access location, the remainder of each line might be enclosed in quotes to indicate that the value is a JSON string literal. For backward compatibility, Node.js only uses JSON string literals within this property when necessary to avoid ambiguity. Third-party code should be prepared to handle both possible entry formats. ### `x509.issuer` \* Type: {string} The issuer identification included in this certificate. ### `x509.issuerCertificate` \* Type: {X509Certificate} The issuer certificate or `undefined` if the issuer certificate is not available. ### `x509.keyUsage` \* Type: {string\[]} An array detailing the key extended usages for this certificate. ### `x509.publicKey` \* Type: {KeyObject} The public key {KeyObject} for this certificate. ### `x509.raw` \* Type: {Buffer} A `Buffer` containing the DER encoding of this certificate. ### `x509.serialNumber` \* Type: {string} The serial number of this certificate. Serial numbers are assigned by certificate authorities and do not uniquely identify certificates. Consider using [`x509.fingerprint256`][] as a unique identifier instead. ### `x509.subject` \* Type: {string} The complete subject of this certificate. ### `x509.subjectAltName` \* Type: {string} The subject alternative name specified
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.061098888516426086, 0.059378016740083694, 0.02621152438223362, -0.03464575484395027, 0.03975691273808479, -0.07347028702497482, 0.04007311165332794, -0.06512156873941422, 0.06544147431850433, -0.07834067940711975, -0.00864475592970848, -0.09010397642850876, 0.0422552265226841, 0.08713657408952713, 0.03461781144142151, -0.05982092022895813, -0.04439858719706535, -0.02893715351819992, 0.05121813341975212, -0.026811033487319946, 0.03688003867864609, 0.06862573325634003, 0.0629761591553688, -0.019558629021048546, -0.10010010749101639, -0.05564069747924805, -0.027848776429891586, 0.02835240215063095, -0.04091474786400795, 0.0030931145884096622, 0.029026713222265244, 0.05936262011528015, -0.08164290338754654, 0.0451526939868927, -0.02875116840004921, 0.0009217706974595785, 0.057032350450754166, 0.04888375103473663, -0.011518538929522038, -0.01263452135026455, 0.026028327643871307, -0.1047893837094307, -0.0028161441441625357, -0.028920356184244156, 0.05424177646636963, 0.09405539929866791, -0.04747772216796875, -0.05215669795870781, -0.06452500820159912, 0.0050809611566364765, 0.008118150755763054, -0.04889966920018196, 0.009874191135168076, 0.0535147525370121, 0.04031132534146309, 0.014065016061067581, -0.00926266610622406, 0.07257688045501709, 0.055203478783369064, -0.00469796359539032, 0.0012765094870701432, -0.003925074823200703, -0.022610008716583252, 0.04900548234581947, 0.0030983490869402885, -0.048162348568439484, -0.09283310174942017, -0.003760912688449025, -0.01253803726285696, 0.0589413084089756, 0.005685402080416679, 0.02843991108238697, 0.004484109580516815, 0.04164385423064232, 0.022389588877558708, 0.00984557718038559, 0.005569091532379389, -0.06138340383768082, -0.013123098760843277, -0.07171565294265747, -0.022838199511170387, -0.09503223747015, -0.07522016018629074, 0.032249365001916885, -0.0029835165478289127, -0.04301510751247406, -0.027230331674218178, -0.02380121313035488, -0.0032422931399196386, 0.022034114226698875, 0.049314651638269424, -0.04437936842441559, 0.007269999943673611, -0.009270677343010902, 0.13912349939346313, 0.06702080368995667, 0.020265065133571625, -0.05914581939578056, -0.011016666889190674, -0.030648451298475266, 0.015282677486538887, -0.04847472161054611, -0.09038978815078735, -0.048175569623708725, 0.06271128356456757, 0.07301033288240433, -0.029392076656222343, -0.03165634721517563, 0.09835001826286316, -0.0003671872545965016, 0.007851376198232174, -0.01158771850168705, 0.05259634181857109, -0.0717073529958725, -0.031154640018939972, 0.1094057634472847, 0.03630277141928673, 0.06849080324172974, 0.03144102543592453, -0.04369138926267624, -0.09172454476356506, -0.012904287315905094, 0.011090302839875221, -0.031979214400053024, 0.02275349386036396, -0.03805551305413246, 0.09483624994754791, 6.814426709741205e-33, 0.050437625497579575, 0.011988421902060509, -0.045151785016059875, 0.0035080367233604193, -0.04817437753081322, 0.003329366445541382, 0.0757126733660698, 0.08574840426445007, -0.0660567507147789, 0.0333387665450573, 0.010608525015413761, 0.02385828085243702, -0.029422251507639885, -0.07442277669906616, -0.00728724617511034, 0.03177650272846222, 0.029284564778208733, 0.04116819426417351, 0.012090981006622314, 0.05464979261159897, -0.006330655887722969, -0.03461330756545067, 0.048228565603494644, 0.008439728058874607, -0.041945163160562515, -0.000025996987460530363, 0.02563677355647087, -0.013879482634365559, 0.009294393472373486, -0.011352714151144028, -0.025244303047657013, -0.020643407478928566, 0.03270845115184784, 0.007092520594596863, 0.09687267988920212, 0.05569709464907646, 0.07563784718513489, 0.01796933077275753, -0.06217612698674202, -0.05211779102683067, 0.0068314592353999615, 0.004077002871781588, 0.009911710396409035, 0.03200533986091614, -0.0007721288711763918, -0.021044565364718437, -0.0339634008705616, -0.0600208155810833, 0.10679849982261658, 0.05971271172165871, 0.0096211489289999, -0.01808510161936283, 0.003937019035220146, -0.0811576247215271, 0.04137318953871727, -0.053935155272483826, -0.03754016384482384, 0.13444486260414124, -0.10443016141653061, -0.021957550197839737, 0.015899239107966423, -0.032791849225759506, -0.14716589450836182, -0.05097796022891998, 0.06263387948274612, 0.09016366302967072, 0.03155427426099777, -0.004762138240039349, -0.0776381716132164, -0.056273989379405975, -0.03882252424955368, 0.03788870573043823, 0.04179932549595833, 0.031482942402362823, 0.020886875689029694, -0.0001020013150991872, -0.055664073675870895, 0.09097420424222946, -0.01359139010310173, -0.011548957787454128, 0.027355503290891647, 0.09684184938669205, 0.027376988902688026, 0.02120983600616455, -0.06615718454122543, 0.04371403530240059, 0.04565614089369774, 0.005613780114799738, -0.01348372083157301, 0.009820215404033661, -0.007446907926350832, 0.011843329295516014, -0.06490587443113327, 0.079273521900177, 0.023339416831731796, -6.562483740213433e-33, -0.03368953987956047, 0.008037472143769264, -0.010335328988730907, 0.03473232313990593, -0.04872068017721176, -0.11089666187763214, 0.042897943407297134, -0.012797572650015354, 0.013613566756248474, -0.039775293320417404, 0.038599152117967606, -0.09109536558389664, 0.0453806072473526, -0.02382753975689411, -0.004197968635708094, 0.003589121624827385, -0.18079356849193573, 0.05029260739684105, -0.09391102939844131, 0.03172171860933304, 0.03808809071779251, 0.056424930691719055, -0.04224717617034912, 0.034426216036081314, -0.035429954528808594, 0.04458598047494888, -0.027736272662878036, 0.018072204664349556, -0.03078405186533928, -0.0018219189951196313, 0.026378287002444267, 0.03479037806391716, -0.016130710020661354, 0.05106564238667488, -0.058133285492658615, -0.07590441405773163, 0.0026841736398637295, 0.0425245575606823, 0.0883292406797409, 0.05035342648625374, 0.0021256753243505955, -0.01821175403892994, -0.01289828959852457, 0.007484125439077616, 0.017102517187595367, -0.014433306641876698, 0.03837444633245468, 0.1007058173418045, 0.038393668830394745, 0.013342415913939476, 0.020763549953699112, -0.011901400052011013, -0.04854569211602211, 0.04319094866514206, 0.1002715677022934, 0.03413534536957741, -0.07173086702823639, 0.01556506846100092, -0.013557156547904015, -0.0142524940893054, 0.03511011227965355, -0.014923219569027424, 0.02925868146121502, 0.06386197358369827, 0.01794206164777279, 0.0998530462384224, -0.05372687056660652, -0.004629489034414291, 0.06509563326835632, -0.02603757753968239, -0.009544930420815945, -0.05545781925320625, -0.04584513604640961, -0.11605025827884674, 0.04466291144490242, 0.038641512393951416, 0.080874003469944, 0.00533724669367075, -0.007802002131938934, 0.07042542099952698, -0.015813682228326797, 0.024311523884534836, -0.059208936989307404, 0.0085570914670825, 0.08124946802854538, 0.05702663213014603, -0.025594046339392662, -0.0002794849860947579, -0.0692668929696083, 0.009570613503456116, -0.0001787719374988228, 0.10375923663377762, 0.003885649610310793, -0.0074085635133087635, 0.04216998443007469, -5.534004543505944e-8, -0.015555997379124165, 0.05894704908132553, -0.07799903303384781, 0.012710962444543839, -0.007790923584252596, 0.04342012107372284, 0.06466400623321533, -0.14925473928451538, -0.006234881468117237, -0.0007291765068657696, -0.09902063757181168, -0.030671441927552223, -0.0034245240967720747, -0.03898013010621071, -0.027421878650784492, -0.10569435358047485, -0.055602602660655975, -0.0200492013245821, -0.029849333688616753, -0.004600190557539463, 0.04562758654356003, -0.14040499925613403, -0.033144887536764145, 0.029225723817944527, -0.057053353637456894, -0.008125598542392254, 0.035280413925647736, -0.021484794095158577, 0.0034142527729272842, 0.03759939596056938, -0.02976183220744133, -0.036317743360996246, -0.031653452664613724, -0.013668058440089226, 0.06427538394927979, 0.13356086611747742, -0.04871579632163048, -0.00359233352355659, 0.024673916399478912, 0.13615599274635315, 0.022432781755924225, -0.00408770889043808, -0.05816403776407242, 0.04620221629738808, 0.032637473195791245, 0.02062157727777958, -0.01954231970012188, -0.01413340587168932, -0.020630162209272385, 0.00221705692820251, -0.05710570886731148, -0.06527537852525711, 0.01027513574808836, -0.058664530515670776, -0.10422820597887039, 0.03428908437490463, 0.006337212864309549, -0.0002987831539940089, -0.04361090809106827, 0.003909669350832701, 0.07575012743473053, -0.07713212817907333, 0.08936256170272827, 0.009292942471802235 ]
-0.033321
Type: {string} The serial number of this certificate. Serial numbers are assigned by certificate authorities and do not uniquely identify certificates. Consider using [`x509.fingerprint256`][] as a unique identifier instead. ### `x509.subject` \* Type: {string} The complete subject of this certificate. ### `x509.subjectAltName` \* Type: {string} The subject alternative name specified for this certificate. This is a comma-separated list of subject alternative names. Each entry begins with a string identifying the kind of the subject alternative name followed by a colon and the value associated with the entry. Earlier versions of Node.js incorrectly assumed that it is safe to split this property at the two-character sequence `', '` (see [CVE-2021-44532][]). However, both malicious and legitimate certificates can contain subject alternative names that include this sequence when represented as a string. After the prefix denoting the type of the entry, the remainder of each entry might be enclosed in quotes to indicate that the value is a JSON string literal. For backward compatibility, Node.js only uses JSON string literals within this property when necessary to avoid ambiguity. Third-party code should be prepared to handle both possible entry formats. ### `x509.toJSON()` \* Type: {string} There is no standard JSON encoding for X509 certificates. The `toJSON()` method returns a string containing the PEM encoded certificate. ### `x509.toLegacyObject()` \* Type: {Object} Returns information about this certificate using the legacy [certificate object][] encoding. ### `x509.toString()` \* Type: {string} Returns the PEM-encoded certificate. ### `x509.validFrom` \* Type: {string} The date/time from which this certificate is valid. ### `x509.validFromDate` \* Type: {Date} The date/time from which this certificate is valid, encapsulated in a `Date` object. ### `x509.validTo` \* Type: {string} The date/time until which this certificate is valid. ### `x509.validToDate` \* Type: {Date} The date/time until which this certificate is valid, encapsulated in a `Date` object. ### `x509.signatureAlgorithm` \* Type: {string|undefined} The algorithm used to sign the certificate or `undefined` if the signature algorithm is unknown by OpenSSL. ### `x509.signatureAlgorithmOid` \* Type: {string} The OID of the algorithm used to sign the certificate. ### `x509.verify(publicKey)` \* `publicKey` {KeyObject} A public key. \* Returns: {boolean} Verifies that this certificate was signed by the given public key. Does not perform any other validation checks on the certificate. ## `node:crypto` module methods and properties ### `crypto.argon2(algorithm, parameters, callback)` > Stability: 1.2 - Release candidate \* `algorithm` {string} Variant of Argon2, one of `"argon2d"`, `"argon2i"` or `"argon2id"`. \* `parameters` {Object} \* `message` {string|ArrayBuffer|Buffer|TypedArray|DataView} REQUIRED, this is the password for password hashing applications of Argon2. \* `nonce` {string|ArrayBuffer|Buffer|TypedArray|DataView} REQUIRED, must be at least 8 bytes long. This is the salt for password hashing applications of Argon2. \* `parallelism` {number} REQUIRED, degree of parallelism determines how many computational chains (lanes) can be run. Must be greater than 1 and less than `2\*\*24-1`. \* `tagLength` {number} REQUIRED, the length of the key to generate. Must be greater than 4 and less than `2\*\*32-1`. \* `memory` {number} REQUIRED, memory cost in 1KiB blocks. Must be greater than `8 \* parallelism` and less than `2\*\*32-1`. The actual number of blocks is rounded down to the nearest multiple of `4 \* parallelism`. \* `passes` {number} REQUIRED, number of passes (iterations). Must be greater than 1 and less than `2\*\*32-1`. \* `secret` {string|ArrayBuffer|Buffer|TypedArray|DataView|undefined} OPTIONAL, Random additional input, similar to the salt, that should \*\*NOT\*\* be stored with the derived key. This is known as pepper in password hashing applications. If used, must have a length not greater than `2\*\*32-1` bytes. \* `associatedData` {string|ArrayBuffer|Buffer|TypedArray|DataView|undefined} OPTIONAL, Additional data to be added to the hash, functionally equivalent to salt or secret, but meant for non-random data. If used, must have a length
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.08813535422086716, 0.09766731411218643, 0.03666507080197334, -0.010093714110553265, 0.05023584142327309, -0.02378748543560505, 0.017947470769286156, 0.0246209017932415, 0.05832361429929733, -0.04965582862496376, -0.030377790331840515, 0.01009784173220396, 0.04306989163160324, 0.0656198263168335, 0.020718280225992203, -0.02984721027314663, -0.08222772926092148, 0.005518872290849686, 0.042253777384757996, 0.0322059690952301, 0.004396677948534489, 0.05653173103928566, -0.002307236660271883, -0.06306132674217224, -0.03276555612683296, -0.04745784401893616, -0.0490865632891655, 0.06957057118415833, 0.019711485132575035, 0.0012562512420117855, 0.04109368473291397, 0.07439123839139938, -0.0039963615126907825, 0.06036265194416046, -0.03645756095647812, 0.013721070252358913, 0.03373299911618233, -0.015635021030902863, 0.01045637670904398, -0.024275900796055794, 0.10114815831184387, 0.0022354423999786377, -0.005792722571641207, 0.053135424852371216, 0.02214840054512024, 0.018443554639816284, -0.08668521046638489, -0.04301212355494499, -0.05671391263604164, -0.017093505710363388, 0.008215147070586681, -0.019368642941117287, -0.019443940371274948, 0.017772633582353592, -0.06119687482714653, -0.010693121701478958, -0.04972350597381592, 0.03763723745942116, 0.02137528546154499, 0.09625732898712158, 0.02682974375784397, 0.01120932586491108, 0.02685418538749218, -0.03704569488763809, 0.027469806373119354, -0.032493844628334045, -0.007184125483036041, -0.04235119745135307, -0.01365458033978939, 0.012528962455689907, 0.08643849939107895, -0.006726390216499567, -0.059203628450632095, 0.03299492970108986, -0.015269611962139606, -0.002430347492918372, -0.05308670923113823, -0.04966568201780319, -0.03835156187415123, 0.018393419682979584, -0.04891696944832802, -0.08788727223873138, -0.02497563511133194, 0.04137961193919182, -0.06764134764671326, 0.0735766813158989, -0.04481875151395798, -0.005409552250057459, -0.019621852785348892, 0.07071226835250854, -0.06988100707530975, -0.12318950891494751, 0.055379074066877365, 0.0069521511904895306, 0.12968048453330994, 0.05283990129828453, 0.04029643535614014, -0.006825820077210665, 0.018194790929555893, -0.028147635981440544, -0.026303142309188843, -0.00958236213773489, 0.00020754753495566547, -0.06828703731298447, 0.026631750166416168, 0.00822847243398428, 0.0028616199269890785, -0.06984347850084305, 0.012790199369192123, -0.02857968769967556, 0.02739756368100643, 0.06694123148918152, -0.05493903532624245, -0.08868039399385452, -0.07247558981180191, 0.05536229908466339, 0.003341530915349722, 0.019039567559957504, 0.09956269711256027, 0.07734190672636032, 0.04159584641456604, -0.043828513473272324, -0.055673811584711075, -0.0046831718645989895, -0.010959510691463947, -0.07714612036943436, 0.03468476980924606, 4.9737990843152804e-33, 0.00011605300824157894, 0.06907875835895538, 0.01996420882642269, -0.024997303262352943, -0.01059163548052311, -0.009382774122059345, 0.007012874819338322, 0.008498351089656353, -0.0384402796626091, 0.01808195374906063, -0.034086816012859344, 0.039250392466783524, -0.020012717694044113, 0.015685420483350754, -0.034175023436546326, -0.0054021873511374, 0.015760676935315132, 0.0037004684563726187, -0.03625192493200302, 0.006229714956134558, 0.04716530442237854, 0.0344911552965641, 0.0171953272074461, 0.04039367288351059, -0.00044797602458857, -0.004957191180437803, 0.04681389033794403, -0.0037120762281119823, 0.05082668736577034, -0.008627515286207199, -0.036467622965574265, -0.029842017218470573, 0.04613819718360901, 0.03264588862657547, 0.13162274658679962, 0.09582962095737457, 0.07052233815193176, 0.005225369706749916, -0.061231497675180435, 0.008204684592783451, 0.0326315201818943, 0.061565179377794266, -0.022883767262101173, 0.07763439416885376, -0.027295446023344994, -0.07638435810804367, 0.025309376418590546, -0.06357483565807343, 0.060477353632450104, -0.009459570981562138, -0.07108554244041443, 0.02851785160601139, -0.0052717262879014015, -0.06083985045552254, -0.006295039318501949, -0.08295286446809769, 0.047790996730327606, 0.036624614149332047, -0.18244734406471252, -0.023648405447602272, 0.030104104429483414, -0.013628114014863968, -0.016584284603595734, 0.0021343156695365906, 0.030049465596675873, 0.02626664936542511, 0.02326720766723156, -0.010420468635857105, -0.07411898672580719, 0.021095668897032738, -0.056535765528678894, 0.05309363082051277, -0.04131058230996132, -0.05637697875499725, 0.006776576396077871, 0.014656458981335163, -0.024642063304781914, 0.09748110920190811, -0.03810567781329155, -0.028608236461877823, -0.012991833500564098, 0.039784450083971024, 0.000008113192961900495, 0.06530610471963882, -0.02559855580329895, 0.09292009472846985, -0.019774675369262695, 0.008359384723007679, 0.00386328948661685, -0.03839848190546036, 0.10713107883930206, 0.032692618668079376, -0.05847344920039177, 0.03867475688457489, -0.08852972090244293, -6.134790406242313e-33, -0.10888805240392685, 0.012621685862541199, -0.03144991025328636, 0.04407527297735214, -0.039140138775110245, -0.1168130487203598, 0.02031651884317398, 0.047162819653749466, 0.008944348432123661, -0.0057753161527216434, 0.009426161646842957, -0.03600143641233444, 0.03303248807787895, -0.018945766612887383, -0.004186578560620546, -0.01349066011607647, -0.12582169473171234, 0.08443192392587662, -0.02024059370160103, -0.021144265308976173, 0.024018093943595886, 0.07697943598031998, -0.023781785741448402, 0.030616523697972298, -0.02778121829032898, 0.0012058803113177419, -0.007428369019180536, -0.0338318906724453, -0.001847036648541689, -0.01635306142270565, -0.03960086777806282, 0.0281254593282938, 0.04128919914364815, 0.089385986328125, -0.06539876013994217, -0.09636575728654861, 0.029164470732212067, 0.03124343231320381, 0.07738319784402847, 0.010655896738171577, -0.050985097885131836, 0.022012431174516678, -0.01314420998096466, 0.025787610560655594, 0.06610842049121857, -0.018503259867429733, 0.019252244383096695, 0.055668462067842484, 0.09582173079252243, 0.017892831936478615, 0.005624858662486076, -0.011221855878829956, -0.06229390949010849, -0.000007038445801299531, 0.004432742949575186, -0.05835028365254402, -0.0901183933019638, 0.0924445390701294, 0.02003009431064129, 0.013478800654411316, 0.03854960948228836, 0.0148392915725708, 0.0036250604316592216, 0.022105181589722633, 0.033937156200408936, 0.003639993956312537, -0.10173922032117844, -0.08544380217790604, 0.007672361098229885, -0.07698594778776169, -0.01822546124458313, -0.06503383815288544, -0.07432447373867035, -0.05423044040799141, -0.05630927160382271, -0.08806190639734268, 0.016969548538327217, -0.026538170874118805, -0.0291872750967741, 0.06736531853675842, 0.026287782937288284, 0.07049742341041565, -0.04605606943368912, 0.09744922071695328, 0.08087598532438278, 0.026356196030974388, -0.010831329971551895, 0.031016400083899498, -0.08257497847080231, 0.02790294587612152, 0.011733414605259895, 0.09584999084472656, -0.09872926771640778, 0.017726844176650047, -0.040196143090724945, -5.4995684450886984e-8, -0.0032321091275662184, 0.06591895967721939, -0.1828090399503708, -0.01387326605618, 0.03042476251721382, 0.019824571907520294, -0.015091911889612675, -0.06817905604839325, 0.06814024597406387, 0.03817912936210632, -0.01339984405785799, -0.0798826739192009, -0.036240119487047195, -0.11754187196493149, 0.028214795514941216, 0.0006730819004587829, -0.07949837297201157, 0.028282830491662025, 0.0034652501344680786, 0.049115560948848724, 0.0830954909324646, -0.07175234705209732, -0.07802680879831314, -0.002473983680829406, -0.04451044648885727, -0.005424160044640303, 0.006703115068376064, 0.13502100110054016, -0.024735907092690468, 0.023368194699287415, -0.06504520028829575, 0.022225890308618546, -0.021249132230877876, -0.015515022911131382, -0.06099369749426842, 0.09457987546920776, -0.017825894057750702, -0.026131559163331985, 0.09617409855127335, 0.10883113741874695, 0.04276430979371071, 0.00035637960536405444, -0.07638122141361237, 0.06133096665143967, -0.04279846325516701, 0.001366181531921029, 0.039978187531232834, 0.02155972272157669, 0.021605921909213066, 0.011612813919782639, 0.024881254881620407, -0.07700039446353912, 0.012519380077719688, -0.0235710758715868, -0.0812433511018753, 0.051969822496175766, 0.0026434699539095163, -0.02507387474179268, 0.006799831986427307, 0.003152885939925909, 0.11250131577253342, -0.05298797786235809, 0.11435654014348984, 0.01640946790575981 ]
0.051426
key. This is known as pepper in password hashing applications. If used, must have a length not greater than `2\*\*32-1` bytes. \* `associatedData` {string|ArrayBuffer|Buffer|TypedArray|DataView|undefined} OPTIONAL, Additional data to be added to the hash, functionally equivalent to salt or secret, but meant for non-random data. If used, must have a length not greater than `2\*\*32-1` bytes. \* `callback` {Function} \* `err` {Error} \* `derivedKey` {Buffer} Provides an asynchronous [Argon2][] implementation. Argon2 is a password-based key derivation function that is designed to be expensive computationally and memory-wise in order to make brute-force attacks unrewarding. The `nonce` should be as unique as possible. It is recommended that a nonce is random and at least 16 bytes long. See [NIST SP 800-132][] for details. When passing strings for `message`, `nonce`, `secret` or `associatedData`, please consider [caveats when using strings as inputs to cryptographic APIs][]. The `callback` function is called with two arguments: `err` and `derivedKey`. `err` is an exception object when key derivation fails, otherwise `err` is `null`. `derivedKey` is passed to the callback as a [`Buffer`][]. An exception is thrown when any of the input arguments specify invalid values or types. ```mjs const { argon2, randomBytes } = await import('node:crypto'); const parameters = { message: 'password', nonce: randomBytes(16), parallelism: 4, tagLength: 64, memory: 65536, passes: 3, }; argon2('argon2id', parameters, (err, derivedKey) => { if (err) throw err; console.log(derivedKey.toString('hex')); // 'af91dad...9520f15' }); ``` ```cjs const { argon2, randomBytes } = require('node:crypto'); const parameters = { message: 'password', nonce: randomBytes(16), parallelism: 4, tagLength: 64, memory: 65536, passes: 3, }; argon2('argon2id', parameters, (err, derivedKey) => { if (err) throw err; console.log(derivedKey.toString('hex')); // 'af91dad...9520f15' }); ``` ### `crypto.argon2Sync(algorithm, parameters)` > Stability: 1.2 - Release candidate \* `algorithm` {string} Variant of Argon2, one of `"argon2d"`, `"argon2i"` or `"argon2id"`. \* `parameters` {Object} \* `message` {string|ArrayBuffer|Buffer|TypedArray|DataView} REQUIRED, this is the password for password hashing applications of Argon2. \* `nonce` {string|ArrayBuffer|Buffer|TypedArray|DataView} REQUIRED, must be at least 8 bytes long. This is the salt for password hashing applications of Argon2. \* `parallelism` {number} REQUIRED, degree of parallelism determines how many computational chains (lanes) can be run. Must be greater than 1 and less than `2\*\*24-1`. \* `tagLength` {number} REQUIRED, the length of the key to generate. Must be greater than 4 and less than `2\*\*32-1`. \* `memory` {number} REQUIRED, memory cost in 1KiB blocks. Must be greater than `8 \* parallelism` and less than `2\*\*32-1`. The actual number of blocks is rounded down to the nearest multiple of `4 \* parallelism`. \* `passes` {number} REQUIRED, number of passes (iterations). Must be greater than 1 and less than `2\*\*32-1`. \* `secret` {string|ArrayBuffer|Buffer|TypedArray|DataView|undefined} OPTIONAL, Random additional input, similar to the salt, that should \*\*NOT\*\* be stored with the derived key. This is known as pepper in password hashing applications. If used, must have a length not greater than `2\*\*32-1` bytes. \* `associatedData` {string|ArrayBuffer|Buffer|TypedArray|DataView|undefined} OPTIONAL, Additional data to be added to the hash, functionally equivalent to salt or secret, but meant for non-random data. If used, must have a length not greater than `2\*\*32-1` bytes. \* Returns: {Buffer} Provides a synchronous [Argon2][] implementation. Argon2 is a password-based key derivation function that is designed to be expensive computationally and memory-wise in order to make brute-force attacks unrewarding. The `nonce` should be as unique as possible. It is recommended that a nonce is random and at least 16 bytes long. See [NIST SP 800-132][] for details. When passing strings for `message`, `nonce`, `secret` or `associatedData`, please consider [caveats when using strings as inputs to cryptographic APIs][]. An exception is thrown when key derivation fails, otherwise the derived key is returned as a [`Buffer`][]. An exception is thrown
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.04384404420852661, -0.0033914956729859114, -0.1146145761013031, -0.0026888297870755196, -0.08043937385082245, -0.08720680326223373, 0.10345442593097687, 0.016335126012563705, 0.09299137443304062, -0.0802266001701355, 0.03567582741379738, 0.010077299550175667, 0.0928478091955185, -0.06298761814832687, -0.06376368552446365, -0.010926824063062668, -0.01961553655564785, -0.06655185669660568, -0.0869014784693718, -0.08716879785060883, 0.04592656344175339, -0.008793424814939499, 0.006117973942309618, -0.03888637199997902, -0.017594821751117706, 0.0301180649548769, 0.031381744891405106, -0.0036336753983050585, 0.01619546487927437, -0.05131247267127037, 0.06159168854355812, 0.037400368601083755, -0.009029616601765156, 0.0429074652493, -0.0729421004652977, 0.040881384164094925, -0.06004176661372185, 0.0021847127936780453, 0.01711481623351574, -0.036764711141586304, -0.03714778646826744, 0.08145224303007126, -0.06681977212429047, 0.08873888105154037, -0.03527837246656418, 0.030276836827397346, -0.04459625855088234, -0.01912495493888855, -0.0286161620169878, -0.024134719744324684, -0.04225267469882965, 0.0934007465839386, -0.004152333829551935, 0.05408614128828049, 0.06451497226953506, -0.04109874740242958, -0.11462467908859253, 0.02415390871465206, -0.007924860343337059, 0.04694262146949768, 0.020016148686408997, -0.025873692706227303, 0.04268047213554382, 0.043185893446207047, -0.00622528325766325, -0.011450103484094143, 0.008271127939224243, -0.05984944477677345, 0.04781675711274147, -0.045521948486566544, -0.03711925446987152, 0.006921887863427401, -0.09814965724945068, 0.06277185678482056, 0.02659791335463524, 0.020674580708146095, 0.005140672437846661, -0.08055652678012848, -0.01911780796945095, -0.04765283316373825, -0.08373001962900162, -0.04146047681570053, 0.02268974296748638, 0.07256617397069931, 0.07783874124288559, 0.061126865446567535, -0.013289705850183964, -0.013148285448551178, -0.03958270326256752, 0.011745212599635124, -0.02508031204342842, -0.012606538832187653, -0.005341255106031895, 0.07827229052782059, 0.03070426546037197, 0.029368869960308075, 0.037963591516017914, -0.07606706023216248, -0.15346257388591766, 0.07898757606744766, -0.020215224474668503, 0.08000542968511581, 0.02009984850883484, -0.06640277057886124, 0.08562648296356201, -0.023752711713314056, 0.048134565353393555, -0.05596964806318283, -0.057064492255449295, 0.04645165055990219, 0.050779424607753754, 0.08600940555334091, -0.0352071076631546, -0.005899015814065933, -0.02302636206150055, 0.015779053792357445, 0.0008080655825324357, -0.01553958561271429, -0.0016688324976712465, 0.05828145891427994, 0.03527357429265976, -0.025753460824489594, -0.1226327195763588, 0.011686116456985474, -0.0760592520236969, -0.04296816885471344, -0.05243474617600441, 5.4441555163815564e-33, -0.045977529138326645, 0.00263567129150033, -0.037436749786138535, -0.006553001701831818, -0.03217863291501999, 0.04887926205992699, 0.024314098060131073, -0.014024616219103336, -0.003404572606086731, 0.028026830404996872, -0.06915818154811859, -0.05780082568526268, 0.02371242083609104, -0.024426700547337532, 0.07239048182964325, 0.03019743598997593, 0.04977225139737129, 0.021768035367131233, 0.04414347559213638, -0.05148409679532051, 0.006450491491705179, 0.04257732257246971, -0.0004577726358547807, -0.061823002994060516, -0.01335902139544487, -0.0008541444549337029, 0.014810958877205849, -0.11861373484134674, 0.06683886796236038, 0.028115317225456238, -0.021932289004325867, 0.013567299582064152, 0.011252891272306442, 0.029811428859829903, 0.11637536436319351, -0.05808652192354202, 0.007530380040407181, -0.04248569533228874, -0.07406068593263626, -0.0163753442466259, -0.036269571632146835, -0.02007545903325081, -0.004524605348706245, -0.026982074603438377, -0.015520647168159485, -0.10215750336647034, -0.014610783196985722, 0.05354086682200432, -0.019925568252801895, 0.07394188642501831, 0.014253108762204647, 0.05432083085179329, 0.012056817300617695, 0.04901904985308647, 0.014126220718026161, -0.06167393922805786, 0.048336755484342575, -0.021526696160435677, -0.01831328310072422, 0.1166185587644577, -0.05316572263836861, 0.015231900848448277, 0.013168579898774624, 0.07608148455619812, -0.012524132616817951, -0.012227177619934082, -0.03181679919362068, -0.05065014213323593, 0.026367465034127235, 0.06033140420913696, -0.036698684096336365, -0.011055916547775269, -0.01554877683520317, 0.06780367344617844, -0.09068939834833145, -0.02845265530049801, -0.019036488607525826, -0.026014728471636772, 0.09023679047822952, -0.003809780115261674, 0.07767485082149506, -0.036687109619379044, -0.00538472319021821, 0.05379960313439369, -0.07648666203022003, 0.023996852338314056, -0.03380229324102402, -0.10978114604949951, -0.055477503687143326, -0.03269517049193382, -0.013756483793258667, -0.007902263663709164, -0.010973553173244, -0.13450099527835846, -0.014106834307312965, -7.871348210712079e-33, 0.029624298214912415, -0.025292864069342613, -0.024638652801513672, 0.04342375695705414, 0.03832519054412842, -0.003496974939480424, 0.029811391606926918, -0.023574640974402428, -0.06812562793493271, -0.08973567932844162, -0.039232272654771805, 0.044698361307382584, 0.0940789058804512, -0.04807793349027634, 0.1028049886226654, 0.049087073653936386, -0.02292083390057087, 0.026678962633013725, -0.026879195123910904, -0.005334901157766581, -0.02002505026757717, 0.06294669955968857, -0.03961767256259918, 0.0725909098982811, -0.06904635578393936, 0.0357595831155777, -0.0020939738024026155, 0.019245339557528496, -0.007218895945698023, -0.013757270760834217, -0.015021348372101784, 0.0781337097287178, -0.07823185622692108, -0.039551280438899994, -0.037863634526729584, -0.09188263863325119, 0.11981553584337234, 0.012599159963428974, -0.07429694384336472, 0.0010203387355431914, 0.05848811939358711, 0.05492902547121048, 0.11020483821630478, 0.005799945909529924, -0.03641866520047188, -0.010302693583071232, -0.02430073916912079, 0.0210262518376112, -0.0006602719658985734, -0.005690577439963818, 0.06966612488031387, -0.08028465509414673, 0.02461802400648594, 0.05339619517326355, 0.029914364218711853, 0.02377905137836933, -0.06717410683631897, 0.025474639609456062, 0.06859839707612991, 0.026062380522489548, -0.00855760183185339, -0.0802561491727829, 0.057891879230737686, 0.03221972659230232, -0.019762463867664337, -0.0398566909134388, -0.03308622166514397, -0.01142708957195282, -0.02126905508339405, 0.0443958155810833, 0.08548880368471146, 0.0012741629034280777, 0.011896409094333649, 0.01599106378853321, -0.038395293056964874, -0.042842283844947815, -0.026774799451231956, -0.09194833040237427, 0.010026022791862488, 0.03131573274731636, 0.00026420431095175445, 0.07231325656175613, 0.006115473806858063, 0.10648761689662933, 0.07804884761571884, -0.07126782834529877, 0.0037527449894696474, 0.024677136912941933, 0.012324847280979156, -0.005592589732259512, 0.009951365180313587, 0.08539249747991562, -0.10315623134374619, 0.03944319114089012, 0.05411461368203163, -6.364579974160733e-8, 0.015392825938761234, -0.02468620240688324, -0.04217943549156189, 0.000758829468395561, 0.03263107314705849, -0.015078060328960419, -0.06775815039873123, -0.10979834944009781, 0.01517261378467083, -0.0757087916135788, 0.08852488547563553, 0.02206377126276493, -0.020714301615953445, -0.07464005798101425, -0.009414390660822392, 0.04455389827489853, -0.024942591786384583, -0.08832406252622604, 0.004333740100264549, -0.06820076704025269, -0.010342433117330074, -0.014650453813374043, -0.0940370038151741, -0.052813783288002014, -0.008244809694588184, 0.013927367515861988, 0.0696263313293457, 0.10669810324907303, 0.013947345316410065, -0.07082308083772659, 0.06648725271224976, 0.004293450620025396, 0.11527396738529205, -0.05636889114975929, -0.02790524624288082, 0.090420201420784, 0.06248427927494049, -0.044808436185121536, -0.01329847238957882, -0.00881805457174778, -0.028868230059742928, 0.00946008414030075, -0.0034060643520206213, 0.026073530316352844, -0.07005992531776428, 0.010544995777308941, -0.012758993543684483, 0.044778820127248764, -0.018472163006663322, 0.030376143753528595, -0.006807995960116386, 0.02221125178039074, 0.01928161084651947, 0.053187839686870575, -0.03429747745394707, 0.039161715656518936, 0.006333774887025356, -0.04513826593756676, 0.03817766532301903, 0.015191311948001385, 0.09904387593269348, 0.025007033720612526, -0.050358157604932785, 0.0036382656544446945 ]
0.164722
16 bytes long. See [NIST SP 800-132][] for details. When passing strings for `message`, `nonce`, `secret` or `associatedData`, please consider [caveats when using strings as inputs to cryptographic APIs][]. An exception is thrown when key derivation fails, otherwise the derived key is returned as a [`Buffer`][]. An exception is thrown when any of the input arguments specify invalid values or types. ```mjs const { argon2Sync, randomBytes } = await import('node:crypto'); const parameters = { message: 'password', nonce: randomBytes(16), parallelism: 4, tagLength: 64, memory: 65536, passes: 3, }; const derivedKey = argon2Sync('argon2id', parameters); console.log(derivedKey.toString('hex')); // 'af91dad...9520f15' ``` ```cjs const { argon2Sync, randomBytes } = require('node:crypto'); const parameters = { message: 'password', nonce: randomBytes(16), parallelism: 4, tagLength: 64, memory: 65536, passes: 3, }; const derivedKey = argon2Sync('argon2id', parameters); console.log(derivedKey.toString('hex')); // 'af91dad...9520f15' ``` ### `crypto.checkPrime(candidate[, options], callback)` \* `candidate` {ArrayBuffer|SharedArrayBuffer|TypedArray|Buffer|DataView|bigint} A possible prime encoded as a sequence of big endian octets of arbitrary length. \* `options` {Object} \* `checks` {number} The number of Miller-Rabin probabilistic primality iterations to perform. When the value is `0` (zero), a number of checks is used that yields a false positive rate of at most 2-64 for random input. Care must be used when selecting a number of checks. Refer to the OpenSSL documentation for the [`BN\_is\_prime\_ex`][] function `nchecks` options for more details. \*\*Default:\*\* `0` \* `callback` {Function} \* `err` {Error} Set to an {Error} object if an error occurred during check. \* `result` {boolean} `true` if the candidate is a prime with an error probability less than `0.25 \*\* options.checks`. Checks the primality of the `candidate`. ### `crypto.checkPrimeSync(candidate[, options])` \* `candidate` {ArrayBuffer|SharedArrayBuffer|TypedArray|Buffer|DataView|bigint} A possible prime encoded as a sequence of big endian octets of arbitrary length. \* `options` {Object} \* `checks` {number} The number of Miller-Rabin probabilistic primality iterations to perform. When the value is `0` (zero), a number of checks is used that yields a false positive rate of at most 2-64 for random input. Care must be used when selecting a number of checks. Refer to the OpenSSL documentation for the [`BN\_is\_prime\_ex`][] function `nchecks` options for more details. \*\*Default:\*\* `0` \* Returns: {boolean} `true` if the candidate is a prime with an error probability less than `0.25 \*\* options.checks`. Checks the primality of the `candidate`. ### `crypto.constants` \* Type: {Object} An object containing commonly used constants for crypto and security related operations. The specific constants currently defined are described in [Crypto constants][]. ### `crypto.createCipheriv(algorithm, key, iv[, options])` \* `algorithm` {string} \* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey} \* `iv` {string|ArrayBuffer|Buffer|TypedArray|DataView|null} \* `options` {Object} [`stream.transform` options][] \* Returns: {Cipheriv} Creates and returns a `Cipheriv` object, with the given `algorithm`, `key` and initialization vector (`iv`). The `options` argument controls stream behavior and is optional except when a cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the `authTagLength` option is required and specifies the length of the authentication tag in bytes, see [CCM mode][]. In GCM mode, the `authTagLength` option is not required but can be used to set the length of the authentication tag that will be returned by `getAuthTag()` and defaults to 16 bytes. For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On recent OpenSSL releases, `openssl list -cipher-algorithms` will display the available cipher algorithms. The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector][]. Both arguments must be `'utf8'` encoded strings, [Buffers][`Buffer`], `TypedArray`, or `DataView`s. The `key` may optionally be a [`KeyObject`][] of type `secret`. If the cipher does not need an initialization vector, `iv` may be `null`. When passing strings for `key` or `iv`, please consider
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.041191961616277695, 0.06429271399974823, -0.1153685450553894, 0.0321529246866703, -0.03604783117771149, -0.11456838995218277, 0.06084678694605827, -0.008009303361177444, 0.03692671284079552, -0.03886103630065918, -0.022000249475240707, -0.028664331883192062, 0.05203934386372566, -0.04419482499361038, -0.0025921149645000696, 0.04148548096418381, -0.07455082982778549, -0.0014230433152988553, 0.009973534382879734, -0.06710885465145111, 0.05744222179055214, -0.06493496894836426, 0.0060770632699131966, -0.07204800844192505, -0.018946610391139984, -0.04384564608335495, 0.103752501308918, 0.07866904139518738, -0.002609821269288659, -0.04398321360349655, 0.11330689489841461, 0.03378647565841675, -0.046822965145111084, -0.005874048452824354, -0.07490525394678116, 0.062483251094818115, -0.048807352781295776, -0.002247770084068179, 0.045921389013528824, -0.020476825535297394, -0.006304718088358641, 0.05225567892193794, -0.0010614930652081966, 0.05076710879802704, 0.024202626198530197, 0.03297265246510506, -0.06360438466072083, 0.07616174221038818, 0.0005177534185349941, -0.012201402336359024, -0.038692034780979156, -0.02827652357518673, -0.030393069609999657, -0.015476103872060776, -0.0412931814789772, 0.010773291811347008, -0.11454556882381439, -0.014710243791341782, 0.0406477116048336, -0.0785723552107811, 0.0478234589099884, -0.008006616495549679, 0.03984862193465233, 0.03859836235642433, -0.008942162618041039, 0.04977128654718399, 0.01874544285237789, -0.007850144989788532, 0.010363744571805, 0.04802252724766731, 0.014613679610192776, 0.054497890174388885, -0.047954168170690536, 0.03441344201564789, -0.002589977579191327, 0.010766146704554558, -0.07568424195051193, -0.06573203206062317, 0.0020269008819013834, -0.015732215717434883, -0.035625554621219635, 0.011569485068321228, 0.05645303055644035, 0.06369837373495102, 0.06439509242773056, 0.1476592719554901, 0.016162874177098274, 0.010981380939483643, -0.021391985937952995, -0.0009504565387032926, 0.016733933240175247, -0.08036371320486069, 0.014465339481830597, 0.050253771245479584, 0.04517148807644844, 0.0691237598657608, 0.07026149332523346, -0.04971075430512428, -0.154633566737175, 0.08072677254676819, -0.010959128849208355, 0.02629733458161354, -0.0000572232820559293, -0.1165238693356514, 0.09523323178291321, 0.0949782133102417, 0.05899948254227638, -0.00441482849419117, 0.01322720292955637, 0.04452555999159813, -0.0426199771463871, 0.10523038357496262, -0.044610049575567245, 0.00876460038125515, -0.019067084416747093, 0.12467476725578308, 0.04561038315296173, -0.02943357825279236, 0.029711026698350906, 0.1036948561668396, 0.05878894776105881, 0.03517170622944832, -0.05424711853265762, 0.0469166524708271, -0.06331094354391098, -0.07106953859329224, -0.0006455754046328366, 8.135603014196775e-33, -0.06352502852678299, 0.013890164904296398, 0.02143833041191101, 0.0123191699385643, 0.0020476782228797674, 0.025158625096082687, 0.061833471059799194, -0.050057198852300644, -0.06435944139957428, 0.037279605865478516, -0.1787027269601822, -0.04559486731886864, 0.008085577748715878, -0.07231473177671432, 0.06518206745386124, -0.03288479149341583, 0.0422755666077137, -0.005034281872212887, 0.07883809506893158, -0.002145916922017932, -0.000516793632414192, 0.02760692685842514, -0.015868332237005234, -0.013863679021596909, 0.023484233766794205, -0.0023893413599580526, 0.009979992173612118, -0.020127106457948685, 0.049162108451128006, 0.012346751056611538, -0.013096986338496208, 0.03001832403242588, -0.03843425214290619, 0.02257085219025612, 0.027631646022200584, -0.06861495971679688, 0.04242834448814392, -0.006414464209228754, -0.037191178649663925, -0.07042538374662399, 0.02047630399465561, -0.007840866222977638, 0.007626039441674948, -0.05744212493300438, -0.028586626052856445, -0.08114654570817947, 0.017696037888526917, -0.04729604721069336, 0.07401382923126221, 0.06365115195512772, -0.0746784508228302, 0.05508369952440262, -0.03390752896666527, -0.0400686040520668, 0.02203195169568062, -0.15222330391407013, 0.00991494208574295, 0.055715713649988174, 0.003515036078169942, 0.06247970834374428, 0.018158363178372383, -0.002457190537825227, 0.05231817811727524, 0.04046248644590378, -0.10128455609083176, -0.0019177317153662443, -0.0779111385345459, -0.0630260482430458, -0.034436535090208054, 0.028913337737321854, -0.001569186570122838, 0.003971673548221588, 0.0026155828963965178, 0.024852847680449486, -0.041259925812482834, -0.017284659668803215, -0.05686182528734207, -0.0060820807702839375, 0.029863839969038963, -0.04520334303379059, 0.044050272554159164, -0.0026465163100510836, -0.03032507933676243, 0.05471957102417946, 0.040727440267801285, 0.05606482923030853, -0.012525924481451511, -0.09415818750858307, -0.01839541085064411, 0.05602648854255676, -0.025696702301502228, 0.001205930020660162, -0.018038004636764526, -0.11809530109167099, -0.013742134906351566, -8.015227249884788e-33, -0.08233487606048584, 0.03819896653294563, -0.007840841077268124, 0.012609920464456081, -0.016024542972445488, 0.006846148520708084, -0.020125074312090874, 0.023309901356697083, -0.04944957047700882, -0.0169050432741642, -0.002692431677132845, 0.015258979983627796, 0.08899280428886414, -0.02194468304514885, 0.10118643194437027, -0.0477825328707695, -0.0036481409333646297, 0.06350908428430557, 0.05321725830435753, -0.01689131185412407, -0.03437602147459984, 0.06290669739246368, -0.08683386445045471, -0.013365947641432285, -0.03634743392467499, 0.09355321526527405, -0.02774094231426716, 0.08168058097362518, 0.030170748010277748, 0.009125396609306335, -0.07057908177375793, 0.031151624396443367, -0.0668119266629219, 0.07959810644388199, -0.036921434104442596, -0.16150856018066406, 0.07441987097263336, 0.05219634994864464, -0.02472735196352005, -0.037802040576934814, 0.0690215528011322, -0.01142142340540886, 0.04235208034515381, 0.024570170789957047, 0.009021596051752567, -0.008098423480987549, 0.004581508692353964, 0.023713117465376854, -0.028116779401898384, -0.040995996445417404, -0.002088257111608982, -0.08282025903463364, -0.009228779934346676, 0.032459523528814316, -0.021048497408628464, 0.014244931749999523, -0.05847327783703804, 0.028162015601992607, 0.0762886106967926, -0.001313030137680471, -0.028071554377675056, -0.06224042549729347, 0.05362121760845184, 0.012619963847100735, 0.07749377191066742, -0.005893856752663851, -0.08051308244466782, 0.06561644375324249, -0.09180344641208649, 0.11173886060714722, 0.04148377478122711, 0.026901522651314735, -0.046703945845365524, 0.012680061161518097, 0.06293214857578278, -0.06543714553117752, 0.025944925844669342, -0.09144192934036255, 0.01650093123316765, -0.03528771921992302, -0.0014480495592579246, 0.032249584794044495, -0.004776334390044212, 0.04055206850171089, 0.028729621320962906, -0.034643445163965225, 0.06467436999082565, 0.017018143087625504, -0.01368536427617073, 0.011578037403523922, -0.004229292273521423, 0.11729633063077927, -0.058511603623628616, 0.004845937713980675, 0.08674437552690506, -5.704194450117939e-8, -0.019005365669727325, -0.013389235362410545, -0.05093536153435707, 0.01633002981543541, 0.01817638985812664, -0.002435623900964856, -0.04565807059407234, -0.11046931147575378, -0.03209003433585167, -0.06160460785031319, 0.03075573407113552, -0.038046300411224365, 0.04497369006276131, -0.03321606665849686, -0.019376913085579872, 0.060565877705812454, -0.08882603049278259, -0.054756853729486465, -0.011656936258077621, -0.10049813240766525, 0.009943541139364243, 0.019253313541412354, -0.01627960614860058, -0.013962037861347198, 0.019280504435300827, 0.02808162197470665, 0.08122863620519638, 0.026721764355897903, 0.02569294162094593, 0.00019381524180062115, -0.06778372079133987, -0.040284544229507446, 0.06770510226488113, -0.029220568016171455, -0.07538241893053055, 0.036086954176425934, -0.05995430052280426, -0.02626653015613556, 0.05429274961352348, -0.004462047014385462, 0.024034645408391953, 0.04922781512141228, -0.02061179094016552, 0.02295675501227379, -0.018391011282801628, -0.007802628446370363, 0.06929349154233932, -0.033244360238313675, 0.04022190719842911, -0.037058424204587936, -0.021650206297636032, -0.021660493686795235, 0.02906237728893757, -0.012205458246171474, -0.03413519263267517, -0.027866492047905922, -0.05697524547576904, -0.02601320669054985, 0.008023444563150406, 0.03445981442928314, 0.09347941726446152, 0.014782228507101536, -0.043310873210430145, -0.0026764553040266037 ]
0.140741
`algorithm` and `iv` is an [initialization vector][]. Both arguments must be `'utf8'` encoded strings, [Buffers][`Buffer`], `TypedArray`, or `DataView`s. The `key` may optionally be a [`KeyObject`][] of type `secret`. If the cipher does not need an initialization vector, `iv` may be `null`. When passing strings for `key` or `iv`, please consider [caveats when using strings as inputs to cryptographic APIs][]. Initialization vectors should be unpredictable and unique; ideally, they will be cryptographically random. They do not have to be secret: IVs are typically just added to ciphertext messages unencrypted. It may sound contradictory that something has to be unpredictable and unique, but does not have to be secret; remember that an attacker must not be able to predict ahead of time what a given IV will be. ### `crypto.createDecipheriv(algorithm, key, iv[, options])` \* `algorithm` {string} \* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey} \* `iv` {string|ArrayBuffer|Buffer|TypedArray|DataView|null} \* `options` {Object} [`stream.transform` options][] \* Returns: {Decipheriv} Creates and returns a `Decipheriv` object that uses the given `algorithm`, `key` and initialization vector (`iv`). The `options` argument controls stream behavior and is optional except when a cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the `authTagLength` option is required and specifies the length of the authentication tag in bytes, see [CCM mode][]. For AES-GCM and `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes and must be set to a different value if a different length is used. The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On recent OpenSSL releases, `openssl list -cipher-algorithms` will display the available cipher algorithms. The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector][]. Both arguments must be `'utf8'` encoded strings, [Buffers][`Buffer`], `TypedArray`, or `DataView`s. The `key` may optionally be a [`KeyObject`][] of type `secret`. If the cipher does not need an initialization vector, `iv` may be `null`. When passing strings for `key` or `iv`, please consider [caveats when using strings as inputs to cryptographic APIs][]. Initialization vectors should be unpredictable and unique; ideally, they will be cryptographically random. They do not have to be secret: IVs are typically just added to ciphertext messages unencrypted. It may sound contradictory that something has to be unpredictable and unique, but does not have to be secret; remember that an attacker must not be able to predict ahead of time what a given IV will be. ### `crypto.createDiffieHellman(prime[, primeEncoding][, generator][, generatorEncoding])` \* `prime` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `primeEncoding` {string} The [encoding][] of the `prime` string. \* `generator` {number|string|ArrayBuffer|Buffer|TypedArray|DataView} \*\*Default:\*\* `2` \* `generatorEncoding` {string} The [encoding][] of the `generator` string. \* Returns: {DiffieHellman} Creates a `DiffieHellman` key exchange object using the supplied `prime` and an optional specific `generator`. The `generator` argument can be a number, string, or [`Buffer`][]. If `generator` is not specified, the value `2` is used. If `primeEncoding` is specified, `prime` is expected to be a string; otherwise a [`Buffer`][], `TypedArray`, or `DataView` is expected. If `generatorEncoding` is specified, `generator` is expected to be a string; otherwise a number, [`Buffer`][], `TypedArray`, or `DataView` is expected. ### `crypto.createDiffieHellman(primeLength[, generator])` \* `primeLength` {number} \* `generator` {number} \*\*Default:\*\* `2` \* Returns: {DiffieHellman} Creates a `DiffieHellman` key exchange object and generates a prime of `primeLength` bits using an optional specific numeric `generator`. If `generator` is not specified, the value `2` is used. ### `crypto.createDiffieHellmanGroup(name)` \* `name` {string} \* Returns: {DiffieHellmanGroup} An alias for [`crypto.getDiffieHellman()`][] ### `crypto.createECDH(curveName)` \* `curveName` {string} \* Returns: {ECDH} Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a predefined curve specified by the `curveName` string. Use [`crypto.getCurves()`][] to obtain a list of available curve names. On recent OpenSSL releases, `openssl ecparam -list\_curves` will also display the
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.04422266036272049, 0.055153604596853256, -0.0946456640958786, -0.00516415573656559, -0.12720680236816406, -0.04889630526304245, 0.03848864510655403, 0.03250495344400406, -0.04829861596226692, -0.09908678382635117, -0.0244718287140131, -0.027005918323993683, 0.08567458391189575, 0.0358428992331028, -0.021058816462755203, -0.018730059266090393, -0.012221477925777435, -0.020089661702513695, -0.008002213202416897, -0.026652269065380096, 0.0650537982583046, -0.007152139209210873, -0.04878409951925278, -0.032157160341739655, 0.005280338227748871, 0.03137257695198059, 0.09691116213798523, 0.03448937460780144, 0.016637522727251053, 0.04448528587818146, 0.04365788772702217, -0.06476958096027374, 0.04524454101920128, 0.02814934030175209, -0.1111837849020958, 0.045011915266513824, -0.020444026216864586, -0.07441090792417526, -0.0241371002048254, 0.009066068567335606, -0.012143896892666817, 0.023884860798716545, -0.09305520355701447, 0.017225166782736778, -0.002459063194692135, 0.05048608034849167, -0.06573127210140228, 0.032223764806985855, -0.02824949100613594, -0.014837645925581455, -0.03500489145517349, 0.00045085581950843334, -0.02708975411951542, 0.04825839027762413, -0.026378678157925606, -0.058757420629262924, -0.08989176154136658, 0.01201716810464859, 0.029268668964505196, 0.006589232943952084, 0.006760964635759592, 0.04362066835165024, 0.11228717118501663, 0.08939876407384872, 0.01047519501298666, -0.008463437668979168, 0.04111243784427643, -0.01923740655183792, 0.038871340453624725, -0.03345971181988716, -0.04153547063469887, 0.043131113052368164, -0.02601783536374569, 0.078831247985363, -0.03484954312443733, 0.03446832671761513, 0.020474886521697044, -0.04307178780436516, -0.039926230907440186, -0.01363354828208685, -0.0054081641137599945, -0.09711690992116928, -0.014101958833634853, 0.07548519223928452, 0.0032517905347049236, 0.045132122933864594, -0.006358652375638485, 0.026815857738256454, -0.02267284132540226, 0.09723104536533356, 0.056454285979270935, -0.02264244481921196, 0.012554691173136234, 0.043821416795253754, 0.19303244352340698, 0.06553104519844055, -0.012914299964904785, -0.0632743164896965, -0.08311914652585983, 0.025163181126117706, -0.04329293966293335, -0.10043452680110931, 0.01027628406882286, 0.04157968983054161, 0.050417013466358185, 0.07634268701076508, 0.03712387755513191, -0.1414063721895218, -0.07626313716173172, 0.02562868967652321, 0.029884425923228264, 0.06301097571849823, -0.0008203662000596523, 0.03427420184016228, 0.014902486465871334, 0.11566569656133652, -0.03767329454421997, 0.04069209843873978, 0.01829342357814312, 0.11397822201251984, 0.010589957237243652, 0.014319156296551228, -0.04044989123940468, 0.02663392946124077, -0.0919884741306305, -0.0236380435526371, -0.014067166484892368, 2.1573688026878128e-33, -0.056681837886571884, -0.032284948974847794, -0.0010975045152008533, 0.02673421986401081, -0.037877339869737625, -0.004114726558327675, 0.051462139934301376, 0.05053866654634476, -0.03525570034980774, -0.024534033611416817, -0.10052066296339035, -0.008592880330979824, 0.020105348899960518, 0.02531910501420498, 0.08414720743894577, 0.03902127221226692, 0.10543425381183624, -0.01320407260209322, 0.010422149673104286, 0.0009895834373310208, 0.13177303969860077, -0.005424082279205322, 0.012942549772560596, -0.05722638964653015, -0.017269546166062355, 0.026597613468766212, 0.013319043442606926, -0.12125343829393387, -0.043550796806812286, 0.007149946875870228, -0.08042768388986588, -0.09164228290319443, -0.05125044658780098, 0.0267123244702816, 0.017242617905139923, 0.00764838419854641, 0.06115170940756798, -0.01927560567855835, -0.09410552680492401, -0.07404493540525436, 0.029887598007917404, -0.0513736754655838, -0.014978736639022827, -0.0065887924283742905, 0.01765434816479683, -0.03078961931169033, -0.09360948204994202, 0.004207792226225138, 0.015547390095889568, 0.06036270782351494, -0.06840504705905914, 0.012871496379375458, -0.06752334535121918, -0.07283084839582443, -0.0035741094034165144, -0.05984202027320862, 0.0029403744265437126, 0.008877655491232872, -0.019118381664156914, -0.0034248128067702055, -0.10874452441930771, 0.01014006044715643, -0.008492856286466122, 0.014561817049980164, -0.03172320872545242, 0.06174739450216293, 0.04346953704953194, -0.10951196402311325, 0.015311411581933498, -0.026639707386493683, -0.06193112954497337, 0.016928531229496002, -0.03708333149552345, 0.04007692262530327, -0.04040273278951645, 0.04345882683992386, -0.04061039537191391, -0.07075053453445435, -0.001488654175773263, -0.06721828132867813, 0.061795674264431, 0.04340885207056999, 0.0009698920184746385, 0.07485758513212204, -0.021197117865085602, 0.028440387919545174, -0.008414394222199917, -0.040094513446092606, -0.012078988365828991, -0.0027530123479664326, -0.020580826327204704, -0.02545301988720894, -0.0055862837471067905, -0.07469704002141953, -0.017935732379555702, -6.215283116598839e-33, 0.04159216210246086, -0.026171071454882622, -0.0153154656291008, 0.03171759843826294, 0.01174931600689888, -0.007327234838157892, -0.012509494088590145, 0.0494227334856987, 0.010890055447816849, -0.07557999342679977, -0.08863084763288498, 0.04628466069698334, 0.10239293426275253, -0.01913500390946865, 0.07106250524520874, 0.010942532680928707, -0.10145967453718185, 0.04635278880596161, 0.05730827897787094, -0.01564190350472927, -0.08706437796354294, 0.02953966148197651, -0.018312254920601845, 0.008289095014333725, 0.07701391726732254, 0.01249770075082779, 0.01928628236055374, 0.06762684881687164, 0.019355695694684982, 0.040456678718328476, -0.035091474652290344, 0.03499344363808632, -0.011925052851438522, 0.04009998217225075, -0.03022167831659317, 0.012775136157870293, 0.04175257310271263, -0.06732839345932007, 0.01632120832800865, 0.03777778148651123, 0.05085601657629013, -0.029527300968766212, -0.0024184698704630136, 0.011899146251380444, -0.03234957158565521, -0.006922207307070494, -0.007793438155204058, 0.1221131980419159, 0.06914044171571732, -0.03507131710648537, 0.05444664508104324, -0.01669406332075596, -0.0361192412674427, 0.02840871550142765, 0.023596981540322304, 0.0009403264266438782, -0.028452109545469284, 0.045650664716959, 0.03968500345945358, -0.008845432661473751, -0.023680640384554863, -0.027964632958173752, 0.019225146621465683, -0.017796043306589127, -0.02291395328938961, -0.05479222163558006, -0.09336193650960922, -0.04659922048449516, -0.026235753670334816, -0.06775202602148056, 0.08010250329971313, -0.034658584743738174, 0.024939706549048424, 0.016277270391583443, 0.008548135869204998, -0.09103450179100037, -0.012699400074779987, -0.08175230026245117, 0.04676453024148941, 0.04473968222737312, 0.020987534895539284, 0.043227631598711014, 0.02136252634227276, 0.07973194122314453, 0.08745818585157394, -0.01565541885793209, 0.041920747607946396, -0.028668535873293877, -0.05456659197807312, 0.017141351476311684, 0.010583732277154922, 0.10648498684167862, -0.12339369207620621, 0.005833966191858053, 0.053630318492650986, -5.679963521743048e-8, 0.03968551754951477, 0.04015183448791504, -0.05884137377142906, 0.08128244429826736, 0.007090685423463583, -0.0367690809071064, -0.06919095665216446, -0.13616159558296204, 0.04554551839828491, -0.05487941950559616, 0.021797673776745796, -0.02554732747375965, 0.018345516175031662, -0.025382516905665398, -0.029789621010422707, 0.04750719293951988, -0.0610634908080101, -0.07386946678161621, 0.0004946273984387517, -0.07000549137592316, 0.05020485445857048, -0.06789981573820114, -0.07462029904127121, -0.06091785430908203, 0.048996806144714355, -0.012040148489177227, 0.007338690105825663, -0.007753891404718161, 0.008943397551774979, 0.13337141275405884, -0.02242645062506199, -0.006816368084400892, 0.09226872771978378, 0.005523765459656715, -0.07137890160083771, 0.038945287466049194, -0.03557610139250755, -0.022348640486598015, 0.036774441599845886, -0.03695909306406975, 0.04560977965593338, 0.014138584025204182, -0.03632429987192154, -0.0391748808324337, -0.03199540823698044, -0.004914142657071352, 0.04386679455637932, 0.0040311808697879314, 0.0024836063385009766, 0.02897239290177822, -0.03713833913207054, -0.007031963672488928, 0.03338483348488808, 0.0068328180350363255, 0.014280348084867, 0.041181549429893494, -0.049891043454408646, -0.10344571620225906, 0.05723484978079796, 0.015194387175142765, 0.03941509500145912, 0.04772511124610901, 0.047677524387836456, -0.0904761329293251 ]
0.067045
alias for [`crypto.getDiffieHellman()`][] ### `crypto.createECDH(curveName)` \* `curveName` {string} \* Returns: {ECDH} Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a predefined curve specified by the `curveName` string. Use [`crypto.getCurves()`][] to obtain a list of available curve names. On recent OpenSSL releases, `openssl ecparam -list\_curves` will also display the name and description of each available elliptic curve. ### `crypto.createHash(algorithm[, options])` \* `algorithm` {string} \* `options` {Object} [`stream.transform` options][] \* Returns: {Hash} Creates and returns a `Hash` object that can be used to generate hash digests using the given `algorithm`. Optional `options` argument controls stream behavior. For XOF hash functions such as `'shake256'`, the `outputLength` option can be used to specify the desired output length in bytes. The `algorithm` is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. On recent releases of OpenSSL, `openssl list -digest-algorithms` will display the available digest algorithms. Example: generating the sha256 sum of a file ```mjs import { createReadStream, } from 'node:fs'; import { argv } from 'node:process'; const { createHash, } = await import('node:crypto'); const filename = argv[2]; const hash = createHash('sha256'); const input = createReadStream(filename); input.on('readable', () => { // Only one element is going to be produced by the // hash stream. const data = input.read(); if (data) hash.update(data); else { console.log(`${hash.digest('hex')} ${filename}`); } }); ``` ```cjs const { createReadStream, } = require('node:fs'); const { createHash, } = require('node:crypto'); const { argv } = require('node:process'); const filename = argv[2]; const hash = createHash('sha256'); const input = createReadStream(filename); input.on('readable', () => { // Only one element is going to be produced by the // hash stream. const data = input.read(); if (data) hash.update(data); else { console.log(`${hash.digest('hex')} ${filename}`); } }); ``` ### `crypto.createHmac(algorithm, key[, options])` \* `algorithm` {string} \* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey} \* `options` {Object} [`stream.transform` options][] \* `encoding` {string} The string encoding to use when `key` is a string. \* Returns: {Hmac} Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. Optional `options` argument controls stream behavior. The `algorithm` is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. On recent releases of OpenSSL, `openssl list -digest-algorithms` will display the available digest algorithms. The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is a [`KeyObject`][], its type must be `secret`. If it is a string, please consider [caveats when using strings as inputs to cryptographic APIs][]. If it was obtained from a cryptographically secure source of entropy, such as [`crypto.randomBytes()`][] or [`crypto.generateKey()`][], its length should not exceed the block size of `algorithm` (e.g., 512 bits for SHA-256). Example: generating the sha256 HMAC of a file ```mjs import { createReadStream, } from 'node:fs'; import { argv } from 'node:process'; const { createHmac, } = await import('node:crypto'); const filename = argv[2]; const hmac = createHmac('sha256', 'a secret'); const input = createReadStream(filename); input.on('readable', () => { // Only one element is going to be produced by the // hash stream. const data = input.read(); if (data) hmac.update(data); else { console.log(`${hmac.digest('hex')} ${filename}`); } }); ``` ```cjs const { createReadStream, } = require('node:fs'); const { createHmac, } = require('node:crypto'); const { argv } = require('node:process'); const filename = argv[2]; const hmac = createHmac('sha256', 'a secret'); const input = createReadStream(filename); input.on('readable', () => { // Only one element is going to be produced by the // hash stream. const data = input.read(); if (data) hmac.update(data); else { console.log(`${hmac.digest('hex')} ${filename}`); } }); ``` ### `crypto.createPrivateKey(key)` \* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView} \* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|Object} The key material, either in PEM, DER, or JWK
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.0050738961435854435, 0.03862663358449936, -0.04013849049806595, -0.0017009193543344736, -0.0008806550758890808, -0.07916615158319473, -0.022035812959074974, 0.06530316919088364, 0.021979155018925667, -0.0949728935956955, -0.0011125258170068264, -0.055156730115413666, -0.019322233274579048, -0.04458115994930267, 0.027055779471993446, 0.006319097243249416, -0.05999470502138138, 0.0285736583173275, -0.0044415914453566074, -0.11707168817520142, 0.10917335003614426, 0.007476409897208214, 0.0071373204700648785, 0.009741241112351418, -0.046199094504117966, 0.01962398923933506, 0.02862054854631424, 0.07846696674823761, -0.04902876913547516, -0.06757410615682602, 0.11550632864236832, -0.03453914448618889, 0.016172701492905617, 0.022082151845097542, 0.02635635994374752, 0.08558216691017151, -0.018514879047870636, 0.03084937483072281, 0.0515158474445343, -0.05166308209300041, 0.03559301793575287, -0.04674879088997841, -0.02577401138842106, -0.04660356044769287, -0.041724517941474915, 0.02255222760140896, -0.0282807108014822, 0.01521624531596899, -0.0629470944404602, 0.043396465480327606, 0.05846723914146423, -0.0668494775891304, 0.002359379781410098, 0.08071315288543701, 0.011275463737547398, 0.0036387962754815817, -0.09591525048017502, -0.03634270653128624, -0.05261069908738136, -0.012015490792691708, -0.11434745788574219, 0.04344389587640762, 0.035810019820928574, 0.0316927433013916, -0.06431844085454941, 0.01941550523042679, 0.11620522290468216, -0.0709533542394638, -0.008635909296572208, 0.010957231745123863, -0.04773053154349327, 0.00877382606267929, 0.03304999694228172, 0.02912077121436596, -0.03293810039758682, 0.0305850300937891, -0.028244968503713608, 0.020025379955768585, -0.125992551445961, -0.032359614968299866, -0.026920422911643982, 0.016731364652514458, -0.033898983150720596, 0.05060034990310669, 0.0024180810432881117, 0.023590583354234695, -0.01867261715233326, -0.006440227851271629, 0.05892462655901909, 0.04008543863892555, -0.08166343718767166, -0.05061335861682892, -0.06718599051237106, -0.02930954098701477, 0.059057239443063736, 0.06883576512336731, 0.06825859844684601, 0.02657124772667885, -0.05513383448123932, 0.020260117948055267, -0.004595075733959675, 0.05060847848653793, 0.049936190247535706, -0.1085018590092659, 0.06215806305408478, 0.019569993019104004, -0.037261683493852615, 0.013300164602696896, -0.017142705619335175, 0.03975062444806099, 0.008903988637030125, -0.04161672294139862, 0.003022615797817707, -0.10547018051147461, 0.06062427908182144, 0.014493064023554325, -0.06418503075838089, -0.012465400621294975, -0.015676436945796013, 0.044598814100027084, 0.07408842444419861, 0.02584901824593544, 0.028440294787287712, 0.04390506073832512, -0.06637052446603775, 0.05846055597066879, -0.07840442657470703, 2.629197174086509e-33, -0.009172108955681324, -0.008171510882675648, 0.05811246111989021, -0.006707045249640942, -0.03318687155842781, 0.034245360642671585, 0.00903507973998785, 0.07691346108913422, -0.032829709351062775, 0.014420068822801113, -0.04463381692767143, -0.03453332558274269, 0.04518925026059151, -0.06747853755950928, -0.004590582102537155, -0.05487951636314392, 0.01703922264277935, 0.031518757343292236, -0.004631099756807089, 0.008911451324820518, 0.015055384486913681, 0.0019461868796497583, -0.006573139224201441, -0.0280406903475523, -0.010660558938980103, 0.052836593240499496, 0.0005359445349313319, -0.05949759483337402, 0.010239810682833195, 0.007006322965025902, 0.030002262443304062, 0.0049444157630205154, -0.007648772560060024, -0.05089610069990158, 0.04215453565120697, -0.00750937033444643, -0.011836274527013302, 0.0021349755115807056, -0.05742118880152702, -0.03355942294001579, 0.0672052651643753, -0.027168722823262215, 0.01248209923505783, -0.020876392722129822, -0.04010387137532234, -0.003779996419325471, -0.052818652242422104, 0.025094179436564445, 0.13702383637428284, -0.03258981928229332, 0.017615221440792084, -0.0314050167798996, 0.010553333908319473, -0.05063244327902794, 0.05130472779273987, -0.05899263545870781, -0.05204731598496437, 0.0033054198138415813, -0.04628196731209755, 0.01974945329129696, -0.017635999247431755, 0.04375290498137474, -0.06544536352157593, -0.038076214492321014, 0.01892509125173092, -0.009330973029136658, 0.08278387039899826, 0.03125812113285065, -0.033305659890174866, 0.06362856924533844, -0.1031368300318718, 0.03183082491159439, -0.02541014365851879, 0.03273332864046097, 0.037547387182712555, -0.02073860913515091, -0.03349332883954048, -0.006324546877294779, 0.08972372114658356, 0.017934449017047882, 0.0071313343942165375, 0.039874084293842316, 0.04635988920927048, 0.0033138154540210962, 0.01012399047613144, 0.025657949969172478, 0.022779053077101707, -0.04803748056292534, -0.06762700527906418, -0.09471151232719421, -0.09013411402702332, 0.01026437059044838, -0.07314730435609818, 0.015582317486405373, -0.048914145678281784, -5.4756841115805333e-33, 0.0798889547586441, -0.025142492726445198, -0.0029049147851765156, 0.0821937546133995, 0.029955336824059486, 0.00835504662245512, -0.005373338237404823, 0.047722719609737396, 0.03475688770413399, -0.02303355187177658, 0.014441266655921936, -0.03253208473324776, 0.03384760767221451, -0.07193899154663086, 0.15172190964221954, -0.013457010500133038, -0.13711826503276825, -0.026642082259058952, 0.04764143005013466, 0.027583947405219078, -0.036381758749485016, 0.01151919737458229, -0.054062746465206146, -0.050859589129686356, 0.068899966776371, 0.00492319418117404, 0.053486939519643784, -0.021123258396983147, 0.06046411022543907, 0.02884114719927311, -0.07320349663496017, 0.08376631140708923, -0.04799169674515724, -0.014843977056443691, -0.09118101745843887, -0.006758437491953373, 0.0042438507080078125, 0.015389719046652317, 0.037179406732320786, 0.07570595294237137, 0.019808227196335793, 0.0371728241443634, 0.07166923582553864, -0.04642137140035629, -0.03862590715289116, 0.038241203874349594, -0.014831993728876114, 0.13323473930358887, 0.011229049414396286, 0.0010732037480920553, 0.03669136017560959, -0.02988908626139164, -0.1243903785943985, -0.011929367668926716, 0.04110250249505043, 0.040525972843170166, -0.09079132229089737, 0.0016645720461383462, -0.024992167949676514, -0.0916103795170784, -0.0505610927939415, 0.02119353786110878, 0.016021789982914925, 0.061513736844062805, -0.0649033635854721, -0.01650419272482395, -0.11425334960222244, -0.13156935572624207, -0.0438697375357151, -0.0264322180300951, -0.034348953515291214, -0.1036929041147232, -0.043226778507232666, -0.07122800499200821, 0.06830121576786041, -0.024815073236823082, -0.022482024505734444, 0.0016412304248660803, 0.021390926092863083, 0.03702673316001892, 0.08550947159528732, 0.10852925479412079, -0.027320804074406624, 0.06646862626075745, 0.06801379472017288, -0.060676924884319305, 0.019347043707966805, 0.10963031649589539, -0.030298322439193726, 0.0213269405066967, 0.022974612191319466, 0.09851176291704178, -0.02943979576230049, 0.1166631355881691, -0.00967340636998415, -5.43837295197136e-8, -0.029722273349761963, -0.01332970429211855, 0.006142015103250742, 0.016354404389858246, 0.0580156184732914, 0.05891793593764305, 0.011035173200070858, -0.010209918953478336, -0.015717260539531708, -0.04619354382157326, 0.0827832743525505, 0.01707567647099495, -0.051011260598897934, -0.018050944432616234, -0.023667147383093834, -0.008762497454881668, -0.07134537398815155, 0.08699051290750504, -0.02576206438243389, -0.006562419235706329, -0.012494830414652824, -0.06569381803274155, -0.04019179195165634, -0.04420890659093857, 0.0382467545568943, -0.002187801292166114, 0.009143506176769733, -0.01715712994337082, -0.07849598675966263, 0.04241035878658295, 0.04704086482524872, -0.008544791489839554, 0.04495249316096306, -0.020573316141963005, 0.007447360549122095, 0.053663380444049835, -0.14167171716690063, -0.003130671801045537, 0.09360867738723755, 0.12153282016515732, -0.015064503997564316, 0.008419864811003208, -0.015348420478403568, -0.006409532856196165, -0.005523172672837973, -0.008258502930402756, 0.010723989456892014, 0.06320846080780029, -0.04569330811500549, 0.04410916566848755, -0.06429337710142136, -0.019138680770993233, 0.07713597267866135, -0.0625971257686615, -0.03418462350964546, 0.055201172828674316, 0.025384288281202316, -0.11834067106246948, 0.030389586463570595, -0.026405148208141327, 0.0557427778840065, -0.053602349013090134, 0.09045585989952087, 0.054119136184453964 ]
0.044265
createReadStream(filename); input.on('readable', () => { // Only one element is going to be produced by the // hash stream. const data = input.read(); if (data) hmac.update(data); else { console.log(`${hmac.digest('hex')} ${filename}`); } }); ``` ### `crypto.createPrivateKey(key)` \* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView} \* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|Object} The key material, either in PEM, DER, or JWK format. \* `format` {string} Must be `'pem'`, `'der'`, or '`'jwk'`. \*\*Default:\*\* `'pem'`. \* `type` {string} Must be `'pkcs1'`, `'pkcs8'` or `'sec1'`. This option is required only if the `format` is `'der'` and ignored otherwise. \* `passphrase` {string | Buffer} The passphrase to use for decryption. \* `encoding` {string} The string encoding to use when `key` is a string. \* Returns: {KeyObject} Creates and returns a new key object containing a private key. If `key` is a string or `Buffer`, `format` is assumed to be `'pem'`; otherwise, `key` must be an object with the properties described above. If the private key is encrypted, a `passphrase` must be specified. The length of the passphrase is limited to 1024 bytes. ### `crypto.createPublicKey(key)` \* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView} \* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|Object} The key material, either in PEM, DER, or JWK format. \* `format` {string} Must be `'pem'`, `'der'`, or `'jwk'`. \*\*Default:\*\* `'pem'`. \* `type` {string} Must be `'pkcs1'` or `'spki'`. This option is required only if the `format` is `'der'` and ignored otherwise. \* `encoding` {string} The string encoding to use when `key` is a string. \* Returns: {KeyObject} Creates and returns a new key object containing a public key. If `key` is a string or `Buffer`, `format` is assumed to be `'pem'`; if `key` is a `KeyObject` with type `'private'`, the public key is derived from the given private key; otherwise, `key` must be an object with the properties described above. If the format is `'pem'`, the `'key'` may also be an X.509 certificate. Because public keys can be derived from private keys, a private key may be passed instead of a public key. In that case, this function behaves as if [`crypto.createPrivateKey()`][] had been called, except that the type of the returned `KeyObject` will be `'public'` and that the private key cannot be extracted from the returned `KeyObject`. Similarly, if a `KeyObject` with type `'private'` is given, a new `KeyObject` with type `'public'` will be returned and it will be impossible to extract the private key from the returned object. ### `crypto.createSecretKey(key[, encoding])` \* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `encoding` {string} The string encoding when `key` is a string. \* Returns: {KeyObject} Creates and returns a new key object containing a secret key for symmetric encryption or `Hmac`. ### `crypto.createSign(algorithm[, options])` \* `algorithm` {string} \* `options` {Object} [`stream.Writable` options][] \* Returns: {Sign} Creates and returns a `Sign` object that uses the given `algorithm`. Use [`crypto.getHashes()`][] to obtain the names of the available digest algorithms. Optional `options` argument controls the `stream.Writable` behavior. In some cases, a `Sign` instance can be created using the name of a signature algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use the corresponding digest algorithm. This does not work for all signature algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest algorithm names. ### `crypto.createVerify(algorithm[, options])` \* `algorithm` {string} \* `options` {Object} [`stream.Writable` options][] \* Returns: {Verify} Creates and returns a `Verify` object that uses the given algorithm. Use [`crypto.getHashes()`][] to obtain an array of names of the available signing algorithms. Optional `options` argument controls the `stream.Writable` behavior. In some cases, a `Verify` instance can be created using the name of a signature algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use the corresponding digest algorithm. This does not work for all signature
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ 0.028467465192079544, 0.046591296792030334, -0.040069177746772766, -0.03687932714819908, -0.05507680028676987, -0.045520029962062836, 0.0691319927573204, 0.05691007152199745, 0.025727253407239914, 0.011844452470541, -0.0069123730063438416, 0.019194144755601883, 0.0637800469994545, -0.03814643621444702, 0.0038347821682691574, -0.011023870669305325, -0.16161216795444489, -0.018628709018230438, -0.04034432768821716, -0.007562846876680851, 0.04569750651717186, -0.10426430404186249, 0.04504154995083809, -0.043957244604825974, -0.08002744615077972, 0.07870975881814957, 0.11805323511362076, 0.05517614632844925, -0.02560998499393463, -0.024817312136292458, 0.04499741643667221, -0.06474936008453369, 0.020813997834920883, 0.0038292023818939924, -0.07684990018606186, 0.08009389787912369, 0.0371672660112381, -0.041326578706502914, -0.03934353590011597, -0.03526170924305916, 0.0621308870613575, 0.02873864211142063, -0.12274742126464844, -0.014466403052210808, -0.006760326214134693, 0.010507483966648579, -0.010073904879391193, -0.04910913109779358, -0.04519081488251686, 0.014254039153456688, -0.061730753630399704, -0.04872503876686096, -0.02445239946246147, 0.013249007053673267, -0.08589880168437958, -0.015230937860906124, -0.0839378759264946, 0.049895256757736206, 0.07417910546064377, -0.09175854921340942, -0.027264239266514778, -0.036553818732500076, 0.03887545317411423, 0.01950203627347946, 0.06487336754798889, 0.04389030858874321, -0.020845305174589157, -0.01996876671910286, 0.007104513701051474, -0.03959226235747337, -0.03069254383444786, -0.03340614587068558, 0.04718657210469246, -0.021437032148241997, -0.06401834636926651, -0.05251747742295265, -0.04482119530439377, -0.021980484947562218, 0.002816232852637768, 0.02191907912492752, -0.010005212388932705, -0.10157902538776398, -0.03578627109527588, 0.05525553226470947, -0.004394799470901489, 0.08740834891796112, -0.03429470211267471, -0.007894146256148815, -0.09888681024312973, 0.008215729147195816, -0.03891881927847862, 0.011801163665950298, 0.024691686034202576, 0.060463983565568924, 0.05609682574868202, 0.08737441897392273, 0.0332145094871521, 0.042958322912454605, -0.004347460810095072, 0.01358491275459528, -0.016698412597179413, 0.050125233829021454, -0.040509115904569626, -0.036809854209423065, 0.07624290138483047, -0.011491972953081131, 0.02761819213628769, -0.020464278757572174, -0.01966833882033825, -0.00901743769645691, -0.003563877195119858, 0.07091743499040604, -0.07017078250646591, -0.02836272120475769, -0.07498433440923691, 0.06300666928291321, -0.0052551687695086, 0.026447532698512077, -0.02685205079615116, 0.03878325596451759, 0.10032221674919128, -0.034995414316654205, -0.07573562115430832, 0.025652015581727028, -0.052945367991924286, -0.06777574121952057, 0.04205366596579552, 4.05113556859762e-33, -0.03151087462902069, -0.05972333624958992, 0.04429120197892189, -0.011187047697603703, 0.008561529219150543, -0.032749976962804794, 0.08660256862640381, 0.014407912269234657, -0.054103199392557144, -0.0333394929766655, -0.08193057030439377, -0.03110077604651451, -0.010105118155479431, -0.045069873332977295, -0.027149956673383713, -0.031182659789919853, -0.0018737359205260873, 0.0006174748414196074, 0.0368117094039917, 0.04719874635338783, 0.05284979194402695, 0.01015470176935196, 0.025793353095650673, -0.05872109904885292, -0.02318006195127964, 0.029517969116568565, 0.006466435734182596, -0.018698958680033684, 0.04027833789587021, -0.038365527987480164, 0.0808379203081131, 0.0157829187810421, -0.026194775477051735, -0.007949878461658955, -0.0035673363599926233, -0.04762719199061394, 0.0011882535181939602, 0.04711061716079712, -0.06788590550422668, -0.06092992424964905, 0.10506117343902588, -0.08884503692388535, 0.037220969796180725, 0.006440687458962202, -0.024849874898791313, 0.0050707305781543255, -0.08597125113010406, 0.01800820603966713, -0.0002006359864026308, 0.02049839124083519, -0.04301218315958977, 0.059174396097660065, -0.049838338047266006, -0.0385957807302475, 0.009700172580778599, -0.070743627846241, -0.02863779477775097, -0.015780124813318253, -0.02021072991192341, -0.008929823525249958, -0.01828010566532612, 0.12139669805765152, 0.049179788678884506, 0.03877998888492584, -0.017318161204457283, -0.03373008221387863, 0.0335102342069149, 0.009209579788148403, -0.027727732434868813, 0.021885614842176437, -0.06807705760002136, 0.02258419245481491, 0.014376492239534855, 0.0026148189790546894, 0.02327904850244522, -0.010012741200625896, -0.12370383739471436, 0.00755789689719677, -0.019715450704097748, -0.031772587448358536, 0.08882194757461548, 0.01867581717669964, -0.0027837585657835007, 0.08955011516809464, 0.03212630748748779, 0.11142957210540771, -0.025111082941293716, -0.02247621864080429, -0.016884487122297287, 0.019944138824939728, -0.010072634555399418, -0.0030073425732553005, -0.027960943058133125, -0.18148715794086456, -0.02199619822204113, -5.984361659483616e-33, 0.09962332248687744, -0.07309781759977341, -0.017050782218575478, 0.07760847359895706, 0.02455698698759079, 0.03273007646203041, -0.001758304424583912, 0.08623243868350983, 0.01790505461394787, -0.0036670418921858072, -0.0229572132229805, 0.024569692090153694, 0.07616099715232849, -0.056820210069417953, 0.0008598122512921691, 0.04250411316752434, -0.1312115490436554, 0.028900159522891045, 0.023087507113814354, -0.08495403081178665, -0.030409852042794228, -0.00010853079584194347, 0.059946209192276, 0.13353271782398224, -0.01432414073497057, -0.019069073721766472, 0.021430009976029396, 0.08309612423181534, -0.020259615033864975, 0.015547516755759716, -0.0952000766992569, 0.08142806589603424, -0.04935380071401596, -0.008648506365716457, -0.012804213911294937, -0.08729162067174911, 0.042901478707790375, 0.06766828149557114, 0.02760857343673706, 0.09764725714921951, 0.01411970891058445, -0.054735757410526276, 0.004763571545481682, -0.049898240715265274, 0.03936149552464485, -0.027851568534970284, 0.024482106789946556, 0.09746706485748291, -0.03234558925032616, 0.010400009341537952, 0.05703405663371086, -0.02283717878162861, -0.05370626598596573, -0.01816435530781746, 0.09945861250162125, 0.053278129547834396, 0.011518357321619987, -0.056284550577402115, 0.006330554373562336, 0.0021607540547847748, -0.041885603219270706, -0.08305704593658447, 0.08563306927680969, 0.035351842641830444, 0.017962083220481873, -0.023212723433971405, -0.037042148411273956, -0.03305325284600258, 0.009503180161118507, 0.033816151320934296, 0.014754402451217175, 0.0014377529732882977, 0.024797357618808746, -0.0060310629196465015, 0.11376917362213135, -0.00954396277666092, -0.05833739787340164, -0.08834484964609146, 0.07332974672317505, 0.06570927798748016, 0.044325217604637146, 0.04404449462890625, 0.0074575007893145084, 0.09760234504938126, 0.12563133239746094, 0.016526740044355392, 0.020543808117508888, -0.004711184184998274, -0.08702018857002258, 0.001052189152687788, -0.03237684816122055, 0.04639187455177307, -0.03534471243619919, -0.03486388921737671, 0.029278166592121124, -5.1122675870374223e-8, -0.018897663801908493, -0.03517720848321915, -0.07306065410375595, 0.02889050543308258, 0.02268008515238762, 0.008682060986757278, -0.08104913681745529, -0.0913427546620369, 0.024946682155132294, -0.1257125437259674, 0.08269532024860382, -0.008180039003491402, 0.00302676297724247, -0.006224864162504673, -0.062007155269384384, 0.0198287982493639, -0.02429344691336155, 0.023042740300297737, 0.0043335710652172565, -0.0464605987071991, 0.011692946776747704, -0.011309773661196232, -0.017938781529664993, 0.02922739088535309, 0.16243544220924377, 0.04990724101662636, 0.08911147713661194, 0.00805317610502243, -0.006662143860012293, -0.03315874561667442, -0.01614229753613472, -0.06873661279678345, 0.10721249133348465, -0.008666081354022026, -0.03844068571925163, -0.0076766228303313255, 0.02631060592830181, 0.015898436307907104, -0.00819149799644947, 0.018528616055846214, 0.04036645591259003, -0.02323039062321186, -0.06764861941337585, 0.0074838814325630665, -0.036176733672618866, 0.0015216707251966, -0.012714928016066551, 0.09893841296434402, -0.03847401589155197, 0.019422883167862892, 0.022762462496757507, 0.027425536885857582, 0.07829435914754868, -0.05215030908584595, -0.05217187479138374, -0.006942017003893852, 0.025291994214057922, -0.06558521836996078, 0.013199377804994583, 0.0013526190305128694, 0.07325855642557144, 0.003831336973235011, 0.02263561077415943, -0.020303498953580856 ]
-0.031127
of the available signing algorithms. Optional `options` argument controls the `stream.Writable` behavior. In some cases, a `Verify` instance can be created using the name of a signature algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use the corresponding digest algorithm. This does not work for all signature algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest algorithm names. ### `crypto.decapsulate(key, ciphertext[, callback])` > Stability: 1.2 - Release candidate \* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject} Private Key \* `ciphertext` {ArrayBuffer|Buffer|TypedArray|DataView} \* `callback` {Function} \* `err` {Error} \* `sharedKey` {Buffer} \* Returns: {Buffer} if the `callback` function is not provided. Key decapsulation using a KEM algorithm with a private key. Supported key types and their KEM algorithms are: \* `'rsa'`[^openssl30] RSA Secret Value Encapsulation \* `'ec'`[^openssl32] DHKEM(P-256, HKDF-SHA256), DHKEM(P-384, HKDF-SHA256), DHKEM(P-521, HKDF-SHA256) \* `'x25519'`[^openssl32] DHKEM(X25519, HKDF-SHA256) \* `'x448'`[^openssl32] DHKEM(X448, HKDF-SHA512) \* `'ml-kem-512'`[^openssl35] ML-KEM \* `'ml-kem-768'`[^openssl35] ML-KEM \* `'ml-kem-1024'`[^openssl35] ML-KEM If `key` is not a [`KeyObject`][], this function behaves as if `key` had been passed to [`crypto.createPrivateKey()`][]. If the `callback` function is provided this function uses libuv's threadpool. ### `crypto.diffieHellman(options[, callback])` \* `options` {Object} \* `privateKey` {KeyObject} \* `publicKey` {KeyObject} \* `callback` {Function} \* `err` {Error} \* `secret` {Buffer} \* Returns: {Buffer} if the `callback` function is not provided. Computes the Diffie-Hellman shared secret based on a `privateKey` and a `publicKey`. Both keys must have the same `asymmetricKeyType` and must support either the DH or ECDH operation. If the `callback` function is provided this function uses libuv's threadpool. ### `crypto.encapsulate(key[, callback])` > Stability: 1.2 - Release candidate \* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject} Public Key \* `callback` {Function} \* `err` {Error} \* `result` {Object} \* `sharedKey` {Buffer} \* `ciphertext` {Buffer} \* Returns: {Object} if the `callback` function is not provided. \* `sharedKey` {Buffer} \* `ciphertext` {Buffer} Key encapsulation using a KEM algorithm with a public key. Supported key types and their KEM algorithms are: \* `'rsa'`[^openssl30] RSA Secret Value Encapsulation \* `'ec'`[^openssl32] DHKEM(P-256, HKDF-SHA256), DHKEM(P-384, HKDF-SHA256), DHKEM(P-521, HKDF-SHA256) \* `'x25519'`[^openssl32] DHKEM(X25519, HKDF-SHA256) \* `'x448'`[^openssl32] DHKEM(X448, HKDF-SHA512) \* `'ml-kem-512'`[^openssl35] ML-KEM \* `'ml-kem-768'`[^openssl35] ML-KEM \* `'ml-kem-1024'`[^openssl35] ML-KEM If `key` is not a [`KeyObject`][], this function behaves as if `key` had been passed to [`crypto.createPublicKey()`][]. If the `callback` function is provided this function uses libuv's threadpool. ### `crypto.fips` > Stability: 0 - Deprecated Property for checking and controlling whether a FIPS compliant crypto provider is currently in use. Setting to true requires a FIPS build of Node.js. This property is deprecated. Please use `crypto.setFips()` and `crypto.getFips()` instead. ### `crypto.generateKey(type, options, callback)` \* `type` {string} The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. \* `options` {Object} \* `length` {number} The bit length of the key to generate. This must be a value greater than 0. \* If `type` is `'hmac'`, the minimum is 8, and the maximum length is 231-1. If the value is not a multiple of 8, the generated key will be truncated to `Math.floor(length / 8)`. \* If `type` is `'aes'`, the length must be one of `128`, `192`, or `256`. \* `callback` {Function} \* `err` {Error} \* `key` {KeyObject} Asynchronously generates a new random secret key of the given `length`. The `type` will determine which validations will be performed on the `length`. ```mjs const { generateKey, } = await import('node:crypto'); generateKey('hmac', { length: 512 }, (err, key) => { if (err) throw err; console.log(key.export().toString('hex')); // 46e..........620 }); ``` ```cjs const { generateKey, } = require('node:crypto'); generateKey('hmac', { length: 512 }, (err, key) => { if (err) throw err; console.log(key.export().toString('hex')); // 46e..........620 }); ``` The size of a generated HMAC key should not exceed the block size
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.03888976201415062, 0.013145742937922478, -0.054198067635297775, -0.07522782683372498, -0.05982128158211708, -0.12920154631137848, -0.007105483207851648, 0.00544235622510314, -0.006218448746949434, -0.03839610517024994, -0.015651414170861244, -0.017626658082008362, 0.02111128345131874, 0.00046393476077355444, 0.006149942055344582, -0.07363595813512802, 0.012611493468284607, 0.03392478823661804, -0.045708928257226944, -0.03487661853432655, 0.015129524283111095, -0.04099675267934799, -0.032000258564949036, -0.012155333533883095, -0.04183758422732353, 0.052261531352996826, 0.07558222115039825, 0.03242888301610947, 0.010918762534856796, -0.03547222912311554, 0.07844885438680649, -0.054303307086229324, -0.018517913296818733, 0.09774968773126602, -0.08842378854751587, 0.1009935587644577, 0.03475458174943924, -0.049432847648859024, 0.0008764150552451611, -0.01822708733379841, -0.029333777725696564, 0.025309007614850998, -0.11390732228755951, -0.0505271814763546, -0.037185221910476685, 0.00027128742658533156, -0.06803718954324722, 0.013687143102288246, -0.0798453837633133, -0.03657551854848862, 0.004799379035830498, 0.007998940534889698, -0.06471481919288635, 0.054219286888837814, -0.05127610266208649, -0.062459152191877365, -0.06514666229486465, -0.009327936917543411, -0.014090723358094692, -0.022058669477701187, 0.041403185576200485, -0.014523712918162346, 0.0583856962621212, 0.06850896030664444, 0.014940615743398666, 0.07796197384595871, 0.06696350127458572, -0.07298389822244644, 0.08158612996339798, 0.019835619255900383, -0.04577719420194626, -0.026274126023054123, 0.05125979706645012, -0.019380807876586914, -0.08339840173721313, 0.04034655913710594, -0.02696346864104271, -0.022415878251194954, -0.05195648968219757, -0.05220461264252663, -0.009553872980177402, -0.02905070036649704, -0.04806969687342644, 0.07051493227481842, 0.010699908249080181, 0.054951850324869156, -0.022969909012317657, -0.012511510401964188, -0.004085376393049955, 0.08496461808681488, 0.052584562450647354, 0.027116095647215843, 0.02780073881149292, -0.032901402562856674, 0.03946569934487343, -0.026479922235012054, 0.05703136697411537, 0.027768375352025032, -0.006670320872217417, -0.011535575613379478, -0.09827812016010284, 0.030289508402347565, -0.026800718158483505, -0.11642622202634811, 0.1445619761943817, 0.028933431953191757, 0.012090462259948254, -0.11565303057432175, -0.01746704988181591, -0.00279297330416739, -0.05433019995689392, 0.06811873614788055, -0.03656255081295967, 0.0233936607837677, 0.026726190000772476, 0.04720349982380867, -0.04984704777598381, 0.01537242066115141, 0.004477452486753464, 0.06192130222916603, 0.03610420599579811, -0.003792022354900837, -0.007187645882368088, -0.04764115437865257, -0.06480277329683304, 0.009543275460600853, -0.041300833225250244, 4.0904657728662106e-33, -0.010604927316308022, -0.019023586064577103, -0.00010896696767304093, -0.011540714651346207, 0.029164765030145645, 0.0255160890519619, 0.018210312351584435, 0.05423635616898537, -0.05624579265713692, -0.019464045763015747, -0.03391366824507713, -0.04979098588228226, 0.009540388360619545, -0.03339589759707451, 0.07883121073246002, 0.04777386412024498, -0.006943714804947376, -0.0003096480795647949, -0.0434076152741909, 0.06050395593047142, 0.0952962189912796, 0.014551118016242981, 0.016026338562369347, -0.04504727944731712, -0.01171704102307558, 0.022623233497142792, 0.03221312537789345, -0.014670481905341148, -0.02073971927165985, 0.010747123509645462, -0.04874955862760544, -0.03692096844315529, -0.005526325665414333, 0.014891289174556732, 0.06737913936376572, -0.03284905105829239, -0.01130741834640503, 0.0028341577854007483, -0.06093784049153328, -0.07103364914655685, 0.04864161089062691, -0.012573854066431522, -0.07086125016212463, -0.023293789476156235, -0.02047838270664215, -0.03404057398438454, -0.049460407346487045, 0.034754905849695206, 0.114105723798275, 0.007434362079948187, 0.012057477608323097, 0.018153386190533638, -0.05405985563993454, -0.10382038354873657, -0.014031395316123962, -0.07114320248365402, 0.012042229063808918, 0.018310079351067543, -0.010243640281260014, 0.03605082258582115, -0.06241491436958313, 0.02944232150912285, -0.013728386722505093, -0.025254953652620316, -0.029498714953660965, 0.07640450447797775, -0.011104161851108074, -0.04153776913881302, -0.013471778482198715, 0.008333251811563969, -0.059985872358083725, 0.00560308201238513, -0.015028133057057858, 0.08608084172010422, -0.006602425128221512, -0.04747149348258972, -0.017020156607031822, -0.01871940679848194, 0.016693115234375, -0.031574029475450516, 0.030111052095890045, 0.05616549775004387, 0.01646939478814602, 0.0457557812333107, -0.014612734317779541, 0.01368342712521553, -0.04982489347457886, -0.009298820048570633, -0.02723359502851963, -0.0008145200554281473, -0.09331169724464417, 0.00401146849617362, 0.008510710671544075, -0.07891222834587097, -0.02907235361635685, -6.313914439472521e-33, 0.07568077743053436, -0.09000617265701294, -0.06070239096879959, 0.11525311321020126, -0.014498898759484291, -0.0008522982243448496, -0.0349455289542675, 0.04058955982327461, 0.02120412513613701, -0.054746050387620926, -0.010148445144295692, -0.029173118993639946, 0.10248474031686783, 0.0021868934854865074, 0.04475421458482742, -0.013116709887981415, -0.09841741621494293, -0.04163246974349022, 0.04465601593255997, -0.05844438076019287, -0.02338074892759323, 0.017567425966262817, 0.04443267360329628, 0.05567457154393196, 0.05375697463750839, 0.008315631188452244, -0.022057093679904938, 0.057597238570451736, 0.06932394206523895, -0.02177543006837368, 0.004250205121934414, 0.10542294383049011, -0.01441450510174036, -0.03953998535871506, -0.06399965286254883, -0.04602966457605362, 0.035384275019168854, 0.05531126633286476, 0.030549947172403336, 0.04770756512880325, 0.03246369957923889, 0.00039980499423108995, 0.059149712324142456, 0.02996024675667286, 0.04344077408313751, -0.009892408736050129, -0.006694624200463295, 0.10050912201404572, -0.020082036033272743, -0.017067646607756615, 0.07374659180641174, -0.05251029506325722, -0.03935833275318146, 0.06188632547855377, 0.08178990334272385, 0.11132366210222244, 0.0435611829161644, 0.010465171188116074, 0.005195277743041515, 0.033914729952812195, 0.0146569162607193, -0.09377025812864304, 0.08298296481370926, 0.0045782397501170635, 0.014367897994816303, 0.005750403739511967, -0.03258020058274269, -0.0552307590842247, -0.008670572191476822, 0.03246314823627472, 0.06152937933802605, -0.09388286620378494, -0.024178294464945793, 0.008540526032447815, 0.04901503771543503, -0.016522105783224106, -0.08450233191251755, -0.06985857337713242, 0.05796269327402115, 0.029295023530721664, -0.03112768568098545, 0.04837403818964958, -0.0039127119816839695, 0.11222777515649796, 0.12379975616931915, -0.03716046363115311, 0.03203714266419411, -0.03742731362581253, -0.11347851902246475, 0.013308463618159294, 0.020159773528575897, 0.011426171287894249, -0.057831477373838425, 0.016938872635364532, 0.05653093755245209, -5.941400615938619e-8, 0.03795446455478668, -0.06710467487573624, -0.03530354052782059, 0.011285369284451008, 0.02819678746163845, -0.023242661729454994, -0.03923756256699562, -0.10747991502285004, 0.07337349653244019, -0.12533585727214813, 0.06005970388650894, -0.04227878525853157, -0.04724258929491043, -0.012452143244445324, -0.012207194231450558, 0.030404848977923393, -0.06945574283599854, 0.006532363127917051, -0.05306696519255638, -0.06839793920516968, 0.00527773005887866, -0.10849368572235107, -0.08007296919822693, -0.012495141476392746, 0.06997198611497879, 0.07474629580974579, 0.11736711114645004, 0.10064399242401123, -0.04612668976187706, 0.017942490056157112, -0.03768579289317131, -0.028513094410300255, 0.13268713653087616, 0.0011352337896823883, 0.027378888800740242, 0.03925600275397301, 0.009428382851183414, 0.008846966549754143, 0.0545584075152874, 0.11661728471517563, 0.012166849337518215, 0.011105290614068508, -0.036354538053274155, 0.00724367331713438, 0.004026531241834164, 0.07957012951374054, 0.04380349442362785, 0.05931135639548302, -0.0632624477148056, 0.09320688992738724, 0.028583986684679985, -0.05589529126882553, 0.03049275651574135, 0.023581113666296005, -0.06761835515499115, 0.04687105491757393, -0.01119588129222393, -0.11134835332632065, 0.10560569912195206, -0.008701687678694725, 0.07904122024774551, 0.015374711714684963, 0.09556037187576294, -0.02571558952331543 ]
0.07204
key) => { if (err) throw err; console.log(key.export().toString('hex')); // 46e..........620 }); ``` ```cjs const { generateKey, } = require('node:crypto'); generateKey('hmac', { length: 512 }, (err, key) => { if (err) throw err; console.log(key.export().toString('hex')); // 46e..........620 }); ``` The size of a generated HMAC key should not exceed the block size of the underlying hash function. See [`crypto.createHmac()`][] for more information. ### `crypto.generateKeyPair(type, options, callback)` \* `type` {string} The asymmetric key type to generate. See the supported [asymmetric key types][]. \* `options` {Object} \* `modulusLength` {number} Key size in bits (RSA, DSA). \* `publicExponent` {number} Public exponent (RSA). \*\*Default:\*\* `0x10001`. \* `hashAlgorithm` {string} Name of the message digest (RSA-PSS). \* `mgf1HashAlgorithm` {string} Name of the message digest used by MGF1 (RSA-PSS). \* `saltLength` {number} Minimal salt length in bytes (RSA-PSS). \* `divisorLength` {number} Size of `q` in bits (DSA). \* `namedCurve` {string} Name of the curve to use (EC). \* `prime` {Buffer} The prime parameter (DH). \* `primeLength` {number} Prime length in bits (DH). \* `generator` {number} Custom generator (DH). \*\*Default:\*\* `2`. \* `groupName` {string} Diffie-Hellman group name (DH). See [`crypto.getDiffieHellman()`][]. \* `paramEncoding` {string} Must be `'named'` or `'explicit'` (EC). \*\*Default:\*\* `'named'`. \* `publicKeyEncoding` {Object} See [`keyObject.export()`][]. \* `privateKeyEncoding` {Object} See [`keyObject.export()`][]. \* `callback` {Function} \* `err` {Error} \* `publicKey` {string | Buffer | KeyObject} \* `privateKey` {string | Buffer | KeyObject} Generates a new asymmetric key pair of the given `type`. See the supported [asymmetric key types][]. If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function behaves as if [`keyObject.export()`][] had been called on its result. Otherwise, the respective part of the key is returned as a [`KeyObject`][]. It is recommended to encode public keys as `'spki'` and private keys as `'pkcs8'` with encryption for long-term storage: ```mjs const { generateKeyPair, } = await import('node:crypto'); generateKeyPair('rsa', { modulusLength: 4096, publicKeyEncoding: { type: 'spki', format: 'pem', }, privateKeyEncoding: { type: 'pkcs8', format: 'pem', cipher: 'aes-256-cbc', passphrase: 'top secret', }, }, (err, publicKey, privateKey) => { // Handle errors and use the generated key pair. }); ``` ```cjs const { generateKeyPair, } = require('node:crypto'); generateKeyPair('rsa', { modulusLength: 4096, publicKeyEncoding: { type: 'spki', format: 'pem', }, privateKeyEncoding: { type: 'pkcs8', format: 'pem', cipher: 'aes-256-cbc', passphrase: 'top secret', }, }, (err, publicKey, privateKey) => { // Handle errors and use the generated key pair. }); ``` On completion, `callback` will be called with `err` set to `undefined` and `publicKey` / `privateKey` representing the generated key pair. If this method is invoked as its [`util.promisify()`][]ed version, it returns a `Promise` for an `Object` with `publicKey` and `privateKey` properties. ### `crypto.generateKeyPairSync(type, options)` \* `type` {string} The asymmetric key type to generate. See the supported [asymmetric key types][]. \* `options` {Object} \* `modulusLength` {number} Key size in bits (RSA, DSA). \* `publicExponent` {number} Public exponent (RSA). \*\*Default:\*\* `0x10001`. \* `hashAlgorithm` {string} Name of the message digest (RSA-PSS). \* `mgf1HashAlgorithm` {string} Name of the message digest used by MGF1 (RSA-PSS). \* `saltLength` {number} Minimal salt length in bytes (RSA-PSS). \* `divisorLength` {number} Size of `q` in bits (DSA). \* `namedCurve` {string} Name of the curve to use (EC). \* `prime` {Buffer} The prime parameter (DH). \* `primeLength` {number} Prime length in bits (DH). \* `generator` {number} Custom generator (DH). \*\*Default:\*\* `2`. \* `groupName` {string} Diffie-Hellman group name (DH). See [`crypto.getDiffieHellman()`][]. \* `paramEncoding` {string} Must be `'named'` or `'explicit'` (EC). \*\*Default:\*\* `'named'`. \* `publicKeyEncoding` {Object} See [`keyObject.export()`][]. \* `privateKeyEncoding` {Object} See [`keyObject.export()`][]. \* Returns: {Object} \* `publicKey` {string | Buffer | KeyObject} \* `privateKey` {string | Buffer | KeyObject} Generates a new asymmetric key pair of the given `type`. See the supported [asymmetric key types][]. If a `publicKeyEncoding` or
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.026219461113214493, 0.08388334512710571, -0.05495574697852135, 0.004048516508191824, 0.015077621676027775, -0.04072723165154457, -0.013814878650009632, 0.06150465086102486, 0.02962813898921013, -0.001738664461299777, 0.002324386266991496, -0.0361044742166996, 0.012409103102982044, -0.055680740624666214, 0.015911931172013283, 0.012933168560266495, -0.1201496496796608, -0.022350464016199112, -0.10456826537847519, -0.012316785752773285, 0.07938972115516663, -0.08889821916818619, 0.0396866612136364, -0.021206006407737732, -0.006047222297638655, -0.01745854876935482, 0.052234724164009094, 0.08259285986423492, 0.013571563176810741, 0.005344945006072521, 0.048099689185619354, 0.013812107034027576, -0.008583465591073036, -0.022277455776929855, 0.020991364493966103, 0.19038760662078857, 0.022981714457273483, -0.0030260507483035326, 0.05311083421111107, -0.0733857974410057, 0.022156665101647377, 0.11020641773939133, -0.011747431941330433, 0.044186078011989594, 0.02295142412185669, 0.05234164372086525, -0.04715440422296524, 0.02132541872560978, -0.014550929889082909, 0.01751578040421009, -0.02454066090285778, 0.04327228665351868, -0.005456074140965939, -0.0839981883764267, -0.06514087319374084, -0.0011880466481670737, -0.10211937129497528, -0.022359147667884827, 0.08517441153526306, -0.009716950356960297, -0.014546425081789494, -0.023988183587789536, 0.05575200170278549, -0.040242526680231094, 0.05592530593276024, -0.006625144276767969, -0.04054323956370354, -0.10667743533849716, -0.07224441319704056, 0.031347665935754776, 0.015069440007209778, -0.05902983248233795, -0.040649790316820145, 0.09609470516443253, -0.03946832939982414, -0.033827003091573715, -0.08929647505283356, -0.02915499359369278, -0.029330674558877945, 0.06920451670885086, -0.045092638581991196, -0.03622155264019966, -0.022210774943232536, 0.08495651930570602, -0.006732473149895668, 0.10194148123264313, 0.035577915608882904, -0.017965439707040787, -0.026757894083857536, 0.0987858772277832, -0.07058767974376678, -0.0472254604101181, -0.001003031269647181, 0.08709081262350082, 0.03941904753446579, 0.022579167038202286, 0.0744396448135376, 0.021220341324806213, -0.0481388159096241, 0.009428982622921467, 0.025530587881803513, -0.009196733124554157, 0.006249241530895233, -0.09134425967931747, 0.05634832754731178, 0.02889358066022396, -0.04694468900561333, -0.012277462519705296, 0.03115788660943508, 0.04237060248851776, 0.00426854845136404, 0.11731044203042984, -0.03669263422489166, -0.04685591161251068, -0.03996817022562027, 0.08379937708377838, -0.017293833196163177, -0.011917957104742527, 0.00005872108886251226, 0.07142145186662674, 0.1015600860118866, 0.0020752237178385258, -0.0024313137400895357, 0.03770453482866287, -0.09296635538339615, -0.043585192412137985, 0.05397704988718033, -3.4031695624682775e-34, -0.03688459470868111, -0.026338651776313782, 0.05489500239491463, 0.0135536789894104, 0.019731421023607254, 0.03462626412510872, 0.06967940926551819, 0.004370586480945349, -0.0786152333021164, -0.02884627692401409, -0.10879627615213394, -0.014642788097262383, -0.022011343389749527, -0.04338378459215164, 0.017270581796765327, -0.07136417180299759, 0.07642477005720139, 0.008847121149301529, 0.009334875270724297, 0.015856053680181503, 0.02186889760196209, -0.006885773502290249, 0.04483483359217644, -0.006356952711939812, 0.02089260146021843, 0.00804871879518032, 0.0112592913210392, -0.002834051614627242, -0.010236377827823162, -0.013161999173462391, 0.004739037249237299, 0.06087084859609604, 0.012812735512852669, -0.012066212482750416, 0.017178259789943695, 0.010132857598364353, 0.010896977037191391, 0.02411579340696335, -0.13275077939033508, -0.05177978053689003, 0.038184985518455505, 0.025757811963558197, -0.04336557909846306, -0.021526850759983063, -0.02153738960623741, -0.021583955734968185, 0.029609696939587593, -0.052059583365917206, 0.030487630516290665, 0.02933821827173233, -0.060156092047691345, 0.03628856688737869, 0.03730554133653641, -0.03968976438045502, 0.05421258136630058, -0.10877615213394165, 0.054610949009656906, -0.023317163810133934, 0.016637826338410378, 0.018912719562649727, 0.009955174289643764, 0.04835249111056328, 0.018264979124069214, 0.06130138039588928, 0.014600101858377457, -0.03602117300033569, -0.01561400480568409, 0.014499405398964882, -0.06473898887634277, -0.005937911570072174, 0.029238011687994003, -0.015558917075395584, -0.019539332017302513, 0.0023841429501771927, -0.010758629068732262, -0.03997579216957092, -0.11311368644237518, 0.03499344363808632, -0.011770971119403839, -0.08101511001586914, 0.07427163422107697, 0.058501165360212326, 0.0001496161421528086, -0.011198163963854313, 0.030266644433140755, 0.04630051180720329, -0.039500247687101364, 0.000024215138182626106, -0.020155422389507294, 0.054887060075998306, 0.001634666696190834, -0.07802905142307281, -0.019062498584389687, -0.10908803343772888, -0.10978546738624573, -2.036715327835444e-33, -0.019760526716709137, -0.05565863847732544, -0.02624889463186264, 0.10939758270978928, -0.014479455538094044, 0.008349287323653698, 0.0054263523779809475, 0.06339539587497711, -0.03658327832818031, -0.04570046067237854, 0.004861688241362572, -0.015883557498455048, 0.10947235673666, -0.022499045357108116, 0.03212977573275566, -0.005562471225857735, -0.04437939077615738, 0.08809572458267212, 0.035952240228652954, -0.036671705543994904, -0.00802307203412056, -0.016184112057089806, 0.023375550284981728, 0.08935803920030594, -0.03840048611164093, 0.023945605382323265, -0.03230323642492294, 0.06967105716466904, -0.007382960058748722, -0.030183566734194756, -0.047793518751859665, 0.1164897009730339, -0.025055814534425735, 0.020193349570035934, 0.004761692602187395, -0.13785891234874725, 0.0028230769094079733, 0.09305582195520401, 0.10368917882442474, 0.05014165863394737, 0.019442154094576836, -0.04952326789498329, 0.00513122696429491, -0.004391763359308243, -0.006711133755743504, -0.014615769498050213, 0.019557489082217216, 0.07128696143627167, 0.0997704416513443, 0.05437406525015831, 0.07210694253444672, -0.03717445209622383, -0.056081704795360565, -0.01578206941485405, 0.0039033638313412666, -0.018225567415356636, -0.10717663913965225, 0.014903022907674313, 0.032383572310209274, -0.00021190392726566643, -0.06586377322673798, -0.09363754093647003, 0.09453057497739792, 0.021818026900291443, 0.015027613379061222, -0.021826185286045074, -0.1017618477344513, 0.02440016344189644, 0.031741321086883545, 0.07629162073135376, -0.03223171830177307, 0.006253678817301989, 0.05178024247288704, 0.00407489575445652, 0.008542828261852264, -0.08528389781713486, -0.02006564661860466, -0.03829821199178696, 0.12941642105579376, 0.022260159254074097, -0.02047749236226082, 0.10247025638818741, 0.03264346718788147, 0.03359469026327133, 0.06474881619215012, -0.052963487803936005, 0.050544749945402145, 0.021299632266163826, -0.09129220992326736, 0.0350230447947979, 0.004965838044881821, 0.032821204513311386, -0.06456665694713593, -0.00045205323840491474, 0.047293610870838165, -4.709637480004858e-8, -0.01171976700425148, -0.0024389945901930332, -0.06968127936124802, -0.040342941880226135, 0.030644582584500313, 0.04271478205919266, -0.01852208562195301, -0.10058348625898361, 0.07024449855089188, -0.0579160712659359, 0.0710659995675087, 0.020005611702799797, -0.030924703925848007, -0.007112300954759121, -0.08128314465284348, -0.04588218405842781, -0.07183701545000076, 0.03748489171266556, 0.03482777997851372, -0.07653553783893585, -0.02104691043496132, -0.03689633309841156, -0.0033882169518619776, 0.008958710357546806, 0.06980344653129578, -0.0315910279750824, 0.004107669927179813, 0.05266185104846954, 0.028936345130205154, -0.05685184895992279, -0.08985695987939835, -0.011399484239518642, 0.03192824870347977, -0.050684619694948196, -0.07427431643009186, -0.008092070929706097, -0.0666499063372612, -0.015355691313743591, 0.1043984442949295, -0.011099236086010933, 0.048812136054039, -0.024472825229167938, -0.04870082810521126, -0.015546873211860657, -0.09620440006256104, 0.01597609557211399, 0.023883096873760223, 0.10928318649530411, -0.033103156834840775, 0.009413761086761951, 0.014174149371683598, -0.018996311351656914, 0.028591904789209366, -0.0976494550704956, -0.018412714824080467, 0.033880215138196945, -0.028817590326070786, -0.016579903662204742, 0.010062813758850098, -0.04090101271867752, 0.05165188014507294, -0.020603040233254433, -0.02801556885242462, -0.011228850111365318 ]
-0.057577
(EC). \*\*Default:\*\* `'named'`. \* `publicKeyEncoding` {Object} See [`keyObject.export()`][]. \* `privateKeyEncoding` {Object} See [`keyObject.export()`][]. \* Returns: {Object} \* `publicKey` {string | Buffer | KeyObject} \* `privateKey` {string | Buffer | KeyObject} Generates a new asymmetric key pair of the given `type`. See the supported [asymmetric key types][]. If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function behaves as if [`keyObject.export()`][] had been called on its result. Otherwise, the respective part of the key is returned as a [`KeyObject`][]. When encoding public keys, it is recommended to use `'spki'`. When encoding private keys, it is recommended to use `'pkcs8'` with a strong passphrase, and to keep the passphrase confidential. ```mjs const { generateKeyPairSync, } = await import('node:crypto'); const { publicKey, privateKey, } = generateKeyPairSync('rsa', { modulusLength: 4096, publicKeyEncoding: { type: 'spki', format: 'pem', }, privateKeyEncoding: { type: 'pkcs8', format: 'pem', cipher: 'aes-256-cbc', passphrase: 'top secret', }, }); ``` ```cjs const { generateKeyPairSync, } = require('node:crypto'); const { publicKey, privateKey, } = generateKeyPairSync('rsa', { modulusLength: 4096, publicKeyEncoding: { type: 'spki', format: 'pem', }, privateKeyEncoding: { type: 'pkcs8', format: 'pem', cipher: 'aes-256-cbc', passphrase: 'top secret', }, }); ``` The return value `{ publicKey, privateKey }` represents the generated key pair. When PEM encoding was selected, the respective key will be a string, otherwise it will be a buffer containing the data encoded as DER. ### `crypto.generateKeySync(type, options)` \* `type` {string} The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. \* `options` {Object} \* `length` {number} The bit length of the key to generate. \* If `type` is `'hmac'`, the minimum is 8, and the maximum length is 231-1. If the value is not a multiple of 8, the generated key will be truncated to `Math.floor(length / 8)`. \* If `type` is `'aes'`, the length must be one of `128`, `192`, or `256`. \* Returns: {KeyObject} Synchronously generates a new random secret key of the given `length`. The `type` will determine which validations will be performed on the `length`. ```mjs const { generateKeySync, } = await import('node:crypto'); const key = generateKeySync('hmac', { length: 512 }); console.log(key.export().toString('hex')); // e89..........41e ``` ```cjs const { generateKeySync, } = require('node:crypto'); const key = generateKeySync('hmac', { length: 512 }); console.log(key.export().toString('hex')); // e89..........41e ``` The size of a generated HMAC key should not exceed the block size of the underlying hash function. See [`crypto.createHmac()`][] for more information. ### `crypto.generatePrime(size[, options], callback)` \* `size` {number} The size (in bits) of the prime to generate. \* `options` {Object} \* `add` {ArrayBuffer|SharedArrayBuffer|TypedArray|Buffer|DataView|bigint} \* `rem` {ArrayBuffer|SharedArrayBuffer|TypedArray|Buffer|DataView|bigint} \* `safe` {boolean} \*\*Default:\*\* `false`. \* `bigint` {boolean} When `true`, the generated prime is returned as a `bigint`. \* `callback` {Function} \* `err` {Error} \* `prime` {ArrayBuffer|bigint} Generates a pseudorandom prime of `size` bits. If `options.safe` is `true`, the prime will be a safe prime -- that is, `(prime - 1) / 2` will also be a prime. The `options.add` and `options.rem` parameters can be used to enforce additional requirements, e.g., for Diffie-Hellman: \* If `options.add` and `options.rem` are both set, the prime will satisfy the condition that `prime % add = rem`. \* If only `options.add` is set and `options.safe` is not `true`, the prime will satisfy the condition that `prime % add = 1`. \* If only `options.add` is set and `options.safe` is set to `true`, the prime will instead satisfy the condition that `prime % add = 3`. This is necessary because `prime % add = 1` for `options.add > 2` would contradict the condition enforced by `options.safe`. \* `options.rem` is ignored if `options.add` is not given. Both `options.add` and `options.rem` must be encoded as big-endian sequences if given as
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.054948315024375916, 0.04328981786966324, -0.05902915820479393, 0.058681800961494446, -0.035415999591350555, -0.018009303137660027, 0.03778607025742531, 0.030673310160636902, 0.0805598720908165, -0.0019294427474960685, 0.019295480102300644, -0.02682196907699108, -0.024484936147928238, -0.020485302433371544, 0.08530307561159134, 0.01839149184525013, -0.0343770794570446, 0.012723490595817566, -0.07698831707239151, 0.06035519763827324, 0.05810801312327385, -0.006658808793872595, 0.011367003433406353, 0.014404174871742725, -0.02320636250078678, -0.0139517392963171, 0.04242747649550438, 0.029507210478186607, 0.02865258976817131, -0.011071410030126572, -0.022019896656274796, -0.006254349369555712, -0.03119971975684166, 0.06360670179128647, 0.07643153518438339, 0.14703720808029175, 0.005860369652509689, -0.033709123730659485, 0.03479376062750816, -0.0869358479976654, 0.0740572139620781, 0.03591598942875862, -0.06782699376344681, -0.0038138646632432938, 0.011506538838148117, 0.07717640697956085, 0.0004383300256449729, -0.029004622250795364, -0.10723647475242615, -0.04812406003475189, -0.060979440808296204, 0.07393480837345123, -0.09217987954616547, -0.0028270112816244364, 0.0216826181858778, 0.007703955285251141, -0.09481363743543625, -0.02080838941037655, 0.05211704969406128, 0.027561742812395096, -0.0118027962744236, -0.012391980737447739, -0.00574552221223712, 0.021057719364762306, -0.06676526367664337, 0.007207695860415697, -0.021038737148046494, -0.0688576027750969, 0.05707114189863205, -0.011545166373252869, -0.066839799284935, -0.02411867119371891, -0.022296277806162834, -0.016831187531352043, 0.011477612890303135, -0.010283957235515118, -0.0019259958062320948, -0.027899084612727165, -0.06359737366437912, -0.05484376102685928, -0.0025365829933434725, -0.0741216242313385, -0.07355020940303802, 0.04561304301023483, 0.020816372707486153, 0.03826753795146942, -0.005551010370254517, -0.04683523252606392, -0.02405834011733532, 0.1506570428609848, -0.050739165395498276, -0.11371593922376633, 0.14680780470371246, 0.06194787845015526, 0.050556689500808716, -0.006525630131363869, 0.08225968480110168, 0.0484909750521183, -0.001585566089488566, 0.0170755572617054, -0.041822802275419235, 0.02900625206530094, 0.07131221145391464, -0.10902664065361023, 0.07248596847057343, 0.022076791152358055, 0.005386656615883112, -0.1170627623796463, 0.04458443447947502, 0.009517550468444824, -0.06439737975597382, 0.02936224825680256, -0.04477812722325325, -0.07073898613452911, -0.07274254411458969, 0.049963630735874176, -0.09152709692716599, -0.006655529141426086, 0.020871294662356377, 0.1060781329870224, 0.05870065838098526, -0.09588750451803207, 0.036208298057317734, 0.009922187775373459, -0.05983828380703926, 0.010798626579344273, -0.03740140423178673, 3.5756194510152034e-33, -0.024955831468105316, -0.04228644445538521, 0.026244543492794037, -0.03856717050075531, -0.017508435994386673, 0.028023088350892067, 0.0433969721198082, 0.003248327411711216, -0.003681659232825041, -0.023944182321429253, -0.06205637753009796, 0.06179484724998474, -0.03844764083623886, 0.038630254566669464, 0.0062452806159853935, 0.10032203048467636, -0.001722876913845539, 0.06899137794971466, 0.027798393741250038, 0.08198017627000809, 0.049583207815885544, 0.035509344190359116, -0.053670138120651245, 0.021922271698713303, 0.0025105164386332035, -0.009507108479738235, 0.0035784700885415077, -0.051170386373996735, -0.022467410191893578, 0.042098186910152435, -0.033761974424123764, 0.009779172949492931, -0.027933726087212563, -0.025045650079846382, 0.025829598307609558, -0.03396299481391907, 0.03902096673846245, -0.013627142645418644, -0.10770255327224731, -0.03802453726530075, -0.03896255046129227, -0.022271571680903435, -0.10449525713920593, 0.05096012353897095, 0.013322451151907444, -0.053185220807790756, -0.05003419890999794, 0.04504714161157608, 0.045137327164411545, -0.010775348171591759, -0.044867970049381256, 0.04292133077979088, 0.03422975540161133, 0.04830636456608772, 0.01820814609527588, -0.07687091082334518, 0.07379288226366043, 0.012926030904054642, -0.045601531863212585, -0.014373752288520336, -0.01934787444770336, 0.08556321263313293, 0.039367157965898514, 0.06337307393550873, 0.0451357327401638, -0.022468620911240578, 0.01834271289408207, 0.010213836096227169, -0.05188821256160736, -0.07047557085752487, -0.003489329246804118, 0.07156768441200256, -0.13004961609840393, -0.0034620838705450296, -0.01976725459098816, -0.04222331941127777, -0.03821020945906639, -0.03461265191435814, 0.06472232937812805, -0.024618228897452354, 0.008328380063176155, 0.06695104390382767, -0.07040093839168549, -0.0010471631539985538, -0.10531404614448547, 0.06647798418998718, -0.05058740824460983, -0.04749445244669914, 0.06336570531129837, 0.0021542184986174107, -0.016770990565419197, -0.040831007063388824, -0.08895837515592575, -0.03733131289482117, -0.10791180282831192, -5.967010260839525e-33, 0.03210514783859253, -0.025471916422247887, -0.07687460631132126, 0.05453132465481758, -0.062216728925704956, -0.0014689848758280277, 0.016425680369138718, 0.01721149869263172, -0.01761162094771862, -0.03270301967859268, -0.0053018927574157715, -0.023281840607523918, 0.08523017913103104, -0.06322196125984192, 0.11175883561372757, -0.00974474847316742, -0.09098980575799942, 0.02280440926551819, 0.008363135159015656, -0.049890708178281784, 0.02078082039952278, -0.028219694271683693, 0.005921688862144947, 0.1217232421040535, 0.014690615236759186, 0.015827413648366928, -0.059673652052879333, 0.08679036796092987, -0.010038829408586025, 0.0407000407576561, 0.0223064087331295, 0.10685085505247116, -0.09508539736270905, -0.004919232334941626, -0.10922739654779434, -0.05698791518807411, -0.03525988385081291, 0.06790537387132645, 0.06722673028707504, -0.012649940326809883, 0.061025071889162064, 0.022092217579483986, 0.004350675735622644, 0.00870567373931408, 0.012760703451931477, -0.013330315239727497, 0.050258196890354156, 0.027988627552986145, 0.05380147695541382, -0.011710982769727707, 0.15419717133045197, -0.043905410915613174, -0.053470272570848465, -0.05720668286085129, -0.02006375603377819, 0.03704008087515831, -0.07818502932786942, -0.028333164751529694, -0.02079916000366211, 0.014420744962990284, 0.03530289977788925, -0.09041808545589447, 0.07584769278764725, 0.043813664466142654, -0.06466320902109146, -0.08817814290523529, 0.015938665717840195, 0.001540292170830071, -0.0057863835245370865, -0.054895661771297455, 0.050988975912332535, -0.04537418112158775, -0.03780359774827957, 0.04999445751309395, -0.003347496036440134, 0.021017473191022873, -0.03331704065203667, 0.004573163576424122, 0.06981147080659866, 0.0917564183473587, 0.0008271723054349422, 0.057672418653964996, 0.05731457471847534, 0.0682457759976387, 0.02090025506913662, -0.07554575055837631, 0.06106029078364372, 0.0024978183209896088, -0.05649080500006676, 0.019095556810498238, 0.01741880178451538, 0.020569905638694763, -0.10728292167186737, 0.06335071474313736, 0.017033623531460762, -5.3231435259704085e-8, 0.005100473761558533, 0.012408711016178131, -0.04623761028051376, 0.01387966237962246, -0.01935519278049469, -0.04633114114403725, -0.022727757692337036, -0.07663246989250183, 0.014606465585529804, -0.08696902543306351, 0.006439428776502609, -0.008295104838907719, -0.037730857729911804, 0.033165156841278076, -0.0005230439710430801, 0.011413756757974625, 0.031290289014577866, 0.02818947844207287, -0.013033147901296616, -0.03607965260744095, -0.004643948748707771, -0.11194293200969696, -0.00029062392422929406, -0.0090508833527565, -0.02974172867834568, 0.05244530364871025, 0.04387916624546051, 0.08997389674186707, 0.05223061516880989, -0.0035434807650744915, -0.014673498459160328, 0.0053689125925302505, 0.013541465625166893, 0.023486655205488205, -0.044613294303417206, 0.046480320394039154, -0.004462055396288633, -0.01088622771203518, -0.01058746874332428, 0.09603855013847351, 0.013366879895329475, -0.058163683861494064, -0.08892615139484406, 0.0313870832324028, -0.06711725145578384, -0.006214677356183529, -0.0003045520279556513, 0.08917220681905746, -0.016801198944449425, -0.01636340655386448, -0.01636682078242302, -0.00742942001670599, 0.0006586804520338774, 0.038003962486982346, -0.06802209466695786, 0.05274886637926102, -0.0366029217839241, 0.04256726801395416, 0.004098888486623764, -0.03353776037693024, 0.03258110582828522, 0.03187517821788788, -0.023561231791973114, 0.046171851456165314 ]
0.05903
the condition that `prime % add = 3`. This is necessary because `prime % add = 1` for `options.add > 2` would contradict the condition enforced by `options.safe`. \* `options.rem` is ignored if `options.add` is not given. Both `options.add` and `options.rem` must be encoded as big-endian sequences if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or `DataView`. By default, the prime is encoded as a big-endian sequence of octets in an {ArrayBuffer}. If the `bigint` option is `true`, then a {bigint} is provided. The `size` of the prime will have a direct impact on how long it takes to generate the prime. The larger the size, the longer it will take. Because we use OpenSSL's `BN\_generate\_prime\_ex` function, which provides only minimal control over our ability to interrupt the generation process, it is not recommended to generate overly large primes, as doing so may make the process unresponsive. ### `crypto.generatePrimeSync(size[, options])` \* `size` {number} The size (in bits) of the prime to generate. \* `options` {Object} \* `add` {ArrayBuffer|SharedArrayBuffer|TypedArray|Buffer|DataView|bigint} \* `rem` {ArrayBuffer|SharedArrayBuffer|TypedArray|Buffer|DataView|bigint} \* `safe` {boolean} \*\*Default:\*\* `false`. \* `bigint` {boolean} When `true`, the generated prime is returned as a `bigint`. \* Returns: {ArrayBuffer|bigint} Generates a pseudorandom prime of `size` bits. If `options.safe` is `true`, the prime will be a safe prime -- that is, `(prime - 1) / 2` will also be a prime. The `options.add` and `options.rem` parameters can be used to enforce additional requirements, e.g., for Diffie-Hellman: \* If `options.add` and `options.rem` are both set, the prime will satisfy the condition that `prime % add = rem`. \* If only `options.add` is set and `options.safe` is not `true`, the prime will satisfy the condition that `prime % add = 1`. \* If only `options.add` is set and `options.safe` is set to `true`, the prime will instead satisfy the condition that `prime % add = 3`. This is necessary because `prime % add = 1` for `options.add > 2` would contradict the condition enforced by `options.safe`. \* `options.rem` is ignored if `options.add` is not given. Both `options.add` and `options.rem` must be encoded as big-endian sequences if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or `DataView`. By default, the prime is encoded as a big-endian sequence of octets in an {ArrayBuffer}. If the `bigint` option is `true`, then a {bigint} is provided. The `size` of the prime will have a direct impact on how long it takes to generate the prime. The larger the size, the longer it will take. Because we use OpenSSL's `BN\_generate\_prime\_ex` function, which provides only minimal control over our ability to interrupt the generation process, it is not recommended to generate overly large primes, as doing so may make the process unresponsive. ### `crypto.getCipherInfo(nameOrNid[, options])` \* `nameOrNid` {string|number} The name or nid of the cipher to query. \* `options` {Object} \* `keyLength` {number} A test key length. \* `ivLength` {number} A test IV length. \* Returns: {Object} \* `name` {string} The name of the cipher \* `nid` {number} The nid of the cipher \* `blockSize` {number} The block size of the cipher in bytes. This property is omitted when `mode` is `'stream'`. \* `ivLength` {number} The expected or default initialization vector length in bytes. This property is omitted if the cipher does not use an initialization vector. \* `keyLength` {number} The expected or default key length in bytes. \* `mode` {string} The cipher mode. One of `'cbc'`, `'ccm'`, `'cfb'`, `'ctr'`, `'ecb'`, `'gcm'`, `'ocb'`, `'ofb'`, `'stream'`, `'wrap'`, `'xts'`. Returns information about a given cipher. Some ciphers accept variable length keys and initialization vectors. By default, the `crypto.getCipherInfo()` method will return the default values for these ciphers. To test
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ 0.015573818236589432, 0.03434467315673828, -0.09629476070404053, 0.009638809598982334, 0.01697213016450405, -0.08021677285432816, -0.050383925437927246, 0.06665334105491638, -0.005382169969379902, 0.0055033061653375626, -0.028109772130846977, 0.020912552252411842, -0.003243556944653392, -0.07048118859529495, 0.010950756259262562, -0.06942679733037949, -0.04869727045297623, -0.025706177577376366, -0.07048078626394272, -0.011670351028442383, 0.07581905275583267, -0.016896739602088928, -0.005122389644384384, -0.013954825699329376, -0.000559472304303199, -0.04255298897624016, -0.007398712448775768, 0.02816535159945488, 0.08559032529592514, -0.07237104326486588, 0.12399334460496902, 0.04000284522771835, 0.03053029254078865, 0.021637775003910065, 0.04729175940155983, 0.052848998457193375, -0.004311953205615282, -0.047275420278310776, -0.0615050345659256, 0.01943490281701088, 0.07522156834602356, -0.03770125284790993, -0.09887108206748962, 0.0867915078997612, -0.07652747631072998, -0.022993410006165504, -0.007181042339652777, 0.020947137847542763, -0.035134077072143555, -0.011597052216529846, -0.050188835710287094, 0.04096510633826256, -0.07986167818307877, 0.037169232964515686, 0.011127680540084839, -0.09646806120872498, -0.07734573632478714, -0.015813209116458893, -0.09387145936489105, 0.014529038220643997, -0.08942390978336334, 0.03425748273730278, 0.010004475712776184, -0.02618682011961937, 0.06004105135798454, 0.02351732738316059, 0.04849007725715637, -0.05786783993244171, 0.008865016512572765, 0.012945432215929031, 0.015207307413220406, -0.004319663625210524, -0.037824518978595734, 0.06410180032253265, -0.010240425355732441, 0.03876947984099388, 0.009432384744286537, -0.04723045974969864, -0.08701901137828827, -0.05592084676027298, 0.020215125754475594, -0.04340774193406105, -0.03938741236925125, -0.024870064109563828, 0.048402272164821625, 0.0030319769866764545, -0.053068920969963074, 0.009501916356384754, 0.05271284654736519, 0.0037278886884450912, 0.07950692623853683, -0.029143504798412323, -0.06009521707892418, -0.005065014585852623, 0.09196680784225464, 0.07465256005525589, 0.06519951671361923, -0.055887527763843536, -0.049210626631975174, -0.0019598305225372314, 0.021371711045503616, 0.018049944192171097, -0.01736767217516899, -0.0030502821318805218, 0.005327134393155575, -0.04108330234885216, 0.019739912822842598, 0.14606456458568573, -0.07452777028083801, -0.017958689481019974, 0.07249825447797775, -0.02501058392226696, 0.12272068113088608, -0.0959589034318924, -0.00690913200378418, 0.05294466391205788, -0.06237427890300751, -0.012529822997748852, -0.03222479671239853, -0.07470757514238358, 0.07062837481498718, 0.0443301647901535, -0.028469430282711983, 0.0514758937060833, -0.026179656386375427, 0.035674162209033966, -0.04146474972367287, 1.5856957778401945e-33, 0.013840393163263798, 0.04565649852156639, -0.03597167506814003, -0.036015111953020096, -0.07965487241744995, 0.05017298460006714, -0.010137328878045082, 0.023797381669282913, -0.036849189549684525, 0.048008762300014496, -0.01351109892129898, -0.08798418939113617, 0.0035996742080897093, 0.03044670820236206, 0.09597188979387283, -0.018075458705425262, 0.07242946326732635, 0.054047591984272, -0.011645507998764515, 0.029763150960206985, 0.04901135340332985, 0.03730980306863785, -0.003337099915370345, -0.007280116435140371, -0.01109440065920353, 0.05026378110051155, 0.04814201220870018, -0.058404602110385895, 0.02719365991652012, -0.007405317388474941, -0.0034483270719647408, 0.024964263662695885, -0.009944407269358635, 0.002557412488386035, 0.1031469851732254, -0.0042458404786884785, -0.017746953293681145, -0.04170827195048332, -0.02619806118309498, 0.0036032991483807564, -0.03925929591059685, 0.08759259432554245, -0.03929990530014038, 0.018901167437434196, 0.029279913753271103, -0.13159437477588654, -0.03340228646993637, 0.017294105142354965, -0.009084412828087807, -0.09391006827354431, 0.049207765609025955, 0.09503334760665894, 0.02284984663128853, 0.012626576237380505, 0.03376457095146179, -0.05022362992167473, 0.037024833261966705, 0.0018444720190018415, -0.024499865248799324, 0.08143068850040436, -0.01812605746090412, -0.009195303544402122, -0.01782110333442688, 0.036796510219573975, -0.04397282004356384, 0.058190617710351944, -0.011311089619994164, 0.08946589380502701, 0.07032813876867294, 0.07866951078176498, -0.01765868067741394, 0.11064153909683228, 0.004342933651059866, -0.014716323465108871, -0.010135194286704063, -0.02969295345246792, 0.010404945351183414, 0.03788891062140465, 0.010752514004707336, -0.03602002188563347, 0.09382307529449463, 0.04158879071474075, -0.010005325078964233, 0.061437997967004776, 0.025946661829948425, -0.04992474243044853, -0.058215752243995667, 0.019372638314962387, -0.05774369463324547, -0.05232245475053787, 0.08251956105232239, -0.031551070511341095, 0.061082202941179276, -0.01902325265109539, -0.10078877955675125, -1.9000668646172377e-33, -0.03884461149573326, -0.044806722551584244, -0.01198620069772005, 0.0624082088470459, -0.032952554523944855, -0.023112649098038673, 0.015514090657234192, 0.024211734533309937, -0.02248278632760048, 0.014529320411384106, 0.02539544552564621, 0.016559703275561333, 0.10614396631717682, -0.06609136611223221, 0.049262069165706635, -0.08908160030841827, -0.06611478328704834, 0.027876054868102074, 0.045293208211660385, -0.00236103730276227, -0.002771941712126136, 0.02836987003684044, 0.04790204018354416, 0.023947428911924362, 0.06053737550973892, 0.05422772094607353, -0.10051580518484116, 0.003077586879953742, -0.03309016302227974, 0.0067349812015891075, 0.03810878470540047, 0.03142182528972626, -0.1005895733833313, -0.0525781624019146, -0.002380768535658717, 0.01961335353553295, -0.012726843357086182, 0.08712548017501831, -0.02054835483431816, 0.048900213092565536, 0.05201366916298866, -0.04618846997618675, 0.0739787146449089, -0.0008464907296001911, 0.012847570702433586, 0.005364680662751198, -0.012989000417292118, 0.021611664444208145, 0.0693395733833313, -0.01383194699883461, 0.02430231310427189, 0.004966343753039837, -0.06309603154659271, 0.029190702363848686, 0.08672508597373962, -0.0416850820183754, -0.05168819800019264, -0.00838675070554018, 0.07493198662996292, -0.11690953373908997, -0.022110605612397194, 0.00900166667997837, 0.04328767582774162, -0.07721948623657227, -0.024971507489681244, -0.057190585881471634, -0.08499754220247269, -0.09251164644956589, 0.035247351974248886, 0.0014629383804276586, 0.02779228612780571, -0.02805958315730095, -0.038290075957775116, 0.036440249532461166, -0.05790445953607559, 0.05612790212035179, -0.04109163582324982, 0.042449962347745895, 0.034735411405563354, 0.1282915323972702, -0.07364030182361603, 0.039183635264635086, -0.04013669490814209, 0.06428276002407074, 0.023964563384652138, -0.010880519635975361, 0.03666015341877937, 0.09687391668558121, -0.057138700038194656, -0.015564569272100925, -0.01239573024213314, 0.12242721766233444, -0.06855200231075287, 0.09622781723737717, 0.05584411695599556, -5.8248097900559515e-8, 0.028096549212932587, -0.0880647525191307, -0.10602986812591553, 0.008251041173934937, 0.04436551406979561, -0.037635866552591324, 0.014757368713617325, -0.026417644694447517, 0.010911611840128899, -0.05866978317499161, 0.0627659410238266, -0.006193774752318859, -0.032135289162397385, -0.07550269365310669, 0.015892792493104935, -0.04288189485669136, -0.00034249600139446557, -0.09813041239976883, -0.04845954105257988, -0.14322711527347565, -0.026305031031370163, -0.02087794430553913, -0.031094031408429146, 0.004136683419346809, -0.065944604575634, 0.016395393759012222, 0.03874564915895462, 0.03111163340508938, -0.04513167962431908, -0.036435458809137344, 0.0796278640627861, -0.027183925732970238, -0.015466246753931046, 0.05654069036245346, 0.0207339059561491, 0.044818129390478134, -0.06102169677615166, 0.08074432611465454, 0.07907672971487045, 0.02588753215968609, 0.02762993797659874, -0.024081910029053688, -0.012918244116008282, 0.027732815593481064, -0.009849736467003822, -0.059937916696071625, -0.010820189490914345, 0.06875137984752655, -0.06385856121778488, 0.01350095123052597, -0.022666122764348984, -0.08165132999420166, 0.027056682854890823, -0.009399143047630787, 0.1018524244427681, -0.006872586905956268, -0.03424658253788948, -0.05274810269474983, -0.00021348462905734777, 0.04981277510523796, 0.06964679807424545, -0.04460970684885979, -0.029613735154271126, 0.004691231995820999 ]
0.037691
bytes. \* `mode` {string} The cipher mode. One of `'cbc'`, `'ccm'`, `'cfb'`, `'ctr'`, `'ecb'`, `'gcm'`, `'ocb'`, `'ofb'`, `'stream'`, `'wrap'`, `'xts'`. Returns information about a given cipher. Some ciphers accept variable length keys and initialization vectors. By default, the `crypto.getCipherInfo()` method will return the default values for these ciphers. To test if a given key length or iv length is acceptable for given cipher, use the `keyLength` and `ivLength` options. If the given values are unacceptable, `undefined` will be returned. ### `crypto.getCiphers()` \* Returns: {string\[]} An array with the names of the supported cipher algorithms. ```mjs const { getCiphers, } = await import('node:crypto'); console.log(getCiphers()); // ['aes-128-cbc', 'aes-128-ccm', ...] ``` ```cjs const { getCiphers, } = require('node:crypto'); console.log(getCiphers()); // ['aes-128-cbc', 'aes-128-ccm', ...] ``` ### `crypto.getCurves()` \* Returns: {string\[]} An array with the names of the supported elliptic curves. ```mjs const { getCurves, } = await import('node:crypto'); console.log(getCurves()); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] ``` ```cjs const { getCurves, } = require('node:crypto'); console.log(getCurves()); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] ``` ### `crypto.getDiffieHellman(groupName)` \* `groupName` {string} \* Returns: {DiffieHellmanGroup} Creates a predefined `DiffieHellmanGroup` key exchange object. The supported groups are listed in the documentation for [`DiffieHellmanGroup`][]. The returned object mimics the interface of objects created by [`crypto.createDiffieHellman()`][], but will not allow changing the keys (with [`diffieHellman.setPublicKey()`][], for example). The advantage of using this method is that the parties do not have to generate nor exchange a group modulus beforehand, saving both processor and communication time. Example (obtaining a shared secret): ```mjs const { getDiffieHellman, } = await import('node:crypto'); const alice = getDiffieHellman('modp14'); const bob = getDiffieHellman('modp14'); alice.generateKeys(); bob.generateKeys(); const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); /\* aliceSecret and bobSecret should be the same \*/ console.log(aliceSecret === bobSecret); ``` ```cjs const { getDiffieHellman, } = require('node:crypto'); const alice = getDiffieHellman('modp14'); const bob = getDiffieHellman('modp14'); alice.generateKeys(); bob.generateKeys(); const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); /\* aliceSecret and bobSecret should be the same \*/ console.log(aliceSecret === bobSecret); ``` ### `crypto.getFips()` \* Returns: {number} `1` if and only if a FIPS compliant crypto provider is currently in use, `0` otherwise. A future semver-major release may change the return type of this API to a {boolean}. ### `crypto.getHashes()` \* Returns: {string\[]} An array of the names of the supported hash algorithms, such as `'RSA-SHA256'`. Hash algorithms are also called "digest" algorithms. ```mjs const { getHashes, } = await import('node:crypto'); console.log(getHashes()); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...] ``` ```cjs const { getHashes, } = require('node:crypto'); console.log(getHashes()); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...] ``` ### `crypto.getRandomValues(typedArray)` \* `typedArray` {Buffer|TypedArray|DataView|ArrayBuffer} \* Returns: {Buffer|TypedArray|DataView|ArrayBuffer} Returns `typedArray`. A convenient alias for [`crypto.webcrypto.getRandomValues()`][]. This implementation is not compliant with the Web Crypto spec, to write web-compatible code use [`crypto.webcrypto.getRandomValues()`][] instead. ### `crypto.hash(algorithm, data[, options])` \* `algorithm` {string|undefined} \* `data` {string|Buffer|TypedArray|DataView} When `data` is a string, it will be encoded as UTF-8 before being hashed. If a different input encoding is desired for a string input, user could encode the string into a `TypedArray` using either `TextEncoder` or `Buffer.from()` and passing the encoded `TypedArray` into this API instead. \* `options` {Object|string} \* `outputEncoding` {string} [Encoding][encoding] used to encode the returned digest. \*\*Default:\*\* `'hex'`. \* `outputLength` {number} For XOF hash functions such as 'shake256', the outputLength option can be used to specify the desired output length in bytes. \* Returns: {string|Buffer} A utility for creating one-shot hash digests of data. It can be faster than the object-based `crypto.createHash()` when hashing a smaller amount of data (<= 5MB) that's readily available. If the data can be big or if it is streamed, it's still recommended to use `crypto.createHash()` instead. The `algorithm` is dependent on
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.025946633890271187, 0.04059765115380287, -0.046159300953149796, 0.026355022564530373, -0.014029673300683498, -0.05807088315486908, -0.012583165429532528, 0.09801077097654343, -0.045731160789728165, -0.08245528489351273, -0.019977878779172897, -0.04574388265609741, 0.023030174896121025, 0.04820100590586662, -0.025208741426467896, -0.08842253684997559, -0.04911080747842789, 0.014733746647834778, -0.0009016346884891391, -0.02009819820523262, 0.03726299852132797, -0.051729295402765274, 0.0171428881585598, -0.028760429471731186, -0.045801933854818344, -0.006455731578171253, 0.008190015330910683, 0.0345410592854023, 0.023659128695726395, 0.004571897443383932, 0.046937476843595505, -0.007589958608150482, 0.04083763808012009, 0.031023580580949783, 0.00027671491261571646, 0.03206395357847214, 0.021294495090842247, -0.13076961040496826, -0.01403236947953701, -0.010359050706028938, -0.005611730273813009, 0.047337450087070465, 0.02229173108935356, 0.029510295018553734, 0.05742891877889633, 0.05380089581012726, -0.06024722382426262, 0.04470697045326233, -0.08709993958473206, -0.01732647977769375, 0.005648292135447264, -0.005362195894122124, -0.09490462392568588, 0.097232885658741, 0.0073236399330198765, -0.07135722041130066, -0.12434369325637817, -0.005482623819261789, 0.07247485965490341, -0.005109368357807398, -0.04366271197795868, -0.009715425781905651, 0.022321732714772224, 0.07516415417194366, -0.02378108911216259, 0.07806872576475143, -0.002069737995043397, -0.026675205677747726, -0.03623896464705467, 0.016881894320249557, -0.04937782138586044, -0.022675897926092148, -0.06311079859733582, 0.12196046113967896, -0.036630019545555115, 0.02792494371533394, 0.003473716089501977, -0.01011865958571434, -0.027293700724840164, 0.056295834481716156, -0.08254176378250122, -0.10976090282201767, 0.01657266542315483, 0.07699495553970337, 0.04135078564286232, 0.05007893592119217, -0.02025182731449604, 0.04860658943653107, -0.002549914177507162, 0.12399457395076752, 0.022565843537449837, -0.045122429728507996, -0.055929768830537796, 0.08765146136283875, 0.035018082708120346, 0.012020785361528397, 0.09229260683059692, -0.010061587207019329, -0.05026814341545105, -0.013347652740776539, -0.03168046846985817, -0.06476941704750061, 0.040506988763809204, 0.0067329080775380135, 0.0753803625702858, 0.04361473768949509, 0.04220205172896385, -0.032996464520692825, 0.03985141962766647, 0.01591799221932888, 0.011373918503522873, 0.07318957895040512, -0.01825581304728985, -0.04819810763001442, 0.07600181549787521, 0.023029232397675514, -0.025033093988895416, 0.003056690562516451, 0.026662766933441162, 0.15831659734249115, 0.06765724718570709, -0.01051570475101471, -0.019523490220308304, -0.005572750698775053, -0.05106645077466965, -0.019053520634770393, 0.040902528911828995, 3.6577762205621116e-33, -0.09221219271421432, -0.02775486558675766, 0.06629791855812073, 0.07543537765741348, -0.03199869021773338, 0.07024616748094559, 0.013093835674226284, 0.08099428564310074, -0.07971986383199692, 0.012670960277318954, -0.07714329659938812, 0.08746369183063507, -0.019963175058364868, 0.01168777421116829, 0.02215277962386608, -0.004914724733680487, 0.11145398020744324, -0.05890120938420296, 0.012867661193013191, 0.016888249665498734, 0.029541533440351486, -0.050176504999399185, 0.06806563585996628, -0.013170700520277023, 0.0417843721807003, -0.045329585671424866, -0.03794731944799423, -0.05236306041479111, -0.06293506920337677, -0.02154882624745369, -0.07287061959505081, -0.002285788068547845, -0.0534854531288147, 0.04313671961426735, -0.0007188083836808801, -0.01514800637960434, -0.007979568094015121, 0.025942398235201836, -0.1268865019083023, -0.05349346622824669, -0.02165701426565647, -0.037948910146951675, -0.024477940052747726, -0.009780950844287872, -0.02671223320066929, -0.06899508833885193, -0.0071481456980109215, -0.10740362852811813, 0.03557118400931358, 0.03241831809282303, 0.025645079091191292, 0.07412762194871902, -0.1041334867477417, -0.02523690275847912, 0.06222251430153847, -0.012932590208947659, 0.06600486487150192, 0.032323434948921204, -0.05460560321807861, -0.0015982979675754905, 0.030834315344691277, 0.013535742647945881, 0.03638739138841629, -0.020432021468877792, -0.016625629737973213, 0.06789108365774155, -0.0512419268488884, -0.06529229879379272, -0.05110909417271614, -0.020504724234342575, -0.03673465549945831, -0.03690481185913086, 0.06140052154660225, 0.018147550523281097, -0.028049277141690254, 0.003084489842876792, -0.0583680123090744, -0.06410286575555801, -0.011905240826308727, -0.08841422200202942, 0.08367172628641129, 0.0228903666138649, 0.05442299693822861, 0.05663731321692467, -0.004028161522001028, 0.034037768840789795, 0.037803467363119125, -0.016712727025151253, 0.05457628145813942, -0.015708239749073982, 0.003494812874123454, -0.051944900304079056, -0.0011166422627866268, -0.11361932754516602, -0.07224147021770477, -5.534217852779729e-33, 0.02772228606045246, 0.03381466865539551, -0.03528385981917381, 0.05178498476743698, -0.05338810756802559, -0.04567146301269531, 0.007067761849611998, 0.10344935208559036, 0.0862509161233902, -0.06515979766845703, 0.04844285175204277, -0.02944888174533844, 0.04614672809839249, 0.007789997383952141, 0.05834591016173363, 0.0602978877723217, -0.09820288419723511, -0.025619899854063988, 0.03532940894365311, -0.04432423412799835, -0.04177379980683327, -0.07101315259933472, -0.027745122089982033, 0.02005838043987751, -0.012186034582555294, 0.058915574103593826, 0.031316112726926804, -0.04086453095078468, -0.018642034381628036, -0.04349173977971077, -0.04994775354862213, 0.06342252343893051, -0.013727385550737381, 0.06737721711397171, -0.020153900608420372, -0.08930269628763199, 0.04475143924355507, 0.10214962065219879, 0.035436954349279404, 0.03163633868098259, 0.062482792884111404, 0.045462727546691895, 0.015603406354784966, 0.021439900621771812, -0.03388744220137596, 0.012100690975785255, 0.0430288091301918, 0.07390379160642624, 0.06853293627500534, 0.011315718293190002, 0.01902921497821808, -0.06683599948883057, 0.008581948466598988, 0.0510663241147995, 0.010692735202610493, -0.020465461537241936, -0.06582062691450119, -0.01677827350795269, 0.06245442107319832, -0.050603121519088745, 0.005368879530578852, -0.04370690509676933, 0.0032542040571570396, -0.036443233489990234, 0.008146627806127071, -0.0006511377869173884, -0.15420962870121002, 0.00759386969730258, -0.04308858513832092, 0.011578068137168884, 0.04827849566936493, -0.03479351848363876, 0.01316832285374403, -0.06298167258501053, -0.03831934928894043, -0.012937262654304504, -0.041574157774448395, -0.08158908784389496, 0.037145573645830154, 0.03140051290392876, 0.024695904925465584, 0.07583723217248917, -0.015965694561600685, 0.07866362482309341, 0.007916800677776337, -0.018230628222227097, 0.11648070067167282, -0.00869471300393343, -0.033521998673677444, -0.001018386916257441, -0.017238924279808998, 0.07623904943466187, -0.05918499454855919, 0.008489997126162052, 0.11559807509183884, -5.384516299500319e-8, -0.056077368557453156, -0.059431012719869614, -0.16360795497894287, 0.007057178299874067, 0.04263593256473541, 0.04572172462940216, -0.03388001769781113, -0.1008492261171341, 0.06356361508369446, -0.016476619988679886, 0.07992484420537949, -0.043053045868873596, -0.002856526290997863, -0.017476331442594528, -0.04837211221456528, 0.013544101268053055, -0.09383102506399155, -0.06918303668498993, 0.017497098073363304, 0.014580287039279938, 0.023829903453588486, -0.021516185253858566, 0.0029732019174844027, 0.04027427360415459, 0.022508280351758003, -0.015138914808630943, -0.022370286285877228, 0.04171798750758171, -0.02718646638095379, 0.052684929221868515, -0.04804889112710953, 0.018310004845261574, 0.07139335572719574, -0.043823543936014175, -0.05093540623784065, 0.030792756006121635, -0.059653084725141525, -0.036687687039375305, 0.0725124254822731, 0.11154160648584366, 0.02868637442588806, -0.026355672627687454, -0.043552253395318985, 0.011453290469944477, -0.07131839543581009, -0.025497563183307648, 0.07215356826782227, 0.0376778170466423, -0.029599763453006744, -0.022861292585730553, 0.046869050711393356, 0.003204864449799061, -0.05362047627568245, -0.008822877891361713, -0.029489198699593544, 0.03960500285029411, -0.03214924782514572, 0.002946158405393362, -0.05427752435207367, -0.02053895592689514, -0.041613854467868805, 0.025845453143119812, 0.05188049376010895, -0.07817790657281876 ]
0.016074
for creating one-shot hash digests of data. It can be faster than the object-based `crypto.createHash()` when hashing a smaller amount of data (<= 5MB) that's readily available. If the data can be big or if it is streamed, it's still recommended to use `crypto.createHash()` instead. The `algorithm` is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. On recent releases of OpenSSL, `openssl list -digest-algorithms` will display the available digest algorithms. If `options` is a string, then it specifies the `outputEncoding`. Example: ```cjs const crypto = require('node:crypto'); const { Buffer } = require('node:buffer'); // Hashing a string and return the result as a hex-encoded string. const string = 'Node.js'; // 10b3493287f831e81a438811a1ffba01f8cec4b7 console.log(crypto.hash('sha1', string)); // Encode a base64-encoded string into a Buffer, hash it and return // the result as a buffer. const base64 = 'Tm9kZS5qcw=='; // console.log(crypto.hash('sha1', Buffer.from(base64, 'base64'), 'buffer')); ``` ```mjs import crypto from 'node:crypto'; import { Buffer } from 'node:buffer'; // Hashing a string and return the result as a hex-encoded string. const string = 'Node.js'; // 10b3493287f831e81a438811a1ffba01f8cec4b7 console.log(crypto.hash('sha1', string)); // Encode a base64-encoded string into a Buffer, hash it and return // the result as a buffer. const base64 = 'Tm9kZS5qcw=='; // console.log(crypto.hash('sha1', Buffer.from(base64, 'base64'), 'buffer')); ``` ### `crypto.hkdf(digest, ikm, salt, info, keylen, callback)` \* `digest` {string} The digest algorithm to use. \* `ikm` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject} The input keying material. Must be provided but can be zero-length. \* `salt` {string|ArrayBuffer|Buffer|TypedArray|DataView} The salt value. Must be provided but can be zero-length. \* `info` {string|ArrayBuffer|Buffer|TypedArray|DataView} Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes. \* `keylen` {number} The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512` generates 64-byte hashes, making the maximum HKDF output 16320 bytes). \* `callback` {Function} \* `err` {Error} \* `derivedKey` {ArrayBuffer} HKDF is a simple key derivation function defined in RFC 5869. The given `ikm`, `salt` and `info` are used with the `digest` to derive a key of `keylen` bytes. The supplied `callback` function is called with two arguments: `err` and `derivedKey`. If an errors occurs while deriving the key, `err` will be set; otherwise `err` will be `null`. The successfully generated `derivedKey` will be passed to the callback as an {ArrayBuffer}. An error will be thrown if any of the input arguments specify invalid values or types. ```mjs import { Buffer } from 'node:buffer'; const { hkdf, } = await import('node:crypto'); hkdf('sha512', 'key', 'salt', 'info', 64, (err, derivedKey) => { if (err) throw err; console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653' }); ``` ```cjs const { hkdf, } = require('node:crypto'); const { Buffer } = require('node:buffer'); hkdf('sha512', 'key', 'salt', 'info', 64, (err, derivedKey) => { if (err) throw err; console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653' }); ``` ### `crypto.hkdfSync(digest, ikm, salt, info, keylen)` \* `digest` {string} The digest algorithm to use. \* `ikm` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject} The input keying material. Must be provided but can be zero-length. \* `salt` {string|ArrayBuffer|Buffer|TypedArray|DataView} The salt value. Must be provided but can be zero-length. \* `info` {string|ArrayBuffer|Buffer|TypedArray|DataView} Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes. \* `keylen` {number} The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512` generates 64-byte hashes, making the maximum HKDF output 16320 bytes). \* Returns: {ArrayBuffer} Provides a synchronous HKDF key derivation function as defined in RFC 5869. The given `ikm`, `salt` and
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ 0.041376251727342606, 0.0742773488163948, -0.0526127889752388, 0.006245656404644251, 0.06809690594673157, -0.07166074216365814, -0.06431582570075989, 0.02118673361837864, 0.06516380608081818, -0.013623165898025036, -0.0590713769197464, 0.057508766651153564, -0.022610139101743698, -0.026516547426581383, -0.013316337950527668, -0.0577208437025547, 0.01812431402504444, 0.06359076499938965, -0.040882013738155365, -0.10261034965515137, 0.03203919902443886, -0.12310799211263657, 0.029084108769893646, -0.05909698083996773, 0.028252363204956055, -0.012762174941599369, 0.0018372770864516497, 0.03704226016998291, 0.0048680962063372135, -0.05409323796629906, 0.08088190853595734, -0.023036019876599312, -0.0110984668135643, 0.007148474920541048, -0.09949524700641632, 0.10508222877979279, 0.03754887357354164, -0.00888080894947052, -0.0355573445558548, -0.06234382465481758, 0.005882666911929846, 0.053435955196619034, -0.08878177404403687, -0.011994150467216969, -0.10421892255544662, 0.026790257543325424, -0.027797728776931763, 0.01137559488415718, -0.031779564917087555, -0.06727012991905212, -0.03380259871482849, -0.025142570957541466, -0.009043578989803791, 0.03293570131063461, -0.03866402804851532, -0.0467909537255764, -0.14598755538463593, -0.057675596326589584, -0.04613226652145386, -0.02020142786204815, -0.09224780648946762, -0.030512087047100067, 0.07044507563114166, 0.060811545699834824, 0.12393705546855927, 0.006003980059176683, 0.0701531320810318, -0.03288786858320236, 0.005657012574374676, 0.02539953403174877, -0.01237260177731514, 0.034299757331609726, -0.024931056424975395, 0.09883509576320648, -0.05644823610782623, 0.022762367501854897, -0.021056460216641426, -0.012402412481606007, -0.04367057606577873, 0.00860283151268959, -0.04152141883969307, -0.015470686368644238, -0.024742525070905685, 0.03857302665710449, -0.021017426624894142, 0.03892374411225319, -0.026267480105161667, 0.04781954735517502, -0.01847180165350437, 0.05106445774435997, -0.00946011207997799, 0.028347233310341835, -0.021969811990857124, -0.05311897397041321, 0.09411022812128067, 0.02965548075735569, 0.027323532849550247, 0.04831487312912941, -0.005391889251768589, -0.02902788110077381, 0.002395542338490486, 0.023556027561426163, 0.072867251932621, -0.04756375402212143, 0.06410335004329681, 0.012960268184542656, 0.008070344105362892, 0.023230228573083878, -0.04371558502316475, 0.040487226098775864, 0.06507264077663422, 0.06299575418233871, 0.002229296136647463, -0.1148948073387146, -0.03590218350291252, 0.06154383718967438, -0.04719552397727966, -0.07192736119031906, -0.024345174431800842, 0.08781266212463379, 0.04504189267754555, -0.00193926936481148, -0.0218964833766222, -0.022245317697525024, 0.0007887633400969207, -0.03247644752264023, -0.03474893420934677, 2.2065132827598156e-33, -0.011627168394625187, 0.028031829744577408, 0.054102543741464615, -0.02100120671093464, -0.041761867702007294, 0.04417361319065094, 0.020763222128152847, 0.03545311838388443, -0.042359139770269394, 0.045592959970235825, -0.06668950617313385, -0.02637610025703907, 0.025852283462882042, -0.053015612065792084, 0.09987513720989227, -0.01904015988111496, 0.014974788762629032, 0.003187036607414484, -0.04124273359775543, 0.058501482009887695, 0.015328816138207912, -0.02324019744992256, 0.042692434042692184, -0.03295116499066353, 0.008155698888003826, 0.0062962607480585575, 0.03506737947463989, -0.06465607136487961, -0.041116952896118164, -0.0346410758793354, 0.008115937002003193, 0.06466422975063324, -0.008392786607146263, 0.017131272703409195, 0.11584220826625824, -0.008174375630915165, 0.014294332824647427, 0.0027714241296052933, -0.027869222685694695, -0.04686269909143448, 0.10007744282484055, 0.030616212636232376, -0.006529468577355146, -0.005768227390944958, -0.048907943069934845, -0.03867688402533531, -0.1444343477487564, -0.013121596537530422, 0.06350621581077576, 0.034547317773103714, 0.1165543645620346, 0.09291239827871323, -0.03784870728850365, 0.0032722356263548136, 0.07495510578155518, -0.05694519355893135, 0.07650357484817505, -0.10040885955095291, -0.04783766716718674, 0.07042902708053589, -0.017497271299362183, -0.011644906364381313, -0.02048330195248127, 0.009036344476044178, 0.0041982922703027725, 0.022280795499682426, 0.0237315334379673, 0.038491230458021164, 0.005063198506832123, 0.054480377584695816, -0.07115650177001953, 0.004650171380490065, -0.004629759583622217, -0.024123406037688255, 0.020230630412697792, 0.04508128762245178, -0.04090777039527893, -0.03363283723592758, 0.05570085346698761, 0.019501185044646263, 0.060707733035087585, 0.021847447380423546, -0.03596093878149986, 0.04671485349535942, 0.005052154418081045, 0.00571776507422328, -0.05288570374250412, -0.057466618716716766, -0.038577232509851456, -0.011935948394238949, -0.03530837967991829, 0.02184964530169964, -0.03059675730764866, -0.07772878557443619, -0.05895177647471428, -4.354231644169362e-33, 0.03211510553956032, -0.08073044568300247, -0.03558449074625969, 0.1512959897518158, 0.03546988591551781, 0.005711978767067194, -0.027680976316332817, 0.006055435631424189, 0.011893169023096561, 0.0031135829631239176, -0.01401410810649395, 0.014691755175590515, 0.06673318892717361, -0.015744773671030998, 0.060618314892053604, -0.004304576199501753, -0.041704390197992325, -0.021874165162444115, 0.030225731432437897, -0.04393479600548744, -0.06857245415449142, 0.06303007900714874, 0.09644357115030289, 0.0019312656950205564, 0.07629072666168213, 0.03641781583428383, 0.03028753772377968, -0.034325405955314636, 0.014050755649805069, -0.03742598742246628, -0.06251724064350128, 0.05662136897444725, 0.004728351254016161, -0.024731742218136787, -0.023524601012468338, -0.04616044461727142, 0.023721814155578613, 0.07226964831352234, 0.05133703351020813, 0.05264046788215637, 0.014399678446352482, -0.01861296407878399, -0.003904889337718487, -0.009995692409574986, -0.02432776428759098, -0.038769226521253586, -0.06414715945720673, 0.0960758775472641, 0.041496314108371735, 0.05677272006869316, 0.06475231796503067, -0.014963898807764053, -0.06040583550930023, 0.009736327454447746, 0.11033785343170166, -0.02880755066871643, -0.09592495113611221, -0.007444842718541622, 0.007085050921887159, 0.014843902550637722, -0.03985834866762161, 0.02001858316361904, -0.013749239034950733, 0.023928605020046234, -0.01060284674167633, 0.03129565343260765, -0.11302971839904785, -0.08555056154727936, -0.01230270229279995, 0.034791700541973114, -0.0925670936703682, -0.053041793406009674, -0.011231382377445698, 0.012042371556162834, 0.024933217093348503, -0.019625844433903694, -0.015452269464731216, -0.031006354838609695, 0.07018956542015076, 0.07650483399629593, -0.05614127218723297, 0.06871446222066879, -0.042744506150484085, 0.0686396062374115, 0.14421796798706055, -0.04045697674155235, -0.07289949804544449, -0.052734311670064926, -0.01616959273815155, 0.03215933218598366, 0.015377103351056576, 0.09065251797437668, -0.08290019631385803, 0.03521920368075371, 0.012533393688499928, -5.715122242122561e-8, -0.03684739023447037, -0.06534209102392197, -0.05880008637905121, 0.014246905222535133, 0.060066547244787216, 0.027296483516693115, -0.03280745819211006, -0.04892687872052193, 0.021357450634241104, -0.02610781043767929, 0.11698592454195023, -0.008310260251164436, -0.01625474914908409, -0.06227472424507141, 0.03934977576136589, 0.016686715185642242, -0.06365029513835907, -0.06742049008607864, -0.04265018552541733, -0.06114618852734566, -0.004226691089570522, 0.002884942339733243, -0.09855260699987411, 0.040331289172172546, 0.0064747813157737255, -0.024034854024648666, 0.049769096076488495, 0.019683359190821648, -0.05663976073265076, -0.04209639132022858, -0.04014184698462486, -0.01757611706852913, 0.03480365127325058, -0.024264859035611153, 0.07723523676395416, 0.019527992233633995, -0.1326695680618286, -0.00770100113004446, 0.09914213418960571, 0.02813846431672573, 0.023619821295142174, 0.08122067898511887, 0.010536286048591137, 0.008845869451761246, -0.08068513125181198, 0.022851286455988884, -0.0004266074683982879, 0.08783961832523346, -0.0742870569229126, 0.041956402361392975, -0.04509416222572327, -0.001250057015568018, -0.010628726333379745, -0.0315859317779541, -0.009464091621339321, 0.021363429725170135, 0.061948295682668686, -0.11843769997358322, 0.07070695608854294, -0.021552613005042076, 0.10796796530485153, -0.07556614279747009, 0.0637509822845459, -0.0010984482942149043 ]
-0.001181
0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512` generates 64-byte hashes, making the maximum HKDF output 16320 bytes). \* Returns: {ArrayBuffer} Provides a synchronous HKDF key derivation function as defined in RFC 5869. The given `ikm`, `salt` and `info` are used with the `digest` to derive a key of `keylen` bytes. The successfully generated `derivedKey` will be returned as an {ArrayBuffer}. An error will be thrown if any of the input arguments specify invalid values or types, or if the derived key cannot be generated. ```mjs import { Buffer } from 'node:buffer'; const { hkdfSync, } = await import('node:crypto'); const derivedKey = hkdfSync('sha512', 'key', 'salt', 'info', 64); console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653' ``` ```cjs const { hkdfSync, } = require('node:crypto'); const { Buffer } = require('node:buffer'); const derivedKey = hkdfSync('sha512', 'key', 'salt', 'info', 64); console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653' ``` ### `crypto.pbkdf2(password, salt, iterations, keylen, digest, callback)` \* `password` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `salt` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `iterations` {number} \* `keylen` {number} \* `digest` {string} \* `callback` {Function} \* `err` {Error} \* `derivedKey` {Buffer} Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) implementation. A selected HMAC digest algorithm specified by `digest` is applied to derive a key of the requested byte length (`keylen`) from the `password`, `salt` and `iterations`. The supplied `callback` function is called with two arguments: `err` and `derivedKey`. If an error occurs while deriving the key, `err` will be set; otherwise `err` will be `null`. By default, the successfully generated `derivedKey` will be passed to the callback as a [`Buffer`][]. An error will be thrown if any of the input arguments specify invalid values or types. The `iterations` argument must be a number set as high as possible. The higher the number of iterations, the more secure the derived key will be, but will take a longer amount of time to complete. The `salt` should be as unique as possible. It is recommended that a salt is random and at least 16 bytes long. See [NIST SP 800-132][] for details. When passing strings for `password` or `salt`, please consider [caveats when using strings as inputs to cryptographic APIs][]. ```mjs const { pbkdf2, } = await import('node:crypto'); pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => { if (err) throw err; console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' }); ``` ```cjs const { pbkdf2, } = require('node:crypto'); pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => { if (err) throw err; console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' }); ``` An array of supported digest functions can be retrieved using [`crypto.getHashes()`][]. This API uses libuv's threadpool, which can have surprising and negative performance implications for some applications; see the [`UV\_THREADPOOL\_SIZE`][] documentation for more information. ### `crypto.pbkdf2Sync(password, salt, iterations, keylen, digest)` \* `password` {string|Buffer|TypedArray|DataView} \* `salt` {string|Buffer|TypedArray|DataView} \* `iterations` {number} \* `keylen` {number} \* `digest` {string} \* Returns: {Buffer} Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) implementation. A selected HMAC digest algorithm specified by `digest` is applied to derive a key of the requested byte length (`keylen`) from the `password`, `salt` and `iterations`. If an error occurs an `Error` will be thrown, otherwise the derived key will be returned as a [`Buffer`][]. The `iterations` argument must be a number set as high as possible. The higher the number of iterations, the more secure the derived key will be, but will take a longer amount of time to complete. The `salt` should be as unique as possible. It is recommended that a salt is random and at least 16 bytes long. See [NIST SP 800-132][] for details. When passing strings for `password` or `salt`, please consider [caveats when using strings as inputs
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ 0.033764682710170746, 0.004171136766672134, -0.06276016682386398, -0.07524372637271881, -0.053166113793849945, -0.04928140714764595, 0.024144969880580902, 0.035068292170763016, -0.056819427758455276, -0.018727177754044533, -0.004189835861325264, -0.005396879743784666, 0.104511559009552, -0.08005088567733765, -0.0122038833796978, -0.010327791795134544, 0.02533474750816822, 0.040282536298036575, -0.10056817531585693, -0.025365129113197327, 0.11262527108192444, -0.0777716189622879, 0.03663640096783638, -0.12297498434782028, -0.04731732979416847, 0.001889060833491385, 0.03379896283149719, 0.04881492629647255, 0.09091343730688095, -0.045795589685440063, 0.03323028236627579, -0.016115354374051094, 0.0020493892952799797, -0.003796616103500128, -0.025409724563360214, 0.07381857186555862, -0.03589996322989464, -0.03629651665687561, -0.001491017173975706, 0.020549524575471878, 0.023117244243621826, 0.05090707913041115, -0.00024942849995568395, 0.010114421136677265, 0.06100241839885712, 0.040650706738233566, -0.05877044424414635, -0.04352850094437599, -0.07267681509256363, 0.06985624134540558, -0.04004469886422157, 0.10650825500488281, -0.0052113900892436504, 0.0022061867639422417, 0.03951594978570938, -0.09076453000307083, -0.11161093413829803, 0.05451848357915878, -0.006368759088218212, -0.014034157618880272, -0.05754910409450531, -0.049930792301893234, 0.07515279948711395, -0.02167726308107376, 0.1008545458316803, 0.01024613343179226, 0.01069597341120243, -0.11488709598779678, 0.013910193927586079, -0.00786296185106039, -0.06957706809043884, -0.037667110562324524, -0.04854884371161461, 0.03317422419786453, 0.0062383986078202724, 0.025208430364727974, -0.032584529370069504, -0.01586039736866951, -0.008259138092398643, -0.04587208479642868, -0.038460761308670044, -0.0013116443296894431, 0.04549456387758255, -0.053706347942352295, 0.028777796775102615, 0.05035945773124695, -0.0551060326397419, 0.0810203030705452, 0.04400201886892319, 0.12341007590293884, -0.0412696935236454, -0.014121394604444504, -0.030809586867690086, 0.0298139825463295, 0.05989529564976692, 0.028029808774590492, 0.0018838937394320965, -0.013646957464516163, -0.008292748592793941, 0.04456004127860069, -0.037047021090984344, 0.034473717212677, -0.02697036787867546, -0.06327003985643387, 0.08231795579195023, -0.02638367749750614, -0.007556982804089785, 0.025921471416950226, -0.03448318690061569, 0.07311264425516129, 0.05297907069325447, 0.06233688443899155, -0.009492330253124237, -0.09260452538728714, 0.014390712603926659, 0.055155374109745026, 0.048203106969594955, -0.006010308396071196, 0.033581677824258804, 0.03138013184070587, 0.031212974339723587, -0.05085259675979614, 0.012248963117599487, 0.03161747008562088, -0.10344485193490982, -0.019343046471476555, -0.06150645762681961, 3.3334213296557486e-33, -0.08892541378736496, -0.009751544333994389, 0.07025595009326935, 0.019939720630645752, -0.05242982134222984, -0.0052506569772958755, 0.04112634435296059, 0.003043593605980277, -0.10326388478279114, -0.07364104688167572, -0.04747915640473366, 0.012301485054194927, 0.006938199978321791, -0.0405455157160759, 0.07206989079713821, -0.00408859783783555, 0.09290578961372375, 0.03238183632493019, 0.04430384933948517, -0.017166169360280037, 0.029928244650363922, 0.02768995426595211, 0.04084957391023636, -0.07102873176336288, -0.04387233778834343, 0.002744739642366767, 0.07330533862113953, -0.010108459740877151, -0.011150650680065155, 0.01297648623585701, -0.039333391934633255, -0.023018404841423035, 0.016470182687044144, -0.05059221386909485, 0.03661220148205757, -0.011046347208321095, -0.028068983927369118, 0.024306587874889374, -0.048822659999132156, -0.04891751706600189, 0.007362549193203449, -0.03844761848449707, 0.05230177193880081, 0.046966325491666794, -0.0730273574590683, -0.03169579431414604, -0.019678708165884018, -0.07085387408733368, 0.0033771416638046503, 0.039742812514305115, -0.029239492490887642, 0.04169665649533272, -0.026861051097512245, 0.024909421801567078, 0.04830379784107208, -0.10525635629892349, 0.02204090543091297, -0.017309777438640594, -0.03826816752552986, 0.12516847252845764, -0.026912976056337357, 0.029384858906269073, 0.025452813133597374, 0.07029853016138077, -0.03540627285838127, -0.016927164047956467, -0.03563178703188896, 0.0066553037613630295, 0.013749169185757637, 0.004163728095591068, 0.006543407216668129, 0.0023977584205567837, 0.03875013068318367, -0.013565322384238243, -0.09405692666769028, -0.01655404269695282, 0.02249838411808014, 0.0016845453064888716, 0.02042643539607525, -0.032053377479314804, 0.04802672192454338, 0.08674657344818115, -0.027770400047302246, 0.02147422358393669, -0.07828924059867859, 0.02157900109887123, -0.08695686608552933, -0.03013394959270954, 0.011610240675508976, -0.008425653912127018, -0.019529998302459717, -0.05352497845888138, -0.0244072787463665, -0.10867749899625778, -0.0932140126824379, -4.385572527614192e-33, 0.03054819442331791, 0.03614587336778641, -0.09241930395364761, 0.07814840972423553, -0.07456734031438828, -0.03969263285398483, 0.028297169134020805, 0.06631200015544891, -0.06211104243993759, -0.06005498394370079, 0.03587701916694641, 0.02393615059554577, 0.16171623766422272, -0.011958356015384197, -0.014908247627317905, -0.05181246995925903, -0.04004679247736931, 0.04498651251196861, 0.048142388463020325, -0.020019646733999252, -0.015392357483506203, 0.01088295504450798, 0.028086602687835693, 0.11447427421808243, -0.06444955617189407, 0.12581071257591248, -0.03494270518422127, 0.08035724610090256, -0.0329413004219532, -0.01541062816977501, -0.006040393840521574, 0.05337490141391754, -0.11900188773870468, 0.03795742988586426, -0.04448547214269638, -0.1199660673737526, 0.025398455560207367, 0.08426573127508163, 0.008212372660636902, 0.06950923800468445, 0.02800758183002472, -0.018518952652812004, 0.01182980090379715, 0.02881290391087532, 0.021548470482230186, -0.001108613796532154, 0.08979462832212448, 0.029655545949935913, 0.11116411536931992, -0.042106084525585175, 0.05753055214881897, -0.0661979466676712, 0.003712427569553256, 0.05216267704963684, -0.04056895896792412, 0.026084918528795242, -0.009840965270996094, 0.04750102013349533, 0.06974491477012634, 0.02248476818203926, 0.006771774031221867, -0.01380080170929432, 0.05570826306939125, 0.006149191875010729, -0.017550546675920486, 0.026173848658800125, -0.011947929859161377, -0.04392759129405022, -0.009386301040649414, 0.019973378628492355, 0.028880061581730843, -0.006995631381869316, 0.067811980843544, -0.014897635206580162, 0.01690177246928215, -0.002662998391315341, 0.0026948668528348207, -0.038318246603012085, 0.011815839447081089, 0.013219120912253857, -0.07355976104736328, 0.10547652095556259, -0.00689125107601285, 0.09730273485183716, 0.0915696993470192, -0.13077257573604584, 0.016161708161234856, -0.03753004968166351, -0.015604224987328053, -0.06627126783132553, -0.022868316620588303, 0.029329126700758934, -0.13199123740196228, -0.034347426146268845, 0.012639056891202927, -5.2560906738108315e-8, -0.030041061341762543, 0.010483399964869022, -0.11113504320383072, -0.006321879103779793, 0.031880687922239304, 0.039028558880090714, -0.07146137207746506, -0.09274911135435104, 0.05487225204706192, -0.030972573906183243, 0.09542425721883774, -0.02291371114552021, -0.06004592031240463, 0.001253735856153071, 0.029347214847803116, 0.05254035443067551, -0.06987790018320084, -0.016381677240133286, -0.022832943126559258, -0.07906807214021683, -0.028905116021633148, -0.01937362179160118, -0.009256541728973389, -0.019799182191491127, -0.001960486639291048, -0.0052131544798612595, 0.042056310921907425, 0.05400022491812706, 0.007126940414309502, -0.03127218410372734, -0.04458005726337433, -0.018568972125649452, 0.019017325714230537, 0.020422259345650673, 0.0023851271253079176, 0.01165247056633234, -0.04858202859759331, 0.031806934624910355, 0.05526311323046684, 0.0961979404091835, -0.00840841606259346, -0.02407262474298477, -0.04054800048470497, 0.0576254278421402, -0.04909252002835274, 0.07232469320297241, -0.04198726266622543, 0.08563034236431122, -0.08202891051769257, 0.026107333600521088, 0.00485251285135746, 0.04167718067765236, 0.00521427346393466, -0.03312915563583374, -0.0432477742433548, -0.00888324249535799, -0.07375067472457886, -0.03812795132398605, 0.026664946228265762, 0.03848925605416298, 0.09498116374015808, 0.039475053548812866, 0.05546669661998749, -0.0001425031223334372 ]
0.028654
a longer amount of time to complete. The `salt` should be as unique as possible. It is recommended that a salt is random and at least 16 bytes long. See [NIST SP 800-132][] for details. When passing strings for `password` or `salt`, please consider [caveats when using strings as inputs to cryptographic APIs][]. ```mjs const { pbkdf2Sync, } = await import('node:crypto'); const key = pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512'); console.log(key.toString('hex')); // '3745e48...08d59ae' ``` ```cjs const { pbkdf2Sync, } = require('node:crypto'); const key = pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512'); console.log(key.toString('hex')); // '3745e48...08d59ae' ``` An array of supported digest functions can be retrieved using [`crypto.getHashes()`][]. ### `crypto.privateDecrypt(privateKey, buffer)` \* `privateKey` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey} \* `oaepHash` {string} The hash function to use for OAEP padding and MGF1. \*\*Default:\*\* `'sha1'` \* `oaepLabel` {string|ArrayBuffer|Buffer|TypedArray|DataView} The label to use for OAEP padding. If not specified, no label is used. \* `padding` {crypto.constants} An optional padding value defined in `crypto.constants`, which may be: `crypto.constants.RSA\_NO\_PADDING`, `crypto.constants.RSA\_PKCS1\_PADDING`, or `crypto.constants.RSA\_PKCS1\_OAEP\_PADDING`. \* `buffer` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* Returns: {Buffer} A new `Buffer` with the decrypted content. Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using the corresponding public key, for example using [`crypto.publicEncrypt()`][]. If `privateKey` is not a [`KeyObject`][], this function behaves as if `privateKey` had been passed to [`crypto.createPrivateKey()`][]. If it is an object, the `padding` property can be passed. Otherwise, this function uses `RSA\_PKCS1\_OAEP\_PADDING`. Using `crypto.constants.RSA\_PKCS1\_PADDING` in [`crypto.privateDecrypt()`][] requires OpenSSL to support implicit rejection (`rsa\_pkcs1\_implicit\_rejection`). If the version of OpenSSL used by Node.js does not support this feature, attempting to use `RSA\_PKCS1\_PADDING` will fail. ### `crypto.privateEncrypt(privateKey, buffer)` \* `privateKey` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey} \* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey} A PEM encoded private key. \* `passphrase` {string|ArrayBuffer|Buffer|TypedArray|DataView} An optional passphrase for the private key. \* `padding` {crypto.constants} An optional padding value defined in `crypto.constants`, which may be: `crypto.constants.RSA\_NO\_PADDING` or `crypto.constants.RSA\_PKCS1\_PADDING`. \* `encoding` {string} The string encoding to use when `buffer`, `key`, or `passphrase` are strings. \* `buffer` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* Returns: {Buffer} A new `Buffer` with the encrypted content. Encrypts `buffer` with `privateKey`. The returned data can be decrypted using the corresponding public key, for example using [`crypto.publicDecrypt()`][]. If `privateKey` is not a [`KeyObject`][], this function behaves as if `privateKey` had been passed to [`crypto.createPrivateKey()`][]. If it is an object, the `padding` property can be passed. Otherwise, this function uses `RSA\_PKCS1\_PADDING`. ### `crypto.publicDecrypt(key, buffer)` \* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey} \* `passphrase` {string|ArrayBuffer|Buffer|TypedArray|DataView} An optional passphrase for the private key. \* `padding` {crypto.constants} An optional padding value defined in `crypto.constants`, which may be: `crypto.constants.RSA\_NO\_PADDING` or `crypto.constants.RSA\_PKCS1\_PADDING`. \* `encoding` {string} The string encoding to use when `buffer`, `key`, or `passphrase` are strings. \* `buffer` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* Returns: {Buffer} A new `Buffer` with the decrypted content. Decrypts `buffer` with `key`.`buffer` was previously encrypted using the corresponding private key, for example using [`crypto.privateEncrypt()`][]. If `key` is not a [`KeyObject`][], this function behaves as if `key` had been passed to [`crypto.createPublicKey()`][]. If it is an object, the `padding` property can be passed. Otherwise, this function uses `RSA\_PKCS1\_PADDING`. Because RSA public keys can be derived from private keys, a private key may be passed instead of a public key. ### `crypto.publicEncrypt(key, buffer)` \* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey} \* `key` {string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey} A PEM encoded public or private key, {KeyObject}, or {CryptoKey}. \* `oaepHash` {string} The hash function to use for OAEP padding and MGF1. \*\*Default:\*\* `'sha1'` \* `oaepLabel` {string|ArrayBuffer|Buffer|TypedArray|DataView} The label to use for OAEP padding. If not specified, no label is used. \* `passphrase` {string|ArrayBuffer|Buffer|TypedArray|DataView} An optional passphrase for the private key. \* `padding` {crypto.constants} An optional padding value defined in `crypto.constants`, which may be: `crypto.constants.RSA\_NO\_PADDING`, `crypto.constants.RSA\_PKCS1\_PADDING`, or `crypto.constants.RSA\_PKCS1\_OAEP\_PADDING`. \* `encoding` {string} The string encoding to use when `buffer`, `key`, `oaepLabel`, or `passphrase` are strings. \* `buffer` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* Returns:
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.0618564672768116, 0.0213087759912014, -0.0409122072160244, -0.027260078117251396, -0.04182910546660423, -0.03597377985715866, 0.016518963500857353, 0.05085226893424988, 0.01348412036895752, -0.08446306735277176, -0.04048626497387886, -0.011498288251459599, 0.08641905337572098, -0.011319846846163273, 0.00030678807524964213, 1.1389005294404342e-7, -0.09144943952560425, 0.027240470051765442, -0.03209485486149788, -0.08797410875558853, 0.06692159175872803, -0.09504176676273346, 0.04416671022772789, -0.07211407274007797, -0.024678535759449005, 0.044183503836393356, 0.07744208723306656, 0.04934303089976311, -0.0045320275239646435, -0.017881376668810844, 0.07821014523506165, 0.012333954684436321, -0.042356863617897034, -0.015124459750950336, -0.04445745795965195, 0.14833849668502808, -0.09488079696893692, -0.0672682523727417, -0.02680327743291855, -0.06462355703115463, 0.006678581703454256, 0.03863847255706787, -0.030053436756134033, 0.08403821289539337, 0.03279731050133705, 0.04124405235052109, -0.030973635613918304, 0.018034467473626137, 0.05135446786880493, -0.029569117352366447, -0.02015850692987442, -0.024639049544930458, -0.02618800289928913, -0.0112917460501194, -0.03171856328845024, 0.018969738855957985, -0.10089266300201416, 0.005203894805163145, 0.046176619827747345, -0.03180108591914177, 0.010741292499005795, 0.03188240900635719, 0.08530331403017044, 0.03931305557489395, 0.11270958930253983, 0.028857368975877762, 0.003940241411328316, -0.04940379410982132, 0.012305205687880516, -0.021451834589242935, -0.041886333376169205, 0.05933603271842003, -0.06450869888067245, 0.07345874607563019, -0.008886739611625671, -0.040782440453767776, -0.034869302064180374, -0.03329956904053688, -0.06114750728011131, 0.03881131857633591, -0.05794750154018402, -0.04155635088682175, 0.021873891353607178, 0.06695400923490524, 0.04654306545853615, 0.0704067125916481, 0.00782659649848938, 0.014620272442698479, -0.02671441249549389, 0.013565408065915108, 0.024494240060448647, -0.04688122496008873, -0.04406328126788139, 0.022918136790394783, 0.0037992217112332582, 0.09258300065994263, -0.00011736428859876469, 0.052254389971494675, -0.11482587456703186, 0.04697386920452118, -0.02254442684352398, 0.001246160943992436, -0.03179335594177246, -0.07249253988265991, 0.12092577666044235, 0.010117588564753532, 0.03413398936390877, -0.016124535351991653, -0.02872573211789131, 0.04018322750926018, 0.03763596713542938, 0.06497950106859207, -0.048063766211271286, -0.027360063046216965, 0.017292240634560585, 0.15274858474731445, 0.055495742708444595, -0.025864651426672935, 0.016100971028208733, 0.10839468985795975, 0.06671068072319031, 0.048541080206632614, -0.028868921101093292, 0.020431911572813988, -0.03771422430872917, -0.010589612647891045, -0.0015796851366758347, 5.8504996688898355e-33, -0.06425376981496811, 0.01673292927443981, 0.042486466467380524, 0.05418471619486809, -0.046017419546842575, -0.0069931368343532085, 0.06765536963939667, -0.004045122303068638, -0.10488654673099518, -0.025000283494591713, -0.12481921911239624, 0.017636772245168686, 0.014420581050217152, -0.09123904258012772, -0.028544075787067413, -0.09254728257656097, 0.13756443560123444, -0.03914317861199379, 0.04666250944137573, -0.032790351659059525, 0.04913170263171196, 0.01086864061653614, 0.09826042503118515, -0.010954136960208416, 0.0018375683575868607, -0.011885014362633228, 0.03714130446314812, -0.02034030109643936, 0.07717587053775787, -0.014144085347652435, 0.029768455773591995, -0.02821759134531021, -0.07110688090324402, 0.04386536031961441, 0.012507893145084381, -0.038398951292037964, 0.013250071555376053, -0.009572370909154415, -0.06614033132791519, -0.11271009594202042, -0.02105075865983963, 0.008110661059617996, -0.007093499414622784, 0.0011477143270894885, -0.04114454612135887, -0.033065132796764374, -0.01202323753386736, -0.05006619915366173, 0.06876412034034729, 0.04111010953783989, -0.029371848329901695, 0.07161206007003784, -0.07043729722499847, -0.024755671620368958, -0.003263586899265647, -0.04873122647404671, 0.08688993006944656, -0.05607810989022255, -0.07267162203788757, 0.029936855658888817, 0.046601515263319016, 0.021948086097836494, -0.020035071298480034, 0.039706189185380936, 0.005590655840933323, 0.01761605776846409, -0.0285811647772789, 0.019431274384260178, -0.006032266654074192, 0.03290489688515663, -0.04009804129600525, -0.014091065153479576, 0.03880440071225166, 0.025161150842905045, -0.052439216524362564, 0.005605924874544144, -0.024527406319975853, -0.03458559513092041, -0.02324303239583969, -0.03670690208673477, 0.1049264445900917, -0.01759251579642296, -0.06249690428376198, 0.0818248838186264, -0.009830333292484283, 0.06105400249361992, -0.007471099961549044, -0.050429221242666245, -0.007951033301651478, 0.008625997230410576, -0.0003968118689954281, -0.007190141826868057, 0.042065978050231934, -0.16990171372890472, -0.0811934694647789, -7.038593482443015e-33, -0.0013081597862765193, -0.0005430763121694326, -0.005294984672218561, 0.10523218661546707, 0.053344786167144775, -0.027621738612651825, -0.0066416701301932335, 0.04210082069039345, -0.05144013464450836, 0.031602729111909866, -0.025452781468629837, -0.007391245104372501, 0.10924414545297623, -0.05524841323494911, 0.04122382402420044, 0.01755325123667717, -0.026399150490760803, 0.12946753203868866, 0.017801698297262192, -0.028648193925619125, -0.08167051523923874, 0.13607890903949738, -0.0329575315117836, 0.03789777308702469, -0.055351827293634415, 0.0768866166472435, -0.0018083632458001375, 0.04693423956632614, -0.03664550185203552, 0.01697908341884613, -0.05645674094557762, 0.09032487869262695, -0.078474260866642, 0.01033926010131836, -0.07260364294052124, -0.10981413722038269, 0.030865546315908432, 0.038359977304935455, -0.000022036807422409765, -0.0074440534226596355, 0.056549474596977234, -0.0556672178208828, -0.05089714005589485, -0.027576254680752754, -0.00479687936604023, -0.007505979388952255, -0.019155649468302727, 0.036144454032182693, 0.0517091266810894, 0.01813560351729393, -0.021541211754083633, -0.039223283529281616, -0.0503188781440258, -0.005939788185060024, 0.018229736015200615, 0.012943523935973644, -0.07901003956794739, 0.010700105689466, 0.08143313974142075, -0.0021634141448885202, -0.021079139783978462, -0.062289901077747345, 0.06913585215806961, -0.039478033781051636, 0.00345622724853456, -0.0414494052529335, -0.06878606975078583, 0.013416281901299953, 0.009832421317696571, 0.036826252937316895, 0.0033568264916539192, 0.04200688749551773, 0.046038903295993805, 0.00956498272716999, 0.02193388342857361, -0.06577594578266144, -0.027101919054985046, 0.00645041698589921, 0.063742995262146, 0.022532833740115166, 0.0056643313728272915, 0.0774298682808876, -0.036235664039850235, 0.0720348134636879, 0.07122306525707245, -0.09795571118593216, 0.07654029875993729, -0.0029044519178569317, -0.01972651481628418, -0.06292019784450531, -0.005398155655711889, 0.06993120908737183, -0.04690171778202057, 0.05275120586156845, 0.09624438732862473, -5.065380648261453e-8, 0.0494036041200161, 0.0246494822204113, -0.0792904645204544, 0.01804572343826294, 0.034005507826805115, 0.04370902478694916, -0.06718303263187408, -0.09001664817333221, -0.0049948133528232574, -0.013291455805301666, 0.04960871860384941, -0.010163823142647743, 0.00944159459322691, -0.01073121465742588, -0.07132332772016525, 0.05099821835756302, -0.08125367760658264, -0.02410145103931427, -0.013218034990131855, -0.058585308492183685, 0.023534255102276802, -0.01749686896800995, -0.046543147414922714, 0.015994520857930183, 0.04700244963169098, -0.026447758078575134, 0.029935210943222046, 0.08750950545072556, -0.004483604803681374, -0.008951420895755291, -0.08778956532478333, -0.05273744836449623, 0.03458113595843315, -0.08311471343040466, -0.039315108209848404, 0.03600294888019562, -0.06299366801977158, -0.00552787771448493, 0.10531121492385864, 0.044865913689136505, -0.0208465326577425, 0.0029671750962734222, -0.008592663332819939, 0.05405201017856598, -0.08260072767734528, -0.011507263407111168, 0.024192141368985176, 0.0451541505753994, -0.01455548033118248, 0.0036387406289577484, 0.029227348044514656, -0.0010260376147925854, -0.01637718454003334, -0.03134609013795853, 0.0008931233896873891, 0.07058048993349075, -0.0587913952767849, -0.06976331770420074, -0.01766582578420639, -0.01702648214995861, 0.047724608331918716, -0.024591613560914993, -0.04514719918370247, -0.04446101561188698 ]
0.00548
is used. \* `passphrase` {string|ArrayBuffer|Buffer|TypedArray|DataView} An optional passphrase for the private key. \* `padding` {crypto.constants} An optional padding value defined in `crypto.constants`, which may be: `crypto.constants.RSA\_NO\_PADDING`, `crypto.constants.RSA\_PKCS1\_PADDING`, or `crypto.constants.RSA\_PKCS1\_OAEP\_PADDING`. \* `encoding` {string} The string encoding to use when `buffer`, `key`, `oaepLabel`, or `passphrase` are strings. \* `buffer` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* Returns: {Buffer} A new `Buffer` with the encrypted content. Encrypts the content of `buffer` with `key` and returns a new [`Buffer`][] with encrypted content. The returned data can be decrypted using the corresponding private key, for example using [`crypto.privateDecrypt()`][]. If `key` is not a [`KeyObject`][], this function behaves as if `key` had been passed to [`crypto.createPublicKey()`][]. If it is an object, the `padding` property can be passed. Otherwise, this function uses `RSA\_PKCS1\_OAEP\_PADDING`. Because RSA public keys can be derived from private keys, a private key may be passed instead of a public key. ### `crypto.randomBytes(size[, callback])` \* `size` {number} The number of bytes to generate. The `size` must not be larger than `2\*\*31 - 1`. \* `callback` {Function} \* `err` {Error} \* `buf` {Buffer} \* Returns: {Buffer} if the `callback` function is not provided. Generates cryptographically strong pseudorandom data. The `size` argument is a number indicating the number of bytes to generate. If a `callback` function is provided, the bytes are generated asynchronously and the `callback` function is invoked with two arguments: `err` and `buf`. If an error occurs, `err` will be an `Error` object; otherwise it is `null`. The `buf` argument is a [`Buffer`][] containing the generated bytes. ```mjs // Asynchronous const { randomBytes, } = await import('node:crypto'); randomBytes(256, (err, buf) => { if (err) throw err; console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); }); ``` ```cjs // Asynchronous const { randomBytes, } = require('node:crypto'); randomBytes(256, (err, buf) => { if (err) throw err; console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); }); ``` If the `callback` function is not provided, the random bytes are generated synchronously and returned as a [`Buffer`][]. An error will be thrown if there is a problem generating the bytes. ```mjs // Synchronous const { randomBytes, } = await import('node:crypto'); const buf = randomBytes(256); console.log( `${buf.length} bytes of random data: ${buf.toString('hex')}`); ``` ```cjs // Synchronous const { randomBytes, } = require('node:crypto'); const buf = randomBytes(256); console.log( `${buf.length} bytes of random data: ${buf.toString('hex')}`); ``` The `crypto.randomBytes()` method will not complete until there is sufficient entropy available. This should normally never take longer than a few milliseconds. The only time when generating the random bytes may conceivably block for a longer period of time is right after boot, when the whole system is still low on entropy. This API uses libuv's threadpool, which can have surprising and negative performance implications for some applications; see the [`UV\_THREADPOOL\_SIZE`][] documentation for more information. The asynchronous version of `crypto.randomBytes()` is carried out in a single threadpool request. To minimize threadpool task length variation, partition large `randomBytes` requests when doing so as part of fulfilling a client request. ### `crypto.randomFill(buffer[, offset][, size], callback)` \* `buffer` {ArrayBuffer|Buffer|TypedArray|DataView} Must be supplied. The size of the provided `buffer` must not be larger than `2\*\*31 - 1`. \* `offset` {number} \*\*Default:\*\* `0` \* `size` {number} \*\*Default:\*\* `buffer.length - offset`. The `size` must not be larger than `2\*\*31 - 1`. \* `callback` {Function} `function(err, buf) {}`. This function is similar to [`crypto.randomBytes()`][] but requires the first argument to be a [`Buffer`][] that will be filled. It also requires that a callback is passed in. If the `callback` function is not provided, an error will be thrown. ```mjs import { Buffer } from 'node:buffer'; const { randomFill } = await import('node:crypto'); const buf = Buffer.alloc(10); randomFill(buf, (err, buf) => { if
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ 0.014121041633188725, 0.02330901473760605, -0.13229617476463318, 0.0000031853580821916694, -0.06705696135759354, -0.04802480712532997, 0.07599971443414688, 0.02709931693971157, 0.048012662678956985, -0.04517662897706032, -0.021768948063254356, -0.009050263091921806, 0.02730846032500267, -0.006555865053087473, 0.012331821955740452, 0.0012450605863705277, -0.04447093978524208, -0.003978305961936712, -0.0511426217854023, 0.038064144551754, 0.11569037288427353, -0.005611855071038008, 0.007995180785655975, -0.016479596495628357, -0.018253611400723457, 0.066607765853405, 0.05952044576406479, 0.0577198751270771, 0.023337578400969505, -0.0000026140560294152237, 0.036098677664995193, -0.015848394483327866, 0.07338850945234299, 0.06043136492371559, -0.03866951912641525, 0.0663406029343605, 0.033507391810417175, -0.06316160410642624, -0.05465233325958252, -0.018411919474601746, -0.005342533811926842, 0.030525464564561844, -0.14767611026763916, 0.054328709840774536, -0.046351589262485504, 0.003721203887835145, -0.030296215787529945, -0.019194716587662697, -0.0728960782289505, -0.049774572253227234, -0.03683540225028992, 0.01831756718456745, -0.044308215379714966, 0.07715991139411926, -0.01852651871740818, -0.05702570825815201, -0.06521496921777725, 0.04531356692314148, 0.006114067975431681, -0.025736479088664055, 0.01594213768839836, 0.014298690482974052, 0.05977228656411171, 0.11375534534454346, -0.030008047819137573, 0.04058745875954628, 0.029328379780054092, -0.006214312743395567, 0.06767690181732178, -0.061160169541835785, -0.1564600020647049, -0.012416179291903973, -0.03714589774608612, 0.011065136641263962, -0.004904600791633129, -0.001301201176829636, 0.026620475575327873, -0.029838472604751587, -0.034722164273262024, -0.0857420265674591, 0.007219979073852301, -0.08447469025850296, -0.01869700476527214, 0.0839635580778122, 0.02597176656126976, 0.11043912917375565, -0.029565777629613876, -0.0038841222412884235, 0.021907584741711617, 0.05474333092570305, 0.0703209787607193, -0.04222331941127777, -0.00739981047809124, 0.038538020104169846, 0.01997753605246544, -0.001202755724079907, 0.01452722493559122, -0.03304201737046242, -0.054529253393411636, -0.011482871137559414, -0.050510190427303314, 0.01868363283574581, 0.03712725639343262, -0.051355816423892975, -0.011100311763584614, -0.0006886274204589427, 0.046918876469135284, -0.06356395035982132, -0.042147424072027206, 0.031124869361519814, 0.005751961376518011, 0.04514143988490105, -0.041350189596414566, -0.0037157260812819004, -0.028024880215525627, 0.05078209191560745, -0.09212295711040497, 0.012429406866431236, 0.0342148132622242, 0.12090925127267838, 0.01886371150612831, -0.03044942021369934, -0.07582585513591766, 0.03650595247745514, -0.07684339582920074, -0.031210439279675484, -0.05513763800263405, 2.642267569241699e-33, 0.017587650567293167, -0.04416021332144737, -0.007246313150972128, -0.05065205693244934, -0.04696928709745407, -0.0003681858070194721, 0.04195868596434593, 0.033455703407526016, 0.007196163758635521, -0.007208820898085833, -0.01787625439465046, -0.06217600777745247, 0.03868973255157471, 0.025496995076537132, 0.014741310849785805, 0.035074736922979355, -0.003885004436597228, 0.009107377380132675, 0.0481339730322361, 0.035749174654483795, 0.056369323283433914, 0.1414947509765625, 0.032064422965049744, -0.04013543203473091, -0.021028617396950722, 0.04074280709028244, 0.016825906932353973, -0.07279304414987564, -0.017389990389347076, 0.010253913700580597, -0.011000002734363079, -0.03716244921088219, -0.013083811849355698, 0.008166255429387093, 0.06703205406665802, -0.013028877787292004, 0.07537795603275299, 0.003714729333296418, -0.03538644686341286, -0.03845540061593056, -0.006287525873631239, -0.036339640617370605, 0.01701091229915619, 0.032104071229696274, -0.004664634820073843, -0.11001968383789062, -0.0505538247525692, 0.053151167929172516, 0.014053062535822392, 0.05867315083742142, -0.03482503071427345, 0.03342694416642189, -0.08359363675117493, -0.023888830095529556, -0.01984170265495777, -0.12159015983343124, -0.023716207593679428, -0.025204505771398544, -0.03058455139398575, 0.02320614643394947, -0.09568238258361816, 0.0020195976831018925, 0.04291658103466034, -0.011082107201218605, -0.0005800663493573666, -0.023803016170859337, -0.002392958151176572, -0.04522328823804855, -0.029568834230303764, 0.02175907790660858, -0.103734590113163, 0.008016912266612053, -0.027299849316477776, 0.10064683109521866, -0.07416562736034393, 0.012947977520525455, -0.03774087876081467, -0.01552381832152605, 0.022490276023745537, -0.016626710072159767, 0.024016007781028748, 0.04425443708896637, -0.0011105412850156426, 0.03966604545712471, -0.09845191985368729, 0.02895359694957733, 0.034855518490076065, -0.07696114480495453, 0.00561580341309309, -0.06491117179393768, 0.00954759307205677, -0.05275942012667656, -0.006115917582064867, -0.12240155786275864, -0.016086740419268608, -5.3408633584068635e-33, 0.09356900304555893, 0.007347581442445517, -0.07747195661067963, 0.06610018759965897, -0.005603831261396408, 0.009493688121438026, 0.01770111173391342, 0.06444947421550751, 0.015607142820954323, -0.031548671424388885, -0.06570705026388168, 0.03366870433092117, 0.11358565092086792, -0.046407993882894516, 0.11035344749689102, 0.02866661176085472, -0.07773749530315399, 0.014796010218560696, 0.013446790166199207, -0.0337788462638855, -0.03683307766914368, 0.00196273485198617, 0.07161696255207062, 0.06779181957244873, 0.0620594322681427, -0.02198105864226818, 0.0060416157357394695, 0.04989488795399666, 0.007362247910350561, 0.0034642070531845093, 0.01080713327974081, 0.04615360498428345, -0.07013711333274841, -0.019666453823447227, -0.09398156404495239, -0.05677821487188339, 0.04235932603478432, -0.029858604073524475, 0.020784685388207436, 0.04992609843611717, 0.09336868673563004, -0.01078006811439991, 0.04177224263548851, -0.0033903070725500584, 0.006394048687070608, -0.01815701648592949, -0.027957597747445107, 0.043282195925712585, -0.019091172143816948, -0.08628465980291367, 0.07783107459545135, -0.008372658863663673, -0.04549592733383179, -0.004814927466213703, 0.08406200259923935, 0.05443158373236656, -0.021127590909600258, 0.06170571222901344, -0.03452889993786812, -0.015099908225238323, 0.02300940826535225, -0.023601988330483437, 0.05405354127287865, 0.0025275128427892923, -0.019324837252497673, -0.03915681317448616, -0.007749349344521761, -0.06692470610141754, -0.03239103779196739, 0.012205705046653748, 0.033692866563797, -0.049443889409303665, -0.010967210866510868, 0.024484163150191307, -0.015391511842608452, -0.030665457248687744, -0.03941725566983223, -0.07509031891822815, 0.02849321812391281, 0.08798293024301529, 0.009181910194456577, 0.01518410537391901, 0.06166538968682289, 0.09055571258068085, 0.09403853863477707, -0.03547893837094307, 0.014855253510177135, 0.007527076173573732, -0.09243390709161758, -0.020890073850750923, 0.011595780029892921, 0.03732333704829216, -0.07315157353878021, 0.10656914114952087, 0.11175563186407089, -4.544192933053637e-8, 0.007244339678436518, -0.10529369115829468, -0.07360455393791199, 0.008740813471376896, -0.0011963417055085301, -0.05108879506587982, -0.04417436197400093, -0.11075041443109512, -0.006027503404766321, -0.10597939789295197, 0.11067254841327667, -0.06683194637298584, -0.027465064078569412, -0.033381059765815735, -0.006853632628917694, 0.0705578476190567, -0.008758206851780415, -0.03730519860982895, -0.0262412428855896, -0.05404726043343544, 0.029753325507044792, -0.0719883143901825, -0.11972097307443619, -0.016751760616898537, 0.11136887222528458, 0.0765128955245018, -0.005777748301625252, 0.08972734212875366, 0.016555892303586006, -0.02769322693347931, 0.07846430689096451, -0.05735368654131889, 0.1352081596851349, -0.08062382787466049, -0.004368835128843784, 0.06201132386922836, -0.004571907222270966, -0.037787873297929764, 0.031865064054727554, 0.12645651400089264, 0.026095803827047348, -0.05143555998802185, -0.009060099720954895, 0.030803633853793144, -0.009496185928583145, 0.012805820442736149, 0.04541677236557007, 0.05445107817649841, -0.03468026965856552, -0.0018867689650505781, 0.028674626722931862, -0.034564848989248276, 0.0011400635121390224, 0.013417933136224747, -0.08461722731590271, 0.02181662991642952, -0.05134717747569084, -0.008907245472073555, 0.04244496300816536, -0.04502059519290924, 0.0304783396422863, 0.06010982394218445, 0.018042802810668945, -0.04018121585249901 ]
0.087725
[`Buffer`][] that will be filled. It also requires that a callback is passed in. If the `callback` function is not provided, an error will be thrown. ```mjs import { Buffer } from 'node:buffer'; const { randomFill } = await import('node:crypto'); const buf = Buffer.alloc(10); randomFill(buf, (err, buf) => { if (err) throw err; console.log(buf.toString('hex')); }); randomFill(buf, 5, (err, buf) => { if (err) throw err; console.log(buf.toString('hex')); }); // The above is equivalent to the following: randomFill(buf, 5, 5, (err, buf) => { if (err) throw err; console.log(buf.toString('hex')); }); ``` ```cjs const { randomFill } = require('node:crypto'); const { Buffer } = require('node:buffer'); const buf = Buffer.alloc(10); randomFill(buf, (err, buf) => { if (err) throw err; console.log(buf.toString('hex')); }); randomFill(buf, 5, (err, buf) => { if (err) throw err; console.log(buf.toString('hex')); }); // The above is equivalent to the following: randomFill(buf, 5, 5, (err, buf) => { if (err) throw err; console.log(buf.toString('hex')); }); ``` Any `ArrayBuffer`, `TypedArray`, or `DataView` instance may be passed as `buffer`. While this includes instances of `Float32Array` and `Float64Array`, this function should not be used to generate random floating-point numbers. The result may contain `+Infinity`, `-Infinity`, and `NaN`, and even if the array contains finite numbers only, they are not drawn from a uniform random distribution and have no meaningful lower or upper bounds. ```mjs import { Buffer } from 'node:buffer'; const { randomFill } = await import('node:crypto'); const a = new Uint32Array(10); randomFill(a, (err, buf) => { if (err) throw err; console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) .toString('hex')); }); const b = new DataView(new ArrayBuffer(10)); randomFill(b, (err, buf) => { if (err) throw err; console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) .toString('hex')); }); const c = new ArrayBuffer(10); randomFill(c, (err, buf) => { if (err) throw err; console.log(Buffer.from(buf).toString('hex')); }); ``` ```cjs const { randomFill } = require('node:crypto'); const { Buffer } = require('node:buffer'); const a = new Uint32Array(10); randomFill(a, (err, buf) => { if (err) throw err; console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) .toString('hex')); }); const b = new DataView(new ArrayBuffer(10)); randomFill(b, (err, buf) => { if (err) throw err; console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) .toString('hex')); }); const c = new ArrayBuffer(10); randomFill(c, (err, buf) => { if (err) throw err; console.log(Buffer.from(buf).toString('hex')); }); ``` This API uses libuv's threadpool, which can have surprising and negative performance implications for some applications; see the [`UV\_THREADPOOL\_SIZE`][] documentation for more information. The asynchronous version of `crypto.randomFill()` is carried out in a single threadpool request. To minimize threadpool task length variation, partition large `randomFill` requests when doing so as part of fulfilling a client request. ### `crypto.randomFillSync(buffer[, offset][, size])` \* `buffer` {ArrayBuffer|Buffer|TypedArray|DataView} Must be supplied. The size of the provided `buffer` must not be larger than `2\*\*31 - 1`. \* `offset` {number} \*\*Default:\*\* `0` \* `size` {number} \*\*Default:\*\* `buffer.length - offset`. The `size` must not be larger than `2\*\*31 - 1`. \* Returns: {ArrayBuffer|Buffer|TypedArray|DataView} The object passed as `buffer` argument. Synchronous version of [`crypto.randomFill()`][]. ```mjs import { Buffer } from 'node:buffer'; const { randomFillSync } = await import('node:crypto'); const buf = Buffer.alloc(10); console.log(randomFillSync(buf).toString('hex')); randomFillSync(buf, 5); console.log(buf.toString('hex')); // The above is equivalent to the following: randomFillSync(buf, 5, 5); console.log(buf.toString('hex')); ``` ```cjs const { randomFillSync } = require('node:crypto'); const { Buffer } = require('node:buffer'); const buf = Buffer.alloc(10); console.log(randomFillSync(buf).toString('hex')); randomFillSync(buf, 5); console.log(buf.toString('hex')); // The above is equivalent to the following: randomFillSync(buf, 5, 5); console.log(buf.toString('hex')); ``` Any `ArrayBuffer`, `TypedArray` or `DataView` instance may be passed as `buffer`. ```mjs import { Buffer } from 'node:buffer'; const { randomFillSync } = await import('node:crypto'); const a = new Uint32Array(10); console.log(Buffer.from(randomFillSync(a).buffer, a.byteOffset, a.byteLength).toString('hex')); const b = new DataView(new ArrayBuffer(10)); console.log(Buffer.from(randomFillSync(b).buffer, b.byteOffset, b.byteLength).toString('hex')); const c = new ArrayBuffer(10); console.log(Buffer.from(randomFillSync(c)).toString('hex')); ``` ```cjs const { randomFillSync } = require('node:crypto'); const { Buffer } = require('node:buffer');
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.012929873540997505, 0.04399850219488144, -0.06657688319683075, 0.002225371776148677, 0.012134887278079987, -0.0046921661123633385, 0.08758001029491425, 0.005992049816995859, 0.004263664595782757, -0.06427081674337387, -0.0883912667632103, -0.0211756844073534, 0.009718074463307858, -0.03607402741909027, 0.011627739295363426, -0.05913634970784187, -0.10124123841524124, 0.06275074183940887, -0.04628179222345352, -0.0742444172501564, 0.07492124289274216, -0.07390207797288895, 0.00968067068606615, -0.050719745457172394, -0.029098395258188248, -0.05985444784164429, 0.04930805787444115, -0.06617835909128189, 0.03845009580254555, -0.027407852932810783, 0.029028847813606262, 0.04422204941511154, -0.050460219383239746, -0.05599965900182724, -0.009870578534901142, 0.07653018832206726, -0.05805717408657074, -0.09822580218315125, -0.06162101775407791, -0.014130731113255024, 0.03603342920541763, 0.041632261127233505, -0.08417227864265442, 0.033472537994384766, 0.04765859991312027, -0.006334429606795311, -0.05158267170190811, 0.04788517579436302, 0.054172784090042114, -0.025275958701968193, 0.030116604641079903, -0.0009510453674010932, -0.06763295084238052, 0.01454936619848013, -0.046484991908073425, -0.008916938677430153, 0.0019236344378441572, -0.06413669884204865, 0.021745730191469193, -0.013852603733539581, 0.006091052666306496, -0.05248594284057617, 0.07180413603782654, 0.03144899010658264, 0.09060465544462204, 0.015882059931755066, -0.016465304419398308, 0.0839005783200264, -0.0007217001402750611, 0.0826394185423851, -0.0043389149941504, 0.0007572920294478536, -0.04870074614882469, 0.09546821564435959, 0.04276741296052933, 0.009552615694701672, -0.04908525571227074, -0.04362809285521507, -0.05022653192281723, 0.06507138907909393, -0.053039807826280594, -0.08081100136041641, 0.03959711641073227, 0.00038714607944712043, -0.01901054196059704, 0.10014864802360535, 0.01817675493657589, -0.025624746456742287, 0.013733766041696072, 0.01857108809053898, -0.03038099966943264, -0.011490851640701294, -0.09578438848257065, 0.0895032286643982, -0.019056331366300583, 0.03695289045572281, 0.06476692855358124, -0.020372452214360237, -0.046699512749910355, 0.004092310089617968, -0.014239158481359482, -0.03011051006615162, 0.0842989981174469, 0.00537100899964571, 0.03964092954993248, 0.050738513469696045, -0.01971379667520523, -0.05986756086349487, 0.0037132366560399532, -0.05712968111038208, -0.003074939828366041, 0.020801745355129242, 0.06901432573795319, 0.01924620382487774, -0.017113368958234787, 0.0289775263518095, -0.01696646399796009, -0.045023225247859955, -0.0021613133139908314, 0.07710076123476028, 0.06356066465377808, 0.09540360420942307, -0.05085192993283272, 0.009655451402068138, -0.035514332354068756, -0.09313035011291504, 0.08367351442575455, 3.469146111453598e-33, -0.010424907319247723, -0.06824291497468948, -0.006765529979020357, 0.07397078722715378, -0.01071152649819851, 0.007781693711876869, 0.08988841623067856, -0.02175348810851574, -0.06393375992774963, -0.04216941446065903, -0.0719163566827774, -0.06270422786474228, 0.02831185981631279, -0.05237097665667534, -0.05007762461900711, -0.08601590991020203, 0.10285793244838715, 0.00021955333068035543, 0.07960142940282822, 0.04217702895402908, 0.03512735664844513, 0.06961611658334732, 0.009877895936369896, -0.07722370326519012, 0.06445146352052689, -0.03379030153155327, -0.02924593724310398, -0.023649172857403755, 0.025103924795985222, 0.01638742722570896, 0.0244146641343832, 0.05869317799806595, 0.03166375681757927, 0.01432403177022934, 0.0072810351848602295, -0.012188144959509373, 0.03805140033364296, 0.052657123655080795, -0.16087433695793152, -0.12711460888385773, 0.05414484441280365, 0.04096514359116554, -0.0027869725599884987, 0.035746876150369644, -0.021778058260679245, -0.12482333183288574, 0.008181476034224033, -0.018290018662810326, 0.07134503126144409, 0.011153653264045715, 0.004548229277133942, 0.07261532545089722, -0.013423881493508816, 0.00573399942368269, 0.06676231324672699, -0.03147048130631447, 0.10090068727731705, -0.018715668469667435, -0.05563521385192871, 0.07001710683107376, 0.023440837860107422, 0.05617377161979675, -0.055012598633766174, 0.03587359935045242, -0.028786225244402885, 0.033976584672927856, -0.02580716833472252, -0.03471171483397484, -0.007039525546133518, -0.021145842969417572, -0.04741393402218819, 0.0111665278673172, -0.03600188344717026, 0.042629729956388474, -0.05345265939831734, 0.03404070809483528, -0.10015756636857986, -0.0007122264360077679, -0.03774849325418472, -0.10472923517227173, 0.07828791439533234, -0.02931363321840763, -0.028226036578416824, 0.023746183142066002, -0.03658324480056763, 0.06560380011796951, 0.025637105107307434, -0.0864233523607254, -0.007633574772626162, 0.044768091291189194, -0.014838322065770626, -0.03251928836107254, 0.05677580088376999, -0.08530031889677048, -0.051148101687431335, -5.734808249565875e-33, -0.03417936712503433, 0.018022315576672554, -0.00909427274018526, 0.14120402932167053, -0.013890109024941921, 0.021559642627835274, 0.02434256486594677, -0.001652558334171772, 0.032408855855464935, 0.022229013964533806, -0.04720167815685272, 0.07381191849708557, 0.09951748698949814, 0.0018442670116201043, 0.031003518030047417, 0.0011926271254196763, 0.0012391859199851751, 0.004718439187854528, -0.013198737055063248, -0.018138527870178223, -0.03390366584062576, -0.01702384278178215, 0.026393990963697433, 0.017792632803320885, -0.0333385169506073, 0.06431251764297485, -0.017922472208738327, 0.020022772252559662, 0.030307134613394737, -0.043328966945409775, -0.04243945702910423, -0.01096641831099987, -0.07917951792478561, 0.04092506319284439, 0.05234290659427643, -0.10168323665857315, 0.08423518389463425, 0.12365790456533432, 0.05070596933364868, -0.04861386865377426, 0.07274264097213745, -0.023711174726486206, -0.027441835030913353, -0.04898182675242424, 0.006419433280825615, -0.02228238806128502, -0.027070648968219757, 0.06667829304933548, 0.09528285264968872, 0.012810804881155491, -0.04874463751912117, -0.06139710545539856, -0.04489941522479057, 0.06074756011366844, -0.0178196020424366, 0.027798989787697792, -0.008408959954977036, 0.014701660722494125, 0.055252064019441605, 0.05050940811634064, -0.04622639715671539, -0.040574926882982254, 0.052585650235414505, -0.10122399032115936, 0.00839118380099535, -0.00929406750947237, -0.15456326305866241, -0.06547807902097702, 0.0741739571094513, 0.014782589860260487, 0.011463084258139133, 0.0920644998550415, -0.019590947777032852, 0.008082369342446327, 0.0161244235932827, -0.03503565117716789, -0.0231626033782959, -0.153931125998497, 0.058411870151758194, 0.058244481682777405, -0.0645996630191803, 0.055015455931425095, 0.0009604848455637693, 0.09349143505096436, 0.058896977454423904, 0.005037036258727312, 0.014423551969230175, -0.0763595923781395, 0.04361620545387268, -0.020139165222644806, 0.014645787887275219, 0.04226573184132576, -0.07054823637008667, -0.018366575241088867, 0.02057705447077751, -5.124433144487739e-8, -0.011618849821388721, -0.052351389080286026, -0.07200894504785538, 0.0012117385631427169, 0.0231446772813797, -0.05743464082479477, 0.012381668202579021, -0.13356077671051025, 0.05508078634738922, -0.04828968644142151, 0.020626476034522057, -0.04485362023115158, 0.014063114300370216, -0.059456393122673035, 0.013717235997319221, -0.0254107303917408, -0.07025784999132156, -0.035273272544145584, -0.0033472853247076273, -0.03525136411190033, 0.008846931159496307, -0.035331036895513535, -0.039391033351421356, 0.04337342083454132, 0.027295416221022606, -0.039246443659067154, 0.08959802240133286, 0.05399677902460098, 0.010888711549341679, 0.019388344138860703, -0.05115671083331108, -0.02883172035217285, 0.015931976959109306, 0.005214660428464413, -0.02876725234091282, 0.039573971182107925, 0.013802208937704563, -0.001784294261597097, 0.0669458881020546, 0.08352429419755936, 0.11717808991670609, -0.03166704624891281, 0.02071688510477543, 0.02862842194736004, -0.029001789167523384, -0.023243313655257225, 0.013852382078766823, 0.04897672310471535, 0.0384654626250267, -0.037661947309970856, -0.00946702528744936, -0.052890028804540634, -0.048414524644613266, -0.008729199878871441, 0.0032811439596116543, -0.033442821353673935, -0.03796316683292389, -0.06489426642656326, 0.01447509229183197, 0.04523400589823723, 0.003173952689394355, -0.013337216340005398, 0.0519469752907753, -0.02627631276845932 ]
0.077245
import { Buffer } from 'node:buffer'; const { randomFillSync } = await import('node:crypto'); const a = new Uint32Array(10); console.log(Buffer.from(randomFillSync(a).buffer, a.byteOffset, a.byteLength).toString('hex')); const b = new DataView(new ArrayBuffer(10)); console.log(Buffer.from(randomFillSync(b).buffer, b.byteOffset, b.byteLength).toString('hex')); const c = new ArrayBuffer(10); console.log(Buffer.from(randomFillSync(c)).toString('hex')); ``` ```cjs const { randomFillSync } = require('node:crypto'); const { Buffer } = require('node:buffer'); const a = new Uint32Array(10); console.log(Buffer.from(randomFillSync(a).buffer, a.byteOffset, a.byteLength).toString('hex')); const b = new DataView(new ArrayBuffer(10)); console.log(Buffer.from(randomFillSync(b).buffer, b.byteOffset, b.byteLength).toString('hex')); const c = new ArrayBuffer(10); console.log(Buffer.from(randomFillSync(c)).toString('hex')); ``` ### `crypto.randomInt([min, ]max[, callback])` \* `min` {integer} Start of random range (inclusive). \*\*Default:\*\* `0`. \* `max` {integer} End of random range (exclusive). \* `callback` {Function} `function(err, n) {}`. Return a random integer `n` such that `min <= n < max`. This implementation avoids [modulo bias][]. The range (`max - min`) must be less than 248. `min` and `max` must be [safe integers][]. If the `callback` function is not provided, the random integer is generated synchronously. ```mjs // Asynchronous const { randomInt, } = await import('node:crypto'); randomInt(3, (err, n) => { if (err) throw err; console.log(`Random number chosen from (0, 1, 2): ${n}`); }); ``` ```cjs // Asynchronous const { randomInt, } = require('node:crypto'); randomInt(3, (err, n) => { if (err) throw err; console.log(`Random number chosen from (0, 1, 2): ${n}`); }); ``` ```mjs // Synchronous const { randomInt, } = await import('node:crypto'); const n = randomInt(3); console.log(`Random number chosen from (0, 1, 2): ${n}`); ``` ```cjs // Synchronous const { randomInt, } = require('node:crypto'); const n = randomInt(3); console.log(`Random number chosen from (0, 1, 2): ${n}`); ``` ```mjs // With `min` argument const { randomInt, } = await import('node:crypto'); const n = randomInt(1, 7); console.log(`The dice rolled: ${n}`); ``` ```cjs // With `min` argument const { randomInt, } = require('node:crypto'); const n = randomInt(1, 7); console.log(`The dice rolled: ${n}`); ``` ### `crypto.randomUUID([options])` \* `options` {Object} \* `disableEntropyCache` {boolean} By default, to improve performance, Node.js generates and caches enough random data to generate up to 128 random UUIDs. To generate a UUID without using the cache, set `disableEntropyCache` to `true`. \*\*Default:\*\* `false`. \* Returns: {string} Generates a random [RFC 4122][] version 4 UUID. The UUID is generated using a cryptographic pseudorandom number generator. ### `crypto.scrypt(password, salt, keylen[, options], callback)` \* `password` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `salt` {string|ArrayBuffer|Buffer|TypedArray|DataView} \* `keylen` {number} \* `options` {Object} \* `cost` {number} CPU/memory cost parameter. Must be a power of two greater than one. \*\*Default:\*\* `16384`. \* `blockSize` {number} Block size parameter. \*\*Default:\*\* `8`. \* `parallelization` {number} Parallelization parameter. \*\*Default:\*\* `1`. \* `N` {number} Alias for `cost`. Only one of both may be specified. \* `r` {number} Alias for `blockSize`. Only one of both may be specified. \* `p` {number} Alias for `parallelization`. Only one of both may be specified. \* `maxmem` {number} Memory upper bound. It is an error when (approximately) `128 \* N \* r > maxmem`. \*\*Default:\*\* `32 \* 1024 \* 1024`. \* `callback` {Function} \* `err` {Error} \* `derivedKey` {Buffer} Provides an asynchronous [scrypt][] implementation. Scrypt is a password-based key derivation function that is designed to be expensive computationally and memory-wise in order to make brute-force attacks unrewarding. The `salt` should be as unique as possible. It is recommended that a salt is random and at least 16 bytes long. See [NIST SP 800-132][] for details. When passing strings for `password` or `salt`, please consider [caveats when using strings as inputs to cryptographic APIs][]. The `callback` function is called with two arguments: `err` and `derivedKey`. `err` is an exception object when key derivation fails, otherwise `err` is `null`. `derivedKey` is passed to the callback as a [`Buffer`][]. An exception is thrown when any of the input arguments specify invalid values or
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ 0.017657984048128128, 0.0174032561480999, -0.11335432529449463, -0.03208835795521736, -0.08032607287168503, -0.0343167707324028, 0.06465889513492584, -0.010668354108929634, -0.010465872474014759, -0.05548606067895889, -0.0353291891515255, -0.05021575465798378, -0.024753516539931297, -0.015491931699216366, -0.046804945915937424, -0.03729870915412903, -0.11651842296123505, 0.0009233969612978399, -0.06849419325590134, 0.010565255768597126, 0.03777293860912323, -0.07832203060388565, -0.03809959441423416, -0.08186134696006775, 0.05782352387905121, 0.00982374045997858, 0.08299054205417633, 0.027846969664096832, 0.022226175293326378, -0.022983510047197342, 0.11022152751684189, 0.009177204221487045, -0.017841601744294167, -0.02693750709295273, -0.03563477098941803, 0.04737969860434532, -0.012076130136847496, -0.1088746041059494, 0.004881804343312979, -0.0013795990962535143, 0.03147943690419197, 0.11343225091695786, -0.09621401876211166, 0.08503540605306625, 0.006326500792056322, 0.018857941031455994, -0.05232495069503784, 0.002507480327039957, 0.04233373701572418, -0.02308347448706627, -0.03267977759242058, 0.01347817201167345, -0.02147662080824375, 0.02244885265827179, -0.05211037024855614, -0.023848017677664757, -0.04478883370757103, 0.040351152420043945, 0.05000149458646774, 0.02598821371793747, 0.02488180808722973, -0.024634702131152153, 0.06825342029333115, 0.07814374566078186, 0.05486035346984863, -0.0019029754912480712, 0.03868182376027107, 0.03516087308526039, 0.0043434081599116325, 0.025100059807300568, -0.0489196702837944, 0.013621561229228973, 0.00034463993506506085, 0.0701480433344841, -0.00012124759814469144, -0.017197327688336372, -0.03046681359410286, -0.05932854115962982, -0.039972204715013504, -0.05142783373594284, -0.05605867877602577, -0.03763681277632713, 0.047411706298589706, 0.07879992574453354, 0.03721976652741432, 0.1310807466506958, -0.024331873282790184, 0.01814388670027256, -0.045844241976737976, 0.02738667093217373, -0.023950550705194473, 0.037980761379003525, -0.1259094923734665, 0.07026166468858719, 0.023061448708176613, -0.01410867739468813, 0.10262119024991989, 0.022802483290433884, -0.060947567224502563, 0.014588933438062668, -0.011848722584545612, -0.020861176773905754, -0.0020619025453925133, 0.06498580425977707, -0.032911382615566254, 0.007515109609812498, 0.01863391324877739, -0.02369401790201664, -0.09766243398189545, 0.002408150117844343, 0.021992752328515053, 0.11768389493227005, -0.006254350300878286, -0.020048024132847786, 0.015315934084355831, 0.03240219131112099, -0.07588210701942444, -0.015321627259254456, 0.0578802227973938, 0.044600531458854675, 0.01657184772193432, 0.02132268249988556, -0.056957513093948364, 0.051853690296411514, -0.046331197023391724, -0.05076313763856888, 0.03606795892119408, 5.8508141136286805e-33, -0.03947867453098297, -0.0640239343047142, -0.015575366094708443, -0.0023092261981219053, 0.00207741791382432, -0.009548473171889782, 0.05194546654820442, 0.03092094697058201, -0.08087847381830215, -0.008988316170871258, -0.10089865326881409, -0.08129257708787918, 0.042309779673814774, -0.05513198673725128, -0.01076443400233984, -0.06925193220376968, 0.07567811757326126, -0.00007695715612499043, 0.03110731765627861, 0.012305112555623055, 0.05402712523937225, 0.06398662179708481, 0.011703722178936005, -0.05638280138373375, -0.014637980610132217, -0.028600219637155533, 0.012754840776324272, -0.01364936213940382, 0.004282059613615274, 0.014369077049195766, 0.0059060812927782536, 0.03971342369914055, 0.06116185709834099, -0.0048307329416275024, 0.0333707295358181, -0.02764408104121685, 0.03224826231598854, 0.038182806223630905, -0.10918064415454865, -0.038298286497592926, 0.06286600232124329, 0.04433729872107506, 0.01636124961078167, -0.040321510285139084, -0.05026771500706673, -0.06875044107437134, -0.025486677885055542, -0.05222989618778229, 0.030500803142786026, -0.05532348155975342, -0.0019451038679108024, 0.060033828020095825, -0.0524233914911747, -0.039269719272851944, 0.0442020483314991, -0.058479759842157364, 0.0571121945977211, -0.011376837268471718, -0.014379658736288548, 0.12284228950738907, -0.053478412330150604, 0.03408454358577728, -0.04411487653851509, 0.045843519270420074, -0.03051542304456234, 0.04547823220491409, -0.0053621986880898476, -0.07503557205200195, -0.06598863005638123, 0.008804974146187305, -0.07456488162279129, 0.01589953899383545, 0.036299221217632294, 0.00587533600628376, -0.027591647580266, 0.08764887601137161, -0.1695970892906189, -0.0048380084335803986, -0.07284294068813324, -0.11694445461034775, 0.041839927434921265, -0.01699022762477398, 0.009016147814691067, 0.015910081565380096, -0.029350245371460915, -0.024258922785520554, 0.004886395297944546, -0.09514100849628448, -0.04160415753722191, 0.0534394271671772, -0.03965555131435394, -0.0367962047457695, 0.037437841296195984, -0.13184009492397308, -0.01626388356089592, -8.224954543854685e-33, -0.0353827029466629, 0.038052044808864594, -0.00003556476076482795, 0.07365339249372482, -0.002853915560990572, 0.04324384033679962, 0.016628624871373177, 0.039469391107559204, 0.03616566210985184, 0.024248095229268074, -0.02835705503821373, 0.06743112206459045, 0.06283431500196457, -0.008044223301112652, 0.03491993620991707, 0.0038033295422792435, 0.023801157251000404, 0.04755669832229614, 0.019422544166445732, -0.04992850124835968, -0.009873071685433388, 0.07782769948244095, 0.06136652082204819, 0.004030486568808556, 0.013631166890263557, 0.00492520909756422, 0.006651852745562792, 0.10095768421888351, 0.058484409004449844, -0.07298610359430313, -0.03960253298282623, -0.021794455125927925, -0.06244489178061485, 0.028778716921806335, 0.01863405667245388, -0.041130248457193375, 0.07869196683168411, 0.01623188890516758, 0.055771056562662125, -0.0008240905590355396, 0.07809548079967499, -0.061322182416915894, -0.03193102777004242, -0.0036315773613750935, 0.0664806216955185, -0.029085518792271614, -0.05263766273856163, 0.12514659762382507, 0.03548654168844223, -0.018721360713243484, -0.014089045114815235, 0.007859544828534126, -0.0491158664226532, 0.037803906947374344, 0.02688983455300331, 0.045903876423835754, 0.02775132842361927, -0.01664767414331436, 0.08769199252128601, 0.012241257354617119, -0.023367496207356453, -0.09742473065853119, 0.052710022777318954, -0.06222308799624443, 0.038780540227890015, 0.009169553406536579, -0.1224125474691391, -0.037086255848407745, 0.02825150452554226, 0.08249372243881226, -0.014464311301708221, 0.05820232629776001, -0.036047276109457016, 0.014209765940904617, -0.017816875129938126, -0.05355844274163246, -0.03920393064618111, -0.09446844458580017, 0.06128520891070366, 0.09660464525222778, -0.015045937150716782, 0.05730734393000603, 0.038557056337594986, 0.08935336768627167, 0.13418743014335632, 0.034898824989795685, 0.028293656185269356, -0.03277239948511124, -0.004118927754461765, -0.051624562591314316, 0.004093855153769255, 0.036657948046922684, -0.05184054747223854, 0.005227757152169943, 0.04440832510590553, -5.555688176173135e-8, -0.009692573919892311, -0.0819936990737915, -0.07866125553846359, 0.03785458579659462, 0.025358816608786583, -0.023220013827085495, -0.05447021499276161, -0.11865361779928207, 0.06208965927362442, -0.09258309751749039, 0.06354186683893204, -0.053138554096221924, 0.011668895371258259, -0.033995117992162704, -0.012306645512580872, -0.05862145870923996, -0.06186934560537338, -0.11313945800065994, 0.0059526227414608, -0.06007694453001022, -0.042502742260694504, -0.01565728150308132, -0.020929545164108276, -0.01109426561743021, 0.02998734451830387, -0.027658820152282715, 0.04259185865521431, 0.053410787135362625, 0.02345825545489788, 0.02510474994778633, -0.05835810676217079, -0.021138539537787437, 0.0777689591050148, -0.021597696468234062, -0.016123216599225998, -0.00667149294167757, -0.009805010631680489, 0.013419091701507568, 0.11800643056631088, 0.05167802795767784, 0.07534937560558319, -0.016470160335302353, 0.019996171817183495, 0.08105337619781494, 0.013579608872532845, -0.013807345181703568, 0.00921188946813345, 0.03821786120533943, 0.07044733315706253, -0.011384299956262112, -0.025999125093221664, -0.03996504843235016, -0.027803484350442886, -0.03058440424501896, -0.010080722160637379, -0.059228379279375076, -0.08540185540914536, -0.09604963660240173, -0.009569650515913963, 0.0609075129032135, 0.02630687691271305, 0.015277877449989319, 0.002208273857831955, -0.026671715080738068 ]
0.036235
to cryptographic APIs][]. The `callback` function is called with two arguments: `err` and `derivedKey`. `err` is an exception object when key derivation fails, otherwise `err` is `null`. `derivedKey` is passed to the callback as a [`Buffer`][]. An exception is thrown when any of the input arguments specify invalid values or types. ```mjs const { scrypt, } = await import('node:crypto'); // Using the factory defaults. scrypt('password', 'salt', 64, (err, derivedKey) => { if (err) throw err; console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' }); // Using a custom N parameter. Must be a power of two. scrypt('password', 'salt', 64, { N: 1024 }, (err, derivedKey) => { if (err) throw err; console.log(derivedKey.toString('hex')); // '3745e48...aa39b34' }); ``` ```cjs const { scrypt, } = require('node:crypto'); // Using the factory defaults. scrypt('password', 'salt', 64, (err, derivedKey) => { if (err) throw err; console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' }); // Using a custom N parameter. Must be a power of two. scrypt('password', 'salt', 64, { N: 1024 }, (err, derivedKey) => { if (err) throw err; console.log(derivedKey.toString('hex')); // '3745e48...aa39b34' }); ``` ### `crypto.scryptSync(password, salt, keylen[, options])` \* `password` {string|Buffer|TypedArray|DataView} \* `salt` {string|Buffer|TypedArray|DataView} \* `keylen` {number} \* `options` {Object} \* `cost` {number} CPU/memory cost parameter. Must be a power of two greater than one. \*\*Default:\*\* `16384`. \* `blockSize` {number} Block size parameter. \*\*Default:\*\* `8`. \* `parallelization` {number} Parallelization parameter. \*\*Default:\*\* `1`. \* `N` {number} Alias for `cost`. Only one of both may be specified. \* `r` {number} Alias for `blockSize`. Only one of both may be specified. \* `p` {number} Alias for `parallelization`. Only one of both may be specified. \* `maxmem` {number} Memory upper bound. It is an error when (approximately) `128 \* N \* r > maxmem`. \*\*Default:\*\* `32 \* 1024 \* 1024`. \* Returns: {Buffer} Provides a synchronous [scrypt][] implementation. Scrypt is a password-based key derivation function that is designed to be expensive computationally and memory-wise in order to make brute-force attacks unrewarding. The `salt` should be as unique as possible. It is recommended that a salt is random and at least 16 bytes long. See [NIST SP 800-132][] for details. When passing strings for `password` or `salt`, please consider [caveats when using strings as inputs to cryptographic APIs][]. An exception is thrown when key derivation fails, otherwise the derived key is returned as a [`Buffer`][]. An exception is thrown when any of the input arguments specify invalid values or types. ```mjs const { scryptSync, } = await import('node:crypto'); // Using the factory defaults. const key1 = scryptSync('password', 'salt', 64); console.log(key1.toString('hex')); // '3745e48...08d59ae' // Using a custom N parameter. Must be a power of two. const key2 = scryptSync('password', 'salt', 64, { N: 1024 }); console.log(key2.toString('hex')); // '3745e48...aa39b34' ``` ```cjs const { scryptSync, } = require('node:crypto'); // Using the factory defaults. const key1 = scryptSync('password', 'salt', 64); console.log(key1.toString('hex')); // '3745e48...08d59ae' // Using a custom N parameter. Must be a power of two. const key2 = scryptSync('password', 'salt', 64, { N: 1024 }); console.log(key2.toString('hex')); // '3745e48...aa39b34' ``` ### `crypto.secureHeapUsed()` \* Returns: {Object} \* `total` {number} The total allocated secure heap size as specified using the `--secure-heap=n` command-line flag. \* `min` {number} The minimum allocation from the secure heap as specified using the `--secure-heap-min` command-line flag. \* `used` {number} The total number of bytes currently allocated from the secure heap. \* `utilization` {number} The calculated ratio of `used` to `total` allocated bytes. ### `crypto.setEngine(engine[, flags])` \* `engine` {string} \* `flags` {crypto.constants} \*\*Default:\*\* `crypto.constants.ENGINE\_METHOD\_ALL` Load and set the `engine` for some or all OpenSSL functions (selected by flags). Support for custom engines in OpenSSL is deprecated from OpenSSL 3. `engine` could be either an id or a path to the engine's shared
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.032974839210510254, 0.03894224017858505, -0.06396389752626419, 0.03553585335612297, 0.035421647131443024, -0.025937777012586594, -0.006869220640510321, 0.05292350798845291, 0.019060902297496796, -0.037369851022958755, -0.04563979431986809, -0.0077463663183152676, 0.06226629391312599, 0.003240778809413314, 0.03925272449851036, -0.002095063915476203, -0.11542713642120361, 0.06239231675863266, -0.011504454538226128, -0.0372004434466362, 0.10173972696065903, -0.03963250294327736, 0.04789658635854721, -0.03489753603935242, -0.02253033220767975, -0.07884389162063599, 0.051138587296009064, -0.002139716874808073, 0.0010829203529283404, 0.03120272420346737, 0.041244033724069595, 0.05362454056739807, -0.08648698776960373, -0.029763732105493546, -0.04150865972042084, 0.10364643484354019, -0.024873100221157074, 0.01360937487334013, 0.03143114596605301, -0.011687583290040493, 0.025448573753237724, 0.08257368206977844, -0.027602246031165123, -0.02360869199037552, 0.021290026605129242, -0.0303947851061821, -0.035449493676424026, 0.025329193100333214, -0.029764054343104362, 0.0008479480748064816, -0.005376731976866722, 0.0035499390214681625, -0.03400862216949463, -0.019768569618463516, -0.046930547803640366, 0.029241397976875305, -0.0972912386059761, 0.012114795856177807, 0.08030633628368378, -0.04624751955270767, 0.04242745786905289, -0.03441057354211807, 0.07920973747968674, -0.023640252649784088, 0.08647473156452179, 0.024387577548623085, 0.018699582666158676, -0.056529197841882706, -0.008570871315896511, 0.05216262862086296, 0.017724838107824326, -0.041705384850502014, -0.047823332250118256, 0.047162819653749466, -0.02078784443438053, -0.013683774508535862, -0.03347470611333847, -0.045496270060539246, -0.03590625897049904, 0.04412763565778732, -0.05059770867228508, -0.044024717062711716, -0.013689735904335976, 0.0419316366314888, 0.08403201401233673, 0.09686774760484695, -0.018678227439522743, -0.009525586850941181, 0.0036367650609463453, 0.05667779967188835, -0.005485862493515015, -0.07327765971422195, -0.07998432964086533, 0.07662097364664078, 0.054270271211862564, 0.028322769328951836, 0.008996742777526379, -0.03048558719456196, -0.062153127044439316, 0.016928041353821754, -0.029919464141130447, 0.002998220967128873, -0.007109792437404394, -0.0967227891087532, 0.1484636664390564, 0.09895598888397217, 0.0337945818901062, -0.06054537743330002, -0.020406803116202354, 0.033691100776195526, 0.032456185668706894, 0.049222905188798904, -0.01318427361547947, 0.0010440389160066843, 0.022573471069335938, 0.127221941947937, 0.047380976378917694, -0.03659898415207863, 0.017392626032233238, 0.09907454252243042, 0.12619620561599731, 0.022555077448487282, 0.0024000813718885183, 0.033404238522052765, -0.023016510531306267, -0.05013188347220421, -0.011897223070263863, 2.6251472287059417e-33, -0.06112813577055931, 0.00011633845861069858, 0.03195347264409065, 0.045595765113830566, -0.013428271748125553, -0.003671610029414296, 0.09626281261444092, -0.035609398037195206, -0.11696060001850128, -0.03251787647604942, -0.10249872505664825, -0.014955136924982071, 0.00944935530424118, -0.11010075360536575, 0.00957093108445406, -0.015298555605113506, 0.08722934871912003, -0.06402821838855743, 0.0748811587691307, 0.025075815618038177, 0.03265422210097313, 0.03233485296368599, 0.06060746684670448, 0.007289025466889143, -0.022943785414099693, -0.054020997136831284, 0.011654740199446678, 0.035227034240961075, 0.05989338830113411, 0.0023632722441107035, 0.024573614820837975, 0.00047500093933194876, -0.009181732311844826, 0.0017826081020757556, 0.012658449821174145, -0.03047306090593338, 0.061536602675914764, 0.021708181127905846, -0.09938598424196243, -0.07697091996669769, -0.019628891721367836, 0.035290807485580444, 0.004671062808483839, 0.015742318704724312, -0.016367461532354355, -0.08778630197048187, -0.016254518181085587, -0.027470385655760765, 0.11610753834247589, 0.04644978046417236, -0.08277610689401627, 0.0593215636909008, -0.029722316190600395, -0.06234002485871315, 0.020392760634422302, -0.05934228003025055, 0.029548384249210358, 0.014181358739733696, -0.045568156987428665, 0.023086048662662506, -0.02573428489267826, -0.016683047637343407, -0.02741570584475994, -0.0018524144543334842, -0.030950818210840225, -0.03174207732081413, -0.05896477401256561, -0.02871466428041458, -0.07876729220151901, -0.025787603110074997, -0.012361181899905205, 0.00008947694732341915, -0.02557111531496048, 0.060241345316171646, -0.0007271541398949921, -0.01032673753798008, -0.05815376713871956, 0.033787500113248825, 0.030169108882546425, -0.07079413533210754, 0.10408013314008713, 0.059727225452661514, -0.08988509327173233, 0.09386080503463745, -0.05324134975671768, 0.0862303301692009, -0.05416436865925789, -0.04574447497725487, 0.05948061868548393, 0.035275619477033615, -0.03451170027256012, -0.022509269416332245, -0.021642310544848442, -0.11243122071027756, -0.09173844009637833, -4.128873214069406e-33, -0.0701063871383667, 0.022135525941848755, -0.022460147738456726, 0.1301514059305191, -0.026438530534505844, -0.002710177795961499, -0.027431584894657135, -0.012435449287295341, -0.009563853964209557, -0.035136956721544266, -0.0005054777138866484, -0.022980375215411186, 0.1341424584388733, -0.03449097275733948, 0.08196253329515457, 0.020882058888673782, -0.053358837962150574, 0.0497543029487133, 0.05467475578188896, -0.038037367165088654, -0.010545019991695881, 0.08607548475265503, -0.03865781053900719, 0.016347551718354225, -0.05201048403978348, 0.09684622287750244, -0.07445815205574036, 0.10670315474271774, 0.04325664043426514, -0.0062059201300144196, -0.03448550030589104, 0.03168247267603874, -0.07737336307764053, 0.07942250370979309, -0.027736280113458633, -0.1034642681479454, -0.0087444968521595, 0.06559281051158905, 0.009069343097507954, -0.024483930319547653, 0.04416815564036369, -0.012553584761917591, 0.06945640593767166, -0.02322831191122532, 0.005709186661988497, -0.054984286427497864, 0.06130604073405266, 0.05340803787112236, 0.08957130461931229, -0.024103427305817604, 0.004612809978425503, -0.07996498793363571, -0.06768244504928589, 0.011556020006537437, -0.015336544252932072, -0.011264923959970474, 0.018443958833813667, 0.04111332446336746, 0.06039854884147644, 0.0029568930622190237, 0.020314639434218407, -0.017679749056696892, 0.07365139573812485, -0.05398797616362572, -0.0019100859062746167, -0.0037515959702432156, -0.10982339829206467, 0.0007971098530106246, 0.028937293216586113, 0.055627841502428055, -0.008332245983183384, 0.02473161369562149, 0.029890811070799828, 0.006349220871925354, 0.02851848304271698, -0.07065974175930023, -0.11296554654836655, -0.06816595792770386, 0.06669915467500687, -0.001939498702995479, 0.009476268664002419, 0.019492411985993385, 0.04305975139141083, 0.06903481483459473, 0.06625691801309586, -0.03579391539096832, 0.023679956793785095, 0.007709436118602753, 0.0014248170191422105, -0.05888538062572479, 0.0304753165692091, -0.01576007343828678, -0.12550848722457886, 0.030120451003313065, 0.0678628459572792, -5.7250051810342484e-8, 0.0001737755665089935, -0.011242829263210297, -0.07965684682130814, -0.031940605491399765, -0.003630095859989524, -0.06344366073608398, -0.01592826656997204, -0.12224830687046051, 0.01686018705368042, -0.0722980871796608, -0.040565598756074905, -0.043455783277750015, 0.07902788370847702, -0.01735924743115902, -0.017438223585486412, 0.04256216436624527, -0.09235978126525879, 0.027038147673010826, -0.019192682579159737, -0.08454373478889465, -0.0065956744365394115, -0.05107675865292549, -0.054227471351623535, 0.023888511583209038, 0.03725270926952362, 0.05306819826364517, 0.04711659997701645, 0.07514958083629608, 0.05472533777356148, -0.03951498866081238, -0.05888095498085022, -0.03753063827753067, 0.06276603788137436, -0.006384791806340218, -0.06093858554959297, 0.0342860110104084, -0.005909285508096218, 0.004654114134609699, 0.09055569022893906, 0.05675171688199043, -0.0008042534464038908, -0.02451145462691784, -0.021608421579003334, 0.049298644065856934, -0.07203831523656845, -0.009374692104756832, 0.012546759098768234, 0.0745343491435051, -0.005065441597253084, 0.02185634709894657, -0.012128646485507488, -0.04401380568742752, -0.020116733387112617, -0.013748745433986187, -0.029596053063869476, -0.005721625406295061, -0.04298508167266846, -0.06058412790298462, -0.01158883050084114, -0.052198972553014755, 0.07643470168113708, 0.0034646266140043736, 0.011347048915922642, -0.019036412239074707 ]
0.011202
bytes. ### `crypto.setEngine(engine[, flags])` \* `engine` {string} \* `flags` {crypto.constants} \*\*Default:\*\* `crypto.constants.ENGINE\_METHOD\_ALL` Load and set the `engine` for some or all OpenSSL functions (selected by flags). Support for custom engines in OpenSSL is deprecated from OpenSSL 3. `engine` could be either an id or a path to the engine's shared library. The optional `flags` argument uses `ENGINE\_METHOD\_ALL` by default. The `flags` is a bit field taking one of or a mix of the following flags (defined in `crypto.constants`): \* `crypto.constants.ENGINE\_METHOD\_RSA` \* `crypto.constants.ENGINE\_METHOD\_DSA` \* `crypto.constants.ENGINE\_METHOD\_DH` \* `crypto.constants.ENGINE\_METHOD\_RAND` \* `crypto.constants.ENGINE\_METHOD\_EC` \* `crypto.constants.ENGINE\_METHOD\_CIPHERS` \* `crypto.constants.ENGINE\_METHOD\_DIGESTS` \* `crypto.constants.ENGINE\_METHOD\_PKEY\_METHS` \* `crypto.constants.ENGINE\_METHOD\_PKEY\_ASN1\_METHS` \* `crypto.constants.ENGINE\_METHOD\_ALL` \* `crypto.constants.ENGINE\_METHOD\_NONE` ### `crypto.setFips(bool)` \* `bool` {boolean} `true` to enable FIPS mode. Enables the FIPS compliant crypto provider in a FIPS-enabled Node.js build. Throws an error if FIPS mode is not available. ### `crypto.sign(algorithm, data, key[, callback])` \* `algorithm` {string | null | undefined} \* `data` {ArrayBuffer|Buffer|TypedArray|DataView} \* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey} \* `callback` {Function} \* `err` {Error} \* `signature` {Buffer} \* Returns: {Buffer} if the `callback` function is not provided. Calculates and returns the signature for `data` using the given private key and algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is dependent upon the key type. `algorithm` is required to be `null` or `undefined` for Ed25519, Ed448, and ML-DSA. If `key` is not a [`KeyObject`][], this function behaves as if `key` had been passed to [`crypto.createPrivateKey()`][]. If it is an object, the following additional properties can be passed: \* `dsaEncoding` {string} For DSA and ECDSA, this option specifies the format of the generated signature. It can be one of the following: \* `'der'` (default): DER-encoded ASN.1 signature structure encoding `(r, s)`. \* `'ieee-p1363'`: Signature format `r || s` as proposed in IEEE-P1363. \* `padding` {integer} Optional padding value for RSA, one of the following: \* `crypto.constants.RSA\_PKCS1\_PADDING` (default) \* `crypto.constants.RSA\_PKCS1\_PSS\_PADDING` `RSA\_PKCS1\_PSS\_PADDING` will use MGF1 with the same hash function used to sign the message as specified in section 3.1 of [RFC 4055][]. \* `saltLength` {integer} Salt length for when padding is `RSA\_PKCS1\_PSS\_PADDING`. The special value `crypto.constants.RSA\_PSS\_SALTLEN\_DIGEST` sets the salt length to the digest size, `crypto.constants.RSA\_PSS\_SALTLEN\_MAX\_SIGN` (default) sets it to the maximum permissible value. \* `context` {ArrayBuffer|Buffer|TypedArray|DataView} For Ed448, ML-DSA, and SLH-DSA, this option specifies the optional context to differentiate signatures generated for different purposes with the same key. If the `callback` function is provided this function uses libuv's threadpool. ### `crypto.subtle` \* Type: {SubtleCrypto} A convenient alias for [`crypto.webcrypto.subtle`][]. ### `crypto.timingSafeEqual(a, b)` \* `a` {ArrayBuffer|Buffer|TypedArray|DataView} \* `b` {ArrayBuffer|Buffer|TypedArray|DataView} \* Returns: {boolean} This function compares the underlying bytes that represent the given `ArrayBuffer`, `TypedArray`, or `DataView` instances using a constant-time algorithm. This function does not leak timing information that would allow an attacker to guess one of the values. This is suitable for comparing HMAC digests or secret values like authentication cookies or [capability urls](https://www.w3.org/TR/capability-urls/). `a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they must have the same byte length. An error is thrown if `a` and `b` have different byte lengths. If at least one of `a` and `b` is a `TypedArray` with more than one byte per entry, such as `Uint16Array`, the result will be computed using the platform byte order. **When both of the inputs are `Float32Array`s or `Float64Array`s, this function might return unexpected results due to IEEE 754 encoding of floating-point numbers. In particular, neither `x === y` nor `Object.is(x, y)` implies that the byte representations of two floating-point numbers `x` and `y` are equal.** Use of `crypto.timingSafeEqual` does not guarantee that the \_surrounding\_ code is timing-safe. Care should be taken to ensure that the surrounding code does not introduce timing vulnerabilities. ### `crypto.verify(algorithm, data,
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.044911161065101624, 0.04448285326361656, -0.12023083120584488, 0.020771320909261703, 0.026134466752409935, -0.08543102443218231, -0.031941093504428864, -0.029477788135409355, -0.004866141825914383, -0.12171011418104172, -0.04184535890817642, -0.0453060045838356, -0.028635552152991295, -0.02732911892235279, 0.02103579416871071, -0.010249967686831951, -0.050681862980127335, 0.006316317245364189, -0.07178942114114761, -0.026850702241063118, 0.021000074222683907, 0.003383926348760724, 0.03590519726276398, -0.03281664475798607, -0.05094177648425102, -0.028884971514344215, -0.033365875482559204, 0.0677308663725853, 0.01540749054402113, -0.04552396386861801, 0.11171674728393555, 0.03992949053645134, -0.024441596120595932, -0.011651497334241867, 0.07700204104185104, 0.08515794575214386, 0.035062216222286224, -0.06317707151174545, -0.04341450706124306, 0.01594497822225094, 0.04753124341368675, -0.059437815099954605, -0.0792226493358612, -0.005762357264757156, -0.11948802322149277, 0.05469844117760658, 0.0023495429195463657, -0.03055650368332863, -0.014684785157442093, -0.13575375080108643, 0.012499753385782242, -0.060250379145145416, -0.015301398932933807, 0.04233019798994064, -0.016179421916604042, -0.05175189673900604, -0.10405609756708145, -0.007008644752204418, -0.07760132849216461, 0.02010773867368698, -0.01345929317176342, 0.0972835049033165, -0.009408549405634403, 0.06154071167111397, -0.010642828419804573, 0.04570760577917099, 0.02422480098903179, -0.05697271227836609, -0.014297634363174438, 0.001373453764244914, -0.023106327280402184, -0.02994074486196041, -0.030124733224511147, 0.05948378145694733, -0.05202160403132439, 0.026555124670267105, -0.040285345166921616, -0.01964891143143177, -0.023233884945511818, -0.11069992929697037, -0.07980356365442276, -0.07681725174188614, 0.011926229111850262, 0.05287894606590271, 0.08187119662761688, 0.07579541951417923, 0.03073912486433983, -0.00404053321108222, 0.09117486327886581, 0.14054988324642181, 0.033284157514572144, -0.027472376823425293, 0.021024039015173912, 0.012585561722517014, 0.07790873199701309, 0.07658965140581131, 0.06527470052242279, -0.01980898343026638, -0.019611453637480736, 0.013175392523407936, -0.03237973153591156, 0.020654121413826942, -0.007088744081556797, -0.023472387343645096, 0.008708157576620579, 0.06946956366300583, -0.07418153434991837, 0.05878189578652382, -0.04032709449529648, -0.040603913366794586, 0.03597679361701012, 0.021681280806660652, 0.009295515716075897, -0.0848352238535881, 0.005385471507906914, 0.026881933212280273, -0.13152460753917694, -0.01359214261174202, -0.017711501568555832, 0.047233946621418, 0.04374469816684723, -0.014723139815032482, -0.0318075530230999, 0.014950520358979702, 0.00003863625897793099, 0.009792385622859001, -0.05598291754722595, 1.9992894244151854e-33, 0.05018267408013344, -0.02166092023253441, -0.008004594594240189, -0.012599967420101166, -0.018469030037522316, 0.05635664984583855, 0.00334230181761086, 0.05975615605711937, -0.09853211045265198, 0.10476281493902206, -0.024014022201299667, 0.03673591464757919, -0.041723962873220444, 0.018678613007068634, 0.04572564736008644, -0.007820614613592625, -0.009778724983334541, -0.037628576159477234, 0.027820046991109848, -0.046554021537303925, 0.014848482795059681, 0.05180652067065239, 0.00870850495994091, 0.006489846855401993, -0.041668254882097244, 0.06297532469034195, 0.03117028996348381, -0.08849082887172699, 0.06066644564270973, 0.02201824076473713, 0.01110148150473833, -0.005802990403026342, -0.04408480226993561, 0.010088388808071613, 0.006404264830052853, 0.015620374120771885, -0.023768695071339607, -0.0034613008610904217, -0.09109177440404892, 0.06013437733054161, 0.15418754518032074, 0.02120896428823471, -0.0348711758852005, -0.08291370421648026, -0.053411539644002914, -0.04085694998502731, -0.054187286645174026, -0.03237774595618248, 0.11291206628084183, 0.009438819251954556, 0.03727271407842636, 0.012073516845703125, 0.010946149937808514, -0.026123883202672005, 0.05533748120069504, -0.10782740265130997, 0.012480192817747593, -0.021736672148108482, -0.07012579590082169, -0.03723525628447533, -0.04000355303287506, -0.01735050603747368, 0.0031477732118219137, -0.026947468519210815, 0.05711204931139946, 0.03526799753308296, 0.011426112614572048, 0.0341014564037323, -0.09133067727088928, 0.06963251531124115, -0.05574370175600052, 0.009598545730113983, 0.031395602971315384, 0.07868969440460205, 0.004901551175862551, 0.006658167578279972, -0.019353732466697693, -0.006272653117775917, 0.03285631164908409, -0.028761740773916245, 0.022723769769072533, 0.07847003638744354, 0.00392719404771924, -0.012599483132362366, -0.03154580667614937, 0.02727389708161354, -0.025996891781687737, -0.015129013918340206, -0.07509944587945938, -0.0723150223493576, -0.009039497002959251, -0.0414041243493557, 0.026008913293480873, -0.040883924812078476, -0.12684772908687592, -6.456283703088393e-33, -0.01868436671793461, -0.03758937492966652, -0.021205248311161995, 0.10013743489980698, 0.004440956749022007, -0.032937243580818176, 0.006900336593389511, 0.02271506004035473, 0.07952621579170227, 0.06778908520936966, -0.026942530646920204, -0.014871636405587196, 0.1743854135274887, -0.05869970843195915, 0.09175821393728256, -0.06702525168657303, -0.10939490795135498, -0.0016393210971727967, -0.015747856348752975, 0.024471884593367577, -0.06598422676324844, 0.09723077714443207, 0.051623664796352386, 0.05028022825717926, 0.05259041115641594, -0.009849442169070244, -0.04350055009126663, 0.004939365666359663, 0.0332971028983593, -0.06901715695858002, 0.01143692433834076, 0.037461645901203156, -0.0559966042637825, -0.05099349841475487, -0.052279382944107056, -0.010887210257351398, 0.012226135469973087, 0.012739921920001507, 0.010188889689743519, 0.018471747636795044, 0.013832000084221363, -0.04517447575926781, 0.037805765867233276, 0.03669790178537369, 0.02857317216694355, 0.02980845421552658, -0.058513395488262177, -0.002675437368452549, 0.027158694341778755, 0.004506177268922329, 0.02524915151298046, -0.012527726590633392, 0.019895102828741074, -0.010614447295665741, 0.07305639982223511, 0.033387690782547, -0.07142660021781921, 0.021572671830654144, -0.004197788890451193, -0.024922356009483337, 0.04769962280988693, -0.012948394753038883, -0.02751491218805313, 0.01578989066183567, -0.07017321139574051, 0.030489984899759293, -0.14467579126358032, -0.04873800650238991, -0.005572195630520582, -0.01756405085325241, -0.002686985768377781, -0.054102823138237, -0.05270550400018692, -0.05002349987626076, -0.05090290680527687, -0.027224846184253693, 0.0041693574748933315, -0.01653096452355385, 0.08873434364795685, 0.057361625134944916, -0.007184382528066635, 0.032376181334257126, 0.0019096109317615628, -0.015541000291705132, 0.07424164563417435, -0.04966530576348305, -0.005519653670489788, 0.05000397190451622, 0.002104605548083782, -0.028919488191604614, 0.005203716456890106, 0.10876858979463577, 0.018655987456440926, 0.0769973173737526, 0.06195371225476265, -5.521326684743144e-8, 0.051629435271024704, -0.10372468829154968, -0.05632022023200989, 0.025673499330878258, 0.09681693464517593, 0.03714685142040253, 0.05153324082493782, -0.015836888924241066, -0.04748085141181946, -0.07308543473482132, 0.10103634744882584, -0.031716082245111465, -0.02338477410376072, -0.03475052863359451, -0.0491032674908638, 0.019718080759048462, -0.09304425865411758, 0.0007684448501095176, -0.01840323768556118, -0.1335909366607666, 0.04671536013484001, -0.0358603373169899, -0.03564435616135597, -0.004061489831656218, -0.014004606753587723, 0.024223346263170242, 0.07067570835351944, -0.004800654482096434, -0.05046128109097481, 0.008144726976752281, -0.00014259149611461908, -0.0773799866437912, 0.10262856632471085, -0.014413158409297466, -0.01690502278506756, 0.08869944512844086, -0.10822806507349014, 0.01602034457027912, 0.07613226771354675, 0.03875119239091873, 0.007321421522647142, 0.020249154418706894, -0.019948123022913933, 0.006517772097140551, -0.042230475693941116, 0.016312630847096443, -0.05827885866165161, 0.05000481382012367, -0.08823320269584656, 0.01795913092792034, 0.008794263936579227, -0.019092848524451256, 0.004489065147936344, 0.05860138311982155, -0.004227856174111366, 0.041652828454971313, -0.017534902319312096, -0.05276866629719734, -0.038521621376276016, -0.02428690902888775, -0.006686890032142401, -0.01018878910690546, 0.05451164022088051, -0.003629450686275959 ]
0.078019
`x === y` nor `Object.is(x, y)` implies that the byte representations of two floating-point numbers `x` and `y` are equal.** Use of `crypto.timingSafeEqual` does not guarantee that the \_surrounding\_ code is timing-safe. Care should be taken to ensure that the surrounding code does not introduce timing vulnerabilities. ### `crypto.verify(algorithm, data, key, signature[, callback])` \* `algorithm` {string|null|undefined} \* `data` {ArrayBuffer| Buffer|TypedArray|DataView} \* `key` {Object|string|ArrayBuffer|Buffer|TypedArray|DataView|KeyObject|CryptoKey} \* `signature` {ArrayBuffer|Buffer|TypedArray|DataView} \* `callback` {Function} \* `err` {Error} \* `result` {boolean} \* Returns: {boolean} `true` or `false` depending on the validity of the signature for the data and public key if the `callback` function is not provided. Verifies the given signature for `data` using the given key and algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is dependent upon the key type. `algorithm` is required to be `null` or `undefined` for Ed25519, Ed448, and ML-DSA. If `key` is not a [`KeyObject`][], this function behaves as if `key` had been passed to [`crypto.createPublicKey()`][]. If it is an object, the following additional properties can be passed: \* `dsaEncoding` {string} For DSA and ECDSA, this option specifies the format of the signature. It can be one of the following: \* `'der'` (default): DER-encoded ASN.1 signature structure encoding `(r, s)`. \* `'ieee-p1363'`: Signature format `r || s` as proposed in IEEE-P1363. \* `padding` {integer} Optional padding value for RSA, one of the following: \* `crypto.constants.RSA\_PKCS1\_PADDING` (default) \* `crypto.constants.RSA\_PKCS1\_PSS\_PADDING` `RSA\_PKCS1\_PSS\_PADDING` will use MGF1 with the same hash function used to sign the message as specified in section 3.1 of [RFC 4055][]. \* `saltLength` {integer} Salt length for when padding is `RSA\_PKCS1\_PSS\_PADDING`. The special value `crypto.constants.RSA\_PSS\_SALTLEN\_DIGEST` sets the salt length to the digest size, `crypto.constants.RSA\_PSS\_SALTLEN\_MAX\_SIGN` (default) sets it to the maximum permissible value. \* `context` {ArrayBuffer|Buffer|TypedArray|DataView} For Ed448, ML-DSA, and SLH-DSA, this option specifies the optional context to differentiate signatures generated for different purposes with the same key. The `signature` argument is the previously calculated signature for the `data`. Because public keys can be derived from private keys, a private key or a public key may be passed for `key`. If the `callback` function is provided this function uses libuv's threadpool. ### `crypto.webcrypto` Type: {Crypto} An implementation of the Web Crypto API standard. See the [Web Crypto API documentation][] for details. ## Notes ### Using strings as inputs to cryptographic APIs For historical reasons, many cryptographic APIs provided by Node.js accept strings as inputs where the underlying cryptographic algorithm works on byte sequences. These instances include plaintexts, ciphertexts, symmetric keys, initialization vectors, passphrases, salts, authentication tags, and additional authenticated data. When passing strings to cryptographic APIs, consider the following factors. \* Not all byte sequences are valid UTF-8 strings. Therefore, when a byte sequence of length `n` is derived from a string, its entropy is generally lower than the entropy of a random or pseudorandom `n` byte sequence. For example, no UTF-8 string will result in the byte sequence `c0 af`. Secret keys should almost exclusively be random or pseudorandom byte sequences. \* Similarly, when converting random or pseudorandom byte sequences to UTF-8 strings, subsequences that do not represent valid code points may be replaced by the Unicode replacement character (`U+FFFD`). The byte representation of the resulting Unicode string may, therefore, not be equal to the byte sequence that the string was created from. ```js const original = [0xc0, 0xaf]; const bytesAsString = Buffer.from(original).toString('utf8'); const stringAsBytes = Buffer.from(bytesAsString, 'utf8'); console.log(stringAsBytes); // Prints ''. ``` The outputs of ciphers, hash functions, signature algorithms, and key derivation functions are pseudorandom byte sequences and should not be used as Unicode strings. \* When strings are obtained from user input, some Unicode characters can
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.016456127166748047, 0.04208379611372948, -0.08208783715963364, -0.010143316350877285, -0.04733753576874733, -0.10760889202356339, 0.030443763360381126, -0.0076716067269444466, -0.030346347019076347, -0.08474062383174896, -0.057438697665929794, -0.01931885816156864, 0.03631966561079025, -0.03896256163716316, -0.0018103505717590451, -0.03405114263296127, -0.011088049039244652, -0.044445402920246124, -0.06917227059602737, 0.02093775011599064, 0.054851580411195755, -0.055228639394044876, -0.038227517157793045, -0.005316230468451977, -0.02045498602092266, -0.0254222359508276, 0.05441343039274216, 0.017132332548499107, 0.003259206423535943, -0.010343499481678009, 0.026665646582841873, 0.017496438696980476, -0.01880745217204094, 0.031574856489896774, -0.04487771913409233, 0.1055082306265831, 0.06853780895471573, -0.0860775038599968, 0.019838038831949234, -0.0018955508712679148, -0.0016620404785498977, -0.0026782285422086716, -0.07330379635095596, -0.024117032065987587, -0.048571981489658356, 0.06574556231498718, -0.014409144409000874, -0.02293839305639267, -0.06576747447252274, -0.07212872803211212, -0.035957686603069305, 0.01254933513700962, -0.05922538787126541, 0.01372084952890873, -0.05469830706715584, -0.02423548512160778, -0.026687385514378548, 0.021473968401551247, -0.009397123008966446, -0.0013148849830031395, 0.01873132213950157, -0.009141882881522179, 0.07088058441877365, 0.10988084971904755, 0.07060910761356354, 0.018205182626843452, 0.021895162761211395, -0.10725177079439163, 0.01716707833111286, 0.04449446126818657, -0.001805774518288672, 0.03633631765842438, 0.02429763786494732, 0.04464707523584366, -0.061269767582416534, 0.005249042995274067, 0.004519253969192505, -0.04539642110466957, -0.011498655192553997, -0.08106796443462372, -0.04505787789821625, -0.12153463065624237, -0.03775949031114578, 0.0674174353480339, 0.030446959659457207, -0.003489552065730095, -0.007044937461614609, -0.012009438127279282, -0.008965260349214077, 0.049089740961790085, 0.04776645079255104, 0.045019056648015976, -0.016530735418200493, 0.05352846160531044, 0.04981475695967674, -0.00021487225603777915, 0.03304622694849968, -0.031774308532476425, -0.02472870796918869, -0.0006967825465835631, -0.10327934473752975, 0.003873407607898116, 0.003372052451595664, -0.06208184361457825, 0.1343899816274643, 0.05239486321806908, 0.04723614826798439, -0.1136464849114418, -0.03011152893304825, 0.02194111980497837, 0.04554082825779915, 0.083848737180233, 0.012457968667149544, 0.044652488082647324, -0.015412379987537861, 0.06150868535041809, -0.06932257115840912, 0.017786815762519836, -0.014839665964245796, -0.009902252815663815, 0.06629114598035812, 0.024914776906371117, 0.0035328574012964964, -0.043671321123838425, -0.04953153058886528, -0.075742207467556, 0.048879474401474, 6.0652544052614055e-33, -0.04683497175574303, -0.05961252376437187, 0.021310977637767792, -0.07534047961235046, 0.04544113948941231, 0.013758066110312939, 0.023256897926330566, 0.01872674934566021, -0.04120887443423271, 0.029272090643644333, -0.042019378393888474, -0.06546027213335037, 0.013948293402791023, -0.04293905571103096, 0.060874879360198975, 0.03848768398165703, 0.05138925462961197, -0.06732477247714996, -0.02992386370897293, 0.04141011834144592, 0.14280278980731964, -0.07838157564401627, -0.06301087886095047, 0.0005299145705066621, -0.04181751236319542, 0.04581279307603836, -0.049534332007169724, -0.012739662081003189, -0.03927859291434288, -0.011794348247349262, -0.041622012853622437, -0.0021546906791627407, -0.0010294020175933838, 0.04046609625220299, 0.07226131856441498, -0.035101134330034256, 0.07548408955335617, -0.030764466151595116, -0.05537034571170807, -0.05878227576613426, 0.037791237235069275, 0.013162456452846527, -0.03830091655254364, -0.0600140355527401, 0.001814007991924882, -0.08854112029075623, -0.05871519446372986, 0.023810744285583496, 0.0781673714518547, 0.0931723341345787, -0.03380017355084419, 0.034761860966682434, -0.010198517702519894, -0.039637014269828796, 0.007784328423440456, -0.09287624061107635, -0.015817034989595413, 0.04978690668940544, 0.037725482136011124, 0.07283931970596313, -0.07006146758794785, -0.03578755632042885, 0.0034365723840892315, -0.11218349635601044, -0.10238015651702881, 0.06383134424686432, 0.040958061814308167, -0.03483787178993225, 0.02034982293844223, 0.02975762076675892, -0.030797377228736877, 0.0015944322803989053, -0.008246511220932007, 0.11001305282115936, -0.03226214274764061, -0.018958522006869316, -0.0420776829123497, -0.05234706029295921, 0.03554287925362587, -0.09074197709560394, 0.06658394634723663, 0.035738226026296616, 0.053666770458221436, 0.05011192336678505, 0.004295355174690485, 0.028789330273866653, -0.01801920495927334, -0.022366074845194817, -0.07121206820011139, 0.082369863986969, -0.10682448744773865, 0.022091897204518318, 0.029242627322673798, -0.14043714106082916, -0.07954554259777069, -8.963394952253461e-33, 0.06864452362060547, -0.03381781652569771, -0.006538914982229471, 0.10961023718118668, 0.04058883339166641, -0.028281619772315025, -0.03181178495287895, 0.02851329743862152, 0.018580961972475052, -0.017998015508055687, -0.022804919630289078, -0.06360068172216415, 0.09120073169469833, -0.059374790638685226, 0.07355828583240509, 0.030865537002682686, -0.09438314288854599, 0.006404126062989235, 0.02623855695128441, -0.04621224105358124, 0.0025483027566224337, 0.056604377925395966, 0.010833458974957466, 0.053305964916944504, 0.012449734844267368, -0.01745525375008583, -0.04737211391329765, 0.0631837472319603, 0.02335151843726635, 0.019483420997858047, -0.010905656963586807, 0.03945327177643776, -0.03716398775577545, -0.03158678114414215, 0.010000479407608509, -0.03861285746097565, 0.09068550169467926, -0.004336552694439888, 0.023506149649620056, 0.025799568742513657, 0.08898109197616577, -0.017542947083711624, -0.007820508442819118, -0.01942828670144081, 0.0034746509045362473, -0.014293290674686432, -0.007698959205299616, 0.06648930162191391, 0.005620704963803291, -0.05275736004114151, 0.03815607354044914, 0.015176181681454182, -0.0006831535138189793, 0.054151833057403564, 0.0579485259950161, 0.035664357244968414, 0.01975839212536812, -0.03790806606411934, 0.026160074397921562, 0.027367455884814262, -0.04185807332396507, -0.08205967396497726, 0.09161069989204407, -0.03130184859037399, 0.0501401387155056, 0.0146176777780056, -0.01671508327126503, -0.005867053288966417, 0.0672065019607544, 0.029711948707699776, 0.056017134338617325, -0.041124824434518814, -0.05533681809902191, 0.019854355603456497, -0.06016794219613075, -0.00422627292573452, -0.044503506273031235, -0.0668390542268753, 0.09063811600208282, 0.09266804903745651, 0.03192383050918579, 0.058840084820985794, 0.03713032603263855, 0.08360642194747925, 0.01912793517112732, 0.04022819548845291, 0.02459731139242649, -0.038038481026887894, -0.15420599281787872, -0.013586127199232578, -0.0077622695825994015, 0.02376350201666355, -0.05514818802475929, -0.012897471897304058, 0.06315849721431732, -5.600840324859746e-8, 0.04869185388088226, -0.04723406955599785, -0.025353100150823593, -0.006598345469683409, 0.0020090611651539803, -0.04713444784283638, -0.07467007637023926, -0.12217960506677628, 0.0352378711104393, -0.11076430976390839, 0.12457451969385147, -0.05888659507036209, 0.006226684898138046, -0.030968209728598595, 0.0002866431314032525, -0.025701140984892845, -0.09266015142202377, -0.07075078785419464, -0.043414413928985596, -0.0243367999792099, 0.010530106723308563, -0.06353878974914551, -0.08635079115629196, -0.03433899208903313, 0.07088790088891983, 0.06543856859207153, 0.06337902694940567, 0.08628758788108826, 0.0037691276520490646, -0.010075091384351254, -0.06015416979789734, -0.011997966095805168, 0.10020780563354492, 0.039052922278642654, -0.0011649251682683825, -0.023243140429258347, 0.0003611270512919873, 0.013530679047107697, 0.01645451784133911, 0.0828397274017334, 0.05128268897533417, 0.010095205157995224, -0.0050679417327046394, 0.023446815088391304, 0.05509909614920616, 0.05294071137905121, 0.07023173570632935, 0.04389354586601257, -0.038511451333761215, 0.04771988466382027, -0.008375105448067188, 0.01727275364100933, -0.0044693052768707275, 0.011255810968577862, -0.08314916491508484, -0.010877159424126148, -0.07137276232242584, -0.04519536346197128, 0.03767330199480057, 0.030078746378421783, 0.06295598298311234, 0.015258322469890118, 0.05014679580926895, -0.0812349021434784 ]
0.018431
const bytesAsString = Buffer.from(original).toString('utf8'); const stringAsBytes = Buffer.from(bytesAsString, 'utf8'); console.log(stringAsBytes); // Prints ''. ``` The outputs of ciphers, hash functions, signature algorithms, and key derivation functions are pseudorandom byte sequences and should not be used as Unicode strings. \* When strings are obtained from user input, some Unicode characters can be represented in multiple equivalent ways that result in different byte sequences. For example, when passing a user passphrase to a key derivation function, such as PBKDF2 or scrypt, the result of the key derivation function depends on whether the string uses composed or decomposed characters. Node.js does not normalize character representations. Developers should consider using [`String.prototype.normalize()`][] on user inputs before passing them to cryptographic APIs. ### Legacy streams API (prior to Node.js 0.10) The Crypto module was added to Node.js before there was the concept of a unified Stream API, and before there were [`Buffer`][] objects for handling binary data. As such, many `crypto` classes have methods not typically found on other Node.js classes that implement the [streams][stream] API (e.g. `update()`, `final()`, or `digest()`). Also, many methods accepted and returned `'latin1'` encoded strings by default rather than `Buffer`s. This default was changed in Node.js 0.9.3 to use [`Buffer`][] objects by default instead. ### Support for weak or compromised algorithms The `node:crypto` module still supports some algorithms which are already compromised and are not recommended for use. The API also allows the use of ciphers and hashes with a small key size that are too weak for safe use. Users should take full responsibility for selecting the crypto algorithm and key size according to their security requirements. Based on the recommendations of [NIST SP 800-131A][]: \* MD5 and SHA-1 are no longer acceptable where collision resistance is required such as digital signatures. \* The key used with RSA, DSA, and DH algorithms is recommended to have at least 2048 bits and that of the curve of ECDSA and ECDH at least 224 bits, to be safe to use for several years. \* The DH groups of `modp1`, `modp2` and `modp5` have a key size smaller than 2048 bits and are not recommended. See the reference for other recommendations and details. Some algorithms that have known weaknesses and are of little relevance in practice are only available through the [legacy provider][], which is not enabled by default. ### CCM mode CCM is one of the supported [AEAD algorithms][]. Applications which use this mode must adhere to certain restrictions when using the cipher API: \* The authentication tag length must be specified during cipher creation by setting the `authTagLength` option and must be one of 4, 6, 8, 10, 12, 14 or 16 bytes. \* The length of the initialization vector (nonce) `N` must be between 7 and 13 bytes (`7 ≤ N ≤ 13`). \* The length of the plaintext is limited to `2 \*\* (8 \* (15 - N))` bytes. \* When decrypting, the authentication tag must be set via `setAuthTag()` before calling `update()`. Otherwise, decryption will fail and `final()` will throw an error in compliance with section 2.6 of [RFC 3610][]. \* Using stream methods such as `write(data)`, `end(data)` or `pipe()` in CCM mode might fail as CCM cannot handle more than one chunk of data per instance. \* When passing additional authenticated data (AAD), the length of the actual message in bytes must be passed to `setAAD()` via the `plaintextLength` option. Many crypto libraries include the authentication tag in the ciphertext, which means that they produce ciphertexts of the length `plaintextLength + authTagLength`. Node.js does not include the authentication tag, so the ciphertext length is always `plaintextLength`. This
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.006109669338911772, 0.0019050483824685216, -0.019923372194170952, -0.018877141177654266, -0.010573322884738445, -0.030793307349085808, 0.05248289555311203, 0.07598043233156204, 0.04730017110705376, -0.035446275025606155, -0.10491198301315308, 0.02564513124525547, 0.026236526668071747, -0.003962544724345207, -0.00499097490683198, -0.027249110862612724, -0.07131080329418182, 0.05381255969405174, -0.0611804835498333, -0.05283287912607193, 0.09553369879722595, -0.0525381937623024, 0.010154524818062782, -0.03941597416996956, 0.05070490017533302, 0.045410335063934326, 0.022657720372080803, 0.010638370178639889, 0.036039456725120544, 0.05765213817358017, 0.017024651169776917, -0.05444357544183731, -0.020495140925049782, 0.0026753402780741453, -0.09154635667800903, 0.150875985622406, -0.009500924497842789, -0.09073488414287567, -0.018796106800436974, -0.022562002763152122, 0.005599940195679665, 0.07324539870023727, -0.10690540075302124, 0.06909014284610748, 0.019611014053225517, 0.09312872588634491, -0.0771859884262085, 0.011195632629096508, -0.036825988441705704, -0.010607093572616577, 0.02707344852387905, 0.003916773945093155, -0.019451171159744263, 0.0015879955608397722, -0.038964785635471344, -0.027889743447303772, -0.07094812393188477, 0.027291063219308853, 0.038735151290893555, -0.043998707085847855, -0.09446215629577637, -0.0360741950571537, 0.08485310524702072, 0.07045386731624603, 0.06559199094772339, 0.008221911266446114, 0.030064191669225693, 0.014856917783617973, 0.02230127528309822, -0.0032218110281974077, -0.0470225028693676, 0.04430603235960007, -0.06852627545595169, 0.020204318687319756, -0.006749751977622509, 0.016474202275276184, 0.00420354912057519, 0.031199678778648376, -0.08917676657438278, 0.012369982898235321, 0.001535788644105196, -0.06765914708375931, 0.038480792194604874, 0.05407922342419624, 0.028699876740574837, 0.1629696637392044, -0.0929514691233635, -0.02337750419974327, -0.033470116555690765, 0.1064920499920845, -0.015633797273039818, -0.06359858065843582, 0.03244274854660034, 0.023235617205500603, 0.01477814931422472, 0.00024307066632900387, 0.027236729860305786, 0.01530920248478651, -0.02504546009004116, 0.005871454253792763, -0.04236970469355583, 0.017529500648379326, 0.04091796278953552, -0.11357614398002625, 0.04172969236969948, 0.042316485196352005, 0.027325229719281197, -0.014647496864199638, 0.03539600595831871, 0.014347163960337639, 0.024004006758332253, 0.03561696782708168, -0.04953436926007271, 0.0020571108907461166, -0.005079230293631554, 0.05586424097418785, -0.013470890000462532, -0.082582026720047, 0.05074729025363922, 0.09020126610994339, 0.0423852801322937, 0.003243244020268321, -0.048584021627902985, 0.05753656476736069, -0.03580339252948761, -0.029331456869840622, -0.014773568138480186, 4.247623490099396e-33, -0.03865616396069527, -0.01505261566489935, 0.00567066902294755, 0.030560677871108055, -0.09073936939239502, 0.008433655835688114, 0.012345886789262295, -0.009543287567794323, -0.06475242972373962, -0.049884308129549026, -0.04258568957448006, 0.010424740612506866, 0.051181185990571976, -0.03883345052599907, 0.021030165255069733, -0.014682965353131294, 0.034985557198524475, -0.04651983454823494, 0.041762467473745346, 0.06050661951303482, 0.028631441295146942, 0.06459548324346542, 0.07074648886919022, 0.004209463484585285, -0.09696918725967407, -0.053898122161626816, -0.019901854917407036, 0.0032303635962307453, -0.03813442587852478, -0.007309060078114271, -0.08617182075977325, -0.006003876682370901, -0.037719178944826126, 0.025253770872950554, 0.002887900685891509, -0.05089791864156723, 0.08230862766504288, -0.021142983809113503, -0.08174588531255722, 0.03670134022831917, -0.0001327488716924563, 0.019352413713932037, -0.012411396019160748, -0.0059392936527729034, -0.01771131530404091, -0.03946812450885773, -0.01608363166451454, -0.11211027204990387, 0.05394209921360016, 0.010748730972409248, -0.04561477527022362, 0.08054516464471817, -0.002122859936207533, -0.0013618191005662084, 0.011536983773112297, -0.07255294919013977, 0.09650787711143494, -0.10279731452465057, -0.08016087859869003, 0.04489188641309738, -0.004909948445856571, 0.03599271923303604, 0.098147913813591, -0.012732448987662792, -0.021476924419403076, -0.022985907271504402, 0.007321883924305439, 0.013840650208294392, -0.05405192822217941, -0.0057729678228497505, -0.06674260646104813, 0.011177096515893936, 0.015945525839924812, 0.056090954691171646, -0.03879036009311676, 0.04498382285237312, -0.0686083734035492, -0.017438571900129318, -0.010822254233062267, 0.0049499995075166225, 0.0639757588505745, 0.0588189959526062, 0.0033641005866229534, 0.04301336407661438, -0.04830922931432724, 0.023381248116493225, 0.04299306496977806, -0.12271752953529358, 0.047332514077425, -0.03329151123762131, 0.05976143479347229, -0.07605026662349701, -0.035412564873695374, -0.08051695674657822, -0.037705931812524796, -6.1381519527436804e-33, -0.04614398628473282, 0.028701340779662132, -0.06763492524623871, 0.09545879811048508, -0.030005402863025665, -0.003106348216533661, 0.0026770427357405424, 0.006523509975522757, 0.03409966826438904, -0.011014793068170547, -0.03232896327972412, 0.04676942527294159, 0.036606237292289734, -0.02118220366537571, 0.0947355329990387, -0.023045985028147697, 0.011920231394469738, 0.06936010718345642, 0.054841574281454086, -0.055321890860795975, -0.00741838663816452, 0.023063013330101967, 0.011217213235795498, 0.005486450623720884, 0.03977295756340027, 0.045724596828222275, -0.03190046176314354, 0.025041012093424797, -0.010934380814433098, -0.03228680416941643, -0.05175628885626793, 0.07205300778150558, -0.0195652786642313, 0.03699800744652748, -0.08994260430335999, -0.11961659044027328, 0.014439000748097897, 0.05992855504155159, 0.0668674036860466, -0.0023039605002850294, 0.05747904255986214, -0.018905149772763252, 0.06319142878055573, 0.009351993910968304, 0.011932676658034325, 0.016732988879084587, -0.07141707092523575, 0.03208477795124054, 0.036072198301553726, 0.02771722711622715, 0.0799066349864006, -0.022559329867362976, -0.023999858647584915, -0.01193978637456894, -0.0374932587146759, -0.036637019366025925, -0.025258656591176987, 0.04611901193857193, 0.05937874689698219, -0.012898905202746391, 0.026125585660338402, -0.027150627225637436, 0.017511826008558273, -0.028227191418409348, -0.06624790281057358, 0.01967405341565609, -0.044499773532152176, -0.005357696209102869, -0.014932388439774513, -0.009668960236012936, -0.03891627863049507, -0.06054667755961418, -0.0038758900482207537, 0.07106393575668335, -0.0027993146795779467, -0.04548146203160286, -0.03241356089711189, -0.09125293046236038, -0.023152701556682587, 0.029391465708613396, -0.016271693632006645, 0.07672091573476791, -0.003078412963077426, 0.09575275331735611, 0.12048575282096863, -0.02090268023312092, -0.0020194605458527803, -0.04844183474779129, -0.06954678893089294, -0.04339464381337166, 0.032511889934539795, 0.06176499277353287, -0.15102562308311462, 0.05007835105061531, 0.06685332953929901, -5.5040935365013866e-8, -0.051849525421857834, 0.00723266089335084, -0.14621886610984802, 0.008905477821826935, -0.010002822615206242, -0.05066601186990738, -0.07975873351097107, -0.08889105916023254, 0.044585853815078735, -0.05852004885673523, -0.01888267882168293, -0.08897529542446136, 0.01962917111814022, -0.10524889081716537, 0.02049066871404648, 0.08350198715925217, -0.03697901964187622, -0.02501978911459446, -0.027790572494268417, -0.011331853456795216, 0.03954973444342613, 0.016530152410268784, -0.14394620060920715, -0.004432967863976955, -0.0009804426226764917, 0.02590223215520382, -0.018942149356007576, 0.1015656590461731, 0.021979408338665962, -0.03234038129448891, -0.02841137908399105, 0.008551538921892643, 0.027779871597886086, -0.04959704354405403, 0.019169572740793228, 0.02989138662815094, -0.020262913778424263, -0.07110130041837692, 0.05896852910518646, 0.14918029308319092, 0.07105390727519989, -0.008402520790696144, -0.001209581852890551, 0.08083070814609528, -0.08432359993457794, 0.02532508596777916, 0.02256585843861103, 0.08548123389482498, 0.010287773795425892, 0.005179010331630707, 0.10146046429872513, -0.013282224535942078, -0.07211467623710632, 0.01171033177524805, 0.007390267215669155, -0.06428874284029007, -0.053720612078905106, -0.06865610182285309, 0.007609117776155472, 0.004469078965485096, 0.038794174790382385, 0.018758373335003853, 0.058790311217308044, -0.016981542110443115 ]
0.021741
actual message in bytes must be passed to `setAAD()` via the `plaintextLength` option. Many crypto libraries include the authentication tag in the ciphertext, which means that they produce ciphertexts of the length `plaintextLength + authTagLength`. Node.js does not include the authentication tag, so the ciphertext length is always `plaintextLength`. This is not necessary if no AAD is used. \* As CCM processes the whole message at once, `update()` must be called exactly once. \* Even though calling `update()` is sufficient to encrypt/decrypt the message, applications \_must\_ call `final()` to compute or verify the authentication tag. ```mjs import { Buffer } from 'node:buffer'; const { createCipheriv, createDecipheriv, randomBytes, } = await import('node:crypto'); const key = 'keykeykeykeykeykeykeykey'; const nonce = randomBytes(12); const aad = Buffer.from('0123456789', 'hex'); const cipher = createCipheriv('aes-192-ccm', key, nonce, { authTagLength: 16, }); const plaintext = 'Hello world'; cipher.setAAD(aad, { plaintextLength: Buffer.byteLength(plaintext), }); const ciphertext = cipher.update(plaintext, 'utf8'); cipher.final(); const tag = cipher.getAuthTag(); // Now transmit { ciphertext, nonce, tag }. const decipher = createDecipheriv('aes-192-ccm', key, nonce, { authTagLength: 16, }); decipher.setAuthTag(tag); decipher.setAAD(aad, { plaintextLength: ciphertext.length, }); const receivedPlaintext = decipher.update(ciphertext, null, 'utf8'); try { decipher.final(); } catch (err) { throw new Error('Authentication failed!', { cause: err }); } console.log(receivedPlaintext); ``` ```cjs const { Buffer } = require('node:buffer'); const { createCipheriv, createDecipheriv, randomBytes, } = require('node:crypto'); const key = 'keykeykeykeykeykeykeykey'; const nonce = randomBytes(12); const aad = Buffer.from('0123456789', 'hex'); const cipher = createCipheriv('aes-192-ccm', key, nonce, { authTagLength: 16, }); const plaintext = 'Hello world'; cipher.setAAD(aad, { plaintextLength: Buffer.byteLength(plaintext), }); const ciphertext = cipher.update(plaintext, 'utf8'); cipher.final(); const tag = cipher.getAuthTag(); // Now transmit { ciphertext, nonce, tag }. const decipher = createDecipheriv('aes-192-ccm', key, nonce, { authTagLength: 16, }); decipher.setAuthTag(tag); decipher.setAAD(aad, { plaintextLength: ciphertext.length, }); const receivedPlaintext = decipher.update(ciphertext, null, 'utf8'); try { decipher.final(); } catch (err) { throw new Error('Authentication failed!', { cause: err }); } console.log(receivedPlaintext); ``` ### FIPS mode When using OpenSSL 3, Node.js supports FIPS 140-2 when used with an appropriate OpenSSL 3 provider, such as the [FIPS provider from OpenSSL 3][] which can be installed by following the instructions in [OpenSSL's FIPS README file][]. For FIPS support in Node.js you will need: \* A correctly installed OpenSSL 3 FIPS provider. \* An OpenSSL 3 [FIPS module configuration file][]. \* An OpenSSL 3 configuration file that references the FIPS module configuration file. Node.js will need to be configured with an OpenSSL configuration file that points to the FIPS provider. An example configuration file looks like this: ```text nodejs\_conf = nodejs\_init .include //fipsmodule.cnf [nodejs\_init] providers = provider\_sect [provider\_sect] default = default\_sect # The fips section name should match the section name inside the # included fipsmodule.cnf. fips = fips\_sect [default\_sect] activate = 1 ``` where `fipsmodule.cnf` is the FIPS module configuration file generated from the FIPS provider installation step: ```bash openssl fipsinstall ``` Set the `OPENSSL\_CONF` environment variable to point to your configuration file and `OPENSSL\_MODULES` to the location of the FIPS provider dynamic library. e.g. ```bash export OPENSSL\_CONF=//nodejs.cnf export OPENSSL\_MODULES=//ossl-modules ``` FIPS mode can then be enabled in Node.js either by: \* Starting Node.js with `--enable-fips` or `--force-fips` command line flags. \* Programmatically calling `crypto.setFips(true)`. Optionally FIPS mode can be enabled in Node.js via the OpenSSL configuration file. e.g. ```text nodejs\_conf = nodejs\_init .include //fipsmodule.cnf [nodejs\_init] providers = provider\_sect alg\_section = algorithm\_sect [provider\_sect] default = default\_sect # The fips section name should match the section name inside the # included fipsmodule.cnf. fips = fips\_sect [default\_sect] activate = 1 [algorithm\_sect] default\_properties = fips=yes ``` ## Crypto constants The following constants exported by `crypto.constants` apply to various uses of the `node:crypto`, `node:tls`, and `node:https` modules and are generally specific
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.012764030136168003, 0.04385697841644287, -0.030316844582557678, 0.048406727612018585, -0.07721461355686188, -0.043450068682432175, 0.022290248423814774, 0.04821476340293884, 0.09217752516269684, 0.04220322147011757, -0.0035026015248149633, -0.054759614169597626, 0.021374735981225967, -0.039599161595106125, 0.0020691081881523132, 0.010128150694072247, -0.005881568416953087, 0.0263956431299448, -0.045011408627033234, -0.04522492736577988, -0.008101624436676502, -0.04443548247218132, 0.10140641778707504, 0.01590454950928688, -0.0114644980058074, -0.0067461347207427025, 0.030250325798988342, 0.03468393161892891, 0.028068436309695244, 0.04949856549501419, 0.07428077608346939, -0.0055083176121115685, 0.04937613382935524, 0.041711051017045975, -0.049161944538354874, 0.09758597612380981, -0.010782958939671516, -0.06937415897846222, -0.05512497201561928, -0.01600012555718422, 0.025762731209397316, 0.07264742255210876, -0.06269516795873642, 0.041827213019132614, -0.0008609963697381318, 0.007277167867869139, -0.056810230016708374, 0.10356485098600388, -0.04413384944200516, -0.007781151216477156, 0.053274188190698624, -0.019471528008580208, -0.07054588943719864, -0.0017581772990524769, -0.07938569784164429, 0.012522697448730469, -0.03483963385224342, 0.057612281292676926, 0.04774053394794464, -0.05713864415884018, -0.01942787691950798, -0.04506537690758705, 0.08830542862415314, 0.05645804852247238, 0.0573091134428978, 0.04034098982810974, -0.018439576029777527, -0.03758646920323372, -0.05030752718448639, 0.04147970303893089, -0.0008424567058682442, -0.02300463616847992, -0.024701684713363647, 0.05430101230740547, -0.06338262557983398, -0.03854668140411377, -0.05958309769630432, -0.014488348737359047, -0.04581315815448761, 0.046831317245960236, 0.02448929101228714, -0.10553360730409622, 0.03126499429345131, 0.041213974356651306, 0.03240353986620903, 0.0698191374540329, 0.030369915068149567, -0.032516784965991974, -0.03174571320414543, 0.052906863391399384, 0.008338701911270618, -0.039887502789497375, -0.06814680248498917, 0.026286693289875984, -0.03760738670825958, 0.025085899978876114, 0.0031731589697301388, 0.032145675271749496, -0.07460900396108627, -0.013276571407914162, 0.005768205504864454, 0.005462161265313625, -0.05766242370009422, -0.016614282503724098, 0.037034712731838226, 0.04639184847474098, 0.030852550640702248, -0.0225555170327425, 0.007902359589934349, 0.029183417558670044, 0.044431619346141815, 0.03584686666727066, -0.012899535708129406, 0.02052891068160534, 0.020258348435163498, 0.05847938731312752, 0.040045879781246185, -0.0228732917457819, 0.021663988009095192, 0.15081548690795898, 0.017931528389453888, -0.06222312152385712, -0.02024167589843273, -0.016381386667490005, -0.04844227433204651, -0.02073155716061592, 0.11994191259145737, 8.460217983228258e-33, -0.022217342630028725, -0.03353549540042877, -0.01873413287103176, 0.06568428874015808, 0.027811164036393166, 0.04699775576591492, 0.059796541929244995, -0.01054270938038826, -0.07285479456186295, -0.05787469074130058, -0.026560679078102112, -0.07491171360015869, 0.07812226563692093, -0.050360120832920074, 0.017621511593461037, -0.0077465595677495, 0.013069785200059414, -0.08006349951028824, 0.11313124746084213, 0.03730230778455734, 0.035845838487148285, 0.0054588308557868, 0.06251876801252365, -0.017186744138598442, -0.05202074348926544, -0.02108943462371826, -0.0044500622898340225, 0.0017173185478895903, 0.03361852467060089, -0.018417060375213623, -0.03105432353913784, 0.09590297192335129, -0.05172063410282135, -0.0039823357947170734, -0.005365684162825346, -0.02681720070540905, 0.006090566515922546, 0.003924963995814323, -0.08061005175113678, -0.1378667950630188, 0.04642552137374878, -0.053303297609090805, -0.027023034170269966, -0.004043187014758587, -0.0591108538210392, -0.06695419549942017, -0.08734599500894547, -0.023892048746347427, 0.05255545303225517, 0.06798598170280457, -0.00041889632120728493, 0.07674183696508408, -0.05361352488398552, -0.08531732112169266, 0.02059638872742653, -0.08260253816843033, -0.004886971786618233, -0.05800413712859154, -0.06566223502159119, 0.00818527489900589, -0.006057258229702711, -0.004636191762983799, -0.00607449933886528, -0.007444458547979593, -0.000554378260858357, 0.04501483589410782, -0.04171838238835335, -0.06517381966114044, -0.011004382744431496, 0.039213791489601135, -0.012759567238390446, -0.019663967192173004, 0.03656522184610367, 0.10183478146791458, -0.06992638111114502, 0.007582417689263821, -0.05206983909010887, 0.04098290205001831, 0.01453077420592308, -0.024490073323249817, 0.11103833466768265, 0.012856594286859035, 0.008914317935705185, 0.056934796273708344, 0.021090134978294373, -0.029583051800727844, -0.03442350775003433, -0.0179633479565382, -0.0039583416655659676, 0.03104660101234913, 0.05000722035765648, -0.0005444447742775083, 0.0775119960308075, -0.04890407621860504, -0.08969519287347794, -9.858320107369577e-33, -0.026168854907155037, 0.002822436159476638, -0.11641955375671387, 0.12781548500061035, 0.016184905543923378, -0.01012539304792881, -0.044556714594364166, 0.10129861533641815, -0.006072116084396839, -0.039314154535532, 0.004267535638064146, 0.05942591652274132, 0.024932637810707092, 0.012059570290148258, 0.05347703397274017, -0.02515554614365101, -0.031735628843307495, -0.002840136643499136, 0.05073251575231552, -0.03697315230965614, 0.0023925018031150103, -0.023025279864668846, -0.013683517463505268, 0.06367841362953186, 0.02808179147541523, 0.007338300347328186, -0.04637017473578453, 0.026067785918712616, 0.008744008839130402, -0.052954867482185364, -0.04429590329527855, 0.09402938187122345, -0.11222223192453384, 0.04215200990438461, -0.06579680740833282, -0.11533286422491074, 0.07992716878652573, 0.08482074737548828, -0.011424893513321877, 0.04931682348251343, 0.06582491099834442, -0.01482184138149023, -0.08100786060094833, -0.00014329836994875222, 0.07050705701112747, -0.003836711635813117, -0.0005057498347014189, 0.03353645280003548, -0.032641004770994186, 0.008203908801078796, 0.027661234140396118, -0.07773122191429138, 0.07326140999794006, 0.05910739302635193, 0.048808734863996506, 0.03437329828739166, -0.02116904780268669, 0.028060531243681908, 0.08059851080179214, -0.0011931717162951827, 0.01463831216096878, -0.025167664512991905, 0.04809565097093582, -0.037400923669338226, 0.016527894884347916, 0.03922935947775841, -0.07381217926740646, -0.0008218294242396951, -0.008600284345448017, 0.03421542048454285, -0.0065322257578372955, 0.005876991897821426, -0.05595625191926956, -0.02006140537559986, 0.005110513418912888, -0.056236907839775085, 0.008241142146289349, -0.18158747255802155, 0.0015743462136015296, 0.0050135585479438305, -0.03534851223230362, 0.09492415934801102, -0.027581077069044113, 0.13405853509902954, 0.01899476908147335, -0.0011874199844896793, 0.02401515655219555, -0.04902487248182297, -0.055208999663591385, 0.006908060982823372, -0.012214318849146366, 0.04132632166147232, -0.053908489644527435, -0.019534919410943985, 0.02642378956079483, -5.718993989489718e-8, -0.030596524477005005, -0.031776078045368195, -0.1274338811635971, -0.011738264933228493, 0.07820490747690201, 0.0109147559851408, -0.07052059471607208, -0.11060915142297745, 0.06275622546672821, -0.11944654583930969, 0.05273101106286049, -0.02796439453959465, 0.0358363538980484, 0.035703107714653015, -0.04026440531015396, 0.01914832927286625, -0.10412754118442535, -0.1060105413198471, 0.0005146496696397662, -0.11276085674762726, -0.011604403145611286, -0.00152406666893512, -0.017085276544094086, 0.044837117195129395, 0.046774670481681824, -0.040519021451473236, 0.05402492731809616, 0.07683855295181274, -0.08603539317846298, -0.03554535657167435, -0.09671259671449661, -0.07866235822439194, 0.09476882219314575, 0.010930483229458332, -0.0414910651743412, 0.0011446987045928836, 0.013092812150716782, -0.08263420313596725, 0.08063947409391403, 0.029756609350442886, 0.015317415818572044, -0.0003879825526382774, 0.0009035183466039598, 0.034512560814619064, -0.05924456566572189, 0.0010094708995893598, 0.04849224537611008, 0.015424647368490696, -0.004927933216094971, 0.04945080354809761, 0.05743628740310669, -0.0033410675823688507, -0.03560994938015938, -0.013461029157042503, 0.005314026027917862, -0.0511099137365818, -0.011266704648733139, -0.10678771883249283, 0.021649906411767006, 0.006740565411746502, 0.043493445962667465, -0.004772917367517948, 0.017685409635305405, -0.10134213417768478 ]
0.022164
The fips section name should match the section name inside the # included fipsmodule.cnf. fips = fips\_sect [default\_sect] activate = 1 [algorithm\_sect] default\_properties = fips=yes ``` ## Crypto constants The following constants exported by `crypto.constants` apply to various uses of the `node:crypto`, `node:tls`, and `node:https` modules and are generally specific to OpenSSL. ### OpenSSL options See the [list of SSL OP Flags][] for details. | Constant | Description | | --- | --- | | `SSL_OP_ALL` | Applies multiple bug workarounds within OpenSSL. See <https://www.openssl.org/docs/man3.0/man3/SSL_CTX_set_options.html> for detail. | | `SSL_OP_ALLOW_NO_DHE_KEX` | Instructs OpenSSL to allow a non-[EC]DHE-based key exchange mode for TLS v1.3 | | `SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION` | Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See <https://www.openssl.org/docs/man3.0/man3/SSL_CTX_set_options.html>. | | `SSL_OP_CIPHER_SERVER_PREFERENCE` | Attempts to use the server's preferences instead of the client's when selecting a cipher. Behavior depends on protocol version. See <https://www.openssl.org/docs/man3.0/man3/SSL_CTX_set_options.html>. | | `SSL_OP_CISCO_ANYCONNECT` | Instructs OpenSSL to use Cisco's version identifier of DTLS\_BAD\_VER. | | `SSL_OP_COOKIE_EXCHANGE` | Instructs OpenSSL to turn on cookie exchange. | | `SSL_OP_CRYPTOPRO_TLSEXT_BUG` | Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. | | `SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS` | Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. | | `SSL_OP_LEGACY_SERVER_CONNECT` | Allows initial connection to servers that do not support RI. | | `SSL_OP_NO_COMPRESSION` | Instructs OpenSSL to disable support for SSL/TLS compression. | | `SSL_OP_NO_ENCRYPT_THEN_MAC` | Instructs OpenSSL to disable encrypt-then-MAC. | | `SSL_OP_NO_QUERY_MTU` | | | `SSL_OP_NO_RENEGOTIATION` | Instructs OpenSSL to disable renegotiation. | | `SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION` | Instructs OpenSSL to always start a new session when performing renegotiation. | | `SSL_OP_NO_SSLv2` | Instructs OpenSSL to turn off SSL v2 | | `SSL_OP_NO_SSLv3` | Instructs OpenSSL to turn off SSL v3 | | `SSL_OP_NO_TICKET` | Instructs OpenSSL to disable use of RFC4507bis tickets. | | `SSL_OP_NO_TLSv1` | Instructs OpenSSL to turn off TLS v1 | | `SSL_OP_NO_TLSv1_1` | Instructs OpenSSL to turn off TLS v1.1 | | `SSL_OP_NO_TLSv1_2` | Instructs OpenSSL to turn off TLS v1.2 | | `SSL_OP_NO_TLSv1_3` | Instructs OpenSSL to turn off TLS v1.3 | | `SSL_OP_PRIORITIZE_CHACHA` | Instructs OpenSSL server to prioritize ChaCha20-Poly1305 when the client does. This option has no effect if `SSL_OP_CIPHER_SERVER_PREFERENCE` is not enabled. | | `SSL_OP_TLS_ROLLBACK_BUG` | Instructs OpenSSL to disable version rollback attack detection. | ### OpenSSL engine constants | Constant | Description | | --- | --- | | `ENGINE_METHOD_RSA` | Limit engine usage to RSA | | `ENGINE_METHOD_DSA` | Limit engine usage to DSA | | `ENGINE_METHOD_DH` | Limit engine usage to DH | | `ENGINE_METHOD_RAND` | Limit engine usage to RAND | | `ENGINE_METHOD_EC` | Limit engine usage to EC | | `ENGINE_METHOD_CIPHERS` | Limit engine usage to CIPHERS | | `ENGINE_METHOD_DIGESTS` | Limit engine usage to DIGESTS | | `ENGINE_METHOD_PKEY_METHS` | Limit engine usage to PKEY\_METHS | | `ENGINE_METHOD_PKEY_ASN1_METHS` | Limit engine usage to PKEY\_ASN1\_METHS | | `ENGINE_METHOD_ALL` | | | `ENGINE_METHOD_NONE` | | ### Other OpenSSL constants | Constant | Description | | --- | --- | | `DH_CHECK_P_NOT_SAFE_PRIME` | | | `DH_CHECK_P_NOT_PRIME` | | | `DH_UNABLE_TO_CHECK_GENERATOR` | | | `DH_NOT_SUITABLE_GENERATOR` | | | `RSA_PKCS1_PADDING` | | | `RSA_SSLV23_PADDING` | | | `RSA_NO_PADDING` | | | `RSA_PKCS1_OAEP_PADDING` | | | `RSA_X931_PADDING` | | | `RSA_PKCS1_PSS_PADDING` | | | `RSA_PSS_SALTLEN_DIGEST` | Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the digest size when signing or verifying. | | `RSA_PSS_SALTLEN_MAX_SIGN` | Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the maximum permissible value when signing data. | | `RSA_PSS_SALTLEN_AUTO` | Causes the salt length for `RSA_PKCS1_PSS_PADDING` to be determined automatically when verifying a signature. | | `POINT_CONVERSION_COMPRESSED` | | | `POINT_CONVERSION_UNCOMPRESSED`
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.06688792258501053, 0.0456506684422493, 0.0007980790687724948, 0.05501781031489372, 0.03302432969212532, -0.06607860326766968, -0.0456295870244503, -0.003128095529973507, 0.02058039978146553, -0.02840171381831169, 0.039190392941236496, -0.041397519409656525, -0.04664751514792442, 0.0430663526058197, 0.01555553451180458, -0.03263722360134125, -0.011364852078258991, 0.05473374202847481, 0.049743231385946274, 0.013051813468337059, 0.04609797149896622, 0.00834067352116108, 0.030829543247818947, 0.02694733440876007, -0.03324876353144646, -0.011541074141860008, -0.050151992589235306, 0.07021244615316391, -0.014279755763709545, -0.04098813235759735, 0.03402649611234665, 0.05344875529408455, 0.026799291372299194, 0.021184293553233147, 0.017172517254948616, 0.05048413947224617, 0.032197631895542145, -0.05832767114043236, -0.0003782568091992289, -0.04084019362926483, 0.03805895522236824, -0.04684185981750488, -0.03728578984737396, 0.022098742425441742, -0.03860275074839592, 0.02373979240655899, 0.0259863268584013, 0.03901084512472153, -0.045779548585414886, -0.05614999681711197, -0.027140270918607712, -0.001015733927488327, 0.02259555459022522, 0.05097292736172676, -0.0023096920922398567, -0.00966145470738411, -0.023743046447634697, 0.024669187143445015, -0.01572270132601261, -0.020898306742310524, -0.07965614646673203, 0.008446973748505116, -0.02638808824121952, 0.007710850331932306, -0.008247880265116692, 0.06743602454662323, -0.03360291197896004, -0.07189829647541046, -0.048071082681417465, 0.09775236994028091, -0.03897102177143097, -0.02625705488026142, 0.035715796053409576, 0.05087796226143837, 0.023615103214979172, 0.056117620319128036, -0.08266312628984451, -0.007819605059921741, -0.044185150414705276, -0.03509170562028885, 0.0064324792474508286, -0.053769174963235855, -0.00829230435192585, -0.0317692831158638, 0.035300105810165405, -0.05022658407688141, 0.00942467711865902, -0.03368131443858147, 0.01182163879275322, 0.049849722534418106, 0.03963923454284668, -0.04198797419667244, -0.10550571978092194, 0.00042000383837148547, 0.1242230236530304, 0.056914687156677246, -0.03404580429196358, 0.004483087919652462, -0.049665872007608414, -0.06254589557647705, -0.007568192668259144, 0.010555424727499485, 0.021632147952914238, -0.015995806083083153, -0.01120436005294323, 0.01247367076575756, 0.006203321740031242, 0.030859576538205147, -0.03658857196569443, -0.027173608541488647, 0.03817591071128845, 0.008254037238657475, 0.0036052274517714977, -0.10751643776893616, 0.0255181435495615, 0.06975656747817993, -0.02561693638563156, -0.0030425572767853737, 0.044215332716703415, 0.04664353281259537, -0.004687337204813957, -0.012791940942406654, 0.0011727680684998631, 0.1285725086927414, -0.03337733447551727, -0.0020322101190686226, -0.023525487631559372, 3.335038001730114e-33, 0.0032432747539132833, 0.00936879962682724, -0.03324494510889053, 0.010372829623520374, -0.017649123445153236, -0.06723139435052872, 0.0823790654540062, -0.04286827892065048, -0.08096520602703094, 0.02672393061220646, -0.022037874907255173, -0.004261904861778021, -0.059391655027866364, -0.06787117570638657, 0.028012791648507118, -0.04199871048331261, -0.026339007541537285, 0.006438528653234243, 0.0860217958688736, -0.02396894246339798, 0.08894336968660355, 0.010414275340735912, 0.00253767310641706, 0.008979249745607376, 0.08948902040719986, 0.0641511008143425, -0.06972352415323257, -0.009470870718359947, 0.017459118738770485, -0.00880501139909029, 0.05467312037944794, 0.08152106404304504, 0.04943882301449776, -0.01462519820779562, 0.03605642542243004, 0.03379826992750168, 0.007269829045981169, 0.004244313109666109, -0.08822263032197952, -0.014138178899884224, 0.08893267810344696, 0.05843350663781166, 0.030054567381739616, 0.040567051619291306, 0.03342483937740326, -0.00939248688519001, -0.12247630953788757, 0.00955999456346035, 0.07845558226108551, 0.007845456711947918, 0.044726159423589706, 0.029367763549089432, -0.0526694692671299, -0.10363169759511948, 0.07231976091861725, -0.09583916515111923, -0.02206837199628353, 0.031807877123355865, -0.11254529654979706, -0.03708067536354065, -0.005546831991523504, -0.05765298381447792, -0.011875801719725132, -0.08213255554437637, -0.006803620606660843, 0.06736216694116592, -0.008732099086046219, 0.04162843897938728, -0.04941469058394432, 0.03601645678281784, -0.05859195068478584, 0.09415298700332642, 0.022217856720089912, 0.050956305116415024, 0.10358656197786331, -0.046314917504787445, 0.003037991002202034, 0.017151502892374992, 0.02810085006058216, -0.018096156418323517, 0.006225543562322855, 0.055129218846559525, -0.02280604839324951, 0.03251376375555992, -0.01156033854931593, 0.00761528592556715, 0.03223954141139984, 0.09049691259860992, -0.03732370212674141, -0.068375363945961, 0.13827385008335114, 0.03816527873277664, 0.04597313702106476, 0.024243775755167007, -0.03771341219544411, -4.4001853917628515e-33, 0.0041834828443825245, -0.080082468688488, -0.021520325914025307, 0.04614504054188728, -0.008956501260399818, -0.03168387711048126, -0.04029054194688797, -0.014332282356917858, 0.14893750846385956, 0.034934502094984055, 0.010184909217059612, -0.07445556670427322, 0.04913037642836571, -0.07723205536603928, -0.012290832586586475, -0.06559698283672333, -0.14555202424526215, 0.00035795284202322364, -0.015716128051280975, 0.02637729048728943, -0.017273399978876114, 0.0401303693652153, 0.09418971091508865, 0.06765475869178772, 0.09791675209999084, 0.041141949594020844, -0.06305989623069763, 0.03604477643966675, 0.010695251636207104, -0.015081416815519333, -0.016930077224969864, 0.03803414851427078, -0.008409061469137669, 0.00147261715028435, -0.10654810070991516, -0.05225864797830582, -0.110137440264225, 0.03843172639608383, 0.09048806875944138, 0.031183674931526184, 0.08230874687433243, 0.03394303098320961, 0.03311534970998764, -0.03321788087487221, -0.021254561841487885, -0.042732685804367065, 0.08524413406848907, -0.03052038699388504, -0.022515498101711273, -0.08531231433153152, -0.024225348606705666, 0.030495263636112213, -0.061583198606967926, -0.032299019396305084, 0.06450077146291733, 0.09944888204336166, -0.08931461721658707, 0.0670069009065628, -0.03778839111328125, -0.07267044484615326, 0.03499423339962959, 0.04334907978773117, 0.030141837894916534, 0.05559656769037247, 0.05086572468280792, 0.04340192303061485, -0.09872670471668243, -0.03307224065065384, 0.06762446463108063, 0.05850214138627052, -0.04887232184410095, -0.07978606969118118, -0.06321506202220917, -0.04283922538161278, 0.08738379925489426, 0.008267748169600964, -0.03261908143758774, 0.07469544559717178, -0.003920520655810833, 0.07648064196109772, -0.0370987169444561, 0.035655662417411804, -0.11349187046289444, 0.05496852844953537, 0.016725359484553337, -0.04028480499982834, 0.039008352905511856, 0.05622082203626633, -0.037820715457201004, 0.04038964956998825, 0.03923306614160538, 0.03545574098825455, 0.03536028787493706, 0.08082903921604156, 0.03823089227080345, -5.0636689508110067e-8, -0.040153756737709045, 0.022970743477344513, -0.15865536034107208, 0.015957001596689224, 0.08997008949518204, 0.024853212758898735, -0.003976800944656134, -0.0742141529917717, -0.02383035607635975, 0.002033496741205454, -0.004403665196150541, 0.028124818578362465, -0.0012076786952093244, -0.04461211338639259, 0.0031480861362069845, -0.07977225631475449, -0.08201783150434494, -0.03466028720140457, 0.001609712140634656, -0.09072073549032211, -0.02139677293598652, -0.022519804537296295, -0.05497748777270317, 0.060757827013731, -0.024257158860564232, 0.07984506338834763, -0.025267891585826874, -0.032055143266916275, 0.03421991690993309, 0.04548671096563339, -0.003948443103581667, -0.0614759624004364, -0.02810349129140377, 0.00005719067848986015, -0.04828798770904541, 0.06060498207807541, -0.09176100045442581, -0.042011577636003494, 0.03561936691403389, 0.14068050682544708, 0.017075007781386375, -0.013174416497349739, 0.015729304403066635, 0.012983587570488453, -0.0927547812461853, 0.07804735749959946, 0.04152589663863182, 0.006331817712634802, -0.04449388384819031, 0.025545842945575714, 0.000747735844925046, -0.014896220527589321, -0.04625176638364792, -0.029358595609664917, -0.012402508407831192, -0.004193683620542288, 0.0630413070321083, -0.011934743262827396, 0.025065356865525246, -0.09428788721561432, -0.024677667766809464, -0.09314878284931183, 0.051995981484651566, 0.05871082842350006 ]
0.005828
the digest size when signing or verifying. | | `RSA_PSS_SALTLEN_MAX_SIGN` | Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the maximum permissible value when signing data. | | `RSA_PSS_SALTLEN_AUTO` | Causes the salt length for `RSA_PKCS1_PSS_PADDING` to be determined automatically when verifying a signature. | | `POINT_CONVERSION_COMPRESSED` | | | `POINT_CONVERSION_UNCOMPRESSED` | | | `POINT_CONVERSION_HYBRID` | | ### Node.js crypto constants | Constant | Description | | --- | --- | | `defaultCoreCipherList` | Specifies the built-in default cipher list used by Node.js. | | `defaultCipherList` | Specifies the active default cipher list used by the current Node.js process. | [^openssl30]: Requires OpenSSL >= 3.0 [^openssl32]: Requires OpenSSL >= 3.2 [^openssl35]: Requires OpenSSL >= 3.5 [AEAD algorithms]: https://en.wikipedia.org/wiki/Authenticated\_encryption [CCM mode]: #ccm-mode [CVE-2021-44532]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44532 [Caveats]: #support-for-weak-or-compromised-algorithms [Crypto constants]: #crypto-constants [FIPS module configuration file]: https://www.openssl.org/docs/man3.0/man5/fips\_config.html [FIPS provider from OpenSSL 3]: https://www.openssl.org/docs/man3.0/man7/crypto.html#FIPS-provider [HTML 5.2]: https://www.w3.org/TR/html52/changes.html#features-removed [JWK]: https://tools.ietf.org/html/rfc7517 [Key usages]: webcrypto.md#cryptokeyusages [NIST SP 800-131A]: https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar2.pdf [NIST SP 800-132]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf [NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf [OpenSSL's FIPS README file]: https://github.com/openssl/openssl/blob/openssl-3.0/README-FIPS.md [OpenSSL's SPKAC implementation]: https://www.openssl.org/docs/man3.0/man1/openssl-spkac.html [RFC 1421]: https://www.rfc-editor.org/rfc/rfc1421.txt [RFC 2409]: https://www.rfc-editor.org/rfc/rfc2409.txt [RFC 2818]: https://www.rfc-editor.org/rfc/rfc2818.txt [RFC 3526]: https://www.rfc-editor.org/rfc/rfc3526.txt [RFC 3610]: https://www.rfc-editor.org/rfc/rfc3610.txt [RFC 4055]: https://www.rfc-editor.org/rfc/rfc4055.txt [RFC 4122]: https://www.rfc-editor.org/rfc/rfc4122.txt [RFC 5208]: https://www.rfc-editor.org/rfc/rfc5208.txt [RFC 5280]: https://www.rfc-editor.org/rfc/rfc5280.txt [Web Crypto API documentation]: webcrypto.md [`BN\_is\_prime\_ex`]: https://www.openssl.org/docs/man1.1.1/man3/BN\_is\_prime\_ex.html [`Buffer`]: buffer.md [`DH\_generate\_key()`]: https://www.openssl.org/docs/man3.0/man3/DH\_generate\_key.html [`DiffieHellmanGroup`]: #class-diffiehellmangroup [`KeyObject`]: #class-keyobject [`Sign`]: #class-sign [`String.prototype.normalize()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/String/normalize [`UV\_THREADPOOL\_SIZE`]: cli.md#uv\_threadpool\_sizesize [`Verify`]: #class-verify [`cipher.final()`]: #cipherfinaloutputencoding [`cipher.update()`]: #cipherupdatedata-inputencoding-outputencoding [`crypto.createCipheriv()`]: #cryptocreatecipherivalgorithm-key-iv-options [`crypto.createDecipheriv()`]: #cryptocreatedecipherivalgorithm-key-iv-options [`crypto.createDiffieHellman()`]: #cryptocreatediffiehellmanprime-primeencoding-generator-generatorencoding [`crypto.createECDH()`]: #cryptocreateecdhcurvename [`crypto.createHash()`]: #cryptocreatehashalgorithm-options [`crypto.createHmac()`]: #cryptocreatehmacalgorithm-key-options [`crypto.createPrivateKey()`]: #cryptocreateprivatekeykey [`crypto.createPublicKey()`]: #cryptocreatepublickeykey [`crypto.createSecretKey()`]: #cryptocreatesecretkeykey-encoding [`crypto.createSign()`]: #cryptocreatesignalgorithm-options [`crypto.createVerify()`]: #cryptocreateverifyalgorithm-options [`crypto.generateKey()`]: #cryptogeneratekeytype-options-callback [`crypto.getCurves()`]: #cryptogetcurves [`crypto.getDiffieHellman()`]: #cryptogetdiffiehellmangroupname [`crypto.getHashes()`]: #cryptogethashes [`crypto.privateDecrypt()`]: #cryptoprivatedecryptprivatekey-buffer [`crypto.privateEncrypt()`]: #cryptoprivateencryptprivatekey-buffer [`crypto.publicDecrypt()`]: #cryptopublicdecryptkey-buffer [`crypto.publicEncrypt()`]: #cryptopublicencryptkey-buffer [`crypto.randomBytes()`]: #cryptorandombytessize-callback [`crypto.randomFill()`]: #cryptorandomfillbuffer-offset-size-callback [`crypto.webcrypto.getRandomValues()`]: webcrypto.md#cryptogetrandomvaluestypedarray [`crypto.webcrypto.subtle`]: webcrypto.md#class-subtlecrypto [`decipher.final()`]: #decipherfinaloutputencoding [`decipher.update()`]: #decipherupdatedata-inputencoding-outputencoding [`diffieHellman.generateKeys()`]: #diffiehellmangeneratekeysencoding [`diffieHellman.setPublicKey()`]: #diffiehellmansetpublickeypublickey-encoding [`ecdh.generateKeys()`]: #ecdhgeneratekeysencoding-format [`ecdh.setPrivateKey()`]: #ecdhsetprivatekeyprivatekey-encoding [`hash.digest()`]: #hashdigestencoding [`hash.update()`]: #hashupdatedata-inputencoding [`hmac.digest()`]: #hmacdigestencoding [`hmac.update()`]: #hmacupdatedata-inputencoding [`import()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import [`keyObject.export()`]: #keyobjectexportoptions [`postMessage()`]: worker\_threads.md#portpostmessagevalue-transferlist [`sign.sign()`]: #signsignprivatekey-outputencoding [`sign.update()`]: #signupdatedata-inputencoding [`stream.Writable` options]: stream.md#new-streamwritableoptions [`stream.transform` options]: stream.md#new-streamtransformoptions [`util.promisify()`]: util.md#utilpromisifyoriginal [`verify.update()`]: #verifyupdatedata-inputencoding [`verify.verify()`]: #verifyverifyobject-signature-signatureencoding [`x509.fingerprint256`]: #x509fingerprint256 [`x509.verify(publicKey)`]: #x509verifypublickey [argon2]: https://www.rfc-editor.org/rfc/rfc9106.html [asymmetric key types]: #asymmetric-key-types [caveats when using strings as inputs to cryptographic APIs]: #using-strings-as-inputs-to-cryptographic-apis [certificate object]: tls.md#certificate-object [encoding]: buffer.md#buffers-and-character-encodings [initialization vector]: https://en.wikipedia.org/wiki/Initialization\_vector [legacy provider]: cli.md#--openssl-legacy-provider [list of SSL OP Flags]: https://wiki.openssl.org/index.php/List\_of\_SSL\_OP\_Flags#Table\_of\_Options [modulo bias]: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates\_shuffle#Modulo\_bias [safe integers]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Number/isSafeInteger [scrypt]: https://en.wikipedia.org/wiki/Scrypt [stream]: stream.md [stream-writable-write]: stream.md#writablewritechunk-encoding-callback
https://github.com/nodejs/node/blob/main//doc/api/crypto.md
main
nodejs
[ -0.042831841856241226, 0.048298127949237823, -0.04432542249560356, 0.019179996103048325, 0.10688503086566925, -0.08438645303249359, -0.047860052436590195, 0.09992047399282455, 0.03445368632674217, -0.051355425268411636, -0.04871063679456711, 0.055087871849536896, 0.016682010143995285, -0.004195848945528269, -0.014066750183701515, -0.05898106470704079, -0.04546558856964111, 0.06901224702596664, -0.013069156557321548, -0.011041859164834023, 0.06004735454916954, -0.04420485720038414, 0.04030672088265419, -0.029159843921661377, 0.007742689456790686, 0.01178415585309267, 0.0007814278942532837, 0.05038311704993248, 0.006137796211987734, -0.031497806310653687, 0.02311594784259796, -0.03552261367440224, 0.07374437898397446, 0.050846487283706665, 0.026113811880350113, 0.09239519387483597, 0.044208988547325134, -0.059837039560079575, -0.026501361280679703, -0.002359044272452593, 0.02460012398660183, 0.03004022315144539, -0.06717001646757126, 0.0000901909515960142, -0.016785871237516403, 0.00862246286123991, -0.11410237103700638, 0.0279057789593935, -0.10734010487794876, -0.033053312450647354, 0.020253119990229607, -0.03167472034692764, -0.04315066710114479, 0.008511461317539215, -0.07676509767770767, -0.030638938769698143, -0.0923132449388504, 0.009527301415801048, 0.011226208880543709, 0.05000754073262215, -0.040237993001937866, -0.008970692753791809, 0.01667221263051033, 0.0105778519064188, 0.06621261686086655, 0.07794196903705597, 0.03942792862653732, -0.0946468859910965, -0.02252182736992836, 0.07676586508750916, -0.035207051783800125, 0.07356134802103043, -0.06707362830638885, 0.058241602033376694, -0.018949951976537704, -0.03139858692884445, -0.07801145315170288, 0.013627034611999989, -0.08465712517499924, -0.02701101452112198, -0.07425051182508469, -0.0725807175040245, -0.08399253338575363, 0.05179498344659805, -0.03237294405698776, 0.08195008337497711, -0.03165920823812485, -0.030552005395293236, 0.049297623336315155, 0.038844820111989975, 0.04094797372817993, -0.0677044540643692, -0.03696596249938011, 0.03832952678203583, 0.005042895209044218, 0.022144339978694916, -0.004358553793281317, 0.0074628666043281555, -0.03856230154633522, -0.026911037042737007, -0.022632652893662453, 0.014953656122088432, 0.056875549256801605, -0.047612037509679794, 0.07722878456115723, 0.023795858025550842, -0.024388035759329796, -0.0007532603340223432, -0.005642289761453867, 0.08687794208526611, 0.07602275162935257, 0.07134510576725006, -0.013700845651328564, -0.03181285038590431, 0.04267800599336624, 0.05141575634479523, 0.0061864471063017845, -0.03215707466006279, 0.021945852786302567, 0.09119952470064163, 0.0791676938533783, -0.002906588837504387, -0.07925081253051758, 0.020633934065699577, -0.01928555592894554, 0.007365348283201456, 0.00306978658773005, 7.39099272982412e-33, -0.016026977449655533, 0.09412325173616409, 0.08138717710971832, 0.021549616008996964, -0.07747889310121536, 0.04624932259321213, -0.012772612273693085, -0.01481025293469429, -0.08496741205453873, 0.06869354844093323, -0.0128231942653656, 0.07112651318311691, 0.02280789241194725, -0.03244397044181824, 0.03367368504405022, 0.021851709112524986, 0.05991220101714134, 0.006199670024216175, 0.034909073263406754, 0.0006990150432102382, 0.037339843809604645, -0.013551358133554459, 0.058553215116262436, 0.037553440779447556, 0.010679149068892002, -0.027208227664232254, -0.017786335200071335, 0.031808335334062576, -0.05734444409608841, -0.04108285531401634, -0.01758171059191227, 0.03090113215148449, 0.005459098611027002, 0.04638029262423515, 0.06011207029223442, 0.038094062358140945, 0.06102339178323746, -0.03683249279856682, -0.06844356656074524, -0.029928497970104218, 0.05892986059188843, 0.05282856896519661, -0.015910679474473, 0.03817233443260193, -0.025451475754380226, -0.0780993178486824, -0.047495678067207336, -0.05733684077858925, 0.08148609101772308, 0.04296056553721428, -0.012372005730867386, 0.06564348936080933, -0.013650944456458092, 0.0023709703236818314, 0.013428987935185432, -0.11144481599330902, 0.08322469890117645, -0.07683869451284409, -0.07500184327363968, 0.024691972881555557, 0.030952567234635353, -0.05880405381321907, 0.03286661580204964, -0.06758290529251099, 0.024925902485847473, 0.08143846690654755, -0.058347832411527634, -0.017775068059563637, -0.019003011286258698, 0.019514841958880424, -0.06300081312656403, 0.026637397706508636, 0.011555677279829979, 0.09233926981687546, -0.056083835661411285, -0.0775093287229538, -0.030510224401950836, 0.044608816504478455, 0.045759327709674835, 0.004830339923501015, -0.036669597029685974, 0.033710233867168427, -0.016686251387000084, 0.07392267137765884, -0.023132339119911194, -0.05706482008099556, -0.014739417470991611, -0.0018828439060598612, -0.06496092677116394, -0.045556843280792236, 0.07735241204500198, 0.02582622691988945, 0.020452724769711494, -0.03819339722394943, -0.07359650731086731, -7.624617089262265e-33, -0.04514225572347641, -0.0398220419883728, -0.08081325143575668, 0.13945519924163818, -0.03174575790762901, -0.06705654412508011, -0.07095979899168015, 0.09251513332128525, 0.026212748140096664, -0.019256364554166794, 0.029227592051029205, -0.04655812680721283, 0.07795627415180206, -0.05187845602631569, 0.026008013635873795, 0.021089591085910797, -0.09621100127696991, 0.025831371545791626, 0.08814205229282379, -0.014737747609615326, 0.03934453800320625, 0.05657725781202316, 0.06648308783769608, 0.08418061584234238, 0.00858366210013628, -0.00040589936543256044, 0.005187593400478363, -0.012932786718010902, -0.06296004354953766, -0.03996820002794266, 0.0488385409116745, 0.05025888606905937, -0.04616129770874977, 0.01811172440648079, -0.07906350493431091, -0.15083065629005432, -0.07557279616594315, 0.06994195282459259, 0.11509796231985092, 0.04260601848363876, 0.004443409387022257, -0.005396004766225815, 0.0015527840005233884, -0.014643721282482147, -0.008233786560595036, -0.00830965768545866, 0.07850787043571472, 0.04487025365233421, 0.05387383699417114, -0.03144402429461479, 0.021390825510025024, -0.026702096685767174, -0.04220317304134369, 0.0318109430372715, 0.05131598562002182, -0.01421351544559002, -0.10581706464290619, 0.06039964035153389, 0.05309220775961876, -0.06960082799196243, 0.03476516902446747, 0.01422224659472704, -0.0165416169911623, -0.003102022223174572, 0.008339758031070232, -0.017236173152923584, -0.031396228820085526, -0.01250874251127243, 0.04427173361182213, 0.038908183574676514, -0.03012653812766075, -0.02864128164947033, 0.027690989896655083, 0.015703896060585976, -0.05663701519370079, -0.0506599061191082, -0.026388755068182945, -0.024994509294629097, 0.051734745502471924, -0.0178961381316185, -0.12657946348190308, 0.11565805226564407, -0.05482220649719238, 0.06988497078418732, 0.04821719601750374, 0.023522278293967247, 0.02974354475736618, 0.03652099147439003, -0.06095312535762787, 0.05216837301850319, 0.014498854987323284, 0.0540023148059845, -0.02571715973317623, 0.04510599002242088, 0.0008603188907727599, -5.030550909168596e-8, -0.0301457941532135, -0.03133373707532883, -0.17025436460971832, -0.01680881157517433, 0.047611285001039505, 0.00720486743375659, 0.015627164393663406, -0.027497248724102974, 0.02730810083448887, 0.010814514942467213, 0.04659046605229378, 0.0248266588896513, -0.025448543950915337, -0.055058553814888, 0.011408381164073944, 0.002024149987846613, -0.052710939198732376, 0.058181289583444595, -0.05768364295363426, -0.06326883286237717, -0.005886212922632694, -0.015736673027276993, -0.07558411359786987, -0.0018725695554167032, 0.04280409961938858, -0.04095844179391861, 0.00789629202336073, 0.1277557611465454, -0.03053738921880722, -0.03720379248261452, -0.01694229617714882, -0.0468275249004364, 0.01929674670100212, -0.11284157633781433, 0.014367442578077316, 0.04400559142231941, -0.038815613836050034, -0.011187160387635231, 0.09971808642148972, 0.09856051951646805, -0.06867452710866928, -0.042471688240766525, -0.0439569428563118, 0.02147221751511097, -0.11604152619838715, 0.023304764181375504, 0.014946166425943375, 0.06599962711334229, -0.04619624838232994, 0.011747234500944614, 0.06672406941652298, -0.0828854888677597, -0.03644610196352005, -0.06762207299470901, -0.011522105894982815, 0.0051185074262320995, -0.027553677558898926, 0.01284642331302166, 0.03202978894114494, -0.01603575423359871, 0.0457102507352829, -0.01879872940480709, -0.000494864652864635, 0.009904861450195312 ]
0.02045
# Node-API > Stability: 2 - Stable Node-API (formerly N-API) is an API for building native Addons. It is independent from the underlying JavaScript runtime (for example, V8) and is maintained as part of Node.js itself. This API will be Application Binary Interface (ABI) stable across versions of Node.js. It is intended to insulate addons from changes in the underlying JavaScript engine and allow modules compiled for one major version to run on later major versions of Node.js without recompilation. The [ABI Stability][] guide provides a more in-depth explanation. Addons are built/packaged with the same approach/tools outlined in the section titled [C++ Addons][]. The only difference is the set of APIs that are used by the native code. Instead of using the V8 or [Native Abstractions for Node.js][] APIs, the functions available in Node-API are used. APIs exposed by Node-API are generally used to create and manipulate JavaScript values. Concepts and operations generally map to ideas specified in the ECMA-262 Language Specification. The APIs have the following properties: \* All Node-API calls return a status code of type `napi\_status`. This status indicates whether the API call succeeded or failed. \* The API's return value is passed via an out parameter. \* All JavaScript values are abstracted behind an opaque type named `napi\_value`. \* In case of an error status code, additional information can be obtained using `napi\_get\_last\_error\_info`. More information can be found in the error handling section [Error handling][]. ## Writing addons in various programming languages Node-API is a C API that ensures ABI stability across Node.js versions and different compiler levels. With this stability guarantee, it is possible to write addons in other programming languages on top of Node-API. Refer to [language and engine bindings][] for more programming languages and engines support details. [`node-addon-api`][] is the official C++ binding that provides a more efficient way to write C++ code that calls Node-API. This wrapper is a header-only library that offers an inlinable C++ API. Binaries built with `node-addon-api` will depend on the symbols of the Node-API C-based functions exported by Node.js. The following code snippet is an example of `node-addon-api`: ```cpp Object obj = Object::New(env); obj["foo"] = String::New(env, "bar"); ``` The above `node-addon-api` C++ code is equivalent to the following C-based Node-API code: ```cpp napi\_status status; napi\_value object, string; status = napi\_create\_object(env, &object); if (status != napi\_ok) { napi\_throw\_error(env, ...); return; } status = napi\_create\_string\_utf8(env, "bar", NAPI\_AUTO\_LENGTH, &string); if (status != napi\_ok) { napi\_throw\_error(env, ...); return; } status = napi\_set\_named\_property(env, object, "foo", string); if (status != napi\_ok) { napi\_throw\_error(env, ...); return; } ``` The end result is that the addon only uses the exported C APIs. Even though the addon is written in C++, it still gets the benefits of the ABI stability provided by the C Node-API. When using `node-addon-api` instead of the C APIs, start with the API [docs][] for `node-addon-api`. The [Node-API Resource](https://nodejs.github.io/node-addon-examples/) offers an excellent orientation and tips for developers just getting started with Node-API and `node-addon-api`. Additional media resources can be found on the [Node-API Media][] page. ## Implications of ABI stability Although Node-API provides an ABI stability guarantee, other parts of Node.js do not, and any external libraries used from the addon may not. In particular, none of the following APIs provide an ABI stability guarantee across major versions: \* the Node.js C++ APIs available via any of ```cpp #include #include #include #include ``` \* the libuv APIs which are also included with Node.js and available via ```cpp #include ``` \* the V8 API available via ```cpp #include ``` Thus, for an addon to remain ABI-compatible across Node.js major versions, it must use
https://github.com/nodejs/node/blob/main//doc/api/n-api.md
main
nodejs
[ -0.13428811728954315, -0.0264495350420475, 0.007969599217176437, 0.051989417523145676, 0.05359925702214241, -0.03102431818842888, -0.08810510486364365, 0.05266978219151497, -0.024949070066213608, -0.048557158559560776, -0.03906380385160446, 0.03258558362722397, -0.037895940244197845, -0.09032818675041199, 0.06503984332084656, 0.07875747978687286, 0.026540236547589302, -0.016710549592971802, -0.05088777840137482, -0.031513895839452744, 0.025007616728544235, -0.006560200825333595, -0.02463558502495289, 0.009127238765358925, -0.012827716767787933, 0.00790388323366642, -0.06095272675156593, -0.007704846560955048, 0.08539623022079468, 0.005918846465647221, 0.024927254766225815, -0.03607189282774925, -0.0165481548756361, 0.0463070422410965, -0.1125485822558403, 0.06090917810797691, 0.04687146842479706, -0.10410720854997635, -0.024541083723306656, -0.024425340816378593, -0.014971046708524227, 0.06803199648857117, -0.08773031830787659, -0.09413754940032959, 0.044255658984184265, -0.055771466344594955, -0.05805715546011925, -0.01924995146691799, -0.04263455048203468, 0.02535581961274147, 0.08719883859157562, -0.028656721115112305, -0.010066108778119087, -0.031630825251340866, 0.047041017562150955, -0.0004547270655166358, -0.07957033812999725, 0.0649442970752716, -0.00564713217318058, 0.09901990741491318, 0.08573397994041443, -0.026030302047729492, 0.06747724860906601, 0.03323996067047119, 0.08647873252630234, 0.018312618136405945, -0.0027768993750214577, -0.0674944594502449, 0.025687161833047867, -0.06628235429525375, -0.02718917466700077, -0.0038104846607893705, -0.028125466778874397, -0.006544225383549929, -0.04240023344755173, -0.023828212171792984, 0.016314640641212463, -0.019721880555152893, -0.046248909085989, 0.021361976861953735, -0.006774808280169964, -0.012149086222052574, -0.041618574410676956, 0.05208598077297211, -0.02910568378865719, 0.07485923171043396, 0.03514954075217247, -0.0030656540766358376, 0.006057520862668753, 0.06870663166046143, -0.008181686513125896, -0.030839037150144577, -0.013747974298894405, -0.013741781935095787, 0.06991370767354965, 0.004836623556911945, 0.0227674413472414, -0.0039569782093167305, -0.06976678967475891, 0.004463715944439173, -0.024113021790981293, 0.009130239486694336, -0.003340152557939291, -0.029255466535687447, 0.05982609838247299, -0.0508197620511055, 0.008707277476787567, -0.039778582751750946, 0.01357214618474245, 0.04238414391875267, 0.02528638206422329, 0.019617995247244835, -0.00259567191824317, -0.03642841801047325, -0.09718719869852066, 0.05373760312795639, -0.014101310633122921, -0.03559471294283867, 0.11386185139417648, 0.0412827730178833, 0.11342845112085342, 0.05276734009385109, 0.042634814977645874, 0.020513707771897316, -0.01610010862350464, -0.025467926636338234, -0.03636280074715614, 3.8367845410671605e-33, -0.04837765544652939, -0.07496926188468933, -0.01743440330028534, 0.10838384926319122, 0.0073127285577356815, 0.013288927264511585, -0.01866070367395878, 0.04162163659930229, -0.13232102990150452, -0.08429037779569626, 0.02681969292461872, 0.07107670605182648, 0.03454466164112091, 0.07256035506725311, 0.09065282344818115, -0.07083280384540558, 0.04965010657906532, -0.029750557616353035, 0.07071813941001892, 0.014204714447259903, 0.017583034932613373, -0.004223658237606287, 0.004728579893708229, 0.07470522075891495, 0.08102186769247055, 0.042378246784210205, 0.041535042226314545, 0.07212141901254654, -0.061121053993701935, 0.0007018069154582918, -0.013544690795242786, 0.04287794604897499, -0.11619722098112106, 0.02833622321486473, 0.008138452656567097, -0.006730335298925638, -0.04447252303361893, -0.029164282605051994, -0.0183272622525692, -0.060996972024440765, -0.03702358901500702, 0.06926753371953964, -0.1057652160525322, -0.047040700912475586, 0.03472013771533966, -0.08592250198125839, -0.03712255507707596, -0.053208138793706894, 0.028605366125702858, -0.046840131282806396, -0.1016390472650528, 0.07452436536550522, 0.004826738964766264, -0.008042065426707268, 0.03821076452732086, -0.013126557692885399, 0.026082364842295647, -0.035241734236478806, -0.019924543797969818, 0.06383609026670456, 0.08848553895950317, 0.0006056187557987869, -0.025398895144462585, 0.007688565645366907, -0.03986711800098419, 0.06636488437652588, -0.051800355315208435, 0.001555437222123146, 0.028222156688570976, 0.03230546414852142, 0.01002642884850502, 0.07613972574472427, 0.01816941238939762, 0.04299033060669899, -0.025642266497015953, -0.06675603240728378, -0.06365419924259186, -0.03389586880803108, -0.005428800359368324, 0.022459590807557106, 0.02093203365802765, 0.01832430623471737, -0.01625334471464157, 0.05199562385678291, 0.010848313570022583, -0.0350998193025589, -0.04081914201378822, 0.06566101312637329, 0.05332566797733307, 0.018248820677399635, 0.06918883323669434, -0.05126658454537392, -0.016819853335618973, -0.015878012403845787, -0.06166791915893555, -5.656259880334007e-33, -0.027687963098287582, -0.06092333048582077, -0.09357696771621704, 0.04655654728412628, -0.08947686851024628, -0.044464316219091415, -0.04268601909279823, -0.026183992624282837, 0.06401262432336807, -0.02250448614358902, -0.03426165506243706, 0.05341831222176552, -0.00015511138190049678, 0.027535241097211838, 0.04857373610138893, 0.0565725676715374, -0.19680342078208923, -0.05006727948784828, 0.05929430201649666, -0.009671791456639767, 0.012118438258767128, 0.0003759916580747813, 0.04125068336725235, -0.055144306272268295, 0.0035739594604820013, -0.02776375226676464, -0.10262349992990494, -0.03457403928041458, -0.0382419116795063, -0.07125623524188995, -0.029715318232774734, 0.003508368507027626, -0.02374892123043537, 0.03497893735766411, 0.047935012727975845, -0.03368336707353592, 0.006542365998029709, 0.027251671999692917, 0.033509671688079834, -0.11397358775138855, 0.03651757165789604, 0.012677202001214027, 0.0004907178808934987, -0.01571008376777172, 0.0671030804514885, 0.061752304434776306, -0.03355357423424721, 0.07798971235752106, -0.0614946149289608, -0.04788022115826607, 0.033909182995557785, -0.07826993614435196, 0.0037148110568523407, 0.016660436987876892, 0.01636016182601452, -0.02962052822113037, 0.01155621837824583, 0.05383087322115898, 0.06107718124985695, 0.022164374589920044, 0.010322781279683113, -0.08105245977640152, 0.034204110503196716, 0.014913341030478477, -0.061213888227939606, 0.01612030901014805, -0.11875896900892258, -0.07539089024066925, 0.03525477647781372, 0.036448948085308075, 0.04349343851208687, -0.05582643300294876, -0.004724981263279915, -0.02151421271264553, -0.09157129377126694, 0.023975642397999763, 0.06349707394838333, -0.09495503455400467, -0.005446936469525099, -0.038378793746232986, -0.1375209093093872, 0.07564453035593033, 0.008029647171497345, 0.04954420030117035, 0.016172584146261215, 0.01454269140958786, 0.011013271287083626, 0.04959173500537872, -0.02718471921980381, 0.06228586658835411, -0.009989574551582336, 0.10483530163764954, -0.11490312218666077, 0.008597505278885365, -0.06584928184747696, -5.415846615619557e-8, -0.01732364110648632, -0.05617666244506836, -0.12676607072353363, -0.005115138832479715, 0.058899447321891785, 0.0014059128006920218, 0.05672697350382805, 0.01693982258439064, 0.06777281314134598, 0.023557055741548538, 0.010738453827798367, 0.016508955508470535, -0.029184531420469284, -0.07878116518259048, 0.012176891788840294, 0.08160874992609024, -0.01845477893948555, 0.049170080572366714, 0.014823130331933498, 0.028963027521967888, -0.0005457024089992046, 0.030346186831593513, 0.02214575931429863, 0.043341562151908875, -0.05905917286872864, -0.030751237645745277, 0.07263239473104477, 0.0576770193874836, -0.040107015520334244, 0.006063979119062424, -0.007180258631706238, 0.0445832684636116, 0.02265726402401924, 0.024052107706665993, 0.019629323855042458, 0.020163310691714287, -0.02337835729122162, 0.03951283171772957, 0.03995916619896889, 0.04962865635752678, 0.064595527946949, 0.02401108853518963, -0.011828751303255558, -0.0042491089552640915, 0.08229408413171768, 0.01720140129327774, -0.0023666596971452236, -0.027883676812052727, -0.005543343257158995, 0.012380804866552353, 0.025913238525390625, -0.016103310510516167, -0.03574991971254349, 0.03607770428061485, -0.039269883185625076, 0.015410982072353363, -0.05025322362780571, -0.10011065006256104, 0.10099811106920242, 0.0909891277551651, 0.009175973944365978, -0.015948975458741188, 0.11467251181602478, 0.006611338816583157 ]
0.222575
APIs available via any of ```cpp #include #include #include #include ``` \* the libuv APIs which are also included with Node.js and available via ```cpp #include ``` \* the V8 API available via ```cpp #include ``` Thus, for an addon to remain ABI-compatible across Node.js major versions, it must use Node-API exclusively by restricting itself to using ```c #include ``` and by checking, for all external libraries that it uses, that the external library makes ABI stability guarantees similar to Node-API. ### Enum values in ABI stability All enum data types defined in Node-API should be considered as a fixed size `int32\_t` value. Bit flag enum types should be explicitly documented, and they work with bit operators like bit-OR (`|`) as a bit value. Unless otherwise documented, an enum type should be considered to be extensible. A new enum value will be added at the end of the enum definition. An enum value will not be removed or renamed. For an enum type returned from a Node-API function, or provided as an out parameter of a Node-API function, the value is an integer value and an addon should handle unknown values. New values are allowed to be introduced without a version guard. For example, when checking `napi\_status` in switch statements, an addon should include a default branch, as new status codes may be introduced in newer Node.js versions. For an enum type used in an in-parameter, the result of passing an unknown integer value to Node-API functions is undefined unless otherwise documented. A new value is added with a version guard to indicate the Node-API version in which it was introduced. For example, `napi\_get\_all\_property\_names` can be extended with new enum value of `napi\_key\_filter`. For an enum type used in both in-parameters and out-parameters, new values are allowed to be introduced without a version guard. ## Building Unlike modules written in JavaScript, developing and deploying Node.js native addons using Node-API requires an additional set of tools. Besides the basic tools required to develop for Node.js, the native addon developer requires a toolchain that can compile C and C++ code into a binary. In addition, depending upon how the native addon is deployed, the \_user\_ of the native addon will also need to have a C/C++ toolchain installed. For Linux developers, the necessary C/C++ toolchain packages are readily available. [GCC][] is widely used in the Node.js community to build and test across a variety of platforms. For many developers, the [LLVM][] compiler infrastructure is also a good choice. For Mac developers, [Xcode][] offers all the required compiler tools. However, it is not necessary to install the entire Xcode IDE. The following command installs the necessary toolchain: ```bash xcode-select --install ``` For Windows developers, [Visual Studio][] offers all the required compiler tools. However, it is not necessary to install the entire Visual Studio IDE. The following command installs the necessary toolchain: ```bash npm install --global windows-build-tools ``` The sections below describe the additional tools available for developing and deploying Node.js native addons. ### Build tools Both the tools listed here require that \_users\_ of the native addon have a C/C++ toolchain installed in order to successfully install the native addon. #### node-gyp [node-gyp][] is a build system based on the [gyp-next][] fork of Google's [GYP][] tool and comes bundled with npm. GYP, and therefore node-gyp, requires that Python be installed. Historically, node-gyp has been the tool of choice for building native addons. It has widespread adoption and documentation. However, some developers have run into limitations in node-gyp. #### CMake.js [CMake.js][] is an alternative build system based on [CMake][]. CMake.js is a good choice
https://github.com/nodejs/node/blob/main//doc/api/n-api.md
main
nodejs
[ -0.1141900047659874, -0.03585013747215271, -0.007975681684911251, -0.008890215307474136, 0.04502960294485092, -0.0315520241856575, -0.048448897898197174, 0.0392719991505146, -0.06512417644262314, -0.022701632231473923, -0.019296692684292793, -0.02518421970307827, -0.019591443240642548, -0.026337677612900734, 0.11754763871431351, 0.06692855060100555, 0.04097289964556694, -0.01751110889017582, -0.029727179557085037, -0.005037184804677963, 0.02505825087428093, 0.021078702062368393, -0.03455181419849396, 0.06495297700166702, -0.018134573474526405, -0.023097839206457138, -0.025639904662966728, 0.001284657046198845, 0.06626880168914795, -0.02189982309937477, -0.05760635435581207, 0.01608853228390217, 0.008981062099337578, 0.010706143453717232, -0.006037608720362186, 0.05082937330007553, 0.019220108166337013, -0.0688415989279747, -0.0219165850430727, -0.05710795149207115, -0.006150535307824612, 0.0899551585316658, -0.08422195911407471, -0.030718225985765457, 0.015137026086449623, -0.07459491491317749, -0.01712283305823803, 0.00361196999438107, -0.06488341838121414, 0.035609181970357895, 0.07771500945091248, 0.00655402522534132, -0.00417995173484087, -0.003911763895303011, 0.04490787908434868, -0.04838079586625099, -0.10444255918264389, 0.05211864039301872, 0.01711456850171089, 0.09945742040872574, -0.011384728364646435, -0.02859547734260559, 0.05076170712709427, -0.0004204962169751525, 0.06014739349484444, 0.05170359089970589, 0.020792340859770775, -0.0608099140226841, -0.07112941145896912, -0.018239842727780342, 0.002313573844730854, -0.029747338965535164, -0.06163490191102028, 0.05967886000871658, -0.05695829540491104, 0.021577030420303345, 0.028869949281215668, 0.01789958029985428, -0.06445830315351486, -0.010409229435026646, -0.06008542329072952, -0.016036584973335266, -0.028130080550909042, 0.05878886952996254, -0.005507535766810179, 0.03130633011460304, 0.07427804172039032, 0.0165775865316391, 0.004109020344913006, 0.07492511719465256, -0.007166467607021332, -0.06033580005168915, -0.005214754492044449, -0.037771888077259064, 0.11636625975370407, 0.04041052609682083, 0.027125032618641853, -0.029253177344799042, -0.0310988649725914, -0.030285166576504707, -0.06293801218271255, 0.013715491630136967, -0.005892878398299217, 0.008005236275494099, -0.010748752392828465, -0.08510345965623856, 0.08644121885299683, 0.01277830172330141, -0.008418696001172066, 0.04821017012000084, 0.03109135292470455, 0.03197218477725983, 0.03424164280295372, -0.09645325690507889, -0.026533327996730804, -0.013921490870416164, 0.01978638581931591, -0.08462552726268768, 0.0792732983827591, -0.014358079992234707, 0.03232481703162193, 0.02541162259876728, 0.0678890123963356, 0.05110589787364006, 0.02285221964120865, -0.006112900096923113, 0.02081472985446453, 5.61253406187731e-33, -0.0567513071000576, -0.07552609592676163, -0.029865073040127754, 0.10840963572263718, -0.025324180722236633, 0.028548218309879303, -0.005958863068372011, 0.02739422582089901, -0.13889865577220917, -0.08449604362249374, -0.039111826568841934, 0.09796781837940216, 0.04905708134174347, 0.03127337247133255, 0.1037338450551033, 0.005076268687844276, 0.04433280602097511, -0.020760931074619293, 0.03909280523657799, 0.03028130903840065, 0.01755179651081562, -0.026648791506886482, -0.005322668701410294, 0.0574444904923439, -0.02332410216331482, 0.04647180810570717, 0.0705927163362503, -0.00009179287008009851, 0.010019992478191853, -0.02826419286429882, 0.0275814738124609, 0.019865067675709724, -0.06722048670053482, 0.044999346137046814, 0.07671763002872467, 0.01745423674583435, -0.02191195636987686, 0.02434566058218479, -0.050329551100730896, -0.04921524226665497, 0.04558035731315613, 0.13409002125263214, -0.09328612685203552, -0.04440638795495033, 0.03442424163222313, -0.1053166463971138, 0.025082502514123917, -0.04528321698307991, 0.032112445682287216, -0.07410372793674469, -0.010282554663717747, 0.12485069036483765, 0.0017471634782850742, -0.09965982288122177, 0.04391169548034668, -0.010106350295245647, 0.08507338166236877, -0.005498520564287901, -0.03026077337563038, 0.05633889138698578, 0.06943513453006744, 0.006664021871984005, 0.062174953520298004, -0.023928070440888405, -0.012879427522420883, 0.03307705745100975, -0.11193503439426422, -0.03337472677230835, 0.031142810359597206, -0.03556417301297188, -0.0051062265411019325, 0.02657473273575306, 0.016412552446126938, 0.07238130271434784, -0.011996815912425518, -0.012405524961650372, -0.07278595119714737, -0.06386160850524902, -0.015726806595921516, -0.04913715273141861, -0.004900247789919376, -0.023975033313035965, 0.03126302361488342, 0.06380670517683029, 0.049598198384046555, -0.08883146941661835, -0.0634661465883255, 0.028849607333540916, 0.027386929839849472, -0.03778921440243721, 0.12617607414722443, -0.027587734162807465, 0.01074410229921341, -0.015868332237005234, -0.08204330503940582, -6.290778506596431e-33, -0.03297026455402374, -0.035029590129852295, -0.02604358270764351, 0.021765176206827164, -0.07785234600305557, -0.028326330706477165, -0.050638001412153244, -0.04781750589609146, 0.10747171193361282, 0.02338988706469536, -0.005525624845176935, 0.06262721866369247, 0.06414820998907089, 0.014416000805795193, 0.06319916993379593, 0.010167531669139862, -0.16040603816509247, -0.1167958453297615, 0.014844740740954876, -0.06716186553239822, -0.016341181471943855, 0.002862433437258005, 0.11192012578248978, -0.029291780665516853, 0.002158988965675235, 0.068280428647995, -0.10097093135118484, -0.009153022430837154, -0.029951829463243484, -0.08557606488466263, -0.06053296476602554, 0.022664852440357208, -0.05254816263914108, 0.022935334593057632, -0.00580564746633172, -0.08272568136453629, 0.0755259171128273, 0.022822631523013115, -0.009090576320886612, -0.09214119613170624, -0.001479795086197555, 0.024896973744034767, -0.018961027264595032, -0.023220818489789963, 0.055877260863780975, -0.041799284517765045, -0.009248694404959679, 0.03153493255376816, -0.0648157000541687, 0.019068976864218712, 0.045250438153743744, -0.06256062537431717, 0.003976612351834774, -0.023421280086040497, 0.0028099012561142445, -0.044153545051813126, -0.03543933108448982, 0.05034221336245537, 0.019758090376853943, -0.006164219696074724, 0.008200163953006268, -0.024694496765732765, 0.040806449949741364, 0.03868221119046211, -0.07166147977113724, 0.0339837409555912, -0.09334500879049301, -0.06831854581832886, -0.016629168763756752, -0.05648059770464897, 0.0005670597311109304, -0.03925931826233864, -0.011278748512268066, -0.0028686330188065767, -0.027017606422305107, 0.033462364226579666, 0.11223948746919632, -0.0832480937242508, 0.03544660285115242, -0.01229569036513567, -0.1450391560792923, 0.09254596382379532, -0.0454537607729435, 0.04112879931926727, 0.019782396033406258, -0.02215210534632206, 0.0015726092969998717, -0.02852434478700161, -0.035882867872714996, -0.01168146077543497, -0.03856782615184784, 0.0370626337826252, -0.05259707570075989, 0.08483314514160156, -0.021532109007239342, -5.6469314557716643e-8, -0.05072072893381119, 0.0020574398804455996, -0.16711461544036865, 0.024500638246536255, 0.03867822885513306, -0.021799618378281593, -0.01147457491606474, 0.00016013237473089248, 0.10747140645980835, 0.022109417244791985, 0.04704710468649864, -0.020377445966005325, -0.024972403421998024, -0.009135635569691658, 0.03725564107298851, 0.04196079820394516, -0.009163270704448223, -0.03744933754205704, -0.01968524605035782, 0.007146031130105257, -0.0021478193812072277, 0.008578375913202763, -0.025417352095246315, 0.07100708037614822, 0.0019266430754214525, -0.08014265447854996, -0.0004613505443558097, 0.03212771937251091, 0.02849471941590309, 0.04010973498225212, -0.007186788134276867, 0.022539786994457245, 0.06789381802082062, -0.004609094467014074, 0.038617465645074844, 0.009244708344340324, 0.022707456722855568, 0.09021087735891342, 0.015138229355216026, 0.08984310179948807, 0.07634031772613525, -0.012460868805646896, -0.05147959664463997, -0.028160661458969116, 0.049853257834911346, 0.02949371188879013, -0.036865152418613434, 0.028308406472206116, 0.008389155380427837, 0.03054497018456459, 0.032794371247291565, -0.01750822551548481, 0.02533271536231041, 0.04313787445425987, -0.045545242726802826, 0.02457544207572937, -0.033487092703580856, -0.08051420748233795, 0.11518342047929764, 0.04443670064210892, 0.006262020207941532, -0.027287837117910385, 0.09133999049663544, 0.031180305406451225 ]
0.185509
therefore node-gyp, requires that Python be installed. Historically, node-gyp has been the tool of choice for building native addons. It has widespread adoption and documentation. However, some developers have run into limitations in node-gyp. #### CMake.js [CMake.js][] is an alternative build system based on [CMake][]. CMake.js is a good choice for projects that already use CMake or for developers affected by limitations in node-gyp. [`build\_with\_cmake`][] is an example of a CMake-based native addon project. ### Uploading precompiled binaries The three tools listed here permit native addon developers and maintainers to create and upload binaries to public or private servers. These tools are typically integrated with CI/CD build systems like [Travis CI][] and [AppVeyor][] to build and upload binaries for a variety of platforms and architectures. These binaries are then available for download by users who do not need to have a C/C++ toolchain installed. #### node-pre-gyp [node-pre-gyp][] is a tool based on node-gyp that adds the ability to upload binaries to a server of the developer's choice. node-pre-gyp has particularly good support for uploading binaries to Amazon S3. #### prebuild [prebuild][] is a tool that supports builds using either node-gyp or CMake.js. Unlike node-pre-gyp which supports a variety of servers, prebuild uploads binaries only to [GitHub releases][]. prebuild is a good choice for GitHub projects using CMake.js. #### prebuildify [prebuildify][] is a tool based on node-gyp. The advantage of prebuildify is that the built binaries are bundled with the native addon when it's uploaded to npm. The binaries are downloaded from npm and are immediately available to the module user when the native addon is installed. ## Usage In order to use the Node-API functions, include the file [`node\_api.h`][] which is located in the src directory in the node development tree: ```c #include ``` This will opt into the default `NAPI\_VERSION` for the given release of Node.js. In order to ensure compatibility with specific versions of Node-API, the version can be specified explicitly when including the header: ```c #define NAPI\_VERSION 3 #include ``` This restricts the Node-API surface to just the functionality that was available in the specified (and earlier) versions. Some of the Node-API surface is experimental and requires explicit opt-in: ```c #define NAPI\_EXPERIMENTAL #include ``` In this case the entire API surface, including any experimental APIs, will be available to the module code. Occasionally, experimental features are introduced that affect already-released and stable APIs. These features can be disabled by an opt-out: ```c #define NAPI\_EXPERIMENTAL #define NODE\_API\_EXPERIMENTAL\_\_OPT\_OUT #include ``` where `` is the name of an experimental feature that affects both experimental and stable APIs. ## Node-API version matrix Up until version 9, Node-API versions were additive and versioned independently from Node.js. This meant that any version was an extension to the previous version in that it had all of the APIs from the previous version with some additions. Each Node.js version only supported a single Node-API version. For example v18.15.0 supports only Node-API version 8. ABI stability was achieved because 8 was a strict superset of all previous versions. As of version 9, while Node-API versions continue to be versioned independently, an add-on that ran with Node-API version 9 may need code updates to run with Node-API version 10. ABI stability is maintained, however, because Node.js versions that support Node-API versions higher than 8 will support all versions between 8 and the highest version they support and will default to providing the version 8 APIs unless an add-on opts into a higher Node-API version. This approach provides the flexibility of better optimizing existing Node-API functions while maintaining ABI stability. Existing add-ons can continue to run without recompilation
https://github.com/nodejs/node/blob/main//doc/api/n-api.md
main
nodejs
[ -0.08785824477672577, -0.0058396123349666595, 0.030289359390735626, 0.023363549262285233, 0.042565278708934784, -0.062289539724588394, -0.06960634142160416, 0.09316767007112503, 0.002668763045221567, -0.006986997090280056, -0.019548386335372925, -0.015966251492500305, -0.01603642851114273, -0.014881006442010403, 0.06854988634586334, -0.03291209414601326, -0.010188741609454155, 0.07348822057247162, 0.01814892515540123, -0.1001136526465416, -0.039325326681137085, 0.013549369759857655, 0.024237310513854027, 0.0279653612524271, -0.006958517711609602, -0.11064232140779495, -0.04893680289387703, -0.02324341982603073, 0.04149197041988373, -0.001926923869177699, -0.009779050014913082, -0.0029695855919271708, 0.05943898856639862, 0.06845848262310028, -0.026058994233608246, 0.10260231047868729, 0.06485658138990402, -0.014572166837751865, -0.07460816204547882, -0.06481410562992096, -0.008420325815677643, 0.04436768591403961, -0.062001146376132965, 0.006754153408110142, -0.05961983650922775, 0.0019529237179085612, -0.002150701591745019, -0.03523624688386917, -0.028842773288488388, -0.05409879609942436, 0.024416590109467506, -0.03129846975207329, 0.0037611329462379217, -0.05200614035129547, -0.05888190120458603, -0.02586337924003601, -0.07639006525278091, 0.017009561881422997, 0.0675235241651535, 0.02119295671582222, 0.006112867034971714, 0.017431557178497314, -0.016094595193862915, -0.0003714967460837215, 0.008554195985198021, 0.04729796573519707, 0.020923763513565063, 0.014392754063010216, 0.10287056118249893, -0.030801091343164444, 0.006001375149935484, -0.045285217463970184, -0.0359325185418129, 0.015420208685100079, -0.08471610397100449, -0.03285282477736473, 0.017443591728806496, 0.007657077629119158, -0.035756874829530716, 0.08127572387456894, 0.0015321385581046343, 0.014839984476566315, 0.0204707533121109, 0.03828314319252968, -0.016959017142653465, 0.0197906531393528, 0.012551023624837399, 0.12169910222291946, 0.012576605193316936, -0.027921678498387337, 0.062450215220451355, 0.006718386895954609, -0.03872670978307724, -0.006942362524569035, 0.02512291632592678, 0.036009885370731354, 0.07828357070684433, -0.02344362437725067, -0.05776572972536087, 0.00795959122478962, -0.03359606862068176, -0.10755455493927002, 0.04355680197477341, 0.012118369340896606, 0.05248819664120674, 0.05913325771689415, 0.0278331208974123, -0.04471506178379059, 0.046672943979501724, 0.01878223568201065, -0.014344275929033756, -0.00007288365304702893, -0.03417433425784111, -0.08560369163751602, -0.01697564870119095, 0.056558314710855484, -0.01930786296725273, 0.013593160547316074, 0.07534125447273254, 0.035891808569431305, 0.021612878888845444, 0.05299486592411995, 0.004531374666839838, -0.018928295001387596, -0.018210165202617645, -0.003124459646642208, -0.0573686808347702, 5.4972621470997996e-33, 0.027173491194844246, -0.0118363993242383, 0.018767859786748886, 0.025181766599416733, 0.04058387503027916, -0.025741105899214745, 0.03347443416714668, -0.0007851572590880096, -0.14059509336948395, -0.07927192747592926, -0.031800173223018646, 0.0010540304938331246, -0.05600711703300476, 0.10309795290231705, 0.01752176322042942, -0.012349551543593407, 0.00224742922000587, -0.05075949430465698, 0.06050609052181244, 0.0024136181455105543, -0.022494934499263763, -0.013520278036594391, 0.036932267248630524, 0.1341964155435562, 0.04411499574780464, -0.06390965729951859, 0.04782038927078247, -0.019016219303011894, 0.04489175230264664, -0.007420956157147884, -0.07874387502670288, 0.025072695687413216, -0.0010639488464221358, 0.10178513079881668, -0.013067282736301422, 0.014470081776380539, -0.0446016900241375, -0.06340612471103668, 0.02316419966518879, -0.010086664929986, 0.03948364406824112, 0.07921142131090164, -0.015586303547024727, -0.06590224802494049, 0.03541099652647972, -0.03827826678752899, -0.03339555487036705, -0.08515527099370956, 0.054186344146728516, 0.005050651263445616, -0.014099371619522572, 0.055533576756715775, -0.06660810858011246, 0.0679769366979599, -0.028444567695260048, -0.008995702490210533, 0.023352298885583878, -0.03484390676021576, 0.03136390820145607, -0.02683025598526001, 0.02323799952864647, 0.03786386176943779, 0.021986326202750206, 0.06399274617433548, 0.001475525670684874, 0.00974847748875618, -0.06718079000711441, 0.0629006177186966, 0.003686371725052595, 0.10193132609128952, -0.04740850254893303, 0.007841824553906918, 0.043676070868968964, 0.019045481458306313, 0.015406576916575432, -0.001125731156207621, -0.06860560923814774, -0.0629228800535202, 0.022846339270472527, 0.046448417007923126, -0.012808249332010746, -0.011845127679407597, -0.05535965785384178, 0.04017875716090202, 0.044971615076065063, -0.04370016232132912, -0.052097566425800323, 0.06903644651174545, 0.0037798574194312096, -0.05981763079762459, 0.042223844677209854, -0.05370871722698212, 0.01756713166832924, 0.023647267371416092, -0.12392880022525787, -7.360158778318083e-33, 0.007454626262187958, -0.0371912382543087, 0.00516326492652297, 0.07201767712831497, -0.031501829624176025, -0.021877150982618332, -0.07680114358663559, -0.1691616028547287, 0.07353249192237854, -0.04050630331039429, -0.10352420806884766, -0.00423842016607523, 0.10363911837339401, 0.014710487797856331, 0.014519644901156425, 0.03649990260601044, -0.12388227880001068, 0.007544271182268858, 0.033341050148010254, 0.017046406865119934, -0.012717937119305134, -0.013160645961761475, 0.02945191226899624, -0.04684820398688316, 0.0624837726354599, -0.09933578968048096, -0.05494993180036545, -0.01946837268769741, 0.015895940363407135, -0.05742882192134857, -0.034752007573843, 0.10844749212265015, -0.05558691918849945, -0.05558190494775772, 0.03895236551761627, -0.014172912575304508, -0.05822449177503586, 0.02698013372719288, 0.04689908027648926, -0.05840914696455002, 0.07351551204919815, -0.029247676953673363, -0.024283597245812416, -0.041264794766902924, 0.026614652946591377, 0.07746831327676773, -0.02016422711312771, 0.08593355119228363, -0.009049929678440094, -0.062303055077791214, 0.0019412562251091003, -0.005859299097210169, -0.016166064888238907, -0.027739839628338814, 0.02286234125494957, -0.015037954784929752, 0.01317272987216711, 0.10465382039546967, -0.006103671621531248, 0.021240385249257088, 0.0051913331262767315, -0.047161661088466644, -0.039477039128541946, -0.06783745437860489, -0.08399606496095657, 0.049143966287374496, -0.14180581271648407, -0.012466296553611755, 0.008944946341216564, 0.059689342975616455, 0.006904209032654762, -0.017755815759301186, 0.04464006796479225, -0.010668260045349598, -0.10530049353837967, 0.03883801028132439, -0.0034621767699718475, -0.06153995171189308, -0.03407131880521774, 0.002707564737647772, 0.002820902969688177, 0.10550698637962341, 0.028348416090011597, 0.028085608035326004, 0.02370765618979931, -0.01770985685288906, 0.005656914319843054, 0.018092654645442963, 0.0382344052195549, 0.050138652324676514, -0.01598271355032921, 0.04984790459275246, -0.00904524140059948, 0.06516984105110168, 0.021515725180506706, -5.5707086943357353e-8, 0.043331705033779144, -0.008327632211148739, -0.1363278031349182, -0.061952780932188034, 0.01322248950600624, 0.0432548001408577, 0.09518097341060638, 0.00683014839887619, 0.006667469162493944, 0.02154180034995079, 0.04429197683930397, -0.08530261367559433, -0.04683727025985718, -0.02373320981860161, -0.04769956320524216, 0.09448811411857605, -0.02898070216178894, 0.07428408414125443, 0.013735249638557434, -0.010107839480042458, -0.006911700125783682, 0.021569805219769478, -0.08240267634391785, 0.07577626407146454, -0.11618370562791824, -0.02257983386516571, 0.06489728391170502, 0.03657843545079231, -0.06352877616882324, 0.03663701191544533, 0.018685849383473396, -0.008478259667754173, -0.014481766149401665, 0.04092017561197281, 0.07964053750038147, -0.019283320754766464, -0.07045808434486389, -0.01638459600508213, 0.07891872525215149, -0.00946433749049902, 0.012389092706143856, 0.05955306813120842, -0.007868162356317043, -0.008828166872262955, -0.04699917510151863, -0.06983333826065063, -0.07857431471347809, -0.005972615443170071, -0.03309504687786102, 0.056063346564769745, 0.11347122490406036, 0.005345380865037441, -0.09807077795267105, 0.04825804755091667, 0.10463445633649826, 0.1298106163740158, -0.07567227631807327, -0.0715668722987175, 0.022163566201925278, -0.04233212023973465, -0.029513485729694366, -0.051580462604761124, 0.11240126192569733, -0.05208839103579521 ]
0.050348
versions between 8 and the highest version they support and will default to providing the version 8 APIs unless an add-on opts into a higher Node-API version. This approach provides the flexibility of better optimizing existing Node-API functions while maintaining ABI stability. Existing add-ons can continue to run without recompilation using an earlier version of Node-API. If an add-on needs functionality from a newer Node-API version, changes to existing code and recompilation will be needed to use those new functions anyway. In versions of Node.js that support Node-API version 9 and later, defining `NAPI\_VERSION=X` and using the existing add-on initialization macros will bake in the requested Node-API version that will be used at runtime into the add-on. If `NAPI\_VERSION` is not set it will default to 8. This table may not be up to date in older streams, the most up to date information is in the latest API documentation in: [Node-API version matrix](https://nodejs.org/docs/latest/api/n-api.html#node-api-version-matrix) | Node-API version | Supported In | | --- | --- | | 10 | v22.14.0+, 23.6.0+ and all later versions | | 9 | v18.17.0+, 20.3.0+, 21.0.0 and all later versions | | 8 | v12.22.0+, v14.17.0+, v15.12.0+, 16.0.0 and all later versions | | 7 | v10.23.0+, v12.19.0+, v14.12.0+, 15.0.0 and all later versions | | 6 | v10.20.0+, v12.17.0+, 14.0.0 and all later versions | | 5 | v10.17.0+, v12.11.0+, 13.0.0 and all later versions | | 4 | v10.16.0+, v11.8.0+, 12.0.0 and all later versions | | 3 | v6.14.2\*, 8.11.2+, v9.11.0+\*, 10.0.0 and all later versions | | 2 | v8.10.0+\*, v9.3.0+\*, 10.0.0 and all later versions | | 1 | v8.6.0+\*\*, v9.0.0+\*, 10.0.0 and all later versions | \\* Node-API was experimental. \\*\\* Node.js 8.0.0 included Node-API as experimental. It was released as Node-API version 1 but continued to evolve until Node.js 8.6.0. The API is different in versions prior to Node.js 8.6.0. We recommend Node-API version 3 or later. Each API documented for Node-API will have a header named `added in:`, and APIs which are stable will have the additional header `Node-API version:`. APIs are directly usable when using a Node.js version which supports the Node-API version shown in `Node-API version:` or higher. When using a Node.js version that does not support the `Node-API version:` listed or if there is no `Node-API version:` listed, then the API will only be available if `#define NAPI\_EXPERIMENTAL` precedes the inclusion of `node\_api.h` or `js\_native\_api.h`. If an API appears not to be available on a version of Node.js which is later than the one shown in `added in:` then this is most likely the reason for the apparent absence. The Node-APIs associated strictly with accessing ECMAScript features from native code can be found separately in `js\_native\_api.h` and `js\_native\_api\_types.h`. The APIs defined in these headers are included in `node\_api.h` and `node\_api\_types.h`. The headers are structured in this way in order to allow implementations of Node-API outside of Node.js. For those implementations the Node.js specific APIs may not be applicable. The Node.js-specific parts of an addon can be separated from the code that exposes the actual functionality to the JavaScript environment so that the latter may be used with multiple implementations of Node-API. In the example below, `addon.c` and `addon.h` refer only to `js\_native\_api.h`. This ensures that `addon.c` can be reused to compile against either the Node.js implementation of Node-API or any implementation of Node-API outside of Node.js. `addon\_node.c` is a separate file that contains the Node.js specific entry point to the addon and which instantiates the addon by calling into `addon.c` when the addon is loaded into a Node.js environment. ```c // addon.h #ifndef
https://github.com/nodejs/node/blob/main//doc/api/n-api.md
main
nodejs
[ -0.05465133115649223, -0.004587302915751934, 0.060682062059640884, 0.009193713776767254, 0.0585765540599823, -0.006452204193919897, -0.10687774419784546, -0.004768014885485172, -0.025558406487107277, -0.024970170110464096, -0.017544692382216454, 0.05773366615176201, -0.07766963541507721, -0.021689537912607193, 0.1304299682378769, 0.026363743469119072, 0.06287451088428497, -0.012278404086828232, -0.020371977239847183, -0.03391076624393463, 0.005530582275241613, -0.02749541588127613, 0.024198951199650764, 0.01108546182513237, 0.01853594183921814, -0.09160653501749039, -0.03894391655921936, -0.0034385917242616415, 0.033089134842157364, 0.000015205707313725725, -0.0318736769258976, 0.047298330813646317, 0.0032378938049077988, 0.01022728718817234, -0.05166330933570862, 0.03443451598286629, 0.02334633097052574, -0.018176596611738205, -0.01992036961019039, 0.04102325439453125, 0.07507401704788208, 0.013700666837394238, -0.07002319395542145, -0.05969266965985298, 0.023128895089030266, -0.07070448249578476, -0.04347967356443405, 0.007066443096846342, -0.003320936346426606, 0.05770276486873627, 0.033579956740140915, -0.02178047224879265, -0.027256743982434273, -0.02574918605387211, 0.0475056990981102, -0.03835318982601166, -0.051958613097667694, 0.08585042506456375, 0.008712018840014935, 0.0773586854338646, -0.02301349863409996, -0.06554685533046722, 0.12480873614549637, -0.022567421197891235, 0.04169537127017975, -0.016098057851195335, 0.011265212669968605, -0.11351029574871063, 0.02114265039563179, 0.007973678410053253, 0.015433486551046371, 0.003563078586012125, -0.03140644729137421, -0.05054154992103577, -0.09604232013225555, 0.007773224730044603, 0.037420570850372314, 0.05185645818710327, -0.034709762781858444, -0.054226312786340714, -0.014815464615821838, 0.0006970582762733102, 0.025658050552010536, 0.05197262763977051, -0.10220158845186234, 0.041645608842372894, 0.00003300828029750846, -0.04905076324939728, 0.05268155038356781, 0.024342063814401627, -0.028256352990865707, 0.001105181174352765, 0.0019060245249420404, -0.03231864422559738, 0.04562724754214287, -0.006576107814908028, 0.006332766264677048, -0.0035201641730964184, -0.02121378667652607, -0.011248825117945671, -0.02327936515212059, -0.05648243799805641, -0.014878964982926846, 0.00791148841381073, 0.06062990054488182, -0.05490519851446152, 0.02313254401087761, -0.0823708102107048, -0.01466821413487196, 0.028366120532155037, 0.10066565126180649, 0.02852657251060009, 0.02569221891462803, -0.09202386438846588, -0.06559418886899948, 0.017506740987300873, 0.0011646761558949947, -0.044028542935848236, 0.06465709954500198, 0.06095775589346886, 0.08058081567287445, -0.012508283369243145, 0.0741211473941803, 0.029629182070493698, -0.056677550077438354, -0.02826744131743908, -0.06699925661087036, 3.8411074215423095e-33, -0.03461892530322075, 0.004773750901222229, 0.008868602104485035, 0.049677323549985886, 0.061441607773303986, -0.055275704711675644, 0.011985787190496922, 0.02879611775279045, -0.11643701046705246, -0.06941049546003342, -0.04393940418958664, 0.08395058661699295, -0.019204551354050636, 0.002077785786241293, 0.07600713521242142, -0.04311344772577286, 0.007796567864716053, 0.007714950479567051, 0.052054908126592636, 0.01964022032916546, 0.02326940931379795, -0.023137535899877548, 0.0040155695751309395, 0.03878113627433777, 0.06453929096460342, 0.005090498831123114, 0.08062844723463058, 0.015558131970465183, -0.07718082517385483, -0.04291588068008423, 0.03452664613723755, -0.015270289033651352, -0.06138120964169502, -0.006754403468221426, 0.0008757517789490521, 0.0025735313538461924, -0.02997620403766632, 0.02603658102452755, -0.0783458948135376, -0.045766253024339676, -0.006826522760093212, 0.14208227396011353, -0.07387888431549072, -0.06510601937770844, 0.037000950425863266, -0.08617974072694778, -0.03495398536324501, -0.052351027727127075, 0.10962577164173126, -0.04054027050733566, -0.024318024516105652, 0.06452726572751999, 0.014975306577980518, -0.02360077016055584, 0.04262738674879074, -0.05605056509375572, 0.0281493179500103, -0.08920171856880188, 0.060568906366825104, 0.04834398999810219, 0.11793084442615509, -0.060645200312137604, 0.019555259495973587, -0.005875201430171728, -0.01837102510035038, 0.09252144396305084, -0.04583149403333664, -0.011669275350868702, 0.07021722942590714, -0.027043074369430542, -0.0015217945910990238, 0.030739501118659973, -0.04069579020142555, 0.05013008788228035, 0.03510722890496254, -0.024606386199593544, -0.035071637481451035, -0.06395522505044937, 0.03488864004611969, -0.006785738281905651, 0.02402821183204651, -0.0011226979549974203, -0.031115807592868805, 0.07311069220304489, -0.014507095329463482, -0.05699629709124565, -0.026768364012241364, 0.06999024003744125, 0.035834118723869324, 0.00779009098187089, 0.0935065895318985, -0.07204830646514893, 0.005863635800778866, -0.009241066873073578, -0.012208154425024986, -3.8995530006651936e-33, -0.02007029578089714, -0.04260896518826485, -0.07274890691041946, -0.005736824590712786, -0.06039529666304588, -0.10201283544301987, -0.010557400994002819, -0.026751119643449783, 0.027418458834290504, -0.0021731883753091097, 0.0005791481235064566, 0.019154945388436317, 0.0036572886165231466, 0.047595538198947906, -0.011567474342882633, 0.03670394420623779, -0.14402131736278534, -0.0734131783246994, 0.05552492290735245, 0.008527140133082867, 0.02560630440711975, -0.0008923053392209113, 0.06314382702112198, -0.004133651964366436, 0.03819681331515312, -0.015199258923530579, -0.07462373375892639, 0.05440206080675125, -0.0308122206479311, -0.14480796456336975, -0.021467527374625206, -0.012251081876456738, -0.04521110653877258, 0.061141423881053925, 0.04259085655212402, -0.03291487693786621, -0.013745431788265705, 0.04947436973452568, 0.05975041538476944, -0.06947019696235657, 0.061309825628995895, -0.08914098888635635, -0.023535078391432762, 0.00820483174175024, 0.039509326219558716, 0.05122146010398865, 0.009842157363891602, 0.06382367759943008, -0.034037891775369644, -0.019183510914444923, 0.016013706102967262, -0.02767137996852398, -0.008187945932149887, 0.010845000855624676, -0.0217276718467474, -0.03156856819987297, 0.02369503490626812, 0.04257867485284805, 0.024633049964904785, 0.016053983941674232, 0.0678490698337555, -0.03416838496923447, 0.08620162308216095, -0.010397286154329777, -0.0970345288515091, 0.016288617625832558, -0.0507967434823513, -0.03607938066124916, 0.021581195294857025, 0.05777500197291374, -0.006800724193453789, -0.08224749565124512, -0.05090499669313431, 0.0011717776069417596, -0.08549168705940247, 0.027081750333309174, 0.0880880132317543, -0.02359854429960251, 0.015177750959992409, -0.035961832851171494, -0.20584465563297272, 0.0695233941078186, -0.036676470190286636, 0.0443091094493866, 0.05143771320581436, 0.03479251638054848, 0.07441030442714691, -0.01646486669778824, 0.0365627259016037, 0.08394072204828262, 0.025767764076590538, 0.008726818487048149, -0.15644791722297668, 0.010198533535003662, -0.12983089685440063, -4.835500533317827e-8, -0.009557850658893585, -0.017452020198106766, -0.14197728037834167, 0.0048947143368422985, 0.08098416775465012, -0.02626325935125351, 0.007046543061733246, 0.03381931409239769, 0.058099132031202316, -0.005365210119634867, 0.05057641118764877, 0.05032467097043991, 0.060949068516492844, -0.04394960775971413, 0.07470135390758514, 0.07697317749261856, 0.023567888885736465, 0.01743452064692974, 0.004463201388716698, 0.026456594467163086, -0.027735253795981407, 0.04674045741558075, -0.01286407932639122, -0.005787965841591358, -0.025086266919970512, -0.05016842857003212, 0.019176755100488663, 0.05351361632347107, -0.031891461461782455, -0.005123539827764034, 0.029750438407063484, 0.0862637460231781, 0.023790916427969933, 0.03823931887745857, 0.039337802678346634, -0.024316012859344482, -0.04608559608459473, 0.1354106068611145, 0.017793849110603333, 0.054725129157304764, 0.03453145921230316, -0.02232934907078743, -0.008149158209562302, -0.021218281239271164, 0.006709624081850052, -0.0357268825173378, -0.028807643800973892, -0.05641882121562958, 0.052313901484012604, 0.029600324109196663, 0.0150287551805377, 0.03260781243443489, -0.01251133531332016, 0.022083790972828865, 0.007207343354821205, 0.014087655581533909, -0.052176035940647125, -0.0910966694355011, 0.07008346170186996, 0.08151265233755112, 0.03590669110417366, -0.07035177201032639, 0.09537060558795929, -0.026099026203155518 ]
0.102005
the Node.js implementation of Node-API or any implementation of Node-API outside of Node.js. `addon\_node.c` is a separate file that contains the Node.js specific entry point to the addon and which instantiates the addon by calling into `addon.c` when the addon is loaded into a Node.js environment. ```c // addon.h #ifndef \_ADDON\_H\_ #define \_ADDON\_H\_ #include napi\_value create\_addon(napi\_env env); #endif // \_ADDON\_H\_ ``` ```c // addon.c #include "addon.h" #define NODE\_API\_CALL(env, call) \ do { \ napi\_status status = (call); \ if (status != napi\_ok) { \ const napi\_extended\_error\_info\* error\_info = NULL; \ napi\_get\_last\_error\_info((env), &error\_info); \ const char\* err\_message = error\_info->error\_message; \ bool is\_pending; \ napi\_is\_exception\_pending((env), &is\_pending); \ /\* If an exception is already pending, don't rethrow it \*/ \ if (!is\_pending) { \ const char\* message = (err\_message == NULL) \ ? "empty error message" \ : err\_message; \ napi\_throw\_error((env), NULL, message); \ } \ return NULL; \ } \ } while(0) static napi\_value DoSomethingUseful(napi\_env env, napi\_callback\_info info) { // Do something useful. return NULL; } napi\_value create\_addon(napi\_env env) { napi\_value result; NODE\_API\_CALL(env, napi\_create\_object(env, &result)); napi\_value exported\_function; NODE\_API\_CALL(env, napi\_create\_function(env, "doSomethingUseful", NAPI\_AUTO\_LENGTH, DoSomethingUseful, NULL, &exported\_function)); NODE\_API\_CALL(env, napi\_set\_named\_property(env, result, "doSomethingUseful", exported\_function)); return result; } ``` ```c // addon\_node.c #include #include "addon.h" NAPI\_MODULE\_INIT(/\* napi\_env env, napi\_value exports \*/) { // This function body is expected to return a `napi\_value`. // The variables `napi\_env env` and `napi\_value exports` may be used within // the body, as they are provided by the definition of `NAPI\_MODULE\_INIT()`. return create\_addon(env); } ``` ## Environment life cycle APIs [Section Agents][] of the [ECMAScript Language Specification][] defines the concept of an "Agent" as a self-contained environment in which JavaScript code runs. Multiple such Agents may be started and terminated either concurrently or in sequence by the process. A Node.js environment corresponds to an ECMAScript Agent. In the main process, an environment is created at startup, and additional environments can be created on separate threads to serve as [worker threads][]. When Node.js is embedded in another application, the main thread of the application may also construct and destroy a Node.js environment multiple times during the life cycle of the application process such that each Node.js environment created by the application may, in turn, during its life cycle create and destroy additional environments as worker threads. From the perspective of a native addon this means that the bindings it provides may be called multiple times, from multiple contexts, and even concurrently from multiple threads. Native addons may need to allocate global state which they use during their life cycle of an Node.js environment such that the state can be unique to each instance of the addon. To this end, Node-API provides a way to associate data such that its life cycle is tied to the life cycle of a Node.js environment. ### `napi\_set\_instance\_data` ```c napi\_status napi\_set\_instance\_data(node\_api\_basic\_env env, void\* data, napi\_finalize finalize\_cb, void\* finalize\_hint); ``` \* `[in] env`: The environment that the Node-API call is invoked under. \* `[in] data`: The data item to make available to bindings of this instance. \* `[in] finalize\_cb`: The function to call when the environment is being torn down. The function receives `data` so that it might free it. [`napi\_finalize`][] provides more details. \* `[in] finalize\_hint`: Optional hint to pass to the finalize callback during collection. Returns `napi\_ok` if the API succeeded. This API associates `data` with the currently running Node.js environment. `data` can later be retrieved using `napi\_get\_instance\_data()`. Any existing data associated with the currently running Node.js environment which was set by means of a previous call to `napi\_set\_instance\_data()` will be overwritten. If a `finalize\_cb` was provided by the previous call, it will not be called. ### `napi\_get\_instance\_data`
https://github.com/nodejs/node/blob/main//doc/api/n-api.md
main
nodejs
[ -0.08466111123561859, 0.0705641508102417, -0.03556257113814354, 0.027898726984858513, 0.010056414641439915, -0.012774053029716015, -0.03162774816155434, 0.06414474546909332, 0.024295324459671974, -0.050580162554979324, -0.015279721468687057, -0.01334711816161871, -0.03951811045408249, -0.052991390228271484, 0.08428054302930832, 0.029096411541104317, -0.018520744517445564, 0.017552878707647324, -0.06029532477259636, -0.06399963796138763, 0.004433611407876015, 0.04717878997325897, -0.013349045068025589, 0.04224168509244919, -0.010631429962813854, -0.0937834307551384, -0.03072393126785755, -0.026612546294927597, 0.005708278156816959, 0.0438055545091629, -0.02190990559756756, -0.006580447778105736, -0.028546087443828583, 0.043188247829675674, -0.0005584087921306491, 0.09584060311317444, 0.007978682406246662, -0.1225377544760704, -0.02931034192442894, -0.0361274778842926, 0.09934419393539429, 0.06059298664331436, -0.08609793335199356, -0.0986468642950058, 0.056224364787340164, -0.07013635337352753, -0.06792158633470535, -0.005801670718938112, -0.009493090212345123, -0.011041028425097466, 0.038661010563373566, 0.033702097833156586, -0.0011162935988977551, -0.051333311945199966, 0.028707874938845634, 0.010317724198102951, 0.015430057421326637, 0.08979371190071106, 0.008709507994353771, 0.055418744683265686, 0.022761832922697067, -0.03362128883600235, 0.10262226313352585, -0.010414310730993748, -0.005676856730133295, 0.04364359751343727, -0.08805148303508759, -0.02994455024600029, -0.01176251657307148, -0.05979924276471138, 0.0034207149874418974, 0.024326136335730553, -0.06865382194519043, 0.0008959636325016618, -0.08064620196819305, -0.05721919238567352, 0.015771666541695595, 0.03614329546689987, -0.07099266350269318, 0.012716654688119888, -0.033534735441207886, -0.006928316783159971, 0.043195221573114395, 0.08283731341362, -0.07701592147350311, 0.09621753543615341, -0.009387372061610222, 0.016941457986831665, 0.050536204129457474, 0.023958073928952217, -0.10710802674293518, -0.05350901558995247, -0.12206890434026718, -0.05598132312297821, 0.06719932705163956, 0.008550380356609821, 0.001447410904802382, -0.0006837923428975046, -0.04850490018725395, -0.020110180601477623, -0.0036371650639921427, -0.04440596327185631, -0.0710761696100235, -0.032807786017656326, 0.08308330178260803, -0.01106262393295765, -0.023446014150977135, -0.07056187093257904, -0.022645384073257446, 0.013074608519673347, 0.0024055312387645245, 0.06262030452489853, 0.0845855176448822, -0.05747610703110695, -0.03351591154932976, 0.013596530072391033, 0.07459092885255814, -0.03292486071586609, 0.06999889761209488, 0.04591187462210655, 0.1270182579755783, -0.016541557386517525, 0.040714848786592484, 0.030163057148456573, 0.025170858949422836, -0.06274239718914032, -0.008036107756197453, -1.8279899591286306e-33, -0.04944132640957832, -0.0688890591263771, 0.03797941654920578, 0.08052362501621246, 0.06515870243310928, -0.03568249195814133, 0.008172156289219856, -0.01824718527495861, -0.0797806903719902, -0.09705223888158798, -0.03340492397546768, 0.023615842685103416, 0.04179931432008743, 0.010754027403891087, 0.0027287823613733053, -0.03283599019050598, 0.06012411415576935, -0.013625493273139, 0.03214132785797119, 0.030927017331123352, 0.00022924515360500664, -0.0061993044801056385, 0.04258006811141968, 0.060137007385492325, 0.012316545471549034, 0.010387609712779522, -0.001945753232575953, -0.006684015970677137, -0.022526370361447334, -0.049296796321868896, 0.07885027676820755, -0.020310113206505775, -0.008916664868593216, 0.023107832297682762, 0.05021384358406067, 0.01455447543412447, -0.0014734722208231688, 0.029672861099243164, -0.09170091897249222, -0.04318726807832718, 0.015040159225463867, 0.09574278444051743, -0.12343604117631912, 0.00008144352614181116, -0.0011147491168230772, -0.06787421554327011, -0.04285766929388046, -0.024215448647737503, 0.0913291722536087, -0.06156008318066597, -0.07653779536485672, 0.07203628867864609, 0.07207226753234863, -0.06538943201303482, 0.02923981100320816, 0.011034885421395302, -0.013004807755351067, -0.10733725130558014, -0.0007593243499286473, 0.02591714821755886, 0.060940809547901154, -0.03364605829119682, -0.02730712853372097, 0.0040221563540399075, -0.008370759896934032, 0.01803058385848999, -0.09531845897436142, 0.025020038709044456, 0.03785345330834389, -0.0364479161798954, 0.0033911915961652994, 0.029733622446656227, 0.010231477208435535, 0.02577938884496689, -0.01036838162690401, -0.0032547563314437866, -0.03905873000621796, -0.05697086080908775, -0.03614351898431778, -0.04851337894797325, 0.06542042642831802, -0.0656425952911377, -0.07528173923492432, 0.037189509719610214, 0.03397541493177414, 0.014200686477124691, -0.05593293160200119, 0.020921358838677406, 0.010441984981298447, 0.05580592900514603, 0.027587806805968285, -0.059422675520181656, -0.0435008779168129, -0.07779671996831894, -0.0375637449324131, -3.0858695662122674e-33, 0.021092310547828674, -0.050080690532922745, -0.09476206451654434, -0.06135374307632446, 0.004146415740251541, -0.03880397602915764, -0.05989202484488487, -0.05899590998888016, 0.008854336105287075, 0.04980836436152458, -0.008694339543581009, 0.0498737171292305, 0.025338901206851006, 0.06435631960630417, -0.02509859949350357, 0.07017713040113449, -0.12357784807682037, -0.02427556738257408, 0.03957897052168846, 0.042184095829725266, -0.007943237200379372, 0.009668320417404175, 0.034403156489133835, -0.010635007172822952, -0.05114179477095604, -0.009046847932040691, -0.1097031906247139, 0.004891590680927038, -0.09976918995380402, -0.11057083308696747, -0.04994098097085953, 0.006684330757707357, -0.04041723906993866, 0.07291386276483536, 0.09801775217056274, -0.03960051015019417, 0.030590733513236046, 0.03919981047511101, 0.019635071977972984, -0.07341054826974869, 0.059866487979888916, -0.07836121320724487, -0.017367703840136528, -0.039464060217142105, 0.03450784459710121, 0.02112213708460331, -0.05938911437988281, 0.06740947812795639, -0.10273010283708572, 0.010240050032734871, 0.009495249949395657, -0.06634759902954102, 0.0007972458261065185, 0.07339911162853241, 0.015964247286319733, -0.030204860493540764, 0.014494596980512142, 0.016862113028764725, 0.02411174587905407, 0.0017859952058643103, 0.008518445305526257, -0.12567831575870514, -0.05369390547275543, 0.01937086321413517, -0.09142246842384338, -0.01674719527363777, -0.06133446842432022, -0.057261090725660324, 0.07612922787666321, -0.03502247482538223, -0.016452061012387276, -0.010238456539809704, -0.01010801736265421, 0.019693175330758095, -0.09739171713590622, 0.04625381901860237, 0.03751145675778389, -0.10854636132717133, 0.0012840356212109327, 0.045752864331007004, -0.15733520686626434, 0.048615291714668274, -0.02697322703897953, -0.001926106633618474, 0.025493480265140533, 0.027253810316324234, 0.0004420071200001985, 0.05702754110097885, -0.014792047441005707, 0.012945756316184998, 0.03549615666270256, 0.06649090349674225, -0.09417060017585754, -0.052971482276916504, -0.1265079230070114, -5.5953442767986417e-8, -0.014793370850384235, -0.061348024755716324, -0.09908600896596909, -0.009418069384992123, -0.00826060026884079, -0.02342180162668228, 0.09934467077255249, -0.010226745158433914, 0.01264425739645958, 0.010745370760560036, 0.0102269621565938, 0.02143874019384384, 0.03368023782968521, -0.07259105145931244, 0.019821932539343834, 0.005983646493405104, 0.01085123885422945, 0.03181329742074013, 0.05449851229786873, 0.03627125918865204, 0.05036861076951027, 0.05107879266142845, -0.02130158431828022, 0.07327266037464142, 0.0017018645303323865, -0.031457576900720596, 0.04179561883211136, 0.0007131623569875956, -0.056807562708854675, 0.022065822035074234, 0.02914998307824135, 0.0335308313369751, 0.04080020263791084, 0.031626731157302856, 0.026141885668039322, 0.04193988814949989, 0.025175347924232483, 0.07607228308916092, 0.024249015375971794, 0.014828454703092575, 0.045877594500780106, 0.09499667584896088, -0.018767748028039932, 0.010932092554867268, 0.03890082985162735, -0.006984359119087458, 0.03710424527525902, 0.015026985667645931, 0.07492854446172714, 0.010019807144999504, 0.013707716017961502, 0.03932473063468933, 0.0037954787258058786, 0.03218322992324829, -0.0652652308344841, 0.038515396416187286, -0.06261726468801498, -0.054521847516298294, 0.05100126564502716, 0.12717831134796143, 0.030166929587721825, -0.01766483671963215, 0.07240058481693268, 0.004476635251194239 ]
0.191931
running Node.js environment. `data` can later be retrieved using `napi\_get\_instance\_data()`. Any existing data associated with the currently running Node.js environment which was set by means of a previous call to `napi\_set\_instance\_data()` will be overwritten. If a `finalize\_cb` was provided by the previous call, it will not be called. ### `napi\_get\_instance\_data` ```c napi\_status napi\_get\_instance\_data(node\_api\_basic\_env env, void\*\* data); ``` \* `[in] env`: The environment that the Node-API call is invoked under. \* `[out] data`: The data item that was previously associated with the currently running Node.js environment by a call to `napi\_set\_instance\_data()`. Returns `napi\_ok` if the API succeeded. This API retrieves data that was previously associated with the currently running Node.js environment via `napi\_set\_instance\_data()`. If no data is set, the call will succeed and `data` will be set to `NULL`. ## Basic Node-API data types Node-API exposes the following fundamental data types as abstractions that are consumed by the various APIs. These APIs should be treated as opaque, introspectable only with other Node-API calls. ### `napi\_status` Integral status code indicating the success or failure of a Node-API call. Currently, the following status codes are supported. ```c typedef enum { napi\_ok, napi\_invalid\_arg, napi\_object\_expected, napi\_string\_expected, napi\_name\_expected, napi\_function\_expected, napi\_number\_expected, napi\_boolean\_expected, napi\_array\_expected, napi\_generic\_failure, napi\_pending\_exception, napi\_cancelled, napi\_escape\_called\_twice, napi\_handle\_scope\_mismatch, napi\_callback\_scope\_mismatch, napi\_queue\_full, napi\_closing, napi\_bigint\_expected, napi\_date\_expected, napi\_arraybuffer\_expected, napi\_detachable\_arraybuffer\_expected, napi\_would\_deadlock, /\* unused \*/ napi\_no\_external\_buffers\_allowed, napi\_cannot\_run\_js } napi\_status; ``` If additional information is required upon an API returning a failed status, it can be obtained by calling `napi\_get\_last\_error\_info`. ### `napi\_extended\_error\_info` ```c typedef struct { const char\* error\_message; void\* engine\_reserved; uint32\_t engine\_error\_code; napi\_status error\_code; } napi\_extended\_error\_info; ``` \* `error\_message`: UTF8-encoded string containing a VM-neutral description of the error. \* `engine\_reserved`: Reserved for VM-specific error details. This is currently not implemented for any VM. \* `engine\_error\_code`: VM-specific error code. This is currently not implemented for any VM. \* `error\_code`: The Node-API status code that originated with the last error. See the [Error handling][] section for additional information. ### `napi\_env` `napi\_env` is used to represent a context that the underlying Node-API implementation can use to persist VM-specific state. This structure is passed to native functions when they're invoked, and it must be passed back when making Node-API calls. Specifically, the same `napi\_env` that was passed in when the initial native function was called must be passed to any subsequent nested Node-API calls. Caching the `napi\_env` for the purpose of general reuse, and passing the `napi\_env` between instances of the same addon running on different [`Worker`][] threads is not allowed. The `napi\_env` becomes invalid when an instance of a native addon is unloaded. Notification of this event is delivered through the callbacks given to [`napi\_add\_env\_cleanup\_hook`][] and [`napi\_set\_instance\_data`][]. ### `node\_api\_basic\_env` > Stability: 1 - Experimental This variant of `napi\_env` is passed to synchronous finalizers ([`node\_api\_basic\_finalize`][]). There is a subset of Node-APIs which accept a parameter of type `node\_api\_basic\_env` as their first argument. These APIs do not access the state of the JavaScript engine and are thus safe to call from synchronous finalizers. Passing a parameter of type `napi\_env` to these APIs is allowed, however, passing a parameter of type `node\_api\_basic\_env` to APIs that access the JavaScript engine state is not allowed. Attempting to do so without a cast will produce a compiler warning or an error when add-ons are compiled with flags which cause them to emit warnings and/or errors when incorrect pointer types are passed into a function. Calling such APIs from a synchronous finalizer will ultimately result in the termination of the application. ### `napi\_value` This is an opaque pointer that is used to represent a JavaScript value. ### `napi\_threadsafe\_function` This is an opaque pointer that represents a JavaScript function which can be called asynchronously
https://github.com/nodejs/node/blob/main//doc/api/n-api.md
main
nodejs
[ -0.010103804990649223, 0.07465887069702148, -0.002235738094896078, 0.05613764375448227, 0.036409225314855576, -0.07754881680011749, -0.027864471077919006, 0.0063463011756539345, 0.03361586481332779, -0.01209478359669447, -0.016482410952448845, 0.027381982654333115, 0.0008494138019159436, -0.07399176061153412, 0.08679606765508652, 0.037796750664711, 0.025147218257188797, 0.01584302820265293, -0.06317003071308136, -0.036222200840711594, -0.010783333331346512, 0.09183923155069351, -0.0009314528433606029, 0.022969773039221764, -0.03400786966085434, -0.003983065020292997, -0.038743846118450165, -0.028583142906427383, 0.005803531501442194, -0.0003725859278347343, -0.020115185528993607, 0.033183708786964417, -0.059456732124090195, 0.03675670921802521, 0.009148143231868744, 0.12717735767364502, -0.013119696639478207, -0.09665272384881973, -0.011966777965426445, 0.010212733410298824, 0.10703712701797485, 0.0950068011879921, -0.13114076852798462, -0.07586140185594559, 0.01641729474067688, -0.0073376866057515144, -0.06236572936177254, -0.05129249393939972, -0.048794399946928024, -0.02849910780787468, -0.01483972929418087, 0.015575936064124107, -0.020046645775437355, 0.029242713004350662, 0.0510137714445591, -0.0119513850659132, 0.046743858605623245, 0.07218089699745178, 0.015613889321684837, 0.08908652514219284, -0.011814504861831665, -0.037261512130498886, 0.043725937604904175, 0.012066662311553955, 0.030557384714484215, -0.0460021086037159, -0.07119176536798477, -0.02221686765551567, 0.05487353727221489, -0.06909050047397614, 0.0047744340263307095, 0.005537552759051323, -0.03597855195403099, -0.06718606501817703, -0.05677398294210434, -0.03376377746462822, -0.0384221151471138, 0.04061463847756386, -0.040233250707387924, -0.0273510180413723, -0.027877138927578926, -0.015118683688342571, -0.010213801637291908, 0.10605734586715698, -0.07935721427202225, 0.05488736927509308, -0.030470822006464005, -0.015361105091869831, 0.06340190023183823, 0.03537071496248245, -0.11291157454252243, -0.10118114948272705, -0.04761626571416855, 0.08728606253862381, 0.015512569807469845, -0.00799537543207407, 0.04298081248998642, -0.009479925036430359, 0.056262023746967316, -0.01551359798759222, 0.014973524026572704, -0.016048720106482506, 0.011096660979092121, 0.04042699187994003, 0.022174883633852005, -0.06684856861829758, -0.03314888849854469, -0.03865453600883484, -0.009796259924769402, 0.012331970036029816, 0.004151724744588137, 0.055101778358221054, 0.00703425845131278, -0.0501425638794899, 0.014476996846497059, -0.04502353072166443, 0.02389119379222393, -0.027117133140563965, 0.008862294256687164, 0.1617962270975113, 0.0946187973022461, -0.0035486100241541862, 0.08638569712638855, 0.019549140706658363, 0.0023925218265503645, -0.025130923837423325, -0.0091509148478508, -1.0783527833672799e-33, -0.018488574773073196, -0.1488656997680664, 0.025129878893494606, 0.03721020743250847, 0.04024489223957062, 0.005642360541969538, -0.028046708554029465, 0.02677685208618641, -0.01632549799978733, -0.0010026730597019196, -0.02011190541088581, 0.09090141952037811, -0.021871425211429596, -0.013451139442622662, -0.014108318835496902, 0.032819997519254684, 0.019658517092466354, 0.010231523774564266, 0.04533630236983299, 0.03379817306995392, 0.04725274816155434, 0.03091450221836567, -0.026961609721183777, 0.02726776897907257, 0.04728017374873161, -0.004318712744861841, 0.03738157078623772, 0.009957242757081985, -0.03449809178709984, -0.03113783523440361, 0.011212601326406002, 0.03555171936750412, -0.014111775904893875, 0.04250079765915871, 0.001980404369533062, 0.0454925112426281, 0.057379674166440964, 0.023410653695464134, -0.16469937562942505, 0.005054411478340626, 0.0720023363828659, 0.12077391147613525, -0.026768703013658524, -0.010484936647117138, -0.04791277274489403, -0.16049723327159882, -0.06138712167739868, -0.03788044676184654, 0.07210239768028259, -0.04183616489171982, -0.06016325205564499, 0.038189612329006195, 0.0644400417804718, -0.06861644238233566, -0.0040269456803798676, -0.03144827112555504, 0.02621408738195896, -0.11484835296869278, -0.029114192351698875, 0.0368548259139061, 0.018058083951473236, -0.005289722234010696, -0.0022136883344501257, 0.00806598924100399, -0.07164303213357925, 0.044343508780002594, -0.05442916229367256, -0.0011378879426047206, 0.035387005656957626, -0.009960011579096317, -0.06848479807376862, 0.04028438404202461, 0.025759181007742882, 0.02954980544745922, 0.04591246694326401, 0.015051362104713917, -0.04895354062318802, -0.07105839997529984, -0.03295803442597389, -0.02939101681113243, 0.08374693244695663, -0.09065636247396469, -0.08527031540870667, 0.05893402546644211, -0.003150216769427061, 0.03396705910563469, -0.029383378103375435, -0.0403033010661602, -0.00014280452160164714, 0.03133293613791466, -0.007265844382345676, -0.05931345745921135, -0.07985813170671463, -0.0599057637155056, -0.10376415401697159, -3.624666218119294e-33, 0.06059251353144646, -0.004122416954487562, -0.11317367851734161, -0.020332859829068184, 0.013183481991291046, -0.07564669102430344, -0.028019938617944717, -0.014517304487526417, -0.034475699067115784, 0.022111190482974052, 0.006961745209991932, 0.02560615725815296, 0.10153964161872864, 0.04266643151640892, -0.016666512936353683, 0.10185226798057556, -0.08480866998434067, -0.07407481968402863, 0.0054211993701756, -0.014536389149725437, -0.061114925891160965, -0.017080239951610565, 0.048085980117321014, -0.02190980687737465, -0.0436294861137867, 0.00008989742491394281, -0.04226881265640259, 0.011542913503944874, 0.011193700134754181, -0.10352280735969543, -0.022389531135559082, -0.05032145977020264, -0.09181249141693115, 0.07842686027288437, -0.017758775502443314, -0.035658132284879684, -0.0011283740168437362, -0.005626540165394545, 0.0433611124753952, -0.07627683877944946, 0.08405111730098724, -0.001491054310463369, -0.06484262645244598, -0.0030523657333105803, 0.04384801536798477, 0.016496628522872925, -0.04661459103226662, 0.07453654706478119, 0.021113431081175804, -0.03716736659407616, 0.04414428025484085, -0.012895707972347736, 0.007251522038131952, 0.08503514528274536, -0.033207379281520844, -0.04724070057272911, 0.057258374989032745, 0.07957370579242706, 0.0010025369701907039, -0.009716730564832687, 0.06547971069812775, -0.09403147548437119, -0.032725293189287186, 0.04180576652288437, -0.12804172933101654, -0.002827482298016548, -0.048732317984104156, -0.038426995277404785, 0.03491060808300972, -0.021453673020005226, -0.022920241579413414, -0.0028354572132229805, -0.04050184413790703, -0.0023963439743965864, -0.03608068823814392, 0.0510687530040741, -0.03005722537636757, -0.14407718181610107, 0.029855377972126007, 0.05972165986895561, -0.10512370616197586, 0.046958647668361664, -0.05662604048848152, 0.00900556892156601, 0.09608817100524902, -0.007325554266571999, -0.043384529650211334, 0.014053963124752045, 0.006726720370352268, 0.01642395369708538, -0.005056365393102169, -0.029125571250915527, -0.17458343505859375, -0.021532800048589706, -0.09899982810020447, -5.395697755261608e-8, -0.02738228626549244, -0.03708299621939659, -0.06325619667768478, 0.0690407082438469, 0.024648088961839676, -0.07913058251142502, 0.06642492115497589, 0.06487872451543808, 0.08347532153129578, -0.03266102820634842, 0.05510738119482994, 0.04605329409241676, 0.021213818341493607, -0.04415576905012131, 0.022565525025129318, 0.022838210687041283, 0.0790705531835556, -0.036632344126701355, 0.06746664643287659, 0.00502801313996315, -0.017635341733694077, 0.009500010870397091, -0.05022260174155235, 0.03089507669210434, 0.029210882261395454, -0.00006665130786132067, 0.02770417183637619, 0.07113271951675415, -0.05777094140648842, -0.038092002272605896, -0.0076345764100551605, 0.029128143563866615, 0.08705052733421326, 0.014490432105958462, -0.0070051527582108974, -0.011075575836002827, 0.0062838103622198105, 0.05102110281586647, 0.015499630011618137, 0.05025557801127434, 0.0061525581404566765, 0.01902701146900654, -0.02352323941886425, 0.029903363436460495, 0.013853419572114944, -0.013802182860672474, 0.044951919466257095, 0.06111986190080643, 0.0655519887804985, -0.03945181891322136, 0.0014347648248076439, -0.007092994637787342, -0.04920455440878868, 0.05660047382116318, 0.01475832425057888, -0.0005538277910090983, -0.03478390723466873, -0.050638120621442795, -0.022031066939234734, 0.03596988692879677, -0.018419992178678513, -0.020844288170337677, 0.006067839916795492, -0.047090739011764526 ]
0.134431
a function. Calling such APIs from a synchronous finalizer will ultimately result in the termination of the application. ### `napi\_value` This is an opaque pointer that is used to represent a JavaScript value. ### `napi\_threadsafe\_function` This is an opaque pointer that represents a JavaScript function which can be called asynchronously from multiple threads via `napi\_call\_threadsafe\_function()`. ### `napi\_threadsafe\_function\_release\_mode` A value to be given to `napi\_release\_threadsafe\_function()` to indicate whether the thread-safe function is to be closed immediately (`napi\_tsfn\_abort`) or merely released (`napi\_tsfn\_release`) and thus available for subsequent use via `napi\_acquire\_threadsafe\_function()` and `napi\_call\_threadsafe\_function()`. ```c typedef enum { napi\_tsfn\_release, napi\_tsfn\_abort } napi\_threadsafe\_function\_release\_mode; ``` ### `napi\_threadsafe\_function\_call\_mode` A value to be given to `napi\_call\_threadsafe\_function()` to indicate whether the call should block whenever the queue associated with the thread-safe function is full. ```c typedef enum { napi\_tsfn\_nonblocking, napi\_tsfn\_blocking } napi\_threadsafe\_function\_call\_mode; ``` ### Node-API memory management types #### `napi\_handle\_scope` This is an abstraction used to control and modify the lifetime of objects created within a particular scope. In general, Node-API values are created within the context of a handle scope. When a native method is called from JavaScript, a default handle scope will exist. If the user does not explicitly create a new handle scope, Node-API values will be created in the default handle scope. For any invocations of code outside the execution of a native method (for instance, during a libuv callback invocation), the module is required to create a scope before invoking any functions that can result in the creation of JavaScript values. Handle scopes are created using [`napi\_open\_handle\_scope`][] and are destroyed using [`napi\_close\_handle\_scope`][]. Closing the scope can indicate to the GC that all `napi\_value`s created during the lifetime of the handle scope are no longer referenced from the current stack frame. For more details, review the [Object lifetime management][]. #### `napi\_escapable\_handle\_scope` Escapable handle scopes are a special type of handle scope to return values created within a particular handle scope to a parent scope. #### `napi\_ref` This is the abstraction to use to reference a `napi\_value`. This allows for users to manage the lifetimes of JavaScript values, including defining their minimum lifetimes explicitly. For more details, review the [Object lifetime management][]. #### `napi\_type\_tag` A 128-bit value stored as two unsigned 64-bit integers. It serves as a UUID with which JavaScript objects or [externals][] can be "tagged" in order to ensure that they are of a certain type. This is a stronger check than [`napi\_instanceof`][], because the latter can report a false positive if the object's prototype has been manipulated. Type-tagging is most useful in conjunction with [`napi\_wrap`][] because it ensures that the pointer retrieved from a wrapped object can be safely cast to the native type corresponding to the type tag that had been previously applied to the JavaScript object. ```c typedef struct { uint64\_t lower; uint64\_t upper; } napi\_type\_tag; ``` #### `napi\_async\_cleanup\_hook\_handle` An opaque value returned by [`napi\_add\_async\_cleanup\_hook`][]. It must be passed to [`napi\_remove\_async\_cleanup\_hook`][] when the chain of asynchronous cleanup events completes. ### Node-API callback types #### `napi\_callback\_info` Opaque datatype that is passed to a callback function. It can be used for getting additional information about the context in which the callback was invoked. #### `napi\_callback` Function pointer type for user-provided native functions which are to be exposed to JavaScript via Node-API. Callback functions should satisfy the following signature: ```c typedef napi\_value (\*napi\_callback)(napi\_env, napi\_callback\_info); ``` Unless for reasons discussed in [Object Lifetime Management][], creating a handle and/or callback scope inside a `napi\_callback` is not necessary. #### `node\_api\_basic\_finalize` > Stability: 1 - Experimental Function pointer type for add-on provided functions that allow the user to be notified when externally-owned data is ready to be cleaned
https://github.com/nodejs/node/blob/main//doc/api/n-api.md
main
nodejs
[ -0.09412378072738647, 0.014644086360931396, -0.018118642270565033, -0.046922631561756134, -0.03445873409509659, -0.01668073609471321, 0.04182668775320053, -0.005726618226617575, 0.04906576871871948, -0.019661949947476387, 0.016722068190574646, -0.01586149074137211, -0.06633397191762924, -0.053662579506635666, 0.01705770753324032, -0.02244589664041996, 0.02299003303050995, -0.006175225600600243, -0.11156243085861206, -0.018745843321084976, 0.008063280023634434, 0.054317038506269455, -0.03188895434141159, 0.046488795429468155, -0.033503443002700806, -0.0514056496322155, -0.04730713739991188, -0.08941438794136047, 0.010537569411098957, 0.01084192842245102, -0.0068180738016963005, -0.04495783895254135, -0.09106530249118805, -0.007146104704588652, -0.018898075446486473, 0.08427341282367706, -0.037196043878793716, -0.11486778408288956, 0.04404977709054947, -0.010510312393307686, 0.03418809920549393, 0.0041926950216293335, -0.21008296310901642, 0.02998190186917782, -0.027378233149647713, -0.00836097914725542, 0.028118109330534935, 0.019392723217606544, -0.03836962208151817, 0.0006759290699847043, -0.05457591265439987, 0.12263588607311249, -0.02899714931845665, -0.030974818393588066, 0.10672452300786972, -0.05075743421912193, 0.11309965699911118, -0.03453874960541725, -0.04512966424226761, 0.09908851981163025, 0.0006393274525180459, -0.03677072748541832, -0.007369781378656626, 0.05071541666984558, 0.11039487272500992, -0.004135959316045046, 0.0358174629509449, -0.03387152776122093, 0.014797760173678398, -0.0527859702706337, -0.04583074524998665, -0.01590304635465145, -0.004755946341902018, 0.05818062275648117, 0.01164208073168993, 0.013737102970480919, -0.013522590510547161, -0.009193746373057365, -0.07248613238334656, -0.04091189429163933, 0.04481064900755882, 0.04401542618870735, 0.08041755110025406, -0.04952966794371605, 0.05804865434765816, 0.03290482982993126, 0.000100652156106662, -0.035646967589855194, 0.12924985587596893, 0.045513998717069626, 0.011975603178143501, 0.04272637143731117, -0.050061918795108795, 0.032636042684316635, 0.06826256215572357, -0.025110935792326927, 0.057979803532361984, -0.012680426239967346, -0.0398496650159359, 0.04176786541938782, -0.019704027101397514, -0.041574880480766296, -0.007026137784123421, -0.032951124012470245, -0.018016736954450607, 0.004043056629598141, -0.07054319977760315, -0.04370042309165001, -0.05026790127158165, -0.04527425765991211, -0.026783660054206848, -0.02022675797343254, 0.05252377316355705, 0.012643828056752682, -0.023122694343328476, 0.035459890961647034, 0.03425642102956772, 0.001668776385486126, 0.11945067346096039, 0.0605686791241169, 0.08531588315963745, -0.012297099456191063, 0.0028852238319814205, -0.0067564393393695354, -0.04485718533396721, 0.007177051622420549, -0.05389712378382683, -1.4855196900856384e-33, 0.005838033743202686, -0.07223714143037796, -0.042053092271089554, -0.005214584991335869, -0.0020212894305586815, 0.009680165909230709, -0.03977731242775917, -0.0093979611992836, -0.06439872831106186, -0.03778618946671486, -0.009765041060745716, 0.0004656983946915716, -0.015366822481155396, 0.010932622477412224, 0.021166091784834862, -0.03166194632649422, 0.04202679172158241, 0.0913134217262268, 0.01681041531264782, 0.03855122625827789, 0.07578568905591965, 0.04137081652879715, 0.0031922433990985155, -0.0167581457644701, 0.003607361577451229, -0.02089076302945614, 0.021066034212708473, -0.0070211561396718025, -0.05306581035256386, 0.022349074482917786, -0.032262660562992096, -0.044051941484212875, -0.021362250670790672, 0.010809015482664108, 0.04120329022407532, -0.0630200207233429, -0.0612582229077816, -0.04276585206389427, -0.04129667580127716, -0.07133602350950241, -0.002422340912744403, 0.06484447419643402, -0.13057547807693481, 0.03267090395092964, -0.022023849189281464, -0.10486258566379547, -0.041490036994218826, 0.06562847644090652, 0.02412966638803482, -0.06558669358491898, 0.03267836570739746, 0.010574751533567905, 0.03783639147877693, -0.10882725566625595, 0.05417681112885475, 0.007279019337147474, 0.05452820658683777, -0.04773010313510895, -0.020589178428053856, 0.12222111225128174, 0.0008643997716717422, -0.01830754056572914, -0.014687343500554562, -0.028409970924258232, -0.02094828523695469, -0.007971880957484245, -0.08470941334962845, -0.030796421691775322, 0.08408713340759277, -0.017254017293453217, -0.059081751853227615, 0.08966705948114395, 0.026598287746310234, 0.08014433830976486, 0.008016244508326054, 0.030773738399147987, -0.054435908794403076, -0.05157141014933586, -0.026296673342585564, -0.06827365607023239, 0.07463543862104416, 0.007980172522366047, -0.06384184956550598, 0.035727277398109436, -0.03740744665265083, -0.031129347160458565, -0.0517200268805027, -0.036895494908094406, -0.07570512592792511, 0.014457454904913902, 0.0132983960211277, -0.04191053286194801, -0.03582180663943291, -0.061228733509778976, -0.05182897672057152, -2.634937259938368e-33, 0.060663674026727676, -0.059579331427812576, -0.13330110907554626, 0.02016466297209263, -0.03367873281240463, 0.004543638322502375, -0.024130532518029213, -0.045977767556905746, -0.05039290711283684, 0.013543532229959965, 0.058183204382658005, 0.034042466431856155, 0.08743054419755936, 0.06679009646177292, 0.06287149339914322, -0.005252867471426725, 0.06451186537742615, -0.059960540384054184, -0.062431808561086655, 0.019587131217122078, 0.035943832248449326, -0.07155612856149673, 0.030460167676210403, -0.017835913226008415, 0.015134657733142376, -0.01211077906191349, -0.062182530760765076, -0.005123412702232599, -0.005717804189771414, -0.011935045942664146, 0.01922253519296646, -0.03141679987311363, -0.03727913275361061, 0.01995830610394478, 0.041760265827178955, 0.048420801758766174, 0.0549045130610466, -0.05123939737677574, -0.00693513173609972, -0.0809362381696701, 0.12595921754837036, 0.03261301666498184, 0.05810661241412163, -0.00942911859601736, -0.03191964328289032, 0.012796631082892418, -0.08262293040752411, -0.011799854226410389, -0.08174071460962296, -0.018541518598794937, 0.013180332258343697, -0.05369969829916954, 0.02035684324800968, 0.019024096429347992, -0.07350552827119827, -0.026224413886666298, 0.07358602434396744, -0.04777275398373604, -0.00011384434037609026, 0.04299629107117653, 0.058995794504880905, -0.04223240166902542, 0.06635969132184982, -0.062133658677339554, -0.0003106210206169635, -0.04778125137090683, 0.008916300721466541, -0.06817129999399185, 0.0685414969921112, 0.009737351909279823, 0.11415669322013855, 0.016547393053770065, -0.01737174205482006, 0.02035888470709324, -0.08040928840637207, 0.0717056468129158, 0.041345417499542236, -0.12034419924020767, -0.01076807826757431, 0.08068584650754929, -0.074860118329525, 0.053365014493465424, 0.0500408336520195, 0.09299629926681519, 0.0074986787512898445, -0.008455419912934303, 0.010142701677978039, 0.034884076565504074, 0.04102974757552147, -0.055332038551568985, 0.0405963696539402, 0.00345444749109447, -0.07129329442977905, 0.06125403195619583, -0.022718872874975204, -5.490420207365787e-8, 0.061967458575963974, -0.06748787313699722, -0.02093309909105301, 0.024396291002631187, -0.03650565817952156, -0.06615107506513596, -0.008990330621600151, -0.0732535645365715, 0.02657862938940525, -0.013117428869009018, 0.07544280588626862, 0.02748158387839794, 0.05086713656783104, -0.052211470901966095, 0.05064079537987709, 0.00801630038768053, -0.02640642039477825, 0.01470682118088007, 0.019416052848100662, -0.06181584671139717, -0.012445666827261448, -0.027879897505044937, -0.03498023375868797, 0.05825066193938255, 0.005440260283648968, -0.005680581089109182, 0.07607050985097885, 0.06271393597126007, 0.047521065920591354, -0.023476053029298782, 0.04595300182700157, -0.01888868771493435, 0.06650929898023605, 0.043497927486896515, -0.05476710572838783, 0.10137605667114258, -0.025510722771286964, 0.0859014019370079, -0.004224328324198723, 0.08077125251293182, 0.03482795134186745, -0.0027834074571728706, -0.03951546177268028, 0.0479724146425724, 0.11144642531871796, 0.06766089051961899, -0.04704916104674339, 0.052158474922180176, -0.02482457272708416, 0.002526054158806801, -0.05295988544821739, 0.033389244228601456, 0.002577773528173566, 0.13360010087490082, -0.0760781317949295, 0.008885801769793034, -0.06967884302139282, -0.03706631809473038, 0.010076920501887798, 0.07322638481855392, 0.02559446357190609, 0.037088703364133835, 0.03942306339740753, 0.0089334174990654 ]
0.319465
``` Unless for reasons discussed in [Object Lifetime Management][], creating a handle and/or callback scope inside a `napi\_callback` is not necessary. #### `node\_api\_basic\_finalize` > Stability: 1 - Experimental Function pointer type for add-on provided functions that allow the user to be notified when externally-owned data is ready to be cleaned up because the object it was associated with has been garbage-collected. The user must provide a function satisfying the following signature which would get called upon the object's collection. Currently, `node\_api\_basic\_finalize` can be used for finding out when objects that have external data are collected. ```c typedef void (\*node\_api\_basic\_finalize)(node\_api\_basic\_env env, void\* finalize\_data, void\* finalize\_hint); ``` Unless for reasons discussed in [Object Lifetime Management][], creating a handle and/or callback scope inside the function body is not necessary. Since these functions may be called while the JavaScript engine is in a state where it cannot execute JavaScript code, only Node-APIs which accept a `node\_api\_basic\_env` as their first parameter may be called. [`node\_api\_post\_finalizer`][] can be used to schedule Node-API calls that require access to the JavaScript engine's state to run after the current garbage collection cycle has completed. In the case of [`node\_api\_create\_external\_string\_latin1`][] and [`node\_api\_create\_external\_string\_utf16`][] the `env` parameter may be null, because external strings can be collected during the latter part of environment shutdown. Change History: \* experimental (`NAPI\_EXPERIMENTAL`): Only Node-API calls that accept a `node\_api\_basic\_env` as their first parameter may be called, otherwise the application will be terminated with an appropriate error message. This feature can be turned off by defining `NODE\_API\_EXPERIMENTAL\_BASIC\_ENV\_OPT\_OUT`. #### `napi\_finalize` Function pointer type for add-on provided function that allow the user to schedule a group of calls to Node-APIs in response to a garbage collection event, after the garbage collection cycle has completed. These function pointers can be used with [`node\_api\_post\_finalizer`][]. ```c typedef void (\*napi\_finalize)(napi\_env env, void\* finalize\_data, void\* finalize\_hint); ``` Change History: \* experimental (`NAPI\_EXPERIMENTAL` is defined): A function of this type may no longer be used as a finalizer, except with [`node\_api\_post\_finalizer`][]. [`node\_api\_basic\_finalize`][] must be used instead. This feature can be turned off by defining `NODE\_API\_EXPERIMENTAL\_BASIC\_ENV\_OPT\_OUT`. #### `napi\_async\_execute\_callback` Function pointer used with functions that support asynchronous operations. Callback functions must satisfy the following signature: ```c typedef void (\*napi\_async\_execute\_callback)(napi\_env env, void\* data); ``` Implementations of this function must avoid making Node-API calls that execute JavaScript or interact with JavaScript objects. Node-API calls should be in the `napi\_async\_complete\_callback` instead. Do not use the `napi\_env` parameter as it will likely result in execution of JavaScript. #### `napi\_async\_complete\_callback` Function pointer used with functions that support asynchronous operations. Callback functions must satisfy the following signature: ```c typedef void (\*napi\_async\_complete\_callback)(napi\_env env, napi\_status status, void\* data); ``` Unless for reasons discussed in [Object Lifetime Management][], creating a handle and/or callback scope inside the function body is not necessary. #### `napi\_threadsafe\_function\_call\_js` Function pointer used with asynchronous thread-safe function calls. The callback will be called on the main thread. Its purpose is to use a data item arriving via the queue from one of the secondary threads to construct the parameters necessary for a call into JavaScript, usually via `napi\_call\_function`, and then make the call into JavaScript. The data arriving from the secondary thread via the queue is given in the `data` parameter and the JavaScript function to call is given in the `js\_callback` parameter. Node-API sets up the environment prior to calling this callback, so it is sufficient to call the JavaScript function via `napi\_call\_function` rather than via `napi\_make\_callback`. Callback functions must satisfy the following signature: ```c typedef void (\*napi\_threadsafe\_function\_call\_js)(napi\_env env, napi\_value js\_callback, void\* context, void\* data); ``` \* `[in] env`: The environment to use for API calls, or `NULL` if the thread-safe function
https://github.com/nodejs/node/blob/main//doc/api/n-api.md
main
nodejs
[ -0.06549221277236938, 0.06861481815576553, -0.024195605888962746, 0.05663979426026344, 0.019369175657629967, -0.09469598531723022, 0.0380294993519783, 0.04377960413694382, 0.015303543768823147, 0.007304861675947905, -0.04500042647123337, 0.0013464413350448012, -0.07095345109701157, -0.034926652908325195, 0.007143507245928049, 0.032012954354286194, 0.04029816389083862, 0.008633241057395935, -0.07483704388141632, -0.02897481992840767, -0.012544827535748482, 0.06315743923187256, -0.043233782052993774, 0.013887451030313969, -0.06661057472229004, -0.04538964852690697, -0.01301021408289671, -0.1112595647573471, 0.03288785740733147, 0.03207380324602127, -0.014477240853011608, -0.032100047916173935, -0.12065710127353668, 0.014306064695119858, -0.02173369750380516, 0.1286759078502655, -0.003613361855968833, -0.09477585554122925, -0.012545689940452576, -0.05063937231898308, 0.045264460146427155, 0.1064709722995758, -0.14845772087574005, -0.021650684997439384, 0.016237886622548103, 0.0031906631775200367, -0.010205669328570366, -0.028169408440589905, -0.06558164954185486, -0.04909767955541611, 0.00704312464222312, 0.00014693872071802616, -0.03683530539274216, -0.005727879237383604, 0.09944882988929749, -0.07611333578824997, 0.08063829690217972, -0.06083478778600693, -0.04616929218173027, 0.11331363767385483, -0.0157452542334795, -0.03755202516913414, 0.0353676974773407, -0.04577695205807686, 0.046722833067178726, 0.00968924444168806, 0.018950264900922775, -0.0020003165118396282, 0.022094540297985077, 0.026346230879426003, -0.020634237676858902, 0.01725021004676819, -0.06653599441051483, 0.009258781559765339, -0.022604607045650482, 0.03349291905760765, -0.06594736874103546, -0.02285577729344368, -0.07007646560668945, -0.04670371860265732, -0.00781818013638258, 0.008225797675549984, 0.004620106890797615, -0.0015704751713201404, 0.01730787567794323, 0.061730578541755676, -0.028031054884195328, 0.027358168736100197, 0.058036357164382935, 0.05756983906030655, -0.04545607790350914, 0.011849227361381054, -0.05817064270377159, 0.0322282612323761, 0.013093816116452217, -0.0078073469921946526, 0.07209223508834839, -0.0864935889840126, 0.021512780338525772, 0.06188901141285896, -0.023488452658057213, 0.02283312752842903, 0.008206999860703945, -0.03628026694059372, 0.0115518094971776, 0.0023513140622526407, -0.035621244460344315, -0.03155872970819473, -0.040108513087034225, 0.03965452313423157, -0.059459153562784195, 0.009234973229467869, 0.005217691417783499, -0.013584797270596027, 0.016334982588887215, 0.01587658002972603, 0.06531024724245071, -0.026751605793833733, 0.07447253167629242, 0.038130275905132294, 0.08680053055286407, 0.012111963704228401, 0.0680682510137558, 0.02995765209197998, 0.0005465085268951952, -0.03338170051574707, -0.010006224736571312, -2.6405549749915967e-34, -0.0027647067327052355, -0.08575519174337387, -0.01764647476375103, 0.05074910447001457, 0.009457848034799099, 0.026297328993678093, 0.04940100014209747, 0.03641187772154808, 0.0005655414424836636, -0.04665308818221092, 0.0264898594468832, 0.04338392987847328, -0.006578152533620596, -0.028662703931331635, 0.06722886115312576, 0.005255911499261856, 0.07338878512382507, 0.06209468096494675, -0.007165547925978899, 0.005961498245596886, 0.06670702248811722, -0.02332833595573902, -0.043492089956998825, -0.0017407559789717197, 0.028505459427833557, -0.04213816300034523, -0.03421691432595253, 0.018746672198176384, -0.01603151112794876, -0.010396287776529789, 0.015062703751027584, 0.0225533414632082, -0.009168320335447788, 0.05645880848169327, 0.03861461207270622, 0.006894589401781559, -0.07625001668930054, 0.0019021773478016257, -0.07741433382034302, -0.09363964200019836, 0.06787838786840439, 0.07256084680557251, -0.07917551696300507, 0.007742069195955992, -0.0470331609249115, -0.12314769625663757, -0.058677203953266144, -0.01977277547121048, 0.02918185107409954, -0.030695652589201927, 0.022676415741443634, 0.05911661311984062, 0.02154432237148285, -0.057379912585020065, 0.02506900206208229, 0.011920209974050522, 0.004233325831592083, -0.0787697583436966, -0.03004777617752552, 0.05773017555475235, 0.024047762155532837, 0.011600074358284473, -0.004792868159711361, 0.04634188488125801, -0.02822277508676052, -0.012028563767671585, -0.0589011125266552, 0.016501275822520256, 0.057682644575834274, -0.05086382105946541, 0.024701695889234543, 0.062178418040275574, 0.024720512330532074, 0.03065011277794838, -0.025096237659454346, -0.032012227922677994, -0.06955547630786896, -0.04291558638215065, -0.02512006089091301, -0.10231277346611023, 0.1045130044221878, -0.04759536683559418, -0.009801693260669708, 0.06060074642300606, 0.017503561452031136, -0.00668909540399909, -0.03849232569336891, -0.026623254641890526, -0.01803487539291382, 0.10715511441230774, -0.03201219439506531, -0.051306042820215225, -0.03169555589556694, -0.06157483160495758, -0.13934265077114105, -2.9196880931265975e-33, 0.07097694277763367, 0.012537941336631775, -0.026002727448940277, 0.01191636174917221, -0.06502137333154678, -0.05616201087832451, -0.06705524027347565, -0.07402481883764267, -0.01069589052349329, 0.013529176823794842, 0.0008177976706065238, -0.007895877584815025, 0.11459000408649445, 0.0289248488843441, 0.03737470507621765, -0.0005832916940562427, -0.09918874502182007, -0.14688345789909363, -0.05244970694184303, -0.01219019666314125, -0.03306761756539345, -0.007306466344743967, 0.060104552656412125, -0.05139210447669029, -0.03777378425002098, -0.010468970984220505, -0.13337492942810059, 0.02063780464231968, -0.017870081588625908, -0.07573748379945755, -0.023242060095071793, -0.015094224363565445, 0.004298008978366852, 0.01279249507933855, 0.04440467804670334, -0.07461481541395187, 0.03371293097734451, 0.01586601510643959, 0.0576140396296978, -0.05968111380934715, 0.13481947779655457, 0.05684899538755417, -0.03870273754000664, 0.014622673392295837, -0.011700859293341637, -0.02670300006866455, -0.07864537835121155, 0.09097041189670563, 0.043675873428583145, -0.013941955752670765, -0.049791984260082245, -0.03631684556603432, -0.00008727616659598425, 0.06371216475963593, -0.051573242992162704, 0.04239076375961304, 0.13557736575603485, 0.01604139246046543, 0.04146428033709526, 0.04367849603295326, 0.050201721489429474, -0.1288214772939682, 0.030871383845806122, 0.0361701063811779, -0.0265530776232481, -0.043109454214572906, 0.023813704028725624, -0.042356669902801514, 0.0822235569357872, 0.023022525012493134, 0.04536948353052139, 0.059768881648778915, -0.06433581560850143, -0.009958796203136444, -0.020629698410630226, 0.04782043397426605, 0.021011436358094215, -0.17416705191135406, 0.026821279898285866, 0.04837575554847717, -0.08736158907413483, 0.023354295641183853, -0.0029171877540647984, 0.04018883779644966, 0.03663794696331024, -0.03877130150794983, -0.0665326938033104, -0.00887975376099348, -0.01894492283463478, -0.004147351253777742, -0.014577070251107216, -0.007283092942088842, -0.12607139348983765, -0.0080811632797122, -0.04737403988838196, -5.3775760733287825e-8, -0.026190511882305145, -0.00423884391784668, -0.028512967750430107, 0.07926876842975616, 0.027786117047071457, -0.08734434098005295, 0.03522038087248802, 0.022501496598124504, 0.0497174933552742, -0.006400753743946552, 0.030420178547501564, -0.04668797552585602, 0.0366043783724308, -0.06835613399744034, 0.02393963932991028, -0.04696058854460716, 0.024490805342793465, -0.04519655182957649, -0.015540827065706253, 0.008627723902463913, -0.03698572516441345, -0.0110033443197608, -0.015995793044567108, 0.04542955011129379, 0.023283496499061584, -0.036132026463747025, 0.10368175059556961, 0.13678911328315735, 0.012630919925868511, -0.010799390263855457, 0.021521303802728653, 0.05974786356091499, 0.06885047256946564, 0.08415374904870987, -0.039370402693748474, 0.051838088780641556, 0.017308635637164116, 0.05659729614853859, -0.03470640629529953, 0.07760564982891083, 0.06749439239501953, 0.04633403196930885, -0.05336481332778931, 0.05752053111791611, 0.08725184202194214, 0.027708834037184715, 0.01225304789841175, 0.05136484280228615, 0.026850415393710136, 0.018954169005155563, -0.01836131140589714, 0.010407078079879284, 0.017733892425894737, 0.10399793088436127, -0.04481450095772743, 0.02672790363430977, -0.055778488516807556, 0.031839706003665924, -0.016856618225574493, 0.08208678662776947, 0.02430158294737339, -0.010439854115247726, 0.004700218327343464, 0.018902847543358803 ]
0.218809
so it is sufficient to call the JavaScript function via `napi\_call\_function` rather than via `napi\_make\_callback`. Callback functions must satisfy the following signature: ```c typedef void (\*napi\_threadsafe\_function\_call\_js)(napi\_env env, napi\_value js\_callback, void\* context, void\* data); ``` \* `[in] env`: The environment to use for API calls, or `NULL` if the thread-safe function is being torn down and `data` may need to be freed. \* `[in] js\_callback`: The JavaScript function to call, or `NULL` if the thread-safe function is being torn down and `data` may need to be freed. It may also be `NULL` if the thread-safe function was created without `js\_callback`. \* `[in] context`: The optional data with which the thread-safe function was created. \* `[in] data`: Data created by the secondary thread. It is the responsibility of the callback to convert this native data to JavaScript values (with Node-API functions) that can be passed as parameters when `js\_callback` is invoked. This pointer is managed entirely by the threads and this callback. Thus this callback should free the data. Unless for reasons discussed in [Object Lifetime Management][], creating a handle and/or callback scope inside the function body is not necessary. #### `napi\_cleanup\_hook` Function pointer used with [`napi\_add\_env\_cleanup\_hook`][]. It will be called when the environment is being torn down. Callback functions must satisfy the following signature: ```c typedef void (\*napi\_cleanup\_hook)(void\* data); ``` \* `[in] data`: The data that was passed to [`napi\_add\_env\_cleanup\_hook`][]. #### `napi\_async\_cleanup\_hook` Function pointer used with [`napi\_add\_async\_cleanup\_hook`][]. It will be called when the environment is being torn down. Callback functions must satisfy the following signature: ```c typedef void (\*napi\_async\_cleanup\_hook)(napi\_async\_cleanup\_hook\_handle handle, void\* data); ``` \* `[in] handle`: The handle that must be passed to [`napi\_remove\_async\_cleanup\_hook`][] after completion of the asynchronous cleanup. \* `[in] data`: The data that was passed to [`napi\_add\_async\_cleanup\_hook`][]. The body of the function should initiate the asynchronous cleanup actions at the end of which `handle` must be passed in a call to [`napi\_remove\_async\_cleanup\_hook`][]. ## Error handling Node-API uses both return values and JavaScript exceptions for error handling. The following sections explain the approach for each case. ### Return values All of the Node-API functions share the same error handling pattern. The return type of all API functions is `napi\_status`. The return value will be `napi\_ok` if the request was successful and no uncaught JavaScript exception was thrown. If an error occurred AND an exception was thrown, the `napi\_status` value for the error will be returned. If an exception was thrown, and no error occurred, `napi\_pending\_exception` will be returned. In cases where a return value other than `napi\_ok` or `napi\_pending\_exception` is returned, [`napi\_is\_exception\_pending`][] must be called to check if an exception is pending. See the section on exceptions for more details. The full set of possible `napi\_status` values is defined in `napi\_api\_types.h`. The `napi\_status` return value provides a VM-independent representation of the error which occurred. In some cases it is useful to be able to get more detailed information, including a string representing the error as well as VM (engine)-specific information. In order to retrieve this information [`napi\_get\_last\_error\_info`][] is provided which returns a `napi\_extended\_error\_info` structure. The format of the `napi\_extended\_error\_info` structure is as follows: ```c typedef struct napi\_extended\_error\_info { const char\* error\_message; void\* engine\_reserved; uint32\_t engine\_error\_code; napi\_status error\_code; }; ``` \* `error\_message`: Textual representation of the error that occurred. \* `engine\_reserved`: Opaque handle reserved for engine use only. \* `engine\_error\_code`: VM specific error code. \* `error\_code`: Node-API status code for the last error. [`napi\_get\_last\_error\_info`][] returns the information for the last Node-API call that was made. Do not rely on the content or format of any of the extended information as it is not subject to SemVer and may change at
https://github.com/nodejs/node/blob/main//doc/api/n-api.md
main
nodejs
[ -0.1121799647808075, 0.030806981027126312, -0.038649190217256546, -0.017393728718161583, -0.045600540935993195, -0.04229326546192169, 0.012792844325304031, -0.01558882836252451, 0.030878989025950432, -0.06049947440624237, -0.01347519364207983, -0.026347987353801727, -0.028897633776068687, -0.06777013838291168, 0.05084211006760597, 0.007138119079172611, 0.0360284149646759, -0.04511910676956177, -0.1183466836810112, -0.009366818703711033, 0.007039427757263184, 0.018502160906791687, 0.042134255170822144, 0.037145864218473434, 0.017834525555372238, -0.12193549424409866, 0.024772638455033302, -0.04897862300276756, -0.0008415154879912734, 0.010748513042926788, 0.024738246574997902, -0.04491308331489563, -0.09798851609230042, -0.11000076681375504, -0.0048883152194321156, 0.10363712906837463, -0.021672070026397705, -0.09908337891101837, 0.004165687598288059, 0.026448719203472137, 0.03527643531560898, 0.03937093913555145, -0.19374974071979523, -0.08651474118232727, -0.059631552547216415, -0.02198486030101776, 0.009265005588531494, -0.03467967361211777, -0.0012151963310316205, 0.012332313694059849, -0.062167949974536896, 0.1318029910326004, -0.009878726676106453, -0.034092359244823456, 0.021528681740164757, -0.08666647970676422, 0.07409407198429108, -0.004317426588386297, -0.02023826539516449, 0.1010817214846611, 0.0411294624209404, -0.043431296944618225, 0.05628836527466774, 0.030888177454471588, 0.062175165861845016, -0.041791994124650955, -0.01919025368988514, -0.04332217201590538, 0.006804005242884159, -0.02655983716249466, -0.022109337151050568, 0.03582534193992615, -0.0018520383164286613, 0.007450982462614775, 0.015019788406789303, 0.002938447752967477, -0.018476448953151703, -0.01453422475606203, -0.019604837521910667, -0.008514062501490116, 0.03070203587412834, 0.028291121125221252, 0.045735910534858704, 0.015951059758663177, 0.014255650341510773, 0.02412305772304535, -0.028969688341021538, -0.0040282392874360085, 0.06587923318147659, 0.025979725643992424, -0.06210743635892868, 0.052972473204135895, -0.03292682766914368, 0.07283904403448105, 0.056812211871147156, -0.03962269797921181, 0.006962474901229143, -0.015624088235199451, -0.04070338234305382, 0.005731482058763504, -0.07258385419845581, -0.044095806777477264, 0.008487879298627377, 0.017391139641404152, -0.0013304208405315876, 0.049242522567510605, -0.06424011290073395, -0.05782124400138855, -0.03315326198935509, 0.02834436297416687, 0.005938508082181215, 0.09223965555429459, 0.08430014550685883, -0.01645015925168991, -0.04746496304869652, -0.0026891070883721113, 0.01782113127410412, -0.07259070873260498, 0.0814707949757576, 0.12279291450977325, 0.10611389577388763, -0.02853141911327839, -0.007243210915476084, -0.0007636952796019614, 0.005737358704209328, -0.006648004520684481, -0.036242686212062836, 5.935014039294112e-34, 0.05054274573922157, 0.007245965767651796, 0.008201816119253635, 0.0012792927445843816, 0.028830718249082565, -0.036462053656578064, -0.05412144958972931, -0.0035006727557629347, -0.05771118029952049, -0.038739558309316635, 0.011285274289548397, -0.03858945891261101, -0.020859338343143463, 0.01696748659014702, 0.0211971253156662, 0.02451920695602894, 0.10117452591657639, -0.0022836392745375633, 0.020909583196043968, 0.02382984384894371, 0.01809779368340969, 0.002695721108466387, 0.03343960642814636, 0.0067119416780769825, 0.020569700747728348, 0.005901724100112915, 0.053716663271188736, -0.011353151872754097, -0.08818359673023224, -0.00014795921742916107, -0.012198514305055141, -0.045061662793159485, -0.004108206368982792, 0.004218033980578184, 0.07616075873374939, 0.01682833954691887, -0.10289796441793442, -0.00830752681940794, -0.10140512883663177, -0.006553928833454847, 0.0036385906860232353, 0.1208513081073761, -0.12073857337236404, 0.029928259551525116, 0.021048052236437798, -0.06487900763750076, -0.043337658047676086, 0.06660023331642151, 0.054067134857177734, -0.003629715647548437, -0.027802839875221252, 0.058819327503442764, 0.07458578795194626, -0.03245467320084572, 0.06120576709508896, 0.019037436693906784, 0.01565966196358204, -0.07782105356454849, 0.018200166523456573, 0.08250435441732407, 0.01104847714304924, -0.0053963130339980125, 0.009018327109515667, -0.017688589170575142, -0.04976906254887581, -0.0006406483007594943, -0.030334841459989548, 0.029992880299687386, 0.01975511945784092, -0.07906928658485413, -0.021045934408903122, 0.0811782106757164, -0.0033257538452744484, 0.13065125048160553, 0.03420909121632576, 0.01315887551754713, -0.059370674192905426, -0.09562477469444275, -0.030510980635881424, -0.01899873837828636, 0.09540124237537384, -0.028737537562847137, -0.05670658126473427, 0.011838614009320736, 0.008757608011364937, 0.012189313769340515, -0.009401396848261356, -0.014774193055927753, -0.03429582342505455, 0.09651823341846466, -0.012329242192208767, -0.08100780099630356, -0.05659087002277374, -0.0853729099035263, -0.11074807494878769, -6.0147327600890175e-33, 0.01967187598347664, -0.060989025980234146, -0.13496504724025726, -0.026403194293379784, -0.018085965886712074, -0.021106339991092682, -0.040892504155635834, 0.013101802207529545, -0.03454108163714409, 0.04115435853600502, -0.022425301373004913, -0.0066207521595060825, 0.027139289304614067, 0.02848360314965248, 0.04872043803334236, 0.0620490200817585, -0.03508484363555908, -0.036971189081668854, -0.05516471341252327, 0.0017166838515549898, 0.05476008355617523, 0.021588187664747238, 0.019833285361528397, 0.028959518298506737, -0.04926159605383873, -0.08546379208564758, -0.07034014165401459, 0.032350439578294754, 0.024475915357470512, -0.003083736402913928, -0.04692164063453674, 0.0017018193611875176, -0.05705618858337402, 0.04832346737384796, 0.049879178404808044, -0.023409120738506317, 0.054319385439157486, -0.02011916972696781, 0.009313665330410004, -0.09601686894893646, 0.10536634176969528, 0.01822023279964924, -0.018199803307652473, -0.01594720222055912, -0.07335919886827469, 0.01522434689104557, -0.0683288648724556, -0.04276406764984131, -0.009765887632966042, -0.003596839727833867, -0.014325461350381374, -0.06052675470709801, 0.0013100729556754231, 0.04516533389687538, -0.018441032618284225, -0.04934979975223541, 0.10113272070884705, -0.08032672852277756, -0.007196106947958469, 0.06447772681713104, -0.040551092475652695, -0.08081348240375519, 0.06524328887462616, -0.05582575127482414, -0.0382700078189373, -0.01869206689298153, 0.0035641288850456476, -0.096238873898983, 0.11741455644369125, -0.004129156935960054, 0.030537407845258713, 0.00354014802724123, 0.01656697876751423, 0.03322117403149605, -0.08929762989282608, 0.08279336988925934, 0.004959471523761749, -0.08112943917512894, 0.027512485161423683, 0.0632689893245697, -0.01966746710240841, 0.008805306628346443, 0.029375743120908737, 0.04046513885259628, 0.07579472661018372, 0.016728918999433517, 0.01487632654607296, 0.003827625885605812, -0.02126988396048546, -0.05862043425440788, 0.07554169744253159, -0.0024479760322719812, -0.03429900482296944, -0.0023527478333562613, -0.04151984676718712, -5.676269765331199e-8, 0.10053464770317078, -0.06844684481620789, -0.07314030826091766, 0.0303163081407547, -0.08795090019702911, -0.0696391761302948, 0.00008102866559056565, -0.06797806173563004, -0.0013025403022766113, -0.012149202637374401, 0.0723775178194046, 0.04243836551904678, 0.06786101311445236, -0.026790352538228035, -0.030927229672670364, -0.029223982244729996, -0.036257240921258926, 0.08337435126304626, 0.04042604938149452, -0.05028201639652252, 0.01240109745413065, -0.010743576101958752, -0.043883394449949265, 0.10355820506811142, 0.0657162293791771, 0.005131417419761419, 0.05326041951775551, 0.008672017604112625, 0.028508596122264862, -0.052929434925317764, 0.00311587518081069, -0.008436850272119045, 0.010760546661913395, 0.05481294170022011, -0.09881231188774109, -0.0025891480036079884, 0.04246640205383301, 0.09004196524620056, 0.010838060639798641, -0.009493071585893631, 0.0421561673283577, 0.04744650050997734, -0.03406771644949913, 0.006613611709326506, 0.1200488731265068, 0.053604282438755035, -0.06883446872234344, 0.026077741757035255, 0.003064893651753664, -0.03451937809586525, -0.05490555614233017, 0.06392081081867218, 0.04140711575746536, 0.1111210361123085, -0.026293747127056122, -0.014534041285514832, -0.05084341764450073, -0.03269176185131073, 0.042487308382987976, 0.013701452873647213, 0.032402463257312775, -0.0035311784595251083, 0.012230068445205688, -0.07334525138139725 ]
0.170457