UNPKG

gitly

Version:

An API to download and/or extract git repositories

24 lines (23 loc) 811 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = exists; const node_fs_1 = require("node:fs"); const node_path_1 = require("node:path"); const parse_1 = __importDefault(require("./parse")); const archive_1 = require("./archive"); async function exists(path, options = {}) { let _path = path; if (!(0, node_path_1.isAbsolute)(path)) { _path = (0, archive_1.getArchivePath)((0, parse_1.default)(path), options); } try { await node_fs_1.promises.access(_path, node_fs_1.constants.F_OK); return true; // eslint-disable-next-line no-empty } catch (_) { } return false; }