Ascii Tree
convert indented line block to an ascii directory tree.中文
sync
convert one tree.
var tree = BytesLine; assert; // or use builder helper. var tree = ; assert; tree; tree; tree;
convert mutilple blocks in a file. block is surround by startTag and endTag, which can be a string or a regex. prepend will be the first line of block result, append will be last line or result.
{% asciitree %}
app
-main.js
-helper.js
-others
--Brocfile.js
package.json
{% endasciitree %}
var convertor = string /^{%\s+asciitree\s+%}$/ "{% endasciitree %}" '<pre>' '</pre>'; //or use builder helper. var convertorBuilder = ; var convertor = convertorBuilder; convertor; convertor; convertor;
results:
<pre>
├── app
| ├── main.js
| ├── helper.js
| └── others
| └── Brocfile.js
└── package.json
</pre>
in:
app
-main.js
-helper.js
-others
--Brocfile.js
package.json
out:
├── app
| ├── main.js
| ├── helper.js
| └── others
| └── Brocfile.js
└── package.json
stream
var src = fs; var dst = fs; src //to BytesLine //produce one line or block of lines. // bypass oneline, process block of lines. // flatten block lines to Buffer. ; //or define a function { return src //to BytesLine //produce one line or block of lines. // bypass oneline, process block of lines. ; // flatten block lines to Buffer. } ;