Socket
Socket
Sign inDemoInstall

@smithy/eventstream-serde-universal

Package Overview
Dependencies
10
Maintainers
0
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @smithy/eventstream-serde-universal

[![NPM version](https://img.shields.io/npm/v/@smithy/eventstream-serde-universal/latest.svg)](https://www.npmjs.com/package/@smithy/eventstream-serde-universal) [![NPM downloads](https://img.shields.io/npm/dm/@smithy/eventstream-serde-universal.svg)](http


Version published
Weekly downloads
6.8M
increased by1.62%
Maintainers
0
Created
Weekly downloads
 

Package description

What is @smithy/eventstream-serde-universal?

@smithy/eventstream-serde-universal is a package designed to handle serialization and deserialization of event streams in a universal manner. It is part of the Smithy framework, which is used for building SDKs for AWS services. This package is particularly useful for working with event-driven architectures and streaming data.

What are @smithy/eventstream-serde-universal's main functionalities?

Serialization

This feature allows you to serialize an event into a format suitable for transmission over a network. The code sample demonstrates how to create an instance of EventStreamMarshaller and use it to serialize an event object.

const { EventStreamMarshaller } = require('@smithy/eventstream-serde-universal');
const marshaller = new EventStreamMarshaller();
const event = { type: 'event', data: 'example data' };
const serializedEvent = marshaller.serialize(event);
console.log(serializedEvent);

Deserialization

This feature allows you to deserialize a received event stream back into a usable event object. The code sample shows how to create an instance of EventStreamMarshaller and use it to deserialize a binary event stream.

const { EventStreamMarshaller } = require('@smithy/eventstream-serde-universal');
const marshaller = new EventStreamMarshaller();
const serializedEvent = new Uint8Array([/* some binary data */]);
const event = marshaller.deserialize(serializedEvent);
console.log(event);

Event Stream Handling

This feature demonstrates handling a stream of events by serializing and then deserializing them. The code sample shows how to process an array of event objects, serialize them, and then deserialize them back to their original form.

const { EventStreamMarshaller } = require('@smithy/eventstream-serde-universal');
const marshaller = new EventStreamMarshaller();
const eventStream = [
  { type: 'event', data: 'data1' },
  { type: 'event', data: 'data2' }
];
const serializedStream = eventStream.map(event => marshaller.serialize(event));
const deserializedStream = serializedStream.map(event => marshaller.deserialize(event));
console.log(deserializedStream);

Other packages similar to @smithy/eventstream-serde-universal

Readme

Source

@smithy/eventstream-serde-universal

NPM version NPM downloads

An internal package

Usage

You probably shouldn't, at least directly.

FAQs

Last updated on 27 Jun 2024

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc