@drizzle-http/undici
v3.1.0
Published
Undici HTTP client for Drizzle-Http
Downloads
15
Maintainers
Readme
Undici Client ·
Drizzle-Http client implementation using Undici.
Installation
Make sure we have the core module @Drizzle-Http/core installed.
npm i @drizzle-http/core
npm i @drizzle-http/undici
Features
- Customize Undici pool
- Allows the response to be written direct to stream.
Usage
Basic setup
import { UndiciCallFactory } from "@drizzle-http/undici";
import { DrizzleBuilder } from "@drizzle-http/core";
const api = DrizzleBuilder
.newBuilder()
.baseUrl(addr)
.callFactory(new UndiciCallFactory())
.build()
.create(API)
Stream
This feature uses undici.stream feature.
Example:
import { StreamingResponse } from "@drizzle-http/undici";
import { Streaming } from "@drizzle-http/undici";
import { StreamTo } from "@drizzle-http/undici";
import { GET } from "@drizzle-http/core";
class API {
@GET('/')
@Streaming()
streaming(@StreamTo() target: Writable): Promise<StreamingResponse> { }
}