Title: Feature request: manually control type mapping · Issue #52 · msgpack/msgpack-node · GitHub
Open Graph Title: Feature request: manually control type mapping · Issue #52 · msgpack/msgpack-node
X Title: Feature request: manually control type mapping · Issue #52 · msgpack/msgpack-node
Description: I would like to use this library in a node.js application that communicates with a msgpack API. Unfortunately, I need to be able to send messages that use specific data types for specific fields (e.g. Array
Open Graph Description: I would like to use this library in a node.js application that communicates with a msgpack API. Unfortunately, I need to be able to send messages that use specific data types for specific fields (e...
X Description: I would like to use this library in a node.js application that communicates with a msgpack API. Unfortunately, I need to be able to send messages that use specific data types for specific fields (e...
Opengraph URL: https://github.com/msgpack/msgpack-node/issues/52
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Feature request: manually control type mapping","articleBody":"I would like to use this library in a node.js application that communicates with a msgpack API. Unfortunately, I need to be able to send messages that use specific data types for specific fields (e.g. `Array\u003cfixint\u003e`, `bin8`, ...) rather than have the library automatically choose/guess as described in\r\nhttps://github.com/msgpack/msgpack-node#type-mapping.\r\n\r\nHow hard would it be to incorporate this? For example, I'd like to be able to do this:\r\n\r\n```js\r\n// Binary data\r\nconst buff = getBufferFromSomewhere();\r\nmsgpack.pack(buff, { family: 'bin' }); // ==\u003e chooses `bin8`, `bin16` or `bin32` depending on buffer size\r\n\r\n// Force particular numeric type\r\nmsgpack.pack(123, { type: 'fixint' });\r\n\r\n// Specify custom type mapping when packing arrays\r\nconst a = [{ data: Math.PI, type: 'float64' }, { data: 3.14, type: 'float32' }];\r\nmsgpack.pack(a, {\r\n interpret(item) {\r\n return {\r\n data: item.data,\r\n type: item.type,\r\n // alternatively:\r\n family: item.family,\r\n };\r\n }\r\n});\r\n```\r\n","author":{"url":"https://github.com/jacobq","@type":"Person","name":"jacobq"},"datePublished":"2019-10-23T18:30:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/52/msgpack-node/issues/52"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:64466247-e5fb-06bb-8629-ab6e7f7cf286 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E878:E82BE:4F525E:65B4E3:69905720 |
| html-safe-nonce | 73693306f091d52d0012c8b9d8b47a0c783a16c92b50a06c7400f5c56f21c3df |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODc4OkU4MkJFOjRGNTI1RTo2NUI0RTM6Njk5MDU3MjAiLCJ2aXNpdG9yX2lkIjoiMTE1NjcyMjQxMzc1NTY1NjAwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e0bca4a44e93f4b3e90ac358a51962cb46dd504ed3ed0eb90836b70b1649c4df |
| hovercard-subject-tag | issue:511498439 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/msgpack/msgpack-node/52/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a2186c9e263ec783c78b88c5e246577f2f79c5b949795f2baad2176a0adfc4b3/msgpack/msgpack-node/issues/52 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a2186c9e263ec783c78b88c5e246577f2f79c5b949795f2baad2176a0adfc4b3/msgpack/msgpack-node/issues/52 |
| og:image:alt | I would like to use this library in a node.js application that communicates with a msgpack API. Unfortunately, I need to be able to send messages that use specific data types for specific fields (e... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jacobq |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/msgpack/msgpack-node git https://github.com/msgpack/msgpack-node.git |
| octolytics-dimension-user_id | 198264 |
| octolytics-dimension-user_login | msgpack |
| octolytics-dimension-repository_id | 7430783 |
| octolytics-dimension-repository_nwo | msgpack/msgpack-node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7430783 |
| octolytics-dimension-repository_network_root_nwo | msgpack/msgpack-node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3b33c5aedc9808f45bc5fcf0b1e4404cf749dac7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width