storage?
0?
0?
storage?,database?
...
initiate code Toggle
var file = fileStorage({
Base: 'storage',
RequestQuota: 1073741824,
Permission: 1,
objectStore:{
name:'fileStorage',
version:1,
file:'file',
other:{
name:'otherName',option:{}
}
}
},
{
done: function(status) {
// NOTE: doneCallback!
// REVIEW: executed either success or fail!
},
fail: function(status) {
// NOTE: failCallback
// REVIEW: executed to warn the Browser does not support 'requestFileSystem'!
},
success: function(fs) {
// NOTE: successCallback
// REVIEW: Browser supports 'requestFileSystem' or 'IndexedDB'!
}
}
);
how download work!
file.download({
url: 'http://www.example.com/file.xml',
urlLocal: 'filename.xml',
// urlLocal===true -> file.xml
// readAs: 'createObjectURL',
// [readAsText,readAsArrayBuffer,readAsDataURL,readAsBinaryString]
// requestMethod: 'GET', [GET,POST]
// requestCache:false, [true]
before: function(xmlHttp){
},
progress: function(Percentage){
console.log(Percentage);
}
}).then(function(e){
console.log('success');
},function(e){
console.log('fail');
}).then(function(e){
console.log('done');
});
how save work!
file.save({
urlLocal: 'directory/filename.txt',
blob: new Blob(['this is plain text'], {type: 'text/plain; charset=utf-8'}),
// data: 'this is plain text',
// fileContent: 'this is plain text',
fileType: 'text/plain'
}).then(function(e){
console.log('success');
},function(e){
console.log('fail');
}).then(function(e){
console.log('done');
});
how open work!
file.open({
urlLocal: 'directory/filename.txt',
readAs: 'createObjectURL'
}).then(function(e){
console.log('success');
},function(e){
console.log('fail');
}).then(function(e){
console.log('done');
});
how delete work!
file.delete({
urlLocal: 'directory/filename.txt',
fileNotFound: true // fileNotFound if true return successCallback, even the file is not found!
}).then(function(e){
console.log('success');
},function(e){
console.log('fail');
}).then(function(e){
console.log('done');
});
how download then save work!
file.download({
url: 'http://www.example.com/file.xml',
urlLocal: true,
readAs: 'createObjectURL'
fileOption:{
create:true
},
before: function(xmlHttp){
xmlHttp.responseType='blob';
},
progress: function(Percentage){
console.log(Percentage);
}
}).then(function(e){
console.log('success');
},function(e){
console.log('fail');
}).then(function(e){
console.log('done');
});