How does gulp check which files are matched?

  node.js, question

I want to use it

gulp.src('./src/**/*.*')

Match all files in the src directory, and then judge the Filename extension. If it is css, compress CSS. If JS is CSS, compress JS. html compresses HTML. Other files are directly copied to other directories.

The problem is: I can’t judge Filename extension because I don’t know how to get which files to match and their file names. ..

Thank you, I have found the answer and wrote a blog post:
How does gulp check which files are matched
http://w3cc.cc/2016/05/27/gulp-how-to-read-file-name/