Multipart.ts overview
Since v1.0.0
Exports Grouped by Category
constructors
makeChannel
Signature
declare const makeChannel: <IE>(
headers: Record<string, string>,
bufferSize?: number
) => Channel.Channel<Chunk.Chunk<Part>, Chunk.Chunk<Uint8Array>, MultipartError | IE, IE, unknown, unknown>
Since v1.0.0
makeConfig
Signature
declare const makeConfig: (headers: Record<string, string>) => Effect.Effect<Multipasta.BaseConfig>
Since v1.0.0
toPersisted
Signature
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>
Since v1.0.0
errors
MultipartError
Signature
declare const MultipartError: new (options: {
readonly reason: MultipartError["reason"]
readonly cause: unknown
}) => MultipartError
Since 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
}
Since v1.0.0
fiber refs
fieldMimeTypes
Signature
declare const fieldMimeTypes: FiberRef.FiberRef<Chunk.Chunk<string>>
Since v1.0.0
maxFieldSize
Signature
declare const maxFieldSize: FiberRef.FiberRef<Brand.Branded<bigint, "Size">>
Since v1.0.0
maxFileSize
Signature
declare const maxFileSize: FiberRef.FiberRef<Option.Option<Brand.Branded<bigint, "Size">>>
Since v1.0.0
maxParts
Signature
declare const maxParts: FiberRef.FiberRef<Option.Option<number>>
Since v1.0.0
withFieldMimeTypes
Signature
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>
}
Since v1.0.0
withMaxFieldSize
Signature
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>
}
Since v1.0.0
withMaxFileSize
Signature
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>
}
Since v1.0.0
withMaxParts
Signature
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>
}
Since 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
}
Since 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>
}
Since v1.0.0
Part (type alias)
Signature
type Part = Field | File
Since v1.0.0
Persisted (interface)
Signature
export interface Persisted {
readonly [key: string]: ReadonlyArray<PersistedFile> | ReadonlyArray<string> | string
}
Since 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
}
Since v1.0.0
refinements
isField
Signature
declare const isField: (u: unknown) => u is Field
Since v1.0.0
isFile
Signature
declare const isFile: (u: unknown) => u is File
Since v1.0.0
isPart
Signature
declare const isPart: (u: unknown) => u is Part
Since v1.0.0
isPersistedFile
Signature
declare const isPersistedFile: (u: unknown) => u is PersistedFile
Since v1.0.0
schema
FileSchema
Signature
declare const FileSchema: Schema.Schema<PersistedFile>
Since v1.0.0
FilesSchema
Signature
declare const FilesSchema: Schema.Schema<ReadonlyArray<PersistedFile>>
Since v1.0.0
SingleFileSchema
Signature
declare const SingleFileSchema: Schema.transform<
Schema.Schema<ReadonlyArray<PersistedFile>>,
Schema.Schema<PersistedFile>
>
Since v1.0.0
schemaJson
Signature
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>
}
Since v1.0.0
schemaPersisted
Signature
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>
Since v1.0.0
type ids
ErrorTypeId
Signature
declare const ErrorTypeId: unique symbol
Since v1.0.0
ErrorTypeId (type alias)
Signature
type ErrorTypeId = typeof ErrorTypeId
Since v1.0.0
TypeId
Signature
declare const TypeId: unique symbol
Since v1.0.0
TypeId (type alias)
Signature
type TypeId = typeof TypeId
Since v1.0.0
utils
Part (namespace)
Since v1.0.0
Proto (interface)
Signature
export interface Proto extends Inspectable {
readonly [TypeId]: TypeId
readonly _tag: string
}
Since v1.0.0