From f1cf93c7a5c792feaa878be039111860ced52b3f Mon Sep 17 00:00:00 2001 From: Martin Fogelman Date: Tue, 11 Jul 2017 14:34:21 -0400 Subject: [PATCH] Adding Nodejs example usage + parser --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index 4bf0329..6204d9d 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,33 @@ def reject_email_blacklist end end ``` +**NodeJs ** contributed by @martin-fogelman +```Node +'use strict'; + +const readline = require('readline'), + fs = require('fs'); + +const input = fs.createReadStream('./disposable_email_blacklist.conf'), + output = [], + rl = readline.createInterface({input}); + +// PROCESS LINES +rl.on('line', (line) => { + console.log(`Processing line ${output.length}`); + output.push(line); +}); + +// SAVE AS JSON +rl.on('close', () => { + try { + const json = JSON.stringify(output); + fs.writeFile('disposable_email_blacklist.json', json, () => console.log('--- FINISHED ---')); + } catch (e) { + console.log(e); + } +}); +``` Contributing ============