I'm working on a gulp task that want to debug some file and I want to read it in the console, for example.
It doesn't matter if it's by stream or by simple task. I try to print the content of the vinyl object... but without any good result
gulp.task('task', function(){
console.log( gulp.src('path/to/file.txt').content.toString() );
});
or through node
function sendTo(res) {
return through(
function write(data) { // this will be called once for each file
res.write(data.contents);
},
function end() { // this will be called when there are no more files
res.end()
}
);
}
gulp.task('task', function(res){
gulp.src('path/to/file.txt')
.pipe(sendTo(res));
});
or try to do it with fs node module with the same results...
fs.readFile('path/to/file.txt', {encoding: 'utf-8', flag: 'rs'}, function(e, data) {
if (e) return console.log(e);
console.log(data);
});
Any idea to print the content of the file ?