postio / apps /backend /dist /libraries /helpers /src /utils /read.or.fetch.js
Leon4gr45's picture
Upload folder using huggingface_hub
e372349 verified
Raw
History Blame Contribute Delete
584 Bytes
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.readOrFetch = void 0;
const tslib_1 = require("tslib");
const fs_1 = require("fs");
const axios_1 = tslib_1.__importDefault(require("axios"));
const readOrFetch = async (path) => {
if (path.indexOf('http') === 0) {
return (await (0, axios_1.default)({
url: path,
method: 'GET',
responseType: 'arraybuffer',
})).data;
}
return (0, fs_1.readFileSync)(path);
};
exports.readOrFetch = readOrFetch;
//# sourceMappingURL=read.or.fetch.js.map