save text file with javascript using fileSaver.js and Blob.js -


don't know if of knows javascript libraries save files.

basically code used following:

var bb = new blobbuilder(); bb.append(content); var filesaver = window.saveas(bb.getblob("text/plain;charset=utf-8"), "filename.txt"); 

but this:

var omyblob = new blob([content], { type : "text/plain", endings: "transparent"}); window.saveas(omyblob, "filename.txt"); 

either way, whatever use (if blobbuilder deprecated or blob), newlines aren't being displayed, saved under same line of text file.

do guys know why happening? tried using different contenttypes: text/plain, text/enricher, text/html...

none of seems work newlines. if make "alert(data)" want save in file, newlines there. when use library, looks parses newlines or something, dunno :( tried charsets well..

thanks in advance.

the "\r\n" char act new line character in content passed blob.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -