Q: Can a custom folder structure be recommended for direct downloads without using a zip file?
My AngularJS application generates text files that need to be imported into a specific folder structure on a commercial machine. Is there a way to prompt users to save the file in this structure directly, rather than having to use a zip file?
Currently, we rely on zipping the files before download, but Windows users are experiencing difficulties with the extracted files when importing them (refer to this question). I am wondering if there is an alternative solution to avoid using a zip archive.
Here are some relevant details:
- Angular version: 5.2.10
- Zip Utility used in angular: JSZip 3.1.5
Code snippet using JSZip:
const zip = new JSZip();
zip.folder('FolderA/FolderB/FolderC').file('FILE.TXT', new File([contentString], 'TEMP.TXT', { type: 'text/plain' }));
zip.generateAsync({ type: 'blob' })
.then(function (content) {
saveAs(content, 'ZipFile.ZIP');
});