HttpBody overview
Added in v1.0.0
Table of contents
constructors
empty
Signature
export declare const empty: Empty
Added in v1.0.0
file
Signature
export declare const file: (
path: string,
options?: FileSystem.StreamOptions & { readonly contentType?: string }
) => Effect.Effect<Stream, PlatformError.PlatformError, FileSystem.FileSystem>
Added in v1.0.0
fileInfo
Signature
export declare const fileInfo: (
path: string,
info: FileSystem.File.Info,
options?: FileSystem.StreamOptions & { readonly contentType?: string }
) => Effect.Effect<Stream, PlatformError.PlatformError, FileSystem.FileSystem>
Added in v1.0.0
fileWeb
Signature
export declare const fileWeb: (file: HttpBody.FileLike) => Stream
Added in v1.0.0
formData
Signature
export declare const formData: (body: globalThis.FormData) => FormData
Added in v1.0.0
json
Signature
export declare const json: (body: unknown) => Effect.Effect<Uint8Array, HttpBodyError>
Added in v1.0.0
jsonSchema
Signature
export declare const jsonSchema: <A, I, R>(
schema: Schema.Schema<A, I, R>
) => (body: A) => Effect.Effect<Uint8Array, HttpBodyError, R>
Added in v1.0.0
raw
Signature
export declare const raw: (
body: unknown,
options?: { readonly contentType?: string | undefined; readonly contentLength?: number | undefined } | undefined
) => Raw
Added in v1.0.0
stream
Signature
export declare const stream: (
body: Stream_.Stream<globalThis.Uint8Array, unknown>,
contentType?: string,
contentLength?: number,
etag?: string
) => Stream
Added in v1.0.0
text
Signature
export declare const text: (body: string, contentType?: string) => Uint8Array
Added in v1.0.0
uint8Array
Signature
export declare const uint8Array: (body: globalThis.Uint8Array) => Uint8Array
Added in v1.0.0
unsafeJson
Signature
export declare const unsafeJson: (body: unknown) => Uint8Array
Added in v1.0.0
urlParams
Signature
export declare const urlParams: (urlParams: UrlParams.UrlParams) => Uint8Array
Added in v1.0.0
errors
ErrorReason (type alias)
Signature
export type ErrorReason =
| {
readonly _tag: "JsonError"
readonly error: unknown
}
| {
readonly _tag: "SchemaError"
readonly error: ParseResult.ParseError
}
Added in v1.0.0
HttpBodyError
Signature
export declare const HttpBodyError: (reason: ErrorReason) => HttpBodyError
Added in v1.0.0
HttpBodyError (interface)
Signature
export interface HttpBodyError {
readonly [ErrorTypeId]: ErrorTypeId
readonly _tag: "HttpBodyError"
readonly reason: ErrorReason
}
Added in v1.0.0
models
Empty (interface)
Signature
export interface Empty extends HttpBody.Proto {
readonly _tag: "Empty"
}
Added in v1.0.0
FormData (interface)
Signature
export interface FormData extends HttpBody.Proto {
readonly _tag: "FormData"
readonly formData: globalThis.FormData
}
Added in v1.0.0
HttpBody (type alias)
Signature
export type HttpBody = Empty | Raw | Uint8Array | FormData | Stream
Added in v1.0.0
Raw (interface)
Signature
export interface Raw extends HttpBody.Proto {
readonly _tag: "Raw"
readonly body: unknown
}
Added in v1.0.0
Stream (interface)
Signature
export interface Stream extends HttpBody.Proto {
readonly _tag: "Stream"
readonly stream: Stream_.Stream<globalThis.Uint8Array, unknown>
readonly contentType: string
readonly contentLength?: number | undefined
}
Added in v1.0.0
Uint8Array (interface)
Signature
export interface Uint8Array extends HttpBody.Proto {
readonly _tag: "Uint8Array"
readonly body: globalThis.Uint8Array
readonly contentType: string
readonly contentLength: number
}
Added in v1.0.0
refinements
isHttpBody
Signature
export declare const isHttpBody: (u: unknown) => u is HttpBody
Added in v1.0.0
type ids
ErrorTypeId
Signature
export declare const ErrorTypeId: typeof ErrorTypeId
Added in v1.0.0
ErrorTypeId (type alias)
Signature
export type ErrorTypeId = typeof ErrorTypeId
Added in v1.0.0
TypeId
Signature
export declare const TypeId: typeof TypeId
Added in v1.0.0
TypeId (type alias)
Signature
export type TypeId = typeof TypeId
Added in v1.0.0
utils
HttpBody (namespace)
Added in v1.0.0
FileLike (interface)
Signature
export interface FileLike {
readonly name: string
readonly lastModified: number
readonly size: number
readonly stream: () => unknown
readonly type: string
}
Added in v1.0.0
Proto (interface)
Signature
export interface Proto extends Inspectable {
readonly [TypeId]: TypeId
readonly _tag: string
readonly contentType?: string | undefined
readonly contentLength?: number | undefined
}
Added in v1.0.0