{"_id":"@amax/fcbuffer","name":"@amax/fcbuffer","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@amax/fcbuffer","description":"Serialization library geared towards immutable data storage such as blockchains.","version":"0.0.1","main":"lib/index.js","license":"MIT","scripts":{"test":"mocha --use_strict src/index.test.js","test_lib":"mocha --exit --use_strict lib/*.test.js","coverage":"istanbul cover _mocha -- -R spec src/index.test.js","coveralls":"npm run coverage && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls","browserify-mocha":"browserify src/index.test.js > mocha/mocha.test.js","build":"rm -fr lib && npm run build_lib","build_lib":"babel --copy-files src --out-dir lib","prepublishOnly":"npm run build && npm run test_lib"},"repository":{"type":"git","url":"git://github.com/EOSIO/fcbuffer.git"},"dependencies":{"bn.js":"^4.11.8","bytebuffer":"^5.0.1","ieee-float":"^0.6.0"},"devDependencies":{"babel-cli":"6.26.0","babel-core":"6.26.3","babel-preset-es2015":"6.24.1","coveralls":"^3.0.0","istanbul":"^0.4.5","mocha":"^5.2.0"},"babel":{"presets":["es2015"]},"bugs":{"url":"https://github.com/EOSIO/fcbuffer/issues"},"homepage":"https://github.com/EOSIO/fcbuffer#readme","_id":"@amax/fcbuffer@0.0.1","_nodeVersion":"14.20.0","_npmVersion":"6.14.17","dist":{"integrity":"sha512-IUOMaopmVMzyDTxs8MJZsCTqGxmOMQyUDG7wMit033K5zt7OUTomqBp6nAPpl7OdEqUOHqCp9VYyBBVkjREnCg==","shasum":"64413bfe0e0f493d24f0ca09388eb73f321bee4e","tarball":"https://registry.npmjs.org/@amax/fcbuffer/-/fcbuffer-0.0.1.tgz","fileCount":8,"unpackedSize":73865,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDogOXK+bczYZyN6+HKpa40Zo/CHMF8VDEjFQ5a+rZLuQIgSYmJrAb7cTkIQU6RkpuBzMb92w4FjcWdVSMEQ7/WRgs="}]},"_npmUser":{"name":"armoniametachain","email":"aplink2022@gmail.com"},"directories":{},"maintainers":[{"name":"armoniametachain","email":"aplink2022@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fcbuffer_0.0.1_1687248607769_0.14406867198744822"},"_hasShrinkwrap":false}},"time":{"created":"2023-06-20T08:10:07.699Z","0.0.1":"2023-06-20T08:10:07.952Z","modified":"2023-06-20T08:10:08.110Z"},"maintainers":[{"name":"armoniametachain","email":"aplink2022@gmail.com"}],"description":"Serialization library geared towards immutable data storage such as blockchains.","homepage":"https://github.com/EOSIO/fcbuffer#readme","repository":{"type":"git","url":"git://github.com/EOSIO/fcbuffer.git"},"bugs":{"url":"https://github.com/EOSIO/fcbuffer/issues"},"license":"MIT","readme":"[![Build Status](https://travis-ci.org/EOSIO/eosjs-fcbuffer.svg?branch=master)](https://travis-ci.org/EOSIO/eosjs-fcbuffer)\n[![Coverage Status](https://coveralls.io/repos/github/EOSIO/eosjs-fcbuffer/badge.svg?branch=master)](https://coveralls.io/github/EOSIO/eosjs-fcbuffer?branch=master)\n[![NPM](https://img.shields.io/npm/v/fcbuffer.svg)](https://www.npmjs.org/package/fcbuffer)\n\n# FC Buffer\n\nSerialization library geared towards immutable data storage such as blockchains.\n\nFor EOS compatible implementation use this library from [eosjs](https://github.com/eosio/eosjs) instead.\n\nFC Buffer is a recent refactor from serialization code used in Bitshares and\nSteem.  Some of the serialization code was reduced and the definitions language\nadded.  The definition format may change.\n\n# Features\n\n- Validation and error reporting\n- Concise and intuitive binary format\n- Compatible with the FC library used in Graphene blockchains\n- Extendable JSON structure definitions\n- Binary and JSON string serialization\n- Unit testing and code coverage\n\n# Non Features\n\n- Consider Cap'n Proto or Protocol Buffers if your data structures need to\n  be extended at the serialization layer.\n- No streams, smaller blockchain sized objects are used\n\n# Example\n\n```javascript\nFcbuffer = require('fcbuffer') // or: Fcbuffer = require('./src')\n\nassert = require('assert')\n\ndefinitions = {\n    message_type: 'fixed_string16', // CustomType: built-in type\n    account_name: 'fixed_string32', // CustomType: built-in type\n    message: { // struct\n        fields: {\n          from: 'account_name',\n          to: 'account_name',\n          cc: 'account_name[]',\n          type: 'message_type',\n          data: 'bytes' // built-in type\n        }\n    }\n}\n\n// Warning: Do not use {defaults: true} in production\nfcbuffer = Fcbuffer(definitions, {defaults: true})\n\n// Check for errors anywhere in the definitions structure\nassert(fcbuffer.errors.length === 0, fcbuffer.errors)\n\n// If there are no errors, you'll get your structs\nvar {message} = fcbuffer.structs\n\n// Create JSON serializable object\n// returns { from: '', to: '', cc: [ '' ], type: '', data: '' }\nmessage.toObject()\n\n// Convert JSON into a more compact fcbuffer serializable object\nmsg = { from: 'jc', to: 'dan', cc: [ 'abc' ], type: '', data: '0f0f0f' }\n\n// Serialize fcbuffer object into a single binary buffer\nbuf = Fcbuffer.toBuffer(message, msg)\n// returns <Buffer 02 6a 63 07 63 68 61 72 6c 65 73 01 03 61 62 63 00 03 0f 0f 0f>\n\n// Convert binary back into a new (cloned) object\nobj = Fcbuffer.fromBuffer(message, buf)\n\n// Check that the new object matches the original\nassert.deepEqual(msg, obj)\n\n// A definition may extend and define other definitions.  This works in the initial\n// definition or later via the extend function.\nfcbuffer2 = fcbuffer.extend({\n    permission_name: 'fixed_string16',\n    permission_level: {\n        fields: {\n          actor: 'account_name',\n          permission: 'permission_name'\n        }\n    }\n})\n\nassert(fcbuffer2.errors.length === 0, fcbuffer2.errors)\n\nvar {permission_level} = fcbuffer2.structs\npermission_level.toObject()\n// toObject returns: { actor: '', permission: '' }\n\n```\n\n# References\n\n- Built-in Types: [types.js](./src/types.js)\n- EOS Definitions: [schema](https://github.com/EOSIO/eosjs-json/blob/master/schema)\n\n# Environment\n\nNode 6+ and browser (browserify, webpack, etc)\n","readmeFilename":"README.md"}