Hello, long time no see! :
Nomkid and I are working on a program that one core feature is to parse and index file to multiple program readable arrays, separated at each time a line contains a certain content.
This is written in node.js :
Code:
^^^ that's what i have right now.
My intention is to split the massive array (index_filtered), into smaller and more program readable mini array chunks at each time a line starts with certain characters.
how would we go about doing this, would i use a regex like :
Code:
but that works to no avail, (it returns -1).
any help would be greatly appreciated
Nomkid and I are working on a program that one core feature is to parse and index file to multiple program readable arrays, separated at each time a line contains a certain content.
This is written in node.js :
Code:
const fs = require('fs');
const homedir = require('os').homedir();
const prgmdir = homedir+'/.program_name';
const tmpdir = prgmdir+'/tmp';
const indexcache = tmpdir+'/master.index'
var index = fs.readFileSync(indexcache).toString();
index = index.split('\n');
var index_filtered = index.filter(Boolean);
console.log(index_filtered);
^^^ that's what i have right now.
My intention is to split the massive array (index_filtered), into smaller and more program readable mini array chunks at each time a line starts with certain characters.
how would we go about doing this, would i use a regex like :
Code:
var index_lbls = index_filtered.indexOf(/Index of /gi);
but that works to no avail, (it returns -1).
any help would be greatly appreciated