0

Why this code inputs nothing? I'm trying to solve the 17th exercise (SECRETZ)

const concat = require('concat-stream')
const tar = require('tar');
const fs = require('fs')
const parser = new tar.Parse()
const crypto = require('crypto')

let name = process.argv[2];
let key = process.argv[3];
let vector = process.argv[4];
const stream = crypto.createDecipheriv(name, key, vector);
let hash = crypto.createHash('md5', {encoding: 'hex'})

process.stdin
.pipe(stream)
.pipe(hash)
.pipe(parser)
// .pipe(process.stdout);

parser.on('entry', (e) => {
    console.dir(e.type)
})

I don't get how these modules work like, so I don't get why it really gives nothing back;

  • instead of testing all stages of your chain-of-pipes, test the stdout side of them one-at-a-time to see which step causes your error – Robert Rowntree Dec 24 '20 at 14:29
  • Yes. Temporarily remove the .pipe(parser) part and everything related to it, and pipe to stdout instead. Also you are declaring concat and fs, which are not used at all in your sample. Try to do a minimal non-working example (reduce the problem). Explain also how you call the program (minimal reproducable example), and what is the error you get. – croraf Dec 24 '20 at 15:03
  • @croraf I don't get any errors, I get nothing at all, I mean, empty output RobertRowntree, croraf thanks it outputs some sort of hash number, I'll write more if get more about it! –  Dec 24 '20 at 18:35

0 Answers0