lz-string icon indicating copy to clipboard operation
lz-string copied to clipboard

Newbie question: How would I go about downloading / uploading a file?

Open justingolden21 opened this issue 3 years ago • 2 comments

Hi, I am currently storing user settings in a variable called settings (and in local storage) and was looking to allow the user to download and upload settings. I know how to download and upload a txt file with JS, but was wondering how to use this package in a way that would allow me to save the file as binary text. I'm guessing that if I just take the text output from compress() and throw it in a text file that it wouldn't work as well since the text file is encoding only specific characters, or maybe I need to change the encoding of the text file.

Basically, I don't want to make any dumb mistakes and lose the benefit of compression, please assist : )

justingolden21 avatar Jun 08 '22 06:06 justingolden21

Use the UTF8 mode to save it as text :-)

Uploading is more of a https://stackoverflow.com/ question :-)

Rycochet avatar Jun 08 '22 12:06 Rycochet

Perfect, thanks!

justingolden21 avatar Jun 09 '22 05:06 justingolden21