{"id":20128609,"url":"https://github.com/coreoffice/olekit","last_synced_at":"2025-07-20T15:03:16.546Z","repository":{"id":52927064,"uuid":"260284166","full_name":"CoreOffice/OLEKit","owner":"CoreOffice","description":"Swift support for Microsoft OLE2 (also known as Structured Storage or Compound File Binary Format)","archived":false,"fork":false,"pushed_at":"2023-02-15T20:51:35.000Z","size":196,"stargazers_count":25,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-17T01:39:06.467Z","etag":null,"topics":["microsoft-ole2","ole-files","swift"],"latest_commit_sha":null,"homepage":"https://coreoffice.github.io/OLEKit/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CoreOffice.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":"MaxDesiatov","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-04-30T18:14:30.000Z","updated_at":"2025-06-05T04:39:51.000Z","dependencies_parsed_at":"2024-01-16T10:09:30.046Z","dependency_job_id":null,"html_url":"https://github.com/CoreOffice/OLEKit","commit_stats":{"total_commits":82,"total_committers":3,"mean_commits":"27.333333333333332","dds":0.04878048780487809,"last_synced_commit":"398248735e690ac422b728acb79d30bd3d675554"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/CoreOffice/OLEKit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoreOffice%2FOLEKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoreOffice%2FOLEKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoreOffice%2FOLEKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoreOffice%2FOLEKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CoreOffice","download_url":"https://codeload.github.com/CoreOffice/OLEKit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoreOffice%2FOLEKit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266143941,"owners_count":23883069,"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","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":["microsoft-ole2","ole-files","swift"],"created_at":"2024-11-13T20:28:18.948Z","updated_at":"2025-07-20T15:03:16.515Z","avatar_url":"https://github.com/CoreOffice.png","language":"Swift","funding_links":["https://github.com/sponsors/MaxDesiatov"],"categories":[],"sub_categories":[],"readme":"# OLEKit\n\nSwift support for Microsoft OLE2 format, also known as Structured Storage, [Compound File Binary Format](https://en.wikipedia.org/wiki/Compound_File_Binary_Format) or Compound Document File Format.\n\nSome of the file formats that utilize it:\n\n- Encrypted Office Open XML documents (Microsoft Office 2003+, Word `.docx`, Excel `.xlsx`, PowerPoint `.pptx`)\n- Microsoft Office 97-2003 documents ([BIFF5 and later](https://www.gaia-gis.it/gaia-sins/freexl-1.0.5-doxy-doc/html/Format.html) in Word `.doc`, Excel `.xls`, PowerPoint `.ppt`, Visio `.vsd`, Project `.mpp`)\n- `vbaProject.bin` in MS Office 2007+ files\n- Image Composer and FlashPix files\n- Outlook messages\n- StickyNotes\n- Zeiss AxioVision ZVI files\n- Olympus FluoView OIB files\n- McAfee antivirus quarantine files\n- Hancom Word's `.hwp` file format\n\n...and more. If you know of a file format that is based on CFBF, please submit [a pull request](https://github.com/MaxDesiatov/OLEKit/edit/master/README.md) so that it's added to the list.\n\nAutomatically generated documentation is available on [our GitHub Pages](https://coreoffice.github.io/OLEKit/).\n\n[Join our Discord](https://discord.gg/H6799jh) for any questions and friendly banter.\n\n## Example\n\nAn OLE2 file has [a minuature filesystem embedded in\nit](https://en.wikipedia.org/wiki/Compound_File_Binary_Format#Structure) that is\nrepresented as a tree of\n[`DirectoryEntry`](https://github.com/CoreOffice/OLEKit/blob/master/Sources/OLEKit/DirectoryEntry.swift)\nvalues in OLEKit.\n\nTo read a file and an entry within the file:\n\n1. Add `import OLEKit` at the top of a relevant source file.\n2. Use `OLEFile(_ path: String)` to create a new instance with a path to your OLE2 file.\n3. Use the `root` property of type `DirectoryEntry` on `OLEFile` to read the root\n   directory entry, and the `children` property on `DirectoryEntry` to traverse the tree of\n   entries.\n4. Call `stream(_ entry:)` on your `OLEFile` instance to get access to the entry.\n   This returns an instance of `DataReader` that provides helper `read()` functions\n   for reading raw data.\n\n```swift\nimport OLEKit\n\nlet filepath = \"./categories.xlsx\"\nlet entryName = \"EncryptionInfo\"\n\nlet ole = try OLEFile(filepath)\nguard\n  let infoEntry = oleFile.root.children.first(where: { $0.name == entryName })\nelse { fatalError(\"entry \\(entryName) not found in file \\(filepath)\") }\n\nlet stream = try oleFile.stream(infoEntry)\n\n// Read version bytes from the encryption stream in little-endian order\nlet major: UInt16 = stream.read()\nlet minor: UInt16 = stream.read()\n\nguard major == 4 \u0026\u0026 minor == 4\nelse { fatalError(\"unknown version: major \\(major), minor \\(minor)\") }\n\n// change position in the `stream`\nreader.seek(toOffset: 8)\n// get the rest of the data\nlet rawStreamData = reader.readDataToEnd()\n```\n\nYou can refer to [source code of the CryptoOffice\nlibrary](https://github.com/CoreOffice/CryptoOffice/blob/3198d5e5add53fab66289a45f9f1760e360bac36/Sources/CryptoOffice/CryptoOfficeFile.swift#L28)\nfor a more detailed example.\n\n## Requirements\n\n**Apple Platforms**\n\n- Xcode 11.2 or later\n- Swift 5.1 or later\n\n**Linux**\n\n- Swift 5.1 or later\n\n## Installation\n\n### Swift Package Manager\n\n[Swift Package Manager](https://swift.org/package-manager/) is a tool for\nmanaging the distribution of Swift code. It’s integrated with the Swift build\nsystem to automate the process of downloading, compiling, and linking\ndependencies on all platforms.\n\nOnce you have your Swift package set up, adding `OLEKit` as a dependency is as\neasy as adding it to the `dependencies` value of your `Package.swift`.\n\n```swift\ndependencies: [\n  .package(\n    url: \"https://github.com/CoreOffice/OLEKit.git\",\n    .upToNextMinor(from: \"0.2.0\")\n  )\n]\n```\n\nIf you're using OLEKit in an app built with Xcode, you can also add it as a direct\ndependency [using Xcode's\nGUI](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app).\n\n## Contributing\n\n### Coding Style\n\nThis project uses [SwiftFormat](https://github.com/nicklockwood/SwiftFormat)\nand [SwiftLint](https://github.com/realm/SwiftLint) to\nenforce formatting and coding style. We encourage you to run SwiftFormat within\na local clone of the repository in whatever way works best for you either\nmanually or automatically via an [Xcode\nextension](https://github.com/nicklockwood/SwiftFormat#xcode-source-editor-extension),\n[build phase](https://github.com/nicklockwood/SwiftFormat#xcode-build-phase) or\n[git pre-commit\nhook](https://github.com/nicklockwood/SwiftFormat#git-pre-commit-hook) etc.\n\nTo guarantee that these tools run before you commit your changes on macOS, you're encouraged\nto run this once to set up the [pre-commit](https://pre-commit.com/) hook:\n\n```\nbrew bundle # installs SwiftLint, SwiftFormat and pre-commit\npre-commit install # installs pre-commit hook to run checks before you commit\n```\n\nRefer to [the pre-commit documentation page](https://pre-commit.com/) for more details\nand installation instructions for other platforms.\n\nSwiftFormat and SwiftLint also run on CI for every PR and thus a CI build can\nfail with incosistent formatting or style. We require CI builds to pass for all\nPRs before merging.\n\n### Code of Conduct\n\nThis project adheres to the [Contributor Covenant Code of\nConduct](https://github.com/CoreOffice/OLEKit/blob/master/CODE_OF_CONDUCT.md).\nBy participating, you are expected to uphold this code. Please report\nunacceptable behavior to coreoffice@desiatov.com.\n\n## License\n\nOLEKit is licensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this library except in compliance with the License.\nSee the\n[LICENSE](https://github.com/CoreOffice/OLEKit/blob/master/LICENSE.md) file\nfor more info.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\nOLEKit is based on the code from the [olefile](https://github.com/decalage2/olefile)\nlibrary, which uses FreeBSD-style license, check out\n[LICENSE-olefile](https://github.com/CoreOffice/OLEKit/blob/master/LICENSE-olefile)\nfor details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreoffice%2Folekit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoreoffice%2Folekit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreoffice%2Folekit/lists"}