UNPKG

1.13 kBTypeScriptView Raw
1/// <reference types="node" resolution-mode="require"/>
2/// <reference types="node" resolution-mode="require"/>
3import type { Mode } from 'node:fs';
4/**
5 * We can detect file types for these files using the magic
6 * number
7 */
8export declare const supportMagicFileTypes: ReadonlySet<import("file-type").FileExtension>;
9/**
10 * Returns the file `type`, `subtype` and `extension`.
11 */
12export declare function getFileType(fileContents: Buffer): Promise<null | {
13 ext: string;
14 type?: string;
15 subtype?: string;
16}>;
17/**
18 * Computes file name from the file type
19 */
20export declare function computeFileTypeFromName(clientName: string, headers: {
21 [key: string]: string;
22}): {
23 ext: string;
24 type?: string;
25 subtype?: string;
26};
27/**
28 * Check if a file already exists
29 */
30export declare function pathExists(filePath: string): Promise<boolean>;
31/**
32 * Move file from source to destination with a fallback to move file across
33 * paritions and devices.
34 */
35export declare function moveFile(sourcePath: string, destinationPath: string, options?: {
36 overwrite: boolean;
37 directoryMode?: Mode;
38}): Promise<void>;