Multipart overview
Added in v1.0.0
Table of contents
constructors
makeChannel
Signature
export declare const makeChannel: <IE>(
headers: Record<string, string>,
bufferSize?: number
) => Channel.Channel<Chunk.Chunk<Part>, Chunk.Chunk<Uint8Array>, MultipartError | IE, IE, unknown, unknown>
Added in v1.0.0
makeConfig
Signature
export declare const makeConfig: (headers: Record<string, string>) => Effect.Effect<Multipasta.BaseConfig>
Added in v1.0.0
toPersisted
Signature
export declare const toPersisted: (
stream: Stream.Stream<Part, MultipartError>,
writeFile?: (path: string, file: File) => Effect.Effect<void, MultipartError, FileSystem.FileSystem>
) => Effect.Effect<Persisted, MultipartError, FileSystem.FileSystem | Path.Path | Scope.Scope>
Added in v1.0.0
errors
MultipartError
Signature
export declare const MultipartError: new (options: {
readonly reason: MultipartError["reason"]
readonly cause: unknown
}) => MultipartError
Added in v1.0.0
MultipartError (interface)
Signature
export interface MultipartError extends YieldableError {
readonly [ErrorTypeId]: ErrorTypeId
readonly _tag: "MultipartError"
readonly reason: "FileTooLarge" | "FieldTooLarge" | "BodyTooLarge" | "TooManyParts" | "InternalError" | "Parse"
readonly message: string
readonly cause: unknown
}
Added in v1.0.0
fiber refs
fieldMimeTypes
Signature
export declare const fieldMimeTypes: FiberRef.FiberRef<Chunk.Chunk<string>>
Added in v1.0.0
maxFieldSize
Signature
export declare const maxFieldSize: FiberRef.FiberRef<Brand.Branded<bigint, "Size">>
Added in v1.0.0
maxFileSize
Signature
export declare const maxFileSize: FiberRef.FiberRef<Option.Option<Brand.Branded<bigint, "Size">>>
Added in v1.0.0
maxParts
Signature
export declare const maxParts: FiberRef.FiberRef<Option.Option<number>>
Added in v1.0.0
withFieldMimeTypes
Signature
export declare const withFieldMimeTypes: {
(mimeTypes: ReadonlyArray<string>): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
<A, E, R>(effect: Effect.Effect<A, E, R>, mimeTypes: ReadonlyArray<string>): Effect.Effect<A, E, R>
}
Added in v1.0.0
withMaxFieldSize
Signature
export declare const withMaxFieldSize: {
(size: FileSystem.SizeInput): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
<A, E, R>(effect: Effect.Effect<A, E, R>, size: FileSystem.SizeInput): Effect.Effect<A, E, R>
}
Added in v1.0.0
withMaxFileSize
Signature
export declare const withMaxFileSize: {
(size: Option.Option<FileSystem.SizeInput>): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
<A, E, R>(effect: Effect.Effect<A, E, R>, size: Option.Option<FileSystem.SizeInput>): Effect.Effect<A, E, R>
}
Added in v1.0.0
withMaxParts
Signature
export declare const withMaxParts: {
(count: Option.Option<number>): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
<A, E, R>(effect: Effect.Effect<A, E, R>, count: Option.Option<number>): Effect.Effect<A, E, R>
}
Added in v1.0.0
models
Field (interface)
Signature
export interface Field extends Part.Proto {
readonly _tag: "Field"
readonly key: string
readonly contentType: string
readonly value: string
}
Added in v1.0.0
File (interface)
Signature
export interface File extends Part.Proto {
readonly _tag: "File"
readonly key: string
readonly name: string
readonly contentType: string
readonly content: Stream.Stream<Uint8Array, MultipartError>
}
Added in v1.0.0
Part (type alias)
Signature
export type Part = Field | File
Added in v1.0.0
Persisted (interface)
Signature
export interface Persisted {
readonly [key: string]: ReadonlyArray<PersistedFile> | ReadonlyArray<string> | string
}
Added in v1.0.0
PersistedFile (interface)
Signature
export interface PersistedFile extends Part.Proto {
readonly _tag: "PersistedFile"
readonly key: string
readonly name: string
readonly contentType: string
readonly path: string
}
Added in v1.0.0
refinements
isField
Signature
export declare const isField: (u: unknown) => u is Field
Added in v1.0.0
isFile
Signature
export declare const isFile: (u: unknown) => u is File
Added in v1.0.0
isPart
Signature
export declare const isPart: (u: unknown) => u is Part
Added in v1.0.0
isPersistedFile
Signature
export declare const isPersistedFile: (u: unknown) => u is PersistedFile
Added in v1.0.0
schema
FileSchema
Signature
export declare const FileSchema: Schema.Schema<PersistedFile>
Added in v1.0.0
FilesSchema
Signature
export declare const FilesSchema: Schema.Schema<readonly PersistedFile[]>
Added in v1.0.0
SingleFileSchema
Signature
export declare const SingleFileSchema: Schema.transform<
Schema.Schema<readonly PersistedFile[]>,
Schema.Schema<PersistedFile>
>
Added in v1.0.0
schemaJson
Signature
export declare const schemaJson: <A, I, R>(
schema: Schema.Schema<A, I, R>,
options?: ParseOptions | undefined
) => {
(field: string): (persisted: Persisted) => Effect.Effect<A, ParseResult.ParseError, R>
(persisted: Persisted, field: string): Effect.Effect<A, ParseResult.ParseError, R>
}
Added in v1.0.0
schemaPersisted
Signature
export declare const schemaPersisted: <A, I extends Partial<Persisted>, R>(
schema: Schema.Schema<A, I, R>,
options?: ParseOptions | undefined
) => (persisted: Persisted) => Effect.Effect<A, ParseResult.ParseError, R>
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
Part (namespace)
Added in v1.0.0
Proto (interface)
Signature
export interface Proto extends Inspectable {
readonly [TypeId]: TypeId
readonly _tag: string
}
Added in v1.0.0