@adonisjs/bodyparser
Version:
BodyParser middleware for AdonisJS http server to read and parse request body
39 lines (38 loc) • 1.13 kB
TypeScript
/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
import type { Mode } from 'node:fs';
/**
* We can detect file types for these files using the magic
* number
*/
export declare const supportMagicFileTypes: ReadonlySet<import("file-type").FileExtension>;
/**
* Returns the file `type`, `subtype` and `extension`.
*/
export declare function getFileType(fileContents: Buffer): Promise<null | {
ext: string;
type?: string;
subtype?: string;
}>;
/**
* Computes file name from the file type
*/
export declare function computeFileTypeFromName(clientName: string, headers: {
[key: string]: string;
}): {
ext: string;
type?: string;
subtype?: string;
};
/**
* Check if a file already exists
*/
export declare function pathExists(filePath: string): Promise<boolean>;
/**
* Move file from source to destination with a fallback to move file across
* paritions and devices.
*/
export declare function moveFile(sourcePath: string, destinationPath: string, options?: {
overwrite: boolean;
directoryMode?: Mode;
}): Promise<void>;