MCPcopy Index your code
hub / github.com/serverless/serverless / writeZip

Function writeZip

packages/serverless/lib/plugins/python/lib/zipTree.js:33–47  ·  view source on GitHub ↗

* Write zip contents to a file. * @param {JSZip} zip the zip object * @param {string} targetPath path to write the zip file to. * @return {Promise} a promise resolving to null.

(zip, targetPath)

Source from the content-addressed store, hash-verified

31 * @return {Promise} a promise resolving to null.
32 */
33function writeZip(zip, targetPath) {
34 const opts = {
35 platform: process.platform == 'win32' ? 'DOS' : 'UNIX',
36 compression: 'DEFLATE',
37 compressionOptions: {
38 level: 9,
39 },
40 }
41 return new Promise((resolve) => {
42 zip
43 .generateNodeStream(opts)
44 .pipe(fse.createWriteStream(targetPath))
45 .on('finish', resolve)
46 }).then(() => null)
47}
48
49/**
50 * Add a new file to a zip file from a buffer.

Callers 4

packRequirementsFunction · 0.90
zipRequirementsFunction · 0.90
injectRequirementsFunction · 0.90
moveModuleUpFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…