SaveOptions
An interface which defines the configuration options for the saveAs
function.
import { saveAs } from '@progress/kendo-file-saver';
const dataURI = "data:text/plain;base64," + encodeBase64("Hello World!");
saveAs(dataURI, 'test.txt', {
forceProxy: true,
proxyURL: '/save-handler',
proxyData: {
'__RequestVerificationToken': 'xyz'
}
});
Members
foceProxy? boolean
If set to true
, the content is forwarded to proxyURL
even if the browser supports the local saving of files. By default, the value is false
.
proxyURL? string
The URL of the server-side proxy which streams the file to the end user. When the browser is not capable of saving files locally, the proxy will be used. Such browsers are Internet Explorer v9 or earlier, and Safari. It is the developer who is responsible for the implementation of the server-side proxy.
The proxy receives a POST
request with the following parameters in the request body:
contentType
—The MIME type of the file.base64
—The Base64-encoded file content.fileName
&mdashh;The file name as requested by the caller.- Additional fields which are set through the optional
proxyData
.
The proxy returns the decoded file with a set "Content-Disposition"
header.
proxyTarget? string
A name or keyword which indicates where to display the document that is returned from the proxy. By default, the value is _self
. To display the document in a new window or an iframe, the proxy has to set the "Content-Disposition"
header to inline; filename="<fileName.ext>"
.
proxyData? { [key: string]: string }
A key/value dictionary of form
values that will be sent to the proxy. Can be used to submit anti-Forgery tokens and other metadata.