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

localstorage-fs

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

localstorage-fs

node's fs module for the browser backed by localStorage

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

localstorage-fs

node's fs module backed by localStorage

Browser Support

why

this would be way better, but i needed the sync methods

how

browserify and use like you would in node land

api coverage

  • fs.rename(oldPath, newPath, callback)
  • fs.renameSync(oldPath, newPath)
  • fs.truncate(path, len, callback)
  • fs.truncateSync(path, len)
  • fs.chmod(path, mode, callback)
  • fs.chmodSync(path, mode)
  • fs.stat(path, callback)
  • fs.statSync(path)
  • fs.unlink(path, callback)
  • fs.unlinkSync(path)
  • fs.rmdir(path, callback)
  • fs.rmdirSync(path)
  • fs.mkdir(path, callback)
  • fs.mkdirSync(path, mode)
  • fs.readdir(path, callback)
  • fs.readdirSync(path)
  • fs.readFile(path, options, callback)
  • fs.readFileSync(path, options)
  • fs.writeFile(path, data, options, callback)
  • fs.writeFileSync(path, data, options)
  • fs.appendFile(path, data, options, callback)
  • fs.appendFileSync(path, data, options)
  • fs.exists(path, callback)
  • fs.existsSync(path)
  • fs.createWriteStream(path, options)
  • fs.createReadStream(path, options)

others that could probably be implemented here

tests / example

  • get browserify
  • get bash
  • npm run test
  • npm run example

implementation

  • file data and directory listings are keyed by '/path/name' under the prefix: 'file://'
  • meta data (also keyed by path name) is stored as JSON stringified fs.Stats instances under 'file-meta://'
  • file contents are stored as base64 encoded strings which means binary files work
  • directory listings are stored as newline delimited plain strings (like ls(1))
  • async methods are faked with process.nextTick
  • streams are faked by buffering into memory

notes

  • some fs related process methods are shimmed out by this module for now

license

WTFPL

FAQs

Package last updated on 08 Jan 2014

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