# ldap-promise

> Small wrapper for ldap-client that use promises.

Latest version **1.0.1** (published 2016-09-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install ldap-promise
pnpm add ldap-promise
yarn add ldap-promise
bun add ldap-promise
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-09-25 |
| First published | 2016-09-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | meikidd |
| Maintainers | meikidd |
| Keywords | promise, ldap |

## Links

- npm: https://www.npmjs.com/package/ldap-promise
- Repository: https://github.com/meikidd/ldap-promise
- Homepage: https://github.com/meikidd/ldap-promise#readme
- Issues: https://github.com/meikidd/ldap-promise/issues
- npm.io page: https://npm.io/package/ldap-promise

## Dependencies (1)

- [ldap-client](https://npm.io/package/ldap-client.md) ^3.1.3

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2016-09-25
- 1.0.0 — 2016-09-23
- 0.1.0 — 2016-09-23

## README

# ldap-promise

Small wrapper for [ldap-client](https://www.npmjs.com/package/ldap-client) that use promises.

You can use [ldap-client](https://www.npmjs.com/package/ldap-client) in this way

```
let data = yield ldap.search({
	filter: '(objectClass=*)'
});
```

and this way too

```
ldap.search({
	filter: '(objectClass=*)'
}).then((err, data) => {
	console.log(data);
});
```



## Installation

This module is installed via npm:

``` bash
$ npm install ldap-promise
```

## Example Usage

```
let ldap = new LDAP({
    uri:             'ldap://server',   // string 
    validatecert:    false,             // Verify server certificate 
    connecttimeout:  -1,                // seconds, default is -1 (infinite timeout), connect timeout 
    base:            'dc=com',          // default base for all future searches 
    attrs:           '*',               // default attribute list for future searches 
    filter:          '(objectClass=*)', // default filter for all future searches 
    scope:           LDAP.SUBTREE,      // default scope for all future searches 
    connect:         function(),        // optional function to call when connect/reconnect occurs 
    disconnect:      function(),        // optional function to call when disconnect occurs         
}, function(err) {
    // connected and ready     
});

```

### promise 

```
ldap.search({
	filter: '(objectClass=*)'
}).then((err, data) => {
	if(err) {
		console.log(err);
	} else {
		console.log(data);
	}
});
```


### generator

```
let co = require('co');

co(function *() {
	let result = null;
	try {
		result = yield ldap.search({
			filter: '(objectClass=*)'
		});
	} catch(e) {
		result = e;
	}
	console.log(result);
});
```

---
_Source: https://npm.io/package/ldap-promise · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
