{"id":19536067,"url":"https://github.com/miyako/4d-plugin-archive","last_synced_at":"2025-10-06T10:21:44.147Z","repository":{"id":147172304,"uuid":"362703758","full_name":"miyako/4d-plugin-archive","owner":"miyako","description":"Utility based on libarchive","archived":false,"fork":false,"pushed_at":"2021-10-07T04:33:01.000Z","size":81170,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-04T08:43:40.526Z","etag":null,"topics":["4d-plugin"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miyako.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-04-29T05:45:52.000Z","updated_at":"2024-08-27T04:46:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"51cc88eb-4e65-452d-a2ec-6bf681890ebc","html_url":"https://github.com/miyako/4d-plugin-archive","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/miyako/4d-plugin-archive","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyako%2F4d-plugin-archive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyako%2F4d-plugin-archive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyako%2F4d-plugin-archive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyako%2F4d-plugin-archive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miyako","download_url":"https://codeload.github.com/miyako/4d-plugin-archive/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miyako%2F4d-plugin-archive/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278592817,"owners_count":26012382,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["4d-plugin"],"created_at":"2024-11-11T02:20:54.378Z","updated_at":"2025-10-06T10:21:44.128Z","avatar_url":"https://github.com/miyako.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"![version](https://img.shields.io/badge/version-17%2B-3E8B93)\n![platform](https://img.shields.io/static/v1?label=platform\u0026message=mac-intel%20|%20mac-arm%20|%20win-64\u0026color=blue)\n[![license](https://img.shields.io/github/license/miyako/4d-plugin-archive)](LICENSE)\n![downloads](https://img.shields.io/github/downloads/miyako/4d-plugin-archive/total)\n\n**Note**: for v17 and earlier, move `manifest.json` to `Contents`\n\n# 4d-plugin-archive\nUtility based on libarchive\n\n#### About this project\n\n4D `zip` commands are based on [nih-at/libzip](https://github.com/nih-at/libzip).\n\n`.4darchive` is a proprietary format that works with a `cache.xml` file, but will soon be replaced by `.zip`.\n\nFor standard archives, the native `zip` commands are sufficient; **there is no need for a plugin**.\n\nThe purpose of this project is to support `.7z` and other archive formats to store away large but highly compressable files such as `.4BK`.\n\nThe operation is typically performed on the server, require significant computation power and may take a while to complete.\n\nNevertheless its **impact on server performance** should be minimal.\n\n#### Design principle\n\nIn order not to slow down the server during compression, and in order to be performant even if the application is running in interpretative mode, the plugin should perform compression in a **background thread**.\n\nInstead of a callback method, the plugin should run asynchronously; the command should return a reference immediately, which can be used in 4D to query status at any time.\n\nThe total size is calculated first in the calling process. After that, the archive will be delegated to a new thread. \n\nThe preprocessing should be relatively fast for `archive write`. The command will add up the actual file size as well as the extended attributes on Mac. Creating a 7-zip format will take more time, since .7z requires intense usage of the CPU.\n\nBy contrast, the preprocessing could be relatively slow for `archive read`. The command will add up the `archive_entry_size` of each item in the archive. Expanding a 7-zip format should be quite fast.\n\nThe total size for read vs write may not match exactly, as they are each calculated using different metrics. The purpose of these values is to measure progress.\n\n#### Technology\n\n[libarchive](https://www.libarchive.org)\n\n* Definition of hidden item on Mac:\n \n  * `NSURL` `-getResourceValue:forKey:NSURLIsHiddenKeyerror:`\n  * `path.at(0) == '.'`\n  * `path.find(\"/.\") != std::string::npos`\n\n* Options for general purpose:\n \n  * noDotDot (default=false) \n  * noAbsolutePaths (default=false)\n  * noAutoDir (default=false) \n  * atomic (default=false)\n  * noHFSCompression (default=false)\n  * forceHFSCompression (default=false)\n  * clearNoChangeFlags (default=false)\n  * unlink (default=false)\n  * sparse (default=false)\n  * metadata (default=true)\n  * owner (default=true)\n  * time (default=true)\n  * perm (default=true)\n  * ACL (default=true)\n  * fflags (default=true)\n  * xattr (default=true)\n  * noOverWrite (default=true)\n  * noOverWriteNewer (default=true)\n  * secureSymlinks (default=true)\n\n* Options for archive:\n \n  * skipHidden (default=false) \n  * keepParent (default=false) \n  * format (default=.7z) \n\n* Options for .zip archive:\n \n  * compression (store or deflate)\n  \n* Options for zip unarchive:\n\n  * passphrase\n   \n* Supported formats: \n\n  * .7z\n  * .zip = .jar\n  * .cpio\n  * .iso\n  * .a = .ar\n  * .tar\n  * .tgz = .tar.gz\n  * .tar.bz2\n  * .tar.xz\n\n#### Compress\n\n```4d\n$file:=Folder(fk desktop folder).file(\"test.7z\")\n$folder:=Folder(fk desktop folder).folder(Generate UUID)\n$folder.create()\n\n$options:=New object\n$options.passphrase:=\"1234d\"  //this option is only applicable for .zip; it does not work for .7z\n\n$status:=archive read ($file.platformPath;$folder.platformPath;$options)\n\nIf ($status.uuid#Null)\n\t\n\t$uuid:=$status.uuid\n\t\n\tRepeat \n\t\t\n\t\t$status:=archive get progress ($uuid)\n\t\t\n\t\t$message:=New collection($status.progress;\"/\";$status.total).join()\n\t\t\n\t\tMESSAGE($message)\n\t\t\n\tUntil ($status.complete)\n\t\n\t$status:=archive abort ($uuid)\n\t\nEnd if \n```\n\n#### Expand\n\n```4d\n$files:=New collection\nIf (Is macOS)\n\t$files.push(\"Macintosh HD:Applications:4D v17.5:4D.app:\")\nEnd if \n\nIf (Is Windows)\n\t$files.push(\"C:\\\\Program Files\\\\4D\\\\4D v18.4\\\\4D\")\nEnd if \n\n$folder:=Folder(fk desktop folder).folder(Generate UUID)\n\n$options:=New object\n$options.keepParent:=True\n$options.skipHidden:=True\n$options.format:=\".7z\"\n\n$status:=archive write ($files;$folder.platformPath;$options)\n\nIf ($status.uuid#Null)\n\t\n\t$uuid:=$status.uuid\n\t\n\tRepeat \n\t\t\n\t\t$status:=archive get progress ($uuid)\n\t\t\n\t\t$message:=New collection($status.progress;\"/\";$status.total).join()\n\t\t\n\t\tMESSAGE($message)\n\t\t\n\t\tDELAY PROCESS(Current process;10)\n\t\t\n\tUntil ($status.complete)\n\t\n\t$status:=archive abort ($uuid)\n\t\nEnd if \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiyako%2F4d-plugin-archive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiyako%2F4d-plugin-archive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiyako%2F4d-plugin-archive/lists"}