1
0
Fork 0
mirror of https://github.com/demostf/demo.js synced 2026-06-04 00:54:14 +02:00

more granular parse modes

This commit is contained in:
Robin Appelman 2018-03-06 00:09:31 +01:00
commit 5aa5fe95fd
5 changed files with 36 additions and 16 deletions

View file

@ -1,3 +1,5 @@
import {ParseMode} from "../src/Demo";
const Demo = require('../index');
const fs = require('fs');
const argv = require('minimist')(process.argv.slice(2), {boolean: true});
@ -15,7 +17,7 @@ const echo = function (data) {
fs.readFile(argv._[0], function (err, data) {
if (err) throw err;
const demo = Demo.fromNodeBuffer(data);
const analyser = demo.getAnalyser(!argv.slow);
const analyser = demo.getAnalyser(argv.slow ? ParseMode.ENTITIES : ParseMode.MINIMAL);
const head = analyser.getHeader();
if (argv.head) {
echo(head);