question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

document.merge(io.read(file) reads contents of file as full path

See original GitHub issue

When trying to merge many .GLTF files together using a Document and NodeIO object, I encounter an issue where the NodeIO.read() function seems to read the entirety of the file as the path to the file.

Following your advice on this SE post, I try to pass each model as a file path using a loop:

for (const file in files){
	const fp = path.join(outDir, files[file])
	document.merge(io.read(fp))

Throws an error: Error: ENOENT: no such file or directory, open '/home/voodoo/Documents/Personal/Repositories/GLTF_Merger/GLTF_Out/data:application/octet-stream;base64,AACAPwAAAEAAAIC/AACAvwAAAEAAAIC/.... and so on. In an earlier post you helped me with, you mentioned this may have been a bug fixed in an earlier version. I am using version 0.12.4 of glTF-transform at this time. I can try using .GLB instead, but I’d really like to be able to allow .glTF or .GLB for this tool.

My tool is here on Github for reference, and this time around its a lot nicer to look at 😄

I am marking this as a bug for now, since it seems this is a known error that may have previously been fixed. If this is simply an issue with my implentation, please let me know!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
MrMagicPenguincommented, Oct 22, 2021

Cheers, I will upgrade and take a look at changing my tool!

0reactions
donmccurdycommented, Oct 25, 2021

Glad to hear that worked! 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - How to read existing text files without defining path
To do that, right click on the file that is in your project under the solution explorer (test1.txt), select properties and then select...
Read more >
14. Files and File I/O - gigamonkeys
Reading File Data. The most basic file I/O task is to read the contents of a file. You obtain a stream from which...
Read more >
The many ways to read and write to files - Powershell
Split-Path will take a full path to a file and gives you the parent folder path. PS:> Split-Path -Path 'c:\users\kevin.marquette\documents' c:\ ...
Read more >
Read files using Go (aka) Golang | golangbot.com
This tutorial has the following sections. Reading an entire file into memory. Using an absolute file path; Passing the file path as a...
Read more >
Python Tutorial - File and Text Processing
File Input/Output. File Input/Ouput (IO) requires 3 steps: Open the file for read or write or both. Read/Write data. Close the file to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found