UNPKG

@stencila/jesta

Version:

Stencila plugin for executable documents using JavaScript

42 lines (41 loc) 1.44 kB
import { MethodSchema } from './manifest'; export declare const schema: MethodSchema; /** * Read content from a URL. * * For HTTP/S URLs this function complies with [RFC 7234](http://httpwg.org/specs/rfc7234.html) * for caching of requests. Use `force` to ignore any cached content that may * exist on the machine for the URL. * * @param input The URL to read. * @param cache Should any cached content be ignored? For remote URLs only. * @returns The content that was read. */ export declare function read(input: string, cache?: boolean): Promise<[string, string | undefined]>; export declare namespace read { var schema: MethodSchema; } /** * Read content from standard input * * @returns The content */ export declare function readStdio(): Promise<string>; /** * Read content from the local file system * * @param filePath The path to the file to read * @returns A tuple of the content and its format */ export declare function readFile(filePath: string): Promise<[string, string | undefined]>; /** * Read content from a HTTP/S URL * * The format is determined from the `Content-Type` header if present, * guessed from the URL's path segment if not. * * @param url The URL to fetch * @param caching Should a cache be used to retrieve / store content. * @returns A tuple of the content and its format */ export declare function readHttp(url: string, caching?: boolean): Promise<[string, string | undefined]>;