{"id":28036537,"url":"https://github.com/dam4rus/nu_plugin_nuts","last_synced_at":"2025-05-11T13:01:57.677Z","repository":{"id":284328231,"uuid":"954023311","full_name":"dam4rus/nu_plugin_nuts","owner":"dam4rus","description":"Nushell plugin for Nats","archived":false,"fork":false,"pushed_at":"2025-05-05T06:51:14.000Z","size":53,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-05T07:38:42.185Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dam4rus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-24T12:56:03.000Z","updated_at":"2025-05-05T06:44:36.000Z","dependencies_parsed_at":"2025-05-05T07:30:33.291Z","dependency_job_id":null,"html_url":"https://github.com/dam4rus/nu_plugin_nuts","commit_stats":null,"previous_names":["dam4rus/nu_plugin_nuts"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dam4rus%2Fnu_plugin_nuts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dam4rus%2Fnu_plugin_nuts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dam4rus%2Fnu_plugin_nuts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dam4rus%2Fnu_plugin_nuts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dam4rus","download_url":"https://codeload.github.com/dam4rus/nu_plugin_nuts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253568691,"owners_count":21928909,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-11T13:00:48.218Z","updated_at":"2025-05-11T13:01:57.440Z","avatar_url":"https://github.com/dam4rus.png","language":"Rust","readme":"# nu_plugin_nuts\nNushell plugin for communicating with a Nats server\n\n## Why\nNats already has a CLI tool and this plugin is not intended to replace it.\nHowever, the official CLI tool's performance is not great when working with bulk data to a point that I would say\nit's basically unusable. Publishing 1000 message of random bytes results in the following:\n\n```bash\ntimeit { generate {|data| {out: $data, next: (random chars --length 8) } } (random chars --length 8) | take 1_000 | each { nats pub mysubject $in e\u003e /dev/null } }\n1min 1sec 656ms 305µs 542ns \n```\n\nEven with `par-each`, while better, the situation is not that great:\n\n```bash\ntimeit { generate {|data| {out: $data, next: (random chars --length 8) } } (random chars --length 8) | take 1_000 | par-each { nats pub mysubject $in e\u003e /dev/null } }\n36sec 502ms 574µs 792ns\n```\n\nWith this plugin the performance of bulk operations are much better even on a cold start:\n\n```bash\ntimeit { generate {|data| {out: $data, next: (random chars --length 8) } } (random chars --length 8) | take 1_000 | nuts connect | nuts pub mysubject }\n61ms 217µs 833ns\n```\n\nWhile the Nats CLI has a bulk publish operation it relies on Go templating which is not always preferable.\nIt also performs worse than this plugin:\n\n```bash\ntimeit { ^nats pub --count=1000 mysubject \"{{ Random 8 8 }}\" }\n703ms 391µs 125ns\n```\n\n## Installing\nSince Nushell is still in pre-production stage the recommended way of installing is to clone the repository,\nchange the nu protocol version to your Nushell version and build it yourself.\n\n```bash\ngit clone https://github.com/dam4rus/nu_plugin_nuts.git\ncd nu_plugin_nuts\ncargo install --path .\nplugin add ~/.cargo/bin/nu_plugin_nuts\nplugin use nuts\n```\n\n## Usage\nThe plugin currently stores a single connection to a Nats server.\nThis connection can be opened with the `nuts connect` command. This connection is open for the lifetime of the plugin.\n\nOne way to use this plugin is to call `nuts connect` then call other operations while the plugin is alive.\n\n```bash\nnuts connect\n'message' | nuts pub mysubject\n```\n\nMake sure to set the gc for the plugin to a duration you are comfortable with.\n\n`nuts connect` also pipes it's input to it's output, so it can be used in a pipe operation as well:\n\n```bash\n'message' | nuts connect | nuts pub mysubject\n```\n\nRefer to each commands documentation to see it's usage\n","funding_links":[],"categories":["Plugins"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdam4rus%2Fnu_plugin_nuts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdam4rus%2Fnu_plugin_nuts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdam4rus%2Fnu_plugin_nuts/lists"}