{"id":25940703,"url":"https://github.com/2003scape/rsc-archiver","last_synced_at":"2025-03-04T05:18:35.790Z","repository":{"id":57093504,"uuid":"222131373","full_name":"2003scape/rsc-archiver","owner":"2003scape","description":"📦 compress and decompress runescape classic cache archives","archived":false,"fork":false,"pushed_at":"2022-11-14T18:08:20.000Z","size":33,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-23T14:07:18.234Z","etag":null,"topics":["archiver","buffer","bzip2","cache","hash","jag","jagex","rsc","runescape","runescape-client"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/2003scape.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-16T16:59:24.000Z","updated_at":"2023-04-27T02:25:16.000Z","dependencies_parsed_at":"2023-01-23T02:45:57.962Z","dependency_job_id":null,"html_url":"https://github.com/2003scape/rsc-archiver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2003scape%2Frsc-archiver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2003scape%2Frsc-archiver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2003scape%2Frsc-archiver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2003scape%2Frsc-archiver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2003scape","download_url":"https://codeload.github.com/2003scape/rsc-archiver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241787644,"owners_count":20020130,"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":["archiver","buffer","bzip2","cache","hash","jag","jagex","rsc","runescape","runescape-client"],"created_at":"2025-03-04T05:18:35.038Z","updated_at":"2025-03-04T05:18:35.779Z","avatar_url":"https://github.com/2003scape.png","language":"JavaScript","readme":"# rsc-archiver\ncompress and decompress runescape classic .jag/.mem cache files. these files\ncontain a proprietary header describing the size of the archive, and of\neach individual entry (file). filenames are stored with a hash so it's\nimpossible to recover the originals without bruteforcing (unless they're under\n~5 characters).\n\nthis module works in the browser and node.\n\n## install\n\n    $ npm install @2003scape/rsc-archiver # -g for CLI program\n\n## cli usage\n```\nrsc-archiver \u003ccommand\u003e\n\nCommands:\n  rsc-archiver x \u003carchive\u003e \u003cfiles..\u003e  extract a file from an archive\n                                                              [aliases: extract]\n  rsc-archiver a \u003carchive\u003e \u003cfiles..\u003e  add files to an archive     [aliases: add]\n  rsc-archiver d \u003carchive\u003e \u003cfiles..\u003e  remove files from an archive\n                                                               [aliases: delete]\n  rsc-archiver l \u003carchive\u003e            list hashes and file sizes in an archive\n                                                                 [aliases: list]\n  rsc-archiver h \u003cname\u003e               return the integer hash of a filename stri\n                                      ng                         [aliases: hash]\n\nOptions:\n  --help     Show help                                                 [boolean]\n  --version  Show version number                                       [boolean]\n\nExamples:\n  rsc-archiver l ./cache/config85.jag       list the hashes in config85.jag\n  rsc-archiver a ./cache/jagex.jag logo.tg  add logo.tga to jagex.jag\n  a\n```\n\n## example\n```javascript\nimport fs from 'fs/promises';\nimport { JagArchive } from './src/index.js';\n\nconst archive = new JagArchive();\nawait archive.init();\narchive.readArchive(await fs.readFile('./cache/sounds1.mem'));\n\nconsole.log(`cache has ${archive.entries.size} files`);\n\n// get death.pcm from the archive and write it to disk\nawait fs.writeFile('death.pcm', archive.getEntry('death.pcm'));\n\n// create a new archive and add a text file to it\narchive.entries.clear();\narchive.putEntry('test.txt', Buffer.from('test string'));\nawait fs.writeFile('./cache/test.jag', archive.toArchive(true));\n\n// read the new archive and retrive the file from it\narchive.readArchive(await fs.readFile('./cache/test.jag'))\n\nconsole.log(`cache has ${archive.entries.size} files`);\nconsole.log(Buffer.from(archive.getEntry('test.txt')).toString());\n```\n\n## api\n### hashFilename(filename)\nconvert `filename` to integer hash used in archives.\n\n### archive = new JagArchive()\ncreate a new jag (de)compressor instance.\n\n### archive.entries\nMap of hashes -\u003e decompressed file buffers.\n\n### async archive.init()\ninitialize the bzip wasm.\n\n### archive.readArchive(buffer)\ndecompress buffer and populate entries with each file within.\n\n### archive.hasEntry(name)\ncheck if archive contains entry based on hash or filename.\n\n### archive.getEntry(name)\nreturn entry based on name or hash.\n\n### archive.putEntry(name, buffer)\nadd a file to the archive buffer.\n\n### archive.removeEntry(name)\nremove entry based on name or hash.\n\n### archive.toArchive(individualCompress=true)\ncompress entries to a jagex archive. if `individualCompress` is true, bzip each\nfile separately. otherwise, concatinate all of the files and then bzip\nthat result instead.\n\n## license\nCopyright 2022  2003Scape Team\n\nThis program is free software: you can redistribute it and/or modify it under\nthe terms of the GNU Affero General Public License as published by the\nFree Software Foundation, either version 3 of the License, or (at your option)\nany later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A\nPARTICULAR PURPOSE. See the GNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License along\nwith this program. If not, see http://www.gnu.org/licenses/.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2003scape%2Frsc-archiver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2003scape%2Frsc-archiver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2003scape%2Frsc-archiver/lists"}