{"id":20696370,"url":"https://github.com/pascalvault/lazarus_7zip","last_synced_at":"2026-03-07T09:32:51.175Z","repository":{"id":174954304,"uuid":"565145801","full_name":"PascalVault/Lazarus_7zip","owner":"PascalVault","description":"7-zip wrapper for Lazarus","archived":false,"fork":false,"pushed_at":"2023-06-13T11:24:35.000Z","size":703,"stargazers_count":15,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-11T02:47:17.932Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Pascal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PascalVault.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-12T13:37:50.000Z","updated_at":"2024-12-24T06:10:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"221e1709-a645-4780-a0dc-663e2a86ea2f","html_url":"https://github.com/PascalVault/Lazarus_7zip","commit_stats":null,"previous_names":["pascalvault/lazarus_7zip"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PascalVault/Lazarus_7zip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PascalVault%2FLazarus_7zip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PascalVault%2FLazarus_7zip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PascalVault%2FLazarus_7zip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PascalVault%2FLazarus_7zip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PascalVault","download_url":"https://codeload.github.com/PascalVault/Lazarus_7zip/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PascalVault%2FLazarus_7zip/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30210846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T09:02:10.694Z","status":"ssl_error","status_checked_at":"2026-03-07T09:02:08.429Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T00:13:44.749Z","updated_at":"2026-03-07T09:32:51.157Z","avatar_url":"https://github.com/PascalVault.png","language":"Pascal","readme":"# Lazarus 7zip\n\nCreate archives, extract files from archive, list files inside archives - using 7-zip DLL version 21.07.\n\nLibrary by Henri Gourvest updated to newer 7-zip.\n\nVersion 1.3\n\n## About\n\nThis API use the 7-zip dll (7z.dll) to read and write all 7-zip supported archive formats.  According to the documentation, file formats listed below are supported, although many may only support decompression/extraction and not creation/compression.\n - zip\n - bz2\n - rar\n - arj\n - z\n - lzh\n - 7z\n - cab\n - nsis\n - lzma\n - lzma86\n - xz\n - ppmd\n - squashFS\n - cramFS\n - apm\n - mslz\n - flv\n - swf\n - swfc\n - ntfs\n - fat\n - mbr\n - vhd\n - pe\n - elf\n - macho\n - udf\n - xar\n - mub\n - hfs\n - dmg\n - compound doc\n - wim\n - iso\n - bkf\n - chm\n - split\n - rpm\n - deb\n - cpio\n - tar\n - gzip\n\n## Detecting format\n```pascal\nvar i: Integer;\n    Guid: TGuid;\n    Filename: String;\nbegin\n  if not OpenDialog1.Execute then Exit;\n\n  Filename := OpenDialog1.Filename;\n\n  Guid := DetectFormat(Filename);\n  if IsEqualGUID(Guid, CLSID_CFormat_Unsupported) then begin\n    ShowMessage('Unsupported');\n    Exit;\n  end;\n\n  with CreateInArchive(Guid) do begin\n   OpenFile(Filename);\n   for i := 0 to NumberOfItems - 1 do\n    if not ItemIsFolder[i] then\n      Memo1.Lines.Add(\n        ItemPath[i] + ' == ' + GetItemCRC(i) +\n        ItemComment[i] +IntToStr(GetItemPackSize(i)) + ' ' +\n        FormatDateTime('YYYY-MM-DD', GetItemModDate(i))\n        );\n  end;\n  ```\n  \n## Reading archive:\n### Extract to path:\n\n```pascal\n with CreateInArchive(CLSID_CFormatZip) do\n begin\n   OpenFile('c:\\test.zip');\n   ExtractTo('c:\\test');\n end;\n```\n### Get file list:\n```Pascal\n with CreateInArchive(CLSID_CFormat7z) do\n begin\n   OpenFile('c:\\test.7z');\n   for i := 0 to NumberOfItems - 1 do\n    if not ItemIsFolder[i] then\n      Writeln(ItemPath[i]);\n end;\n```\n### Extract to stream\n```Pascal\n with CreateInArchive(CLSID_CFormat7z) do\n begin\n   OpenFile('c:\\test.7z');\n   for i := 0 to NumberOfItems - 1 do\n     if not ItemIsFolder[i] then\n       ExtractItem(i, stream, false);\n end;\n```\n### Extract \"n\" Items\n```Pascal\nfunction GetStreamCallBack(sender: Pointer; index: Cardinal;\n  var outStream: ISequentialOutStream): HRESULT; stdcall;\nbegin\n  case index of ...\n    outStream := T7zStream.Create(aStream, soReference);\n  Result := S_OK;\nend;\n\nprocedure TMainForm.ExtractClick(Sender: TObject);\nvar\n  i: integer;\n  items: array[0..2] of Cardinal;\nbegin\n  with CreateInArchive(CLSID_CFormat7z) do\n  begin\n    OpenFile('c:\\test.7z');\n    // items must be sorted by index!\n    items[0] := 0;\n    items[1] := 1;\n    items[2] := 2;\n    ExtractItems(@items, Length(items), false, nil, GetStreamCallBack);\n  end;\nend;\n```\n### Open stream\n```Pascal\n with CreateInArchive(CLSID_CFormatZip) do\n begin\n   OpenStream(T7zStream.Create(TFileStream.Create('c:\\test.zip', fmOpenRead), soOwned));\n   OpenStream(aStream, soReference);\n   ...\n end;\n```\n### Progress bar\n```Pascal\n function ProgressCallback(sender: Pointer; total: boolean; value: int64): HRESULT; stdcall;\n begin\n   if total then\n     Mainform.ProgressBar.Max := value else\n     Mainform.ProgressBar.Position := value;\n   Result := S_OK;\n end;\n\n procedure TMainForm.ExtractClick(Sender: TObject);\n begin\n   with CreateInArchive(CLSID_CFormatZip) do\n   begin\n     OpenFile('c:\\test.zip');\n     SetProgressCallback(nil, ProgressCallback);\n     ...\n   end;\n end;\n```\n### Password\n```Pascal\n function PasswordCallback(sender: Pointer; var password: WideString): HRESULT; stdcall;\n begin\n   // call a dialog box ...\n   password := 'password';\n   Result := S_OK;\n end;\n\n procedure TMainForm.ExtractClick(Sender: TObject);\n begin\n   with CreateInArchive(CLSID_CFormatZip) do\n   begin\n     // using callback\n     SetPasswordCallback(nil, PasswordCallback);\n     // or setting password directly\n     SetPassword('password');\n     OpenFile('c:\\test.zip');\n     ...\n   end;\n end;\n```\n### Writing archive\n```Pascal\n procedure TMainForm.ExtractAllClick(Sender: TObject);\n var\n   Arch: I7zOutArchive;\n begin\n   Arch := CreateOutArchive(CLSID_CFormat7z);\n   // add a file\n   Arch.AddFile('c:\\test.bin', 'folder\\test.bin');\n   // add files using willcards and recursive search\n   Arch.AddFiles('c:\\test', 'folder', '*.pas;*.dfm', true);\n   // add a stream\n   Arch.AddStream(aStream, soReference, faArchive, CurrentFileTime, CurrentFileTime, 'folder\\test.bin', false, false);\n   // compression level\n   SetCompressionLevel(Arch, 5);\n   // compression method if \u003c\u003e LZMA\n   SevenZipSetCompressionMethod(Arch, m7BZip2);\n   // add a progress bar ...\n   Arch.SetProgressCallback(...);\n   // set a password if necessary\n   Arch.SetPassword('password');\n   // Save to file\n   Arch.SaveToFile('c:\\test.zip');\n   // or a stream\n   Arch.SaveToStream(aStream);\n end;\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpascalvault%2Flazarus_7zip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpascalvault%2Flazarus_7zip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpascalvault%2Flazarus_7zip/lists"}