@sigiljs/sigil
Version:
TypeScript-first Node.js HTTP framework offering schema-driven routing, modifier-based middleware, plugin extensibility, and flexible response templating
65 lines (64 loc) • 1.65 kB
TypeScript
/**
* Options for constructing an IncomingFile instance.
*/
interface IncomingFileConstructorOptions {
/**
* Original filename as provided by the client, or null if unavailable.
*/
originalName: string | null;
/**
* Internal name or identifier for the file.
*/
name: string;
/**
* MIME type of the file (e.g., "image/png").
*/
mimeType: string;
/**
* Buffer containing the raw file data.
*/
buffer: Buffer;
/**
* Key or field name associated with this file in the request.
*/
key: string;
}
/**
* Represents an uploaded file in an incoming request.
* Provides access to file metadata, raw buffer, and Blob representation.
*/
export default class IncomingFile {
/**
* Constructs a new IncomingFile.
*
* @param options configuration options including buffer, names, and MIME type.
*/
constructor(options: IncomingFileConstructorOptions);
/**
* MIME type of the file.
*/
get mimeType(): string;
/**
* Original filename provided by the client.
*/
get originalName(): string | null;
/**
* Field key associated with this file in the form data.
*/
get incomingFileKey(): string;
/**
* Returns a Blob representation of the file data.
* Caches the Blob for subsequent calls.
*
* @returns blob containing the file's binary data and correct MIME type.
*/
blob(): Blob;
/**
* Returns the raw Buffer of the file data.
*
* @returns buffer containing the file's binary content.
*/
buffer(): Buffer;
}
export {};