Socket
Socket
Sign inDemoInstall

memfs

Package Overview
Dependencies
1
Maintainers
1
Versions
143
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.8.0-next.1 to 4.8.0

lib/crud-to-cas/CrudCasBase.d.ts

10

lib/cas/types.d.ts
import type { CrudResourceInfo } from '../crud/types';
export interface CasApi {
put(blob: Uint8Array): Promise<string>;
get(hash: string, options?: CasGetOptions): Promise<Uint8Array>;
del(hash: string, silent?: boolean): Promise<void>;
info(hash: string): Promise<CrudResourceInfo>;
export interface CasApi<Hash> {
put(blob: Uint8Array): Promise<Hash>;
get(hash: Hash, options?: CasGetOptions): Promise<Uint8Array>;
del(hash: Hash, silent?: boolean): Promise<void>;
info(hash: Hash): Promise<CrudResourceInfo>;
}

@@ -8,0 +8,0 @@ export interface CasGetOptions {

@@ -1,14 +0,10 @@

import type { CasApi, CasGetOptions } from '../cas/types';
import type { CrudApi, CrudResourceInfo } from '../crud/types';
import { CrudCasBase } from './CrudCasBase';
import type { CrudApi } from '../crud/types';
export interface CrudCasOptions {
hash: (blob: Uint8Array) => Promise<string>;
}
export declare class CrudCas implements CasApi {
export declare class CrudCas extends CrudCasBase<string> {
protected readonly crud: CrudApi;
protected readonly options: CrudCasOptions;
constructor(crud: CrudApi, options: CrudCasOptions);
readonly put: (blob: Uint8Array) => Promise<string>;
readonly get: (hash: string, options?: CasGetOptions) => Promise<Uint8Array>;
readonly del: (hash: string, silent?: boolean) => Promise<void>;
readonly info: (hash: string) => Promise<CrudResourceInfo>;
}

@@ -5,51 +5,9 @@ "use strict";

const util_1 = require("./util");
const normalizeErrors = async (code) => {
try {
return await code();
}
catch (error) {
if (error && typeof error === 'object') {
switch (error.name) {
case 'ResourceNotFound':
case 'CollectionNotFound':
throw new DOMException(error.message, 'BlobNotFound');
}
}
throw error;
}
};
class CrudCas {
const CrudCasBase_1 = require("./CrudCasBase");
const hashEqual = (h1, h2) => h1 === h2;
class CrudCas extends CrudCasBase_1.CrudCasBase {
constructor(crud, options) {
super(crud, options.hash, util_1.hashToLocation, hashEqual);
this.crud = crud;
this.options = options;
this.put = async (blob) => {
const digest = await this.options.hash(blob);
const [collection, resource] = (0, util_1.hashToLocation)(digest);
await this.crud.put(collection, resource, blob);
return digest;
};
this.get = async (hash, options) => {
const [collection, resource] = (0, util_1.hashToLocation)(hash);
return await normalizeErrors(async () => {
const blob = await this.crud.get(collection, resource);
if (!(options === null || options === void 0 ? void 0 : options.skipVerification)) {
const digest = await this.options.hash(blob);
if (hash !== digest)
throw new DOMException('Blob contents does not match hash', 'Integrity');
}
return blob;
});
};
this.del = async (hash, silent) => {
const [collection, resource] = (0, util_1.hashToLocation)(hash);
await normalizeErrors(async () => {
return await this.crud.del(collection, resource, silent);
});
};
this.info = async (hash) => {
const [collection, resource] = (0, util_1.hashToLocation)(hash);
return await normalizeErrors(async () => {
return await this.crud.info(collection, resource);
});
};
}

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

/// <reference types="node" />
import { Readable } from 'stream';
import { Defer } from 'thingies/es6/Defer';
import { Defer } from '../thingies/Defer';
import type { FsaNodeFsOpenFile } from './FsaNodeFsOpenFile';

@@ -16,3 +16,3 @@ import type { IReadStream } from '../node/types/misc';

protected __bytes__: number;
protected readonly __mutex__: <T = unknown>(code: import("thingies/es6/types").Code<T>) => Promise<T>;
protected readonly __mutex__: <T = unknown>(code: import("../thingies/types").Code<T>) => Promise<T>;
protected readonly __file__: Defer<FsaNodeFsOpenFile>;

@@ -19,0 +19,0 @@ constructor(fs: FsaNodeFs, handle: Promise<FsaNodeFsOpenFile>, path: string, options: IReadStreamOptions);

@@ -5,4 +5,4 @@ "use strict";

const stream_1 = require("stream");
const Defer_1 = require("thingies/es6/Defer");
const concurrency_1 = require("thingies/es6/concurrency");
const Defer_1 = require("../thingies/Defer");
const concurrency_1 = require("../thingies/concurrency");
class FsaNodeReadStream extends stream_1.Readable {

@@ -9,0 +9,0 @@ constructor(fs, handle, path, options) {

@@ -35,3 +35,3 @@ /// <reference types="node" />

protected readonly __stream__: Promise<IFileSystemWritableFileStream>;
protected readonly __mutex__: <T = unknown>(code: import("thingies/es6/types").Code<T>) => Promise<T>;
protected readonly __mutex__: <T = unknown>(code: import("../thingies/types").Code<T>) => Promise<T>;
constructor(handle: Promise<FsaNodeFsOpenFile>, path: string, options: IWriteStreamOptions);

@@ -38,0 +38,0 @@ private ___write___;

@@ -5,4 +5,4 @@ "use strict";

const stream_1 = require("stream");
const Defer_1 = require("thingies/es6/Defer");
const concurrency_1 = require("thingies/es6/concurrency");
const Defer_1 = require("../thingies/Defer");
const concurrency_1 = require("../thingies/concurrency");
const util_1 = require("../node/util");

@@ -9,0 +9,0 @@ const queueMicrotask_1 = require("../queueMicrotask");

@@ -1,4 +0,4 @@

import { CborEncoder } from 'json-joy/es6/json-pack/cbor/CborEncoder';
import { CborDecoder } from 'json-joy/es6/json-pack/cbor/CborDecoder';
export declare const encoder: CborEncoder<import("json-joy/es6/util/buffers").IWriter & import("json-joy/es6/util/buffers").IWriterGrowable>;
export declare const decoder: CborDecoder<import("json-joy/es6/util/buffers").IReader & import("json-joy/es6/util/buffers").IReaderResettable>;
import { CborEncoder } from '../json-joy/json-pack/cbor/CborEncoder';
import { CborDecoder } from '../json-joy/json-pack/cbor/CborDecoder';
export declare const encoder: CborEncoder<import("../json-joy/util/buffers").IWriter & import("../json-joy/util/buffers").IWriterGrowable>;
export declare const decoder: CborDecoder<import("../json-joy/util/buffers").IReader & import("../json-joy/util/buffers").IReaderResettable>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.decoder = exports.encoder = void 0;
const CborEncoder_1 = require("json-joy/es6/json-pack/cbor/CborEncoder");
const CborDecoder_1 = require("json-joy/es6/json-pack/cbor/CborDecoder");
const CborEncoder_1 = require("../json-joy/json-pack/cbor/CborEncoder");
const CborDecoder_1 = require("../json-joy/json-pack/cbor/CborDecoder");
exports.encoder = new CborEncoder_1.CborEncoder();
exports.decoder = new CborDecoder_1.CborDecoder();
//# sourceMappingURL=json.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FsaNodeSyncAdapterWorker = void 0;
const Defer_1 = require("thingies/es6/Defer");
const Defer_1 = require("../../thingies/Defer");
const SyncMessenger_1 = require("./SyncMessenger");

@@ -6,0 +6,0 @@ const json_1 = require("../json");

/// <reference types="node" />
/// <reference types="node" />
import { Buffer } from 'buffer';

@@ -4,0 +3,0 @@ declare const bufferAllocUnsafe: (size: number) => Buffer;

@@ -18,3 +18,3 @@ "use strict";

exports.basename = basename;
const nameRegex = /^(\.{1,2})|(.*(\/|\\).*)$/;
const nameRegex = /^(\.{1,2})$|^(.*([\/\\]).*)$/;
const assertName = (name, method, klass) => {

@@ -21,0 +21,0 @@ const isInvalid = !name || nameRegex.test(name);

/// <reference types="node" />
/// <reference types="node" />
import { Volume } from './volume';

@@ -4,0 +3,0 @@ import { EventEmitter } from 'events';

@@ -1,2 +0,1 @@

/// <reference types="node" />
import type * as opts from './types/options';

@@ -3,0 +2,0 @@ import type { IFileHandle, IStats, TData, TDataOut, TMode, TTime } from './types/misc';

/// <reference types="node" />
/// <reference types="node" />
import type { constants } from '../../constants';

@@ -4,0 +3,0 @@ import * as misc from './misc';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toTreeSync = void 0;
const printTree_1 = require("json-joy/es6/util/print/printTree");
const printTree_1 = require("../json-joy/util/print/printTree");
const util_1 = require("../node-to-fsa/util");

@@ -6,0 +6,0 @@ const toTreeSync = (fs, opts = {}) => {

@@ -1,2 +0,2 @@

import type { CborUint8Array } from 'json-joy/es6/json-pack/cbor/types';
import type { CborUint8Array } from '../json-joy/json-pack/cbor/types';
import type { AsyncSnapshotOptions, SnapshotNode, SnapshotOptions } from './types';

@@ -3,0 +3,0 @@ export declare const toBinarySnapshotSync: (options: SnapshotOptions) => CborUint8Array<SnapshotNode>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fromBinarySnapshot = exports.toBinarySnapshot = exports.fromBinarySnapshotSync = exports.toBinarySnapshotSync = void 0;
const CborEncoder_1 = require("json-joy/es6/json-pack/cbor/CborEncoder");
const CborDecoder_1 = require("json-joy/es6/json-pack/cbor/CborDecoder");
const CborEncoder_1 = require("../json-joy/json-pack/cbor/CborEncoder");
const CborDecoder_1 = require("../json-joy/json-pack/cbor/CborDecoder");
const sync_1 = require("./sync");

@@ -7,0 +7,0 @@ const async_1 = require("./async");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fromJsonSnapshot = exports.toJsonSnapshot = exports.fromJsonSnapshotSync = exports.toJsonSnapshotSync = void 0;
const JsonEncoder_1 = require("json-joy/es6/json-pack/json/JsonEncoder");
const JsonDecoder_1 = require("json-joy/es6/json-pack/json/JsonDecoder");
const JsonEncoder_1 = require("../json-joy/json-pack/json/JsonEncoder");
const JsonDecoder_1 = require("../json-joy/json-pack/json/JsonDecoder");
const sync_1 = require("./sync");

@@ -7,0 +7,0 @@ const async_1 = require("./async");

@@ -1,2 +0,2 @@

import { Writer } from 'json-joy/es6/util/buffers/Writer';
import { Writer } from '../json-joy/util/buffers/Writer';
export declare const writer: Writer;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.writer = void 0;
const Writer_1 = require("json-joy/es6/util/buffers/Writer");
const Writer_1 = require("../json-joy/util/buffers/Writer");
exports.writer = new Writer_1.Writer(1024 * 32);
//# sourceMappingURL=shared.js.map
{
"name": "memfs",
"version": "4.8.0-next.1",
"version": "4.8.0",
"description": "In-memory file-system with Node's fs API.",

@@ -53,3 +53,3 @@ "keywords": [

"scripts": {
"build": "tsc -p .",
"build": "tsc -p . && rimraf --glob lib/__tests__ 'lib/**/__tests__'",
"build:webfs": "NODE_ENV=production webpack --config ./src/webfs/webpack.config.js",

@@ -63,4 +63,4 @@ "clean": "rimraf lib types",

"demo:webfs": "webpack serve --config ./src/webfs/webpack.config.js",
"prettier": "prettier --ignore-path .gitignore --write \"src/**/*.{ts,js}\"",
"prettier:diff": "prettier -l \"src/**/*.{ts,js}\"",
"prettier": "prettier --write .",
"prettier:check": "prettier --check .",
"test": "jest --maxWorkers 2",

@@ -125,3 +125,5 @@ "test:coverage": "jest --coverage",

},
"dependencies": {},
"dependencies": {
"tslib": "^2.0.0"
},
"devDependencies": {

@@ -140,6 +142,4 @@ "@semantic-release/changelog": "^6.0.1",

"jest": "^29.0.0",
"json-joy": "^11.0.0",
"path-browserify": "^1.0.1",
"prettier": "^2.7.1",
"pretty-quick": "^4.0.0",
"prettier": "^3.0.0",
"process": "^0.11.10",

@@ -150,3 +150,2 @@ "readable-stream": "^4.4.0",

"tar-stream": "^3.1.2",
"thingies": "^1.11.1",
"ts-jest": "^29.1.0",

@@ -164,15 +163,2 @@ "ts-loader": "^9.4.3",

},
"peerDependencies": {
"json-joy": "^11.0.0",
"thingies": "^1.11.1",
"tslib": "2"
},
"peerDependenciesMeta": {
"json-joy": {
"optional": true
},
"thingies": {
"optional": true
}
},
"engines": {

@@ -179,0 +165,0 @@ "node": ">= 4.0.0"

@@ -12,3 +12,2 @@ # memfs

## Install

@@ -20,3 +19,2 @@

## Docs

@@ -32,3 +30,2 @@

## Demos

@@ -43,3 +40,2 @@

## See also

@@ -57,5 +53,4 @@

## License
Apache 2.0

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc