/// import { Readable } from "stream"; /** * A storage interface for storing and retrieving data during ingestion and processing. * For example, documents, document fragments, transformed data, can be stored in during a pipeline run. */ export interface BlobStorage { /** * Saves the blob to the storage. * @param blob The blob to save. * @param name The name of the blob. * @returns A promise that resolves to the ID of the saved blob. */ write(blob: Blob, name?: string): Promise; /** * Writes the blob to the storage from a stream. */ writeStream(stream: Readable, name?: string): Promise; /** * Gets the blob from the storage. */ read(blobUri: string): Promise; /** * Streaming data from the blob storage. */ readStream(blobUri: string): Promise; /** * Deletes the blob from the storage. */ delete(blobUri: string): Promise; } /** * A blob identifier is a unique identifier for a blob in a blob storage. */ export interface BlobIdentifier { blobUri: string; storage: BlobStorage; } /** * A blob is a piece of data that can be stored in a BlobStorage. */ export interface Blob { data: Uint8Array; mimeType?: string; id?: BlobIdentifier; } export declare class InMemoryStorage implements BlobStorage { private blobs; write(blob: Blob, name?: string | undefined): Promise; writeStream(stream: Readable, name?: string | undefined): Promise; read(blobUri: string): Promise; readStream(blobUri: string): Promise; delete(blobUri: string): Promise; } /** * A blob storage that stores data in the local file system. */ export declare class FileSystemStorage implements BlobStorage { private workingDirectory; constructor(workingDirectory: string); write(blob: Blob, name?: string): Promise; writeStream(stream: Readable, name?: string): Promise; read(blobUri: string): Promise; readStream(blobUri: string): Promise; delete(blobUri: string): Promise; } /** * A blob storage that stores data in a temporary file system. * Data gets destroyed when the process exits. */ export declare class TemporaryFileSystemStorage extends FileSystemStorage { static instance: TemporaryFileSystemStorage; constructor(); } /** * A blob storage that stores data in an AWS S3 bucket. */ export declare class S3Storage implements BlobStorage { constructor(); write(_blob: Blob, _name?: string): Promise; writeStream(_stream: Readable, _name?: string): Promise; read(_blobUri: string): Promise; readStream(_blobUri: string): Promise; delete(_blobUri: string): Promise; }