convert.js 609 B

123456789101112131415161718192021
  1. 'use strict'
  2. const tape = require('tape')
  3. const { BufferList, BufferListStream } = require('../')
  4. const { Buffer } = require('buffer')
  5. tape('convert from BufferList to BufferListStream', (t) => {
  6. const data = Buffer.from(`TEST-${Date.now()}`)
  7. const bl = new BufferList(data)
  8. const bls = new BufferListStream(bl)
  9. t.ok(bl.slice().equals(bls.slice()))
  10. t.end()
  11. })
  12. tape('convert from BufferListStream to BufferList', (t) => {
  13. const data = Buffer.from(`TEST-${Date.now()}`)
  14. const bls = new BufferListStream(data)
  15. const bl = new BufferList(bls)
  16. t.ok(bl.slice().equals(bls.slice()))
  17. t.end()
  18. })