I've seen this question a few times but all seem to ask questions differently than mine thus I'm having a few problems trying to wrap my head around how i'd handle what i'm trying to do.
I have a file that I create in node, basically a JSON object stringified.
I read the file like so :
fs.readFile('data.txt', 'utf-8', function (err, data) {
console.log(data.search("generated_images"));
if (err) {
return console.error(err);
}
});
How can I do a search on the text file I have and find every time generated_images has been used in there?
I'm basically trying to get the word generated_images then grab characters after it so...
Everytime generated_images is used, count 80 characters after and write it to a new array or new text file I can read.
fs.writeFile('data.txt', JSON.stringify(data), function(err) {)JSON.parse(data)to get json object and traverse object normally to get your job done.