Files and pipes are both examples of general Mathematica objects known as streams. A stream in Mathematica is a source of input or output.
When you open a file or a pipe, Mathematica creates a "stream object" that specifies the open stream associated with the file or pipe. In general, the stream object contains the name of the file or the external command used in a pipe, together with a unique number. The reason that the stream object needs to include a unique number is that in general you can have several streams connected to the same file or external program at the same time.