DefinitelyTyped/types/line-by-line/line-by-line-tests.ts
Sean Roach 129ec7b668 [@types/line-by-line] Fixed stream use case (#35152)
* Overhauled the line-by-line package to be accurate.

The prior version of @types/line-by-line did not properly represent the
options used in creating a LineByLineReader and did not represent the
stream compatibility the package has. This overhauls the declaration
file to represent the package in both its use case of reading files and
readable streams, as well as supplying documentation as found on the
package's README.md.

* Overhauled the line-by-line package to be accurate

The prior version of @types/line-by-line did not properly represent the
options used in creating a LineByLineReader and did not represent the
stream compatibility the package has. This overhauls the declaration
file to represent the package in both its use case of reading files and
readable streams, as well as supplying documentation as found on the
package's README.md.

* Fixed code to conform to dtslint
2019-05-13 10:08:50 -07:00

8 lines
294 B
TypeScript

import LineByLineReader = require("line-by-line");
const reader = new LineByLineReader("index.d.ts");
reader.on("end", () => console.log("end"));
reader.on("error", (err) => { throw new Error("Uh oh!~ There was an error reading the file"); });
reader.on("line", (line) => console.log(line));