mapbox / shapefile-fairy

I put a zipfile under my pillow and the fairy brought me shapefiles
ISC License
16 stars 6 forks source link

shp -> zip #8

Open rclark opened 9 years ago

rclark commented 9 years ago

It would be nice to teach the shapefile-fairy how to put all the shapefile bits together into a zipfile. Unfortunately node-zipfile does not create archives (as far as I can tell). Please correct me if I'm wrong @springmeyer.

springmeyer commented 9 years ago

Correct, it does not create archives. It could, but I've been keen to keep it's scope small. So I think this would be another case where ideally we find a pure js solution and if nothing is robust enough then consider adding to node-zipfile if its important.

Would tarring up the shapefiles (instead of zipping) suffice for what you are thinking about?

rclark commented 9 years ago

I'm getting to this in the context of preprocessing. Our upload processor currently expects shapefiles to come in zipped. The preprocessor step is going to have to open up the zipfile and make new, adjusted shapefiles, then submit the result back to the processor. If it can be resubmitted as a zipfile then the processor doesn't have to change.

But we could change that. All my previous looks for pure JS zipfile modules have come up short, but I can make the rounds again with this use-case in mind.

springmeyer commented 9 years ago

Ah, I see. Yeah, sounds useful/most simple to stick with zip format for this.

If we were to add node-zipfile support I'd approach this the same as the copyFile API in that we'd try to hide as much complexity as possible and work in files rather than in-memory buffers. Maybe something like:

zipfile.Create(directory,filename, function(err) { ... read filename and do something ... })
rclark commented 9 years ago

I should have a look at https://github.com/thejoshwolfe/yazl.