Skip to content

migrateFileStorage

function migrateFileStorage(options): Promise<{
moved: number;
}>;

Defined in: src/storage/file.ts:352

One-time upgrade of a store in the legacy layout (raw key segments as file names, so keys differing only by case shared a file on case-insensitive filesystems). Moves every leaf that is not in the encoded layout to its encodeSegment path and removes the emptied directories. Idempotent; run it with no writer on the store. Resolves how many keys moved.

Parameter Type
options Pick<FileStorageOptions, "dir">

Promise<{ moved: number; }>

import { migrateFileStorage } from "@xtandard/kit/storage/file";
await migrateFileStorage({ dir: "./data" });