Get support for random-access-storage/random-access-idb
If you're new to LTH, please see our FAQ for more information on what it is we do.
Support Options
Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:
View Open IssuesTake a look to see if anyone else has experienced the same issue as you and if they managed to solve it.
Open an IssueMake sure to read any relevant guidelines for opening issues on this repo before posting a new issue.
Sponsor directlyCheck out the page and see if there are any options to sponsor this project or it's developers directly.
random-access-storage/random-access-idb
random-access-idb
random-access-compatible indexedDB storage layer
NB: This version is a fork of @substack's original random-access-idb that implements random-access-storage abstraction. It helps normalizing every random access instances and eases rai usage in modules like random-access-network.
Substack's idb.close()
function is removed from this branch as it appears to conflict with how Corestore opens and closes the RandomAccess Store, until further work can be done to gracefully handle closing state.
example
var random = require('random-access-idb')('dbname')
var cool = random('cool.txt')
cool.write(100, Buffer.from('GREETINGS'), function (err) {
if (err) return console.error(err)
cool.read(104, 3, function (err, buf) {
if (err) return console.error(err)
console.log(buf.toString()) // TIN
})
})
api
var random = require('random-access-idb')
var db = random(dbname, opts)
Open an indexedDB database at dbname
.
Any opts
provided are forwarded to db(name, opts)
as default options.
var file = db(name, opts)
Create a handle file
from name
and opts
:
-
opts.size
- internal chunk size to use (default 4096)
You must keep opts.size
the same after you've written data.
If you change the size, bad things will happen.
file.read(offset, length, cb)
Read length
bytes at an offset
from file
as cb(err, buf)
.
file.write(offset, buf, cb)
Write buf
to file
at an offset
.
install
npm install random-access-idb
license
BSD
Our Mission
We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.
From the Blog
Interesting Articles
-
Generating income from open source
Jun 23 • 8 min read
-
2023 State of OSS
Apr 23 • 45 min read ★
-
A funding experiment...
Aug 19 • 10 min read
-
But You Said I could
Aug 19 • 2 min read
Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated
p-e622a1a2