Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8c5c3c2

Browse files
Update README.md
1 parent 2743dc2 commit 8c5c3c2

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

‎README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,42 @@
11
# GEDCOM-file-to-JSON-using-Node-JS-with-ES6
2+
3+
1. npm install
4+
5+
2. node app.js
6+
7+
3. Run your localhost:8080
8+
9+
Description:
10+
This simple code will return the gedcom file to json using ES6.
11+
12+
Usage:
13+
------------------
14+
app.js
15+
------------------
16+
1. Set the Babel Register, To Convert your Ecmascript 6 code to ecmascript 5.
17+
---------------------------------------------------
18+
require('babel-register')({
19+
presets: [ 'es2015' ]
20+
});
21+
22+
2. Define the module(s), Where we use ES6.
23+
------------------------------------------
24+
require('./index.js');
25+
26+
index.js
27+
------------------
28+
1. import the header files.
29+
--------------------------------
30+
import http from 'http'; /*--- The HTTP module can create an HTTP server, It listen to server port 8080 ---*/
31+
import fs from 'fs'; /*--- Import File systems module -----*/
32+
import path from 'path'; /*--- Import Path module ------*/
33+
import gedcom from 'parse-gedcom'; /*--- Parse ged file use gedcom parse module ----*/
34+
35+
2. Define the method using Arrow function.
36+
--------------------------------------------
37+
http.createServer((req, res) => {
38+
fs.readFile(path.resolve(__dirname)+'/ged/ft.ged','utf-8',(err, data) => {
39+
var jsonArrayObj = JSON.stringify(gedcom.parse(data), null, 2);
40+
res.write(jsonArrayObj);
41+
});
42+
}).listen(8080);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /