aboutsummaryrefslogtreecommitdiff
path: root/src/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.js')
-rw-r--r--src/utils.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/utils.js b/src/utils.js
index 05e519d..3176400 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -42,7 +42,23 @@ function genYdk(deck) {
return ydkContent;
}
+function downloadStringAsFile(filename, text) {
+ const blob = new Blob([text], { type: 'text/plain' });
+ const link = document.createElement('a');
+ link.href = URL.createObjectURL(blob);
+ link.download = filename;
+ document.body.appendChild(link);
+
+ link.click();
+
+ document.body.removeChild(link);
+ URL.revokeObjectURL(link.href);
+}
+
+
export {
parseYdk,
genYdk,
+ downloadStringAsFile,
};
+