javascript write to text file stack overflow

Solutions on MaxInterview for javascript write to text file stack overflow by the best coders in the world

showing results for - "javascript write to text file stack overflow"
Lilli
28 Feb 2018
1var textFile = null,
2  makeTextFile = function (text) {
3    var data = new Blob([text], {type: 'text/plain'});
4
5    // If we are replacing a previously generated file we need to
6    // manually revoke the object URL to avoid memory leaks.
7    if (textFile !== null) {
8      window.URL.revokeObjectURL(textFile);
9    }
10
11    textFile = window.URL.createObjectURL(data);
12
13    // returns a URL you can use as a href
14    return textFile;
15  };