Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

marshal

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

marshal

Parse Ruby's Marshal strings into JavaScript objects/JSON.

  • 0.5.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

node-marshal

CI Badge

Parse Ruby's Marshal strings into JavaScript objects/JSON.

This module could not have been built without this awesome blog post series.

Installation

npm install marshal

Use

Basic use

var Marshal = require('marshal');
var m = new Marshal('0408220a68656c6c6f', 'hex');
// OR var m = new Marshal(someBufferInstance);
console.log(m.parsed); // 'hello'

This library was purpose-built for sharing a Rails cookie with an Express session.

See clayzermk1/rails-cookie-parser for an example.

Features / Limitations

Able to convert a Marshal string into a JavaScript object (not all types are supported, if you see one you would like supported please create an issue). i.e. Marshal.load()

Unable to convert a JavaScript object into a Marshal string. i.e. Marshal.dump()

Supported Types

  • nil (converted to null)
  • booleans
  • integers
  • floats (thank you @tgriesser!)
  • bignums (converted to strings. bignums are broken in the pre-release version v0.2.1, if you need bignum support please do not use v0.2.1.)
  • raw strings
  • symbols
  • symbol links
  • object links
  • IVARs (encoded strings only, regular expressions are not supported)
  • arrays
  • objects
  • hashes

Unsupported Types

Notes

From what I can tell, positive integers in Ruby Marshal are unsigned and negative integers are signed. Thus, positive integers have twice the range as negative integers.

Keywords

FAQs

Package last updated on 11 Apr 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc