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

@dbpath/files

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dbpath/files - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

1

dist/src/files.d.ts
import { ErrorsAnd } from "@dbpath/utils";
export declare function findInParent(directory: string, acceptor: (filename: string) => boolean): string | undefined;
export declare function findDirectoryHoldingFileOrError(directory: string, file: string): ErrorsAnd<string>;
export declare function loadFileInDirectory(cwd: string, marker: string, filename: string): any;
export declare function findDirectoryHoldingFileOrThrow(directory: string, file: string): string;
export declare function findFileInParentsOrError(directory: string, file: string): ErrorsAnd<string>;
export declare function readTestFile(dir: any, file: string): string;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.readTestFile = exports.findFileInParentsOrError = exports.findDirectoryHoldingFileOrThrow = exports.findDirectoryHoldingFileOrError = exports.findInParent = void 0;
exports.readTestFile = exports.findFileInParentsOrError = exports.findDirectoryHoldingFileOrThrow = exports.loadFileInDirectory = exports.findDirectoryHoldingFileOrError = exports.findInParent = void 0;
const path_1 = __importDefault(require("path"));

@@ -54,2 +54,21 @@ const fs_1 = __importDefault(require("fs"));

exports.findDirectoryHoldingFileOrError = findDirectoryHoldingFileOrError;
function loadFileInDirectory(cwd, marker, filename) {
const dir = findDirectoryHoldingFileOrError(cwd, marker);
if ((0, utils_1.hasErrors)(dir))
return dir;
const file = Path.join(dir, filename);
try {
const contents = fs_1.default.readFileSync(file).toString('utf-8');
try {
return JSON.parse(contents).currentEnvironment;
}
catch (e) {
return [`Error parsing ${file}: ${e.message}`];
}
}
catch (e) {
return [`Error reading ${file}: ${e.message}`];
}
}
exports.loadFileInDirectory = loadFileInDirectory;
function findDirectoryHoldingFileOrThrow(directory, file) {

@@ -56,0 +75,0 @@ const dir = findDirectoryHoldingFileOrError(directory, file);

2

package.json
{
"name": "@dbpath/files",
"description": "",
"version": "0.1.1",
"version": "0.2.0",
"main": "dist/index",

@@ -6,0 +6,0 @@ "types": "dist/index",

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