parse and manipulate AppCache manifests
This module exports an AppCache
constructor, and a parser function so that
your JavaScript code can understand and manipulate the string contents of an
AppCache Manifest.
This is module is not designed to work in web browsers as-is, due to the use of
the CommonJS module pattern, and Node.js' crypto
built-in.
You should be able to use this in Node.js as-is, or in web browsers with a CommonJS-compatible bundler like WebPack or Browserify.
AppCache
AppCache#sha1
String
} a handy SHA1 hash, populated by AppCache.parse()
Having a hash is useful for comparing AppCache manifests files.
AppCache#cache
String[]
} the CACHE entries, populated by AppCache.parse()
AppCache#fallback
String[]
} the FALLBACK entries, populated by AppCache.parse()
AppCache#network
String[]
} the NETWORK entries, populated by AppCache.parse()
AppCache.parse(contents)
String
} the AppCache manifest file's contentsAppCache
} the parsed resultvar AppCache = require('@jokeyrhyme/appcache');
var appCache = AppCache.parse(/* string downloaded from an AppCache URL */);
console.log(appCache.cache);
// [ ... ] Array of URL Strings from all CACHE sections of the AppCache manifest