Socket
Socket
Sign inDemoInstall

grpc-create-metadata

Package Overview
Dependencies
35
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    grpc-create-metadata

A simple Node.js helper utility for creating gRPC metadata


Version published
Weekly downloads
25K
decreased by-18.25%
Maintainers
1
Install size
35.0 kB
Created
Weekly downloads
 

Readme

Source

grpc-create-metadata

Simple Node.js helper utility for creating gRPC metadata

Example (Installation)

npm install grpc-create-metadata

Example (Usage)

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' }

module.exports(metadata, options) ⇒ Metadata

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

Kind: Exported function
Returns: Metadata - An instance of Metadata, or undefined if input is not an object

ParamTypeDescription
metadataObjectPlain javascript object to tranform into Metadata If an instance of Metadata is passed in it is simply returned
optionsObjectoptions
options.addEmptyBooleanwhether to add empty strings. Default: false

Keywords

FAQs

Last updated on 19 Jul 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc