I have a .list file containing information on movies. The file is formatted as follows
New Distribution Votes Rank Title
0000000125 1176527 9.2 The Shawshank Redemption (1994)
0000000125 817264 9.2 The Godfather (1972)
0000000124 538216 9.0 The Godfather: Part II (1974)
0000000124 1142277 8.9 The Dark Knight (2008)
0000000124 906356 8.9 Pulp Fiction (1994)
The code I have so far is as follows:
//modules ill be using
var fs = require('fs');
var csv = require('csv');
csv().from.path('files/info.txt', { delimiter: ' '})
.to.array(function(data){
console.log(data);
});
But because the values are separated by single spaces, double spaces and tabs. There is no single delimiter to use. How can I extract this information into an array?