prototxt-parser
Version:
a prototxt parser for js based on parsimmon
64 lines (44 loc) • 1.27 kB
Markdown
[](https://travis-ci.org/chaosmail/prototxt-parser)
Parse `*.prototxt` files to JavaScript objects.
```html
<script src="https://unpkg.com/prototxt-parser"></script>
<script>
function fetchText(uri) {
return fetch(new Request(uri)).then(function(res){
return res.text();
});
}
var uri = "https://rawgit.com/DeepScale/SqueezeNet/master/SqueezeNet_v1.1/deploy.prototxt";
var proto;
fetchText(uri).then(function(str){
proto = prototxtParser.parse(str);
console.log(proto);
});
</script>
```
```typescript
import * as prototxtParser from 'prototxt-parser';
function fetchText(uri: string) : Promise<string> {
return fetch(new Request(uri)).then((res) => res.text());
}
let uri = "https://rawgit.com/DeepScale/SqueezeNet/master/SqueezeNet_v1.1/deploy.prototxt";
let proto: Object;
fetchText(uri).then(function(str){
proto = prototxtParser.parse(str);
console.log(proto);
});
```
```sh
npm install
npm run build
npm run test
```
The software is provided under MIT license.