{"_id":"@bmjs/localforage","_rev":"4-bd8ae6796a93c655a72d5d73157b8932","name":"@bmjs/localforage","dist-tags":{"latest":"1.10.3"},"versions":{"1.10.0":{"name":"@bmjs/localforage","version":"1.10.0","keywords":["indexeddb","localstorage","storage","websql"],"author":{"name":"Mozilla"},"license":"Apache-2.0","_id":"@bmjs/localforage@1.10.0","maintainers":[{"name":"ywenhao","email":"ywenhao2019@qq.com"}],"homepage":"https://github.com/localForage/localForage","bugs":{"url":"http://github.com/localForage/localForage/issues"},"dist":{"shasum":"f9e95cae541cee8055ed3473d1d102969d2bfe2f","tarball":"https://registry.npmjs.org/@bmjs/localforage/-/localforage-1.10.0.tgz","fileCount":30,"integrity":"sha512-xWs+AlkLsfuUiD+WV1y4qYrW3DHJBQkIZI/AxO8lcgkHMePGalMdOdYFhYFBkPrwpS+mas3azze/jB7EEnuejA==","signatures":[{"sig":"MEYCIQCXEB3130FoN6UW+UF6IE09gvvprZvsRzyNnaJPmYgj+QIhANEiBO0V7A/zvqXE1mKhKp68clJvQjrhzy/2mkeRUqAF","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":234738},"main":"dist/localforage.js","type":"module","gitHead":"9ae8a6465852777c4d6a328a715d16193fcd4fd1","scripts":{"test":"node -e \"require('grunt').cli()\" null test","build":"tsdown","serve":"node -e \"require('grunt').cli()\" null serve","prettify":"prettier --write \"src/**/*.js\" \"test/**/*.js\"","publish-docs":"node -e \"require('grunt').cli()\" null copy build-rules-html publish-rules"},"typings":"typings/localforage.d.ts","_npmUser":{"name":"ywenhao","email":"ywenhao2019@qq.com"},"repository":{"url":"git://github.com/localForage/localForage.git","type":"git"},"_npmVersion":"11.6.2","description":"Offline storage, improved.","directories":{},"_nodeVersion":"22.20.0","_hasShrinkwrap":false,"devDependencies":{"husky":"^2.3.0","tsdown":"^0.15.6","prettier":"~1.12.0","typescript":"^5.9.3","lint-staged":"^8.1.7","eslint-config-prettier":"^2.9.0"},"_npmOperationalInternal":{"tmp":"tmp/localforage_1.10.0_1760063671128_0.3444216240249611","host":"s3://npm-registry-packages-npm-production"}},"1.10.1":{"name":"@bmjs/localforage","version":"1.10.1","keywords":["indexeddb","localstorage","storage","websql"],"author":{"name":"Mozilla"},"license":"Apache-2.0","_id":"@bmjs/localforage@1.10.1","maintainers":[{"name":"ywenhao","email":"ywenhao2019@qq.com"}],"homepage":"https://github.com/localForage/localForage","bugs":{"url":"http://github.com/localForage/localForage/issues"},"dist":{"shasum":"76f3ae6f746bec9355aa0eb17b0b5af59699e480","tarball":"https://registry.npmjs.org/@bmjs/localforage/-/localforage-1.10.1.tgz","fileCount":10,"integrity":"sha512-0/gpPaXs5z6ZMm56NlgvhKvhWbanwWToZqmf6L6DG8hVDrdb/kpnp7xAm+mVzBsUWDuZGv3QMUEvkCGQ1lYItw==","signatures":[{"sig":"MEQCIAlMo7PT+Rl/gCPPk3lbwceS7ytnDyGOVU2Zp+wooKpwAiBLyi/ygWIcPMUs6+3BSLqVKh/hmf2TXNoqbyCuFZLo+w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":138543},"main":"dist/localforage.js","type":"module","gitHead":"93f48888a3c9abd6594a6e28dda407f56b159deb","scripts":{"test":"node -e \"require('grunt').cli()\" null test","build":"tsdown","serve":"node -e \"require('grunt').cli()\" null serve","prettify":"prettier --write \"src/**/*.js\" \"test/**/*.js\"","publish-docs":"node -e \"require('grunt').cli()\" null copy build-rules-html publish-rules"},"typings":"typings/localforage.d.ts","_npmUser":{"name":"ywenhao","email":"ywenhao2019@qq.com"},"repository":{"url":"git://github.com/localForage/localForage.git","type":"git"},"_npmVersion":"11.6.2","description":"Offline storage, improved.","directories":{},"_nodeVersion":"22.20.0","_hasShrinkwrap":false,"devDependencies":{"husky":"^2.3.0","tsdown":"^0.15.6","prettier":"~1.12.0","typescript":"^5.9.3","lint-staged":"^8.1.7","eslint-config-prettier":"^2.9.0"},"_npmOperationalInternal":{"tmp":"tmp/localforage_1.10.1_1760063999966_0.8820585551098432","host":"s3://npm-registry-packages-npm-production"}},"1.10.2":{"name":"@bmjs/localforage","version":"1.10.2","keywords":["indexeddb","localstorage","storage","websql"],"author":{"name":"Mozilla"},"license":"Apache-2.0","_id":"@bmjs/localforage@1.10.2","maintainers":[{"name":"ywenhao","email":"ywenhao2019@qq.com"}],"homepage":"https://github.com/localForage/localForage","bugs":{"url":"http://github.com/localForage/localForage/issues"},"dist":{"shasum":"658ac1722ec77df0f313770fce030a66f0572803","tarball":"https://registry.npmjs.org/@bmjs/localforage/-/localforage-1.10.2.tgz","fileCount":10,"integrity":"sha512-tKLu44th5Uk4qsSJCi+rOZ1rR74UI79GX8WJkUszsPq25+Gfw3k8zJ9CKLtR26Q97y+2Nyqni28qwkTpmYieHQ==","signatures":[{"sig":"MEUCIQCAV3taX7256jJUR9GqOwqjqMoZ/nhr8X4d+PASLfRzXgIgTedFBnAWRYuTggdqLCAuoYEeHiOxLlE8K1BIczrkXWU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":138589},"main":"dist/localforage.js","type":"module","gitHead":"fff90e1aa1305458a77c4abd18257557578a94bc","scripts":{"test":"node -e \"require('grunt').cli()\" null test","build":"tsdown","serve":"node -e \"require('grunt').cli()\" null serve","prettify":"prettier --write \"src/**/*.js\" \"test/**/*.js\"","publish-docs":"node -e \"require('grunt').cli()\" null copy build-rules-html publish-rules"},"typings":"typings/localforage.d.ts","_npmUser":{"name":"ywenhao","email":"ywenhao2019@qq.com"},"repository":{"url":"git://github.com/localForage/localForage.git","type":"git"},"_npmVersion":"11.6.2","description":"Offline storage, improved.","directories":{},"_nodeVersion":"22.20.0","_hasShrinkwrap":false,"devDependencies":{"husky":"^2.3.0","tsdown":"^0.15.6","prettier":"~1.12.0","typescript":"^5.9.3","lint-staged":"^8.1.7","eslint-config-prettier":"^2.9.0"},"_npmOperationalInternal":{"tmp":"tmp/localforage_1.10.2_1760064747701_0.596711026109551","host":"s3://npm-registry-packages-npm-production"}},"1.10.3":{"name":"@bmjs/localforage","type":"module","author":{"name":"Mozilla"},"license":"Apache-2.0","description":"Offline storage, improved.","keywords":["indexeddb","localstorage","storage","websql"],"version":"1.10.3","homepage":"https://github.com/localForage/localForage","repository":{"type":"git","url":"git://github.com/localForage/localForage.git"},"scripts":{"build":"tsdown","prettify":"prettier --write \"src/**/*.js\" \"test/**/*.js\"","publish-docs":"node -e \"require('grunt').cli()\" null copy build-rules-html publish-rules","serve":"node -e \"require('grunt').cli()\" null serve","test":"node -e \"require('grunt').cli()\" null test"},"devDependencies":{"eslint-config-prettier":"^2.9.0","husky":"^2.3.0","lint-staged":"^8.1.7","prettier":"~1.12.0","tsdown":"^0.15.6","typescript":"^5.9.3"},"main":"dist/localforage.js","typings":"typings/localforage.d.ts","bugs":{"url":"http://github.com/localForage/localForage/issues"},"gitHead":"3cd30d72b6f28c988eb67e576e20b7a11b3e02ef","_id":"@bmjs/localforage@1.10.3","_nodeVersion":"22.20.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-orCO6xJWUCb05G9DQllKDg0ps+KIxfYOs5N7qMXN/TLDsrmCMBUVb7bmr6puQeq0n5hItUpmG6+tDEEDDNd9/g==","shasum":"c5ce67034ee1b8c8b47cf7ca31efd33651b87736","tarball":"https://registry.npmjs.org/@bmjs/localforage/-/localforage-1.10.3.tgz","fileCount":10,"unpackedSize":138580,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBrU4g7H0KU9ecFxeLKXONCCGIso2Mk08gSqtIxMZGq4AiEAlP1uUFurNG7MzxiTQD7oYO05GhLDxvJr/2MsFDEnFSU="}]},"_npmUser":{"name":"ywenhao","email":"ywenhao2019@qq.com"},"directories":{},"maintainers":[{"name":"ywenhao","email":"ywenhao2019@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/localforage_1.10.3_1760064999209_0.26973135890331235"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-10T02:34:31.024Z","modified":"2025-10-10T02:56:39.626Z","1.10.0":"2025-10-10T02:34:31.377Z","1.10.1":"2025-10-10T02:40:00.177Z","1.10.2":"2025-10-10T02:52:27.922Z","1.10.3":"2025-10-10T02:56:39.393Z"},"bugs":{"url":"http://github.com/localForage/localForage/issues"},"author":{"name":"Mozilla"},"license":"Apache-2.0","homepage":"https://github.com/localForage/localForage","keywords":["indexeddb","localstorage","storage","websql"],"repository":{"type":"git","url":"git://github.com/localForage/localForage.git"},"description":"Offline storage, improved.","maintainers":[{"name":"ywenhao","email":"ywenhao2019@qq.com"}],"readme":"# localForage\n[![NPM version](https://badge.fury.io/js/localforage.svg)](http://badge.fury.io/js/localforage)\n[![npm](https://img.shields.io/npm/dm/localforage.svg?maxAge=2592000)](https://npmcharts.com/compare/localforage?minimal=true)\n[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/localforage/badge?style=rounded)](https://www.jsdelivr.com/package/npm/localforage)\n[![minzipped size](https://badgen.net/bundlephobia/minzip/localforage)](https://bundlephobia.com/result?p=localforage@1.10.0)\n\nlocalForage is a fast and simple storage library for JavaScript. localForage\nimproves the offline experience of your web app by using asynchronous storage\n(IndexedDB or WebSQL) with a simple, `localStorage`-like API.\n\nlocalForage uses localStorage in browsers with no IndexedDB or\nWebSQL support. See [the wiki for detailed compatibility info][supported browsers].\n\nTo use localForage, just drop a single JavaScript file into your page:\n\n```html\n<script src=\"localforage/dist/localforage.js\"></script>\n<script>localforage.getItem('something', myCallback);</script>\n```\nTry the [live example](http://codepen.io/thgreasi/pen/ojYKeE).\n\nDownload the [latest localForage from GitHub](https://github.com/localForage/localForage/releases/latest), or install with\n[npm](https://www.npmjs.com/):\n\n```bash\nnpm install localforage\n```\n\n[supported browsers]: https://github.com/localForage/localForage/wiki/Supported-Browsers-Platforms\n\n## Support\n\nLost? Need help? Try the\n[localForage API documentation](https://localforage.github.io/localForage). [localForage API文档也有中文版。](https://localforage.docschina.org)\n\nIf you're having trouble using the library, running the tests, or want to contribute to localForage, please look through the [existing issues](https://github.com/localForage/localForage/issues) for your problem first before creating a new one. If you still need help, [feel free to file an issue](https://github.com/localForage/localForage/issues/new).\n\n# How to use localForage\n\n## Callbacks vs Promises\n\nBecause localForage uses async storage, it has an async API.\nIt's otherwise exactly the same as the\n[localStorage API](https://hacks.mozilla.org/2009/06/localstorage/).\n\nlocalForage has a dual API that allows you to either use Node-style callbacks\nor [Promises](https://www.promisejs.org/). If you are unsure which one is right for you, it's recommended to use Promises.\n\nHere's an example of the Node-style callback form:\n\n```js\nlocalforage.setItem('key', 'value', function (err) {\n  // if err is non-null, we got an error\n  localforage.getItem('key', function (err, value) {\n    // if err is non-null, we got an error. otherwise, value is the value\n  });\n});\n```\n\nAnd the Promise form:\n\n```js\nlocalforage.setItem('key', 'value').then(function () {\n  return localforage.getItem('key');\n}).then(function (value) {\n  // we got our value\n}).catch(function (err) {\n  // we got an error\n});\n```\n\nOr, use `async`/`await`:\n\n```js\ntry {\n    const value = await localforage.getItem('somekey');\n    // This code runs once the value has been loaded\n    // from the offline store.\n    console.log(value);\n} catch (err) {\n    // This code runs if there were any errors.\n    console.log(err);\n}\n```\n\nFor more examples, please visit [the API docs](https://localforage.github.io/localForage).\n\n## Storing Blobs, TypedArrays, and other JS objects\n\nYou can store any type in localForage; you aren't limited to strings like in\nlocalStorage. Even if localStorage is your storage backend, localForage\nautomatically does `JSON.parse()` and `JSON.stringify()` when getting/setting\nvalues.\n\nlocalForage supports storing all native JS objects that can be serialized to\nJSON, as well as ArrayBuffers, Blobs, and TypedArrays. Check the\n[API docs][api] for a full list of types supported by localForage.\n\nAll types are supported in every storage backend, though storage limits in\nlocalStorage make storing many large Blobs impossible.\n\n[api]: https://localforage.github.io/localForage/#data-api-setitem\n\n## Configuration\n\nYou can set database information with the `config()` method.\nAvailable options are `driver`, `name`, `storeName`, `version`, `size`, and\n`description`.\n\nExample:\n```javascript\nlocalforage.config({\n    driver      : localforage.WEBSQL, // Force WebSQL; same as using setDriver()\n    name        : 'myApp',\n    version     : 1.0,\n    size        : 4980736, // Size of database, in bytes. WebSQL-only for now.\n    storeName   : 'keyvaluepairs', // Should be alphanumeric, with underscores.\n    description : 'some description'\n});\n```\n\n**Note:** you must call `config()` _before_ you interact with your data. This\nmeans calling `config()` before using `getItem()`, `setItem()`, `removeItem()`,\n`clear()`, `key()`, `keys()` or `length()`.\n\n## Multiple instances\n\nYou can create multiple instances of localForage that point to different stores\nusing `createInstance`. All the configuration options used by\n[`config`](#configuration) are supported.\n\n``` javascript\nvar store = localforage.createInstance({\n  name: \"nameHere\"\n});\n\nvar otherStore = localforage.createInstance({\n  name: \"otherName\"\n});\n\n// Setting the key on one of these doesn't affect the other.\nstore.setItem(\"key\", \"value\");\notherStore.setItem(\"key\", \"value2\");\n```\n\n## RequireJS\n\nYou can use localForage with [RequireJS](http://requirejs.org/):\n\n```javascript\ndefine(['localforage'], function(localforage) {\n    // As a callback:\n    localforage.setItem('mykey', 'myvalue', console.log);\n\n    // With a Promise:\n    localforage.setItem('mykey', 'myvalue').then(console.log);\n});\n```\n\n## TypeScript\n\nIf you have the [`allowSyntheticDefaultImports` compiler option](https://www.typescriptlang.org/docs/handbook/compiler-options.html) set to `true` in your [tsconfig.json](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) (supported in TypeScript v1.8+), you should use:\n\n```javascript\nimport localForage from \"localforage\";\n```\n\nOtherwise you should use one of the following:\n\n```javascript\nimport * as localForage from \"localforage\";\n// or, in case that the typescript version that you are using\n// doesn't support ES6 style imports for UMD modules like localForage\nimport localForage = require(\"localforage\");\n```\n\n## Framework Support\n\nIf you use a framework listed, there's a localForage storage driver for the\nmodels in your framework so you can store data offline with localForage. We\nhave drivers for the following frameworks:\n\n* [AngularJS](https://github.com/ocombe/angular-localForage)\n* [Angular 4 and up](https://github.com/Alorel/ngforage/)\n* [Backbone](https://github.com/localForage/localForage-backbone)\n* [Ember](https://github.com/genkgo/ember-localforage-adapter)\n* [Vue](https://github.com/dmlzj/vlf)\n* [NuxtJS](https://github.com/nuxt-community/localforage-module)\n\nIf you have a driver you'd like listed, please\n[open an issue](https://github.com/localForage/localForage/issues/new) to have it\nadded to this list.\n\n## Custom Drivers\n\nYou can create your own driver if you want; see the\n[`defineDriver`](https://localforage.github.io/localForage/#driver-api-definedriver) API docs.\n\nThere is a [list of custom drivers on the wiki][custom drivers].\n\n[custom drivers]: https://github.com/localForage/localForage/wiki/Custom-Drivers\n\n# Working on localForage\n\nYou'll need [node/npm](http://nodejs.org/) and\n[bower](http://bower.io/#installing-bower).\n\nTo work on localForage, you should start by\n[forking it](https://github.com/localForage/localForage/fork) and installing its\ndependencies. Replace `USERNAME` with your GitHub username and run the\nfollowing:\n\n```bash\n# Install bower globally if you don't have it:\nnpm install -g bower\n\n# Replace USERNAME with your GitHub username:\ngit clone git@github.com:USERNAME/localForage.git\ncd localForage\nnpm install\nbower install\n```\n\nOmitting the bower dependencies will cause the tests to fail!\n\n## Running Tests\n\nYou need PhantomJS installed to run local tests. Run `npm test` (or,\ndirectly: `grunt test`). Your code must also pass the\n[linter](http://jshint.com/).\n\nlocalForage is designed to run in the browser, so the tests explicitly require\na browser environment. Local tests are run on a headless WebKit (using\n[PhantomJS](http://phantomjs.org)).\n\nWhen you submit a pull request, tests will be run against all browsers that\nlocalForage supports on Travis CI using [Sauce Labs](https://saucelabs.com/).\n\n## Library Size\nAs of version 1.7.3 the payload added to your app is rather small. Served using gzip compression, localForage will add less than 10k to your total bundle size:\n\n<dl>\n  <dt>minified</dt><dd>`~29kB`</dd>\n  <dt>gzipped</dt><dd>`~8.8kB`</dd>\n  <dt>brotli'd</dt><dd>`~7.8kB`</dd>\n</dl>\n\n# License\n\nThis program is free software; it is distributed under an\n[Apache License](https://github.com/localForage/localForage/blob/master/LICENSE).\n\n---\n\nCopyright (c) 2013-2016 [Mozilla](https://mozilla.org)\n([Contributors](https://github.com/localForage/localForage/graphs/contributors)).\n","readmeFilename":"README.md"}