Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

52
LINES

< > BotCompany Repo | #1018991 // Test LargeLocalStorage v2

HTML

<html>
<head>
<title>LargeLocalStorage Test</title>
</head>

<body>

<script src="http://tantaman.github.io/LargeLocalStorage/bower_components/jquery/jquery.js"></script>
<script src="http://tantaman.github.io/LargeLocalStorage/bower_components/q/q.js"></script>
<script src="http://tantaman.github.io/LargeLocalStorage/dist/LargeLocalStorage.js"></script>
<script src="http://tantaman.github.io/LargeLocalStorage/dist/contrib/URLCache.js"></script>
  
<script>

Q.longStackSupport = true;
Q.onerror = function(err) {
	console.log(err);
	throw err;
};

// Specify desired capacity in bytes
var desiredCapacity = 10 * 1024 * 1024;

console.log("Making LargeLocalStorage");

var storage = new LargeLocalStorage({size: desiredCapacity, name: 'lls-test'});

storage.initialized.then(function(capacity) {
  console.log('initialized with capacity: ' + capacity);

  var test1a1txt = '123asd';
  var blob = new Blob([test1a1txt], {type: 'text/plain'});
  
  console.log("Saving blob");
  
  storage.setAttachment('myDoc', 'titleImage2', blob).then(function() {
    console.log('finished setting the titleImage2 attachment');
  
    storage.getAttachment('myDoc', 'titleImage').then(function(blob) {
      console.log('Got blob back: ' + blob);
      var reader = new FileReader();
      reader.onload = function() {
        console.log('blob text: ' + reader.result);
      };
      reader.readAsText(blob);
    });
  });
});

</script>
</body>
</html>

Author comment

Began life as a copy of #1018986

download  render html  show line numbers   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018991
Snippet name: Test LargeLocalStorage v2
Eternal ID of this version: #1018991/14
Text MD5: 7ffc11e27a8f9e948098607babdb9dd4
Author: stefan
Category: javax / web
Type: HTML
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-19 17:29:42
Source code size: 1496 bytes / 52 lines
Pitched / IR pitched: No / No
Views / Downloads: 243 / 219
Version history: 13 change(s)
Referenced in: [show references]