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
112
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 2.1.1 to 2.1.2

2

CHANGELOG.md
# Change Log
- **Last updated**: 2024-04-25T19:44:55Z
- **Last updated**: 2024-05-08T18:24:31Z
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)

@@ -5,0 +5,0 @@

import { rmSync, unlinkSync } from "node:fs";
const deleteFile = (path, logger, dryRun = false) => {
logger && logger.info(`${dryRun ? "[dryrun] " : ""}deleting file: ${path}`);
if (dryRun)
return;
if (dryRun) return;
unlinkSync(path);

@@ -10,4 +9,3 @@ };

logger && logger.info(`${dryRun ? "[dryrun] " : ""}deleting file: ${path}`);
if (dryRun)
return;
if (dryRun) return;
rmSync(path, { recursive: true, force: true });

@@ -14,0 +12,0 @@ };

@@ -20,7 +20,5 @@ import { U32 } from "@thi.ng/hex";

});
if (bytesRead === 0)
break;
if (bytesRead === 0) break;
yield buffer;
if (bytesRead < size)
break;
if (bytesRead < size) break;
start += bytesRead;

@@ -27,0 +25,0 @@ }

@@ -7,4 +7,3 @@ import { readdirSync, statSync } from "node:fs";

function* __files(dir, match = "", logger, maxDepth = Infinity, depth = 0) {
if (depth >= maxDepth)
return;
if (depth >= maxDepth) return;
const pred = __ensurePred(match);

@@ -26,4 +25,3 @@ for (let f of readdirSync(dir).sort()) {

function* __dirs(dir, match = "", logger, maxDepth = Infinity, depth = 0) {
if (depth >= maxDepth)
return;
if (depth >= maxDepth) return;
const pred = __ensurePred(match);

@@ -34,4 +32,3 @@ for (let f of readdirSync(dir).sort()) {

if (statSync(curr).isDirectory()) {
if (pred(curr))
yield curr;
if (pred(curr)) yield curr;
yield* __dirs(curr, match, logger, maxDepth, depth + 1);

@@ -38,0 +35,0 @@ }

@@ -9,4 +9,3 @@ import { createHash } from "node:crypto";

const sum = createHash(algo);
for await (let chunk of src)
sum.update(chunk);
for await (let chunk of src) sum.update(chunk);
const hash = sum.digest("hex");

@@ -13,0 +12,0 @@ logger && logger.info(`${algo} hash: ${hash}`);

{
"name": "@thi.ng/file-io",
"version": "2.1.1",
"version": "2.1.2",
"description": "Assorted file I/O utils (with logging support) for NodeJS/Bun",

@@ -39,13 +39,13 @@ "type": "module",

"dependencies": {
"@thi.ng/api": "^8.11.1",
"@thi.ng/checks": "^3.6.3",
"@thi.ng/hex": "^2.3.45",
"@thi.ng/logger": "^3.0.11",
"@thi.ng/random": "^3.7.5"
"@thi.ng/api": "^8.11.2",
"@thi.ng/checks": "^3.6.4",
"@thi.ng/hex": "^2.3.46",
"@thi.ng/logger": "^3.0.12",
"@thi.ng/random": "^3.8.0"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.43.0",
"esbuild": "^0.20.2",
"typedoc": "^0.25.12",
"typescript": "^5.4.3"
"@microsoft/api-extractor": "^7.43.2",
"esbuild": "^0.21.1",
"typedoc": "^0.25.13",
"typescript": "^5.4.5"
},

@@ -127,3 +127,3 @@ "keywords": [

},
"gitHead": "aed3421c21044c005fbcb7cc37965ccf85a870d2\n"
"gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
}

@@ -8,4 +8,3 @@ var __defProp = Object.defineProperty;

result = (kind ? decorator(target, key, result) : decorator(result)) || result;
if (kind && result)
__defProp(target, key, result);
if (kind && result) __defProp(target, key, result);
return result;

@@ -42,4 +41,3 @@ };

add(path, opts) {
if (this.watchers[path])
return false;
if (this.watchers[path]) return false;
const isDir = isDirectory(path);

@@ -52,7 +50,5 @@ const pred = __ensurePred(opts?.ext || "");

(event, currPath) => {
if (!currPath)
return;
if (!currPath) return;
currPath = isDir ? join(path, currPath) : path;
if (!pred(currPath))
return;
if (!pred(currPath)) return;
setTimeout(() => {

@@ -81,4 +77,3 @@ if (event === "change") {

const watcher = this.watchers[path];
if (!watcher)
return false;
if (!watcher) return false;
this.opts.logger.debug(`removing watcher for: ${path}`);

@@ -85,0 +80,0 @@ watcher.close();

@@ -6,4 +6,3 @@ import { isString } from "@thi.ng/checks/is-string";

logger && logger.info(`${dryRun ? "[dryrun] " : ""}writing file: ${path}`);
if (dryRun)
return;
if (dryRun) return;
ensureDirForFile(path);

@@ -10,0 +9,0 @@ writeFileSync(path, body, !opts && isString(body) ? "utf-8" : opts);

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