Socket
Socket
Sign inDemoInstall

@ark/fs

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ark/fs - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

9

out/fs.d.ts
export { rmSync } from "node:fs";
export declare const ensureDir: (path: string) => string;
export declare const readFile: (path: string) => string;
export declare const writeFile: (path: string, contents: string) => void;
export declare const readJson: (path: string) => any;
export declare const writeFile: (path: string, contents: string) => string;
export declare const rewriteFile: (path: string, transform: (contents: string) => string) => string;
export declare const readJson: (path: string) => Record<string, unknown>;
export declare const writeJson: (path: string, data: object) => void;
export type JsonTransformer = (data: object) => object;
export declare const rewriteJson: (path: string, transform: (data: object) => object) => void;
export declare const rmRf: (target: string) => void;
export declare const cpR: (from: string, to: string) => void;
export type JsonTransformer = (data: object) => object;
export declare const rewriteJson: (path: string, transform: JsonTransformer) => void;
export type WalkOptions = {

@@ -12,0 +13,0 @@ ignoreDirsMatching?: RegExp;

@@ -19,8 +19,12 @@ import { cpSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";

export const readFile = (path) => readFileSync(path).toString();
export const writeFile = (path, contents) => writeFileSync(path, contents);
export const writeFile = (path, contents) => {
writeFileSync(path, contents);
return contents;
};
export const rewriteFile = (path, transform) => writeFile(path, transform(readFile(path)));
export const readJson = (path) => JSON.parse(readFileSync(path, { encoding: "utf8" }));
export const writeJson = (path, data) => writeFileSync(path, `${JSON.stringify(data, null, 4)}\n`);
export const rewriteJson = (path, transform) => writeJson(path, transform(readJson(path)));
export const rmRf = (target) => rmSync(target, { recursive: true, force: true });
export const cpR = (from, to) => cpSync(from, to, { recursive: true, force: true });
export const rewriteJson = (path, transform) => writeJson(path, transform(readJson(path)));
export const walkPaths = (dir, options = {}) => readdirSync(dir).reduce((paths, item) => {

@@ -27,0 +31,0 @@ const path = join(dir, item);

@@ -64,3 +64,3 @@ /** The combination of location information about the line that was executing at the time */

* "method": "Object.<anonymous>",
* "file": "/Users/balupton/some-project/calling-file.js"
* "file": "/Users/balupton/some-project/calling-file.ts"
* }

@@ -67,0 +67,0 @@ * ```

@@ -12,2 +12,3 @@ // Copied from unmaintained package https://github.com/bevry/get-current-line to fix imports

stack = error.stack;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
}

@@ -19,2 +20,3 @@ catch (error1) {

stack = previous && previous.stack;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
}

@@ -157,3 +159,3 @@ catch (error2) {

* "method": "Object.<anonymous>",
* "file": "/Users/balupton/some-project/calling-file.js"
* "file": "/Users/balupton/some-project/calling-file.ts"
* }

@@ -160,0 +162,0 @@ * ```

@@ -1,3 +0,3 @@

export * from "./caller.js";
export * from "./fs.js";
export * from "./shell.js";
export * from "./caller.ts";
export * from "./fs.ts";
export * from "./shell.ts";
{
"name": "@ark/fs",
"version": "0.2.1",
"version": "0.2.2",
"author": {

@@ -18,4 +18,6 @@ "name": "David Blass",

"exports": {
".": "./out/index.js",
"./internal/*": "./out/*"
".": {
"ark-ts": "./index.ts",
"default": "./out/index.js"
}
},

@@ -29,4 +31,4 @@ "files": [

"scripts": {
"build": "tsx ../repo/build.ts"
"build": "ts ../repo/build.ts"
}
}
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