/** * What an fopen-style mode string says about a handle. * * One vocabulary for every dialect that opens by mode: quickjs's * `std.open` passes these strings verbatim, and Python's preview1 * oflags/rights/fdflags translate onto the same facts. */ export interface OpenMode { /** The handle may read (r, +). */ readable: boolean; /** The handle may mutate its buffer (w, a, x, +). */ writable: boolean; /** Opening discards existing content (w). */ truncate: boolean; /** The position starts at the end (a). */ append: boolean; /** A missing file is created (w, a, x). */ create: boolean; /** An existing file refuses the open (x). */ exclusive: boolean; /** The handle carries bytes, not text (b). */ binary: boolean; } /** * Read an fopen-style mode string into its facts, validating it. * * The rule is CPython's, the stricter of the two parsers this * replaced — one base, at most one each of `+`, `b`, `t`, and never * `b` together with `t` — widened by one C-dialect spelling: `wx`, * fopen's exclusive create, which CPython spells as a bare `x`. Both * dialects open by mode through this one parser, so it accepts the * union. A guest engine that tolerates looser spellings still (C * fopen reads `rr` as `r`) renders this refusal in its own dialect at * its own boundary. * * Args: * mode: the mode as the caller spelled it (`r`, `w+b`, `a`, `wx`, ...). * * Throws: * Error: the mode does not parse, in CPython's own wording. */ export declare function parseMode(mode: string): OpenMode; //# sourceMappingURL=mode.d.ts.map