{"id":21660178,"url":"https://github.com/mprot/msgpack-js","last_synced_at":"2025-10-12T01:16:02.861Z","repository":{"id":57295248,"uuid":"102599741","full_name":"mprot/msgpack-js","owner":"mprot","description":"A MessagePack implementation for JavaScript and TypeScript.","archived":false,"fork":false,"pushed_at":"2024-09-24T09:51:09.000Z","size":74,"stargazers_count":38,"open_issues_count":1,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-25T23:40:07.916Z","etag":null,"topics":["javascript","messagepack","msgpack","serialization","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/mprot.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-06T11:19:58.000Z","updated_at":"2025-07-24T04:34:42.000Z","dependencies_parsed_at":"2024-11-25T09:44:35.113Z","dependency_job_id":null,"html_url":"https://github.com/mprot/msgpack-js","commit_stats":{"total_commits":42,"total_committers":4,"mean_commits":10.5,"dds":"0.19047619047619047","last_synced_commit":"815e9235e3b3cd5577bf9294bbed0e89000c647b"},"previous_names":["tsne/msgpack-js"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/mprot/msgpack-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mprot%2Fmsgpack-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mprot%2Fmsgpack-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mprot%2Fmsgpack-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mprot%2Fmsgpack-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mprot","download_url":"https://codeload.github.com/mprot/msgpack-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mprot%2Fmsgpack-js/sbom","scorecard":{"id":663161,"data":{"date":"2025-08-11","repo":{"name":"github.com/mprot/msgpack-js","commit":"815e9235e3b3cd5577bf9294bbed0e89000c647b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":1,"reason":"Found 3/30 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T16:52:39.433Z","repository_id":57295248,"created_at":"2025-08-21T16:52:39.433Z","updated_at":"2025-08-21T16:52:39.433Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279009736,"owners_count":26084645,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["javascript","messagepack","msgpack","serialization","typescript"],"created_at":"2024-11-25T09:32:25.848Z","updated_at":"2025-10-12T01:16:02.828Z","avatar_url":"https://github.com/mprot.png","language":"TypeScript","readme":"# msgpack-js\n`msgpack-js` is a [MessagePack](http://msgpack.org/) implementation for JavaScript and TypeScript.\n\n## Encoding\nTo encode objects into the binary MessagePack format, an `encode` function is provided:\n```typescript\nfunction encode\u003cT\u003e(v: T, typ?: Type\u003cT\u003e): Uint8Array;\n```\nThis function takes an object of an arbitrary type and converts it to its binary representation. If the type of the object is known in advance, an optional `typ` parameter could be passed to indicate the encoding algorithm. For an automatic type detection this parameter could be omitted.\n\n## Decoding\nTo decode binary MessagePack data into objects, a `decode` function is provided:\n```typescript\nfunction decode\u003cT\u003e(buf: BufferSource, typ?: Type\u003cT\u003e): T;\n```\nThis function takes a buffer containing the binary data and converts it to an object. The buffer could either be an `ArrayBuffer` or an `ArrayBufferView` and should contain valid MessagePack data. If a certain type is expected, an optional `typ` parameter could be passed. For automatic detection from the buffer's content this parameter could be omitted.\n\n## Example\n```typescript\nimport {encode, decode} from \"messagepack\";\n\nconst bin1 = encode({foo: 7, bar: \"seven\"});\nconst obj = decode(bin1);\nconsole.log(obj);\n\nconst bin2 = encode(\"foobar\");\nconst str = decode(bin2);\nconsole.log(str);\n```\n\n## Types\nSometimes even a JavaScript developer wants to have a little bit more type safety. In this situation specific types could be passed to the `encode` and `decode` functions. If the object or the binary data has an incompatible type, an error will be thrown.\n\nThe following types are supported:\n* `Nil` for null values,\n* `Bool` for boolean values,\n* `Int` for signed integer values,\n* `Uint` for unsigned integer values,\n* `Float` for floating-point values,\n* `Bytes` for binary data,\n* `Str` for string values,\n* `Arr` for arrays,\n* `Map` for objects,\n* `Raw` for already encoded values,\n* `Time` for date and time values, and\n* `Any` for automatically detecting the type and forward it to one of the types above.\n\nThe `Arr` and `Map` types provide generic encoding and decoding for their elements, i.e. `Arr` and `Map` essentially equal `Any[]` and `Map\u003cStr, Any\u003e` respectively. If more stringent element types are required, the `TypedArr` and `TypedMap` functions could be used instead:\n```typescript\nimport {TypedArr, TypedMap, Int, Str} from \"messagepack\";\n\nconst IntArray = TypedArr(Int);\nconst IntStrMap = TypedMap(Int, Str);\n```\n\n### Structs\nA struct is an object type with a predefined shape. To define such a type, the function\n```typescript\nfunction Struct(fields: Fields): Type\u003cObj\u003cany\u003e\u003e;\n```\ncan be used, which creates a type out of the predefined fields. All fields, that do not belong to the struct definition, will be omitted during the encoding and decoding process. To save some bytes and allow name changes, a struct is not simply encoded as a map with string keys. Instead, each field consists of a name, a type, and an ordinal, where the ordinal is used to uniquely identify a field.\n\nHere is an example, how define a struct:\n```typescript\nimport {Struct, Int, Str} from \"messagepack\";\n\nconst S = Struct({\n    // ordinal: [name, type],\n    1: [\"foo\", Int],\n    2: [\"bar\", Str],\n});\n```\n\nIf only the encoding or decoding capability is necessary, the functions\n```typescript\nfunction structEncoder(fields: Fields): EncodeFunc\u003cany\u003e;\nfunction structDecoder(fields: Fields): DecodeFunc\u003cany\u003e;\n```\ncan be used to create encoder and decoder functions respectively.\n\n### Unions\nA union is a value, that can be one of several types. To define a union type, the function\n```typescript\nfunction Union(branches: Branches): Type\u003cany\u003e;\n```\ncan be used, which creates a type out of the predefined branches. Each branch consists of an ordinal and a type. If a type should be encoded or decoded, that is not part of the union definition, an exception will be thrown. Also, `branches` needs to define a function to determine the ordinal number from a value.\n\nHere is an example, how to define a union:\n```typescript\nimport {Union, Int, Str} from \"messagepack\";\n\nconst U = Union({\n    // ordinal: type,\n    1: Int,\n    2: Str,\n    ordinalOf(v) {\n        switch(typeof v) {\n        case \"string\": return 1;\n        case \"number\": return 2;\n        default: new TypeError(\"invalid union type\");\n        }\n    },\n});\n```\n\nIf only the encoding or decoding capability is necessary, the functions\n```typescript\nfunction unionEncoder(branches: Branches): EncodeFunc\u003cany\u003e;\nfunction unionDecoder(branches: Branches): DecodeFunc\u003cany\u003e;\n```\ncan be used to create encoder and decoder functions respectively.\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmprot%2Fmsgpack-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmprot%2Fmsgpack-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmprot%2Fmsgpack-js/lists"}