random-access-chrome-file

WebJar for random-access-chrome-file

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

random-access-chrome-file
Last Version

Last Version

1.1.3
Release Date

Release Date

Type

Type

jar
Description

Description

random-access-chrome-file
WebJar for random-access-chrome-file
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/random-access-storage/random-access-chrome-file

Download random-access-chrome-file

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/random-access-chrome-file/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>random-access-chrome-file</artifactId>
    <version>1.1.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/random-access-chrome-file/
implementation 'org.webjars.npm:random-access-chrome-file:1.1.3'
// https://jarcasting.com/artifacts/org.webjars.npm/random-access-chrome-file/
implementation ("org.webjars.npm:random-access-chrome-file:1.1.3")
'org.webjars.npm:random-access-chrome-file:jar:1.1.3'
<dependency org="org.webjars.npm" name="random-access-chrome-file" rev="1.1.3">
  <artifact name="random-access-chrome-file" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='random-access-chrome-file', version='1.1.3')
)
libraryDependencies += "org.webjars.npm" % "random-access-chrome-file" % "1.1.3"
[org.webjars.npm/random-access-chrome-file "1.1.3"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : random-access-storage jar [1.3.0,2)

Project Modules

There are no modules declared in this project.

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

org.webjars.npm
Random Access Storage projects and community

Versions

Version
1.1.3