https://github.com/clappcodes/transporter
TransportStream - Remote TransformStream
https://github.com/clappcodes/transporter
deno duplex-stream streams web
Last synced: 2 months ago
JSON representation
TransportStream - Remote TransformStream
- Host: GitHub
- URL: https://github.com/clappcodes/transporter
- Owner: clappcodes
- Created: 2024-04-24T06:59:00.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-27T02:22:13.000Z (11 months ago)
- Last Synced: 2024-09-14T12:25:56.672Z (9 months ago)
- Topics: deno, duplex-stream, streams, web
- Language: TypeScript
- Homepage: https://transporter.clapp.codes/
- Size: 622 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @clapp/transporter
### Client
```ts
import {
IncomingTextStream,
OutgoingTextStream,
} from "@clappcodes/transporter";async function receive() {
const stream = new IncomingTextStream("/foo");for await (const chunk of await stream.ready) {
console.log("(server)", chunk);
}
}async function send() {
const stream = new OutgoingTextStream("/foo");await stream.write("Hello from browser");
}
```### Server
```ts
import {
IncomingTextStream,
OutgoingTextStream,
} from "@clappcodes/transporter";async function receive(request: Request) {
const stream = new IncomingTextStream(request);for await (const chunk of await stream.ready) {
console.log("(client)", chunk);
}
}async function send(request: Request) {
const stream = new OutgoingTextStream(request);stream.write("Hello from server");
// new Response(stream.readable)
return stream.response();
}// pseudo request handlers
app.put("/foo", receive);
app.get("/foo", send);
```