🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

react-file-viewer-v2

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-file-viewer-v2

Extendable file viewer for web

1.0.1
npm
Version published
Weekly downloads
109
14.74%
Maintainers
1
Weekly downloads
 
Created
Source

react-file-viewer-v2

Extendable file viewer for web

NPM JavaScript Style Guide

react-file-viewer-v2 is a small package for viewing files on the web inspired by react-file-viewer

Install

npm install --save react-file-viewer-v2

Supported file formats:

  • Images: png, jpeg, gif
  • pdf
  • docx
  • Video: mp4, webm
  • Audio: mp3

Usage

There is one main React component, FileViewer, that takes the following props:

fileType string: type of resource to be shown (one of the supported file formats, eg 'png'). Passing in an unsupported file type will result in displaying an unsupported file type message (or a custom component).

filePath string: the url of the resource to be shown by the FileViewer.

unsupportedComponent react element [optional]: A component to render in case the file format is not supported.

import React, { Component } from 'react'

import { FileViewer } from 'react-file-viewer-v2'

class Example extends Component {
  render() {
    return <FileViewer
      fileType="pdf"
      filePath={pdf}
    />
  }
}

License

MIT © javier-mora

FAQs

Package last updated on 25 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts