Przeglądaj źródła

Tentative optimisation fichier ppf

Loquicom 5 lat temu
rodzic
commit
49758f106f
1 zmienionych plików z 26 dodań i 0 usunięć
  1. 26 0
      optimizer.js

+ 26 - 0
optimizer.js

@@ -0,0 +1,26 @@
+const readline = require('readline');
+const file = require('./src/file');
+const fs = file.fs;
+
+const path = './data/opti/';
+const source = './data/preprocess.ppf';
+let data = {};
+
+file.makedir(path);
+
+const reader = readline.createInterface({
+    input: fs.createReadStream(source)
+});
+reader.on('line', (line) => {
+    const group = JSON.parse(line);
+    group.forEach(auth => {
+        let coauth = JSON.parse(line);
+        coauth.splice(coauth.indexOf(auth), 1);
+        coauth.forEach(elt => {
+            file.append(path + auth, elt + '\n');
+        });
+    });
+});
+reader.on('close', () => {
+    console.log('Fin');
+});