Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-file-preview-latest

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-file-preview-latest

React component to render and preview images, pdf and text files via file object or web url

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
559
increased by30%
Maintainers
1
Weekly downloads
 
Created
Source

react-file-preview-latest

React component to render and preview images, pdf and text files via file object or web url

Example

alt text

import React, { Component } from "react";
import FilePreview from "react-file-preview-latest";

class App extends Component {
  constructor() {
    super();
    this.state = {
      file: null,
    };
  }
  
  onError = (err) => console.log("Error:", err); // Write your own logic

  render() {
    return (
      <FilePreview
        type={"file"}
        file={this.state.file}
        onError={this.onError}
      />
    );
  }
}

export default App;

Install

npm install react-file-preview-latest

Props

type

It can be either file or url.


file

The file object of input[type="file"] element which needs to be previewed.


url

The url which needs to be previewed.


onError

A callback function to get detailed error.

License

MIT

Keywords

FAQs

Package last updated on 21 Jul 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc