glTF-Transform
glTF-Transform copied to clipboard
I/O usability improvements for HTTP requests
Now that version 2.x supports HTTP requests, it'd be helpful to add a few "quality of life" things for working with remote files. A couple I've noticed:
- Logger could display something while downloading remote files (under verbose mode only)
- Create local folders (e.g.
./texture/
) under asset root path if needed
Example:
gltf-transform cp https://example.com/path/to/model.gltf ./model.gltf --allow-http --verbose
@donmccurdy I was planning to pick this up, the code for it using ReadableStream
is done too but then when testing the Response
class from fetch doesn't seem to exist until node v18, that too experimentally.
Will submit the PR but I do not think it would be usable until node v18 is used by everyone :)
Great to see Node v18 provides a fetch
implementation! It's certainly OK if the CLI does not display progress in Node <18, I guess the trick would just be exposing that API from the NodeIO (and WebIO?) class in such way that loading still works — without progress events — in older versions.
I've added a way to check for Response
class being available but I'm not sure of the semantics in node 18, will checkout the node version and add the pending stuff :)
For now I'm going to close this out with just support for creating required subfolders, in #779. I briefly looked at streaming updates from the node.js fetch() API but didn't get very far with that — would be open to PRs or recommendations.