Skip to content

Instantly share code, notes, and snippets.

@mvasilkov
Created October 25, 2012 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvasilkov/3953539 to your computer and use it in GitHub Desktop.
Save mvasilkov/3953539 to your computer and use it in GitHub Desktop.
FAILSYSTEM lol
function everythingIsRuinedForever(error) {
console.log(error)
}
- function(filename) {
var quota = 1 << 24
webkitStorageInfo.requestQuota(PERSISTENT, quota, function(bytes) {
webkitRequestFileSystem(PERSISTENT, bytes, function(fs) {
console.log(fs.name)
var req = new XMLHttpRequest
req.responseType = 'blob'
req.onload = function(event) {
fs.root.getFile(filename, {create: 1}, function(f) {
f.createWriter(function(file) {
file.onwriteend = function() {
var i = new Image
i.src = f.toURL()
document.body.appendChild(i)
console.log('failsystem: all done')
}
file.write(req.response)
}, everythingIsRuinedForever)
}, everythingIsRuinedForever)
}
req.open('get', filename)
req.send()
})
})
}('animooted.gif')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment