Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#71020 [@types/adm-zip] Fix return type of …
Browse files Browse the repository at this point in the history
….addFile as ZipEntry by @LumaKernel
  • Loading branch information
LumaKernel authored Oct 28, 2024
1 parent d1a2c94 commit a4a75a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion types/adm-zip/adm-zip-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ new AdmZip();
new AdmZip(undefined, { method: Constants.DEFLATED });

// add file directly
zip.addFile("test.txt", new Buffer("inner content of the file"), "entry comment goes here");
const addedEntry = zip.addFile("test.txt", new Buffer("inner content of the file"), "entry comment goes here");
console.log("added", addedEntry.name);
processZipEntry(addedEntry);
// add local file
zip.addLocalFile("/home/me/some_picture.png");
// get everything as a buffer
Expand Down
3 changes: 2 additions & 1 deletion types/adm-zip/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ declare class AdmZip {
* for a directory.
* @param comment Comment to add to the entry.
* @param attr Attribute to add to the entry.
* @return The entry corresponding to one which was just added.
*/
addFile(entryName: string, content: Buffer, comment?: string, attr?: number): void;
addFile(entryName: string, content: Buffer, comment?: string, attr?: number): AdmZip.IZipEntry;
/**
* Returns an array of `IZipEntry` objects representing the files and folders
* inside the archive.
Expand Down

0 comments on commit a4a75a3

Please sign in to comment.