diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 8fb3172..8b6678b 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: '10.0.35', + version: '10.0.36', description: 'offers smart ways to work with files in nodejs' } diff --git a/ts/smartfile.classes.smartfile.ts b/ts/smartfile.classes.smartfile.ts index 6e07bed..738c3f8 100644 --- a/ts/smartfile.classes.smartfile.ts +++ b/ts/smartfile.classes.smartfile.ts @@ -289,4 +289,14 @@ export class Smartfile extends plugins.smartjson.Smartjson { const newFileString = await editFuncArg(this.contentBuffer.toString()); this.contentBuffer = Buffer.from(newFileString); } + + /** + * Returns a ReadableStream from the file's content buffer + */ + public getStream(): plugins.stream.Readable { + const stream = new plugins.stream.Readable(); + stream.push(this.contentBuffer); // Push the content buffer to the stream + stream.push(null); // Push null to signify the end of the stream (EOF) + return stream; + } }