Skip to content

Instantly share code, notes, and snippets.

@scripting
Last active April 12, 2020 15:15
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 scripting/aa50ae77b8929bcad55c8b7125a6f3ba to your computer and use it in GitHub Desktop.
Save scripting/aa50ae77b8929bcad55c8b7125a6f3ba to your computer and use it in GitHub Desktop.
Psuedocode for how I'd like zip archivng to work. It gives me full JS to decide if a file belongs or doesn't.
const zip = require ("davezip");
const fs = require ("fs");
const theArchiveFile = zip.createArchive ('outlines.zip");
fs.fileloop ("/users/bullmancuso/publicfiles/", function (err, f) { //I made up fs.fileloop, it would be nice ;-)
if (f.hasExtension (".opml")) {
zip.addToArchive (f, theArchiveFile);
}
});
zip.closeArchive (theArchiveFile);
@scripting
Copy link
Author

scripting commented Apr 12, 2020

This thread on Stack Exchange seems to offer quite a few options.

https://stackoverflow.com/questions/15641243/need-to-zip-an-entire-directory-using-node-js

I wonder if they all build on the same codebase.

But I don't really like any of the options.

I guess you can't do it the way I outlined it above, because I don't take care of synchronization. Fuck JavaScript for making even stupid simple stuff like this a "problem."

Compounded by the four different ways to do synchronization in the new syntax. So everyone has a favorite and I skip over example code that uses stuff I haven't programmed my brain for yet. All the advantages of having a single syntax for example code. All the new syntaxes are provably just reshufflings of the others.

@scripting
Copy link
Author

I've gotten the sample code for the archiver package to work locally. So I'm on the road.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment