jvilk / BrowserFS

BrowserFS is an in-browser filesystem that emulates the Node JS filesystem API and supports storing and retrieving files from various backends.
Other
3.06k stars 216 forks source link

Addition of SessionStorage backend #330

Closed ragusrinivasan closed 9 months ago

ragusrinivasan commented 1 year ago

Can session storage be added to browserfs?

james-pre commented 1 year ago

@ragusrinivasan Since session storage and local storage both use Storage it should be fairly easy to implement (since we already have LocalStorageFS).

james-pre commented 9 months ago

Added in d922c74. Use it like so:

import { configure, fs } from 'browserfs';
await configure({
    '/example/session': {
        fs: 'Storage',
        options: {
            storage: sessionStorage
        }
    }
});