Git Product home page Git Product logo

random-access-idb-mutable-file's Introduction

random-access-idb-mutable-file

travis package downloads styled with prettier

random-access storage layer over IDBMutableFile, which is non-standard IndexedDB extension in Gecko to provide virtual file system API with-in the IndexedDB.

This library will only work in Firefox (unless other browsers implement IDBMutableFile API) and it's mostly targeted at WebExtensions. It mostly amis to be a drop-in replacement for random-access-file. It is also an alternative to random-access-idb that is able to avoid loading all of the file content for random read / writes at the expanse of limited runtime suport.

Usage

import RandomAccess from "random-access-idb-mutable-file"

const main = async (filename, options) => {
  const randomAccessFile = await RandomAccess.mount()

  const file = randomAccessFile(filename, options)
  file.write(10, Buffer.from("hello"), error => {
    // write a buffer to offset 10
    file.read(10, 5, (error, buffer) => {
      console.log(buffer) // read 5 bytes from offset 10
      file.close(() => {
        console.log("file is closed")
      })
    })
  })
}

Install

npm install random-access-idb-mutable-file

random-access-idb-mutable-file's People

Contributors

gozala avatar dpaez avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.