I've got an application where i'd like to share data across windows. The data will almost always be less than 5MB but in some cases it may be 7MB or more. In order to share this data across windows I need to write the data to local storage in chunks, and once the data has been collected, replace it with the next chunk to be collected.
My question is. How do I calculate this with javascript? Not only do I need to calculate the byte size of the data, but I also need to calculate whatever head I will give the "packet" of data, so when it's received it can be concatenated to the right (incomplete) "packet" in the other windows. In local storage how do I figure out,
A. How much data is available?
and
B. How much space will my data take up?