On my client side, I am creating some content and trying to download it using chrome.downloads.download. However, when the file is downloaded, the new lines are missing. I am adding new lines in the code snippet below:
lineContent += '\r\n';
I have also tried using '\r' or '\n', but none of these options seem to work. The document generated contains everything except for the new line characters. Any suggestions on why this might be happening?
I have verified that the issue is not related to the text editor, as I have tested with different editors.
// While debugging, the fileData appears to be multi-lined,
// but after downloading, the content becomes a single line.
chrome.downloads.download({
url: "data:text/plain," + fileData,
filename: 'file.txt',
conflictAction: "prompt",
saveAs: true,
}, function(downloadId) {
console.log("Downloaded item with ID", downloadId);
});