UNPKG

create-fansitem

Version:

Create a new Manifest backend

22 lines (21 loc) 703 B
import * as fs from 'node:fs'; export const getBackendFileContent = async (localPath, remotePath) => { // We use local default example backend file if remotePath is not provided. if (!remotePath) { return Promise.resolve(fs.readFileSync(localPath, 'utf8')); } else { try { const response = await fetch(remotePath); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const yamlContent = await response.text(); return yamlContent; } catch (error) { console.error('Error fetching YAML:', error); throw error; } } };