fsj

2.1.0 • Public • Published

fsj

Command line:

fsj(1)

usage: fsj [files] [-lhf] [-d int] [-t exec] [-i regex]
 
    Writes a json blob to stdout, with all the contents of all the files in it.

    If no arguments are specified, reads a whitespace delimited list of files
    from stdin, and builds a bundle from their contents once it receives EOF.

    Options:

    -d, --indent:

       formats the resulting json with the specified number of spaces 

    -h, --help:

        Print this help message, and exit.

    -l, --links:

        follow symbolic links, recursively descending whatever the
        link points to, as well.

    -i, --ignore regex:

        Paths matching this JavaScript regex are excluded

    -t, --file-transform

        The path to an executable process that listens for file data on stdin
        and writes some transform of the above to stdout. For example:

          fsj -t $(grep ack)

        will result in a json blob whose values are only those lines containing
        "ack".

    -f, --flat
        
        Whether the resulting json blob should unify paths and return a nested
        blob, or a flat json blob. For example, with flat specified, the
        resulting blob might be:

            {
                'my-proj/help.txt': 'text',
                'my-proj/chpater1/intro.txt': 'text',
                'my-proj/chpater1/body.txt': 'text',
                'my-proj/chpater1/conclusion.txt': 'text',
                'my-proj/chpater2/body.txt': 'text'
            }

        With flat set to false, it owuld be:

            {
                'my-proj': {
                    'help.txt': 'text'
                    'chpater1': {
                        /intro.txt': 'text',
                        'body.txt': 'text',
                        'conclusion.txt': 'text'
                    },
                    'chpater2': {
                        'body.txt': 'text'
                    }
                }
            }

Node

var fsj = require('fsj')

fsj(stream, options, ready)
  • stream: a readable stream which emits paths to walk
  • options: options keyed and defined by the logform of the command line arguments listed below
  • ready: a callback when its all been walked. Will be called with the json blob defined in the command line section

Dependencies (5)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i fsj

    Weekly Downloads

    0

    Version

    2.1.0

    License

    MIT

    Last publish

    Collaborators

    • andrewwinterman