Skip to content

Commit accff2b

Browse files
committed
initial commit
0 parents  commit accff2b

File tree

4 files changed

+84
-0
lines changed

4 files changed

+84
-0
lines changed

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Created by .gitignore support plugin (hsz.mobi)
2+
### Node template
3+
# Logs
4+
logs
5+
*.log
6+
7+
# Runtime data
8+
pids
9+
*.pid
10+
*.seed
11+
12+
# Directory for instrumented libs generated by jscoverage/JSCover
13+
lib-cov
14+
15+
# Coverage directory used by tools like istanbul
16+
coverage
17+
18+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
19+
.grunt
20+
21+
# node-waf configuration
22+
.lock-wscript
23+
24+
# Compiled binary addons (http://nodejs.org/api/addons.html)
25+
build/Release
26+
27+
# Dependency directory
28+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
29+
node_modules
30+
31+
.idea

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Cli Tool to extract html content from a eml file
2+
3+
## Usage
4+
5+
6+
```bash
7+
node parse.js -i /path/to/email.eml -o /path/to/email.html
8+
```

package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "eml_parser",
3+
"version": "1.0.0",
4+
"description": "Parse eml file and output html",
5+
"main": "parse.js",
6+
"dependencies": {
7+
"mailparser": "^0.4.6",
8+
"nomnom": "^1.8.1"
9+
},
10+
"devDependencies": {},
11+
"scripts": {
12+
"test": "echo \"Error: no test specified\" && exit 1"
13+
},
14+
"keywords": [
15+
"eml",
16+
"html"
17+
],
18+
"author": "Aco Mitevski",
19+
"license": "ISC"
20+
}

parse.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env node
2+
3+
var MailParser = require('mailparser').MailParser;
4+
var mailparser = new MailParser();
5+
var fs = require('fs');
6+
7+
var opts = require("nomnom")
8+
.option('infile', {
9+
abbr: 'i',
10+
required: true,
11+
help: 'Specify input file'
12+
})
13+
.option('outfile', {
14+
abbr: 'o',
15+
required: true,
16+
help: 'Specify output file'
17+
})
18+
.parse();
19+
20+
21+
mailparser.on("end", function(mail){
22+
fs.writeFileSync(opts.outfile, mail.html);
23+
});
24+
25+
fs.createReadStream(opts.infile).pipe(mailparser);

0 commit comments

Comments
 (0)