-
Notifications
You must be signed in to change notification settings - Fork 9
/
parseFile.js
36 lines (35 loc) · 974 Bytes
/
parseFile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var parseLargeHtmlToRawSlot_1 = require("./src/core/parser/parseLargeHtmlToRawSlot");
/**
* This file is suppose to be run as script
* Type the following command in bash:
* node parseFile.js
*
* Remember to change the INPUT_FILENAME
*/
const INPUT_FILENAME = "./new.html";
function log(message) {
console.log(new Date() + " : " + message);
}
var fs = require("fs");
log("Loading file");
fs.readFile(INPUT_FILENAME, function (err, contents) {
if (err) {
log("Load file error");
log(err);
return;
}
log("Parsing");
var rawSlots2 = parseLargeHtmlToRawSlot_1.ParseLargeHtmlToRawSlot(
contents.toString()
);
log("Finish parsing");
fs.writeFile("./output.json", JSON.stringify(rawSlots2), function (err2) {
if (!err2) {
log("The file was saved as output.json");
}
});
log("File saved succesfully.");
});
//# sourceMappingURL=parseFile.js.map