https://github.com/matehat/jaysoned
Quick 'n Dirty JSON Concatenation/Compression utility
https://github.com/matehat/jaysoned
Last synced: about 1 year ago
JSON representation
Quick 'n Dirty JSON Concatenation/Compression utility
- Host: GitHub
- URL: https://github.com/matehat/jaysoned
- Owner: matehat
- License: mit
- Created: 2013-09-18T13:52:55.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-09-18T19:22:52.000Z (over 12 years ago)
- Last Synced: 2025-01-21T02:41:40.642Z (over 1 year ago)
- Language: JavaScript
- Size: 109 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
jaysoned
========
Quick 'n Dirty JSON Concatenation/Compression utility
I needed a way to take a bunch of JSON files needed by an iOS app, put them together (and preferably compress them) to
coalesce disk seeks into a single efficient one. I added Build Phase that calls this script like this :
/usr/local/bin/node /usr/local/share/npm/bin/jaysoned ${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ ${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/json.snz
rm ${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/*.json
1. Which basically looks for all `.json` files in the unlocalized resource location of the app's product directory, hands them
to `jaysoned` and removes them when done.
2. `jaysoned` parses them and makes one, larger JSON file with keys being the original
files' names, and values being the files' contents as javascript objects.
3. Then, it takes the resulting large js object, stringifies it, compresses it using [Snappy][1], Google's fast compression
library and writes the result to `json.snz`, jaysoned's second argument.
The app, as soon as one of these JSON objects is needed, reads the file, uncompresses it using [Snappy-ObjC][2] and caches
the resulting JSON object for later use.
[1]: https://code.google.com/p/snappy/
[2]: https://github.com/matehat/Snappy-ObjC