{"id":16113001,"url":"https://github.com/guilospanck/node-js-streams","last_synced_at":"2026-06-20T04:31:23.150Z","repository":{"id":43216669,"uuid":"469089528","full_name":"Guilospanck/node-js-streams","owner":"Guilospanck","description":"Basic example using Node.js streams with TypeScript.","archived":false,"fork":false,"pushed_at":"2023-03-01T09:21:09.000Z","size":109,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-11T06:04:22.207Z","etag":null,"topics":["nodejs","nodejs-streams","streams","typescript"],"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/Guilospanck.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-12T13:24:34.000Z","updated_at":"2023-02-27T14:27:35.000Z","dependencies_parsed_at":"2024-10-31T23:24:26.866Z","dependency_job_id":"75d4611b-c3bc-4f8a-9d83-d60b88b87a33","html_url":"https://github.com/Guilospanck/node-js-streams","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Guilospanck/node-js-streams","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Guilospanck%2Fnode-js-streams","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Guilospanck%2Fnode-js-streams/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Guilospanck%2Fnode-js-streams/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Guilospanck%2Fnode-js-streams/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Guilospanck","download_url":"https://codeload.github.com/Guilospanck/node-js-streams/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Guilospanck%2Fnode-js-streams/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34557551,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["nodejs","nodejs-streams","streams","typescript"],"created_at":"2024-10-09T20:09:56.565Z","updated_at":"2026-06-20T04:31:23.133Z","avatar_url":"https://github.com/Guilospanck.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NodeJS Streams\n[![codecov](https://codecov.io/gh/Guilospanck/node-js-streams/branch/main/graph/badge.svg?token=ZBFI1KICHQ)](https://codecov.io/gh/Guilospanck/node-js-streams)\n\nBasic example using NodeJS Streams.\n\n## Installation\nGit clone this repository:\n```bash\ngit clone https://github.com/Guilospanck/node-js-streams.git\n```\n### \"Slow\" test\nChange directory into the repository:\n```bash\ncd node-js-streams/\n```\nThen run:\n```bash\nyarn\n```\nTo install dependencies and then run:\n```bash\nyarn start:dev\n```\n\n### Fast test\nBe sure to have [Docker] and [Docker Compose] installed.\n\nChange directory into the repository:\n```bash\ncd node-js-streams/\n```\nThen run:\n```bash\nsudo docker-compose -f docker-compose.yml up -d --build\n```\nIn order to view the logs once it's built, run:\n```bash\nsudo docker ps # get the id of the container\nsudo docker logs [id]\n```\n\n----\n\n## Streams\nBasically we have three main structures: `Readable`, `Transform` and `Writable`.\n\n### Readable\nThe Readable is the `source` of data. So, let's say we have a `client-server` architecture and we, the client, want to retrieve some information from the server.\n\nThe Readable will be kept in the server and it will read and send the stream of data.\n\n### Transform\nThe Transform is the `man in the middle`. It's responsible for making changes on the data. Everything you want to do with the stream of data, you can use the Transform to do that.\n\n### Writable\nThe Writable usually lies in the client and is responsive to finally do something with the data received.\n\n## Chunk and callbacks\n- `Chunk` is the data coming from the stream. It is a buffer and if you want to get the data, just parse it using `JSON.parse(chunk);` or use `toString();`.\n- `Callback` is used to inform the server (the readable stream) that the client received the data and it can send the other. If we don't pass it, it won't get the next data.\n\n-------- \n\n## TypeScript\nInstall TS dev dependencies:\n```bash\nyarn add -D typescript ts-node\n```\nThen generate a new `tsconfig.json` file:\n```bash\nnpx tsc --init\n```\nUse the `tsconfig.json` that exists in this repository for a more complete version.\n\nAlso, add a new file called `nodemon.json` in order to run Nodemon with TypeScript without getting an error.\n\n--------\n\n## Jest with TS\nInstall the Jest dev dependencies:\n```bash\nyarn add -D jest ts-jest @types/jest\n```\nThen generate a new `jest.config.js` (or `jest.config.cjs`) file:\n```bash\nnpx ts-jest config:init\n```\n\n[Docker]: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04\n[Docker Compose]: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguilospanck%2Fnode-js-streams","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguilospanck%2Fnode-js-streams","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguilospanck%2Fnode-js-streams/lists"}