ForgeComponents
en

Components

j-FileSaver

jComponent 20 · jcomponent@20 component Example loaded with jComponent 20

This component is a wrapper for the FileSaver.js library. With this component you can easily save locally generated files directly in the web browser.

  • singleton

Methods

  • component.save(filename, string/blob, [contentType])

Use it with <ui-component name="filesaver">. When the component is not loaded yet, jComponent downloads it on first use from the address in DEF.fallback (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

example.html
<ui-component name="LAZY filesaver"></ui-component>
<button>Save something</button>

<script>

	$(document).on('click', 'button', function() {
		SETTER('filesaver/save', 'totaljs.txt', 'Hello world!\n\nwww.totaljs.com');
	});

</script>