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

chrome-fs

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chrome-fs

Use the Node `fs` API in Chrome Apps

  • 7.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
39
increased by3800%
Maintainers
1
Weekly downloads
 
Created
Source

chrome-fs

Use the Node fs API in Chrome Apps

This module is used by chromiumify

Usage

This library can be used directly with your browserify builds with targeting Chrome Packaged Apps.

$ npm install chrome-fs --save
$ browserify -r chrome-fs:fs index.js -o bundle.js

API Status

This list is based on the node.js documentation https://nodejs.org/api/fs.html Sync apis won't be supported they are listed here https://github.com/No9/chrome-fs/wiki/API-Mapping

fs
  • fs.rename(oldPath, newPath, callback)
  • fs.ftruncate(fd, len, callback)
  • fs.truncate(path, len, callback)
  • fs.chown(path, uid, gid, callback)
  • fs.fchown(fd, uid, gid, callback)
  • fs.lchown(path, uid, gid, callback)
  • fs.chmod(path, mode, callback)
  • fs.fchmod(fd, mode, callback)
  • fs.lchmod(path, mode, callback)
  • fs.stat(path, callback)
  • fs.lstat(path, callback)
  • fs.fstat(fd, callback)
  • fs.link(srcpath, dstpath, callback)
  • fs.symlink(srcpath, dstpath[, type], callback)
  • fs.readlink(path, callback)
  • fs.realpath(path[, cache], callback)
  • fs.unlink(path, callback)
  • fs.rmdir(path, callback)
  • fs.mkdir(path[, mode], callback)
  • fs.readdir(path, callback)
  • fs.close(fd, callback)
  • fs.open(path, flags[, mode], callback)
  • fs.utimes(path, atime, mtime, callback)
  • fs.futimes(fd, atime, mtime, callback)
  • fs.write(fd, buffer, offset, length[, position], callback)
  • fs.write(fd, data[, position[, encoding]], callback)
  • fs.read(fd, buffer, offset, length, position, callback)
  • fs.readFile(filename[, options], callback)
  • fs.writeFile(filename, data[, options], callback)
  • fs.appendFile(filename, data[, options], callback)
  • fs.watchFile(filename[, options], listener)
  • fs.unwatchFile(filename[, listener])
  • fs.watch(filename[, options][, listener])
  • fs.exists(path, callback)
  • fs.access(path[, mode], callback)
  • fs.createReadStream(path[, options])
  • fs.createWriteStream(path[, options])
Class: - fs.Stats
  • fs.Stats
  • Stat Time Values
Class: - fs.ReadStream
  • fs.ReadStream
  • Event: 'open'
Class: - fs.WriteStream
  • fs.WriteStream
  • Event: 'open'
  • file.bytesWritten
Class: - fs.FSWatcher
  • fs.FSWatcher
  • watcher.close()
  • Event: 'change'
  • Event: 'error'

Test

$ npm test

This will load the folder test/chrome-app as an unpacked extension in chrome. Test currently designed for Chrome on Windows and Linux Canary on Mac other variants accepted

Permissions

It is recommended that the following permissions are added to your chrome packaged app for this module.

  "permissions": [
    "unlimitedStorage"
  ]

Caveats

Relative Directories

Chrome Packaged Apps don't have the notion of current working directory CWD. So relative paths are not escapted they are trimmed to be relative from root i.e. ../../direct1/file1 Will resolve to /direct1/file1

. Will resolve to /

Ownership Mod Mapping

Chrome Packaged Apps allow you to see and edit the filesystem from the dev tools so the chown, fchown, chmod, fmod calls are there for compatibility only. Any chown call will not be reflected in stat

Stat

Best effort has been made to support stat but the Chrome File System is not a complete implementation. Files have size and last modified but directories have no size and default to the start of epoc for last modified.

Encoding

Currently only UTF-8 is supported

File Extensions

There seems to be an issue around saving files in chomefs

Contributors

anton whalley @no9

Keywords

FAQs

Package last updated on 31 Jul 2015

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