Socket
Socket
Sign inDemoInstall

fdir

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fdir - npm Package Compare versions

Comparing version 5.2.1 to 5.3.0

6

index.d.ts

@@ -28,2 +28,3 @@ declare module "fdir" {

relativePaths?: boolean;
useRealPaths?: boolean;
};

@@ -61,5 +62,6 @@

/**
* Resolve and recurse over all symlinks
* Recursively follow all symlinks
* @param {boolean} resolvePaths By default, `fdir` returns original paths to files irrespective of whether they are inside a symlinked directory or not. If you want the paths to be relative to the symlink, set this flag to `false`. (Default is `true`).
*/
withSymlinks(): Builder;
withSymlinks(resolvePaths?: boolean): Builder;

@@ -66,0 +68,0 @@ /**

{
"name": "fdir",
"version": "5.2.1",
"version": "5.3.0",
"description": "The fastest directory crawler & globbing alternative to glob, fast-glob, & tiny-glob. Crawls 1m files in < 1s",

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

@@ -93,3 +93,3 @@ const { sep } = require("../compat/fs");

fs.realpath(path, (error, resolvedPath) => {
fs.stat(path, (error, stat) => {
if (error) {

@@ -100,3 +100,22 @@ state.queue.dequeue(state.options.suppressErrors ? null : error, state);

fs.lstat(resolvedPath, (error, stat) => {
callback(stat, path);
state.queue.dequeue(null, state);
});
};
module.exports.resolveSymlinksWithRealPathsAsync = function(
path,
state,
callback
) {
state.queue.queue();
fs.stat(path, (error, stat) => {
if (error) {
state.queue.dequeue(state.options.suppressErrors ? null : error, state);
return;
}
fs.realpath(path, (error, resolvedPath) => {
if (error) {

@@ -108,3 +127,2 @@ state.queue.dequeue(state.options.suppressErrors ? null : error, state);

callback(stat, resolvedPath);
state.queue.dequeue(null, state);

@@ -116,5 +134,14 @@ });

module.exports.resolveSymlinksSync = function(path, _state, callback) {
const stat = fs.statSync(path);
callback(stat, path);
};
module.exports.resolveSymlinksWithRealPathsSync = function(
path,
_state,
callback
) {
const stat = fs.statSync(path);
const resolvedPath = fs.realpathSync(path);
const stat = fs.lstatSync(resolvedPath);
callback(stat, resolvedPath);
};

@@ -124,2 +124,3 @@ const { Dirent } = require("fs");

isSync,
useRealPaths,
} = this.options;

@@ -142,3 +143,3 @@

this.buildSymlinkResolver(resolveSymlinks, isSync);
this.buildSymlinkResolver(resolveSymlinks, useRealPaths, isSync);

@@ -193,2 +194,3 @@ this.buildCallbackInvoker(onlyCountsVar, isSync);

resolveSymlinks,
useRealPaths,
isSync

@@ -199,3 +201,7 @@ ) {

this.symlinkResolver = isSync
? fns.resolveSymlinksSync
? useRealPaths
? fns.resolveSymlinksWithRealPathsSync
: fns.resolveSymlinksSync
: useRealPaths
? fns.resolveSymlinksWithRealPathsAsync
: fns.resolveSymlinksAsync;

@@ -202,0 +208,0 @@ };

@@ -31,2 +31,3 @@ const APIBuilder = require("./apiBuilder");

options.relativePath = options.relativePaths ? path : undefined;
options.useRealPaths = options.useRealPaths || true;

@@ -71,4 +72,5 @@ if (options.excludeFiles) {

Builder.prototype.withSymlinks = function() {
Builder.prototype.withSymlinks = function(resolvePaths = true) {
this.resolveSymlinks = true;
this.useRealPaths = resolvePaths;
this.withFullPaths();

@@ -75,0 +77,0 @@ return this;

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