3.1.4 • Published 2 months ago

@zacharygriffee/random-access-idb v3.1.4

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

random-access-idb


API Documentation

See: random-access-storage for the full api about what this library derives from.


Test it

In Node

npm test

In Browser

Test it in your browser


Installation

npm install @zacharygriffee/random-access-idb --save

Import

import rai from "@zacharygriffee/random-access-idb";

Improvements

  • Uses b4a for buffer operations
  • Implements del and truncate, and removes empty chunks from database with these operations
  • Extends with purge to delete a file from the database
  • Metadata that holds the chunkSize. IF you reopen a file that had a declared chunk size, it will open the file in that chunk size despite the configuration.
  • New blocking handlers for multiple tab support. If a file is open in one place, and another place tries to open the same file, use the blocking handlers to specify how to handle the conflict
  • Close now has a necessary reason to exist.

!!! NEW BEHAVIOR !!!

If you plan on using this cross-tab... It is now important to close the IDB file when you're done so that other tabs in the same origin can open the file.

Example

    import rai from "@zacharygriffee/random-access-idb";
    
    const file = rai("hello.txt");
    file.write(0, b4a.from("hello world"), (e) => {
        file.read(0, 5, (e, buffer) => {
            b4a.toString(buffer); // hello
        })
    });

Todo

  • Add a metadata for stats. Block/Chunk size.
  • Error handling and testing of errors
  • Multiple browser tab support (needs testing)

Distributed under the MIT license. See LICENSE for more information.

3.1.4

2 months ago

3.1.2

3 months ago

3.1.1

3 months ago

3.1.0

3 months ago

3.0.4

3 months ago

3.0.3

3 months ago

3.0.2

3 months ago

3.0.1

3 months ago

3.0.5

3 months ago

3.0.0

3 months ago

2.2.2

4 months ago

2.2.1

4 months ago

2.2.0

4 months ago

2.1.0

4 months ago

2.0.13

4 months ago

2.0.14

4 months ago

2.0.11

4 months ago

2.0.12

4 months ago

2.0.10

4 months ago

2.0.3

4 months ago

2.0.2

4 months ago

2.0.5

4 months ago

2.0.4

4 months ago

2.0.6

4 months ago

2.0.1

4 months ago

2.0.0

4 months ago

1.0.1

5 months ago

1.0.0

5 months ago

0.1.55

5 months ago

0.1.5

5 months ago

0.1.4

5 months ago

0.1.3

5 months ago

0.1.2

6 months ago

0.1.1

6 months ago

0.1.1-s

6 months ago

0.1.0

6 months ago