@zenfs/core
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -57,3 +57,3 @@ import type { Backend, BackendConfiguration, FilesystemOf, SharedConfig } from './backends/backend.js'; | ||
/** | ||
* If true, disables `read` and `readSync` from immediately syncing the updated atime to the file system. | ||
* If true, disables `read` and `readSync` from updating the atime. | ||
* | ||
@@ -64,3 +64,3 @@ * This can increase performance. | ||
*/ | ||
disableSyncOnRead: boolean; | ||
disableUpdateOnRead: boolean; | ||
} | ||
@@ -67,0 +67,0 @@ /** |
@@ -73,3 +73,3 @@ import { checkOptions, isBackend, isBackendConfig } from './backends/backend.js'; | ||
config.checkAccess = !configuration.disableAccessChecks; | ||
config.syncOnRead = !configuration.disableSyncOnRead; | ||
config.updateOnRead = !configuration.disableUpdateOnRead; | ||
if (configuration.addDevices) { | ||
@@ -76,0 +76,0 @@ const devfs = new DeviceFS(); |
@@ -9,3 +9,3 @@ export declare const config: { | ||
*/ | ||
syncOnRead: boolean; | ||
updateOnRead: boolean; | ||
}; |
@@ -9,3 +9,3 @@ export const config = { | ||
*/ | ||
syncOnRead: true, | ||
updateOnRead: true, | ||
}; |
@@ -361,3 +361,6 @@ import { O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_SYNC, O_TRUNC, O_WRONLY, S_IFMT, size_max } from './emulation/constants.js'; | ||
} | ||
this.dirty = true; | ||
if (config.updateOnRead) { | ||
this.dirty = true; | ||
this.stats.atimeMs = Date.now(); | ||
} | ||
position ?? (position = this.position); | ||
@@ -368,3 +371,2 @@ let end = position + length; | ||
} | ||
this.stats.atimeMs = Date.now(); | ||
this._position = end; | ||
@@ -389,4 +391,3 @@ const bytesRead = end - position; | ||
const bytesRead = this._read(buffer, offset, length, position); | ||
if (config.syncOnRead) | ||
await this.sync(); | ||
await this.sync(); | ||
return { bytesRead, buffer }; | ||
@@ -405,4 +406,3 @@ } | ||
const bytesRead = this._read(buffer, offset, length, position); | ||
if (config.syncOnRead) | ||
this.syncSync(); | ||
this.syncSync(); | ||
return bytesRead; | ||
@@ -409,0 +409,0 @@ } |
{ | ||
"name": "@zenfs/core", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "A filesystem, anywhere", | ||
@@ -5,0 +5,0 @@ "funding": { |
@@ -122,3 +122,3 @@ import type { Backend, BackendConfiguration, FilesystemOf, SharedConfig } from './backends/backend.js'; | ||
/** | ||
* If true, disables `read` and `readSync` from immediately syncing the updated atime to the file system. | ||
* If true, disables `read` and `readSync` from updating the atime. | ||
* | ||
@@ -129,3 +129,3 @@ * This can increase performance. | ||
*/ | ||
disableSyncOnRead: boolean; | ||
disableUpdateOnRead: boolean; | ||
} | ||
@@ -158,3 +158,3 @@ | ||
config.checkAccess = !configuration.disableAccessChecks; | ||
config.syncOnRead = !configuration.disableSyncOnRead; | ||
config.updateOnRead = !configuration.disableUpdateOnRead; | ||
@@ -161,0 +161,0 @@ if (configuration.addDevices) { |
@@ -10,3 +10,3 @@ export const config = { | ||
*/ | ||
syncOnRead: true, | ||
updateOnRead: true, | ||
}; |
@@ -518,3 +518,6 @@ import type { FileReadResult } from 'node:fs/promises'; | ||
} | ||
this.dirty = true; | ||
if (config.updateOnRead) { | ||
this.dirty = true; | ||
this.stats.atimeMs = Date.now(); | ||
} | ||
position ??= this.position; | ||
@@ -525,3 +528,2 @@ let end = position + length; | ||
} | ||
this.stats.atimeMs = Date.now(); | ||
this._position = end; | ||
@@ -547,3 +549,3 @@ const bytesRead = end - position; | ||
const bytesRead = this._read(buffer, offset, length, position); | ||
if (config.syncOnRead) await this.sync(); | ||
await this.sync(); | ||
return { bytesRead, buffer }; | ||
@@ -563,3 +565,3 @@ } | ||
const bytesRead = this._read(buffer, offset, length, position); | ||
if (config.syncOnRead) this.syncSync(); | ||
this.syncSync(); | ||
return bytesRead; | ||
@@ -566,0 +568,0 @@ } |
23068
868394