fix(SmartDuplex): Fix issue with SmartDuplex fromWebReadableStream method
This commit is contained in:
parent
60c8824f33
commit
f211cc8ddd
@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# 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)
|
## 2024-10-16 - 3.2.1 - fix(core)
|
||||||
Fix the order of operations in SmartDuplex _read method to ensure proper waiting for items.
|
Fix the order of operations in SmartDuplex _read method to ensure proper waiting for items.
|
||||||
|
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartstream',
|
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.'
|
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.'
|
||||||
}
|
}
|
||||||
|
@ -58,19 +58,13 @@ export class SmartDuplex<TInput = any, TOutput = any> extends Duplex {
|
|||||||
const smartDuplex = new SmartDuplex<T, T>({
|
const smartDuplex = new SmartDuplex<T, T>({
|
||||||
readFunction: async () => {
|
readFunction: async () => {
|
||||||
const reader = readableStream.getReader();
|
const reader = readableStream.getReader();
|
||||||
try {
|
const { value, done } = await reader.read();
|
||||||
while (true) {
|
if (value !== undefined) {
|
||||||
const { value, done } = await reader.read();
|
smartDuplex.push(value);
|
||||||
if (value !== undefined) {
|
}
|
||||||
smartDuplex.push(value);
|
reader.releaseLock();
|
||||||
}
|
if (done) {
|
||||||
if (done) {
|
smartDuplex.end();
|
||||||
smartDuplex.end();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
reader.releaseLock();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartstream',
|
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.'
|
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.'
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user