Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@browserfs/fs-dom

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@browserfs/fs-dom

DOM backends for BrowserFS

  • 0.0.6
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

BrowserFS DOM Backends

BrowserFS backends for DOM APIs. DOM APIs are only available natively in browsers.

Please read the BrowserFS documentation!

Backends

  • HTTPRequest: Downloads files on-demand from a webserver using fetch.
  • Storage: Stores files in a Storage object, like localStorage and seesionStorage.
  • IndexedDB: Stores files into an IndexedDB object database.
  • WorkerFS: Lets you mount the BrowserFS file system configured in the main thread in a WebWorker, or the other way around!

For more information, see the API documentation.

Installing

npm install @browserfs/fs-dom

Usage

🛈 The examples are written in ESM. If you are using CJS, you can require the package. If running in a browser you can add a script tag to your HTML pointing to the browser.min.js and use BrowserFS DOM via the global BrowserFS_DOM object.

You can use DOM backends, though you must register them if you plan on using configure:

import { configure, fs, registerBackend } from '@browserfs/core';
import { Storage } from '@browserfs/fs-dom';

registerBackend(Storage);
await configure({ fs: 'Storage', options: { storage: localStorage } });

if (!fs.existsSync('/test.txt')) {
	fs.writeFileSync('/test.txt', 'This will persist across reloads!');
}

const contents = fs.readFileSync('/test.txt', 'utf-8');
console.log(contents);

Keywords

FAQs

Package last updated on 27 Feb 2024

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