2.0.0-dev.3.6 • Published 2 years ago

vrm-validator v2.0.0-dev.3.6

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

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](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/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

ExternalResourceFunction

Type: Function

Parameters

  • uri string Relative URI of the external resource.

Returns Promise Promise with Uint8Array data.