{"id":19383335,"url":"https://github.com/mdouchement/iosupport","last_synced_at":"2026-06-08T21:32:59.069Z","repository":{"id":25922668,"uuid":"29363757","full_name":"mdouchement/iosupport","owner":"mdouchement","description":"It provides some io supports for Golang","archived":false,"fork":false,"pushed_at":"2018-08-20T22:43:22.000Z","size":107,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-24T17:15:38.912Z","etag":null,"topics":["csv-reader","csv-sorter","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdouchement.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-16T19:18:05.000Z","updated_at":"2018-08-20T22:43:20.000Z","dependencies_parsed_at":"2022-07-27T05:46:29.871Z","dependency_job_id":null,"html_url":"https://github.com/mdouchement/iosupport","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mdouchement/iosupport","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdouchement%2Fiosupport","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdouchement%2Fiosupport/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdouchement%2Fiosupport/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdouchement%2Fiosupport/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdouchement","download_url":"https://codeload.github.com/mdouchement/iosupport/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdouchement%2Fiosupport/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34082130,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-reader","csv-sorter","golang"],"created_at":"2024-11-10T09:25:37.043Z","updated_at":"2026-06-08T21:32:59.051Z","avatar_url":"https://github.com/mdouchement.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iosupport\n[![CircleCI](https://circleci.com/gh/mdouchement/iosupport.svg?style=shield)](https://circleci.com/gh/mdouchement/iosupport)\n[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/mdouchement/iosupport)\n[![Go Report Card](https://goreportcard.com/badge/github.com/mdouchement/iosupport)](https://goreportcard.com/report/github.com/mdouchement/iosupport)\n[![License](https://img.shields.io/github/license/mdouchement/iosupport.svg)](http://opensource.org/licenses/MIT)\n\nIt provides some io supports for GoLang:\n- Read large files (line length and large amount of lines)\n- Parse CSV files according the RFC4180, but:\n  - It does not support `\\r\\n` in quoted field\n  - It does not support comment\n- Sort CSV on one or several columns\n\n## Usage\n\nIn order to start, go get this repository:\n\n```bash\n$ go get github.com/mdouchement/iosupport\n```\n\n### Example\n\n- Scanner \u0026 wc\n\n```go\npackage main\n\nimport(\n  \"os\"\n\n  \"github.com/mdouchement/iosupport\"\n)\n\nfunc main() {\n  // With local filesystem\n  file, _ := os.Open(\"my_file.txt\")\n  defer file.Close()\n\n  // Or with HDFS \"github.com/colinmarc/hdfs\"\n  // client, _ := hdfs.New(\"localhost:9000\")\n  // file, _ := client.Open(\"/iris.csv\")\n\n  // See scanner.go for more examples\n  sc := iosupport.NewScanner(file)\n  sc.EachString(func(line string, err error) {\n    check(err)\n    println(line)\n  })\n\n  // See wc.go for more examples\n  wc := iosupport.NewWordCount(file)\n  wc.Perform()\n  println(wc.Chars)\n  println(wc.Words)\n  println(wc.Lines)\n}\n\nfunc check(err error) {\n  if err != nil {\n    panic(err)\n  }\n}\n```\n\n- TSV sort\n\n```go\npackage main\n\nimport(\n  \"os\"\n\n  \"github.com/mdouchement/iosupport\"\n)\n\nfunc main() {\n  sc := func() *iosupport.Scanner {\n    file, _ := os.Open(\"iris.csv\")\n    // Or with HDFS \"github.com/colinmarc/hdfs\"\n    // client, _ := hdfs.New(\"localhost:9000\")\n    // file, _ := client.Open(\"/iris.csv\")\n    return iosupport.NewScanner(file)\n  }\n\n  // See tsv_indexer.go for more examples\n  indexer = iosupport.NewTsvIndexer(sc, iosupport.HasHeader(), iosupport.Separator(\",\"), iosupport.Fields(\"col2\", \"col1\")) // scanner, headerIsPresent, separator, fieldsForSorting\n  defer indexer.CloseIO()\n  err := indexer.Analyze() // creates lines index\n  check(err)\n  indexer.Sort() // sorts indexed lines\n  ofile, _ := os.Open(\"my_sorted.tsv\")\n  defer ofile.Close()\n  indexer.Transfer(ofile) // transfers the input TSV in sorted output TSV\n}\n\nfunc check(err error) {\n  if err != nil {\n    panic(err)\n  }\n}\n```\n\n## Tests\n\n- Installation\n\n```sh\n$ go get github.com/onsi/ginkgo/ginkgo\n$ go get github.com/onsi/gomega\n$ go get github.com/golang/mock/gomock\n```\n\n_ Run tests\n\n```sh\n# One shot\n$ ginko\n\n# With watch\n$ ginkgo watch\n```\n\n- Generate package test file\n\n```sh\n$ ginkgo bootstrap # set up a new ginkgo suite\n$ ginkgo generate my_file.go # will create a sample test file.  edit this file and add your tests then...\n```\n\n- Benchmarks\n\n```sh\n$ go test -run=NONE -bench=ParseFields\n```\n\n- Generate mocks\n\n```sh\n# go get github.com/golang/mock/mockgen\n$ mockgen -package=iosupport_test -source=storage_service.go -destination=storage_service_mock_test.go\n```\n\n## License\n\n**MIT**\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (git checkout -b my-new-feature)\n3. Commit your changes (git commit -am 'Add some feature')\n5. Push to the branch (git push origin my-new-feature)\n6. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdouchement%2Fiosupport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdouchement%2Fiosupport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdouchement%2Fiosupport/lists"}