string.md
October 8, 2016 ยท View on GitHub
In-memory string streams
import * as ez from 'ez-streams'
reader = ez.devices.string.reader(text, options)
creates an EZ reader that reads its chunks fromtext.
reader.read(_)will return the chunks asynchronously by default.
You can force synchronous delivery by settingoptions.synctotrue. The default chunk size is 1024. You can override it by passing achunkSizeoption.writer = ez.devices.string.writer(options)
creates an EZ writer that collects strings into a text buffer.
writer.write(_, data)will write asynchronously by default.
You can force synchronous write by settingoptions.synctotrue.writer.toString()returns the internal text buffer into which the strings have been collected.