2.0.0-dev.3.6 • Published 4 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-validatorExamples
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
dataUint8Array Byte array containing glTF or GLB data.optionsValidationOptions Object with validation options.
Returns Promise Promise with validation result in object form.
validateString
Validates an asset from JSON string.
Parameters
jsonstring String containing glTF JSON.optionsValidationOptions Object with validation options.
Returns Promise Promise with validation result in object form.
ValidationOptions
Type: Object
Properties
uristring Absolute or relative asset URI that will be copied to validation report.externalResourceFunctionExternalResourceFunction Function for loading external resources. If omitted, external resources are not validated.writeTimestampboolean Set tofalseto omit timestamp from the validation report. Default istrue.maxIssuesnumber Max number of reported issues. Use0for unlimited output.ignoredIssuesArray[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) Array of ignored issue codes.severityOverridesObject Object with overridden severities for issue codes.
ExternalResourceFunction
Type: Function
Parameters
uristring Relative URI of the external resource.
Returns Promise Promise with Uint8Array data.
2.0.0-dev.3.6
4 years ago
2.0.0-dev.3.5
4 years ago