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

@thi.ng/file-io

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/file-io - npm Package Compare versions

Comparing version 0.3.25 to 0.4.0

read.d.ts

9

CHANGELOG.md
# Change Log
- **Last updated**: 2022-12-29T20:56:59Z
- **Last updated**: 2023-01-10T15:20:18Z
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)

@@ -12,2 +12,9 @@

## [0.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/file-io@0.4.0) (2023-01-10)
#### 🚀 Features
- add readText() encoding opts ([22366c0](https://github.com/thi-ng/umbrella/commit/22366c0))
- add readBinary(), update pkg exports ([2c647ed](https://github.com/thi-ng/umbrella/commit/2c647ed))
### [0.3.25](https://github.com/thi-ng/umbrella/tree/@thi.ng/file-io@0.3.25) (2022-12-29)

@@ -14,0 +21,0 @@

@@ -8,2 +8,3 @@ export * from "./delete.js";

export * from "./mask.js";
export * from "./read.js";
export * from "./temp.js";

@@ -10,0 +11,0 @@ export * from "./text.js";

@@ -8,4 +8,5 @@ export * from "./delete.js";

export * from "./mask.js";
export * from "./read.js";
export * from "./temp.js";
export * from "./text.js";
export * from "./write.js";

17

package.json
{
"name": "@thi.ng/file-io",
"version": "0.3.25",
"version": "0.4.0",
"description": "Assorted file I/O utils (with logging support) for NodeJS",

@@ -37,10 +37,10 @@ "type": "module",

"dependencies": {
"@thi.ng/api": "^8.6.2",
"@thi.ng/checks": "^3.3.6",
"@thi.ng/logger": "^1.4.6",
"@thi.ng/random": "^3.3.20"
"@thi.ng/api": "^8.6.3",
"@thi.ng/checks": "^3.3.7",
"@thi.ng/logger": "^1.4.7",
"@thi.ng/random": "^3.3.21"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.33.7",
"@thi.ng/testament": "^0.3.8",
"@thi.ng/testament": "^0.3.9",
"rimraf": "^3.0.2",

@@ -99,2 +99,5 @@ "tools": "^0.0.1",

},
"./read": {
"default": "./read.js"
},
"./temp": {

@@ -114,3 +117,3 @@ "default": "./temp.js"

},
"gitHead": "28bb74c67217a352d673b6efdab234921d4a370e\n"
"gitHead": "3f0b3e2a7c82aefc7e46fb4338369836b5e1b8cf\n"
}

@@ -46,3 +46,3 @@ <!-- This file is generated - DO NOT EDIT! -->

Package sizes (brotli'd, pre-treeshake): ESM: 997 bytes
Package sizes (brotli'd, pre-treeshake): ESM: 1.03 KB

@@ -79,2 +79,2 @@ ## Dependencies

&copy; 2022 Karsten Schmidt // Apache License 2.0
&copy; 2022 - 2023 Karsten Schmidt // Apache License 2.0

@@ -0,4 +1,13 @@

/// <reference types="node" />
import type { ILogger } from "@thi.ng/logger";
export declare const readText: (path: string, logger?: ILogger) => string;
/**
* Reads text from given file `path`, optionally with custom encoding (default:
* UTF-8).
*
* @param path
* @param logger
* @param encoding
*/
export declare const readText: (path: string, logger?: ILogger, encoding?: Extract<BufferEncoding, "ascii" | "latin1" | "utf-8" | "utf-16le" | "ucs-2">) => string;
/**
* Writes `body` as UTF-8 file to given `path`. If `dryRun` is true (default:

@@ -5,0 +14,0 @@ * false), the file WON'T be written, however if a `logger` is provided then at

import { isArray } from "@thi.ng/checks/is-array";
import { readFileSync } from "fs";
import { writeFile } from "./write.js";
export const readText = (path, logger) => {
/**
* Reads text from given file `path`, optionally with custom encoding (default:
* UTF-8).
*
* @param path
* @param logger
* @param encoding
*/
export const readText = (path, logger, encoding = "utf-8") => {
logger && logger.debug("reading file:", path);
return readFileSync(path, "utf-8");
return readFileSync(path, encoding);
};

@@ -8,0 +16,0 @@ /**

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