Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@zenfs/core

Package Overview
Dependencies
Maintainers
1
Versions
156
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.5.11 to 0.5.12

22

dist/emulation/path.js

@@ -111,22 +111,22 @@ /*

export function resolve(...args) {
let resolvedPath = '';
let resolvedAbsolute = false;
for (let i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
let resolved = '';
let absolute = false;
for (let i = args.length - 1; i >= -1 && !absolute; i--) {
const path = i >= 0 ? args[i] : cwd;
validateString(path, `paths[${i}]`);
// Skip empty entries
if (path.length === 0) {
if (!path.length) {
continue;
}
resolvedPath = `${path}/${resolvedPath}`;
resolvedAbsolute = path[0] === '/';
resolved = `${path}/${resolved}`;
absolute = path[0] == '/';
}
// At this point the path should be resolved to a full absolute path, but
// handle relative paths to be safe (might happen when process.cwd() fails)
// handle relative paths to be safe (might happen when cwd fails)
// Normalize the path
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
if (resolvedAbsolute) {
return `/${resolvedPath}`;
resolved = normalizeString(resolved, !absolute);
if (absolute) {
return `/${resolved}`;
}
return resolvedPath.length > 0 ? resolvedPath : '.';
return resolved.length > 0 ? resolved : '/';
}

@@ -133,0 +133,0 @@ export function normalize(path) {

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

import type { CreateReadStreamOptions, CreateWriteStreamOptions, FileChangeInfo, FileReadResult, FlagAndOpenMode } from 'node:fs/promises';
import type { ReadableStream } from 'node:stream/web';
import type { Interface as ReadlineInterface } from 'readline';
import { FileContents } from '../filesystem.js';

@@ -16,5 +18,4 @@ import { BigIntStats, type BigIntStatsFs, type Stats, type StatsFs } from '../stats.js';

import type { PathLike } from './shared.js';
import { ReadStream, WriteStream } from './streams.js';
export * as constants from './constants.js';
import type { ReadableStream } from 'node:stream/web';
import type { Interface as ReadlineInterface } from 'readline';
export declare class FileHandle implements promises.FileHandle {

@@ -166,4 +167,4 @@ /**

readv(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise<Node.ReadVResult>;
createReadStream(options?: CreateReadStreamOptions): Node.ReadStream;
createWriteStream(options?: CreateWriteStreamOptions): Node.WriteStream;
createReadStream(options?: CreateReadStreamOptions): ReadStream;
createWriteStream(options?: CreateWriteStreamOptions): WriteStream;
}

@@ -170,0 +171,0 @@ /**

@@ -7,3 +7,3 @@ import { Buffer } from 'buffer';

import { Dirent } from './dir.js';
import { dirname, join } from './path.js';
import { dirname, join, parse } from './path.js';
import { cred, fd2file, fdMap, fixError, getFdForFile, mounts, normalizeMode, normalizeOptions, normalizePath, normalizeTime, resolveFS } from './shared.js';

@@ -231,3 +231,4 @@ export * as constants from './constants.js';

rawPath = normalizePath(rawPath);
const { fs, path } = resolveFS(resolveSymlinks && (await exists(rawPath)) ? await realpath(rawPath) : rawPath);
const _path = resolveSymlinks && (await exists(rawPath)) ? await realpath(rawPath) : rawPath;
const { fs, path } = resolveFS(_path);
try {

@@ -271,4 +272,4 @@ // @ts-expect-error 2556 (since ...args is not correctly picked up as being a tuple)

try {
const { fs, path } = resolveFS(_path);
return fs.exists(path, cred);
const { fs, path } = resolveFS(await realpath(_path));
return await fs.exists(path, cred);
}

@@ -636,13 +637,14 @@ catch (e) {

path = normalizePath(path);
const { fs, path: resolvedPath, mountPoint } = resolveFS(path);
const { base, dir } = parse(path);
const lpath = join(dir == '/' ? '/' : await realpath(dir), base);
const { fs, path: resolvedPath, mountPoint } = resolveFS(lpath);
try {
const stats = await fs.stat(resolvedPath, cred);
if (!stats.isSymbolicLink()) {
return path;
return lpath;
}
const dst = mountPoint + normalizePath(Buffer.from(await _readFile(resolvedPath, 'r+', false)).toString());
return realpath(dst);
return realpath(mountPoint + (await readlink(lpath)));
}
catch (e) {
throw fixError(e, { [resolvedPath]: path });
throw fixError(e, { [resolvedPath]: lpath });
}

@@ -649,0 +651,0 @@ }

/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
import { Buffer } from 'buffer';
import type * as Node from 'fs';
import type { BufferEncodingOption, EncodingOption, ReadSyncOptions, symlink } from 'fs';
import { FileContents } from '../filesystem.js';
import { BigIntStats, type BigIntStatsFs, type Stats, type StatsFs } from '../stats.js';
import type { symlink, ReadSyncOptions, EncodingOption, BufferEncodingOption } from 'fs';
import type * as Node from 'fs';
import { Dir, Dirent } from './dir.js';
import { PathLike } from './shared.js';
import { Dir, Dirent } from './dir.js';
/**

@@ -10,0 +11,0 @@ * Synchronous rename.

@@ -0,7 +1,8 @@

import { Buffer } from 'buffer';
import { ApiError, ErrorCode } from '../ApiError.js';
import { ActionType, isAppendable, isReadable, isWriteable, parseFlag, pathExistsAction, pathNotExistsAction } from '../file.js';
import { BigIntStats, FileType } from '../stats.js';
import { normalizePath, cred, getFdForFile, normalizeMode, normalizeOptions, fdMap, fd2file, normalizeTime, resolveFS, fixError, mounts } from './shared.js';
import { Dirent } from './dir.js';
import { dirname, join } from './path.js';
import { dirname, join, parse } from './path.js';
import { cred, fd2file, fdMap, fixError, getFdForFile, mounts, normalizeMode, normalizeOptions, normalizePath, normalizeTime, resolveFS } from './shared.js';
function doOp(...[name, resolveSymlinks, path, ...args]) {

@@ -48,3 +49,3 @@ path = normalizePath(path);

try {
const { fs, path: resolvedPath } = resolveFS(path);
const { fs, path: resolvedPath } = resolveFS(realpathSync(path));
return fs.existsSync(resolvedPath, cred);

@@ -518,13 +519,14 @@ }

path = normalizePath(path);
const { fs, path: resolvedPath, mountPoint } = resolveFS(path);
const { base, dir } = parse(path);
const lpath = join(dir == '/' ? '/' : realpathSync(dir), base);
const { fs, path: resolvedPath, mountPoint } = resolveFS(lpath);
try {
const stats = fs.statSync(resolvedPath, cred);
if (!stats.isSymbolicLink()) {
return path;
return lpath;
}
const dst = normalizePath(mountPoint + Buffer.from(_readFileSync(resolvedPath, 'r+', false)).toString());
return realpathSync(dst);
return realpathSync(mountPoint + readlinkSync(lpath));
}
catch (e) {
throw fixError(e, { [resolvedPath]: path });
throw fixError(e, { [resolvedPath]: lpath });
}

@@ -531,0 +533,0 @@ }

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

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

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