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

@bscotch/pathy

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bscotch/pathy - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

12

dist/lib/pathy.d.ts
/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
import fs from 'fs';
import fse from 'fs-extra';
import { PathyCache } from './pathy.cache.js';
import { PathyStatic } from './pathy.static.js';
import type { PathyFindParentOptions, PathyInfix, PathyListChildrenOptions, PathyOrString, PathyReadOptions, PathyWriteOptions } from './pathy.types.js';

@@ -13,3 +15,3 @@ export type { PathyListChildrenOptions, PathyOrString, PathyReadOptions, PathyWriteOptions, } from './pathy.types.js';

*/
export declare class Pathy<FileContent = unknown> extends PathyCache {
export declare class Pathy<FileContent = unknown> extends PathyStatic {
/**

@@ -76,3 +78,3 @@ * The normalized path, with whatever

up(levels?: number): Pathy;
join(...paths: PathyOrString[]): Pathy;
join<T = unknown>(...paths: PathyOrString[]): Pathy<T>;
/**

@@ -117,4 +119,4 @@ * Change to another path by jumping through a number

}): boolean;
stat(): Promise<import("./pathy.types.js").PathyStats>;
statSync(): import("./pathy.types.js").PathyStats;
stat(): Promise<fs.Stats>;
statSync(): fs.Stats;
/**

@@ -121,0 +123,0 @@ * Check if this path leads to an empty directory.

@@ -6,4 +6,4 @@ import { __decorate, __metadata } from "tslib";

import nodePath from 'path';
import { PathyCache } from './pathy.cache.js';
import { trace } from './pathy.lib.js';
import { PathyStatic } from './pathy.static.js';
/**

@@ -16,3 +16,3 @@ * An **immutable** utility class for reducing the cognitive load of

*/
export class Pathy extends PathyCache {
export class Pathy extends PathyStatic {
/**

@@ -186,10 +186,6 @@ * The normalized path, with whatever

async stat() {
const stats = this.fromCache('stats') ||
this.updateCache('stats', await fse.stat(this.absolute));
return stats;
return await fse.stat(this.absolute);
}
statSync() {
const stats = this.fromCache('stats') ||
this.updateCache('stats', fs.statSync(this.absolute));
return stats;
return fs.statSync(this.absolute);
}

@@ -196,0 +192,0 @@ /**

/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
import { Stats } from 'fs';
import type { Pathy } from './pathy.js';
import type { PathyFindParentOptions, PathyInfix, PathyListChildrenOptions, PathyOrString, PathyReadOptions, PathyStats, PathyWriteOptions } from './pathy.types.js';
import type { PathyFindParentOptions, PathyInfix, PathyListChildrenOptions, PathyOrString, PathyReadOptions, PathyWriteOptions } from './pathy.types.js';
/**

@@ -122,3 +124,3 @@ * A base class providing static functions for {@link Pathy}.

static normalizedExtension(filepath: PathyOrString): string | undefined;
static stat(filepath: PathyOrString): Promise<PathyStats>;
static stat(filepath: PathyOrString): Promise<Stats>;
static exists(filepath: PathyOrString): Promise<boolean>;

@@ -125,0 +127,0 @@ /**

@@ -285,2 +285,14 @@ import { __decorate, __metadata } from "tslib";

}
// May have permissions problems trying to
// stat administrative files etc. In those
// cases, treat those as if they were ignored.
try {
await child.stat();
}
catch (err) {
if (err.code === 'EPERM') {
continue;
}
throw err;
}
// Handle dirs first!

@@ -287,0 +299,0 @@ if (await child.isDirectory()) {

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

}
/**
* Node has two ways to represent information about
* an object at a given filepath: {@link fs.Dirent} and
* {@link fs.Stats}.
*
* These two types overlap in a bunch of their methods,
* and those are the only ones Pathy uses. This interface
* represents that intersection, allowing either core type
* to be used internally.
*/
export interface PathyStats {
isFile(): boolean;
isDirectory(): boolean;
isBlockDevice(): boolean;
isCharacterDevice(): boolean;
isSymbolicLink(): boolean;
isFIFO(): boolean;
isSocket(): boolean;
}
export interface PathyCacheData {
stats?: PathyStats;
}
export declare type PathyOrString = string | Pathy;

@@ -233,0 +211,0 @@ export interface PathyInfix {

{
"name": "@bscotch/pathy",
"version": "2.0.0",
"version": "2.1.0",
"type": "module",

@@ -19,3 +19,3 @@ "exports": {

"dependencies": {
"@bscotch/utility": "^6.1.0",
"@bscotch/utility": "^6.1.1",
"chai": "^4.3.6",

@@ -28,3 +28,4 @@ "fs-extra": "^10.1.0",

"devDependencies": {
"type-fest": "^2.13.0"
"type-fest": "^2.16.0",
"typescript": "^4.8.0-beta"
},

@@ -31,0 +32,0 @@ "publishConfig": {

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

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