@gik/tools-streamer

0.0.11 • Public • Published

@gik/tools-streamer 0.0.11

RXjs extra operators. Part of our tools suite.

Contributors
Supported platforms
  • darwin
  • linux

Table of contents

  • streamer An utility belt for our most common operations with RXJS's Observables.
    • fromAccess member Determine if given path is accessible.
    • fromStat member Determine statistics about a file system node.
    • fromSpawn member Spawn a shell command.
    • fromDirMake member Creates a directory.
    • fromDirRequire member Requires a directory path, if the directory does not exists, it's created.
    • fromDirRead member Get path of nodes in given directory (non recursively).
    • fromDirReadRecursive member Get path of nodes in given directory (recursively).
    • fromFileRead member Reads a file from the disk.
    • fromFileWrite member Writes a file on the disk.

streamer

An utility belt for our most common operations with RXJS's Observables.

To do
  • [ ] Add unit tests for all operators.
Members

▲ Top


fromAccess

static property of streamer

Determine if given path is accessible.

Parameters
path string A path to the node you want to check.
Returns

StreamBoolean - Wether the file is accessible or not.

▲ Top


fromStat

static property of streamer

Determine statistics about a file system node.

Parameters
path string A path to the node you want to check.
Returns

StreamStat - stat object for the node.

Throws
  • Error - When given an invalid node.

▲ Top


fromSpawn

static property of streamer

Spawn a shell command.

Parameters
command string The command you wish to spawn.
config Object Configs sent to spawn command.
Returns

StreamOutput - Each chunk of either stdout or stderr data.

▲ Top


fromDirMake

static property of streamer

Creates a directory.

Parameters
path string The directory to be created.
Returns

StreamString - The path of the directory that was just created.

Throws
  • Error - When directory cannot be created.

▲ Top


fromDirRequire

static property of streamer

Requires a directory path, if the directory does not exists, it's created.

Parameters
dirpath string The requested directory.
Returns

Array.<StreamString> - The path of the directory.

Throws
  • Error - When requested path exists and is not a directory.

▲ Top


fromDirRead

static property of streamer

Get path of nodes in given directory (non recursively).

Parameters
path string The requested directory.
Returns

Array.<StreamDirNode> - The path of the directory.

Throws
  • Error - When requested path exists and is not a directory.

▲ Top


fromDirReadRecursive

static property of streamer

Get path of nodes in given directory (recursively).

Parameters
path string The requested directory.
Returns

StreamPath - The path of the directory.

Throws
  • Error - When requested path exists and is not a directory.

▲ Top


fromFileRead

static property of streamer

Reads a file from the disk.

Parameters
path string The path to the file to read.
Returns

Observable.<string> - The contents of the file.

▲ Top


fromFileWrite

static property of streamer

Writes a file on the disk.

Parameters
path string The full path for the file.
content string The contents of the file.
Returns

Observable.<string> - The future value true if write was succesful.

Throws
  • Error - When the file cannot be written.

▲ Top


Types

Members

▲ Top


NodeOutput

static typedef of Types

Properties
type string The type of chunk that is being received. (stderr || stdout)
data string The actual output.

▲ Top


NodePath

static typedef of Types

Properties
path string The full path for the node
data NodeStat The actual output.

▲ Top


StreamBoolean

static typedef of Types

▲ Top


StreamString

static typedef of Types

▲ Top


StreamStat

static typedef of Types

A stream containing stat from node.

▲ Top


StreamOutput

static typedef of Types

A stream containing stat from node.

▲ Top


StreamPath

static typedef of Types

A stream containing stat from node.

▲ Top


StreamParamError

static typedef of Types

Thrown when a parameter is not the correct type.

▲ Top


Package Sidebar

Install

npm i @gik/tools-streamer

Homepage

gik.mx

Weekly Downloads

1

Version

0.0.11

License

MIT

Last publish

Collaborators

  • etor