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

steno

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

steno - npm Package Compare versions

Comparing version 4.0.1 to 4.0.2

23

lib/index.js
import { rename, writeFile } from 'node:fs/promises';
import { basename, dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import retry from 'async-retry';
// Returns a temporary file

@@ -11,2 +10,18 @@ // Example: for /some/file will return /some/.file.tmp

}
// Retries an asynchronous operation with a delay between retries and a maximum retry count
async function retryAsyncOperation(fn, maxRetries, delayMs) {
for (let i = 0; i < maxRetries; i++) {
try {
return await fn();
}
catch (error) {
if (i < maxRetries - 1) {
await new Promise((resolve) => setTimeout(resolve, delayMs));
}
else {
throw error; // Rethrow the error if max retries reached
}
}
}
}
export class Writer {

@@ -40,7 +55,5 @@ #filename;

await writeFile(this.#tempFilename, data, 'utf-8');
await retry(async () => {
await retryAsyncOperation(async () => {
await rename(this.#tempFilename, this.#filename);
}, {
minTimeout: 100,
});
}, 10, 100);
// Call resolve

@@ -47,0 +60,0 @@ this.#prev?.[0]();

{
"name": "steno",
"version": "4.0.1",
"version": "4.0.2",
"description": "Specialized fast async file writer",

@@ -61,6 +61,3 @@ "keywords": [

"node": ">=18"
},
"dependencies": {
"async-retry": "^1.3.3"
}
}
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