zipfilemap
v1.0.1
Published
Fetches Zipfiles from the Web or a NodeJS buffer and loads them into memory as javascript dictionaries.
Downloads
3
Readme
zipfilemap
Zipfilemap maps a zipfiles from URLs or buffers to JavaScript dictionaries.
Usage Examples
Read the contents of a zipfile into a JavaScript dictionary
const zipfilemap = require('zipfilemap');
const fs = require('fs');
const zipBuffer = fs.readFileSync('/path/to/myfile.zip');
async function myTestFunction() {
zipDict = await zipfilemap.fromBuffer(zipBuffer);
Object.keys(zipDict).forEach((key)=>{
console.log("zipFile contains file " + key + " which has a file with contents " + zipDict[key]);
});
}
Read a zipfile from the web into a JavaScript dictionary
const zipfilemap = require("zipfilemap");
async function myTestFunction() {
options = {
uri: 'http://localhost/test.zip'
}
zipDict = await zipfilemap.fromLink(options);
Object.keys(zipDict).forEach((key)=>{
console.log("zipFile contains file " + key + " which has a file with contents " + zipDict[key]);
});
}