npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

chromium-pickle

v0.1.4

Published

Binary value packing and unpacking

Downloads

53

Readme

chromium-pickle

This module ports Chromium's Pickle class to Node, see Pickle's header for introduction:

This class provides facilities for basic binary value packing and unpacking.

The Pickle class supports appending primitive values (ints, strings, etc.) to a pickle instance. The Pickle instance grows its internal memory buffer dynamically to hold the sequence of primitive values. The internal memory buffer is exposed as the "data" of the Pickle. This "data" can be passed to a Pickle object to initialize it for reading.

When reading from a Pickle object, it is important for the consumer to know what value types to read and in what order to read them as the Pickle does not keep track of the type of data written to it.

The Pickle's data has a header which contains the size of the Pickle's payload. It can optionally support additional space in the header. That space is controlled by the header_size parameter passed to the Pickle constructor.

Install

$ npm install chromium-pickle

Usage

createEmpty()

Returns an empty Pickle object.

createFromBuffer(buffer)

  • buffer Buffer

Returns a Pickle object that initialized from a buffer. The data is not copied so you have to ensure the buffer lives when using the Pickle object, and you should never modify the Pickle object created this way.

Pickle.createIterator()

Returns a PickleIterator object that can be used to read data from this Pickle object.

Pickle.toBuffer()

Returns a Buffer object that contains this Pickle object's data.

Pickle.writeBool(value)

Writes value to Pickle object as bool. Returns true when succeeded and returns false when failed.

Pickle.writeInt(value)

Writes value to Pickle object as int. Returns true when succeeded and returns false when failed.

Pickle.writeUInt32(value)

Writes value to Pickle object as uint32. Returns true when succeeded and returns false when failed.

Pickle.writeInt64(value)

Writes value to Pickle object as int64. Returns true when succeeded and returns false when failed.

Pickle.writeUInt64(value)

Writes value to Pickle object as uint64. Returns true when succeeded and returns false when failed.

Pickle.writeFloat(value)

Writes value to Pickle object as float. Returns true when succeeded and returns false when failed.

Pickle.writeDouble(value)

Writes value to Pickle object as Double. Returns true when succeeded and returns false when failed.

Pickle.writeString(str)

  • str String

Writes str to Pickle object. Returns true when succeeded and returns false when failed.

PickleIterator.readBool()

Returns current value as bool and seeks to next data. ATypeError exception would be thrown when failed.

PickleIterator.readInt()

Returns current value as int and seeks to next data. ATypeError exception would be thrown when failed.

PickleIterator.readUInt32()

Returns current value as uint32 and seeks to next data. ATypeError exception would be thrown when failed.

PickleIterator.readInt64()

Returns current value as int64 and seeks to next data. ATypeError exception would be thrown when failed.

PickleIterator.readUInt64()

Returns current value as uint64 and seeks to next data. ATypeError exception would be thrown when failed.

PickleIterator.readFloat()

Returns current value as float and seeks to next data. ATypeError exception would be thrown when failed.

PickleIterator.readDouble()

Returns current value as double and seeks to next data. ATypeError exception would be thrown when failed.

PickleIterator.readString()

Returns current value as String and seeks to next data. ATypeError exception would be thrown when failed.