{"id":46621,"library":"tile-cache","title":"tile-cache","description":"Client-side slippy tile cache for map tiles, fonts, JSON styles, and sprites. Version 3.0.0 is the current stable release with an irregular release cadence. Provides simple store-based API (put, get, check, remove, drop) using IndexedDB or LevelDB. Lightweight alternative to tilelive-cache or Leaflet tile layers, focused on offline caching. Supports Blob/ArrayBuffer storage with key format [x, y, zoom].","status":"active","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/pirxpilot/tile-cache","tags":["javascript","tile-cache","slippy tiles","db","cache"],"install":[{"cmd":"npm install tile-cache","lang":"bash","label":"npm"},{"cmd":"yarn add tile-cache","lang":"bash","label":"yarn"},{"cmd":"pnpm add tile-cache","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default import in ESM; CommonJS uses require('tile-cache').","wrong":"const { tileCache } = require('tile-cache')","symbol":"tileCache","correct":"import tileCache from 'tile-cache'"},{"note":"CJS require returns the module directly.","wrong":"","symbol":"tileCache","correct":"const tileCache = require('tile-cache')"},{"note":"TypeScript users can import types if available; not documented.","wrong":"","symbol":"types","correct":"import type { TileCache } from 'tile-cache'"}],"quickstart":{"code":"const tileCache = require('tile-cache');\n\nasync function example() {\n  const key = [0, 3, 5]; // [x, y, zoom]\n  const tile = new ArrayBuffer(16); // example tile data\n\n  await tileCache.put('tile', key, tile);\n  console.log('Tile saved');\n\n  const retrieved = await tileCache.get('tile', key);\n  console.log('Tile retrieved:', retrieved);\n\n  const inCache = await tileCache.check('tile', key);\n  console.log('In cache:', inCache);\n\n  await tileCache.remove('tile', key);\n  console.log('Tile removed');\n\n  await tileCache.drop('tile');\n  console.log('Store dropped');\n}\n\nexample().catch(console.error);","lang":"javascript","description":"Demonstrates all basic operations on the tile store: put, get, check, remove, and drop."},"warnings":[{"fix":"Use async/await or .then() for all operations.","message":"Version 3.0.0 changed the API from callbacks to promises. Old style callbacks are no longer supported.","severity":"breaking","affected_versions":">=3.0.0 <4.0.0"},{"fix":"Always provide an array of three integers.","message":"Keys must be arrays of three numbers [x, y, zoom]; other formats may silently fail.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Call tileCache.drop('store') to clear a store when needed.","message":"Stores are persistent across page loads via IndexedDB; data is not automatically cleared.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Use localStorage or dedicated JSON caching library for styles.","message":"The 'json' store type may be deprecated in future versions; prefer storing JSON via other means.","severity":"deprecated","affected_versions":">=3.0.0"}],"env_vars":null,"search_vec":"'3.0.0':19 'altern':46 'api':35 'base':34 'blob/arraybuffer':60 'cach':3,9,50,58,71,75 'cadenc':29 'check':38 'client':5 'client-sid':4 'current':22 'db':74 'drop':40 'focus':55 'font':13 'format':64 'get':37 'indexeddb':42 'irregular':27 'javascript':68 'json':14 'key':63 'layer':54 'leaflet':52 'leveldb':44 'lightweight':45 'map':11 'offlin':57 'provid':30 'put':36 'releas':24,28 'remov':39 'side':6 'simpl':31 'slippi':7,72 'sprite':17 'stabl':23 'storag':61 'store':33 'store-bas':32 'style':15 'support':59 'tile':2,8,12,53,70,73 'tile-cach':1,69 'tilel':49 'tilelive-cach':48 'use':41 'version':18 'x':65 'y':66 'zoom':67","created_at":"2026-06-07T13:00:49.845776+00:00","updated_at":"2026-06-07T13:00:49.845776+00:00","problems":[{"fix":"Use one of the allowed stores: 'tile', 'font', 'json', 'image'.","cause":"Provided an invalid or misspelled store name.","error":"Error: store name must be one of: tile, font, json, image"},{"fix":"Pass key as an array like [0, 3, 5].","cause":"Key provided as a string or array of wrong dimensions.","error":"TypeError: key must be an array of 3 numbers"},{"fix":"Use `import tileCache from 'tile-cache'` or `const tileCache = require('tile-cache')`.","cause":"Importing via destructuring when default import is needed.","error":"tileCache.put is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/pirxpilot/tile-cache#readme","github":"https://github.com/pirxpilot/tile-cache","docs":null,"changelog":null,"pypi":null,"npm":"tile-cache","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}