@magic-gear/file-viewer
v0.1.6
Published
## Supported file formats:
Downloads
10
Readme
@magic-gear/file-viewer
Supported file formats:
- [x] Images: png, jpg, jpeg, gif, bmp
- [x] pdf
- [x] csv
- [x] xls
- [x] xlsx
- [x] docx
- [x] mp3
- [x] mp4
- [x] webm
Getting Started
npm install @magic-gear/file-viewer
Usage
import React from 'react'
import FileViewer from '@magic-gear/file-viewer'
import { CustomErrorComponent } from 'custom-error'
const MyComponent = () => {
const file = 'http://example.com/image.png'
const type = 'png'
const fetchOptions = { headers: { 'app-id': 'abc123' } }
return (
<FileViewer
fileType={type}
fileUrl={file}
requestOptions={fetchOptions}
errorComponent={CustomErrorComponent}
/>
)
}
export default MyComponent