Skip to content

Commit dce998a

Browse files
author
Anand Thakker
committed
Add CLI
1 parent aab23ca commit dce998a

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ gdalinfo.remote('http://example.com/somefile.TIF', function(err, metadata) {
3636

3737
```
3838

39+
#### From Command Line
40+
41+
```bash
42+
npm install -g gdalinfo-json
43+
gdalinfo-json somefile.TIF
44+
```
45+
3946
### Example output
4047

4148
```json

cli.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env node
2+
'use strict';
3+
4+
var gdalinfo = require('./');
5+
6+
if (process.argv.length < 3) {
7+
console.log('Usage: ', process.argv[0], process.argv[1], ' FILENAME|URL');
8+
process.exit();
9+
}
10+
11+
gdalinfo.local(process.argv[2], function(err, metadata) {
12+
if (err) {
13+
console.error(err);
14+
process.exit(1);
15+
}
16+
console.log(JSON.stringify(metadata));
17+
process.exit();
18+
});

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.4.1",
44
"description": "gdalinfo output in json",
55
"main": "index.js",
6+
"bin": "cli.js",
67
"scripts": {
78
"test": "./node_modules/mocha/bin/mocha"
89
},

0 commit comments

Comments
 (0)