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

csv-big

v1.0.3-np

Published

CSV-parse for handling large files, mainly through filtering out unnecessary data and sorting the most coherent ones

Downloads

17

Readme

🎉 csv-big

csvBig is a powerful Node.js library designed for processing and extracting data from large CSV files. It efficiently handles large CSV files using streaming, making it perfect for big data applications.

🚀 Installation

To get started with csvBig, install it via npm by running the following command in your project directory:

npm install csvBig

📖 Usage

Here’s how to use csvParseBig to process your CSV files.

Example Code

const csvBig = require('csvBig');

// Create an instance of the parser with the CSV file path and options
const parser = new csvBig('path/to/largefile.csv', {
    outputFilePath: 'output.json',
    maxLines: 1000,
    delimiter: ','
});

// Extract the first lines
parser.extractFirstLines(10).then((records) => {
    console.log('📄 First 10 records:', records);
});

// Extract lines that meet certain conditions
parser.extractWhere([
    { attribute: 'status', filter: value => value === 'active' }
], 50).then((records) => {
    console.log('✅ Filtered records:', records);
});

🛠️ Methods

extractFirstLines(numberOfLines)

Extracts the first numberOfLines lines from the CSV file.

Parameters:

  • numberOfLines (Number): Number of lines to extract.
  • Returns: A promise that resolves to an array of extracted records.

extractWhere(conditions, numberOfLines)

Extracts up to numberOfLines lines from the CSV file that meet the specified conditions.

Parameters:

  • conditions (Array): List of conditions where each condition is an object { attribute, filter }.
    • attribute (String): Name of the attribute to filter.
    • filter (Function): Filtering function that returns true or false for the given attribute.
  • numberOfLines (Number): Maximum number of lines to extract.
  • Returns: A promise that resolves to an array of extracted records.

⚙️ Constructor Options

  • inputFilePath (String): The path to the CSV file to be processed (required).
  • outputFilePath (String): The path to the output JSON file (optional, defaults to output.json).
  • maxLines (Number): Maximum number of lines to keep for full analysis (optional).
  • delimiter (String): Delimiter used in the CSV file (optional, defaults to ,).

📌 Notes

Ensure that the CSV file is properly formatted and that the column headers match the data.

🤝 Contributing

Contributions are welcome! If you have suggestions or corrections, please submit a pull request or open an issue on the project’s GitHub repository.

📄 License

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

👤 Authors

Khalil MEQQORI - Module Creator
For more information or any questions, please open an issue on the GitHub repository or contact us at [email protected].