-
Book Overview & Buying
-
Table Of Contents
Coffeescript Application Development Cookbook
By :
In this recipe, we will parse a fixed-width file by creating a simple streaming parser. Our sample file will contain fixed-width columns of strings, numbers, dates, and Boolean values of accounting data. Our goal is to count the records and get a total credit and debit amount for all records that have been posted.
Our sample file looks like the following:

In this section, we will create our own parser for fixed-width files. When considering the features we would like for our basic parser, it should:
We will use Node's built-in stream reader to read our data files.
We will create our schema as an array of column objects. Each column has a name, starting position (start), size, and type. Supported type values include string, float, date, and Boolean.
Because of the variety of date and number...
Change the font size
Change margin width
Change background colour