From 9085b8d2844c501447359a7943db8aa686c30a11 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 19 Oct 2017 08:58:51 -0700 Subject: [PATCH] Add usage docs to README. Fixes #8. --- npm/README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/npm/README.md b/npm/README.md index e738940..20e8cce 100644 --- a/npm/README.md +++ b/npm/README.md @@ -13,6 +13,35 @@ and located in three eponymous directories: - bin/Linux/FBX2glTF - bin/Windows/FBX2glTF.exe +# Usage + +```js +/** + * Converts an FBX to a GTLF or GLB file. + * @param string srcFile path to the source file. + * @param string destFile path to the destination file. + * This must end in `.glb` or `.gltf` (case matters). + * @param string[] [opts] options to pass to the converter tool. + * @return Promise a promise that yields the full path to the converted + * file, an error on conversion failure. + */ +convert(srcPath :string, destPath :string, args :?string[]) :Promise +``` + +For example: + +```js +const convert = require('fbx2gltf'); +convert('path/to/some.fbx', 'path/to/target.glb', ['--flip-v']).then( + destPath => { + // yay, do what we will with our shiny new GLB file! + }, + error => { + // ack, conversion failed: inspect 'error' for details + } +); +``` + # Further Reading The home of this tool is [here](https://github.com/facebookincubator/FBX2glTF).