New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

random-access-chrome-file

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

random-access-chrome-file

random-access-storage instance backed by the Chrome file system api.

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
222
increased by258.06%
Maintainers
2
Weekly downloads
 
Created
Source

random-access-chrome-file

A random-access-storage instance backed by the Chrome file system api

npm install random-access-chrome-file

Usage

// Currently only works in Chrome

const createFile = require('random-access-chrome-file')

const file = createFile('test.txt')

file.write(0, Buffer.from('hello world'), function (err) {
  if (err) throw err
  file.read(0, 11, function (err, buf) {
    if (err) throw err
    console.log(buf.toString())
  })
})

API

file = createFile(name, [options])

Returns a random-access-storage instance that supports the full API.

Options include:

{
  maxSize: Number.MAX_SAFE_INTEGER
}

maxSize is the storage quota it asks the browser for. If you are making an extension you can set the unlimitedStorage to get all the storage you want. Otherwise tweak the maxSize option to fit your needs.

If you want to change the maxSize default for all instances change createFile.DEFAULT_MAX_SIZE.

createFile.requestQuota(maxSize, cb)

Manually request the maxSize quota without creating af file.

License

MIT

FAQs

Package last updated on 24 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc