10 lines
		
	
	
		
			281 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			10 lines
		
	
	
		
			281 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
"use strict";
 | 
						|
 | 
						|
function getSpeed(fileProgress) {
 | 
						|
  if (!fileProgress.bytesUploaded) return 0;
 | 
						|
  const timeElapsed = Date.now() - fileProgress.uploadStarted;
 | 
						|
  const uploadSpeed = fileProgress.bytesUploaded / (timeElapsed / 1000);
 | 
						|
  return uploadSpeed;
 | 
						|
}
 | 
						|
 | 
						|
module.exports = getSpeed; |