Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3
Promise-based HTML5 Filesystem API similar to Node.js fs module
vitalets/bro-fs
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Promise-based wrapper overHTML5 Filesystem APIallowing to work with sandboxed filesystem in browser.
API is similar toNode.js fs module with some extra sugar.Currently it is supportedonly by Chrome.
- install from npm:
npm install bro-fs
- include directly from CDN via
<script>
tag:<scriptsrc="https://unpkg.com/bro-fs"></script>
- download manually the latest release
Withasync/await
:
constfs=require('bro-fs');(asyncfunction(){awaitfs.init({type:window.TEMPORARY,bytes:5*1024*1024});awaitfs.mkdir('dir');awaitfs.writeFile('dir/file.txt','hello world');constcontent=awaitfs.readFile('dir/file.txt');console.log(content);// => "hello world"})();
or with.then()
:
fs.init({type:window.TEMPORARY,bytes:5*1024*1024}).then(()=>fs.mkdir('dir')).then(()=>fs.writeFile('dir/file.txt','hello world')).then(()=>fs.readFile('dir/file.txt')).then(content=>console.log(content));// => "hello world"
See more usage examples intest directory.
Current:
- https://dev.w3.org/2009/dap/file-system/file-dir-sys.html (Chrome)
- https://wicg.github.io/entries-api (Firefox and Edge)
Coming (draft):
Discussion:
- filer.js - unix-like commands, callbacks
- html5-fs - looks obsolete, callbacks
- chromestore.js - looks obsolete, callbacks
- BrowserFS - many backends, callbacks
- fs-web - store files in IndexedDB, not html5 filesystem
- web-fs - abandoned
- browserify-fs - uses leveldb under hood, callbacks
- fs-browserify - abandoned
- dom-fs - abandoned
MIT @Vitaliy Potapov
About
Promise-based HTML5 Filesystem API similar to Node.js fs module
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.