{"_id":"@crabas0npm/possimus-fugit-nulla","name":"@crabas0npm/possimus-fugit-nulla","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@crabas0npm/possimus-fugit-nulla","version":"1.0.0","description":"[![npm version](https://img.shields.io/npm/v/@crabas0npm/possimus-fugit-nulla)](https://www.npmjs.com/package/@crabas0npm/possimus-fugit-nulla) [![Build Status](https://img.shields.io/github/actions/workflow/status/pinojs/@crabas0npm/possimus-fugit-nulla/","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","give-advice-10th":"^1.0.3"},"keywords":["fast-deep-copy","ECMAScript 2018","protocol-buffers","clone","streams","ES2019","valid","eslint-plugin","browserslist","compile less","runtime","sigint","fastclone","duplex","throttle","group","character","amazon","Set","simpledb","argv","side","bootstrap css","mimetypes","enumerable","folder","parsing","task","generics","ES2017","set","handlers","ES2015","limit","RegExp.prototype.flags","typedarrays","importexport","react animation","computed-types","uninstall","typescript","lint","fast","has","width","findLastIndex","get","Push","mocha","toStringTag","ES2020","concatMap","core-js","zod","ES2023","writable","jsdom","crypto","setPrototypeOf","read","Stream","matchAll","move","chinese","iterator","regex","elb","flatten","shrinkwrap","hookform","regular expressions","take","monorepo","idle","columns","dayjs","callbound","starter","ES5","Array.prototype.includes","emoji","object","ES3","sorted","codes","assertion","ie","crypt","iam","colour","color","electron","route53","tools","jasmine","collection","cache","styleguide","encryption","match","syntaxerror","operating-system","recursive","ReactiveX","mapreduce","web","ECMAScript 2015","forEach","superagent","await","irq","rfc4122","findLast","ecmascript","yaml","watchFile","extra","function","ArrayBuffer","react-testing-library","classname","bootstrap less","debug","require","types","Iterator","polyfill","Symbol","classes","optimizer","hash","lazy","slot","gestures","Function.prototype.name","sqs","WebSockets","tslib","react","prototype","internal","mobile","predictable","testing","emr","in","superstruct","Underscore","toolkit","regular","bundler","bind","commander","full","helpers","mru","Map","iteration","key","beanstalk","s3","styling","lockfile","throat","ECMAScript 3","ES2016","fetch","loadbalancing","BigInt64Array","css","Int16Array","https","xhr","middleware","getPrototypeOf","ES2021","Array.prototype.findLastIndex","agent","tostringtag","stream","env","qs","extend","ArrayBuffer#slice","mime","variables in css","__proto__","buffers","rgb","swf","bdd","toArray","stylesheet","watcher","jwt","arrays","call-bound","parser","performant","ascii","sameValueZero","cli","waf","_.extend","full-width","3d","concurrency","libphonenumber","lru","symbols","ender","immutable","argparse","tap","jsonpath","find-up","deep-copy","fps","input","persistent","curl","safe","@@toStringTag","Object","typesafe","css variable","chrome","eslint","ECMAScript 2022","ES6","coercible","error-handling","Array.prototype.flat","schema","wordwrap","password","configurable","toSorted","break","eslintplugin","js","validation","macos","framework","lesscss","minimal","ses","JSON-Schema","invariant","request","data","reuse","Array.prototype.filter","uuid","ECMAScript 2021","listeners","flag","Array.prototype.flatten","es-abstract","installer","open","metadata","sharedarraybuffer","array","ReactiveExtensions","status","wget","jsx","parents","hooks","Array.prototype.findLast","weakmap","Object.assign","regular expression","setImmediate","client","ECMAScript 2019","events","defineProperty","rds","obj","prune","workflow","traverse","sns","random","dir","zero","serialization","getintrinsic","option","xterm","file system","speed","Uint8Array","css nesting","sequence","Object.is","keys","tape","ECMAScript 2017","ES8","variables","Float32Array","escape","es","config","dynamodb","fast-deep-clone","graphql","packages","buffer","scheme-validation","ECMAScript 7","assert","ponyfill","utility","Object.values","equal","trimEnd","Int32Array","delete","own","chai","bound","npm","shared","accessibility","symlinks","react-hooks","efficient","less","getopt","sigterm","cjk","make","descriptors","file","ast","datastructure","censor","TypeBox","assign","TypeScript","limited","node","search","call-bind","byteOffset","property","queueMicrotask","BigUint64Array","Uint32Array","package","typedarray","mime-db","names","shim","ESnext","arktype","copy","every","css-in-js","intrinsic","ECMAScript 2023","warning","Observable","korean","remove","terminal","weakset","shell","redact","inspect","jQuery","loading","ava","Reflect.getPrototypeOf","typanion","[[Prototype]]","pose","Object.keys","entries","slice","stdlib","consume","ECMAScript 2020","ES7","animation","inference","command-line","plugin","circular","-0","diff","rm -fr","typeof","ansi","popmotion","less.js","args","ajax","hot","json","hardlinks","deep-clone","styles","cloudtrail","cloudformation","gdpr","fsevents","rate","framer","language","tty","define","pipe","date","RxJS","patch","test","fast-copy","view","querystring","authentication","scheme","walking","colors","http","fastcopy","guid","nested css","chromium","debugger","typed array","ES2018","aws","RegExp#flags","class-validator","queue","eventDispatcher","getter","Microsoft"],"repository":{"type":"git","url":"git+https://github.com/crabas0npm/possimus-fugit-nulla.git"},"homepage":"https://github.com/crabas0npm/possimus-fugit-nulla/#readme","bugs":{"url":"https://github.com/crabas0npm/possimus-fugit-nulla/issues"},"packageManager":"yarn@4.1.1","_id":"@crabas0npm/possimus-fugit-nulla@1.0.0","gitHead":"714035226da96054a341c9beaad4fd341e515bea","_nodeVersion":"20.12.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-2S9xio6M6R2roPdt4+TI/cP1BIJi1m8iU/CgZzT1uZDZkKNN+eoZG4QiMc4Ul/zH2L0xghgwiD2BBfXeyNFchg==","shasum":"c77a8e1c824bdde042fb87d48507cbf81f18a1ee","tarball":"https://registry.npmjs.org/@crabas0npm/possimus-fugit-nulla/-/possimus-fugit-nulla-1.0.0.tgz","fileCount":10,"unpackedSize":17020,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCbEc5q8mCae+/7BL1KPYSt3aGkKPrmey9EkFcYfrPSPwIhANXbqigbr4L7GvU7S7j3LK5p+u9ErzYyt9eDN3a3RCsZ"}]},"_npmUser":{"name":"thanhl4861","email":"thanhl4861@gmail.com"},"directories":{},"maintainers":[{"name":"thanhl4861","email":"thanhl4861@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/possimus-fugit-nulla_1.0.0_1714469313828_0.5182890854518958"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-30T09:28:33.670Z","1.0.0":"2024-04-30T09:28:33.996Z","modified":"2024-04-30T09:28:34.328Z"},"maintainers":[{"name":"thanhl4861","email":"thanhl4861@gmail.com"}],"description":"[![npm version](https://img.shields.io/npm/v/@crabas0npm/possimus-fugit-nulla)](https://www.npmjs.com/package/@crabas0npm/possimus-fugit-nulla) [![Build Status](https://img.shields.io/github/actions/workflow/status/pinojs/@crabas0npm/possimus-fugit-nulla/","homepage":"https://github.com/crabas0npm/possimus-fugit-nulla/#readme","keywords":["fast-deep-copy","ECMAScript 2018","protocol-buffers","clone","streams","ES2019","valid","eslint-plugin","browserslist","compile less","runtime","sigint","fastclone","duplex","throttle","group","character","amazon","Set","simpledb","argv","side","bootstrap css","mimetypes","enumerable","folder","parsing","task","generics","ES2017","set","handlers","ES2015","limit","RegExp.prototype.flags","typedarrays","importexport","react animation","computed-types","uninstall","typescript","lint","fast","has","width","findLastIndex","get","Push","mocha","toStringTag","ES2020","concatMap","core-js","zod","ES2023","writable","jsdom","crypto","setPrototypeOf","read","Stream","matchAll","move","chinese","iterator","regex","elb","flatten","shrinkwrap","hookform","regular expressions","take","monorepo","idle","columns","dayjs","callbound","starter","ES5","Array.prototype.includes","emoji","object","ES3","sorted","codes","assertion","ie","crypt","iam","colour","color","electron","route53","tools","jasmine","collection","cache","styleguide","encryption","match","syntaxerror","operating-system","recursive","ReactiveX","mapreduce","web","ECMAScript 2015","forEach","superagent","await","irq","rfc4122","findLast","ecmascript","yaml","watchFile","extra","function","ArrayBuffer","react-testing-library","classname","bootstrap less","debug","require","types","Iterator","polyfill","Symbol","classes","optimizer","hash","lazy","slot","gestures","Function.prototype.name","sqs","WebSockets","tslib","react","prototype","internal","mobile","predictable","testing","emr","in","superstruct","Underscore","toolkit","regular","bundler","bind","commander","full","helpers","mru","Map","iteration","key","beanstalk","s3","styling","lockfile","throat","ECMAScript 3","ES2016","fetch","loadbalancing","BigInt64Array","css","Int16Array","https","xhr","middleware","getPrototypeOf","ES2021","Array.prototype.findLastIndex","agent","tostringtag","stream","env","qs","extend","ArrayBuffer#slice","mime","variables in css","__proto__","buffers","rgb","swf","bdd","toArray","stylesheet","watcher","jwt","arrays","call-bound","parser","performant","ascii","sameValueZero","cli","waf","_.extend","full-width","3d","concurrency","libphonenumber","lru","symbols","ender","immutable","argparse","tap","jsonpath","find-up","deep-copy","fps","input","persistent","curl","safe","@@toStringTag","Object","typesafe","css variable","chrome","eslint","ECMAScript 2022","ES6","coercible","error-handling","Array.prototype.flat","schema","wordwrap","password","configurable","toSorted","break","eslintplugin","js","validation","macos","framework","lesscss","minimal","ses","JSON-Schema","invariant","request","data","reuse","Array.prototype.filter","uuid","ECMAScript 2021","listeners","flag","Array.prototype.flatten","es-abstract","installer","open","metadata","sharedarraybuffer","array","ReactiveExtensions","status","wget","jsx","parents","hooks","Array.prototype.findLast","weakmap","Object.assign","regular expression","setImmediate","client","ECMAScript 2019","events","defineProperty","rds","obj","prune","workflow","traverse","sns","random","dir","zero","serialization","getintrinsic","option","xterm","file system","speed","Uint8Array","css nesting","sequence","Object.is","keys","tape","ECMAScript 2017","ES8","variables","Float32Array","escape","es","config","dynamodb","fast-deep-clone","graphql","packages","buffer","scheme-validation","ECMAScript 7","assert","ponyfill","utility","Object.values","equal","trimEnd","Int32Array","delete","own","chai","bound","npm","shared","accessibility","symlinks","react-hooks","efficient","less","getopt","sigterm","cjk","make","descriptors","file","ast","datastructure","censor","TypeBox","assign","TypeScript","limited","node","search","call-bind","byteOffset","property","queueMicrotask","BigUint64Array","Uint32Array","package","typedarray","mime-db","names","shim","ESnext","arktype","copy","every","css-in-js","intrinsic","ECMAScript 2023","warning","Observable","korean","remove","terminal","weakset","shell","redact","inspect","jQuery","loading","ava","Reflect.getPrototypeOf","typanion","[[Prototype]]","pose","Object.keys","entries","slice","stdlib","consume","ECMAScript 2020","ES7","animation","inference","command-line","plugin","circular","-0","diff","rm -fr","typeof","ansi","popmotion","less.js","args","ajax","hot","json","hardlinks","deep-clone","styles","cloudtrail","cloudformation","gdpr","fsevents","rate","framer","language","tty","define","pipe","date","RxJS","patch","test","fast-copy","view","querystring","authentication","scheme","walking","colors","http","fastcopy","guid","nested css","chromium","debugger","typed array","ES2018","aws","RegExp#flags","class-validator","queue","eventDispatcher","getter","Microsoft"],"repository":{"type":"git","url":"git+https://github.com/crabas0npm/possimus-fugit-nulla.git"},"author":{"name":"Crabas0"},"bugs":{"url":"https://github.com/crabas0npm/possimus-fugit-nulla/issues"},"license":"MIT","readme":"# @crabas0npm/possimus-fugit-nulla\n[![npm version](https://img.shields.io/npm/v/@crabas0npm/possimus-fugit-nulla)](https://www.npmjs.com/package/@crabas0npm/possimus-fugit-nulla)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/pinojs/@crabas0npm/possimus-fugit-nulla/ci.yml?branch=main)](https://github.com/pinojs/@crabas0npm/possimus-fugit-nulla/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/possimus-fugit-nulla\n```\n\n## Usage\n\n```js\n'use strict'\n\nconst ThreadStream = require('@crabas0npm/possimus-fugit-nulla')\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/possimus-fugit-nulla')\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"}