{"id":18017035,"url":"https://github.com/achille-roussel/mpack-js","last_synced_at":"2025-06-30T20:37:12.887Z","repository":{"id":24269985,"uuid":"27664214","full_name":"achille-roussel/mpack-js","owner":"achille-roussel","description":"Javascript implementation of MessagePack encoder and decoder.","archived":false,"fork":false,"pushed_at":"2015-05-20T22:33:27.000Z","size":347,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T07:24:10.805Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/achille-roussel.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":"2014-12-07T08:38:28.000Z","updated_at":"2024-06-09T00:03:49.000Z","dependencies_parsed_at":"2022-09-26T21:51:16.700Z","dependency_job_id":null,"html_url":"https://github.com/achille-roussel/mpack-js","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/achille-roussel%2Fmpack-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/achille-roussel%2Fmpack-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/achille-roussel%2Fmpack-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/achille-roussel%2Fmpack-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/achille-roussel","download_url":"https://codeload.github.com/achille-roussel/mpack-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245722810,"owners_count":20661830,"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-30T04:19:58.370Z","updated_at":"2025-03-26T19:33:52.167Z","avatar_url":"https://github.com/achille-roussel.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"mpack-js\n========\n\nBrowser-oriented javascript implementation of MessagePack encoder and decoder.\n\nUsage\n-----\n\nHere's a simple example of how to use mpack-js:\n```js\nvar mpack = require('mpack-js')\n\nvar bytes = mpack.encode({\n    \"hello\" : \"world\",\n    \"answer\": 42,\n})\n\nvar object = mpack.decode(bytes)\n\nconsole.log(object.answer) // 42\n```\n\nYou can also use the Encoder and Decoder objects to build MessagePack messages\nfrom a sequence of multiple objects:\n```js\nvar mpack = require('mpack-js')\n\nvar encoder = new mpack.Encoder()\n\nencoder.encode('hello')\nencoder.encode(42)\nencoder.encode([1, 2, 3])\n\nvar decoder = new mpack.Decoder(encoder.flush())\nvar object  = null\n\nobject = decoder.decode() // hello\nobject = decoder.decode() // 42\nobject = decoder.decode() // [1, 2, 3]\nobject = decoder.decode() // undefined\n```\n\nMessagePack Extensions\n----------------------\n\nMessagePack supports encoding *extended* types to embed arbitrary data into a\nserialized message.\nHere's a quick example showing how to use extended types with mpack-js:\n```js\nvar mpack = require('mpack-js')\n\nvar data = new Uint8Array(...) // some pre-serialized data\nvar type = 42 // must be an integer in the range [-128; 127]\n\n// Encode the given binary data as an extended data type using MessagePack\n// extension support.\nvar bytes = mpack.encode(new mpack.Extended(type, data))\n\n// Decode works like any other data type, the returned object has two fields\n// named data and type.\nvar object = mpack.decode(bytes)\n\nconsole.log(object.type) // 42\nconsole.log(object.data) // Uint8Array\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fachille-roussel%2Fmpack-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fachille-roussel%2Fmpack-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fachille-roussel%2Fmpack-js/lists"}