code: function determineFilename(file) {
      var filename,
          filenameMatch;
  
      if (file.hasOwnProperty('httpVersion')) {
          // it's an http response
          // first let's check if there's a content-disposition header...
          if (file.headers['content-disposition']) {
              filenameMatch = /filename=(.*)/.exec(file.headers['content-disposition']);
              filename = filenameMatch[1];
          }
          if (!filename) {
              // try to get the path of the request url
              filename = path.basename(file.client._httpMessage.path);
          }
      } else if (file.path) {
          // it looks like a file, let's just get the path
          filename = path.basename(file.path);
      }
      return filename || 'untitled document';
  }
docs: Try to figure out the filename for the given file
  @param   {Stream} file The file stream
  @returns {string}      The guessed filename