@zenfs/core
Advanced tools
Comparing version 0.9.3 to 0.9.4
@@ -176,2 +176,5 @@ import type { Cred } from '../cred.js'; | ||
openFile(path: string, flag: string, cred: Cred): Promise<import("../file.js").File>; | ||
/** | ||
* Constructs a new FileIndex. | ||
*/ | ||
openFileSync(path: string, flag: string, cred: Cred): import("../file.js").File; | ||
@@ -178,0 +181,0 @@ readdir(path: string, cred: Cred): Promise<string[]>; |
@@ -42,3 +42,3 @@ import { type Cred } from './cred.js'; | ||
constructor(options?: object); | ||
abstract ready(): Promise<this>; | ||
ready(): Promise<this>; | ||
/** | ||
@@ -45,0 +45,0 @@ * Asynchronous rename. No arguments other than a possible exception |
@@ -30,2 +30,5 @@ import { ApiError, ErrorCode } from './ApiError.js'; | ||
} | ||
async ready() { | ||
return this; | ||
} | ||
/** | ||
@@ -61,5 +64,2 @@ * Test whether or not the given path exists by checking with the file system. | ||
class _SyncFileSystem extends FS { | ||
async ready() { | ||
return this; | ||
} | ||
async exists(path, cred) { | ||
@@ -126,2 +126,3 @@ return this.existsSync(path, cred); | ||
await this._sync.ready(); | ||
await super.ready(); | ||
if (this._isInitialized) { | ||
@@ -201,6 +202,5 @@ return this; | ||
const asyncFile = await this.openFile(p, parseFlag('r'), rootCred); | ||
const syncFile = this._sync.createFileSync(p, parseFlag('w'), stats.mode, rootCred); | ||
const syncFile = this._sync.createFileSync(p, parseFlag('w'), stats.mode, stats.cred()); | ||
try { | ||
const { size } = await asyncFile.stat(); | ||
const buffer = new Uint8Array(size); | ||
const buffer = new Uint8Array(stats.size); | ||
await asyncFile.read(buffer); | ||
@@ -207,0 +207,0 @@ syncFile.writeSync(buffer); |
{ | ||
"name": "@zenfs/core", | ||
"version": "0.9.3", | ||
"version": "0.9.4", | ||
"description": "A filesystem in your browser", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -138,3 +138,3 @@ import { dirname, basename, join, resolve } from '../emulation/path.js'; | ||
public async ready() { | ||
public async ready(): Promise<this> { | ||
if (this._options.lruCacheSize > 0) { | ||
@@ -141,0 +141,0 @@ this._cache = new LRUCache(this._options.lruCacheSize); |
@@ -62,3 +62,5 @@ import type { ExtractProperties } from 'utilium'; | ||
public abstract ready(): Promise<this>; | ||
public async ready(): Promise<this> { | ||
return this; | ||
} | ||
@@ -222,6 +224,2 @@ /** | ||
abstract class _SyncFileSystem extends FS implements SyncFileSystem { | ||
public async ready(): Promise<this> { | ||
return this; | ||
} | ||
public async exists(path: string, cred: Cred): Promise<boolean> { | ||
@@ -330,2 +328,3 @@ return this.existsSync(path, cred); | ||
await this._sync.ready(); | ||
await super.ready(); | ||
if (this._isInitialized) { | ||
@@ -416,6 +415,5 @@ return this; | ||
const asyncFile = await this.openFile(p, parseFlag('r'), rootCred); | ||
const syncFile = this._sync.createFileSync(p, parseFlag('w'), stats.mode, rootCred); | ||
const syncFile = this._sync.createFileSync(p, parseFlag('w'), stats.mode, stats.cred()); | ||
try { | ||
const { size } = await asyncFile.stat(); | ||
const buffer = new Uint8Array(size); | ||
const buffer = new Uint8Array(stats.size); | ||
await asyncFile.read(buffer); | ||
@@ -422,0 +420,0 @@ syncFile.writeSync(buffer); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
19789
1787749