oustWebCache

A tool for caching remote files in memory


Keywords
cache, angularjs, website
License
BSD-3-Clause-LBNL
Install
bower install oustWebCache

Documentation

oustWebCache

In memory Caching of Remote Urls in the form of BLOB objects using fetch API

INSTRUCTIONS:

  1. Install the package using: bower install oustWebCache at the terminal
  2. Attach the js file 'oust-web-cache.js' as a reference in your main html file.
  3. Add 'oustWebCache' as a dependancy in your angular app.
  4. Inject 'webCacheManager' as a dependancy anywhere in your controller, service, etc.

MODELS:

  • File : Properties -
  1. fileName
  2. url

METHODS:

  • webCacheManager.queueDownload() Argument(s): File(object) Returns: key(string) - A unique key generated by webCacheManager for this file. This key is used to extract the downloaded file later.

  • webCacheManager.startAllDownloads() Arguments: Null

    • Starts All Queued Downloads
  • webCacheManager.reset() Argument(s): NONE Return(s): Null

    • Resets the download queue. Will remove all pending and completed downloads.
  • webCacheManager.getTemporaryUrl() Argument(s): key(string) - Supply the key returned by the 'queueDownload' method to get the temporary URL of the corresponding file. Returns: url (string) - Temporary URL of the file.

    • Method to get the temporary url of the file

EVENTS:

  • webCacheManager.on('ALL_DOWNLOADS_COMPLETE', callback) - Called when all the downloades in the queue have completed
  • webCacheManager.on('DOWNLOADS_STARTED', callback) - Called when the download(s) are started in the background.