browser-module-cache

Caches browserify-cdn modules using level.js

browser-module-cache

Caches browserify-cdn modules using level.js

npm install browser-module-cache
var createCache = require('browser-module-cache')
var cache = createCache({
  name: 'browser-module-cache' // name of level.js database 
  inMemory: false // Whether to force usage of memdown 
})

Saves a browserify-cdn object where the keys bundle and package are required.

cache.put({
  blah: {
    bundle: 'blahblahblah',
    package: {
      name: 'blah',
      author: 'The Dude',
    },
  },
}, function() {
  console.log('saved!')
})

Gets all or one specific package from cache.

cache.get(function(errmodules) {
  console.log('all modules', modules)
})
 
cache.get('blah', function(errmodule) {
  console.log('the blah module', module)
})

Removes all cached modules.

cache.clear(function(err) {
  console.log('all clean')
})
  • 0.1.3 - Add inMemory option to memdown (@maxogden)
  • 0.1.2 - fallsback to memdown if indexedDB not found
  • 0.1.1 - return empty object if none found during get
  • 0.1.0 - initial release

Copyright (c) 2013 Kyle Robinson Young
Licensed under the MIT license.