UNPKG

@promptbook/langtail

Version:

It's time for a paradigm shift. The future of software in plain English, French or Latin

35 lines (34 loc) 1.5 kB
import type { PrepareAndScrapeOptions } from '../../../prepare/PrepareAndScrapeOptions'; import type { string_file_extension } from '../../../types/typeAliases'; import type { ScraperSourceHandler } from '../Scraper'; import type { ScraperIntermediateSource } from '../ScraperIntermediateSource'; /** * @@@ * * @private internal utility of `getScraperIntermediateSource` */ type GetScraperIntermediateSourceSource = Pick<ScraperSourceHandler, 'filename' | 'url'>; /** * @@@ * * @private internal utility of `getScraperIntermediateSource` */ type GetScraperIntermediateSourceHandler = Required<Pick<PrepareAndScrapeOptions, 'rootDirname' | 'cacheDirname' | 'intermediateFilesStrategy' | 'isVerbose'>> & { readonly extension: string_file_extension; }; /** * Create a filename for intermediate cache for scrapers * * Note: It also checks if directory exists and creates it if not * * @private as internal utility for scrapers */ export declare function getScraperIntermediateSource(source: GetScraperIntermediateSourceSource, options: GetScraperIntermediateSourceHandler): Promise<ScraperIntermediateSource>; export {}; /** * Note: Not using `FileCacheStorage` for two reasons: * 1) Need to store more than serialized JSONs * 2) Need to switch between a `rootDirname` and `cacheDirname` <- TODO: [😡] * TODO: [🐱‍🐉][🧠] Make some smart crop * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment */