Socket
Socket
Sign inDemoInstall

@yarnpkg/fslib

Package Overview
Dependencies
Maintainers
6
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yarnpkg/fslib - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

33

lib/NodeFS.js

@@ -8,2 +8,9 @@ "use strict";

const path_1 = require("./path");
function direntToPortable(dirent) {
// We don't need to return a copy, we can just reuse the object the real fs returned
const portableDirent = dirent;
if (typeof dirent.path === `string`)
portableDirent.path = path_1.npath.toPortablePath(dirent.path);
return portableDirent;
}
class NodeFS extends FakeFS_1.BasePortableFakeFS {

@@ -371,6 +378,16 @@ constructor(realFs = fs_1.default) {

if (opts) {
this.realFs.readdir(path_1.npath.fromPortablePath(p), opts, this.makeCallback(resolve, reject));
if (opts.recursive && process.platform === `win32`) {
if (opts.withFileTypes) {
this.realFs.readdir(path_1.npath.fromPortablePath(p), opts, this.makeCallback(results => resolve(results.map(direntToPortable)), reject));
}
else {
this.realFs.readdir(path_1.npath.fromPortablePath(p), opts, this.makeCallback(results => resolve(results.map(path_1.npath.toPortablePath)), reject));
}
}
else {
this.realFs.readdir(path_1.npath.fromPortablePath(p), opts, this.makeCallback(resolve, reject));
}
}
else {
this.realFs.readdir(path_1.npath.fromPortablePath(p), this.makeCallback(value => resolve(value), reject));
this.realFs.readdir(path_1.npath.fromPortablePath(p), this.makeCallback(resolve, reject));
}

@@ -381,3 +398,13 @@ });

if (opts) {
return this.realFs.readdirSync(path_1.npath.fromPortablePath(p), opts);
if (opts.recursive && process.platform === `win32`) {
if (opts.withFileTypes) {
return this.realFs.readdirSync(path_1.npath.fromPortablePath(p), opts).map(direntToPortable);
}
else {
return this.realFs.readdirSync(path_1.npath.fromPortablePath(p), opts).map(path_1.npath.toPortablePath);
}
}
else {
return this.realFs.readdirSync(path_1.npath.fromPortablePath(p), opts);
}
}

@@ -384,0 +411,0 @@ else {

2

package.json
{
"name": "@yarnpkg/fslib",
"version": "3.0.0",
"version": "3.0.1",
"license": "BSD-2-Clause",

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

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