export declare const NAME_MAX_BYTES = 255; /** Measure a string the way the filesystem does: in UTF-8 bytes. */ export declare function byteLength(text: string): number; /** * Trim a string to fit a byte budget without splitting a character. * * Returns `text` unchanged when it already fits, else the longest prefix * whose UTF-8 encoding is at most `budget` bytes. */ export declare function truncateBytes(text: string, budget: number): string; /** Trim trailing underscores, linearly. python's `str.rstrip("_")`. */ export declare function stripTrailingUnderscores(value: string): string; export declare function stripUnderscores(value: string): string; /** * Sanitize a name for use in virtual paths. * * Replaces shell-unsafe characters (apostrophes, quotes, etc.) and spaces * with underscores. Safe for use in shell commands without quoting. */ export declare function sanitizeName(name: string): string; /** * Make a name safe to embed in a VFS path segment. * * Preserves the original spelling (spaces, apostrophes, emoji, etc.) and only * replaces the path separator `/` with `∕` (U+2215) so the value cannot * collide with a directory boundary. Use this for resource directory and file * names where keeping the original display name matters more than shell * ergonomics. */ export declare function pathSafeName(name: string): string; /** * Sanitize an API-supplied label for use inside a filename. * * The shared body behind every backend's title/subject sanitizer: replace * shell-unsafe characters and spaces with underscores, collapse the runs, trim * the edges, then ellipsize past the budget. Backends differ only in what an * empty label becomes and how long a label may be, so those are the arguments. * * Unlike `sanitizeName` this ellipsizes rather than hard-cutting, so a * truncated name reads as truncated. * * Two budgets apply, and both have to: `maxLen` is the readable length a * backend wants, while `maxBytes` is what the filesystem will actually * accept. They are the same number only for ASCII, so a 100-character CJK * title passed a 100-character budget untouched and rendered a 300-byte * filename, which ext4 and APFS reject with ENAMETOOLONG. Pass the bytes the * *rest* of the filename does not already use -- see `makeFilename` in the * gdocs/gsheets/gslides entries and `makeEventFilename` in gcal, which is * where the fixed overhead is known. */ export declare function sanitizeLabel(text: string, options: { fallback: string; maxLen: number; maxBytes?: number; }): string; //# sourceMappingURL=sanitize.d.ts.map