Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

chore: update deps #128

Merged
merged 3 commits into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
language: node_js
cache: npm
dist: bionic

branches:
only:
- master
- /^release\/.*$/

stages:
- check
- test
- cov

node_js:
- '10'
- '12'
- 'lts/*'
- 'node'

os:
- linux
- osx
- windows

script: npx nyc -s npm run test:node -- --bail
after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov
Expand All @@ -36,7 +44,7 @@ jobs:
name: firefox
addons:
firefox: latest
script: npx aegir test -t browser -t webworker -- --browsers FirefoxHeadless
script: npx aegir test -t browser -t webworker -- --browser firefox

notifications:
email: false
20 changes: 11 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,27 @@
},
"homepage": "https://github.com/multiformats/js-multistream-select#readme",
"dependencies": {
"bl": "^4.0.0",
"bl": "^5.0.0",
"debug": "^4.1.1",
"err-code": "^2.0.0",
"it-handshake": "^1.0.2",
"it-length-prefixed": "^3.0.0",
"err-code": "^3.0.1",
"it-first": "^1.0.6",
"it-handshake": "^2.0.0",
"it-length-prefixed": "^5.0.0",
"it-pipe": "^1.0.1",
"it-reader": "^2.0.0",
"it-reader": "^3.0.0",
"p-defer": "^3.0.0",
"uint8arrays": "^1.1.0"
"uint8arrays": "^2.1.4"
},
"devDependencies": {
"aegir": "^25.1.0",
"@types/bl": "^4.1.0",
"aegir": "^33.0.0",
"chai": "^4.2.0",
"dirty-chai": "^2.0.1",
"it-pair": "^1.0.0",
"mocha": "^8.1.1",
"p-timeout": "^3.2.0",
"p-timeout": "^4.0.0",
"streaming-iterables": "^5.0.2",
"varint": "^5.0.0"
"varint": "^6.0.0"
},
"contributors": [
"David Dias <daviddias.p@gmail.com>",
Expand Down
7 changes: 2 additions & 5 deletions src/multistream.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ const lp = require('it-length-prefixed')
const pipe = require('it-pipe')
const errCode = require('err-code')
const uint8ArrayFromString = require('uint8arrays/from-string')
const first = require('it-first')

const NewLine = uint8ArrayFromString('\n')

async function oneChunk (source) {
for await (const chunk of source) return chunk // We only need one!
}

exports.encode = buffer => lp.encode.single(new BufferList([buffer, NewLine]))

// `write` encodes and writes a single buffer
Expand All @@ -31,7 +28,7 @@ exports.read = async reader => {

// Once the length has been parsed, read chunk for that length
const onLength = l => { byteLength = l }
const buf = await pipe(varByteSource, lp.decode({ onLength }), oneChunk)
const buf = await pipe(varByteSource, lp.decode({ onLength }), first)

if (buf.get(buf.length - 1) !== NewLine[0]) {
throw errCode(new Error('missing newline'), 'ERR_INVALID_MULTISTREAM_SELECT_MESSAGE')
Expand Down