@freeword/meta
Version:
Meta package for Freeword: exports all core types, constants, and utilities from the src/ directory.
38 lines • 2.04 kB
TypeScript
import type * as FT from './FilerTypes.ts';
/**
* Creates directory recursively
* @param anypath - The pathname or pathinfo of the directory to create -- the `abspath` is used and NOT the `dirpath`
* @returns a GoodFilerMkdirResult or a BadFilerMkdirResult
*/
export declare function mkdirp(anypath: FT.Anypath): Promise<FT.FilerMkdirResult>;
/**
* Given a pathinfo object, assemble the absolute path
*/
export declare function _abspathForPathparts(pathinfo: Pick<FT.PathinfoT, 'dirpath' | 'barename' | 'fext'>): FT.Abspath;
/**
* Converts a plain pathname to an absolute path
*/
export declare function _abspathForPathname(pathname: FT.Pathname): FT.Abspath;
/** Assemble pathinfo using a (possibly relative) dirpath, a barename and a file extension
* @param pathinfo - The pathinfo dna to assemble
* dirpath - The directory path (relative or absolute)
* barename - The base name of the file (without extension)
* fext - The file extension (including the dot)
* @returns A complete pathinfo object, with abspath and dirpath resolved
*/
export declare function pathinfoFor(anypath: FT.Anypath): FT.PathinfoT | FT.BadFilerResult<'badPath' | 'badInput' | 'blankPath'>;
/**
* Async generator that reads a file and yields each line
* Returns AsyncGenerator<string, FilerReadResult, unknown>
*/
export declare function starlines(anypath: FT.Anypath): AsyncGenerator<string, FT.FilerReadResult<FT.PathinfoT, FT.CoreReadGist>, unknown>;
/**
* Creates directory and writes each line from an iterable/async iterable to a file
* Returns FilerResult<PathinfoT>
*/
export declare function dumptext(anypath: FT.Anypath, lines: Iterable<string> | AsyncIterable<string>): Promise<FT.FilerWriteResult<FT.PathinfoT, 'writeErr' | 'fsErr' | 'badPath' | 'badInput' | 'blankPath'>>;
/**
* Pretty prints JSON and calls dumptext. Returns FilerResult<PathinfoT>
*/
export declare function dumpjson(anypath: FT.Anypath, data: any): Promise<FT.FilerWriteResult<FT.PathinfoT, FT.CoreWriteGist>>;
//# sourceMappingURL=Filer.d.ts.map