Created
          February 13, 2020 12:28 
        
      - 
      
 - 
        
Save alexalannunes/ae536871bb3cfaed1a2149036356bcda to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /** | |
| * download de um arquivo | |
| * | |
| * @param {Blob} file | |
| * @example | |
| * ... | |
| * exec(response.data) | |
| * ... | |
| */ | |
| function exec(file, type = "text/csv") { | |
| var blob = new Blob([file], { type }); | |
| var filename = | |
| moment().format("Y_MM_D") + "_waves_" + Date.now().toString(16) + ".csv"; | |
| var link = document.createElement("a"); | |
| link.href = window.URL.createObjectURL(blob); | |
| link.download = filename; | |
| document.body.appendChild(link); | |
| link.click(); | |
| document.body.removeChild(link); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment