{"id":21153766,"url":"https://github.com/idris-maps/deno-ndjson","last_synced_at":"2026-04-28T15:42:45.787Z","repository":{"id":62421609,"uuid":"290872996","full_name":"idris-maps/deno-ndjson","owner":"idris-maps","description":"CLI tools for dealing with ndjson in Deno","archived":false,"fork":false,"pushed_at":"2020-08-27T21:03:49.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-19T15:59:34.052Z","etag":null,"topics":["deno","ndjson"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idris-maps.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-27T20:18:02.000Z","updated_at":"2020-08-27T20:55:52.000Z","dependencies_parsed_at":"2022-11-01T17:32:22.874Z","dependency_job_id":null,"html_url":"https://github.com/idris-maps/deno-ndjson","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/idris-maps/deno-ndjson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idris-maps%2Fdeno-ndjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idris-maps%2Fdeno-ndjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idris-maps%2Fdeno-ndjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idris-maps%2Fdeno-ndjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idris-maps","download_url":"https://codeload.github.com/idris-maps/deno-ndjson/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idris-maps%2Fdeno-ndjson/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260831428,"owners_count":23069466,"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":["deno","ndjson"],"created_at":"2024-11-20T10:59:20.394Z","updated_at":"2026-04-28T15:42:35.776Z","avatar_url":"https://github.com/idris-maps.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# deno-ndjson\n\nCLI tools for dealing with [ndjson](http://ndjson.org/) in [Deno](https://deno.land/). Heavily inspired by [ndjson-cli](https://github.com/mbostock/ndjson-cli) for [node](https://nodejs.org).\n\n## `ndj-cat`\n\nreads a `ndjson` file into the console line by line\n\n### install\n\n```bash\ndeno install --allow-read https://raw.githubusercontent.com/idris-maps/deno-ndjson/master/ndj-cat.ts\n```\n\n### usage\n\n```bash\nndj-cat \u003cPATH_TO_NDJSON_FILE\u003e\n```\n\n#### example\n\n```bash\nndj-cat some_folder/file.ndjson\n```\n\n## `ndj-map`\n\nmaps every line of an `ndjson`.\n\nTakes one argument, the expression to map.\n\nThe expression assumes there are two arguments:\n\n* `d`, the `json` line\n* `i`, the index of the line\n\n### install\n\n```bash\ndeno install https://raw.githubusercontent.com/idris-maps/deno-ndjson/master/ndj-map.ts\n```\n\n### usage\n\n```bash\nndj-map \u003cEXPRESSION\u003e\n```\n\n#### example\n\nSuppose you have a `file.ndjson` such as:\n\n```\n{\"nom\":\"Lausanne\",\"population\":138905}\n{\"nom\":\"Yverdon-les-Bains\",\"population\":30143}\n{\"nom\":\"Montreux\",\"population\":26574}\n{\"nom\":\"Renens\",\"population\":21036}\n{\"nom\":\"Nyon\",\"population\":20533}\n{\"nom\":\"Vevey\",\"population\":19827}\n```\n\n```bash\nndj-cat file.ndjson \\\n| ndj-map '({ index: i, town: d.nom })'\n```\n\nwill return\n\n```\n{\"index\":0,\"town\":\"Lausanne\"}\n{\"index\":1,\"town\":\"Yverdon-les-Bains\"}\n{\"index\":2,\"town\":\"Montreux\"}\n{\"index\":3,\"town\":\"Renens\"}\n{\"index\":4,\"town\":\"Nyon\"}\n{\"index\":5,\"town\":\"Vevey\"}\n```\n\n## `ndj-filter`\n\nfilters lines of an `ndjson`.\n\nTakes one argument, an expression that assumes two arguments:\n\n* `d`, the `json` line\n* `i`, the index of the line\n\n### install\n\n```bash\ndeno install https://raw.githubusercontent.com/idris-maps/deno-ndjson/master/ndj-filter.ts\n```\n\n### usage\n\n```bash\nndj-filter \u003cEXPRESSION\u003e\n```\n\n#### example\n\nSuppose you have a `file.ndjson` such as:\n\n```\n{\"nom\":\"Lausanne\",\"population\":138905}\n{\"nom\":\"Yverdon-les-Bains\",\"population\":30143}\n{\"nom\":\"Montreux\",\"population\":26574}\n{\"nom\":\"Renens\",\"population\":21036}\n{\"nom\":\"Nyon\",\"population\":20533}\n{\"nom\":\"Vevey\",\"population\":19827}\n```\n\n```bash\nndj-cat file.ndjson \\\n| ndj-filter 'd.population \u003e 30000'\n```\n\nwill return\n\n```\n{\"nom\":\"Lausanne\",\"population\":138905}\n{\"nom\":\"Yverdon-les-Bains\",\"population\":30143}\n```\n\n## `ndj-reduce`\n\nreduces an `ndjson`.\n\nTakes either no arguments or two arguments.\n\nIf there are no arguments, it will return a `json` array.\n\nIf there are arguments, there must be two: the expression and the initial value. The expression assumes three arguments:\n\n* `a`, the accumulator\n* `d`, the `json` line\n* `i`, the index\n\n### install\n\n```bash\ndeno install https://raw.githubusercontent.com/idris-maps/deno-ndjson/master/ndj-reduce.ts\n```\n\n### usage\n\n```bash\nndj-reduce\n\n## or\n\nndj-reduce \u003cEXPRESSION\u003e \u003cINITIAL_VALUE\u003e\n```\n\n#### examples\n\nSuppose you have a `file.ndjson` such as:\n\n```\n{\"nom\":\"Lausanne\",\"population\":138905}\n{\"nom\":\"Yverdon-les-Bains\",\"population\":30143}\n{\"nom\":\"Montreux\",\"population\":26574}\n{\"nom\":\"Renens\",\"population\":21036}\n{\"nom\":\"Nyon\",\"population\":20533}\n{\"nom\":\"Vevey\",\"population\":19827}\n```\n\n```bash\nndj-cat file.ndjson \\\n| ndj-reduce\n```\n\nwithout arguments, it will return\n\n```json\n[{\"nom\":\"Lausanne\",\"population\":138905},{\"nom\":\"Yverdon-les-Bains\",\"population\":30143},{\"nom\":\"Montreux\",\"population\":26574},{\"nom\":\"Renens\",\"population\":21036},{\"nom\":\"Nyon\",\"population\":20533}]\n```\n\n```bash\nndj-cat file.ndjson \\\n| ndj-reduce 'a + d.population' 0\n```\n\nwith arguments, it will return\n\n```\n237191\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidris-maps%2Fdeno-ndjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidris-maps%2Fdeno-ndjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidris-maps%2Fdeno-ndjson/lists"}