8000 split dies when using a transform function that returns an object · Issue #8 · dominictarr/split · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jul 5, 2019. It is now read-only.
This repository was archived by the owner on Jul 5, 2019. It is now read-only.
split dies when using a transform function that returns an object #8
Open
@kevzettler

Description

@kevzettler

per the readme I should beable to pass a function to split which returns an object ( like JSON.parse ) and then get a stream of objects.

Doing this I get an error

function splitHandler(){
  return {test: true};
}

  var stream = fs.createReadStream(file_path)
                 .pipe(zlib.createGunzip())
                 .pipe(split(splitHandler))
                 .pipe(process.stdout)
net.js:614
    throw new TypeError('invalid data');
          ^
TypeError: invalid data
    at WriteStream.Socket.write (net.js:614:11)
    at Stream.ondata (stream.js:51:26)
    at Stream.emit (events.js:95:17)
    at drain (/home/app/aquirer_shuffle/node_modules/split/node_modules/through/index.js:36:16)
    at Stream.stream.queue.stream.push (/home/app/aquirer_shuffle/node_modules/split/node_modules/through/index.js:45:5)
    at emit (/home/app/aquirer_shuffle/node_modules/split/index.js:33:16)
    at next (/home/app/aquirer_shuffle/node_modules/split/index.js:48:7)
    at Stream.<anonymous> (/home/app/aquirer_shuffle/node_modules/split/index.js:53:5)
    at Stream.stream.write (/home/app/aquirer_shuffle/node_modules/split/node_modules/through/index.js:26:11)
    at write (_stream_readable.js:585:24)

if I change the splitHandler to

function splitHandler(){
  return "derp";
}

and return a string it works

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0