2 Commits

Author SHA1 Message Date
61e3f3a0b6 v1.3.3
Some checks failed
Default (tags) / security (push) Successful in 38s
Default (tags) / test (push) Failing after 36s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-03-05 13:28:17 +00:00
8728115ad0 fix(smartfs.provider.node): replace synchronous readdirSync with async await fs.readdir for directory listings in the Node provider to avoid blocking the event loop 2026-03-05 13:28:17 +00:00
4 changed files with 11 additions and 9 deletions

View File

@@ -1,5 +1,12 @@
# Changelog # Changelog
## 2026-03-05 - 1.3.3 - fix(smartfs.provider.node)
replace synchronous readdirSync with async await fs.readdir for directory listings in the Node provider to avoid blocking the event loop
- Replaced fsSync.readdirSync with await fs.readdir in listDirectory and listDirectoryRecursive.
- Switches from a blocking filesystem call to the non-blocking Node fs API in the node provider.
- Patch bump from 1.3.2 to 1.3.3 is recommended.
## 2026-03-05 - 1.3.2 - fix(provider(node)) ## 2026-03-05 - 1.3.2 - fix(provider(node))
use synchronous readdir to avoid partial results on some filesystems (e.g., XFS) when the process receives signals use synchronous readdir to avoid partial results on some filesystems (e.g., XFS) when the process receives signals

View File

@@ -1,6 +1,6 @@
{ {
"name": "@push.rocks/smartfs", "name": "@push.rocks/smartfs",
"version": "1.3.2", "version": "1.3.3",
"private": false, "private": false,
"description": "a cross platform extendable fs module", "description": "a cross platform extendable fs module",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartfs', name: '@push.rocks/smartfs',
version: '1.3.2', version: '1.3.3',
description: 'a cross platform extendable fs module' description: 'a cross platform extendable fs module'
} }

View File

@@ -158,11 +158,7 @@ export class SmartFsProviderNode implements ISmartFsProvider {
if (options?.recursive) { if (options?.recursive) {
await this.listDirectoryRecursive(path, entries, options); await this.listDirectoryRecursive(path, entries, options);
} else { } else {
// Use readdirSync for reliability — async readdir can return partial results const dirents = await fs.readdir(path, { withFileTypes: true });
// on XFS/mounted filesystems when the process receives signals (e.g., from
// SmartExit/smartshell process group management). The synchronous version
// completes the entire getdents64 syscall without event loop interruption.
const dirents = fsSync.readdirSync(path, { withFileTypes: true });
for (const dirent of dirents) { for (const dirent of dirents) {
const entryPath = pathModule.join(path, dirent.name); const entryPath = pathModule.join(path, dirent.name);
@@ -200,8 +196,7 @@ export class SmartFsProviderNode implements ISmartFsProvider {
entries: IDirectoryEntry[], entries: IDirectoryEntry[],
options?: IListOptions, options?: IListOptions,
): Promise<void> { ): Promise<void> {
// Use readdirSync for reliability — see listDirectory comment const dirents = await fs.readdir(path, { withFileTypes: true });
const dirents = fsSync.readdirSync(path, { withFileTypes: true });
for (const dirent of dirents) { for (const dirent of dirents) {
const entryPath = pathModule.join(path, dirent.name); const entryPath = pathModule.join(path, dirent.name);