Socket
Book a DemoInstallSign in
Socket

file2jsonjs

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file2jsonjs

A simple Node.js package for reading CSV, Excel, and TXT files with flexible options, inspired by Python's pandas.

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

file2jsonjs

A simple Node.js package for reading CSV, Excel, and TXT files with flexible options, inspired by Python's pandas.

Features

  • Read CSV, Excel (.xlsx), and TXT files
  • Flexible options: custom headers, delimiter, skip lines, skip empty lines
  • Returns JSON array of objects mapped to headers

Usage

const { readCSV, readExcel, readTxt } = require('file2jsonjs');

// Example usage
const data = await readCSV({ filePath: 'data.csv', headers: ['col1', 'col2'], delimiter: ',', skipLines: 1, skipEmptyLines: true });

API

  • readCSV(options)
  • readExcel(options)
  • readTxt(options)

All options are optional:

  • filePath (string): Path to the file
  • headers (array): Array of header names
  • delimiter (string): Delimiter for CSV/TXT
  • skipLines (number): Number of lines to skip at the start
  • skipEmptyLines (boolean): Skip empty lines

License

MIT

Keywords

file

FAQs

Package last updated on 18 May 2025

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