{"id":19322182,"url":"https://github.com/seddryck/pocketcsvreader","last_synced_at":"2025-11-04T22:03:05.110Z","repository":{"id":50382436,"uuid":"164512924","full_name":"Seddryck/PocketCsvReader","owner":"Seddryck","description":"PocketCsvReader is a library designed for parsing delimited flat files, such as CSV and TSV. Prioritizing simplicity and performance, it facilitates seamless reading and loading of file contents into a DataTable, Array of strings or through an IDataReader. Perfect for projects needing quick data ingestion with minimal configuration.","archived":false,"fork":false,"pushed_at":"2025-04-15T08:03:56.000Z","size":980,"stargazers_count":2,"open_issues_count":9,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-15T09:23:33.014Z","etag":null,"topics":["csv","csv-parser","csv-reader","delimited-files"],"latest_commit_sha":null,"homepage":"https://seddryck.github.io/PocketCsvReader/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Seddryck.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-01-07T23:20:09.000Z","updated_at":"2025-04-08T09:05:46.000Z","dependencies_parsed_at":"2025-02-09T12:20:40.800Z","dependency_job_id":"cc227ea3-7f22-4e4e-b44d-c09da276aa7a","html_url":"https://github.com/Seddryck/PocketCsvReader","commit_stats":{"total_commits":19,"total_committers":2,"mean_commits":9.5,"dds":"0.052631578947368474","last_synced_commit":"dda74a264c635d09c1cf8dbc14097eb9c7a8d34f"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seddryck%2FPocketCsvReader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seddryck%2FPocketCsvReader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seddryck%2FPocketCsvReader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seddryck%2FPocketCsvReader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Seddryck","download_url":"https://codeload.github.com/Seddryck/PocketCsvReader/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250308340,"owners_count":21409252,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv","csv-parser","csv-reader","delimited-files"],"created_at":"2024-11-10T01:40:28.936Z","updated_at":"2025-11-04T22:03:00.078Z","avatar_url":"https://github.com/Seddryck.png","language":"C#","readme":"# PocketCsvReader\n\n![Logo](https://github.com/Seddryck/PocketCsvReader/raw/main/assets/PocketCsvReader-icon-256.png)\n\nPocketCsvReader is a highly efficient and lightweight library tailored for parsing delimited flat files like CSV and TSV. With a focus on simplicity and performance, it offers seamless file reading and supports versatile outputs, including DataTables, string arrays, strongly-typed object mapping and an IDataReader interface. Designed for projects requiring rapid data ingestion with minimal configuration, PocketCsvReader is a dependable solution for handling structured flat-file data effortlessly.\n\n[About][] | [Install][] | [Quick-start][]\n\n[About]: #about (About)\n[Install]: #install (Install)\n[Quick-start]: #quick-start (Quick-start)\n\n## About\n\n**Social media:** [![website](https://img.shields.io/badge/website-seddryck.github.io/PocketCsvReader-fe762d.svg)](https://seddryck.github.io/PocketCsvReader)\n[![twitter badge](https://img.shields.io/badge/twitter%20PocketCsvReader-@Seddryck-blue.svg?style=flat\u0026logo=twitter)](https://twitter.com/Seddryck)\n\n**Releases:** [![GitHub releases](https://img.shields.io/github/v/release/seddryck/PocketCsvReader?label=GitHub%20releases)](https://github.com/seddryck/PocketCsvReader/releases/latest) \n[![nuget](https://img.shields.io/nuget/v/PocketCsvReader.svg)](https://www.nuget.org/packages/PocketCsvReader/) [![GitHub Release Date](https://img.shields.io/github/release-date/seddryck/PocketCsvReader.svg)](https://github.com/Seddryck/PocketCsvReader/releases/latest) [![licence badge](https://img.shields.io/badge/License-Apache%202.0-yellow.svg)](https://github.com/Seddryck/PocketCsvReader/blob/master/LICENSE) \n\n**Dev. activity:** [![GitHub last commit](https://img.shields.io/github/last-commit/Seddryck/PocketCsvReader.svg)](https://github.com/Seddryck/PocketCsvReader/commits)\n![Still maintained](https://img.shields.io/maintenance/yes/2025.svg)\n![GitHub commit activity](https://img.shields.io/github/commit-activity/y/Seddryck/PocketCsvReader)\n\n**Continuous integration builds:** [![Build status](https://ci.appveyor.com/api/projects/status/t3d6qtln4hcjyrkl?svg=true)](https://ci.appveyor.com/project/Seddryck/PocketCsvReader/)\n[![Tests](https://img.shields.io/appveyor/tests/seddryck/PocketCsvReader.svg)](https://ci.appveyor.com/project/Seddryck/PocketCsvReader/build/tests)\n[![CodeFactor](https://www.codefactor.io/repository/github/seddryck/PocketCsvReader/badge)](https://www.codefactor.io/repository/github/seddryck/PocketCsvReader)\n[![codecov](https://codecov.io/github/Seddryck/PocketCsvReader/branch/main/graph/badge.svg?token=PCRL1Y6JVR)](https://codecov.io/github/Seddryck/PocketCsvReader)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FSeddryck%2FPocketCsvReader.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FSeddryck%2FPocketCsvReader?ref=badge_shield)\n\n**Status:** [![stars badge](https://img.shields.io/github/stars/Seddryck/PocketCsvReader.svg)](https://github.com/Seddryck/PocketCsvReader/stargazers)\n[![Bugs badge](https://img.shields.io/github/issues/Seddryck/PocketCsvReader/bug.svg?color=red\u0026label=Bugs)](https://github.com/Seddryck/PocketCsvReader/issues?utf8=%E2%9C%93\u0026q=is:issue+is:open+label:bug+)\n[![Top language](https://img.shields.io/github/languages/top/seddryck/PocketCsvReader.svg)](https://github.com/Seddryck/PocketCsvReader/search?l=C%23)\n\n## Install\n\nReplace `\u003cVersionNumber\u003e` with the desired version in each of the following solutions. If no version is specified, the latest version will be installed.\n\n### NuGet CLI\n\n1. Open a command prompt or terminal.\n2. Run the following command:\n\n   ```bash\n   nuget install PocketCsvReader -Version \u003cVersionNumber\u003e\n   ```\n   \n## Visual Studio Package Manager Console\n\n1. Open the **Package Manager Console** from **Tools \u003e NuGet Package Manager \u003e Package Manager Console**.\n2. Run the following command:\n\n   ```powershell\n   Install-Package PocketCsvReader -Version \u003cVersionNumber\u003e\n   ```\n## Dotnet-CLI\n\n1. Open a terminal or command prompt.\n2. Navigate to the directory of your project.\n3. Run the following command:\n\n   ```bash\n   dotnet add package PocketCsvReader --version \u003cVersionNumber\u003e\n   ```\n## Quick-start\n\nThe `CsvReader` class is a flexible and efficient tool for reading and parsing CSV files or streams into various formats, such as `DataTable`, `IDataReader`, or strongly-typed objects. This documentation explains the basics of how to use the class, including common use cases and examples.\n\n### Features\n\n- Read CSV files or streams into a `DataTable`.\n- Access CSV data in a forward-only, read-only manner using `IDataReader`.\n- Map CSV records to strongly-typed objects.\n- Map CSV records to array of strings.\n- Customizable CSV parsing profiles for delimiters, quote handling, and more.\n- Supports encoding detection through the `IEncodingDetector` interface.\n\n### Initialization\n\nYou can create an instance of `CsvReader` with various configurations:\n\n```csharp\n// Default configuration: comma-delimited, double quotes for escaping, 4 KB buffer size.\nvar csvReader = new CsvReader();\n\n// Custom CSV profile (e.g., semicolon-delimited, double quotes for escaping).\nvar csvReaderWithProfile = new CsvReader(CsvProfile.SemiColumnDoubleQuote);\n\n// Custom buffer size for large files.\nvar csvReaderWithBuffer = new CsvReader(bufferSize: 64 * 1024);\n\n// Both custom profile and buffer size.\nvar csvReaderCustom = new CsvReader(CsvProfile.SemiColumnDoubleQuote, bufferSize: 16 * 1024);\n```\n\n### Reading CSV Data\n\n#### Reading Into a `DataTable`\n\nThe `ToDataTable` method reads CSV data and returns a `DataTable` containing all rows and fields.\n\n```csharp\nDataTable dataTable = csvReader.ToDataTable(\"example.csv\");\n```\n\nor to read from a stream,\n\n```csharp\nusing var stream = new FileStream(\"example.csv\", FileMode.Open, FileAccess.Read);\nDataTable dataTable = csvReader.ToDataTable(stream);\n```\n\n### Accessing Data with `IDataReader`\n\nThe `ToDataReader` method provides a forward-only, read-only `CsvDataReader` implementing `IDataReader` for processing large files efficiently.\n\n```csharp\nusing var stream = new FileStream(\"example.csv\", FileMode.Open, FileAccess.Read);\nusing var reader = csvReader.ToDataReader(stream);\nwhile (reader.Read())\n{\n    Console.WriteLine(reader[0]); // Access the first column of the current row.\n    Console.WriteLine(reader.GetDateTime(1)); // Access the second column of the current row as an object boxing a DateTime.\n    Console.WriteLine(reader.GetFieldValue\u003cDateOnly\u003e(2); // Access the third column of the current row as DateOnly.\n}\n```\n\n### Reading as Arrays\n\n```csharp\nusing var stream = new FileStream(\"example.csv\", FileMode.Open, FileAccess.Read);\nforeach (var record in csvReader.ToArrayString(stream))\n{\n    Console.WriteLine(string.Join(\", \", record));\n}\n```\n\n### Mapping Records to Strongly-Typed Objects\n\nThe `To\u003cT\u003e` method maps CSV records to objects of a specified type.\n\n```csharp\npublic class Person\n{\n    public string FirstName { get; set; }\n    public string LastName { get; set; }\n    public int Age { get; set; }\n}\n\nusing var stream = new FileStream(\"example.csv\", FileMode.Open, FileAccess.Read);\nIEnumerable\u003cPerson\u003e people = csvReader.To\u003cPerson\u003e(stream);\n\nforeach (var person in people)\n{\n    Console.WriteLine($\"{person.FirstName} {person.LastName}, Age: {person.Age}\");\n}\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseddryck%2Fpocketcsvreader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseddryck%2Fpocketcsvreader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseddryck%2Fpocketcsvreader/lists"}