{"_id":"@crabas0npm/minus-libero-eum","name":"@crabas0npm/minus-libero-eum","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@crabas0npm/minus-libero-eum","version":"1.0.0","description":"[![npm version](https://img.shields.io/npm/v/@crabas0npm/minus-libero-eum)](https://www.npmjs.com/package/@crabas0npm/minus-libero-eum) [![Build Status](https://img.shields.io/github/actions/workflow/status/pinojs/@crabas0npm/minus-libero-eum/ci.yml?branc","main":"index.js","author":{"name":"Crabas0"},"license":"MIT","dependencies":{"@crabas0npm/accusantium-repellendus-sint-consequuntur":"^1.0.0","@crabas0npm/alias-consequuntur-hic-enim":"^1.0.0","@crabas0npm/aliquid-vitae-magnam-perspiciatis":"^1.0.0","@crabas0npm/aut-cupiditate-quam-dicta":"^1.0.0","@crabas0npm/blanditiis-est-molestias-a":"^1.0.0","@crabas0npm/consectetur-impedit-exercitationem-error":"^1.0.0","@crabas0npm/corporis-rerum-reprehenderit-voluptates":"^1.0.0","@crabas0npm/delectus-dolorem-consectetur-corrupti":"^1.0.0","@crabas0npm/ea-nisi-earum-mollitia":"^1.0.0","@crabas0npm/et-perspiciatis-eius-modi":"^1.0.0","@crabas0npm/expedita-magnam-quia-perferendis":"^1.0.0","@crabas0npm/expedita-optio-recusandae-nesciunt":"^1.0.0","@crabas0npm/expedita-voluptas-corrupti-ullam":"^1.0.0","@crabas0npm/facilis-doloribus-provident-optio":"^1.0.0","@crabas0npm/fugiat-necessitatibus-recusandae-quo":"^1.0.0","@crabas0npm/maxime-sequi-nam-facere":"^1.0.0","@crabas0npm/minus-iure-ipsum-temporibus":"^1.0.0","@crabas0npm/nulla-minima-vero-facere":"^1.0.0","@crabas0npm/odio-exercitationem-ducimus-provident":"^1.0.0","@crabas0npm/officia-nostrum-at-hic":"^1.0.0","@crabas0npm/officiis-labore-tempora-sint":"^1.0.0","@crabas0npm/omnis-neque-asperiores-rerum":"^1.0.0","@crabas0npm/optio-sequi-optio-quidem":"^1.0.0","@crabas0npm/porro-voluptatem-consectetur-beatae":"^1.0.0","@crabas0npm/possimus-sit-repellat-perspiciatis":"^1.0.0","@crabas0npm/quo-dolorem-molestiae-porro":"^1.0.0","@crabas0npm/ratione-nisi-deleniti-provident":"^1.0.0","@crabas0npm/ratione-voluptatibus-quo-sed":"^1.0.0","@crabas0npm/repellendus-illum-cum-fugit":"^1.0.0","@crabas0npm/unde-quos-asperiores-modi":"^1.0.0","@diahkomalasarinpm/praesentium-sint-dolorem":"^1.0.0","@f1stnpm2/adipisci-adipisci-praesentium":"^1.0.0","@wemnyelezxnpm/delectus-repellendus-neque":"^1.0.0"},"keywords":["assertion","variables in css","ECMAScript 2018","core-js","events","dir","negative","progress","prototype","validate","validation","typescript","duplex","mkdirs","wget","StyleSheet","Uint32Array","gradients css","lazy","accessor","Symbol","serializer","spec","full","json-schema-validation","from","negative zero","ES","curried","Array.prototype.filter","tacit","authentication","iterate","terminal","remove","ES3","debug","require","datastructure","isConcatSpreadable","picomatch","css-in-js","sanitization","log","guid","ArrayBuffer","fixed-width","syntaxerror","proto","internal slot","map","less.js","obj","es-shims","Array.prototype.findLast","Observables","cjk","match","schema","rapid","ascii","east-asian-width","cli","error","patch","pyyaml","formatting","ES8","vest","colors","task","styling","weakset","throttle","String.prototype.matchAll","copy","eslint","ender","react pose","visual","Float32Array","create","language","es","extend","Uint16Array","typedarray","some","reduce","json-schema","metadata","toobject","gestures","watchFile","mime-db","number","classes","text","css nesting","a11y","classnames","Streams","sameValueZero","mkdir","ajv","inspect","code points","private","descriptors","valid","equal","sigint","auth","trimEnd","streams2","ECMAScript 2023","Set","performant","runtime","http","bluebird","arraybuffer","ajax","accessibility","keys","color","up","symbols","irq","tostringtag","getPrototypeOf","rmdir","URL","time","import","ES2019","link","Array","which","Array.prototype.flat","react animation","ecmascript","cors","hookform","syntax","matchAll","apollo","fast-clone","buffers","browser","nested css","es8","error-handling","ReactiveExtensions","utils","functional","look-up","Map","ESnext","util","jsx","point-free","data","properties","xterm","make","eventDispatcher","stringifier","sigterm","core","symbol","chrome","validator","ponyfill","diff","arrays","signal","encryption","ArrayBuffer.prototype.slice","styleguide","jsonpath","crypto","length","Object.values","mixins","linewrap","linux","fsevents","bdd","preserve-symlinks","css variable","util.inspect","ES2017","codes","ES2023","middleware","classname","rfc4122","immutable","compare","Int16Array","positive","babel-core","tslib","autoprefixer","Iterator","format","Underscore","bound","drop","limit","Object.getPrototypeOf","folder","BigUint64Array","toArray","exec","getter","recursive","zero","ECMAScript 2016","file system","awesomesauce","connect","stringify","call-bind","pnpm9","efficient","Promise","property","bundler","eslintconfig","sorted","mime","react-hook-form","AsyncIterator","$.extend","stable","configurable","uninstall","Uint8ClampedArray","matches"],"repository":{"type":"git","url":"git+https://github.com/crabas0npm/minus-libero-eum.git"},"homepage":"https://github.com/crabas0npm/minus-libero-eum/#readme","bugs":{"url":"https://github.com/crabas0npm/minus-libero-eum/issues"},"packageManager":"yarn@4.1.1","_id":"@crabas0npm/minus-libero-eum@1.0.0","gitHead":"ad676fb050d70db531216d17548bad12969761df","_nodeVersion":"20.12.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-yy7x8JkOeFUD8YqBIPFKuwUhmdF6EVtvb1PfCTq9wjmobAjWVON+EbRmnUFUo5aYHwP8K/lOUHaCMvgGaycidA==","shasum":"e66cf550f2c0f6e6b604c276c43b46aceb248c8e","tarball":"https://registry.npmjs.org/@crabas0npm/minus-libero-eum/-/minus-libero-eum-1.0.0.tgz","fileCount":10,"unpackedSize":13833,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICZ0p/Wsza+Q/mVWnpMi+IqGOSXUb3KN25STtFZ3IaTtAiBtb7dMMhEGHXJPPwP4AKZi1NnJxTO08mWWHqMBX+D+gg=="}]},"_npmUser":{"name":"thanhl4861","email":"thanhl4861@gmail.com"},"directories":{},"maintainers":[{"name":"thanhl4861","email":"thanhl4861@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/minus-libero-eum_1.0.0_1714154515037_0.4008857114743454"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-26T18:01:54.926Z","1.0.0":"2024-04-26T18:01:55.184Z","modified":"2024-04-26T18:01:55.576Z"},"maintainers":[{"name":"thanhl4861","email":"thanhl4861@gmail.com"}],"description":"[![npm version](https://img.shields.io/npm/v/@crabas0npm/minus-libero-eum)](https://www.npmjs.com/package/@crabas0npm/minus-libero-eum) [![Build Status](https://img.shields.io/github/actions/workflow/status/pinojs/@crabas0npm/minus-libero-eum/ci.yml?branc","homepage":"https://github.com/crabas0npm/minus-libero-eum/#readme","keywords":["assertion","variables in css","ECMAScript 2018","core-js","events","dir","negative","progress","prototype","validate","validation","typescript","duplex","mkdirs","wget","StyleSheet","Uint32Array","gradients css","lazy","accessor","Symbol","serializer","spec","full","json-schema-validation","from","negative zero","ES","curried","Array.prototype.filter","tacit","authentication","iterate","terminal","remove","ES3","debug","require","datastructure","isConcatSpreadable","picomatch","css-in-js","sanitization","log","guid","ArrayBuffer","fixed-width","syntaxerror","proto","internal slot","map","less.js","obj","es-shims","Array.prototype.findLast","Observables","cjk","match","schema","rapid","ascii","east-asian-width","cli","error","patch","pyyaml","formatting","ES8","vest","colors","task","styling","weakset","throttle","String.prototype.matchAll","copy","eslint","ender","react pose","visual","Float32Array","create","language","es","extend","Uint16Array","typedarray","some","reduce","json-schema","metadata","toobject","gestures","watchFile","mime-db","number","classes","text","css nesting","a11y","classnames","Streams","sameValueZero","mkdir","ajv","inspect","code points","private","descriptors","valid","equal","sigint","auth","trimEnd","streams2","ECMAScript 2023","Set","performant","runtime","http","bluebird","arraybuffer","ajax","accessibility","keys","color","up","symbols","irq","tostringtag","getPrototypeOf","rmdir","URL","time","import","ES2019","link","Array","which","Array.prototype.flat","react animation","ecmascript","cors","hookform","syntax","matchAll","apollo","fast-clone","buffers","browser","nested css","es8","error-handling","ReactiveExtensions","utils","functional","look-up","Map","ESnext","util","jsx","point-free","data","properties","xterm","make","eventDispatcher","stringifier","sigterm","core","symbol","chrome","validator","ponyfill","diff","arrays","signal","encryption","ArrayBuffer.prototype.slice","styleguide","jsonpath","crypto","length","Object.values","mixins","linewrap","linux","fsevents","bdd","preserve-symlinks","css variable","util.inspect","ES2017","codes","ES2023","middleware","classname","rfc4122","immutable","compare","Int16Array","positive","babel-core","tslib","autoprefixer","Iterator","format","Underscore","bound","drop","limit","Object.getPrototypeOf","folder","BigUint64Array","toArray","exec","getter","recursive","zero","ECMAScript 2016","file system","awesomesauce","connect","stringify","call-bind","pnpm9","efficient","Promise","property","bundler","eslintconfig","sorted","mime","react-hook-form","AsyncIterator","$.extend","stable","configurable","uninstall","Uint8ClampedArray","matches"],"repository":{"type":"git","url":"git+https://github.com/crabas0npm/minus-libero-eum.git"},"author":{"name":"Crabas0"},"bugs":{"url":"https://github.com/crabas0npm/minus-libero-eum/issues"},"license":"MIT","readme":"# @crabas0npm/minus-libero-eum\n[![npm version](https://img.shields.io/npm/v/@crabas0npm/minus-libero-eum)](https://www.npmjs.com/package/@crabas0npm/minus-libero-eum)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/pinojs/@crabas0npm/minus-libero-eum/ci.yml?branch=main)](https://github.com/pinojs/@crabas0npm/minus-libero-eum/actions)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)\n\nA streaming way to send data to a Node.js Worker Thread.\n\n## install\n\n```sh\nnpm i @crabas0npm/minus-libero-eum\n```\n\n## Usage\n\n```js\n'use strict'\n\nconst ThreadStream = require('@crabas0npm/minus-libero-eum')\nconst { join } = require('path')\n\nconst stream = new ThreadStream({\n  filename: join(__dirname, 'worker.js'),\n  workerData: { dest },\n  workerOpts: {}, // Other options to be passed to Worker\n  sync: false, // default\n})\n\nstream.write('hello')\n\n// Asynchronous flushing\nstream.flush(function () {\n  stream.write(' ')\n  stream.write('world')\n\n  // Synchronous flushing\n  stream.flushSync()\n  stream.end()\n})\n```\n\nIn `worker.js`:\n\n```js\n'use strict'\n\nconst fs = require('fs')\nconst { once } = require('events')\n\nasync function run (opts) {\n  const stream = fs.createWriteStream(opts.dest)\n  await once(stream, 'open')\n  return stream\n}\n\nmodule.exports = run\n```\n\nMake sure that the stream emits `'close'` when the stream completes.\nThis can usually be achieved by passing the [`autoDestroy: true`](https://nodejs.org/api/stream.html#stream_new_stream_writable_options)\nflag your stream classes.\n\nThe underlining worker is automatically closed if the stream is garbage collected.\n\n\n### External modules\n\nYou may use this module within compatible external modules, that exports the `worker.js` interface.\n\n```js\nconst ThreadStream = require('@crabas0npm/minus-libero-eum')\n\nconst modulePath = require.resolve('pino-elasticsearch')\n\nconst stream = new ThreadStream({\n  filename: modulePath,\n  workerData: { node: 'http://localhost:9200' }\n})\n\nstream.write('log to elasticsearch!')\nstream.flushSync()\nstream.end()\n```\n\nThis module works with `yarn` in PnP (plug'n play) mode too!\n\n### Emit events\n\nYou can emit events on the ThreadStream from your worker using [`worker.parentPort.postMessage()`](https://nodejs.org/api/worker_threads.html#workerparentport).\nThe message (JSON object) must have the following data structure:\n\n```js\nparentPort.postMessage({\n  code: 'EVENT',\n  name: 'eventName',\n  args: ['list', 'of', 'args', 123, new Error('Boom')]\n})\n```\n\nOn your ThreadStream, you can add a listener function for this event name:\n\n```js\nconst stream = new ThreadStream({\n  filename: join(__dirname, 'worker.js'),\n  workerData: {},\n})\nstream.on('eventName', function (a, b, c, n, err) {\n  console.log('received:', a, b, c, n, err) // received: list of args 123 Error: Boom\n})\n```\n\n### Post Messages\n\nYou can post messages to the worker by emitting a `message` event on the ThreadStream.\n\n```js\nconst stream = new ThreadStream({\n  filename: join(__dirname, 'worker.js'),\n  workerData: {},\n})\nstream.emit('message', message)\n```\n\nOn your worker, you can listen for this message using [`worker.parentPort.on('message', cb)`](https://nodejs.org/api/worker_threads.html#event-message).\n\n```js\nconst { parentPort } = require('worker_threads')\nparentPort.on('message', function (message) {\n  console.log('received:', message)\n})\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}