Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
amitevski committed Nov 25, 2014
0 parents commit accff2b
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Created by .gitignore support plugin (hsz.mobi)
### Node template
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules

.idea
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Cli Tool to extract html content from a eml file

## Usage


```bash
node parse.js -i /path/to/email.eml -o /path/to/email.html
```
20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "eml_parser",
"version": "1.0.0",
"description": "Parse eml file and output html",
"main": "parse.js",
"dependencies": {
"mailparser": "^0.4.6",
"nomnom": "^1.8.1"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"eml",
"html"
],
"author": "Aco Mitevski",
"license": "ISC"
}
25 changes: 25 additions & 0 deletions parse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env node

var MailParser = require('mailparser').MailParser;
var mailparser = new MailParser();
var fs = require('fs');

var opts = require("nomnom")
.option('infile', {
abbr: 'i',
required: true,
help: 'Specify input file'
})
.option('outfile', {
abbr: 'o',
required: true,
help: 'Specify output file'
})
.parse();


mailparser.on("end", function(mail){
fs.writeFileSync(opts.outfile, mail.html);
});

fs.createReadStream(opts.infile).pipe(mailparser);

0 comments on commit accff2b

Please sign in to comment.