forked from KEMT/zpwiki
Upload files to 'pages/students/2016/jan_holp/dp2021/zdrojove_subory'
This commit is contained in:
parent
84a1e6d6ad
commit
2703ed41cc
@ -0,0 +1,44 @@
|
||||
|
||||
const fs = require('fs');
|
||||
const readline = require('readline');
|
||||
|
||||
|
||||
var result = [];
|
||||
|
||||
|
||||
|
||||
const readInterface = readline.createInterface({
|
||||
input : fs.createReadStream('/home/elastic/BP/skweb/server/scnc2/answers'),
|
||||
console : false
|
||||
});
|
||||
|
||||
|
||||
readInterface.on('line', function(line){
|
||||
var tokens = line.split(" ");
|
||||
var id_query = parseInt(tokens[0]);
|
||||
var id_document = parseInt(tokens[1]);
|
||||
// console.log([id_query]);
|
||||
|
||||
if (!(id_query in result)){
|
||||
result[id_query]=[id_document];
|
||||
}
|
||||
else {
|
||||
result[id_query].push(id_document);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// console.log(result);
|
||||
});
|
||||
|
||||
|
||||
readInterface.on('close', function() {
|
||||
for (let i = 0 ; i < result.length; i++){
|
||||
|
||||
console.log(i);
|
||||
console.log(result[i]);
|
||||
}
|
||||
console.log("koniec");
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user