# routesfile

> Parse ROUTES file for static sites

Latest version **2.0.0** (published 2018-02-14) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install routesfile
pnpm add routesfile
yarn add routesfile
bun add routesfile
```

## 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 | 2.0.0 |
| Published | 2018-02-14 |
| First published | 2018-02-13 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Brecht Savelkoul |
| Maintainers | savelbr |
| Keywords | routes, redirect, static, site |

## Links

- npm: https://www.npmjs.com/package/routesfile
- Repository: https://github.com/brechtpm/routesfile
- Homepage: https://github.com/brechtpm/routesfile#readme
- Issues: https://github.com/brechtpm/routesfile/issues
- npm.io page: https://npm.io/package/routesfile

## Recent versions

- 2.0.0 (latest) — 2018-02-14
- 1.0.0 — 2018-02-13

## README

# routesfile

Parse ROUTES file for static sites

## Install

`npm install routesfile`

## Usage

```js
var routesfile = require('routesfile')

// async
routesfile.read('./ROUTES', function (err, routes) {
  if (err) throw err
  // do something with `routes`
})

// sync
var fs = require('fs')

var file = fs.readFileSync('./ROUTES', 'utf-8')
var routes = routesfile.parse(file)
// do something with `routes`
```

## API

### `var routes = routesfile.parse(string)`

Returns a routes objects of the following format:

```js
{
  [redirectFromUrl: string]: {
    code: [statusCode: number],
    target: [redirectToUrl: string]
  },
  // more routes...
}
```

### `routesfile.read(path, cb)`

Callback with signature `(err, routes)`, with `routes` being the same format as returned by the `parse` method.

## License

Apache-2.0

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