> For the complete documentation index, see [llms.txt](https://docs.twine.world/twine-js/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.twine.world/twine-js/twine-protocol/twine-core/functions/findpath.md).

# findPath

[**@twine-protocol/twine-core v0.1.0**](/twine-js/twine-protocol/twine-core/index.md) • **Docs**

***

[twine-js](/twine-js/index.md) / [@twine-protocol/twine-core](/twine-js/twine-protocol/twine-core/index.md) / findPath

## Function: findPath()

> **findPath**(`start`, `target`, `resolver`): `Promise`<[`Path`](/twine-js/twine-protocol/twine-core/type-aliases/path.md) | `null`>

Find a path between two pulses

This function is a convenience function that uses the `crawl` function to find a path between two pulses. It will return a path if one is found, or null if no path is found.

### Parameters

| Parameter  | Type                                                                                                 | Description                                           |
| ---------- | ---------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| `start`    | [`IntoResolvePulseQuery`](/twine-js/twine-protocol/twine-core/type-aliases/intoresolvepulsequery.md) | The starting pulse, or a query for the starting pulse |
| `target`   | [`IntoResolvePulseQuery`](/twine-js/twine-protocol/twine-core/type-aliases/intoresolvepulsequery.md) | The target pulse, or a query for the target pulse     |
| `resolver` | [`Resolver`](/twine-js/twine-protocol/twine-core/interfaces/resolver.md)                             | The resolver to use for resolving pulses              |

### Returns

`Promise`<[`Path`](/twine-js/twine-protocol/twine-core/type-aliases/path.md) | `null`>

* A path if one is found, or null if no path is found

### Example

```js
import { findPath } from '@twine-protocol/twine-core'
import { HttpStore } from '@twine-protocol/twine-http-store'

const resolver = new HttpStore('https://someapi.io')
const start = { chain: 'chaincid', pulse: 'startpulsecid' }
const target = { chain: 'chaincid', pulse: 'targetpulsecid' }

const path = await findPath(start, target, resolver)
if (path) {
  console.log('Path found:', path)
} else {
  console.log('No path found')
}
```

### Defined in

[packages/twine-core/src/crawl.ts:357](https://github.com/twine-protocol/twine-js/blob/3800995f9c83f4f5711bcf3062ea754a1e4448ce/packages/twine-core/src/crawl.ts#L357)
