1.0.0 • Published 10 years ago
imweb-filestorage v1.0.0
imweb-filestorage
filestorage
install
npm install-imweb-filestorageAPI
- fileStorage.js
- v0.1.0 - 2014-07-27
- written by Aaron Ou
- FileStorage.load(url, opts)
- url - String
- opts - object(optional)
expire - Number(in seconds) - 1814400(as 21 days) - the time length the file should be storageexecute - Boolean - true - whether execute the script once it's loadednoCache - Boolean - false - do not use cacherefresh - Boolean - false - refresh the storagecors - Boolean - false - whether add crossorigin attribute to script tag if it comes to use script tag to load the filecb - Function - function(err, info){} - callback once it's doneerr - Event - null - if there is an error, it will not be nullopts - Objecttime - Number(in microseconds) - the time spend on loading the scriptfrom - where this script coming from, its value and meaning is written at FileStorage.FROMurl - String - the url you request- FileStorage.clear()
just clear all localStorage- FileStorage.config(opts)
configure default settings for FileStorage, should be call before FileStorage.loadopts - Objecttimeout - Number(in microseconds) - 30000(as 30s) - ajax timeout for fetchingexpire - Number(in seconds) - 1814400(as 21 days) - the time length the file should be storageclearExpireTimeout - Number(in microseconds) - 10000(as 10s) - when to try clearing the expire file- FileStorage.FROM
return ObjectFile: 'file' // means loaded from regular script tag with srcSTORAGE: 'storage' // means loaded from localStorageFETCH: 'fetch' // means loaded from ajax call
1.0.0
10 years ago