Gathering detailed insights and metrics for react-file-previewer-v2
Gathering detailed insights and metrics for react-file-previewer-v2
Gathering detailed insights and metrics for react-file-previewer-v2
Gathering detailed insights and metrics for react-file-previewer-v2
A browser/device-agnostic file previewer for PDF, JPG, and PNG filetypes built on top of React-PDF
npm install react-file-previewer-v2
Typescript
Module System
Node Version
NPM Version
JavaScript (89.42%)
CSS (10.58%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
89 Commits
2 Forks
11 Branches
1 Contributors
Updated on Jan 25, 2023
Latest Version
0.6.3
Package Id
react-file-previewer-v2@0.6.3
Unpacked Size
176.63 kB
Size
35.58 kB
File Count
33
NPM Version
6.14.4
Node Version
12.18.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
8
1
24
A browser/device-agnostic file previewer for PDF and image file types built on top of React-PDF.
npm i react-file-previewer
This component supports URLs and base64 encoded data.
1import FilePreviewer from 'react-file-previewer'; 2 3export const App = () => ( 4 <div> 5 <h1>My App</h1> 6 <FilePreviewer file={{ 7 url: "https://cors-anywhere.herokuapp.com/http://africau.edu/images/default/sample.pdf"}} 8 /> 9 </div> 10);
1import FilePreviewer from 'react-file-previewer'; 2 3export const App = () => ( 4 <div> 5 <h1>My App</h1> 6 <FilePreviewer 7 file={{ 8 data: "<base64 string>", 9 mimeType: 'application/pdf', 10 name: 'sample.pdf' // for download 11 }} 12 /> 13 </div> 14);
1import { useState } from 'react'; 2import FilePreviewer from 'react-file-previewer'; 3 4const PDF1_URL = 5 'https://cors-anywhere.herokuapp.com/http://africau.edu/images/default/sample.pdf'; 6 7export const App = () => { 8 const [file, setFile] = useState({ url: PDF1_URL }); 9 10 const onFileChange = event => { 11 const fileReader = new window.FileReader(); 12 const file = event.target.files[0]; 13 14 fileReader.onload = fileLoad => { 15 const { result } = fileLoad.target; 16 setFile({ url: result }); 17 }; 18 19 fileReader.readAsDataURL(file); 20 }; 21 22 return ( 23 <div> 24 <h1>My App</h1> 25 <input type="file" onChange={onFileChange} /> 26 <FilePreviewer 27 file={file} 28 /> 29 </div> 30 ) 31};
This will render the first page of the file as a thumbnail. It takes the exact same props as the default export
FilePreviewer
.
1import {FilePreviewerThumbnail} from 'react-file-previewer'; 2 3export const App = () => ( 4 <div> 5 <h1>My App</h1> 6 <FilePreviewerThumbnail 7 file={{ 8 data: "<base64 string>", 9 mimeType: 'application/pdf', 10 name: 'sample.pdf' // for download 11 }} 12 /> 13 -or- 14 <FilePreviewerThumbnail file={{ 15 url: "https://cors-anywhere.herokuapp.com/http://africau.edu/images/default/sample.pdf"}} 16 /> 17 </div> 18);
Prop name | Type | Description |
---|---|---|
file | object | Refer to file object |
onClick | function | Event handler for when viewer is clicked |
hideControls | bool | If 'true', viewer won't display the zoom, page up/down, and fit-to-screen controls |
Prop name | Type | Description |
---|---|---|
file | object | Refer to file object |
onClick | function | Event handler for when viewer is clicked |
hideControls | bool | If 'true', viewer won't display the zoom, page up/down, and fit-to-screen controls |
style | object | Any css style overrides |
Prop name | Type | Description |
---|---|---|
url | string | This can be used by itself with no other prop |
data | string | Base64 encoded string of file. If used, mimeType must also be provided |
mimeType | string | Type of the file |
name | string | Used to specify the filename when download button is clicked |
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
130 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More