{"id":16703227,"url":"https://github.com/matehat/snappy-objc","last_synced_at":"2025-04-10T04:58:05.831Z","repository":{"id":62455733,"uuid":"12931744","full_name":"matehat/Snappy-ObjC","owner":"matehat","description":"Google's Snappy compression power as NSData/NSString categories","archived":false,"fork":false,"pushed_at":"2014-01-05T16:49:20.000Z","size":208,"stargazers_count":15,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T01:50:14.463Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-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/matehat.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}},"created_at":"2013-09-18T18:53:28.000Z","updated_at":"2023-01-31T07:07:41.000Z","dependencies_parsed_at":"2022-11-01T22:32:49.017Z","dependency_job_id":null,"html_url":"https://github.com/matehat/Snappy-ObjC","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matehat%2FSnappy-ObjC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matehat%2FSnappy-ObjC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matehat%2FSnappy-ObjC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matehat%2FSnappy-ObjC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matehat","download_url":"https://codeload.github.com/matehat/Snappy-ObjC/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161264,"owners_count":21057554,"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":[],"created_at":"2024-10-12T19:07:30.695Z","updated_at":"2025-04-10T04:58:05.809Z","avatar_url":"https://github.com/matehat.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Snappy-ObjC\n\nGoogle's Snappy compression power as NSData/NSString categories. All you need to know to use it:\n\n```objective-c\n#import \"Snappy-ObjC.h\"\nNSData *someCompressedData = [NSData dataWithContentsOfURL:somewhereOnDiskWhereThereIsCompressedData];\nNSData *uncompressedData = [someCompressedData snappy_decompressedData];\nNSData *backToCompressedData = [uncompressedData snappy_compressedData];\nNSAssert([backToCompressedData isEqualToData:someCompressedData], @\"IT SHOULD HAVE BEEN EQUAL!\");\n\n// It works with NSString (UTF8 only) too!\nNSString *imGoingToGetShrinked = @\"Hello, World!\";\nNSData *shrinked = [imGoingToGetShrinked snappy_compressedString];\nNSString *imBackAsAWhole = [shrinked snappy_decompressedString];\nNSAssert([imGoingToGetShrinked isEqualToString:imBackAsAWhole], @\"IT SHOULD HAVE BEEN EQUAL!\");\n```\n\nIt uses [snappy-c][2], a C port of [Google's Snappy][1] compression library (originally written in C++). It performs\npretty well, by trading off some compression ratio. In their own words:\n\n\u003e Snappy is a compression/decompression library. It does not aim for maximum compression, or compatibility with any \nother compression library; instead, it aims for very high speeds and reasonable compression. For instance, compared \nto the fastest mode of zlib, Snappy is an order of magnitude faster for most inputs, but the resulting compressed files \nare anywhere from 20% to 100% bigger. On a single core of a Core i7 processor in 64-bit mode, Snappy compresses at \nabout 250 MB/sec or more and decompresses at about 500 MB/sec or more.\n\n### Installation\n\nUsing [CocoaPods][3] (which you should be using), only add a line saying `pod 'Snappy'` and compress away.\n\n### Method prefix\n\nIf you want to do without the `snappy_*` prefix in front of all method names, simply add a preprocessor macro named `SNAPPY_NO_PREFIX`. \n\nIf you are using cocoapods, that means going to the `Pods-Snappy` target in your \"Pods\" Xcode project, to its build settings, finding the \"Preprocessor Macros\" setting and adding the above macro. Note that you'll have to do this after every run of cocoapod (everytime you type `pod [something]` in your project's folder), since cocoapod overrides that setting when it runs. There is going to be a fix for this [sometime in the future](https://github.com/CocoaPods/CocoaPods/issues/833). Meanwhile, you can add this code to your project's Podfile:\n\n```ruby\npost_install do |rep|\n  rep.project.targets.each do |target|\n    target.build_configurations.each do |config|\n      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= '$(inherited)'\n      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] \u003c\u003c= \" SNAPPY_NO_PREFIX=1\"\n    end\n  end\nend\n```\n\n### Testing\n\nThe project includes a (simple) [test suite](Tests/Snappy-ObjC Tests/Snappy_ObjC_Tests.m).\n\n1. Clone the repo\n2. Go in Tests/\n3. `pod install`\n4. Open Snappy-ObjC.xcworkspace and run the tests\n\n### License\n\nThe MIT License (MIT)\n\nCopyright (c) 2013 Mathieu D'Amours\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n[1]: http://code.google.com/p/snappy/\n[2]: https://github.com/andikleen/snappy-c\n[3]: http://cocoapods.org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatehat%2Fsnappy-objc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatehat%2Fsnappy-objc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatehat%2Fsnappy-objc/lists"}