2.0.0-dev.3.6 • Published 2 years ago
vrm-validator v2.0.0-dev.3.6
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
data
Uint8Array Byte array containing glTF or GLB data.options
ValidationOptions Object with validation options.
Returns Promise Promise with validation result in object form.
validateString
Validates an asset from JSON string.
Parameters
json
string String containing glTF JSON.options
ValidationOptions Object with validation options.
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 tofalse
to omit timestamp from the validation report. Default istrue
.maxIssues
number Max number of reported issues. Use0
for unlimited output.ignoredIssues
Array[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/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.
2.0.0-dev.3.6
2 years ago
2.0.0-dev.3.5
2 years ago