Naysayers Promote Misery
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    rpc-with-streamspublic

    stream-rpc

    rpc-stream but with streams

    server-tests

    browser-support

    //server 
    var RPC = require('rpc-with-streams')
    var net = require('net')
    var fs = require('fs')
     
    var rpc = RPC(fs)
    net.createStream(function (stream) {
      stream.pipe(rpc).pipe(stream)
    }).listen(PORT)
    //client 
    var RPC = require('rpc-with-streams')
    var net = require('net')
    var rpc = RPC(fs)
    var stream = net.connect(PORT)
     
    stream.pipe(rpc).pipe(stream)
    //create a partial wrapper of the fs module. 
    var fs = rpc.wrap(
      ['readFile', 'writeFile', 'unlinkFile', 'stat'],
      ['createReadStream', 'createWriteStream']
    )

    Note, stuff that depends on properties that get set on streams (like the .path property on fs streams will not work)

    License

    MIT

    Keywords

    none

    install

    npm i rpc-with-streams

    Downloadslast 7 days

    2

    version

    0.0.0

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar