I'm writing plugin for Gulp, and in order to process file i need to get it's full path. I used through2 package, then prepared processFile(file)
function, but as an argument from through2 it receives file in strange XML-like format instead of object like file.path
, file.encoding
and so on.
How can I receive file.path when through2 is returning each file in following format:
<File "relative/path/to/file/aaa.js" ...
Full code:
var through = require('through2');
module.exports = function() {
return through.obj(function(file, encoding, callback) {
function processFile(file){
console.log(file); // returns <File "relative/path/to/file/aaa.js" ...
}
callback(null, processFile(file));
});
};