0

im trying to unzip a File with NodeJS and Express. I tried ADM-Zip.

I typed:

npm install adm-zip

and got:

npm WARN package.json express-namespace@0.1.1 No repository field.

Everything else went fine.

My Code is:

var AdmZip = require('adm-zip');
var zip = new AdmZip("/scenario/file/05ae5db61e83b7611570f2a313f778dd1c8-7c32.zip");
zip.extractAllTo("scenario/file/", true);

The zip-File is in my public Folder (Express). All I got is an console output with the text "undefined".

I'm a node newbie and have no idea what I should try.

It would be nice if someone could help me

DaTebe
  • 702
  • 1
  • 9
  • 30

1 Answers1

2

try

var zip = new AdmZip("./scenario/file/05ae5db61e83b7611570f2a313f778dd1c8-7c32.zip");
user1801279
  • 1,743
  • 5
  • 24
  • 40
  • After a few days I looked again on my code and got my mistake. I just had to write "./public/szenario/...". This worked for me. But you were right with the "./" – DaTebe May 03 '14 at 16:53
  • Is there a way to add the file path without passing it in the constructor ? – joseph Nov 02 '21 at 19:09