Skip to content

Commit

Permalink
docs: add options to readme, add licence
Browse files Browse the repository at this point in the history
  • Loading branch information
alesmenzelsocialbakers committed Jan 16, 2021
1 parent 9c0be4b commit f5735d0
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
18 changes: 18 additions & 0 deletions LICENCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# The MIT Licence

Copyright (c) 2021 Ales Menzel <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the 'Software'), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@

Simple and elegant streaming `csv` parser.

Handles formats defined by [RFC4180](https://tools.ietf.org/html/rfc4180) but also works with format produced by PHP's fputcsv
Handles formats defined by [RFC4180](https://tools.ietf.org/html/rfc4180) but also works with format produced by PHP's [fputcsv](https://www.php.net/manual/en/function.fputcsv.php). Note in mind, that there is no defacto standard for CSV and different csv libraries create slightly different versions, for example some of them

- use comments in csv `# this is a comment`
- use escaping character instead of double quoting `"\""` (this is valid csv cell in PHP's version)
- use blank spaces after quoted fields `"abc" , "cde"`
- output different column count per each row

```csv
a,b,c
1,2
4,5,6
```

## Installation

Expand Down Expand Up @@ -36,3 +47,17 @@ csv.write('A,B,C\n')
csv.write('a,b,c\n')
csv.end('x,"Joe ""The Death"" Black",z\n')
```

## Options

| Option | Description | Default Value |
| -------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------- |
| `delimiter` | Single character that is used to delimit the cells in a row. | `,` |
| `rowDelimiter` | Single character that is used to delimit the rows in the input. | `\n` (optionally preceded by \r) |
| `quote` | Single character that is used to quote the value of a cell. | `"` |
| `escape` | Single character that is used to escape a character inside the cell. | `\` |
| `highWaterMark` and other transform stream options | Other options are passed to the underlaying Transform stream. | `-` |

## Licence

This package is developed under the [MIT licence](./LICENCE.md).

0 comments on commit f5735d0

Please sign in to comment.