DEV Community

loading...

NodeJS Line Reader

Joe Enos
Software developer/architect, mostly working with .NET and SQL Server.
・1 min read

Here's a simple way to use NodeJS to read lines from a textfile and do something with them.

It's reasonably straightforward, although not as straightforward as doing it in a language like C#.

You define a line reader from the readline package, and then subscribe to two events: line and close. From there, it's straight up ordinary JavaScript

Discussion (0)