@file-type/xml
XML detection plugin for file-type
Last updated 7 months ago by borewit .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @file-type/xml 
SYNC missed versions from official npm registry.

NPM version Node.js CI npm downloads

@file-type/xml

Detector plugin for file-type for XML files.

Installation

npm install @file-type/xml

Usage

The following example shows how to add the XML detector to file-type.

import {FileTypeParser} from 'file-type';
import {detectXml} from '@file-type/xml';

const parser = new FileTypeParser({customDetectors: [detectXml]});
const fileType = await parser.fromFile('example.kml');
console.log(fileType);

You can also use the XML detector outside file-type:

import {XmlTextDetector} from '@file-type/xml';

const xmlTextDetector = new XmlTextDetector();
xmlTextDetector.write('<svg xmlns="http://www.w3.org/2000/svg"><path fill="#00CD9F"/></svg>');
const fileType = xmlTextDetector.fileType;
console.log(JSON.stringify(fileType)); // Outputs: {"ext":"svg","mime":"image/svg+xml"}

Support file formats

Licence

This project is licensed under the MIT License. Feel free to use, modify, and distribute as needed.

Current Tags

  • 1.2.0                                ...           latest (2 months ago)

14 Versions

  • 1.2.0                                ...           2 months ago
  • 1.1.1                                ...           7 months ago
  • 1.1.0                                ...           9 months ago
  • 1.0.0                                ...           9 months ago
  • 0.5.0                                ...           9 months ago
  • 0.4.4                                ...           a year ago
  • 0.4.3                                ...           2 years ago
  • 0.4.2                                ...           2 years ago
  • 0.4.1                                ...           2 years ago
  • 0.4.0                                ...           2 years ago
  • 0.3.0                                ...           2 years ago
  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
Maintainers (1)
Downloads
Total 21
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 1
Last Month 19
Dependencies (2)
Dev Dependencies (7)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE