New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@zenfs/core

Package Overview
Dependencies
Maintainers
1
Versions
171
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zenfs/core - npm Package Compare versions

Comparing version 0.12.7 to 0.12.8

1

dist/backends/index/fs.d.ts

@@ -23,2 +23,3 @@ import type { Cred } from '../../cred.js';

syncSync(path: string, data: Uint8Array, stats: Readonly<Stats>): void;
_disableSync?: boolean | undefined;
ready(): Promise<void>;

@@ -25,0 +26,0 @@ stat(path: string, cred: Cred): Promise<Stats>;

7

dist/backends/port/fs.d.ts

@@ -44,3 +44,2 @@ /// <reference types="node" resolution-mode="require"/>

declare const PortFS_base: (abstract new (...args: any[]) => {
_disableSync: boolean;
_sync?: FileSystem | undefined;

@@ -60,2 +59,3 @@ queueDone(): Promise<void>;

syncSync(path: string, data: Uint8Array, stats: Readonly<Stats>): void;
_disableSync?: boolean | undefined;
rename(oldPath: string, newPath: string, cred: Cred): Promise<void>;

@@ -67,6 +67,3 @@ stat(path: string, cred: Cred): Promise<Stats>;

rmdir(path: string, cred: Cred): Promise<void>;
mkdir(path: string, mode: number, cred: Cred): Promise<void>; /**
* Constructs a new PortFS instance that connects with ZenFS running on
* the specified port.
*/
mkdir(path: string, mode: number, cred: Cred): Promise<void>;
readdir(path: string, cred: Cred): Promise<string[]>;

@@ -73,0 +70,0 @@ exists(path: string, cred: Cred): Promise<boolean>;

@@ -16,11 +16,10 @@ import type { Cred } from '../../cred.js';

export declare class StoreFS<T extends Store = Store> extends FileSystem {
private $store;
protected get store(): T;
protected _store?: T;
protected store: T;
private _initialized;
ready(): Promise<void>;
constructor($store: T | Promise<T>);
constructor(store: T);
metadata(): FileSystemMetadata;
/**
* Delete all contents stored in the file system.
* @deprecated
*/

@@ -30,2 +29,3 @@ empty(): Promise<void>;

* Delete all contents stored in the file system.
* @deprecated
*/

@@ -32,0 +32,0 @@ emptySync(): void;

@@ -19,24 +19,16 @@ import { W_OK, R_OK } from '../../emulation/constants.js';

export class StoreFS extends FileSystem {
get store() {
if (!this._store) {
throw new ErrnoError(Errno.ENODATA, 'No store attached');
}
return this._store;
}
async ready() {
await super.ready();
if (this._initialized) {
return;
}
await this.makeRootDirectory();
this._initialized = true;
this._store = await this.$store;
}
constructor($store) {
constructor(store) {
super();
this.$store = $store;
this.store = store;
this._initialized = false;
if (!($store instanceof Promise)) {
this._store = $store;
if (!this._disableSync) {
this.makeRootDirectorySync();
this._initialized = true;
this.makeRootDirectorySync();
}

@@ -52,2 +44,3 @@ }

* Delete all contents stored in the file system.
* @deprecated
*/

@@ -61,2 +54,3 @@ async empty() {

* Delete all contents stored in the file system.
* @deprecated
*/

@@ -63,0 +57,0 @@ emptySync() {

import type { Ino } from '../../inode.js';
import { type Store, SyncTransaction } from './store.js';
import { SyncTransaction, type Store } from './store.js';
/**

@@ -35,4 +35,3 @@ * An interface for simple synchronous stores that don't have special support for transactions and such.

*/
export declare class SimpleTransaction extends SyncTransaction {
protected store: SimpleSyncStore;
export declare class SimpleTransaction extends SyncTransaction<SimpleSyncStore> {
/**

@@ -47,2 +46,3 @@ * Stores data in the keys we modify prior to modifying them.

protected modifiedKeys: Set<Ino>;
protected store: SimpleSyncStore;
constructor(store: SimpleSyncStore);

@@ -49,0 +49,0 @@ getSync(ino: Ino): Uint8Array;

@@ -47,4 +47,3 @@ import { SyncTransaction } from './store.js';

constructor(store) {
super();
this.store = store;
super(store);
/**

@@ -51,0 +50,0 @@ * Stores data in the keys we modify prior to modifying them.

@@ -9,3 +9,3 @@ import type { Ino } from '../../inode.js';

*/
name: string;
readonly name: string;
/**

@@ -29,5 +29,7 @@ * Syncs the store

/**
* A transaction for a synchronous store.
* A transaction for a store.
*/
export declare abstract class Transaction {
export declare abstract class Transaction<T extends Store = Store> {
protected store: T;
constructor(store: T);
protected aborted: boolean;

@@ -96,3 +98,3 @@ /**

*/
export declare abstract class SyncTransaction extends Transaction {
export declare abstract class SyncTransaction<T extends Store = Store> extends Transaction<T> {
get(ino: Ino): Promise<Uint8Array>;

@@ -106,10 +108,9 @@ set(ino: bigint, data: Uint8Array): Promise<void>;

* Transaction that only supports asynchronous operations
* @todo Add caching
*/
export declare abstract class AsyncTransaction extends Transaction {
getSync(ino: Ino): Uint8Array;
setSync(ino: bigint, data: Uint8Array): void;
removeSync(ino: bigint): void;
export declare abstract class AsyncTransaction<T extends Store = Store> extends Transaction<T> {
getSync(): Uint8Array;
setSync(): void;
removeSync(): void;
commitSync(): void;
abortSync(): void;
}
import { ErrnoError } from '../../error.js';
/**
* A transaction for a synchronous store.
* A transaction for a store.
*/
export class Transaction {
constructor() {
constructor(store) {
this.store = store;
this.aborted = false;

@@ -44,12 +45,11 @@ }

* Transaction that only supports asynchronous operations
* @todo Add caching
*/
export class AsyncTransaction extends Transaction {
getSync(ino) {
getSync() {
throw ErrnoError.With('ENOSYS', undefined, 'AsyncTransaction.getSync');
}
setSync(ino, data) {
setSync() {
throw ErrnoError.With('ENOSYS', undefined, 'AsyncTransaction.setSync');
}
removeSync(ino) {
removeSync() {
throw ErrnoError.With('ENOSYS', undefined, 'AsyncTransaction.removeSync');

@@ -56,0 +56,0 @@ }

@@ -67,2 +67,8 @@ import { type Cred } from './cred.js';

metadata(): FileSystemMetadata;
/**
* Whether the sync cache should be disabled.
* Only affects async things.
* @internal @protected
*/
_disableSync?: boolean;
constructor();

@@ -190,15 +196,8 @@ ready(): Promise<void>;

* @internal
* Note: `_*` should be treated like protected.
* Protected can't be used because of TS quirks however.
*/
declare abstract class AsyncFS extends FileSystem {
/**
* @access protected
* @hidden
* protected can't be used because of TS quirks.
* @hidden @protected
*/
_disableSync: boolean;
/**
* @access protected
* @hidden
*/
abstract _sync?: FileSystem;

@@ -205,0 +204,0 @@ queueDone(): Promise<void>;

@@ -19,3 +19,3 @@ import { ErrnoError, Errno } from './error.js';

return {
name: this.constructor.name,
name: this.constructor.name.toLowerCase(),
readonly: false,

@@ -25,3 +25,3 @@ totalSpace: 0,

noResizableBuffers: false,
noAsyncCache: false,
noAsyncCache: this._disableSync ?? false,
type: ZenFsType,

@@ -119,3 +119,2 @@ };

this._isInitialized = false;
this._disableSync = false;
}

@@ -147,8 +146,2 @@ get _queueRunning() {

}
metadata() {
return {
...super.metadata(),
noAsyncCache: this._disableSync,
};
}
checkSync(path, syscall) {

@@ -155,0 +148,0 @@ if (this._disableSync) {

{
"name": "@zenfs/core",
"version": "0.12.7",
"version": "0.12.8",
"description": "A filesystem in your browser",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -23,29 +23,17 @@ import type { Cred } from '../../cred.js';

export class StoreFS<T extends Store = Store> extends FileSystem {
protected get store(): T {
if (!this._store) {
throw new ErrnoError(Errno.ENODATA, 'No store attached');
}
return this._store;
}
protected _store?: T;
private _initialized: boolean = false;
public async ready(): Promise<void> {
await super.ready();
if (this._initialized) {
return;
}
await this.makeRootDirectory();
this._initialized = true;
this._store = await this.$store;
}
constructor(private $store: T | Promise<T>) {
constructor(protected store: T) {
super();
if (!($store instanceof Promise)) {
this._store = $store;
if (!this._disableSync) {
this.makeRootDirectorySync();
this._initialized = true;
this.makeRootDirectorySync();
}

@@ -63,2 +51,3 @@ }

* Delete all contents stored in the file system.
* @deprecated
*/

@@ -73,2 +62,3 @@ public async empty(): Promise<void> {

* Delete all contents stored in the file system.
* @deprecated
*/

@@ -75,0 +65,0 @@ public emptySync(): void {

import type { Ino } from '../../inode.js';
import { type Store, SyncTransaction } from './store.js';
import { SyncTransaction, type Store } from './store.js';

@@ -72,3 +72,3 @@ /**

*/
export class SimpleTransaction extends SyncTransaction {
export class SimpleTransaction extends SyncTransaction<SimpleSyncStore> {
/**

@@ -84,4 +84,6 @@ * Stores data in the keys we modify prior to modifying them.

constructor(protected store: SimpleSyncStore) {
super();
protected declare store: SimpleSyncStore;
constructor(store: SimpleSyncStore) {
super(store);
}

@@ -88,0 +90,0 @@

@@ -11,3 +11,3 @@ import { ErrnoError } from '../../error.js';

*/
name: string;
readonly name: string;

@@ -36,5 +36,7 @@ /**

/**
* A transaction for a synchronous store.
* A transaction for a store.
*/
export abstract class Transaction {
export abstract class Transaction<T extends Store = Store> {
constructor(protected store: T) {}
protected aborted: boolean = false;

@@ -128,3 +130,3 @@

*/
export abstract class SyncTransaction extends Transaction {
export abstract class SyncTransaction<T extends Store = Store> extends Transaction<T> {
public async get(ino: Ino): Promise<Uint8Array> {

@@ -149,17 +151,20 @@ return this.getSync(ino);

* Transaction that only supports asynchronous operations
* @todo Add caching
*/
export abstract class AsyncTransaction extends Transaction {
public getSync(ino: Ino): Uint8Array {
export abstract class AsyncTransaction<T extends Store = Store> extends Transaction<T> {
public getSync(): Uint8Array {
throw ErrnoError.With('ENOSYS', undefined, 'AsyncTransaction.getSync');
}
public setSync(ino: bigint, data: Uint8Array): void {
public setSync(): void {
throw ErrnoError.With('ENOSYS', undefined, 'AsyncTransaction.setSync');
}
public removeSync(ino: bigint): void {
public removeSync(): void {
throw ErrnoError.With('ENOSYS', undefined, 'AsyncTransaction.removeSync');
}
public commitSync(): void {
throw ErrnoError.With('ENOSYS', undefined, 'AsyncTransaction.commitSync');
}
public abortSync(): void {

@@ -166,0 +171,0 @@ throw ErrnoError.With('ENOSYS', undefined, 'AsyncTransaction.abortSync');

@@ -83,3 +83,3 @@ import type { ExtractProperties } from 'utilium';

return {
name: this.constructor.name,
name: this.constructor.name.toLowerCase(),
readonly: false,

@@ -89,3 +89,3 @@ totalSpace: 0,

noResizableBuffers: false,
noAsyncCache: false,
noAsyncCache: this._disableSync ?? false,
type: ZenFsType,

@@ -95,2 +95,9 @@ };

/**
* Whether the sync cache should be disabled.
* Only affects async things.
* @internal @protected
*/
_disableSync?: boolean;
public constructor() {}

@@ -299,15 +306,8 @@

* @internal
* Note: `_*` should be treated like protected.
* Protected can't be used because of TS quirks however.
*/
declare abstract class AsyncFS extends FileSystem {
/**
* @access protected
* @hidden
* protected can't be used because of TS quirks.
* @hidden @protected
*/
_disableSync: boolean;
/**
* @access protected
* @hidden
*/
abstract _sync?: FileSystem;

@@ -369,4 +369,2 @@ public queueDone(): Promise<void>;

_disableSync: boolean = false;
abstract _sync?: FileSystem;

@@ -392,9 +390,2 @@

public metadata(): FileSystemMetadata {
return {
...super.metadata(),
noAsyncCache: this._disableSync,
};
}
protected checkSync(path?: string, syscall?: string): asserts this is { _sync: FileSystem } {

@@ -401,0 +392,0 @@ if (this._disableSync) {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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