Reading and parsing unstructured files with JavaScript