random-access-web
Advanced tools
Comparing version 1.0.0 to 1.1.0
26
index.js
@@ -6,8 +6,24 @@ const global = (typeof window !== 'undefined') ? window : self; | ||
const DEFAULT_DB_NAME = 'random-access-web' | ||
let init = async (options={}) => { | ||
if(typeof options === 'string') options = {name: options} | ||
const name = options.name || DEFAULT_DB_NAME | ||
return require('random-access-idb')(name) | ||
} | ||
if(requestFileSystem) { | ||
module.exports = require('random-access-chrome-file') | ||
} else if(mutableFile) { | ||
module.exports = require('@sammacbeth/random-access-idb-mutable-file') | ||
} else { | ||
module.exports = require('random-access-idb') | ||
init = async (options) => { | ||
return require('random-access-chrome-file') | ||
} | ||
} else if(mutableFile) { | ||
init = async (options) => { | ||
const RandomAccess = require('@sammacbeth/random-access-idb-mutable-file') | ||
return RandomAccess.mount() | ||
} | ||
} | ||
module.exports = { | ||
init | ||
} |
{ | ||
"name": "random-access-web", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Chooses the fastest random access backend based on the user's browser", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# random-access-web | ||
Chooses the fastest random access backend based on the user's browser | ||
```shell | ||
npm install --save random-access-web | ||
``` | ||
```js | ||
const RandomAccessWeb = require('random-access-web') | ||
const storage = await RandomAccessWeb.init() | ||
const dat = new DatJs({ | ||
db: storage | ||
}) | ||
``` |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
2965
22
17
0