Skip to content

FrancescoSaverioZuppichini/http-streaming-fastapi-js-playground

Repository files navigation

HTTP Streaming with FastAPI and JS

Installation

pip install -r requirements.txt

Run the server

uvicorn api:app 

There are two endpoints,

  • /file -> send a file
  • /stream -> creates server sent events

Then, run the client (install node)

node main.ts

Have a look inside, there are two functions fetch_stream and fetch_file_stream the first one consumes the server sent event and the second the file - both are HTTP streaming requests resulting in a ReadableStream class

About

http-streaming-playground

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published