# grpc-create-metadata

> A simple Node.js helper utility for creating gRPC metadata

Latest version **4.0.1** (published 2021-07-19) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install grpc-create-metadata
pnpm add grpc-create-metadata
yarn add grpc-create-metadata
bun add grpc-create-metadata
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.1 |
| Published | 2021-07-19 |
| First published | 2016-12-17 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 17.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Bojan D. |
| Maintainers | bojand |
| Keywords | protocol buffer, protobuf, grpc, metadata |

## Links

- npm: https://www.npmjs.com/package/grpc-create-metadata
- Repository: https://github.com/bojand/grpc-create-metadata
- Issues: https://github.com/bojand/grpc-create-metadata/issues
- npm.io page: https://npm.io/package/grpc-create-metadata

## Dependencies (1)

- [lodash.forown](https://npm.io/package/lodash.forown.md) ^4.4.0

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads
- [datasets-fi-postalcodes](https://npm.io/package/datasets-fi-postalcodes.md) — 1.1K weekly downloads

## Recent versions

- 4.0.1 (latest) — 2021-07-19
- 4.0.0 — 2021-02-03
- 3.1.0 — 2021-01-30
- 3.0.0 — 2017-12-16
- 2.0.0 — 2017-11-08
- 1.0.0 — 2016-12-17

## README

<a name="module_grpc-create-metadata"></a>

### grpc-create-metadata
Simple Node.js helper utility for creating gRPC metadata

**Example** *(Installation)*  
```js
npm install grpc-create-metadata
```
**Example** *(Usage)*  
```js
const grpc = require('grpc')
const create = require('grpc-create-metadata')
const meta = create({
  name: 'Bob',
  age: 20,
  active: true
});
console.log(meta instanceof grpc.Metadata) // true
console.dir(meta.getMap()) // { foo: 'bar', age: '12', prop: 'true' }
```
<a name="exp_module_grpc-create-metadata--module.exports"></a>

#### module.exports(metadata, options) ⇒ <code>Metadata</code> ⏏
Utility helper function to create <code>Metadata</code> object from plain Javascript object
This strictly just calls <code>Metadata.add</code> with the key / value map of objects.
If the value is a <code>Buffer</code> it's passed as is.
If the value is a <code>Sting</code> it's passed as is.
Else if the value defined and not a string we simply call <code>toString()</code>.
Note that <code>Metadata</code> only accept string or buffer values.

**Kind**: Exported function  
**Returns**: <code>Metadata</code> - An instance of <code>Metadata</code>, or `undefined` if input is not an object  

| Param | Type | Description |
| --- | --- | --- |
| metadata | <code>Object</code> | Plain javascript object to tranform into <code>Metadata</code>                           If an instance of <code>Metadata</code> is passed in it is simply returned |
| options | <code>Object</code> | options |
| options.addEmpty | <code>Boolean</code> | whether to add empty strings. Default: <code>false</code> |

---
_Source: https://npm.io/package/grpc-create-metadata · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
