glTF-Transform icon indicating copy to clipboard operation
glTF-Transform copied to clipboard

I/O usability improvements for HTTP requests

Open donmccurdy opened this issue 2 years ago • 3 comments

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 avatar Mar 14 '22 18:03 donmccurdy

@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 :)

lokiiarora avatar Jul 04 '22 19:07 lokiiarora

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.

donmccurdy avatar Jul 05 '22 16:07 donmccurdy

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 :)

lokiiarora avatar Jul 06 '22 12:07 lokiiarora

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.

donmccurdy avatar Jan 09 '23 04:01 donmccurdy