Skip to content

Instantly share code, notes, and snippets.

@nitinbhojwani
Created May 30, 2018 11:25
Show Gist options
  • Select an option

  • Save nitinbhojwani/5d4212e408bd46a7d9932499a4abe5f1 to your computer and use it in GitHub Desktop.

Select an option

Save nitinbhojwani/5d4212e408bd46a7d9932499a4abe5f1 to your computer and use it in GitHub Desktop.
Typescript to create and download file at client
downloadFile(dataToBeDownloaded): void {
let a = document.createElement("a");
let dataURI = "data:text/plain;base64," + btoa(dataToBeDownloaded);
a.href = dataURI;
a['download'] = this._sddcInformation.id + ".pem";
a.click();
a.remove();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment