Skip to content

Instantly share code, notes, and snippets.

@mhkeller
Last active March 6, 2017 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhkeller/33f4bbb9b61a0aec8862c00bd17e7167 to your computer and use it in GitHub Desktop.
Save mhkeller/33f4bbb9b61a0aec8862c00bd17e7167 to your computer and use it in GitHub Desktop.
Promise not resolved if buffer is null
var shapefile = require('shapefile')
function open (fileName) {
shapefile.openDbf(fileName)
.then(source => source.read()
.then(function log(result) {
if (result.done) return;
console.log(result.value);
return source.read().then(log);
}))
.catch(error => console.error('errror!', error.stack));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment