{"id":16027387,"url":"https://github.com/theacodes/ninja-lib","last_synced_at":"2026-06-06T17:30:19.114Z","repository":{"id":66132269,"uuid":"64822632","full_name":"theacodes/Ninja-Lib","owner":"theacodes","description":"Git repository for NPM library","archived":false,"fork":false,"pushed_at":"2015-11-04T14:24:09.000Z","size":234,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-03T09:42:46.340Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"bogglez/Ninja-Lib","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theacodes.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-03T06:52:06.000Z","updated_at":"2016-08-03T06:52:07.000Z","dependencies_parsed_at":"2023-02-19T23:15:42.720Z","dependency_job_id":null,"html_url":"https://github.com/theacodes/Ninja-Lib","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/theacodes%2FNinja-Lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theacodes%2FNinja-Lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theacodes%2FNinja-Lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theacodes%2FNinja-Lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theacodes","download_url":"https://codeload.github.com/theacodes/Ninja-Lib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240190849,"owners_count":19762584,"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-08T20:21:10.982Z","updated_at":"2026-06-06T17:30:19.073Z","avatar_url":"https://github.com/theacodes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nNinja-lib is now on npm. You can now convert files easily using Nodejs. This\nlibrary has been made mostly with BlueBurst in mind and have no intention of\nsupporting other versions, but this is an open source library, so if you need\nyou change anything you can always fork the github repository.\n\n**Installation**\n\nInstall ninja-lib with npm\n```\nnpm install ninja-lib\n```\n\nUse it in your code\n```\nvar ninja = require(\"ninja-lib\");\n```\n\n**get_extension(buffer)**\n\nThis function takes a buffer as an agrument, looks at the first four bytes and\nreturns an extension for the file based on the Interchange File Format given by\nthe first four bytes of the file. Returns \".bin\" if file extension is not\nrecognized.\n```\nvar buffer = fs.readFileSync(\"unkown_file.bin\");\nvar ext = ninja.get_extension(buffer);\n//returns \".xvm\", \".nj\", etc\n```\n\n**extract_bml(filename, [dest_folder])**\n\nThis function takes a filename and an destination folder as an optional argument.\nThe provided bml file is parsed and extracted to the destination folder. If no\ndestination folder is provided, the files are written to the same directory as\nthe source filename. This function will throw an error if the source file or\ndestinatation folder provided do not exist.\n\nReturns a list of all of the extracted files from the bml archive.\n```\nvar bml_file = \"booma_bagons.bml\";\nvar arr = ninja.extract_bml(bml_file, \"out/\");\n//returns [\"out/booma.nj\", \"out/booma.pvm\", ...]\n```\n\n**extract_afs(filename, [compressed], [dest_folder])**\n\nThis function takes a filename, compressed boolean and destination folder as\narguments. Compressed is a boolean value stating if the files inside the afs\nfile are compressed with prs. Dest folder follows the same rules as extract_bml,\nif no folder is provided, files are extracted to the same directory as the source\nfolder.\n\nReturns a list of all of the extracted files from the afs archive.\n```\nvar afs_file = \"WeaponList.afs\";\nvar arr = ninja.extract_afs(afs_file, true, \"out/\");\n//returns [\"out/WeaponList_000.xvm\", \"out/WeaponList_001.xvm\" ...]\n```\n\n**extract_gsl(filename, [dest_folder])**\n\nThis function takes a filename and a destination folder as arguments. Dest folder\nfollows the same rules as extract_bml, if no folder is provided, files are\nextracted to the same directory as the source folder.\n\nReturns a list of all of the extracted files from the gsl archive.\n```\nvar gsl_file = \"data.gsl\";\nvar arr = ninja.extract_gsl(gsl_file, \"out/\");\n//returns [\"out/lightentry.bin\", \"out/map_ancient_e.bin\" ...]\n```\n\n**decompress_prs(buffer)**\n\nThis function takes a buffer as an argument and returns a decompressed buffer\nas a result.\n```\nvar prs_buffer = fs.readFileSync(\"some_file.prs\");\nvar decomp_buffer = ninja.decompress_prs(prs_buffer);\nvar ext = ninja.get_extension(decomp_buffer);\nfs.writeFileSync(\"some_file\" + ext, decomp_buffer);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheacodes%2Fninja-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheacodes%2Fninja-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheacodes%2Fninja-lib/lists"}