An open API service indexing awesome lists of open source software.

https://github.com/bsv-blockchain/uhrp-react

UHRP-enabled React components for images, video, and audio
https://github.com/bsv-blockchain/uhrp-react

Last synced: 3 months ago
JSON representation

UHRP-enabled React components for images, video, and audio

Awesome Lists containing this project

README

          

# The `@bsv/uhrp-react` Package

UHRP-enabled React components for images, video, and audio.

# Background

The Universal Hash Resolution Protocol (UHRP) allows content to be addressed by its SHA256 hash, enabling efficient content storage and retrieval. This eliminates the need to store large media files directly on the blockchain, significantly reducing costs.

## Installation

```
npm i @bsv/uhrp-react
```

## Usage

In your React project:

```tsx
import React from 'react'
import { Img, Source } from '@bsv/uhrp-react'

const App = () => (


UHRP Media Showcase


Image Preview




Video Preview






Image with Loading State


Loading...
}
/>


)

export default App
```

## Props

src (required) – The UHRP address of the media.
loading (optional) – A React element to display while the media is being resolved.
Any additional props will be passed directly to the rendered or element for greater flexibility.

## How It Works

The uhrp-react library automatically resolves UHRP URLs to HTTP URLs using the UHRP Storage Server in the background. This provides seamless integration with your React application.

## Example

Check the [example directory of the repo](./example) for a simple React Scripts project utilizing these components.

## License

The license for the code in this repository is the Open BSV License.