lib/static-asset.js
function assetFingerprint(label, fingerprint, cacheInfo) {
		if(arguments.length > 1)
		{
			//Add a label
			var labelInfo = labels[label] = {"fingerprint": fingerprint};
			if(cacheInfo)
				for(var i in cacheInfo)
					labelInfo[i] = cacheInfo[i];
		}
		else
		{
			//Try to get a fingerprint from a registered label
			var info = labels[label];
			if(info)
			{
				fingerprints[info.fingerprint] = info;
				return info.fingerprint;
			}
			else
			{
				info = {};
				//Try to get a fingerprint using the specified cache strategy
				var fullPath = path.resolve(rootPath + "/" + (label || this.url) );
				//Use the "cache strategy" to get a fingerprint
				//Prefer the use of etag over lastModified when generating fingerprints
				if(!fs.existsSync(fullPath) )
					return label;
				if(strategy.lastModified)
				{
					var mdate = info.lastModified = strategy.lastModified(fullPath);
					mdate.setMilliseconds(0);
				}
				if(strategy.etag)
					info.etag = strategy.etag(fullPath);
				if(strategy.expires)
					info.expires = strategy.expires(fullPath);
				if(strategy.fileFingerprint)
				{
					var fingerprint = strategy.fileFingerprint(label, fullPath);
					fingerprints[fingerprint] = info;
					return fingerprint;
				}
				else
					return label; //Do not generate a fingerprint
			}
		}
	}
function assetFingerprint(label, fingerprint, cacheInfo) {
		if(arguments.length > 1)
		{
			//Add a label
			var labelInfo = labels[label] = {"fingerprint": fingerprint};
			if(cacheInfo)
				for(var i in cacheInfo)
					labelInfo[i] = cacheInfo[i];
		}
		else
		{
			//Try to get a fingerprint from a registered label
			var info = labels[label];
			if(info)
			{
				fingerprints[info.fingerprint] = info;
				return info.fingerprint;
			}
			else
			{
				info = {};
				//Try to get a fingerprint using the specified cache strategy
				var fullPath = path.resolve(rootPath + "/" + (label || this.url) );
				//Use the "cache strategy" to get a fingerprint
				//Prefer the use of etag over lastModified when generating fingerprints
				if(!fs.existsSync(fullPath) )
					return label;
				if(strategy.lastModified)
				{
					var mdate = info.lastModified = strategy.lastModified(fullPath);
					mdate.setMilliseconds(0);
				}
				if(strategy.etag)
					info.etag = strategy.etag(fullPath);
				if(strategy.expires)
					info.expires = strategy.expires(fullPath);
				if(strategy.fileFingerprint)
				{
					var fingerprint = strategy.fileFingerprint(label, fullPath);
					fingerprints[fingerprint] = info;
					return fingerprint;
				}
				else
					return label; //Do not generate a fingerprint
			}
		}
	}
function assetFingerprint ( label , fingerprint , cacheInfo ) { if ( arguments . length > 1 ) { //Add a label var labelInfo = labels [ label ] = { "fingerprint" : fingerprint } ; if ( cacheInfo ) for ( var i in cacheInfo ) labelInfo [ i ] = cacheInfo [ i ] ; } else { //Try to get a fingerprint from a registered label var info = labels [ label ] ; if ( info ) { fingerprints [ info . fingerprint ] = info ; return info . fingerprint ; } else { info = { } ; //Try to get a fingerprint using the specified cache strategy var fullPath = path . resolve ( rootPath + "/" + ( label || this . url ) ) ; //Use the "cache strategy" to get a fingerprint //Prefer the use of etag over lastModified when generating fingerprints if ( ! fs . existsSync ( fullPath ) ) return label ; if ( strategy . lastModified ) { var mdate = info . lastModified = strategy . lastModified ( fullPath ) ; mdate . setMilliseconds ( 0 ) ; } if ( strategy . etag ) info . etag = strategy . etag ( fullPath ) ; if ( strategy . expires ) info . expires = strategy . expires ( fullPath ) ; if ( strategy . fileFingerprint ) { var fingerprint = strategy . fileFingerprint ( label , fullPath ) ; fingerprints [ fingerprint ] = info ; return fingerprint ; } else return label ; //Do not generate a fingerprint } } }
req.assetFingerprint function
req . assetFingerprint function