From 14771fab2737f346201e62c9f2e07fbc801a5a58 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Thu, 6 Jun 2024 22:29:06 +0200 Subject: [PATCH] fix(core): update --- ts/00_commitinfo_data.ts | 2 +- ts/classes.streamfile.ts | 29 +++++++++++++++-------------- ts/fs.ts | 3 ++- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 24ee98e..8ba0378 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartfile', - version: '11.0.16', + version: '11.0.17', description: 'Provides comprehensive tools for efficient file management in Node.js using TypeScript, including handling streams, virtual directories, and various file operations.' } diff --git a/ts/classes.streamfile.ts b/ts/classes.streamfile.ts index 21a95c5..1279d80 100644 --- a/ts/classes.streamfile.ts +++ b/ts/classes.streamfile.ts @@ -10,20 +10,6 @@ type TStreamSource = (streamFile: StreamFile) => Promise; * It allows creating streams from a file path, a URL, or a buffer. */ export class StreamFile { - // INSTANCE - relativeFilePath?: string; - private streamSource: TStreamSource; - - // enable stream based multi use - private cachedStreamBuffer?: Buffer; - public multiUse: boolean; - public used: boolean = false; - - private constructor(streamSource: TStreamSource, relativeFilePath?: string) { - this.streamSource = streamSource; - this.relativeFilePath = relativeFilePath; - } - // STATIC public static async fromPath(filePath: string): Promise { @@ -91,6 +77,21 @@ export class StreamFile { return streamFile; } + + // INSTANCE + relativeFilePath?: string; + private streamSource: TStreamSource; + + // enable stream based multi use + private cachedStreamBuffer?: Buffer; + public multiUse: boolean; + public used: boolean = false; + + private constructor(streamSource: TStreamSource, relativeFilePath?: string) { + this.streamSource = streamSource; + this.relativeFilePath = relativeFilePath; + } + // METHODS private checkMultiUse() { diff --git a/ts/fs.ts b/ts/fs.ts index 074eec9..5b3c646 100644 --- a/ts/fs.ts +++ b/ts/fs.ts @@ -190,7 +190,8 @@ export const removeManySync = (filePathArrayArg: string[]): void => { ===============================================================*/ /** - * + * reads a file content to an object + * good for JSON, YAML, TOML, etc. * @param filePathArg * @param fileTypeArg * @returns {any}