https://github.com/petermikitsh/http-stream-examples
Examples demonstrating the use of NodeJS streams with HTTP
https://github.com/petermikitsh/http-stream-examples
http nodejs stream
Last synced: 8 months ago
JSON representation
Examples demonstrating the use of NodeJS streams with HTTP
- Host: GitHub
- URL: https://github.com/petermikitsh/http-stream-examples
- Owner: petermikitsh
- Created: 2019-02-25T04:32:03.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-25T08:27:15.000Z (about 7 years ago)
- Last Synced: 2025-02-02T01:23:55.258Z (about 1 year ago)
- Topics: http, nodejs, stream
- Language: JavaScript
- Size: 373 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# http-stream
Examples demonstrating the use of NodeJS streams with HTTP.
## Why streams?
Streams are useful when dealing with large quantities of data and properly managing an application's memory footprint.
## Examples
`GET /ttfb`
This shows how streams and TTFB (time to first byte) / TTLB (time to last byte) are related.
After ~1000ms, the first byte is sent. And at ~5000ms, the last byte is sent.


`GET /html`
This shows how browsers handles a streaming DOM. Notice how the `title`, `body` and end of the document are progressively displayed. (Note: this browser behavior varies).

`GET /users`
This endpoint demonstrates how to consume a paginated JSON api and convert it to CSV using streams and piping.
View the comments in the code for more details on how it works.

## Developing
```
npm install
npm start
```