npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nresume

v1.1.2

Published

A parser to parse resume into JSON format for any esm based platform like React, Next.js, Vanilla JS etc.

Downloads

148

Readme

Nresume

This project is a Resume Parser that extracts structured information such as job titles, companies, dates, and descriptions from resume PDFs. It processes resumes in the Browser environments, making it flexible for different use cases. The extracted data is returned in a JSON format, which can be used for further processing or storage.

Installation

npm install nresume

Considerations

Nresume assumes some basic structure in the resume PDFs, such as the use of headings for job titles and companies, and bullet points for descriptions.The parser uses a combination of regular expressions and feature scoring to identify the most relevant information. However, the parser may not work as expected for resumes with complex layouts or unconventional formats.

Right now it only supports Single column resumes, the below picture is the structure of the resume that nresume assumes.

image

But what about Projects section well projects can have way too many variations, so it's hard to predict the structure of the project section in the resume, so for now, the parser doesn't support the project section.

Features

  • Feature Scoring: Uses feature scoring logic to identify the most relevant information (titles, companies, dates) based on certain patterns.
  • Bullet Point Detection: Identifies and extracts descriptions from bullet points within the resume.
  • Flexible Environment: Works on browser for client-side use.

Usage

In the Browser (Client-Side)

For Next.js

For Next.js, you can use the following code snippet to parse a resume PDF file and display the extracted data in a React component: There is also a complete example in the examples/nextjs/src/app/page.tsx.

"use client";

import { parseResumeFromFile, pdfjs } from 'nresume';
import { useState } from 'react';

// Polyfill for `Promise.withResolvers`, which is required for Next.js builds on Vercel
if (typeof Promise.withResolvers === 'undefined') {
  if (typeof window !== 'undefined') {
    // @ts-expect-error Polyfilling Promise.withResolvers
    window.Promise.withResolvers = function () {
      let resolve, reject;
      const promise = new Promise((res, rej) => {
        resolve = res;
        reject = rej;
      });
      return { promise, resolve, reject };
    };
  } else {
    // @ts-expect-error Polyfilling Promise.withResolvers
    global.Promise.withResolvers = function () {
      let resolve, reject;
      const promise = new Promise((res, rej) => {
        resolve = res;
        reject = rej;
      });
      return { promise, resolve, reject };
    };
  }
}

// Configure pdf.js worker for the parser the version must be 4.7.76 as the parser is built on top of this version.
pdfjs.GlobalWorkerOptions.workerSrc = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.7.76/pdf.worker.min.mjs`;

export default function Home() {
    const [resumeData, setResumeData] = useState(null);

    const handleFileChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
        const file = e.target.files?.[0];
        if (file) {
            try {
                const resume = await parseResumeFromFile(file);
                console.log(resume);
                setResumeData(resume);
            } catch (error) {
                console.error('Error parsing resume:', error);
                alert('Error parsing resume file');
            }
        }
    };

    return (
        <div className='flex flex-col items-center p-4'>
            <input type="file" onChange={handleFileChange} />
            <div className='mt-5 p-4 border border-gray-300 rounded w-full max-w-lg'>
                {resumeData ? (
                    <pre>{JSON.stringify(resumeData, null, 2)}</pre>
                ) : (
                    <p>Upload a resume PDF to see parsed data here.</p>
                )}
            </div>
        </div>
    );
}

For Vanilla JavaScript

import { parseResumeFromFile, pdfjs } from 'nresume';

// Need to get the worker from a CDN the version must be 4.7.76 as the parser is built on top of this version.
pdfjs.GlobalWorkerOptions.workerSrc = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/4.7.76/pdf.worker.min.mjs`;

// Handle file upload (for example, through an input element)
const fileInput = document
    .getElementById('fileInput')
    .addEventListener('change', async event => {
        const file = event.target.files[0];
        if (file) {
            try {
                const resumeData = await parseResumeFromFile(file);
                document.getElementById('output').textContent = JSON.stringify(
                    resumeData,
                    null,
                    2
                );
            } catch (error) {
                console.error('Error parsing resume:', error);
            }
        }
    });

Development

If you'd like to contribute or improve the project:

  1. Clone the repository:
git clone https://github.com/AvaterClasher/nresume.git
cd nresume
  1. Install dependencies:
npm install
  1. Build the package:
npm run build
  1. For using the package:
npm link

Contribution

Feel free to open issues, submit pull requests, or suggest improvements. Before contributing, ensure that the code adheres to the code style.

Credits

This project is inspired from the Open-Resume project but the feature scoring of that Open-Resume is much better than this project. Mainly due to fact that I wanted to write my own feature scroring logic.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Happy Parsing! 😊