0
0
Fork 0
mirror of https://github.com/renovatebot/renovate.git synced 2025-05-13 08:01:49 +00:00
renovatebot_renovate/lib/modules/datasource/custom/formats/json.ts

16 lines
552 B
TypeScript

import { readLocalFile } from '../../../../util/fs';
import type { Http } from '../../../../util/http';
import type { CustomDatasourceFetcher } from './types';
export class JSONFetcher implements CustomDatasourceFetcher {
async fetch(http: Http, registryURL: string): Promise<unknown> {
const response = await http.getJsonUnchecked(registryURL);
return response.body;
}
async readFile(registryURL: string): Promise<unknown> {
const fileContent = await readLocalFile(registryURL, 'utf8');
return JSON.parse(fileContent!);
}
}