Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

shapefile

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shapefile - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

test/empty.dbf

4

dbf.js

@@ -28,3 +28,3 @@ var file = require("./file");

fieldDescriptors.push({
name: fieldName(fields.toString("ascii", n, n + 11)),
name: fieldName(fields.toString("utf-8", n, n + 11)),
type: fields.toString("ascii", n + 11, n + 12),

@@ -47,3 +47,3 @@ length: fields.readUInt8(n + 16)

stream.emit("record", fieldDescriptors.map(function(field) {
return fieldTypes[field.type](record.toString("ascii", i, i += field.length));
return fieldTypes[field.type](record.toString("utf-8", i, i += field.length));
}));

@@ -50,0 +50,0 @@ read(recordBytes, readRecord);

{
"name": "shapefile",
"version": "0.0.3",
"version": "0.0.4",
"description": "An implementation of the shapefile (.shp) spatial data format.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -26,2 +26,64 @@ var vows = require("vows"),

"The header of an empty dBASE file": {
topic: function() {
var callback = this.callback;
dbf.readStream("./test/empty.dbf")
.on("error", callback)
.on("header", function(header) { callback(null, header); });
},
"has the expected values": function(header) {
assert.deepEqual(header, {
count: 0,
date: new Date(Date.UTC(1995, 6, 26, 7)),
version: 3,
fields: []
});
}
},
"The header of a dBASE file with unicode property names": {
topic: function() {
var callback = this.callback;
dbf.readStream("./test/unicode-property.dbf")
.on("error", callback)
.on("header", function(header) { callback(null, header); });
},
"has the expected values": function(header) {
assert.deepEqual(header, {
count: 1,
date: new Date(Date.UTC(1995, 6, 26, 7)),
version: 3,
fields: [{name: "☃", type: "C", length: 80}]
});
}
},
"The records of a dBASE file with unicode property names": {
topic: function() {
var callback = this.callback, records = [];
dbf.readStream("./test/unicode-property.dbf")
.on("error", callback)
.on("record", function(record) { records.push(record); })
.on("end", function() { callback(null, records); });
},
"have the expected values": function(records) {
assert.deepEqual(records, [
["ηελλο ςορλδ"]
]);
}
},
"The records of an empty dBASE file": {
topic: function() {
var callback = this.callback, records = [];
dbf.readStream("./test/empty.dbf")
.on("error", callback)
.on("record", function(record) { records.push(record); })
.on("end", function() { callback(null, records); });
},
"have the expected values": function(records) {
assert.deepEqual(records, []);
}
},
"The records of a simple dBASE file": {

@@ -28,0 +90,0 @@ topic: function() {

@@ -26,2 +26,32 @@ var vows = require("vows"),

"The header of an empty shapefile": {
topic: function() {
var callback = this.callback;
shp.readStream("./test/empty.shp")
.on("error", callback)
.on("header", function(header) { callback(null, header); });
},
"has the expected values": function(header) {
assert.deepEqual(header, {
fileCode: 9994,
version: 1000,
shapeType: 3,
box: [0, 0, 0, 0]
});
}
},
"The records of an empty shapefile": {
topic: function() {
var callback = this.callback, records = [];
shp.readStream("./test/empty.shp")
.on("error", callback)
.on("record", function(record) { records.push(record); })
.on("end", function() { callback(null, records); });
},
"have the expected values": function(records) {
assert.deepEqual(records, []);
}
},
"The records of a shapefile of points": {

@@ -28,0 +58,0 @@ topic: function() {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc