Multipart.ts overview
Since v1.0.0
Exports Grouped by Category
Config
makeConfig
Signature
declare const makeConfig: (headers: Record<string, string>) => Effect.Effect<MP.BaseConfig>
Since v1.0.0
Conversions
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
ErrorTypeId
Signature
declare const ErrorTypeId: unique symbol
Since v1.0.0
ErrorTypeId (type alias)
Signature
type ErrorTypeId = typeof ErrorTypeId
Since v1.0.0
MultipartError (class)
Signature
declare class MultipartError
Since v1.0.0
[ErrorTypeId] (property)
Signature
readonly [ErrorTypeId]: unique symbol
Since v1.0.0
Guards
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
Parsers
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
Schemas
FileSchema
Signature
declare const FileSchema: Schema.Schema<PersistedFile, PersistedFile, never>
Since v1.0.0
FilesSchema
Signature
declare const FilesSchema: Schema.Schema<ReadonlyArray<PersistedFile>, ReadonlyArray<PersistedFile>, never>
Since v1.0.0
SingleFileSchema
Signature
declare const SingleFileSchema: Schema.transform<
Schema.Schema<ReadonlyArray<PersistedFile>, ReadonlyArray<PersistedFile>, never>,
Schema.Schema<PersistedFile, PersistedFile, never>
>
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
fiber refs
FieldMimeTypes (class)
Signature
declare class FieldMimeTypes
Since v1.0.0
MaxFieldSize (class)
Signature
declare class MaxFieldSize
Since v1.0.0
MaxFileSize (class)
Signature
declare class MaxFileSize
Since v1.0.0
MaxParts (class)
Signature
declare class MaxParts
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
withLimits
Signature
declare const withLimits: {
(options: {
readonly maxParts?: Option.Option<number> | undefined
readonly maxFieldSize?: FileSystem.SizeInput | undefined
readonly maxFileSize?: Option.Option<FileSystem.SizeInput> | undefined
readonly maxTotalSize?: Option.Option<FileSystem.SizeInput> | undefined
readonly fieldMimeTypes?: ReadonlyArray<string> | undefined
}): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
<A, E, R>(
effect: Effect.Effect<A, E, R>,
options: {
readonly maxParts?: Option.Option<number> | undefined
readonly maxFieldSize?: FileSystem.SizeInput | undefined
readonly maxFileSize?: Option.Option<FileSystem.SizeInput> | undefined
readonly maxTotalSize?: Option.Option<FileSystem.SizeInput> | undefined
readonly fieldMimeTypes?: ReadonlyArray<string> | undefined
}
): Effect.Effect<A, E, R>
}
Since v1.0.0
withLimits (namespace)
Since v1.0.0
Options (type alias)
Signature
type Options = {
readonly maxParts?: Option.Option<number> | undefined
readonly maxFieldSize?: FileSystem.SizeInput | undefined
readonly maxFileSize?: Option.Option<FileSystem.SizeInput> | undefined
readonly maxTotalSize?: Option.Option<FileSystem.SizeInput> | undefined
readonly fieldMimeTypes?: ReadonlyArray<string> | undefined
}
Since v1.0.0
withLimitsStream
Signature
declare const withLimitsStream: {
(options: {
readonly maxParts?: Option.Option<number> | undefined
readonly maxFieldSize?: FileSystem.SizeInput | undefined
readonly maxFileSize?: Option.Option<FileSystem.SizeInput> | undefined
readonly maxTotalSize?: Option.Option<FileSystem.SizeInput> | undefined
readonly fieldMimeTypes?: ReadonlyArray<string> | undefined
}): <A, E, R>(stream: Stream.Stream<A, E, R>) => Stream.Stream<A, E, R>
<A, E, R>(
stream: Stream.Stream<A, E, R>,
options: {
readonly maxParts?: Option.Option<number> | undefined
readonly maxFieldSize?: FileSystem.SizeInput | undefined
readonly maxFileSize?: Option.Option<FileSystem.SizeInput> | undefined
readonly maxTotalSize?: Option.Option<FileSystem.SizeInput> | undefined
readonly fieldMimeTypes?: ReadonlyArray<string> | undefined
}
): Stream.Stream<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>
readonly contentEffect: Effect.Effect<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
type ids
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.Inspectable {
readonly [TypeId]: TypeId
readonly _tag: string
}
Since v1.0.0
collectUint8Array
Signature
declare const collectUint8Array: Channel.Channel<
never,
Chunk.Chunk<Uint8Array<ArrayBufferLike>>,
unknown,
unknown,
Uint8Array<ArrayBufferLike>,
unknown,
never
>
Since v1.0.0