@zenfs/core
Advanced tools
Comparing version
@@ -72,2 +72,12 @@ import { Cred } from '../cred.js'; | ||
} | ||
export interface AsyncStoreFileSystemOptions { | ||
/** | ||
* Promise that resolves to the store | ||
*/ | ||
store: Promise<AsyncStore>; | ||
/** | ||
* The size of the cache. If not provided, no cache will be used | ||
*/ | ||
cacheSize?: number; | ||
} | ||
/** | ||
@@ -82,3 +92,3 @@ * An "Asynchronous key-value file system". Stores data to/retrieves data from | ||
ready(): Promise<this>; | ||
constructor(cacheSize: number); | ||
constructor({ store, cacheSize }: AsyncStoreFileSystemOptions); | ||
/** | ||
@@ -88,3 +98,3 @@ * Initializes the file system. Typically called by subclasses' async | ||
*/ | ||
init(store: AsyncStore): Promise<void>; | ||
protected _initialize(store: Promise<AsyncStore>): Promise<this>; | ||
/** | ||
@@ -91,0 +101,0 @@ * Delete all contents stored in the file system. |
@@ -76,3 +76,3 @@ import { dirname, basename, join, resolve } from '../emulation/path.js'; | ||
} | ||
constructor(cacheSize) { | ||
constructor({ store, cacheSize }) { | ||
super(); | ||
@@ -82,2 +82,3 @@ if (cacheSize > 0) { | ||
} | ||
this._ready = this._initialize(store); | ||
} | ||
@@ -88,6 +89,7 @@ /** | ||
*/ | ||
async init(store) { | ||
this.store = store; | ||
async _initialize(store) { | ||
this.store = await store; | ||
// INVARIANT: Ensure that the root exists. | ||
await this.makeRootDirectory(); | ||
return this; | ||
} | ||
@@ -94,0 +96,0 @@ /** |
@@ -109,3 +109,3 @@ import { Cred } from '../cred.js'; | ||
} | ||
export interface SyncFileSystemOptions { | ||
export interface SyncStoreFileSystemOptions { | ||
/** | ||
@@ -134,3 +134,3 @@ * The actual key-value store to read from/write to. | ||
protected store: SyncStore; | ||
constructor(options: SyncFileSystemOptions); | ||
constructor(options: SyncStoreFileSystemOptions); | ||
get metadata(): FileSystemMetadata; | ||
@@ -137,0 +137,0 @@ /** |
{ | ||
"name": "@zenfs/core", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A filesystem in your browser", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1458261
0.06%11134
0.12%