i have some callbacks inside my promise:
var res = new Promise(resolve => {
console.log('trig1');
var out = fs.createWriteStream(pathToFile);
console.log('trig2');
out.on('finish', function() {
console.log('out finish')
})
out.on('close', function() {
console.log('out close')
})
out.on('error', function(err) {
console.log('out error: ' + err)
})
})
When i call this promise, it creates the file on the path and prints:
trig1
trig2
Nothing more. Why are my callbacks not executed?
Greetings and thanks