How to Check if product has links_exist attribute in Magento 2?

Attribute code links_exist is available for the only Downloadable Product type in Magento 2.

You can verify if the product has links exists or not programmatically by the class, Magento\Downloadable\Model\Product\Type

Using Model class, create simple function to check links exist for the given product by $product->getData(‘links_exist’)

<?php
namespace Jesadiya\Links\Model;

use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Downloadable\Model\Product\Type;
use Magento\Framework\Exception\NoSuchEntityException;
use Psr\Log\LoggerInterface;

class ProductLinksExist
{
    /**
     * @var ProductRepositoryInterface
     */
    private $productRepository;

    /**
     * @var Type
     */
    private $type;

    /**
     * @var LoggerInterface
     */
    private $logger;

    public function __construct(
        LoggerInterface $logger,
        ProductRepositoryInterface $productRepository,
        Type $type
    ) {
        $this->logger = $logger;
        $this->productRepository = $productRepository;
        $this->type = $type;
    }

    /**
     * Get links array of Downloadable Product.
     *
     * @param string $sku
     * @return boolean
     */
    public function hasLinks(string $sku): bool
    {
        $hasLinks = false;
        try {
            $product = $this->productRepository->get($sku);
            $hasLinks = $this->type->hasLinks($product);
        } catch (NoSuchEntityException $exception) {
            $this->logger->error($exception->getMessage());
        }

        return $hasLinks;
    }
}

Call method from the PHP class,

$sku = '240-LV09';
$linksArray = $this->hasLinks($sku);

hasLinks() used for the check product type has links exists or not.
links_exist attribute code will be available for only Downloadable products.

Output:
boolean