New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

pdf-front-validator

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pdf-front-validator

This library was created to validate real type of a document PDF on front-end.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

PDF Front-end Validator


Overview   |    Install   

Overview

The PDF Front Validator library is a tool that simplifies the process of validating PDF files when developing front-end interfaces.

Use the main function to validate whether a file is in fact a PDF or whether it has been renamed with the pdf extension.

Technology

  • ⚛️ React 18
  • ⛑ TypeScript
  • ⛑ Vite
  • 📏 ESLint
  • 💖 Prettier

Install

NPM:

npm i pdf-front-validator

Yarn

yarn add pdf-front-validator

Usage

React example


import { validateFilePDF } from 'pdf-front-validator'

function App() {
  const selectedFile = e.target.files[0]

    validateFilePDF(selectedFile)
    .then((result) => {
      if (result !== undefined) {
        // It's a PDF file
      } else {
        // It's not a PDF file
      }
    })
    .catch((error) => {
      console.error("Error to validate PDF File. ln: 58 Error => ", error);
      return;
    });
}

Made with 💗 by Patrick Gratão

Keywords

frontend pdf

FAQs

Package last updated on 09 Feb 2024

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