Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Commit

Permalink
package: move to csv.js.org
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Sep 28, 2018
1 parent 1bfa7d2 commit 42f29ca
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 40 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,7 @@

## Trunk

* package: move to csv.js.org
* samples: new cast sample
* package: upgrade to babel 7
* samples: new mixed api samples
Expand Down
22 changes: 10 additions & 12 deletions README.md
@@ -1,13 +1,15 @@
[![Build Status](https://api.travis-ci.org/adaltas/node-csv-parse.svg)](https://travis-ci.org/#!/adaltas/node-csv-parse)

Part of the [CSV module][csv_home], this project is a parser converting CSV text
input into arrays or objects. It implements the Node.js
[`stream.Transform` API][stream_transform]. It also provides a simple
callback-based API for convenience. It is both extremely easy to use and
powerful. It was first released in 2010 and is used against big data sets by a
large community.
Part of the [CSV module](https://csv.js.org/), this project is a parser converting CSV text input into arrays or objects. It implements the Node.js [`stream.Transform` API](http://nodejs.org/api/stream.html#stream_class_stream_transform). It also provides a simple callback-based API for convenience. It is both extremely easy to use and powerful. It was first released in 2010 and is used against big data sets by a large community.

[Documentation for the "csv-parse" package is available here][home].
## Documentation

* [Project homepage](http://localhost:8000/parse/)
* [API](http://localhost:8000/parse/api/)
* [Options](http://localhost:8000/parse/options/)
* [State properties](http://localhost:8000/parse/state/)
* [Common errors](http://localhost:8000/parse/errors/)
* [Examples](http://localhost:8000/parse/examples/)

## Features

Expand All @@ -19,8 +21,4 @@ large community.
* Complete test coverage and samples for inspiration
* no external dependencies
* to be used conjointly with `csv-generate`, `stream-transform` and `csv-stringify`
* BSD License

[home]: http://csv.adaltas.com/parse/
[csv_home]: https://github.com/wdavidw/node-csv
[stream_transform]: http://nodejs.org/api/stream.html#stream_class_stream_transform
* BSD License
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -30,7 +30,7 @@
"type": "git",
"url": "https://github.com/wdavidw/node-csv-parse"
},
"homepage": "http://csv.adaltas.com/parse/",
"homepage": "https://csv.js.org/parse/",
"devDependencies": {
"@babel/cli": "^7.1.0",
"@babel/core": "^7.1.0",
Expand Down
1 change: 0 additions & 1 deletion samples/mixed.input_stream.js
@@ -1,7 +1,6 @@

const parse = require('../lib')
const assert = require('assert')

// Create the parser
const parser = parse({
delimiter: ':'
Expand Down
39 changes: 14 additions & 25 deletions src/index.coffee.md
@@ -1,11 +1,9 @@

# CSV Parser

This module provides a CSV parser tested and used against large datasets. Over
the year, it has been enhance and is now full of useful options.
This module provides a CSV parser tested and used against large datasets. Over the year, it has been enhance and is now full of useful options.

Please look at the [README], the [project website][site] the [samples] and the
[tests] for additional information.
Please look at the [project website](https://csv.js.org/parse/) for additional information.

stream = require 'stream'
util = require 'util'
Expand All @@ -17,7 +15,7 @@ Callback approach, for ease of use:

`parse(data, [options], callback)`

[Node.js Stream API][stream], for maximum of power:
[Node.js Stream API](http://nodejs.org/api/stream.html), for maximum of power:

`parse([options], [callback])`

Expand Down Expand Up @@ -77,7 +75,7 @@ Callback approach, for ease of use:
## `Parser([options])`

Options are documented [here](http://csv.adaltas.com/parse/).
Options are documented [here](http://csv.js.org/parse/options/).

Parser = (options = {}) ->
# @options = options
Expand Down Expand Up @@ -144,30 +142,28 @@ Options are documented [here](http://csv.adaltas.com/parse/).
## Internal API

The Parser implement a [`stream.Transform` class][transform].
The Parser implement a [`stream.Transform` class](https://nodejs.org/api/stream.html#stream_class_stream_transform).

### Events

The library extends Node [EventEmitter][event] class and emit all
the events of the Writable and Readable [Stream API][stream].
The library extends Node [EventEmitter][event] class and emit all the events of the Writable and Readable [Stream API](http://nodejs.org/api/stream.html).

util.inherits Parser, stream.Transform
For extra flexibility, you can get access to the original Parser
class: `require('csv-parse').Parser`.
For extra flexibility, you can get access to the original Parser class: `require('csv-parse').Parser`.

module.exports.Parser = Parser
### `_transform(chunk, encoding, callback)`

* `chunk` Buffer | String
The chunk to be transformed. Will always be a buffer unless the decodeStrings option was set to false.
* `encoding` String
If the chunk is a string, then this is the encoding type. (Ignore if decodeStrings chunk is a buffer.)
* `callback` Function
Call this function (optionally with an error argument) when you are done processing the supplied chunk.
* `chunk` Buffer | String
The chunk to be transformed. Will always be a buffer unless the decodeStrings option was set to false.
* `encoding` String
If the chunk is a string, then this is the encoding type. (Ignore if decodeStrings chunk is a buffer.)
* `callback` Function
Call this function (optionally with an error argument) when you are done processing the supplied chunk.
Implementation of the [`stream.Transform` API][transform]
Implementation of the [`stream.Transform` API](https://nodejs.org/api/stream.html#stream_class_stream_transform)

Parser.prototype._transform = (chunk, encoding, callback) ->
setImmediate =>
Expand Down Expand Up @@ -486,10 +482,3 @@ Implementation of the [`stream.Transform` API][transform]
break if Object.getPrototypeOf( _test = Object.getPrototypeOf _test ) is null
Object.getPrototypeOf _obj is _test
)()
[readme]: https://github.com/wdavidw/node-csv-parse
[site]: http://csv.adaltas.com/parse/
[samples]: https://github.com/wdavidw/node-csv-parse/tree/master/samples
[tests]: https://github.com/wdavidw/node-csv-parse/tree/master/test
[stream]: (http://nodejs.org/api/stream.html
[transform]: (http://nodejs.org/api/stream.html#stream_class_stream_transform_1)
4 changes: 3 additions & 1 deletion src/sync.coffee.md
Expand Up @@ -3,7 +3,9 @@

Provides a synchronous alternative to the CSV parser.

Usage: `const records = parse(data, [options]`
## Usage

`const records = parse(data, [options]`

{StringDecoder} = require 'string_decoder'
parse = require './index'
Expand Down

0 comments on commit 42f29ca

Please sign in to comment.