js save files
//javascript
function download(text, name, type) {
var a = document.getElementById("a");
var file = new Blob([text], {type: type});
a.href = URL.createObjectURL(file);
a.download = name;
}
//html
<a href="" id="a">click here to download your file</a>
<button onclick="download('file text', 'myfilename.txt', 'text/plain')">Create file</button>
Also in JavaScript:
- let in javascript
- how to filter an array of objects in javascript
- int to octal javascript
- convert to json python
- follow and unfollow node js button
- jqeury cdn
- react cdn
- how to reload a page in javascript
- how to use the map method in javascript
- javascript fastest loop
- angular this web site use cookie example
- date masking javascript to not allow /
- js time
- eslint disable block
- check if a variable is array in javascript
- optional chaining
- javascript canvas gamma correction
- React Hook "useEffect" is called in function
- adding cors parameters to extjs ajax
- node node_modules/protractor/bin/webdriver-manager update
- how to make page scroll to the top jsx
- check if word is in string javascript
- if condition in class angular 8
- react native webview postmessage example