import schema from '@stencila/schema'; import { Codec, CommonDecodeOptions, CommonEncodeOptions } from './codecs/types'; /** * To read or write from the STDIO a special `filePath` value of `-` can * be used with several of the encode/decode functions. */ export declare const STDIO_PATH = "-"; /** * A list of all codecs. * * Note that order is of importance for matching. More "generic" * formats should go last. See the `match` function. */ export declare const codecList: string[]; /** * Match the codec based on file name, extension name, media type or by content sniffing. * * Iterates through the list of codecs and returns the first that matches based on any * of the above criteria. * * If the supplied format contains a forward slash then it is assumed to be a media type, * otherwise an extension name. * * If trying to find a codec for an output, then `content` is more likely to be a path than * actual content. This is passed through to `vfile.isPath` for detection. * * @param content The content as a file path (e.g. `../folder/file.txt`) or raw content * @param format The format as a media type (e.g. `text/plain`) or extension name (e.g. `txt`) * @param isOutput `true` if attempting to find a match for an output file * @returns A promise that resolves to the `Codec` to use */ export declare function match(content?: string, format?: string, isOutput?: boolean): Promise; /** * Is the file path, or media type handled? (i.e. is there a codec for it?) * * @param content The file path * @param format The media type */ export declare function handled(content?: string, format?: string): Promise; /** * Load a `stencila.Node` from a string of content. * * @param content The content to load. * @param format The format to load the content as. */ export declare function load(content: string, format: string, options?: Options): Promise; /** * Dump a `stencila.Node` to a string of content. * * @param node The node to dump. * @param format The format to dump the node as. * @param options Encoding options. */ export declare function dump(node: schema.Node, format: string, options?: Options): Promise; /** * Read a file to a `stencila.Node`. * * @param source The raw content or file path to read. * Use `-` to read from standard input. * @param format The format to read the file as. * If undefined then determined from content or file path. */ export declare function read(source: string, format?: string, options?: Options): Promise; /** * Write a `stencila.Node` to a file. * * @param node The node to write. * @param filePath The file system path to write to. * Use `-` write to standard output. * @param options Encoding options. */ export declare function write(node: schema.Node, filePath: string, options?: Options): Promise; interface ConvertOptions { from?: string; to?: string; decodeOptions?: CommonDecodeOptions; encodeOptions?: CommonEncodeOptions; } /** * Convert content from one format to another. * * @param input The input content (raw or file path). * @param outputPaths The output file path/s. * @param options Conversion options e.g `from` and `to`: to specify the formats to convert from/to * @returns The converted content, or file path (for converters that only write to files). */ export declare function convert(input: string, outputPaths?: string | string[], options?: ConvertOptions): Promise; export {};