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

Commit

Permalink
document parse and stringify
Browse files Browse the repository at this point in the history
  • Loading branch information
dominictarr committed Jul 18, 2012
1 parent 15aa6e7 commit 3fa5f0c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,27 @@ Replace all occurences of `from` with `to`. `from` may be a `String` or a `RegEx
Works just like `string.split(from).join(to)`, but streaming.


## parse

Convienience function for parsing JSON chunks. For newline seperated JSON,
use with `es.split`

``` js
fs.createReadStream(filename)
.pipe(es.split()) //defaults to lines.
.pipe(es.parse())
```

## stringify

convert javascript objects into lines of text. The text will have whitespace escaped and have a `\n` appended, so it will be compatible with `es.parse`

``` js
objectStream
.pipe(es.stringify())
.pipe(fs.createWriteStream(filename))
```

##readable (asyncFunction)

create a readable stream (that respects pause) from an async function.
Expand Down

0 comments on commit 3fa5f0c

Please sign in to comment.