# doctrine-file

> File-Reader for the Doctrine JSDoc Parser

Latest version **2.0.1** (published 2018-06-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install doctrine-file
pnpm add doctrine-file
yarn add doctrine-file
bun add doctrine-file
```

## 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.1 |
| Published | 2018-06-09 |
| First published | 2016-02-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.0.0 |
| Dependencies | 1 |
| Unpacked size | 10.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Daniel Tschinder |
| Maintainers | bashofmann, danez, haeusler, rendez, sbekrin, sevinf, tobias.hornberger, weaintplastic |
| Keywords | doctrine, jsdoc, parser |

## Links

- npm: https://www.npmjs.com/package/doctrine-file
- Repository: https://github.com/researchgate/doctrine-file
- Homepage: https://github.com/researchgate/doctrine-file#readme
- Issues: https://github.com/researchgate/doctrine-file/issues
- npm.io page: https://npm.io/package/doctrine-file

## Dependencies (1)

- [doctrine](https://npm.io/package/doctrine.md) ^2.0.0

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2018-06-09
- 2.0.0 — 2017-12-19
- 1.0.3 — 2017-11-09
- 1.0.2 — 2016-12-10
- 1.0.1 — 2016-07-12
- 1.0.0 — 2016-02-21
- 0.1.0 — 2016-02-08

## README

# Doctrine-File
###### File-Reader for the [Doctrine][1] JSDoc Parser

[![Build Status](https://travis-ci.org/researchgate/doctrine-file.svg?branch=master)](https://travis-ci.org/researchgate/doctrine-file) [![codecov](https://codecov.io/gh/researchgate/doctrine-file/branch/master/graph/badge.svg)](https://codecov.io/gh/researchgate/doctrine-file)


## Installation

You can install Doctrine-File using [npm](https://www.npmjs.com/package/doctrine-file):

```
$ npm install doctrine-file --save-dev
```

## Usage

Import doctrine-File inside of your JavaScript:

```js
import { parseFile, parseFileContent } from 'doctrine-file';
```

### parseFile(file[, options], callback)

* `file` String PathName to a textfile
* `options` Object
    * All options that [doctrine.parse][1] supports, except unwrap which can't be changed.
* `callback` Function

The callback is passed two arguments `(err, comments)`, where `comments` is an array of doctrine results.
If no JSDocs can be extracted from the file, the array will be empty.
When the file cannot be read `err` will contain the `Error`.

Here's a simple example:

```js
parseFile('somefile.js', (err, comments) => {
  if (err) throw err;

  comments.forEach(console.log);
});
```

### parseFileContent(content[, options])

* `content` String | Buffer Content of a complete file to be parsed
* `options` Object
    * All options that [doctrine.parse][1] supports, except unwrap which can't be changed.

Here's a simple example:

```js
const content = fs.readFileSync('somefile.js', 'utf-8');

const comments = parseFileContent(content);

comments.forEach(console.log);
```

## License

doctrine-file is licensed under the MIT license.

[1]: https://github.com/eslint/doctrine#readme

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