{"id":16472626,"url":"https://github.com/screeny05/corrode","last_synced_at":"2025-03-16T18:31:31.182Z","repository":{"id":57209546,"uuid":"62573659","full_name":"screeny05/corrode","owner":"screeny05","description":"A batteries-included library for reading binary data.","archived":false,"fork":false,"pushed_at":"2018-09-10T08:28:46.000Z","size":575,"stargazers_count":114,"open_issues_count":16,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-08T02:08:42.295Z","etag":null,"topics":["binary","buffer","parsing","stream"],"latest_commit_sha":null,"homepage":"https://corrode.scn.cx/","language":"JavaScript","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/screeny05.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2016-07-04T15:58:27.000Z","updated_at":"2024-05-31T15:04:08.000Z","dependencies_parsed_at":"2022-09-01T07:51:06.167Z","dependency_job_id":null,"html_url":"https://github.com/screeny05/corrode","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screeny05%2Fcorrode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screeny05%2Fcorrode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screeny05%2Fcorrode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screeny05%2Fcorrode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/screeny05","download_url":"https://codeload.github.com/screeny05/corrode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826788,"owners_count":20354220,"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":["binary","buffer","parsing","stream"],"created_at":"2024-10-11T12:17:47.810Z","updated_at":"2025-03-16T18:31:30.356Z","avatar_url":"https://github.com/screeny05.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://cdn.rawgit.com/screeny05/corrode/master/corrode.svg?raw=true\" alt=\"∆ corrode\" width=\"330\"/\u003e\n\u003c/p\u003e\n\n[![MIT license](https://img.shields.io/npm/l/corrode.svg?style=flat-square)](./LICENSE)\n[![NPM version](https://img.shields.io/npm/v/corrode.svg?style=flat-square)](https://www.npmjs.com/package/corrode)\n[![dependencies](https://img.shields.io/david/screeny05/corrode.svg?style=flat-square)](https://david-dm.org/screeny05/corrode)\n[![coverage](https://img.shields.io/coveralls/screeny05/corrode.svg?style=flat-square)](https://coveralls.io/github/screeny05/corrode)\n[![build status](https://img.shields.io/travis/screeny05/corrode.svg?style=flat-square)](https://travis-ci.org/screeny05/corrode)\n[![docs](https://corrode.scn.cx/badge.svg)](https://corrode.scn.cx/)\n\nCorrode is a batteries-included library for reading binary data. It helps you converting that blob-mess into useable data.\n\nUse it to parse _that one_ obscure binary-file with the help of JavaScript.\n\n#### Install\n```\n$ npm install --save corrode\n```\n\n#### Tests\n```\n$ npm test\n```\n\n#### Offline Docs\n```\n$ npm run docs\n$ open doc/index.html\n```\n\n\n## What's this?\ncorrode provides standard read-actions like uint8-uint64 for big \u0026 little endian, strings, buffers and control-structures like loops, skipping, etc. for your buffers and files.\nAdditionally you can use assertions to always be sure, the data you parse corresponds to a specified format.\nThe parsing is done not by a configuration-object, but by imperative code, allowing for far greater flexibility.\n\ncorrode is an abstraction on top of `TransformStream` and as such is pipeable to but also provides functions for more simple usage.\n\nThis library is not only heavily inspired by [dissolve](https://github.com/deoxxa/dissolve), it in fact can be seen as a total rewrite with even more features.\nThe code is written in ES7, fully documented and tested.\n\n\n## Quick examples\n```javascript\nconst Corrode = require('corrode');\nconst parser = new Corrode();\n\nparser\n    .uint8('val_1')\n    .uint32('val_2')\n    .int16be('val_3')\n    .tap(function(){\n        console.log(this.vars.val_1 * this.vars.val_3);\n    })\n    .repeat('array', 5, function(){\n        this\n            .uint32('array_val_1')\n            .string('array_val_4', 5);\n    });\n```\n\n#### Parsing a buffer\n```javascript\nparser.fromBuffer(buffer, () =\u003e console.log(parser.vars));\n```\n\n#### Parsing a filestream\n```javascript\nvar stream = fs.createReadStream(file);\nstream.pipe(parser);\nparser.on('finish', () =\u003e console.log(parser.vars));\n```\n\nThese are just some of the very basic operations supported by Corrode.\n\n\n## Examples\nAll examples can be found in the examples/-folder. Included:\n* ID3v2.3-Parser - strict, unforgiving parser for a subset of the standard used to store meta-data in mp3-files. It needs `npm i image-to-ascii temp` and can be run with `node examples/id3 test.mp3`.\n\nIf you'd like to include your own examples, just open a PR. I'm more than happy to not have to think about existing complex structured binary data to parse myself.\n\n\n## Documentation \u0026 API Reference\n* [Corrode Overview](https://corrode.scn.cx/manual/overview.html)\n* [API Reference](https://corrode.scn.cx/identifiers.html)\n* [Getting Started](https://corrode.scn.cx/manual/getting-started.html)\n\n\n## Why use corrode over dissolve\nIt solves most of the major shortcomings dissolve has:\n* EOF terminates corrode. If not explicitly asked not to do so it will give you all variables, without you having to fiddle with its intestines.\n* Loops get unwinded correctly.\n* Thoroughly tested.\n* As a js-library from 2016 it has all the swag you need.\n\n\n## When not to use corrode\n* Your data is too complex - If you need to apply black magic on your data, to retrieve meaningful values, corrode currently may not support your use-case.\n* Your data is really simple - If you don't need to read structured data, but instead just numbers or strings you should simply use the built-in read-functions provided by `Buffer`.\n\nNot yet included are additions like bignum-support for int64 and additional non-node-standard-encodings.\n\ncorrode also works in browsers. You will need a `setImmediate()` polyfill, but you're able to parse ArrayBuffers as usual.\n\n\n## Used dependencies (3)\nThe following dependencies are installed when installing corrode:\n* bl - used for buffering data, in case a job gets greedy or you don't want to auto-flush\n* readable-streams - ensures consistent and stable behaviour of the underlying Transform-Stream\n* lodash - several utility functions\n\n\n## License\nThis library is issued under the [MIT license](./LICENSE).\n\nThe Logo is from The Noun Project, created by [Michael Senkow](https://thenounproject.com/mhsenkow/) and licensed under the [CC-BY-3.0](https://creativecommons.org/licenses/by/3.0/us/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscreeny05%2Fcorrode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscreeny05%2Fcorrode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscreeny05%2Fcorrode/lists"}