New to Kendo UI for Angular? Start a free 30-day trial
saveAs
Prompts the user to save a file with a specified name and content.
The saveAs function is designed to work with Data URIs and Blobs and save them as files on the client machine. Under the hood, saveAs either creates a link that is clicked or a form that is submitted to the proxy end point if a proxy is used.
- Saving a Blob with a proxy is not supported and will result in an error.
- To download files from a server endpoint, use the regular HTML5
downloadattribute on ananchortag to trigger the download.
js
import { saveAs, encodeBase64 } from '@progress/kendo-file-saver';
const dataURI = "data:text/plain;base64," + encodeBase64("Hello World!");
saveAs(dataURI, 'test.txt');
Parameters
data string | Blob
The content of the file as a Base64-encoded Data URI or a Blob.
fileName string
The desired file name.
options? SaveOptions
An optional proxy configuration to use during the file-saving operation. Ignored