17 return MAIN_THREAD_EM_ASM_INT({
18 let path = UTF8ToString($0);
19 let key =
"SL:" + path;
20 return localStorage.getItem(key) !==
null;
33 let path = UTF8ToString($0);
34 let key =
"SL:" + path;
35 let item = localStorage.getItem(key);
36 let
string = atob(item);
39 let buffer = _malloc(
string.length + 1);
40 stringToAscii(
string, buffer,
string.length + 1);
42 setValue($1, buffer,
"i8*");
43 setValue($2,
string.length,
"i32");
44 }, path.c_str(), &data, &length);
47 std::vector<char> vector(data, data + length);
64 const char* data = buffer.data();
65 size_t length = buffer.size();
69 let path = UTF8ToString($0);
70 let section = HEAPU8.subarray($1, $1 + $2);
72 let array =
new Uint8Array(section);
74 for(let i = 0; i < array.byteLength; i++)
75 binary += String.fromCharCode(array[i]);
77 let key =
"SL:" + path;
78 localStorage.setItem(key, btoa(binary));
79 },
_path.c_str(), data, length);
~SLIOReaderLocalStorage()
SLIOReaderLocalStorage(std::string path)
SLIOStream implementation for reading from memory.
SLIOWriterLocalStorage(std::string path)
SLIOStream implementation for reading to memory.
bool exists(std::string path)
std::vector< char > & get(std::string path)
void set(std::string path, const std::vector< char > &data)
void clear(std::string path)