File size: 322 Bytes
57aa51e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import { readFileSync } from 'fs';
import axios from 'axios';
export const readOrFetch = async (path: string) => {
if (path.indexOf('http') === 0) {
return (
await axios({
url: path,
method: 'GET',
responseType: 'arraybuffer',
})
).data;
}
return readFileSync(path);
};
|