UNPKG

@uizard/nx-fast-s3-cache

Version:

Nx s3 cache using GNU tar, pigz and multipart s3 uploads/downloads

20 lines (19 loc) 839 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createRemoteCacheStore = void 0; const path_1 = __importDefault(require("path")); const get_file_name_from_hash_1 = require("./get-file-name-from-hash"); const createRemoteCacheStore = (safeImplementation) => async (hash, cacheDirectory) => { const implementation = await safeImplementation; if (!implementation) { return false; } const file = (0, get_file_name_from_hash_1.getFileNameFromHash)(hash); const { storeFile } = implementation; await storeFile(path_1.default.join(cacheDirectory, file), hash); return true; }; exports.createRemoteCacheStore = createRemoteCacheStore;