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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ldapjs-type-parsers

v0.1.5

Published

A collection of functions to parse raw buffers from LDAPJS

Readme

Functions

coerceEntry(entry) ⇒ Object

Coerce an ldapjs entry into an object with keys (using entry.object as a base) (This uses module.attributeTransforms to map attribute names to type parsers. Many of the names present are Active-Directory-LDAP specific and I don't honestly know how well it works on other instances)

Kind: global function
Returns: Object - An object in the form { sAMAccountName: 'PickleRick', objectSid: 'S-1-5-21-3231561394-915883793-4011936924-6446' }

| Param | Type | Description | | --- | --- | --- | | entry | Object | An entry object retuend from ldapjs |

parseInteger8(buffer) ⇒ Number

Parse an LDAP Interger8 buffer into a Number

Kind: global function
Returns: Number - A Number

| Param | Type | Description | | --- | --- | --- | | buffer | Buffer | A buffer representing an attribute of type Integer8. |

bufferToPEMCertString(buffer) ⇒ String

Parse an LDAP OctetString buffer into a base 64 encoded certificate string with line breaks every 64 characters. (this should match the content in a .pem certificate file)

Kind: global function
Returns: String - A Base64 string

| Param | Type | Description | | --- | --- | --- | | buffer | Buffer | A buffer representing an LDAP attribute of type OctetString |

PEMCertStringToBuffer(str) ⇒ Buffer

Parse a base 64 encoded certificate string into a buffer representing an LDAP OctetString.

Kind: global function
Returns: Buffer - A buffer representing an LDAP attribute of type OctetString.

| Param | Type | Description | | --- | --- | --- | | str | String | A Base64 string |

parseGeneralizedDate(buffer) ⇒ Date

Parse an LDAP GeneralizedDate buffer into a javascript Date object

Kind: global function
Returns: Date - A Date object

| Param | Type | Description | | --- | --- | --- | | buffer | Buffer | A buffer representing an LDAP GeneralizedDate attribute. |

toGeneralizedDateString(date) ⇒ String

Convert a javascript Date object into an LDAP GeneralizedDate string (Can be converted to a buffer with Buffer.from(str, 'utf8) but the most common use-case is in ldapjs filters, which take a string)

Kind: global function
Returns: String - - A String in the format "YYYYMMDDHHMMSS.mmmZ" eg."20211225070000.000Z"

| Param | Type | Description | | --- | --- | --- | | date | Date | A Date object |

parseIntegerDate(buffer) ⇒ Date

Parse an LDAP IntegerDate buffer into a javascript Date object

Kind: global function
Returns: Date - A Date object

| Param | Type | Description | | --- | --- | --- | | buffer | Buffer | A buffer representing an LDAP IntegerDate attribute. |

toIntegerDateString(date) ⇒ String

Convert a javascript Date object into an LDAP IntegerDate string (Can be converted to a buffer with Buffer.from(str, 'utf8) but the most common use-case is in ldapjs filters, which take a string)

Kind: global function
Returns: String - - A string representation of an integer

| Param | Type | Description | | --- | --- | --- | | date | Date | A Date object |

parseLargeInteger(buffer, NumberType) ⇒ Date

Parse an LDAP IntegerDate buffer into a javascript Date object

Kind: global function
Returns: Date - A Date object

| Param | Type | Description | | --- | --- | --- | | buffer | Buffer | A buffer representing an LDAP IntegerDate attribute. | | NumberType | function | A constructor for the Type of Number you want returned (defaults to String). You can supply "BigInt" here, if your environment supports it. |

parseObjectSID(buffer) ⇒ String

Parse an LDAP ObjectSID buffer into a string

Kind: global function
Returns: String - An ObjectSID string eg S-1-5-21-3231561394-915883793-4011936924-6446

| Param | Type | Description | | --- | --- | --- | | buffer | Buffer | A buffer representing an LDAP ObjectSID attribute. |

toObjectSIDBuffer(str) ⇒ Buffer

Convert an objectSID string into an LDAP ObjectSID buffer

Kind: global function
Returns: Buffer - A buffer representing an LDAP ObjectSID

| Param | Type | Description | | --- | --- | --- | | str | String | An ObjectSID string eg. S-1-5-21-3231561394-915883793-4011936924-6446 |

parseObjectGUID(buffer) ⇒ String

Parse an LDAP ObjectGUID buffer into a string

Kind: global function
Returns: String - An ObjectSID string eg S-1-5-21-3231561394-915883793-4011936924-6446

| Param | Type | Description | | --- | --- | --- | | buffer | Buffer | A buffer representing an LDAP ObjectGUID attribute. |

toObjectGUIDBuffer(str) ⇒ Buffer

Convert an ObjectGUID string into an LDAP ObjectGUID buffer

Kind: global function
Returns: Buffer - A buffer representing an LDAP ObjectGUID attribute

| Param | Type | Description | | --- | --- | --- | | str | String | An ObjectGUID string eg. 1E633E26-741B-4D0E-94C7-64D8DED0791F |

parseBoolean(buffer) ⇒ Boolean

Parse an LDAP Boolean buffer into a javascript Boolean

Kind: global function
Returns: Boolean - A javascript Boolean

| Param | Type | Description | | --- | --- | --- | | buffer | Buffer | A buffer representing an LDAP Boolean attribute. |

toBooleanString(buffer) ⇒ String

Convert a javascript Boolean into a string representation of an LDAP Boolean

Kind: global function
Returns: String - An upper case javascript string. Either "TRUE" or "FALSE"

| Param | Type | Description | | --- | --- | --- | | buffer | Boolean | A buffer representing an LDAP Boolean attribute |

parseUnicodeString(buffer) ⇒ String

Parse an LDAP UnicodeString buffer into a javascript String

Kind: global function
Returns: String - A javascript String

| Param | Type | Description | | --- | --- | --- | | buffer | Buffer | A buffer representing an LDAP UnicodeString attribute |

parseUserAccountControl(buffer) ⇒ Object

Parse an LDAP UserAccountControl buffer into a javascript Object

Kind: global function
Returns: Object - A javascript Object with Boolean properties representing each possible flag in a UserAccountControl bitmask eg: { accountDisabled: true, lockedOut: false, ...}

| Param | Type | Description | | --- | --- | --- | | buffer | Buffer | A buffer representing an LDAP UserAccountControl attribute |

parseSAMAccountType(buffer) ⇒ Object

Parse an LDAP SAMAccountType buffer into a javascript Object

Kind: global function
Returns: Object - A javascript Object with Boolean properties representing each possible flag in a SAMAccountType bitmask eg: { userObject: true, normalUserAccount: true, ...}

| Param | Type | Description | | --- | --- | --- | | buffer | Buffer | A buffer representing an LDAP SAMAccountType attribute |