fix(core): update
This commit is contained in:
parent
b0ae383622
commit
14771fab27
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartfile',
|
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.'
|
description: 'Provides comprehensive tools for efficient file management in Node.js using TypeScript, including handling streams, virtual directories, and various file operations.'
|
||||||
}
|
}
|
||||||
|
@ -10,20 +10,6 @@ type TStreamSource = (streamFile: StreamFile) => Promise<Readable>;
|
|||||||
* It allows creating streams from a file path, a URL, or a buffer.
|
* It allows creating streams from a file path, a URL, or a buffer.
|
||||||
*/
|
*/
|
||||||
export class StreamFile {
|
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
|
// STATIC
|
||||||
|
|
||||||
public static async fromPath(filePath: string): Promise<StreamFile> {
|
public static async fromPath(filePath: string): Promise<StreamFile> {
|
||||||
@ -91,6 +77,21 @@ export class StreamFile {
|
|||||||
return 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
|
// METHODS
|
||||||
|
|
||||||
private checkMultiUse() {
|
private checkMultiUse() {
|
||||||
|
3
ts/fs.ts
3
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 filePathArg
|
||||||
* @param fileTypeArg
|
* @param fileTypeArg
|
||||||
* @returns {any}
|
* @returns {any}
|
||||||
|
Loading…
Reference in New Issue
Block a user