diff --git a/changelog.md b/changelog.md index be8f558..601d61c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2024-10-16 - 3.2.2 - fix(SmartDuplex) +Fix issue with SmartDuplex fromWebReadableStream method + +- Resolved a potential unhandled promise rejection in fromWebReadableStream method +- Ensured proper release of stream reader lock in case of read completion + ## 2024-10-16 - 3.2.1 - fix(core) Fix the order of operations in SmartDuplex _read method to ensure proper waiting for items. diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 418649c..7b6c7c6 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartstream', - version: '3.2.1', + version: '3.2.2', description: 'A library to simplify the creation and manipulation of Node.js streams, providing utilities for handling transform, duplex, and readable/writable streams effectively in TypeScript.' } diff --git a/ts/smartstream.classes.smartduplex.ts b/ts/smartstream.classes.smartduplex.ts index e6b5d67..689cf09 100644 --- a/ts/smartstream.classes.smartduplex.ts +++ b/ts/smartstream.classes.smartduplex.ts @@ -58,19 +58,13 @@ export class SmartDuplex extends Duplex { const smartDuplex = new SmartDuplex({ readFunction: async () => { const reader = readableStream.getReader(); - try { - while (true) { - const { value, done } = await reader.read(); - if (value !== undefined) { - smartDuplex.push(value); - } - if (done) { - smartDuplex.end(); - break; - } - } - } finally { - reader.releaseLock(); + const { value, done } = await reader.read(); + if (value !== undefined) { + smartDuplex.push(value); + } + reader.releaseLock(); + if (done) { + smartDuplex.end(); } }, }); diff --git a/ts_web/00_commitinfo_data.ts b/ts_web/00_commitinfo_data.ts index 418649c..7b6c7c6 100644 --- a/ts_web/00_commitinfo_data.ts +++ b/ts_web/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartstream', - version: '3.2.1', + version: '3.2.2', description: 'A library to simplify the creation and manipulation of Node.js streams, providing utilities for handling transform, duplex, and readable/writable streams effectively in TypeScript.' }