import { type Readable } from 'node:stream'; import { AttachmentContentEncoding } from '@cucumber/messages'; export interface IAttachmentMedia { encoding: AttachmentContentEncoding; contentType: string; } export interface IAttachment { data: string; media: IAttachmentMedia; fileName?: string; } export type IAttachFunction = (attachment: IAttachment) => void; export interface ICreateAttachmentOptions { mediaType: string; fileName?: string; } export type ICreateStringAttachment = (data: string, mediaTypeOrOptions?: string | ICreateAttachmentOptions) => void; export type ICreateBufferAttachment = (data: Buffer, mediaTypeOrOptions: string | ICreateAttachmentOptions) => void; export type ICreateStreamAttachment = (data: Readable, mediaTypeOrOptions: string | ICreateAttachmentOptions) => Promise; export type ICreateStreamAttachmentWithCallback = (data: Readable, mediaTypeOrOptions: string | ICreateAttachmentOptions, callback: () => void) => void; export type ICreateAttachment = ICreateStringAttachment & ICreateBufferAttachment & ICreateStreamAttachment & ICreateStreamAttachmentWithCallback; export type ICreateLog = (text: string) => void; export type ICreateLink = (text: string) => void; export default class AttachmentManager { private readonly onAttachment; constructor(onAttachment: IAttachFunction); log(text: string): void | Promise; link(...url: string[]): void | Promise; create(data: Buffer | Readable | string, mediaTypeOrOptions?: string | ICreateAttachmentOptions, callback?: () => void): void | Promise; createBufferAttachment(data: Buffer, mediaType: string, fileName?: string): void; createStreamAttachment(data: Readable, mediaType: string, fileName?: string, callback?: () => void): void | Promise; createStringAttachment(data: string, media: IAttachmentMedia, fileName?: string): void; }