zip: package and compress (archive) files (Info-ZIP 3.0)
zip [-r] [-j] [-q] [-d] ZIPFILE FILE...
Options you will use
-r- recurse into directories (zip -r function.zip . packs the current directory)
-j- junk the paths: store just the file names
-q- quiet
-d- delete the named entries from the archive
Examples
$ zip function.zip index.mjsone file
$ cd src && zip -r ../function.zip . && cd ..a whole folder, contents at the root
$ unzip -l function.zipcheck the layout
Gotchas
- A Lambda deployment package: the handler file must be at the ROOT of the zip (zip function.zip index.mjs, or cd into the folder and zip -r ../function.zip .) - zipping the folder itself puts it one level down and Lambda answers Runtime.ImportModuleError.
- Installed with sudo apt install zip; unzip -l function.zip lists what is inside.
Taught in
Try zip in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.