react-blob-viewer
v1.0.1
Published
React Blob viewer is a React component for viewing various file types, including images, PDFs, and text files. It supports both local and remote files.
Maintainers
Readme
React Blob Viewer
React Blob viewer is a React component for viewing various file types, including images, PDFs, and text files. It supports both local and remote files.
Installation
You can install the package from GitHub directly using npm or yarn:
npm install react-blob-viewerHow to Use
To use the React Blob Viewer in your project, follow these steps:
import {ReactBlobViewer} from 'react-blob-viewer';
function App(){
const path = 'https://example.com/path/to/your/file.pdf'; // Replace with your file URL
const [blob, setBlob] = React.useState<Blob | null>(null);
useEffect(() => {
fetch(path).then(response => {
response.blob().then(setBlob).catch(console.error);
})
}, [])
return (
<div>
<h1>React Blob Viewer Example</h1>
<ReactBlobViewer blob={blob} />
</div>
);
}License
This project is licensed under the MIT License. See the LICENSE file for details.
