Socket
Socket
Sign inDemoInstall

@file-services/memory

Package Overview
Dependencies
Maintainers
4
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@file-services/memory - npm Package Compare versions

Comparing version 8.1.2 to 8.1.3

6

dist/index.d.ts

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

export * from './error-codes.js';
export * from './memory-fs.js';
export * from './types.js';
export * from './error-codes';
export * from './memory-fs';
export * from './types';
//# sourceMappingURL=index.d.ts.map

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

Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./error-codes.js"), exports);
__exportStar(require("./memory-fs.js"), exports);
__exportStar(require("./types.js"), exports);
__exportStar(require("./error-codes"), exports);
__exportStar(require("./memory-fs"), exports);
__exportStar(require("./types"), exports);
//# sourceMappingURL=index.js.map
import { IDirectoryContents } from '@file-services/types';
import type { IMemFileSystem, IBaseMemFileSystem, IBaseMemFileSystemSync } from './types.js';
import type { IMemFileSystem, IBaseMemFileSystem, IBaseMemFileSystemSync } from './types';
/**

@@ -4,0 +4,0 @@ * This is the main function to use, returning a sync/async

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

const types_1 = require("@file-services/types");
const error_codes_js_1 = require("./error-codes.js");
const error_codes_1 = require("./error-codes");
const posixPath = path_1.default.posix;

@@ -116,6 +116,6 @@ /**

if (!fileNode) {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.NO_FILE, 'ENOENT');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.NO_FILE, 'ENOENT');
}
else if (fileNode.type === 'dir') {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.PATH_IS_DIRECTORY, 'EISDIR');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.PATH_IS_DIRECTORY, 'EISDIR');
}

@@ -126,3 +126,3 @@ return fileNode.contents;

if (filePath === '') {
throw createFsError(filePath, error_codes_js_1.FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
throw createFsError(filePath, error_codes_1.FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
}

@@ -133,3 +133,3 @@ const resolvedPath = resolvePath(filePath);

if (existingNode.type === 'dir') {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.PATH_IS_DIRECTORY, 'EISDIR');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.PATH_IS_DIRECTORY, 'EISDIR');
}

@@ -144,3 +144,3 @@ existingNode.entry = { ...existingNode.entry, mtime: new Date() };

if (!parentNode || parentNode.type !== 'dir') {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.CONTAINING_NOT_EXISTS, 'ENOENT');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.CONTAINING_NOT_EXISTS, 'ENOENT');
}

@@ -170,3 +170,3 @@ const fileName = posixPath.basename(resolvedPath);

if (!parentNode || parentNode.type !== 'dir') {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.NO_FILE, 'ENOENT');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.NO_FILE, 'ENOENT');
}

@@ -176,6 +176,6 @@ const fileName = posixPath.basename(resolvedPath);

if (!fileNode) {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.NO_FILE, 'ENOENT');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.NO_FILE, 'ENOENT');
}
else if (fileNode.type === 'dir') {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.PATH_IS_DIRECTORY, 'EISDIR');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.PATH_IS_DIRECTORY, 'EISDIR');
}

@@ -189,6 +189,6 @@ parentNode.contents.delete(fileName);

if (!directoryNode) {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.NO_DIRECTORY, 'ENOENT');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.NO_DIRECTORY, 'ENOENT');
}
else if (directoryNode.type === 'file') {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.PATH_IS_FILE, 'ENOTDIR');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.PATH_IS_FILE, 'ENOTDIR');
}

@@ -210,7 +210,7 @@ return !!options && typeof options === 'object' && options.withFileTypes

else {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.CONTAINING_NOT_EXISTS, 'ENOENT');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.CONTAINING_NOT_EXISTS, 'ENOENT');
}
}
else if (parentNode.type !== 'dir') {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.PATH_IS_FILE, 'ENOTDIR');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.PATH_IS_FILE, 'ENOTDIR');
}

@@ -222,3 +222,3 @@ else if (parentPath === resolvedPath) {

else {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.PATH_ALREADY_EXISTS, 'EEXIST');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.PATH_ALREADY_EXISTS, 'EEXIST');
}

@@ -232,3 +232,3 @@ }

}
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.PATH_ALREADY_EXISTS, 'EEXIST');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.PATH_ALREADY_EXISTS, 'EEXIST');
}

@@ -244,3 +244,3 @@ const newDirNode = createMemDirectory(directoryName);

if (!parentNode || parentNode.type !== 'dir') {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.NO_DIRECTORY, 'ENOENT');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.NO_DIRECTORY, 'ENOENT');
}

@@ -250,6 +250,6 @@ const directoryName = posixPath.basename(resolvedPath);

if (!directoryNode || directoryNode.type !== 'dir') {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.NO_DIRECTORY, 'ENOENT');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.NO_DIRECTORY, 'ENOENT');
}
else if (directoryNode.contents.size > 0) {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.DIRECTORY_NOT_EMPTY, 'ENOTEMPTY');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.DIRECTORY_NOT_EMPTY, 'ENOTEMPTY');
}

@@ -268,3 +268,3 @@ parentNode.contents.delete(directoryName);

else {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.NO_DIRECTORY, 'ENOENT');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.NO_DIRECTORY, 'ENOENT');
}

@@ -279,7 +279,7 @@ }

else {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.NO_DIRECTORY, 'ENOENT');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.NO_DIRECTORY, 'ENOENT');
}
}
if (targetNode.type === 'dir' && !recursive) {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.PATH_IS_DIRECTORY, 'EISDIR');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.PATH_IS_DIRECTORY, 'EISDIR');
}

@@ -298,3 +298,3 @@ parentNode.contents.delete(targetName);

if (throwIfNoEntry) {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
}

@@ -313,3 +313,3 @@ else {

if (throwIfNoEntry) {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
}

@@ -346,3 +346,3 @@ else {

if (!node) {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
}

@@ -355,6 +355,6 @@ return currentPath;

if (!node) {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
}
else if (node.type !== 'symlink') {
throw createFsError(resolvedPath, error_codes_js_1.FsErrorCodes.PATH_IS_INVALID, 'EINVAL');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.PATH_IS_INVALID, 'EINVAL');
}

@@ -369,3 +369,3 @@ return node.target;

if (!sourceParentNode || sourceParentNode.type !== 'dir') {
throw createFsError(resolvedSourcePath, error_codes_js_1.FsErrorCodes.CONTAINING_NOT_EXISTS, 'ENOENT');
throw createFsError(resolvedSourcePath, error_codes_1.FsErrorCodes.CONTAINING_NOT_EXISTS, 'ENOENT');
}

@@ -375,3 +375,3 @@ const sourceName = posixPath.basename(resolvedSourcePath);

if (!sourceNode) {
throw createFsError(resolvedSourcePath, error_codes_js_1.FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
throw createFsError(resolvedSourcePath, error_codes_1.FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
}

@@ -381,3 +381,3 @@ const destinationParentPath = posixPath.dirname(resolvedDestinationPath);

if (!destinationParentNode || destinationParentNode.type !== 'dir') {
throw createFsError(resolvedDestinationPath, error_codes_js_1.FsErrorCodes.CONTAINING_NOT_EXISTS, 'ENOENT');
throw createFsError(resolvedDestinationPath, error_codes_1.FsErrorCodes.CONTAINING_NOT_EXISTS, 'ENOENT');
}

@@ -389,7 +389,7 @@ const destinationName = posixPath.basename(resolvedDestinationPath);

if (destinationNode.contents.size > 0) {
throw createFsError(resolvedDestinationPath, error_codes_js_1.FsErrorCodes.DIRECTORY_NOT_EMPTY, 'ENOTEMPTY');
throw createFsError(resolvedDestinationPath, error_codes_1.FsErrorCodes.DIRECTORY_NOT_EMPTY, 'ENOTEMPTY');
}
}
else {
throw createFsError(resolvedDestinationPath, error_codes_js_1.FsErrorCodes.PATH_ALREADY_EXISTS, 'EEXIST');
throw createFsError(resolvedDestinationPath, error_codes_1.FsErrorCodes.PATH_ALREADY_EXISTS, 'EEXIST');
}

@@ -408,6 +408,6 @@ }

if (!sourceFileNode) {
throw createFsError(resolvedSourcePath, error_codes_js_1.FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
throw createFsError(resolvedSourcePath, error_codes_1.FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
}
if (sourceFileNode.type !== 'file') {
throw createFsError(resolvedSourcePath, error_codes_js_1.FsErrorCodes.PATH_IS_DIRECTORY, 'EISDIR');
throw createFsError(resolvedSourcePath, error_codes_1.FsErrorCodes.PATH_IS_DIRECTORY, 'EISDIR');
}

@@ -417,3 +417,3 @@ const destParentPath = posixPath.dirname(resolvedDestinationPath);

if (!destParentNode || destParentNode.type !== 'dir') {
throw createFsError(resolvedDestinationPath, error_codes_js_1.FsErrorCodes.CONTAINING_NOT_EXISTS, 'ENOENT');
throw createFsError(resolvedDestinationPath, error_codes_1.FsErrorCodes.CONTAINING_NOT_EXISTS, 'ENOENT');
}

@@ -425,6 +425,6 @@ const targetName = posixPath.basename(resolvedDestinationPath);

if (!shouldOverride) {
throw createFsError(resolvedDestinationPath, error_codes_js_1.FsErrorCodes.PATH_ALREADY_EXISTS, 'EEXIST');
throw createFsError(resolvedDestinationPath, error_codes_1.FsErrorCodes.PATH_ALREADY_EXISTS, 'EEXIST');
}
if (destinationFileNode.type !== 'file') {
throw createFsError(resolvedDestinationPath, error_codes_js_1.FsErrorCodes.PATH_IS_DIRECTORY, 'EISDIR');
throw createFsError(resolvedDestinationPath, error_codes_1.FsErrorCodes.PATH_IS_DIRECTORY, 'EISDIR');
}

@@ -442,3 +442,3 @@ }

if (getNode(resolvedLinkPath)) {
throw createFsError(resolvedLinkPath, error_codes_js_1.FsErrorCodes.PATH_ALREADY_EXISTS, 'EEXIST');
throw createFsError(resolvedLinkPath, error_codes_1.FsErrorCodes.PATH_ALREADY_EXISTS, 'EEXIST');
}

@@ -448,6 +448,6 @@ const parentLinkPath = posixPath.dirname(resolvedLinkPath);

if (!parentNode) {
throw createFsError(resolvedLinkPath, error_codes_js_1.FsErrorCodes.NO_FILE, 'ENOENT');
throw createFsError(resolvedLinkPath, error_codes_1.FsErrorCodes.NO_FILE, 'ENOENT');
}
if (parentNode.type === 'file') {
throw createFsError(resolvedLinkPath, error_codes_js_1.FsErrorCodes.PATH_IS_FILE, 'ENOTDIR');
throw createFsError(resolvedLinkPath, error_codes_1.FsErrorCodes.PATH_IS_FILE, 'ENOTDIR');
}

@@ -454,0 +454,0 @@ const currentDate = new Date(Date.now());

{
"name": "@file-services/memory",
"description": "An in-memory, sync/async, file system implementation.",
"version": "8.1.2",
"main": "dist/index.js",
"version": "8.1.3",
"main": "./dist/index.js",
"exports": {
".": "./dist/index.js",
"./package.json": "./package.json"
},
"scripts": {

@@ -12,5 +16,5 @@ "test": "npm run test:node && npm run test:browser",

"dependencies": {
"@file-services/path": "^8.1.2",
"@file-services/types": "^8.1.2",
"@file-services/utils": "^8.1.2"
"@file-services/path": "^8.1.3",
"@file-services/types": "^8.1.3",
"@file-services/utils": "^8.1.3"
},

@@ -17,0 +21,0 @@ "files": [

@@ -1,3 +0,3 @@

export * from './error-codes.js';
export * from './memory-fs.js';
export * from './types.js';
export * from './error-codes';
export * from './memory-fs';
export * from './types';

@@ -15,3 +15,3 @@ import { createFileSystem, syncToAsyncFs, SetMultiMap } from '@file-services/utils';

} from '@file-services/types';
import { FsErrorCodes } from './error-codes.js';
import { FsErrorCodes } from './error-codes';
import type {

@@ -25,3 +25,3 @@ IMemFileSystem,

IFsMemSymlinkNode,
} from './types.js';
} from './types';

@@ -28,0 +28,0 @@ const posixPath = path.posix;

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc