UNPKG

@mnrendra/read-stacked-file

Version:

Read a file based on the stack trace from any subdirectory in your project.

51 lines (47 loc) 1.5 kB
/** * The Options interface for `readStackedFile` and `readStackedFileSync`. * * @see https://github.com/mnrendra/read-stacked-file#readme */ interface Options { /** * A caller function to serve as the stack-trace target. * * @see https://github.com/mnrendra/read-stacked-file#readme */ caller?: (...args: any) => any; /** * The `Error.stackTraceLimit` property specifies the number of stack frames * to be collected by a stack trace. * * @default 10 * * @see https://github.com/mnrendra/read-stacked-file#readme */ stackTraceLimit?: number; } /** * Read the stack-trace file asynchronously. * * @param {string} targetFile - The target file to be obtained. * @param {Options} [options] - The optional params. * * @returns {Promise<string>} Obtained value. * * @see https://github.com/mnrendra/read-stacked-file#readme */ declare const main$1: (targetFile: string, { caller, stackTraceLimit }?: Options) => Promise<string>; /** * Read the stack-trace file synchronously. * * @param {string} targetFile - The target file to be obtained. * @param {Options} [options] - The optional params. * * @returns {string} Obtained value. * * @see https://github.com/mnrendra/read-stacked-file#readme */ declare const main: (targetFile: string, { caller, stackTraceLimit }?: Options) => string; export { main$1 as readStackedFile, main as readStackedFileSync }; export type { Options }; //# sourceMappingURL=index.d.ts.map