{"_id":"http-asset","_rev":"332461","name":"http-asset","description":"Class for fetching and caching an asset over http","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"spalger","email":"email@spalger.com"}],"time":{"modified":"2021-06-07T02:48:36.000Z","created":"2015-06-14T23:10:11.750Z","1.0.1":"2015-06-15T07:40:48.911Z","1.0.0":"2015-06-15T07:31:36.301Z","1.0.0-alpha.1":"2015-06-15T06:35:13.942Z","1.0.0-alpha.0":"2015-06-14T23:10:11.750Z"},"users":{},"author":{"name":"Spencer Alger","email":"email@spalger.com"},"repository":{"type":"git","url":"git+https://github.com/spalger/http-asset.git"},"versions":{"1.0.1":{"name":"http-asset","version":"1.0.1","description":"Class for fetching and caching an asset over http","main":"lib/HttpAsset.js","scripts":{"test":"npm run compile && mocha lib/**/__tests__/**/*.js","compile":"rm -rf lib && babel --optional runtime src/ -d lib/","prepublish":"npm run compile"},"keywords":["asset","http","etag","cache"],"author":{"name":"Spencer Alger","email":"email@spalger.com"},"license":"MIT","dependencies":{"babel-runtime":"^5.5.8","debug":"^2.2.0","lodash.defaults":"^3.1.1","node-fetch":"^1.3.0","spark-md5":"0.0.5","temp":"^0.8.3","ya-cache":"^1.0.0-alpha.2"},"devDependencies":{"babel":"^5.5.7","chai":"^3.0.0","mocha":"^2.2.5"},"repository":{"type":"git","url":"git+https://github.com/spalger/http-asset.git"},"bugs":{"url":"https://github.com/spalger/http-asset/issues"},"homepage":"https://github.com/spalger/http-asset#readme","gitHead":"114d7fa81c303d1694d8d21f970289171071bc16","_id":"http-asset@1.0.1","_shasum":"54738e6161081b60dcd038ed4d8362cfc29f695c","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"spalger","email":"email@spalger.com"},"dist":{"shasum":"54738e6161081b60dcd038ed4d8362cfc29f695c","size":3091,"noattachment":false,"key":"/http-asset/-/http-asset-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/http-asset/download/http-asset-1.0.1.tgz"},"maintainers":[{"name":"spalger","email":"email@spalger.com"}],"directories":{},"publish_time":1434354048911,"_cnpm_publish_time":1434354048911,"_hasShrinkwrap":false},"1.0.0":{"name":"http-asset","version":"1.0.0","description":"Class for fetching and caching an asset over http","main":"lib/HttpAsset.js","scripts":{"test":"npm run compile && mocha lib/**/__tests__/**/*.js","compile":"rm -rf lib && babel --optional runtime src/ -d lib/","prepublish":"npm run compile"},"keywords":["asset","http","etag","cache"],"author":{"name":"Spencer Alger","email":"email@spalger.com"},"license":"MIT","dependencies":{"babel-runtime":"^5.5.8","debug":"^2.2.0","lodash.defaults":"^3.1.1","node-fetch":"^1.3.0","spark-md5":"0.0.5","temp":"^0.8.3","ya-cache":"^1.0.0-alpha.2"},"devDependencies":{"babel":"^5.5.7","chai":"^3.0.0","mocha":"^2.2.5"},"gitHead":"3c517ebbd5e227ff53b844f144fccc6d2bea4b2e","_id":"http-asset@1.0.0","_shasum":"d764707efb54306fca1427c8458065da82cbbd2a","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"spalger","email":"email@spalger.com"},"dist":{"shasum":"d764707efb54306fca1427c8458065da82cbbd2a","size":3029,"noattachment":false,"key":"/http-asset/-/http-asset-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/http-asset/download/http-asset-1.0.0.tgz"},"maintainers":[{"name":"spalger","email":"email@spalger.com"}],"directories":{},"publish_time":1434353496301,"_cnpm_publish_time":1434353496301,"_hasShrinkwrap":false},"1.0.0-alpha.1":{"name":"http-asset","version":"1.0.0-alpha.1","description":"Class for fetching and caching an asset over http","main":"lib/HttpAsset.js","scripts":{"test":"mocha -r babel/register -r test/support.js src/**/__tests__/**/*.js","compile":"rm -rf lib && babel src/ -d lib/ --ignore './__tests__/*'","prepublish":"npm run compile"},"keywords":["asset","http","etag","cache"],"author":{"name":"Spencer Alger","email":"email@spalger.com"},"license":"MIT","dependencies":{"debug":"^2.2.0","node-fetch":"^1.3.0","spark-md5":"0.0.5","temp":"^0.8.3","ya-cache":"^1.0.0-alpha.2"},"devDependencies":{"babel":"^5.5.7","chai":"^3.0.0","chai-as-promised":"^5.1.0","lodash.defaults":"^3.1.1","mocha":"^2.2.5"},"gitHead":"41ca08f0f4beb881eed14d6b7e052d828d7133f0","_id":"http-asset@1.0.0-alpha.1","_shasum":"4fba5e793be84608fe94e78b0a0d4e9c16524263","_from":".","_npmVersion":"2.11.1","_nodeVersion":"2.3.0","_npmUser":{"name":"spalger","email":"email@spalger.com"},"dist":{"shasum":"4fba5e793be84608fe94e78b0a0d4e9c16524263","size":3050,"noattachment":false,"key":"/http-asset/-/http-asset-1.0.0-alpha.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/http-asset/download/http-asset-1.0.0-alpha.1.tgz"},"maintainers":[{"name":"spalger","email":"email@spalger.com"}],"directories":{},"publish_time":1434350113942,"_cnpm_publish_time":1434350113942,"_hasShrinkwrap":false},"1.0.0-alpha.0":{"name":"http-asset","version":"1.0.0-alpha.0","description":"Class for fetching and caching an asset over http","main":"lib/HttpAsset.js","scripts":{"test":"mocha -r babel/register -r test/support.js src/**/__tests__/**/*.js","compile":"rm -rf lib && babel src/ -d lib/ --ignore './__tests__/*'","prepublish":"npm run compile"},"keywords":["asset","http","etag","cache"],"author":{"name":"Spencer Alger","email":"email@spalger.com"},"license":"MIT","dependencies":{"checksum":"^0.1.1","node-fetch":"^1.3.0","temp":"^0.8.3","ya-cache":"^1.0.0-alpha.1"},"devDependencies":{"babel":"^5.5.7","chai":"^3.0.0","chai-as-promised":"^5.1.0","debug":"^2.2.0","mocha":"^2.2.5"},"gitHead":"04108119722e08e8ae4913bb665381206a55604a","_id":"http-asset@1.0.0-alpha.0","_shasum":"b8dd0203f34f17c07e3428802b6fdd21192f20c5","_from":".","_npmVersion":"2.11.1","_nodeVersion":"2.3.0","_npmUser":{"name":"spalger","email":"email@spalger.com"},"dist":{"shasum":"b8dd0203f34f17c07e3428802b6fdd21192f20c5","size":2478,"noattachment":false,"key":"/http-asset/-/http-asset-1.0.0-alpha.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/http-asset/download/http-asset-1.0.0-alpha.0.tgz"},"maintainers":[{"name":"spalger","email":"email@spalger.com"}],"directories":{},"publish_time":1434323411750,"_cnpm_publish_time":1434323411750,"_hasShrinkwrap":false}},"readme":"# http-asset\n\nFetch, cache, and update some asset over http.\n\nUseful for managing things like lists of manifest that are maintained in a remote place, but you need regular access to locally. Designed for use by [esvm](https://www.npmjs.com/package/esvm) in order to download the list of available releases.\n\n## features\n\n - filesystem backed caching of asset\n - utilizes http caching headers\n - falls back to cache on failure (offline support I guess?)\n\n## example\n\n```js\nlet HttpAsset = require('http-asset')\nlet asset = HttpAsset('https://api.github.com/repos/elastic/elasticsearch/tags?per_page=100')\nasset.get().then(labels => {\n  // use labels\n})\n```\n\n## api\n\n---\n#### `new HttpAsset(url, options = {})`\n\nConstruct an asset object. `url` is where the asset should be downloaded from, options include:\n\n| option         | default                      | description                             |\n| ------         | -------                      | -----------                             |\n| `cache`        | `true`                       | Set to true to disable caching          |\n| `cacheStaleMs` | `1000 * 60 * 5` (5 minutes)  | number of milliseconds before we should check for an update |\n| `cacheDir`     | `os.tmpDir()`                | Directory to store this asset's cache   |\n| `cacheName`    | `md5(url)`                   | Filename for the cache                  |\n| `cachePath`    | `cacheDir` + `cacheName`     | Override the cache path for this asset  |\n\n---\n#### `asset.get() -> Promise`\n\nGet the body of a asset, returns a promise\n\n```js\nlet HttpAsset = require('http-asset')\nlet asset = HttpAsset('https://api.github.com/repos/elastic/elasticsearch/tags?per_page=100')\nasset.get().then(labels => {\n  // use labels\n})\n```\n\n---\n#### `asset.clear() -> Promise`\n\nClears the value of the asset\n\n```js\n// force a fetch\nasset.clear().then(function () {\n  return asset.get()\n})\n```","_attachments":{},"homepage":"https://github.com/spalger/http-asset#readme","bugs":{"url":"https://github.com/spalger/http-asset/issues"},"license":"MIT"}