pull-stream/pull-files

Net/ws adapter

Closed this issue · 0 comments

jamen commented

It would be cool if there was pull-net or pull-ws adapter that allowed you to stream files over a network:

pull(
  read('foo/*.js'. { encode: 'utf8' }),
  send()
)

And then on client-side:

pull(
  receive(),
  drain(file => {
    // ...
  })
)

This would be pretty easy just using some basic serialization.

But what would be more interesting (and tricky) is maintaining stream mode over to the client:

pull(
  read('foo/*.js', { stream: true }),
  send()
)

And then client-side:

pull(
  receive(),
  drain(file => {
    pull(file.contents, collect((err, chunks) => {
      // ...
    }))
  })
)

This would stream the file over the network in chunks, and allow you to collect it on the client in chunks, very easily!