
Research
wget to Wipeout: Malicious Go Modules Fetch Destructive Payload
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
UniParser is a powerful, lightweight Node.js library designed to handle parsing of multiple file formats—such as PDF, DOCX, TXT, HTML, and Markdown—and convert them into plain text with ease.
🚀 Say goodbye to file format limitations! UniParser extracts text content from all these formats, providing a consistent text output for your applications.
.docx
files.autoParse
function.To install UniParser, simply run:
npm install uniparser
If you’re working in a Node.js environment with CommonJS (CJS), use require()
to import UniParser:
const { autoParse, parsePDF, parseDOCX, parseTXT, parseHTML, parseMarkdown } = require('uniparser');
// Example: Automatically detect and parse a file
(async () => {
const parsedText = await autoParse('./path/to/sample-file.pdf');
console.log(parsedText);
})();
// Example: Parse specific file types
const pdfText = await parsePDF('./path/to/sample-file.pdf');
const docxText = await parseDOCX('./path/to/sample-file.docx');
const txtText = parseTXT('./path/to/sample-file.txt');
const htmlText = parseHTML('./path/to/sample-file.html');
const markdownText = parseMarkdown('./path/to/sample-file.md');
If you’re working in an ES Module environment (modern JavaScript), use import
to load the functions:
import { autoParse, parsePDF, parseDOCX, parseTXT, parseHTML, parseMarkdown } from 'uniparser';
// Example: Automatically detect and parse a file
(async () => {
const parsedText = await autoParse('./path/to/sample-file.pdf');
console.log(parsedText);
})();
// Example: Parse specific file types
const pdfText = await parsePDF('./path/to/sample-file.pdf');
const docxText = await parseDOCX('./path/to/sample-file.docx');
const txtText = parseTXT('./path/to/sample-file.txt');
const htmlText = parseHTML('./path/to/sample-file.html');
const markdownText = parseMarkdown('./path/to/sample-file.md');
For small files, you can use UniParser synchronously, but this should only be done for very lightweight files.
const { parseTXT, parseMarkdown } = require('uniparser');
// Synchronously read small text files
const txtContent = parseTXT('./path/to/sample-file.txt');
console.log(txtContent);
const markdownContent = parseMarkdown('./path/to/sample-file.md');
console.log(markdownContent);
import { parseTXT, parseMarkdown } from 'uniparser';
// Synchronously read small text files
const txtContent = parseTXT('./path/to/sample-file.txt');
console.log(txtContent);
const markdownContent = parseMarkdown('./path/to/sample-file.md');
console.log(markdownContent);
.pdf
): Converts PDF documents to plain text..docx
): Extracts text from Microsoft Word .docx
files..txt
): Reads plain text from simple text files..html
): Strips HTML tags and returns the text content..md
): Converts Markdown files to plain text, removing all formatting.autoParse
and processes them accordingly.Here's a quick example to get you started with DOCX parsing:
const { parseDOCX } = require('uniparser');
(async () => {
const docxText = await parseDOCX('./path/to/sample-file.docx');
console.log(docxText);
})();
import { parseDOCX } from 'uniparser';
(async () => {
const docxText = await parseDOCX('./path/to/sample-file.docx');
console.log(docxText);
})();
This project is licensed under the MIT License. See the LICENSE file for more information.
Contributions are welcome! If you'd like to improve UniParser, feel free to fork the repository and submit a pull request. We appreciate your feedback and contributions!
💡 UniParser makes it easier than ever to extract content from a wide range of file formats—Try it now and streamline your file processing tasks! 🌟
FAQs
A universal parser for PDF, DOCX, TXT, MD, and HTML files into text
The npm package uniparser receives a total of 2 weekly downloads. As such, uniparser popularity was classified as not popular.
We found that uniparser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.
Product
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.