UNPKG

@tmlmobilidade/utils

Version:

A collection of utility functions and helpers for the TML Mobilidade Go monorepo, providing common functionality for batching operations, caching, HTTP requests, object manipulation, permissions, and more.

27 lines (26 loc) 1.02 kB
import { HttpResponse } from './response.js'; /** * Sends a multipart form data request to a URL. * @param url - The URL to send the request to * @param formData - The FormData object containing the multipart form data * @returns Promise resolving to HttpResponse containing data, error and status * @example * ```ts * const formData = new FormData(); * formData.append('file', fileBlob); * formData.append('name', 'profile.jpg'); * const response = await multipartFetch('/api/upload', formData); * ``` */ export declare function multipartFetch<T>(url: string, formData: FormData): Promise<HttpResponse<T>>; /** * Uploads a file to a URL using multipart form data. * @param url - The URL to send the request to * @param file - The file to upload * @returns Promise resolving to HttpResponse containing data, error and status * @example * ```ts * const response = await uploadFile('/api/upload', file); * ``` */ export declare function uploadFile<T>(url: string, file: File): Promise<HttpResponse<T>>;