2.0.2 • Published 3 years ago

metadata-extract v2.0.2

Weekly downloads
2
License
AGPL-3.0-or-later
Repository
github
Last release
3 years ago

metadata-extract

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

API

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:
    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)
  • 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
  • extractors/exif-tool - Extract using exiftool - requires exiftool to be installed as an external dependency. Disabled by default.
  • extractors/image-size - Get the size of images using image-size
  • extractors/pdf-text - extracts text from PDFs using 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