Socket
Socket
Sign inDemoInstall

memfs

Package Overview
Dependencies
1
Maintainers
1
Versions
145
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.5.3 to 3.6.0

lib/node/FileHandle.d.ts

53

lib/Dirent.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Dirent = void 0;
var constants_1 = require("./constants");
var encoding_1 = require("./encoding");
var S_IFMT = constants_1.constants.S_IFMT, S_IFDIR = constants_1.constants.S_IFDIR, S_IFREG = constants_1.constants.S_IFREG, S_IFBLK = constants_1.constants.S_IFBLK, S_IFCHR = constants_1.constants.S_IFCHR, S_IFLNK = constants_1.constants.S_IFLNK, S_IFIFO = constants_1.constants.S_IFIFO, S_IFSOCK = constants_1.constants.S_IFSOCK;
const constants_1 = require("./constants");
const encoding_1 = require("./encoding");
const { S_IFMT, S_IFDIR, S_IFREG, S_IFBLK, S_IFCHR, S_IFLNK, S_IFIFO, S_IFSOCK } = constants_1.constants;
/**
* A directory entry, like `fs.Dirent`.
*/
var Dirent = /** @class */ (function () {
function Dirent() {
class Dirent {
constructor() {
this.name = '';
this.mode = 0;
}
Dirent.build = function (link, encoding) {
var dirent = new Dirent();
var mode = link.getNode().mode;
static build(link, encoding) {
const dirent = new Dirent();
const { mode } = link.getNode();
dirent.name = (0, encoding_1.strToEncoding)(link.getName(), encoding);
dirent.mode = mode;
return dirent;
};
Dirent.prototype._checkModeProperty = function (property) {
}
_checkModeProperty(property) {
return (this.mode & S_IFMT) === property;
};
Dirent.prototype.isDirectory = function () {
}
isDirectory() {
return this._checkModeProperty(S_IFDIR);
};
Dirent.prototype.isFile = function () {
}
isFile() {
return this._checkModeProperty(S_IFREG);
};
Dirent.prototype.isBlockDevice = function () {
}
isBlockDevice() {
return this._checkModeProperty(S_IFBLK);
};
Dirent.prototype.isCharacterDevice = function () {
}
isCharacterDevice() {
return this._checkModeProperty(S_IFCHR);
};
Dirent.prototype.isSymbolicLink = function () {
}
isSymbolicLink() {
return this._checkModeProperty(S_IFLNK);
};
Dirent.prototype.isFIFO = function () {
}
isFIFO() {
return this._checkModeProperty(S_IFIFO);
};
Dirent.prototype.isSocket = function () {
}
isSocket() {
return this._checkModeProperty(S_IFSOCK);
};
return Dirent;
}());
}
}
exports.Dirent = Dirent;
exports.default = Dirent;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.strToEncoding = exports.assertEncoding = exports.ENCODING_UTF8 = void 0;
var buffer_1 = require("./internal/buffer");
var errors = require("./internal/errors");
const buffer_1 = require("./internal/buffer");
const errors = require("./internal/errors");
exports.ENCODING_UTF8 = 'utf8';

@@ -7,0 +7,0 @@ function assertEncoding(encoding) {

import Stats from './Stats';
import Dirent from './Dirent';
import { Volume as _Volume, StatWatcher, FSWatcher, IReadStream, IWriteStream, DirectoryJSON } from './volume';
import { IPromisesAPI } from './promises';
import { constants } from './constants';
import type { FsPromisesApi } from './node/types';
export { DirectoryJSON };

@@ -17,3 +17,3 @@ export declare const Volume: typeof _Volume;

WriteStream: new (...args: any[]) => IWriteStream;
promises: IPromisesAPI;
promises: FsPromisesApi;
_toUnixTimestamp: any;

@@ -23,1 +23,15 @@ }

export declare const fs: IFs;
/**
* Creates a new file system instance.
*
* @param json File system structure expressed as a JSON object.
* Use `null` for empty directories and empty string for empty files.
* @param cwd Current working directory. The JSON structure will be created
* relative to this path.
* @returns A `memfs` file system instance, which is a drop-in replacement for
* the `fs` module.
*/
export declare const memfs: (json?: DirectoryJSON, cwd?: string) => IFs;
export type IFsWithVolume = IFs & {
__vol: _Volume;
};
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.fs = exports.createFsFromVolume = exports.vol = exports.Volume = void 0;
var Stats_1 = require("./Stats");
var Dirent_1 = require("./Dirent");
var volume_1 = require("./volume");
var _a = require('fs-monkey/lib/util/lists'), fsSyncMethods = _a.fsSyncMethods, fsAsyncMethods = _a.fsAsyncMethods;
var constants_1 = require("./constants");
var F_OK = constants_1.constants.F_OK, R_OK = constants_1.constants.R_OK, W_OK = constants_1.constants.W_OK, X_OK = constants_1.constants.X_OK;
exports.memfs = exports.fs = exports.createFsFromVolume = exports.vol = exports.Volume = void 0;
const Stats_1 = require("./Stats");
const Dirent_1 = require("./Dirent");
const volume_1 = require("./volume");
const { fsSyncMethods, fsAsyncMethods } = require('fs-monkey/lib/util/lists');
const constants_1 = require("./constants");
const { F_OK, R_OK, W_OK, X_OK } = constants_1.constants;
exports.Volume = volume_1.Volume;

@@ -25,14 +14,10 @@ // Default volume.

function createFsFromVolume(vol) {
var fs = { F_OK: F_OK, R_OK: R_OK, W_OK: W_OK, X_OK: X_OK, constants: constants_1.constants, Stats: Stats_1.default, Dirent: Dirent_1.default };
const fs = { F_OK, R_OK, W_OK, X_OK, constants: constants_1.constants, Stats: Stats_1.default, Dirent: Dirent_1.default };
// Bind FS methods.
for (var _i = 0, fsSyncMethods_1 = fsSyncMethods; _i < fsSyncMethods_1.length; _i++) {
var method = fsSyncMethods_1[_i];
for (const method of fsSyncMethods)
if (typeof vol[method] === 'function')
fs[method] = vol[method].bind(vol);
}
for (var _a = 0, fsAsyncMethods_1 = fsAsyncMethods; _a < fsAsyncMethods_1.length; _a++) {
var method = fsAsyncMethods_1[_a];
for (const method of fsAsyncMethods)
if (typeof vol[method] === 'function')
fs[method] = vol[method].bind(vol);
}
fs.StatWatcher = vol.StatWatcher;

@@ -44,2 +29,3 @@ fs.FSWatcher = vol.FSWatcher;

fs._toUnixTimestamp = volume_1.toUnixTimestamp;
fs.__vol = vol;
return fs;

@@ -49,3 +35,19 @@ }

exports.fs = createFsFromVolume(exports.vol);
module.exports = __assign(__assign({}, module.exports), exports.fs);
/**
* Creates a new file system instance.
*
* @param json File system structure expressed as a JSON object.
* Use `null` for empty directories and empty string for empty files.
* @param cwd Current working directory. The JSON structure will be created
* relative to this path.
* @returns A `memfs` file system instance, which is a drop-in replacement for
* the `fs` module.
*/
const memfs = (json = {}, cwd = '/') => {
const volume = exports.Volume.fromJSON(json, cwd);
const fs = createFsFromVolume(volume);
return fs;
};
exports.memfs = memfs;
module.exports = Object.assign(Object.assign({}, module.exports), exports.fs);
module.exports.semantic = true;
"use strict";
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.bufferFrom = exports.bufferAllocUnsafe = exports.Buffer = void 0;
var buffer_1 = require("buffer");
const buffer_1 = require("buffer");
Object.defineProperty(exports, "Buffer", { enumerable: true, get: function () { return buffer_1.Buffer; } });
function bufferV0P12Ponyfill(arg0) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return new (buffer_1.Buffer.bind.apply(buffer_1.Buffer, __spreadArray([void 0, arg0], args, false)))();
function bufferV0P12Ponyfill(arg0, ...args) {
return new buffer_1.Buffer(arg0, ...args);
}
var bufferAllocUnsafe = buffer_1.Buffer.allocUnsafe || bufferV0P12Ponyfill;
const bufferAllocUnsafe = buffer_1.Buffer.allocUnsafe || bufferV0P12Ponyfill;
exports.bufferAllocUnsafe = bufferAllocUnsafe;
var bufferFrom = buffer_1.Buffer.from || bufferV0P12Ponyfill;
const bufferFrom = buffer_1.Buffer.from || bufferV0P12Ponyfill;
exports.bufferFrom = bufferFrom;

@@ -7,45 +7,21 @@ "use strict";

// message may change, the code should not.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.E = exports.AssertionError = exports.message = exports.RangeError = exports.TypeError = exports.Error = void 0;
var assert = require("assert");
var util = require("util");
var kCode = typeof Symbol === 'undefined' ? '_kCode' : Symbol('code');
var messages = {}; // new Map();
const assert = require("assert");
const util = require("util");
const kCode = typeof Symbol === 'undefined' ? '_kCode' : Symbol('code');
const messages = {}; // new Map();
function makeNodeError(Base) {
return /** @class */ (function (_super) {
__extends(NodeError, _super);
function NodeError(key) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var _this = _super.call(this, message(key, args)) || this;
_this.code = key;
_this[kCode] = key;
_this.name = "".concat(_super.prototype.name, " [").concat(_this[kCode], "]");
return _this;
return class NodeError extends Base {
constructor(key, ...args) {
super(message(key, args));
this.code = key;
this[kCode] = key;
this.name = `${super.name} [${this[kCode]}]`;
}
return NodeError;
}(Base));
};
}
var g = typeof globalThis !== 'undefined' ? globalThis : global;
var AssertionError = /** @class */ (function (_super) {
__extends(AssertionError, _super);
function AssertionError(options) {
var _this = this;
const g = typeof globalThis !== 'undefined' ? globalThis : global;
class AssertionError extends g.Error {
constructor(options) {
if (typeof options !== 'object' || options === null) {

@@ -55,19 +31,17 @@ throw new exports.TypeError('ERR_INVALID_ARG_TYPE', 'options', 'object');

if (options.message) {
_this = _super.call(this, options.message) || this;
super(options.message);
}
else {
_this = _super.call(this, "".concat(util.inspect(options.actual).slice(0, 128), " ") +
"".concat(options.operator, " ").concat(util.inspect(options.expected).slice(0, 128))) || this;
super(`${util.inspect(options.actual).slice(0, 128)} ` +
`${options.operator} ${util.inspect(options.expected).slice(0, 128)}`);
}
_this.generatedMessage = !options.message;
_this.name = 'AssertionError [ERR_ASSERTION]';
_this.code = 'ERR_ASSERTION';
_this.actual = options.actual;
_this.expected = options.expected;
_this.operator = options.operator;
exports.Error.captureStackTrace(_this, options.stackStartFunction);
return _this;
this.generatedMessage = !options.message;
this.name = 'AssertionError [ERR_ASSERTION]';
this.code = 'ERR_ASSERTION';
this.actual = options.actual;
this.expected = options.expected;
this.operator = options.operator;
exports.Error.captureStackTrace(this, options.stackStartFunction);
}
return AssertionError;
}(g.Error));
}
exports.AssertionError = AssertionError;

@@ -77,5 +51,5 @@ function message(key, args) {

// const msg = messages.get(key);
var msg = messages[key];
assert(msg, "An invalid error message key was used: ".concat(key, "."));
var fmt;
const msg = messages[key];
assert(msg, `An invalid error message key was used: ${key}.`);
let fmt;
if (typeof msg === 'function') {

@@ -121,6 +95,6 @@ fmt = msg;

E('ERR_CPU_USAGE', 'Unable to obtain cpu usage %s');
E('ERR_DNS_SET_SERVERS_FAILED', function (err, servers) { return "c-ares failed to set servers: \"".concat(err, "\" [").concat(servers, "]"); });
E('ERR_DNS_SET_SERVERS_FAILED', (err, servers) => `c-ares failed to set servers: "${err}" [${servers}]`);
E('ERR_FALSY_VALUE_REJECTION', 'Promise was rejected with falsy value');
E('ERR_ENCODING_NOT_SUPPORTED', function (enc) { return "The \"".concat(enc, "\" encoding is not supported"); });
E('ERR_ENCODING_INVALID_ENCODED_DATA', function (enc) { return "The encoded data was not valid for encoding ".concat(enc); });
E('ERR_ENCODING_NOT_SUPPORTED', enc => `The "${enc}" encoding is not supported`);
E('ERR_ENCODING_INVALID_ENCODED_DATA', enc => `The encoded data was not valid for encoding ${enc}`);
E('ERR_HTTP_HEADERS_SENT', 'Cannot render headers after they are sent to the client');

@@ -131,5 +105,5 @@ E('ERR_HTTP_INVALID_STATUS_CODE', 'Invalid status code: %s');

E('ERR_INVALID_ARG_TYPE', invalidArgType);
E('ERR_INVALID_ARRAY_LENGTH', function (name, len, actual) {
E('ERR_INVALID_ARRAY_LENGTH', (name, len, actual) => {
assert.strictEqual(typeof actual, 'number');
return "The array \"".concat(name, "\" (length ").concat(actual, ") must be of length ").concat(len, ".");
return `The array "${name}" (length ${actual}) must be of length ${len}.`;
});

@@ -145,6 +119,6 @@ E('ERR_INVALID_BUFFER_SIZE', 'Buffer size must be a multiple of %s');

E('ERR_INVALID_IP_ADDRESS', 'Invalid IP address: %s');
E('ERR_INVALID_OPT_VALUE', function (name, value) {
return "The value \"".concat(String(value), "\" is invalid for option \"").concat(name, "\"");
E('ERR_INVALID_OPT_VALUE', (name, value) => {
return `The value "${String(value)}" is invalid for option "${name}"`;
});
E('ERR_INVALID_OPT_VALUE_ENCODING', function (value) { return "The value \"".concat(String(value), "\" is invalid for option \"encoding\""); });
E('ERR_INVALID_OPT_VALUE_ENCODING', value => `The value "${String(value)}" is invalid for option "encoding"`);
E('ERR_INVALID_REPL_EVAL_CONFIG', 'Cannot specify both "breakEvalOnSigint" and "eval" for REPL');

@@ -155,3 +129,3 @@ E('ERR_INVALID_SYNC_FORK_INPUT', 'Asynchronous forks do not support Buffer, Uint8Array or string input: %s');

E('ERR_INVALID_URL', 'Invalid URL: %s');
E('ERR_INVALID_URL_SCHEME', function (expected) { return "The URL must be ".concat(oneOf(expected, 'scheme')); });
E('ERR_INVALID_URL_SCHEME', expected => `The URL must be ${oneOf(expected, 'scheme')}`);
E('ERR_IPC_CHANNEL_CLOSED', 'Channel closed');

@@ -178,3 +152,3 @@ E('ERR_IPC_DISCONNECTED', 'IPC channel is already disconnected');

E('ERR_TLS_CERT_ALTNAME_INVALID', "Hostname/IP does not match certificate's altnames: %s");
E('ERR_TLS_DH_PARAM_SIZE', function (size) { return "DH parameter size ".concat(size, " is less than 2048"); });
E('ERR_TLS_DH_PARAM_SIZE', size => `DH parameter size ${size} is less than 2048`);
E('ERR_TLS_HANDSHAKE_TIMEOUT', 'TLS handshake timeout');

@@ -194,3 +168,3 @@ E('ERR_TLS_RENEGOTIATION_FAILED', 'Failed to renegotiate');

// determiner: 'must be' or 'must not be'
var determiner;
let determiner;
if (expected.includes('not ')) {

@@ -203,43 +177,39 @@ determiner = 'must not be';

}
var msg;
let msg;
if (Array.isArray(name)) {
var names = name.map(function (val) { return "\"".concat(val, "\""); }).join(', ');
msg = "The ".concat(names, " arguments ").concat(determiner, " ").concat(oneOf(expected, 'type'));
const names = name.map(val => `"${val}"`).join(', ');
msg = `The ${names} arguments ${determiner} ${oneOf(expected, 'type')}`;
}
else if (name.includes(' argument')) {
// for the case like 'first argument'
msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`;
}
else {
var type = name.includes('.') ? 'property' : 'argument';
msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
const type = name.includes('.') ? 'property' : 'argument';
msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`;
}
// if actual value received, output it
if (arguments.length >= 3) {
msg += ". Received type ".concat(actual !== null ? typeof actual : 'null');
msg += `. Received type ${actual !== null ? typeof actual : 'null'}`;
}
return msg;
}
function missingArgs() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
function missingArgs(...args) {
assert(args.length > 0, 'At least one arg needs to be specified');
var msg = 'The ';
var len = args.length;
args = args.map(function (a) { return "\"".concat(a, "\""); });
let msg = 'The ';
const len = args.length;
args = args.map(a => `"${a}"`);
switch (len) {
case 1:
msg += "".concat(args[0], " argument");
msg += `${args[0]} argument`;
break;
case 2:
msg += "".concat(args[0], " and ").concat(args[1], " arguments");
msg += `${args[0]} and ${args[1]} arguments`;
break;
default:
msg += args.slice(0, len - 1).join(', ');
msg += ", and ".concat(args[len - 1], " arguments");
msg += `, and ${args[len - 1]} arguments`;
break;
}
return "".concat(msg, " must be specified");
return `${msg} must be specified`;
}

@@ -250,18 +220,18 @@ function oneOf(expected, thing) {

if (Array.isArray(expected)) {
var len = expected.length;
const len = expected.length;
assert(len > 0, 'At least one expected value needs to be specified');
// tslint:disable-next-line
expected = expected.map(function (i) { return String(i); });
expected = expected.map(i => String(i));
if (len > 2) {
return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1];
return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` + expected[len - 1];
}
else if (len === 2) {
return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);
return `one of ${thing} ${expected[0]} or ${expected[1]}`;
}
else {
return "of ".concat(thing, " ").concat(expected[0]);
return `of ${thing} ${expected[0]}`;
}
}
else {
return "of ".concat(thing, " ").concat(String(expected));
return `of ${thing} ${String(expected)}`;
}

@@ -274,4 +244,4 @@ }

else {
return "\"".concat(name, "\" is outside of buffer bounds");
return `"${name}" is outside of buffer bounds`;
}
}

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

write(buf: Buffer, off?: number, len?: number, pos?: number): number;
read(buf: Buffer | Uint8Array, off?: number, len?: number, pos?: number): number;
read(buf: Buffer | ArrayBufferView | DataView, off?: number, len?: number, pos?: number): number;
truncate(len?: number): void;

@@ -154,5 +154,5 @@ chmod(perm: number): void;

write(buf: Buffer, offset?: number, length?: number, position?: number): number;
read(buf: Buffer | Uint8Array, offset?: number, length?: number, position?: number): number;
read(buf: Buffer | ArrayBufferView | DataView, offset?: number, length?: number, position?: number): number;
chmod(perm: number): void;
chown(uid: number, gid: number): void;
}
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.File = exports.Link = exports.Node = exports.SEP = void 0;
var process_1 = require("./process");
var buffer_1 = require("./internal/buffer");
var constants_1 = require("./constants");
var events_1 = require("events");
var Stats_1 = require("./Stats");
var S_IFMT = constants_1.constants.S_IFMT, S_IFDIR = constants_1.constants.S_IFDIR, S_IFREG = constants_1.constants.S_IFREG, S_IFLNK = constants_1.constants.S_IFLNK, O_APPEND = constants_1.constants.O_APPEND;
var getuid = function () { var _a, _b; return (_b = (_a = process_1.default.getuid) === null || _a === void 0 ? void 0 : _a.call(process_1.default)) !== null && _b !== void 0 ? _b : 0; };
var getgid = function () { var _a, _b; return (_b = (_a = process_1.default.getgid) === null || _a === void 0 ? void 0 : _a.call(process_1.default)) !== null && _b !== void 0 ? _b : 0; };
const process_1 = require("./process");
const buffer_1 = require("./internal/buffer");
const constants_1 = require("./constants");
const events_1 = require("events");
const Stats_1 = require("./Stats");
const { S_IFMT, S_IFDIR, S_IFREG, S_IFLNK, O_APPEND } = constants_1.constants;
const getuid = () => { var _a, _b; return (_b = (_a = process_1.default.getuid) === null || _a === void 0 ? void 0 : _a.call(process_1.default)) !== null && _b !== void 0 ? _b : 0; };
const getgid = () => { var _a, _b; return (_b = (_a = process_1.default.getgid) === null || _a === void 0 ? void 0 : _a.call(process_1.default)) !== null && _b !== void 0 ? _b : 0; };
exports.SEP = '/';

@@ -31,109 +16,77 @@ /**

*/
var Node = /** @class */ (function (_super) {
__extends(Node, _super);
function Node(ino, perm) {
if (perm === void 0) { perm = 438; }
var _this = _super.call(this) || this;
class Node extends events_1.EventEmitter {
constructor(ino, perm = 0o666) {
super();
// User ID and group ID.
_this._uid = getuid();
_this._gid = getgid();
_this._atime = new Date();
_this._mtime = new Date();
_this._ctime = new Date();
_this._perm = 438; // Permissions `chmod`, `fchmod`
_this.mode = S_IFREG; // S_IFDIR, S_IFREG, etc.. (file by default?)
this._uid = getuid();
this._gid = getgid();
this._atime = new Date();
this._mtime = new Date();
this._ctime = new Date();
this._perm = 0o666; // Permissions `chmod`, `fchmod`
this.mode = S_IFREG; // S_IFDIR, S_IFREG, etc.. (file by default?)
// Number of hard links pointing at this Node.
_this._nlink = 1;
_this._perm = perm;
_this.mode |= perm;
_this.ino = ino;
return _this;
this._nlink = 1;
this._perm = perm;
this.mode |= perm;
this.ino = ino;
}
Object.defineProperty(Node.prototype, "ctime", {
get: function () {
return this._ctime;
},
set: function (ctime) {
this._ctime = ctime;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Node.prototype, "uid", {
get: function () {
return this._uid;
},
set: function (uid) {
this._uid = uid;
this.ctime = new Date();
},
enumerable: false,
configurable: true
});
Object.defineProperty(Node.prototype, "gid", {
get: function () {
return this._gid;
},
set: function (gid) {
this._gid = gid;
this.ctime = new Date();
},
enumerable: false,
configurable: true
});
Object.defineProperty(Node.prototype, "atime", {
get: function () {
return this._atime;
},
set: function (atime) {
this._atime = atime;
this.ctime = new Date();
},
enumerable: false,
configurable: true
});
Object.defineProperty(Node.prototype, "mtime", {
get: function () {
return this._mtime;
},
set: function (mtime) {
this._mtime = mtime;
this.ctime = new Date();
},
enumerable: false,
configurable: true
});
Object.defineProperty(Node.prototype, "perm", {
get: function () {
return this._perm;
},
set: function (perm) {
this._perm = perm;
this.ctime = new Date();
},
enumerable: false,
configurable: true
});
Object.defineProperty(Node.prototype, "nlink", {
get: function () {
return this._nlink;
},
set: function (nlink) {
this._nlink = nlink;
this.ctime = new Date();
},
enumerable: false,
configurable: true
});
Node.prototype.getString = function (encoding) {
if (encoding === void 0) { encoding = 'utf8'; }
set ctime(ctime) {
this._ctime = ctime;
}
get ctime() {
return this._ctime;
}
set uid(uid) {
this._uid = uid;
this.ctime = new Date();
}
get uid() {
return this._uid;
}
set gid(gid) {
this._gid = gid;
this.ctime = new Date();
}
get gid() {
return this._gid;
}
set atime(atime) {
this._atime = atime;
this.ctime = new Date();
}
get atime() {
return this._atime;
}
set mtime(mtime) {
this._mtime = mtime;
this.ctime = new Date();
}
get mtime() {
return this._mtime;
}
set perm(perm) {
this._perm = perm;
this.ctime = new Date();
}
get perm() {
return this._perm;
}
set nlink(nlink) {
this._nlink = nlink;
this.ctime = new Date();
}
get nlink() {
return this._nlink;
}
getString(encoding = 'utf8') {
this.atime = new Date();
return this.getBuffer().toString(encoding);
};
Node.prototype.setString = function (str) {
}
setString(str) {
// this.setBuffer(bufferFrom(str, 'utf8'));
this.buf = (0, buffer_1.bufferFrom)(str, 'utf8');
this.touch();
};
Node.prototype.getBuffer = function () {
}
getBuffer() {
this.atime = new Date();

@@ -143,44 +96,41 @@ if (!this.buf)

return (0, buffer_1.bufferFrom)(this.buf); // Return a copy.
};
Node.prototype.setBuffer = function (buf) {
}
setBuffer(buf) {
this.buf = (0, buffer_1.bufferFrom)(buf); // Creates a copy of data.
this.touch();
};
Node.prototype.getSize = function () {
}
getSize() {
return this.buf ? this.buf.length : 0;
};
Node.prototype.setModeProperty = function (property) {
}
setModeProperty(property) {
this.mode = (this.mode & ~S_IFMT) | property;
};
Node.prototype.setIsFile = function () {
}
setIsFile() {
this.setModeProperty(S_IFREG);
};
Node.prototype.setIsDirectory = function () {
}
setIsDirectory() {
this.setModeProperty(S_IFDIR);
};
Node.prototype.setIsSymlink = function () {
}
setIsSymlink() {
this.setModeProperty(S_IFLNK);
};
Node.prototype.isFile = function () {
}
isFile() {
return (this.mode & S_IFMT) === S_IFREG;
};
Node.prototype.isDirectory = function () {
}
isDirectory() {
return (this.mode & S_IFMT) === S_IFDIR;
};
Node.prototype.isSymlink = function () {
}
isSymlink() {
// return !!this.symlink;
return (this.mode & S_IFMT) === S_IFLNK;
};
Node.prototype.makeSymlink = function (steps) {
}
makeSymlink(steps) {
this.symlink = steps;
this.setIsSymlink();
};
Node.prototype.write = function (buf, off, len, pos) {
if (off === void 0) { off = 0; }
if (len === void 0) { len = buf.length; }
if (pos === void 0) { pos = 0; }
}
write(buf, off = 0, len = buf.length, pos = 0) {
if (!this.buf)
this.buf = (0, buffer_1.bufferAllocUnsafe)(0);
if (pos + len > this.buf.length) {
var newBuf = (0, buffer_1.bufferAllocUnsafe)(pos + len);
const newBuf = (0, buffer_1.bufferAllocUnsafe)(pos + len);
this.buf.copy(newBuf, 0, 0, this.buf.length);

@@ -192,12 +142,9 @@ this.buf = newBuf;

return len;
};
}
// Returns the number of bytes read.
Node.prototype.read = function (buf, off, len, pos) {
if (off === void 0) { off = 0; }
if (len === void 0) { len = buf.byteLength; }
if (pos === void 0) { pos = 0; }
read(buf, off = 0, len = buf.byteLength, pos = 0) {
this.atime = new Date();
if (!this.buf)
this.buf = (0, buffer_1.bufferAllocUnsafe)(0);
var actualLen = len;
let actualLen = len;
if (actualLen > buf.byteLength) {

@@ -209,7 +156,7 @@ actualLen = buf.byteLength;

}
this.buf.copy(buf, off, pos, pos + actualLen);
const buf2 = buf instanceof Buffer ? buf : Buffer.from(buf.buffer);
this.buf.copy(buf2, off, pos, pos + actualLen);
return actualLen;
};
Node.prototype.truncate = function (len) {
if (len === void 0) { len = 0; }
}
truncate(len = 0) {
if (!len)

@@ -224,3 +171,3 @@ this.buf = (0, buffer_1.bufferAllocUnsafe)(0);

else {
var buf = (0, buffer_1.bufferAllocUnsafe)(len);
const buf = (0, buffer_1.bufferAllocUnsafe)(len);
this.buf.copy(buf);

@@ -232,20 +179,18 @@ buf.fill(0, this.buf.length);

this.touch();
};
Node.prototype.chmod = function (perm) {
}
chmod(perm) {
this.perm = perm;
this.mode = (this.mode & ~511) | perm;
this.mode = (this.mode & ~0o777) | perm;
this.touch();
};
Node.prototype.chown = function (uid, gid) {
}
chown(uid, gid) {
this.uid = uid;
this.gid = gid;
this.touch();
};
Node.prototype.touch = function () {
}
touch() {
this.mtime = new Date();
this.emit('change', this);
};
Node.prototype.canRead = function (uid, gid) {
if (uid === void 0) { uid = getuid(); }
if (gid === void 0) { gid = getgid(); }
}
canRead(uid = getuid(), gid = getgid()) {
if (this.perm & 4 /* S.IROTH */) {

@@ -265,6 +210,4 @@ return true;

return false;
};
Node.prototype.canWrite = function (uid, gid) {
if (uid === void 0) { uid = getuid(); }
if (gid === void 0) { gid = getgid(); }
}
canWrite(uid = getuid(), gid = getgid()) {
if (this.perm & 2 /* S.IWOTH */) {

@@ -284,7 +227,7 @@ return true;

return false;
};
Node.prototype.del = function () {
}
del() {
this.emit('delete', this);
};
Node.prototype.toJSON = function () {
}
toJSON() {
return {

@@ -303,5 +246,4 @@ ino: this.ino,

};
};
return Node;
}(events_1.EventEmitter));
}
}
exports.Node = Node;

@@ -311,47 +253,39 @@ /**

*/
var Link = /** @class */ (function (_super) {
__extends(Link, _super);
function Link(vol, parent, name) {
var _this = _super.call(this) || this;
_this.children = {};
class Link extends events_1.EventEmitter {
get steps() {
return this._steps;
}
// Recursively sync children steps, e.g. in case of dir rename
set steps(val) {
this._steps = val;
for (const [child, link] of Object.entries(this.children)) {
if (child === '.' || child === '..') {
continue;
}
link === null || link === void 0 ? void 0 : link.syncSteps();
}
}
constructor(vol, parent, name) {
super();
this.children = {};
// Path to this node as Array: ['usr', 'bin', 'node'].
_this._steps = [];
this._steps = [];
// "i-node" number of the node.
_this.ino = 0;
this.ino = 0;
// Number of children.
_this.length = 0;
_this.vol = vol;
_this.parent = parent;
_this.name = name;
_this.syncSteps();
return _this;
this.length = 0;
this.vol = vol;
this.parent = parent;
this.name = name;
this.syncSteps();
}
Object.defineProperty(Link.prototype, "steps", {
get: function () {
return this._steps;
},
// Recursively sync children steps, e.g. in case of dir rename
set: function (val) {
this._steps = val;
for (var _i = 0, _a = Object.entries(this.children); _i < _a.length; _i++) {
var _b = _a[_i], child = _b[0], link = _b[1];
if (child === '.' || child === '..') {
continue;
}
link === null || link === void 0 ? void 0 : link.syncSteps();
}
},
enumerable: false,
configurable: true
});
Link.prototype.setNode = function (node) {
setNode(node) {
this.node = node;
this.ino = node.ino;
};
Link.prototype.getNode = function () {
}
getNode() {
return this.node;
};
Link.prototype.createChild = function (name, node) {
if (node === void 0) { node = this.vol.createNode(); }
var link = new Link(this.vol, this, name);
}
createChild(name, node = this.vol.createNode()) {
const link = new Link(this.vol, this, name);
link.setNode(node);

@@ -364,9 +298,8 @@ if (node.isDirectory()) {

return link;
};
Link.prototype.setChild = function (name, link) {
if (link === void 0) { link = new Link(this.vol, this, name); }
}
setChild(name, link = new Link(this.vol, this, name)) {
this.children[name] = link;
link.parent = this;
this.length++;
var node = link.getNode();
const node = link.getNode();
if (node.isDirectory()) {

@@ -379,5 +312,5 @@ link.children['..'] = this;

return link;
};
Link.prototype.deleteChild = function (link) {
var node = link.getNode();
}
deleteChild(link) {
const node = link.getNode();
if (node.isDirectory()) {

@@ -391,4 +324,4 @@ delete link.children['..'];

this.emit('child:delete', link, this);
};
Link.prototype.getChild = function (name) {
}
getChild(name) {
this.getNode().mtime = new Date();

@@ -398,9 +331,9 @@ if (Object.hasOwnProperty.call(this.children, name)) {

}
};
Link.prototype.getPath = function () {
}
getPath() {
return this.steps.join(exports.SEP);
};
Link.prototype.getName = function () {
}
getName() {
return this.steps[this.steps.length - 1];
};
}
// del() {

@@ -422,5 +355,3 @@ // const parent = this.parent;

*/
Link.prototype.walk = function (steps, stop, i) {
if (stop === void 0) { stop = steps.length; }
if (i === void 0) { i = 0; }
walk(steps, stop = steps.length, i = 0) {
if (i >= steps.length)

@@ -430,9 +361,9 @@ return this;

return this;
var step = steps[i];
var link = this.getChild(step);
const step = steps[i];
const link = this.getChild(step);
if (!link)
return null;
return link.walk(steps, stop, i + 1);
};
Link.prototype.toJSON = function () {
}
toJSON() {
return {

@@ -443,8 +374,7 @@ steps: this.steps,

};
};
Link.prototype.syncSteps = function () {
}
syncSteps() {
this.steps = this.parent ? this.parent.steps.concat([this.name]) : [this.name];
};
return Link;
}(events_1.EventEmitter));
}
}
exports.Link = Link;

@@ -454,3 +384,3 @@ /**

*/
var File = /** @class */ (function () {
class File {
/**

@@ -464,8 +394,3 @@ * Open a Link-Node pair. `node` is provided separately as that might be a different node

*/
function File(link, node, flags, fd) {
/**
* A cursor/offset position in a file, where data will be written on write.
* User can "seek" this position.
*/
this.position = 0;
constructor(link, node, flags, fd) {
this.link = link;

@@ -475,56 +400,51 @@ this.node = node;

this.fd = fd;
this.position = 0;
if (this.flags & O_APPEND)
this.position = this.getSize();
}
File.prototype.getString = function (encoding) {
if (encoding === void 0) { encoding = 'utf8'; }
getString(encoding = 'utf8') {
return this.node.getString();
};
File.prototype.setString = function (str) {
}
setString(str) {
this.node.setString(str);
};
File.prototype.getBuffer = function () {
}
getBuffer() {
return this.node.getBuffer();
};
File.prototype.setBuffer = function (buf) {
}
setBuffer(buf) {
this.node.setBuffer(buf);
};
File.prototype.getSize = function () {
}
getSize() {
return this.node.getSize();
};
File.prototype.truncate = function (len) {
}
truncate(len) {
this.node.truncate(len);
};
File.prototype.seekTo = function (position) {
}
seekTo(position) {
this.position = position;
};
File.prototype.stats = function () {
}
stats() {
return Stats_1.default.build(this.node);
};
File.prototype.write = function (buf, offset, length, position) {
if (offset === void 0) { offset = 0; }
if (length === void 0) { length = buf.length; }
}
write(buf, offset = 0, length = buf.length, position) {
if (typeof position !== 'number')
position = this.position;
if (this.flags & O_APPEND)
position = this.getSize();
var bytes = this.node.write(buf, offset, length, position);
const bytes = this.node.write(buf, offset, length, position);
this.position = position + bytes;
return bytes;
};
File.prototype.read = function (buf, offset, length, position) {
if (offset === void 0) { offset = 0; }
if (length === void 0) { length = buf.byteLength; }
}
read(buf, offset = 0, length = buf.byteLength, position) {
if (typeof position !== 'number')
position = this.position;
var bytes = this.node.read(buf, offset, length, position);
const bytes = this.node.read(buf, offset, length, position);
this.position = position + bytes;
return bytes;
};
File.prototype.chmod = function (perm) {
}
chmod(perm) {
this.node.chmod(perm);
};
File.prototype.chown = function (uid, gid) {
}
chown(uid, gid) {
this.node.chown(uid, gid);
};
return File;
}());
}
}
exports.File = File;

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

*/
var maybeReturnProcess = function () {
const maybeReturnProcess = () => {
if (typeof process !== 'undefined') {

@@ -28,11 +28,11 @@ return process;

function createProcess() {
var p = maybeReturnProcess() || {};
const p = maybeReturnProcess() || {};
if (!p.cwd)
p.cwd = function () { return '/'; };
p.cwd = () => '/';
if (!p.nextTick)
p.nextTick = require('./setImmediate').default;
if (!p.emitWarning)
p.emitWarning = function (message, type) {
p.emitWarning = (message, type) => {
// tslint:disable-next-line:no-console
console.warn("".concat(type).concat(type ? ': ' : '').concat(message));
console.warn(`${type}${type ? ': ' : ''}${message}`);
};

@@ -39,0 +39,0 @@ if (!p.env)

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var _setImmediate;
let _setImmediate;
if (typeof setImmediate === 'function')

@@ -5,0 +5,0 @@ _setImmediate = setImmediate.bind(typeof globalThis !== 'undefined' ? globalThis : global);

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

function setTimeoutUnref(callback, time, args) {
var ref = setTimeout.apply(typeof globalThis !== 'undefined' ? globalThis : global, arguments);
const ref = setTimeout.apply(typeof globalThis !== 'undefined' ? globalThis : global, arguments);
if (ref && typeof ref === 'object' && typeof ref.unref === 'function')

@@ -11,0 +11,0 @@ ref.unref();

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Stats = void 0;
var constants_1 = require("./constants");
var getBigInt_1 = require("./getBigInt");
var S_IFMT = constants_1.constants.S_IFMT, S_IFDIR = constants_1.constants.S_IFDIR, S_IFREG = constants_1.constants.S_IFREG, S_IFBLK = constants_1.constants.S_IFBLK, S_IFCHR = constants_1.constants.S_IFCHR, S_IFLNK = constants_1.constants.S_IFLNK, S_IFIFO = constants_1.constants.S_IFIFO, S_IFSOCK = constants_1.constants.S_IFSOCK;
const constants_1 = require("./constants");
const getBigInt_1 = require("./getBigInt");
const { S_IFMT, S_IFDIR, S_IFREG, S_IFBLK, S_IFCHR, S_IFLNK, S_IFIFO, S_IFSOCK } = constants_1.constants;
/**
* Statistics about a file/directory, like `fs.Stats`.
*/
var Stats = /** @class */ (function () {
function Stats() {
}
Stats.build = function (node, bigint) {
if (bigint === void 0) { bigint = false; }
var stats = new Stats();
var uid = node.uid, gid = node.gid, atime = node.atime, mtime = node.mtime, ctime = node.ctime;
var getStatNumber = !bigint ? function (number) { return number; } : getBigInt_1.default;
class Stats {
static build(node, bigint = false) {
const stats = new Stats();
const { uid, gid, atime, mtime, ctime } = node;
const getStatNumber = !bigint ? number => number : getBigInt_1.default;
// Copy all values on Stats from Node, so that if Node values

@@ -34,3 +31,3 @@ // change, values on Stats would still be the old ones,

stats.mtimeMs = getStatNumber(mtime.getTime());
var ctimeMs = getStatNumber(ctime.getTime());
const ctimeMs = getStatNumber(ctime.getTime());
stats.ctimeMs = ctimeMs;

@@ -42,30 +39,29 @@ stats.birthtimeMs = ctimeMs;

return stats;
};
Stats.prototype._checkModeProperty = function (property) {
}
_checkModeProperty(property) {
return (Number(this.mode) & S_IFMT) === property;
};
Stats.prototype.isDirectory = function () {
}
isDirectory() {
return this._checkModeProperty(S_IFDIR);
};
Stats.prototype.isFile = function () {
}
isFile() {
return this._checkModeProperty(S_IFREG);
};
Stats.prototype.isBlockDevice = function () {
}
isBlockDevice() {
return this._checkModeProperty(S_IFBLK);
};
Stats.prototype.isCharacterDevice = function () {
}
isCharacterDevice() {
return this._checkModeProperty(S_IFCHR);
};
Stats.prototype.isSymbolicLink = function () {
}
isSymbolicLink() {
return this._checkModeProperty(S_IFLNK);
};
Stats.prototype.isFIFO = function () {
}
isFIFO() {
return this._checkModeProperty(S_IFIFO);
};
Stats.prototype.isSocket = function () {
}
isSocket() {
return this._checkModeProperty(S_IFSOCK);
};
return Stats;
}());
}
}
exports.Stats = Stats;
exports.default = Stats;
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.createVolume = exports.ObjectStore = void 0;
var volume_1 = require("./volume");
var node_1 = require("./node");
var ObjectStore = /** @class */ (function () {
function ObjectStore(obj) {
const volume_1 = require("./volume");
const node_1 = require("./node");
class ObjectStore {
constructor(obj) {
this.obj = obj;
}
ObjectStore.prototype.setItem = function (key, json) {
setItem(key, json) {
this.obj[key] = JSON.stringify(json);
};
ObjectStore.prototype.getItem = function (key) {
var data = this.obj[key];
}
getItem(key) {
const data = this.obj[key];
if (typeof data === void 0)
return void 0;
return JSON.parse(data);
};
ObjectStore.prototype.removeItem = function (key) {
}
removeItem(key) {
delete this.obj[key];
};
return ObjectStore;
}());
}
}
exports.ObjectStore = ObjectStore;
function createVolume(namespace, LS) {
if (LS === void 0) { LS = localStorage; }
var store = new ObjectStore(LS);
var key = function (type, id) { return "memfs.".concat(namespace, ".").concat(type, ".").concat(id); };
var NodeLocalStorage = /** @class */ (function (_super) {
__extends(NodeLocalStorage, _super);
function NodeLocalStorage() {
return _super !== null && _super.apply(this, arguments) || this;
function createVolume(namespace, LS = localStorage) {
const store = new ObjectStore(LS);
const key = (type, id) => `memfs.${namespace}.${type}.${id}`;
class NodeLocalStorage extends node_1.Node {
get Key() {
if (!this._key)
this._key = key('ino', this.ino);
return this._key;
}
Object.defineProperty(NodeLocalStorage.prototype, "Key", {
get: function () {
if (!this._key)
this._key = key('ino', this.ino);
return this._key;
},
enumerable: false,
configurable: true
});
NodeLocalStorage.prototype.sync = function () {
sync() {
store.setItem(this.Key, this.toJSON());
};
NodeLocalStorage.prototype.touch = function () {
_super.prototype.touch.call(this);
}
touch() {
super.touch();
this.sync();
};
NodeLocalStorage.prototype.del = function () {
_super.prototype.del.call(this);
}
del() {
super.del();
store.removeItem(this.Key);
};
return NodeLocalStorage;
}(node_1.Node));
var LinkLocalStorage = /** @class */ (function (_super) {
__extends(LinkLocalStorage, _super);
function LinkLocalStorage() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(LinkLocalStorage.prototype, "Key", {
get: function () {
if (!this._key)
this._key = key('link', this.getPath());
return this._key;
},
enumerable: false,
configurable: true
});
LinkLocalStorage.prototype.sync = function () {
}
class LinkLocalStorage extends node_1.Link {
get Key() {
if (!this._key)
this._key = key('link', this.getPath());
return this._key;
}
sync() {
store.setItem(this.Key, this.toJSON());
};
return LinkLocalStorage;
}(node_1.Link));
return /** @class */ (function (_super) {
__extends(VolumeLocalStorage, _super);
function VolumeLocalStorage() {
return _super.call(this, {
}
}
return class VolumeLocalStorage extends volume_1.Volume {
constructor() {
super({
Node: NodeLocalStorage,
Link: LinkLocalStorage,
}) || this;
});
}
VolumeLocalStorage.prototype.createLink = function (parent, name, isDirectory, perm) {
var link = _super.prototype.createLink.call(this, parent, name, isDirectory, perm);
createLink(parent, name, isDirectory, perm) {
const link = super.createLink(parent, name, isDirectory, perm);
store.setItem(key('link', link.getPath()), link.toJSON());
return link;
};
VolumeLocalStorage.prototype.deleteLink = function (link) {
}
deleteLink(link) {
store.removeItem(key('link', link.getPath()));
return _super.prototype.deleteLink.call(this, link);
};
return VolumeLocalStorage;
}(volume_1.Volume));
return super.deleteLink(link);
}
};
}
exports.createVolume = createVolume;

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

/// <reference types="node" />
import { PathLike, symlink } from 'fs';
import { Node, Link, File } from './node';

@@ -15,2 +14,3 @@ import Stats from './Stats';

import { TEncodingExtended, TDataOut } from './encoding';
import type { PathLike, symlink } from 'fs';
export interface IError extends Error {

@@ -20,3 +20,3 @@ code?: string;

export type TFileId = PathLike | number;
export type TData = TDataOut | Uint8Array;
export type TData = TDataOut | ArrayBufferView | DataView;
export type TFlags = string | number;

@@ -95,3 +95,6 @@ export type TMode = string | number;

export interface IRmdirOptions {
/** @deprecated */
recursive?: boolean;
maxRetries?: number;
retryDelay?: number;
}

@@ -164,3 +167,3 @@ export interface IRmOptions {

private promisesApi;
get promises(): import("./promises").IPromisesAPI;
get promises(): import("./node/types").FsPromisesApi;
constructor(props?: {});

@@ -207,4 +210,4 @@ createLink(): Link;

private readBase;
readSync(fd: number, buffer: Buffer | Uint8Array, offset: number, length: number, position: number): number;
read(fd: number, buffer: Buffer | Uint8Array, offset: number, length: number, position: number, callback: (err?: Error | null, bytesRead?: number, buffer?: Buffer | Uint8Array) => void): void;
readSync(fd: number, buffer: Buffer | ArrayBufferView | DataView, offset: number, length: number, position: number): number;
read(fd: number, buffer: Buffer | ArrayBufferView | DataView, offset: number, length: number, position: number, callback: (err?: Error | null, bytesRead?: number, buffer?: Buffer | ArrayBufferView | DataView) => void): void;
private readFileBase;

@@ -215,8 +218,8 @@ readFileSync(file: TFileId, options?: IReadFileOptions | string): TDataOut;

private writeBase;
writeSync(fd: number, buffer: Buffer | Uint8Array, offset?: number, length?: number, position?: number): number;
writeSync(fd: number, buffer: Buffer | ArrayBufferView | DataView, offset?: number, length?: number, position?: number): number;
writeSync(fd: number, str: string, position?: number, encoding?: BufferEncoding): number;
write(fd: number, buffer: Buffer | Uint8Array, callback: (...args: any[]) => void): any;
write(fd: number, buffer: Buffer | Uint8Array, offset: number, callback: (...args: any[]) => void): any;
write(fd: number, buffer: Buffer | Uint8Array, offset: number, length: number, callback: (...args: any[]) => void): any;
write(fd: number, buffer: Buffer | Uint8Array, offset: number, length: number, position: number, callback: (...args: any[]) => void): any;
write(fd: number, buffer: Buffer | ArrayBufferView | DataView, callback: (...args: any[]) => void): any;
write(fd: number, buffer: Buffer | ArrayBufferView | DataView, offset: number, callback: (...args: any[]) => void): any;
write(fd: number, buffer: Buffer | ArrayBufferView | DataView, offset: number, length: number, callback: (...args: any[]) => void): any;
write(fd: number, buffer: Buffer | ArrayBufferView | DataView, offset: number, length: number, position: number, callback: (...args: any[]) => void): any;
write(fd: number, str: string, callback: (...args: any[]) => void): any;

@@ -223,0 +226,0 @@ write(fd: number, str: string, position: number, callback: (...args: any[]) => void): any;

{
"name": "memfs",
"version": "3.5.3",
"version": "3.6.0",
"description": "In-memory file-system with Node's fs API.",

@@ -5,0 +5,0 @@ "keywords": [

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

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