rxrunscript
    TypeScript icon, indicating that this package has built-in type declarations

    6.2.0 • Public • Published

    RxRunScript

    Run shell script or command in Node.js child process, Output Observable<Buffer>

    Version License Build Status Build status Coverage Status

    Installing

    $ npm install rxrunscript

    Usage

    import { run } from 'rxrunscript'
    import { take } from 'rxjs/operators'
    
    run('openssl version')
      .pipe(
        take(1),  // assume all output in one buffer
      )
      .subscribe(
        buf => console.log(buf.toString()), 
        err => console.error(err),
      ) 
    
    // exec shell file
    run('./test/openssl.sh')
      .subscribe(
        arr => console.log(buf.toString()),
      )
    
    
    import { reduce } from 'rxjs/operators'
    
    // win32
    run('tasklist')
      .pipe(
        reduce((acc: Buffer[], curr: Buffer) => {
          acc.push(curr)
          return acc
        }, []),
      )
      .subscribe(
        arr => console.log(Buffer.concat(arr).toString()),
        err => console.error(err),
        () => console.log('complete'),
      )
    
    // run cmd file
    run('./test/prepare.cmd')
      .subscribe(
        arr => console.log(buf.toString()),
      )

    License

    MIT

    Languages

    Install

    npm i rxrunscript

    DownloadsWeekly Downloads

    258

    Version

    6.2.0

    License

    MIT

    Unpacked Size

    82.4 kB

    Total Files

    52

    Last publish

    Collaborators

    • avatar