/** * Validate a new file name on its own terms, before any provider sees it. * * A name is not a path: accepting a separator here would let a rename move a * file anywhere the process can write, and `..` would walk out of the media * root entirely. Both are refused rather than sanitised, because silently * rewriting what someone typed produces a file they cannot find. */ export declare function assertValidFileName(name: string): void; /** * The extension of a file name, including the dot, or '' when it has none. * A leading dot is the whole name (`.gitignore`), not an extension. */ export declare function extensionOfName(name: string): string; /** * The name a rename should actually produce, with the file's type intact. * * The extension is what every consumer uses to decide what the file IS — the * browser picks a thumbnail from it, `mimeFor` derives the media type from it, * and the storefront serves it by it. Letting a rename change it produces a * file that claims to be something it is not; letting a rename DROP it * produces one that claims to be nothing at all, which is what happened: the * renamed file came back untyped and lost its preview. * * So: * - a new name with NO extension keeps the original's — typing just the * stem is the common case and should not be an error; * - a new name with the SAME extension is accepted, normalised to the * original's spelling so `.PNG` and `.png` do not become two conventions; * - a new name with a DIFFERENT extension is refused. Renaming cannot * convert a file, and pretending otherwise breaks it silently. */ export declare function resolveRenameTarget(currentName: string, newName: string): string; /** The sibling path for `newName` next to `path`. */ export declare function siblingPath(path: string, newName: string): string; /** * Rename a file, keeping it in its folder. * * @param path the existing file path, relative to the media root * @param newName the new name — a name, never a path * @returns the new path */ export declare const renameFile: (path: string, newName: string) => Promise;