vrm-validator

2.0.0-dev.3.6 • Public • Published

vrm-validator

This is an npm package for the VRM Validator by Fern Solutions compiled from Dart to JS.

Installation

npm install --save vrm-validator

Examples

Basic usage (Node.js)

const fs = require('fs');
const validator = require('vrm-validator');

const asset = fs.readFileSync('./Avatar-1.0-beta.vrm');

validator.validateBytes(new Uint8Array(asset))
    .then((report) => console.info('Validation succeeded: ', report))
    .catch((error) => console.error('Validation failed: ', error));

Basic usage (Browser)

const validator = require('vrm-validator');

fetch('Avatar-1.0-beta.vrm')
    .then((response) => response.arrayBuffer())
    .then((asset) => validator.validateBytes(new Uint8Array(asset)))
    .then((report) => console.info('Validation succeeded: ', report))
    .catch((error) => console.error('Validation failed: ', error));

API

Table of Contents

version

Returns a version string.

Returns string

supportedExtensions

Returns an array of supported extensions names.

Returns Array<string>

validateBytes

Validates an asset from bytes.

Parameters

Returns Promise Promise with validation result in object form.

validateString

Validates an asset from JSON string.

Parameters

Returns Promise Promise with validation result in object form.

ValidationOptions

Type: Object

Properties

  • uri string Absolute or relative asset URI that will be copied to validation report.
  • externalResourceFunction ExternalResourceFunction Function for loading external resources. If omitted, external resources are not validated.
  • writeTimestamp boolean Set to false to omit timestamp from the validation report. Default is true.
  • maxIssues number Max number of reported issues. Use 0 for unlimited output.
  • ignoredIssues Array<string> Array of ignored issue codes.
  • severityOverrides Object Object with overridden severities for issue codes.

ExternalResourceFunction

Type: Function

Parameters

  • uri string Relative URI of the external resource.

Returns Promise Promise with Uint8Array data.

Readme

Keywords

Package Sidebar

Install

npm i vrm-validator

Weekly Downloads

115

Version

2.0.0-dev.3.6

License

Apache-2.0

Unpacked Size

397 kB

Total Files

9

Last publish

Collaborators

  • mrxz