Simple library that parses file listing input for different platforms. An
example file listing is the output of the
ls command in unix, or the
command in DOS/Windows platforms.
var Parser = ;// Yeah yeah, multiline strings would make Crockford mad, I know.var str = "drwxr-xr-x 5 1001 1001 4096 Jan 09 11:52 .\r\n\drwxr-xr-x 4 0 0 4096 Sep 19 13:50 ..\r\n\-rw------- 1 1001 1001 1118 Jan 09 12:09 .bash_history\r\n\-rw------- 1 1001 1001 943 Jan 09 11:52 .viminfo\r\n\drwxrwxr-x 5 1001 1001 4096 Jan 09 11:52 inaccessible\r\n\drwxrwxrwx 2 1001 1001 4096 Sep 21 11:20 project1\r\n\drwx------ 2 1001 1001 4096 Oct 19 16:17 project2\r\n";Parser;
type: 1size: 4096name: "project2"time: 1382192220000owner: "1001"group: "1001"userPermissions:read: truewrite: trueexec: truegroupPermissions:read: falsewrite: falseexec: falseotherPermissions:read: falsewrite: falseexec: false
Parses a single string such as:
drwxrwxrwx 2 1001 1001 4096 Sep 21 11:20 project
npm install parse-listing
git clone https://github.com/sergi/parse-listing.git
The MIT License
Copyright(c) 2013 Sergi Mansilla <sergi.mansilla AT gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.