{"id":15413350,"url":"https://github.com/simonwep/nason","last_synced_at":"2025-04-19T03:20:26.705Z","repository":{"id":49603706,"uuid":"252278719","full_name":"simonwep/nason","owner":"simonwep","description":"📦 Ultra tiny serializer / encoder with plugin-support. Useful to build binary files containing images, strings, numbers and more!","archived":false,"fork":false,"pushed_at":"2022-12-10T11:01:52.000Z","size":355,"stargazers_count":36,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T06:43:21.524Z","etag":null,"topics":["binary","bson","compression","deserialization","json","serialization"],"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/simonwep.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":"2020-04-01T20:22:54.000Z","updated_at":"2025-01-06T08:49:48.000Z","dependencies_parsed_at":"2023-01-26T06:31:00.843Z","dependency_job_id":null,"html_url":"https://github.com/simonwep/nason","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonwep%2Fnason","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonwep%2Fnason/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonwep%2Fnason/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonwep%2Fnason/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonwep","download_url":"https://codeload.github.com/simonwep/nason/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249191261,"owners_count":21227532,"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","bson","compression","deserialization","json","serialization"],"created_at":"2024-10-01T16:56:43.216Z","updated_at":"2025-04-16T03:32:36.449Z","avatar_url":"https://github.com/simonwep.png","language":"TypeScript","funding_links":["https://github.com/sponsors/Simonwep"],"categories":[],"sub_categories":[],"readme":"\u003ch3 align=\"center\"\u003e\n    \u003cimg src=\"https://user-images.githubusercontent.com/30767528/79019744-4d835a00-7b77-11ea-88b6-d748b13bd05f.png\" alt=\"Logo\"\u003e\n\u003c/h3\u003e\n\n\u003ch3 align=\"center\"\u003e\n    Ultra tiny object serializer\n\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"gzip size\" src=\"https://img.badgesize.io/https://cdn.jsdelivr.net/npm/nason/lib/nason.min.js?compression=gzip\u0026style=flat-square\"\u003e\n  \u003cimg alt=\"brotli size\" src=\"https://img.badgesize.io/https://cdn.jsdelivr.net/npm/nason/lib/nason.min.js?compression=brotli\u0026style=flat-square\"\u003e\n  \u003ca href='https://coveralls.io/github/Simonwep/nason?branch=master'\u003e\u003cimg\n     src='https://img.shields.io/coveralls/github/Simonwep/nason?style=flat-square'\n     alt='Coverage Status'/\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/Simonwep/nason/actions\"\u003e\u003cimg\n     alt=\"Build Status\"\n     src=\"https://img.shields.io/github/workflow/status/Simonwep/nason/CI?style=flat-square\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/nason\"\u003e\u003cimg\n     alt=\"Download count\"\n     src=\"https://img.shields.io/npm/dm/nason.svg?style=popout-square\"\u003e\u003c/a\u003e\n  \u003cimg alt=\"No dependencies\" src=\"https://img.shields.io/badge/dependencies-none-27ae60.svg?style=popout-square\"\u003e\n  \u003ca href=\"https://www.jsdelivr.com/package/npm/nason\"\u003e\u003cimg\n     alt=\"JSDelivr download count\"\n     src=\"https://data.jsdelivr.com/v1/package/npm/nason/badge\"\u003e\u003c/a\u003e\n  \u003cimg alt=\"Current version\"\n       src=\"https://img.shields.io/github/tag/Simonwep/nason.svg?color=3498DB\u0026label=version\u0026style=flat-square\"\u003e\n  \u003ca href=\"https://github.com/sponsors/Simonwep\"\u003e\u003cimg\n     alt=\"Support me\"\n     src=\"https://img.shields.io/badge/github-support-3498DB.svg?style=popout-square\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n\n\u003e Disclaimer: This library is part of a bigger project and its goal is to be as small as possible (I don't want to use the \u003e200kb bundle\n\u003e of [bson](https://github.com/mongodb/js-bson)). This lib is only around 4kb, uncompressed.\n\u003e It's only supposed to work within JS itself and not all data-types are implemented so far (see types-table at the bottom).\n\u003e\n\u003e The name is based on nashorn which is the German word for rhino.\n\n### Installation\n\nInstall via `npm ` or `yarn`:\n\n```shell\n$ npm install nason\n# or\n$ yarn add nason\n```\n\nInclude directly via [jsdelivr](https://www.jsdelivr.com/package/npm/nason):\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/nason/lib/nason.min.js\"\u003e\u003c/script\u003e\n```\n\nUsing [ES Modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules):\n\n````js\nimport { deserialize, serialize } from 'https://cdn.jsdelivr.net/npm/nason/lib/nason.min.mjs'\n````\n\n### Usage\n\n```js\nimport { deserialize, serialize } from 'nason';\n\n// Serialize something; you'll get a Uint8Array in return.\n// You can pass any kind of supported data-type you want to serialize.\nconst enc = serialize({\n    'hello': 'world',\n    'number': 13235,\n    'array': [1, 2, 3, 'abc']\n});\n\n// ... save enc to file or do whatever you want with it\n\n// Deserialize a previously-serialized value\nconst dec = deserialize(enc);\nconsole.log(dec); // Will be the same as initially passed into serialize\n```\n\n`nason` exports the following properties and functions:\n\n```js\nimport {\n    deserialize, // Takes a single Uint8Array and decodes it\n    serialize, // Takes any supported value and converts it to a Uint8Array\n    version // Current version of this package\n} from 'nason';\n```\n\n\u003e There's even more if you want to develop [plugins](docs/plugins)!\n\n### Data-types\n\n| Data-type | Status            |\n|-----------|-------------------|\n| `object`  | ✅ Fully supported |\n| `array`   | ✅ Fully supported |\n| `string`  | ✅ Fully supported |\n| `number`  | ✅ Fully supported |\n| `boolean` | ✅ Fully supported |\n| `null`    | ✅ Fully supported |\n\n\u003e `undefined` is not part of the JSON specification and will throw an error if you try to serialize it.\n\u003e You can, however, [add support for it](docs/plugins/undefined.md) ;)\n\n### Plugins\n\nIt's possible to write custom encoders for data-types not supported out-of-the-box.\nHead to [plugins](docs/plugins) to get started!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonwep%2Fnason","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonwep%2Fnason","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonwep%2Fnason/lists"}