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

ldapjs-client-sync

v0.1.0-rc1

Published

a collection of sync client API based on ldapjs

Downloads

10

Readme

简介(Summary)

ldapjs-client-sync基于node-ldapjsClient API部分封装出Client API的同步方法,便于客户端逻辑的编写,避免回调地狱。

所有ldapjs-client-sync的API及API参数都可参考node-ldapjs官方文档

环境

开发环境:Node >= 12.21.0

安装(Install)

  • npm安装
npm i ldapjs-client-sync --save
  • cnpm安装
cnpm i ldapjs-client-sync --save

API

new LDAP()

返回一个LDAP实例,该实例为基于ldap.Client进行封装,添加了同步的方法。下文中所有的ldap都是指该LDAP类的实例,并非ldapjs中原生的ldap.Client实例。

该实例用于调用connect()方法。

示例:

const LDAP = require('ldapjs-client-sync');

const ldap = new LDAP();

ldap.connect()

连接服务器,该方法参数详见官方文档中ldap.createClient()方法的参数

如果连接成功,将返回客户端对象,所有同步方法都在该客户端对象中。

示例:

const LDAP = require('ldapjs-client-sync');

const ldap = new LDAP(); // 创建ldap实例

// 连接服务器,获取客户端对象
const client = await ldap.connect({
  url: ['ldap://127.0.0.1:1389', 'ldap://127.0.0.2:1389']
});

client.bindSync()

bind的同步方法,参数详见官方文档-bind()方法

示例:

const LDAP = require('ldapjs-client-sync');

const ldap = new LDAP(); // 创建ldap实例

// 连接服务器,获取客户端对象
const client = await ldap.connect({
  url: ['ldap://127.0.0.1:1389', 'ldap://127.0.0.2:1389']
});

// 绑定客户端到指定DN
await client.bindSync('cn=admin,dc=example,dc=org', 'my_password');

client.searchSync()

search的同步方法,参数详见官方文档-search()方法

示例:

const LDAP = require('ldapjs-client-sync');

const ldap = new LDAP(); // 创建ldap实例

// 连接服务器,获取客户端对象
const client = await ldap.connect({
  url: ['ldap://127.0.0.1:1389', 'ldap://127.0.0.2:1389']
});

// 绑定客户端到指定DN
await client.bindSync('cn=admin,dc=example,dc=org', 'my_password');

// 搜索指定DN的数据
const result = await client.searchSync('o=my_organization,dc=example,dc=org');

console.log(result.objects[0]);

client.addSync()

add的同步方法,参数详见官方文档-add()方法

client.delSync()

del的同步方法,参数详见官方文档-del()方法

client.modifySync()

modify的同步方法,参数详见官方文档-modify()方法

client.modifyDNSync()

modifyDN的同步方法,参数详见官方文档-modifyDN()方法

client.starttlsSync()

starttls的同步方法,参数详见官方文档-starttls()方法

client.unbindSync()

unbind的同步方法,参数详见官方文档-unbind()方法