Skip to content

Commit

Permalink
chore: update sibling dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
aegir[bot] committed May 30, 2024
1 parent ad7680b commit c271b1c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 24 deletions.
40 changes: 18 additions & 22 deletions packages/it-queueless-pushable/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,30 @@ repo and examine the changes made.
-->

Collects all `Uint8Array` values from an (async)iterable and returns them as a single `Uint8Array`.
A pushable async generator that waits until the current value is consumed
before allowing a new value to be pushed.

## Example

```javascript
import toBuffer from 'it-to-buffer'

// This can also be an iterator, generator, etc
const values = [Buffer.from([0, 1]), Buffer.from([2, 3])]

const result = toBuffer(values)
Useful for when you don't want to keep memory usage under control and/or
allow a downstream consumer to dictate how fast data flows through a pipe,
but you want to be able to apply a transform to that data.

console.info(result) // Buffer[0, 1, 2, 3]
```

Async sources must be awaited:
## Example

```javascript
import toBuffer from 'it-to-buffer'
```typescript
import { queuelessPushable } from 'it-queueless-pushable'

const values = async function * () {
yield Buffer.from([0, 1])
yield Buffer.from([2, 3])
}
const pushable = queuelessPushable<string>()

const result = await toBuffer(values())
// run asynchronously
Promise.resolve().then(async () => {
// push a value - the returned promise will not resolve until the value is
// read from the pushable
await pushable.push('hello')
})

console.info(result) // Buffer[0, 1, 2, 3]
// read a value
const result = await pushable.next()
console.info(result) // { done: false, value: 'hello' }
```

# Install
Expand Down
4 changes: 2 additions & 2 deletions packages/it-queueless-pushable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"devDependencies": {
"aegir": "^43.0.0",
"delay": "^6.0.0",
"it-all": "^3.0.6",
"it-drain": "^3.0.7"
"it-all": "^3.0.0",
"it-drain": "^3.0.0"
}
}

0 comments on commit c271b1c

Please sign in to comment.