You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`delimiter` | `String` | `,` | The character that separates between cells.
29
+
`allowSpecialQuotes` | `Boolean` | `true` | Should quotes be treated as a special character that wraps cells.
30
+
`quote` | `String` | `"` | If `allowSpecialQuotes` is true, this will specify the quote character.
31
+
`skipComments` | `Boolean | String` | `false` | If true, lines which begin with # will be skipped. To use a custom character passe it as a sring.
32
+
`skipLines` | `Number` | `0` | Specifies the number of lines at the beginning of the file to skip over.
28
33
`skipEmptyLines` | `Boolean` | `false` | Should empty lines be automatically skipped?
29
-
`skipHeader` | `Boolean` | `false` | Should the first header row be skipped?
30
-
`rowAsObject` | `Boolean` | `false` | If true, each row will be converted automatically to an object based on the header. This implied `skipHeader=true`.
31
34
`parseNumbers` | `Boolean` | `false` | Should numbers be automatically parsed? This will parse any format supported by `parseFloat`.
32
35
`parseBooleans` | `Boolean` | `false` | Automatically parse booleans (Auto conversion to lowercase `true` and `false`).
`trim` | `Boolean` | `false` | If true, then both 'ltrim' and 'rtrim' are set to true.
38
+
`trim` | `Boolean` | `false` | If true, trim all columns.
39
+
`maxRowBytes` | `Number` | `MAX_ROW_BYTES` | Specifies the maximum number of bytes per row, the default value is on 10 peta byte.
40
+
`rowAsObject` | `Boolean` | `false` | If true, each row will be converted automatically to an object based on the header. This implies `skipLines=1 & strict=true`.
41
+
`strict` | `Boolean` | `false` | If true, the number of columns in each row must match the number of headers.
36
42
`errorLog` | `Boolean` | `false` | If true, errors will be logged to the console whether the `error` event is used or not.
37
43
38
44
## Events:
39
45
40
46
A `'row'` event will be emitted with each row, either in an array format (`(string|number|boolean)[]`) or an Object format (`Object<string, (string|number|boolean)>`), depending on the `rowAsObject` option.
41
47
A preliminary `'header'` event will be emitted with the first row, only in an array format.
42
-
Another 2 events usefull events: `finish` and `error`.
48
+
2 more usefull events: `finish` and `error`.
43
49
44
-
## Usage example:
50
+
## Basic usage example:
51
+
52
+
Suppose you have a CSV file data.csv which contains the data:
53
+
54
+
```
55
+
Name, Age
56
+
Jone Doe,24
57
+
Tom Doe,22
58
+
```
59
+
60
+
It could then be parsed, and results shown like so:
0 commit comments