# metadata-extract

> Extract metadata from media files, with pluggable add-ons.

Latest version **2.0.2** (published 2021-05-07) · AGPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install metadata-extract
pnpm add metadata-extract
yarn add metadata-extract
bun add metadata-extract
```

## 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.2 |
| Published | 2021-05-07 |
| First published | 2020-01-22 |
| Weekly downloads | 0 |
| License | AGPL-3.0-or-later |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 166.6 KB |
| Known vulnerabilities | 0 (+9 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | peg |
| Maintainers | ameba23 |
| Keywords | metadata |

## Links

- npm: https://www.npmjs.com/package/metadata-extract
- Repository: https://github.com/ameba23/metadata-extract
- Homepage: https://github.com/ameba23/metadata-extract#readme
- Issues: https://github.com/ameba23/metadata-extract/issues
- npm.io page: https://npm.io/package/metadata-extract

## Dependencies (10)

- [epub](https://npm.io/package/epub.md) ^1.2.1
- [mime](https://npm.io/package/mime.md) ^2.4.4
- [mobi](https://npm.io/package/mobi.md) ^0.0.1
- [debug](https://npm.io/package/debug.md) ^4.3.1
- [yauzl](https://npm.io/package/yauzl.md) ^2.10.0
- [exiftool](https://npm.io/package/exiftool.md) ^0.0.3
- [file-type](https://npm.io/package/file-type.md) ^14.1.4
- [pdf-parse](https://npm.io/package/pdf-parse.md) ^1.1.1
- [image-size](https://npm.io/package/image-size.md) ^0.8.3
- [music-metadata](https://npm.io/package/music-metadata.md) ^6.3.6

## Recent versions

- 2.0.2 (latest) — 2021-05-07
- 2.0.1 — 2021-05-06
- 2.0.0 — 2021-05-06
- 1.0.3 — 2020-11-04
- 1.0.2 — 2020-07-27
- 1.0.1 — 2020-07-15
- 1.0.0 — 2020-01-22

## README

# metadata-extract

Extract metadata from various types of media file using 'pluggable' extractors.

## API
```js
const extract = require('metadata-extract')
const metadata = await extract(sourceFilename, options)
```

`options` is an optional object which may include:
  - `options.extractors` - An array of extractors to use. These should be either filenames of the extractors included in the `extractors` directory of this module, or promise-returning functions of the form: 
    ```js
    async function (data, input) {
      return metadata
    }
    ```
    - `input` is existing metadata found by other extractors.  `input.mimetype` will contain the mime-type if detected.
    - `metadata` must be an object containing the metadata found, or undefined if nothing was extracted.
  - `options.log` - A logger function (defaults to [debug](https://github.com/visionmedia/debug))
  - `options.allowBuffers` - If true, buffers will be allowed in 

`metadata` is an object containing the metadata found.

## Included extractors

- `extractors/music-metadata` - Extract [music-metdata](https://github.com/borewit/music-metadata)
- `extractors/exif-tool` - Extract using [exiftool](https://www.sno.phy.queensu.ca/~phil/exiftool/) - requires exiftool to be installed as an external dependency. Disabled by default.
- `extractors/image-size` - Get the size of images using [image-size](https://github.com/image-size/image-size)
- `extractors/pdf-text` - extracts text from PDFs using [pdf2json](https://github.com/modesty/pdf2json)
- `extractors/text` - extracts the beginning of text files
- `extractors/zip` - extracts directory listing from zip files
- `extractors/epub` - extracts text preview or contents listing from `epub` files

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