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

Function zipFile

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

* Add a new file to a zip file from a buffer. * @param {JSZip} zip the zip object to add the file to. * @param {string} zipPath the target path in the zip. * @param {Promise} bufferPromise a promise providing a nodebuffer. * @return {Promise} a promise providing the JSZip object. * @param {obje

(zip, zipPath, bufferPromise, fileOpts)

Source from the content-addressed store, hash-verified

55 * @param {object} fileOpts an object with the opts to save for the file in the zip.
56 */
57async function zipFile(zip, zipPath, bufferPromise, fileOpts) {
58 const buffer = await bufferPromise
59 zip.file(
60 zipPath,
61 buffer,
62 Object.assign(
63 {},
64 {
65 // necessary to get the same hash when zipping the same content
66 date: new Date(0),
67 },
68 fileOpts,
69 ),
70 )
71 return zip
72}
73
74export { addTree, writeZip, zipFile }

Callers 2

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…