A simple data streaming mock server built with Bun + TypeScript.
- Bun installed on your machine
You can install Streamock globally using npm:
npm install -g streamock
Or using bun:
bun install -g streamock
Start the server:
streamock start
This will start a server at http://localhost:3001
- Clone the repository:
git clone https://github.com/Wangggym/streamock.git
cd streamock
- Install dependencies:
bun install
- Start in development mode:
bun run dev
- Build the project:
bun run build
streamock/
├── src/
│ ├── server.ts # Main server implementation
│ ├── cli.ts # CLI implementation
│ └── devServer.ts # Server runner
├── dist/ # Compiled JavaScript files
├── index.html # Web interface
└── package.json # Project configuration
- The server serves a single HTML page with a form and a results area
- When the user submits data:
- The form submission is handled via a POST request to
/submit
- A Server-Sent Events connection is established via
/stream
- The form submission is handled via a POST request to
- The server streams the data back to the client with configurable options:
- Line combination: Combine multiple lines using specified range
- Custom separators: Use custom separators between lines
- Real-time updates: See the streaming data immediately
- Stream data with customizable delay
- Combine multiple lines with custom separator
- Web interface for data input and streaming
- Real-time data updates
- Support for custom separators and line combinations
- Built with Bun for better performance
- Written in TypeScript for type safety
GET /
: Serves the web interfacePOST /submit
: Updates the server's data cacheGET /stream
: Streams the data back to the client
The server can be configured with the following options:
interface ServerConfig {
port: number; // Default: 3001
// ... other Bun.serve options
}
MIT License - see the LICENSE file for details
For more information, to report issues, or to contribute, please visit: https://github.com/Wangggym/streamock