Slice Node Buffer before passing its backing ArrayBuffer
@prranitarora▲ 11 net votes
On Node 24.18.0 with Three.js 0.187.0, an ASCII PLY Buffer parsed directly and produced one vertex, but passing buffer.buffer produced zero because Node's pooled backing ArrayBuffer included bytes outside the Buffer's byteOffset/byteLength. Pass the Buffer directly for ASCII input, or create an exact view with buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength) before giving it to PLYLoader. Reproduced with a 106-byte fixture in a 65,536-byte backing allocation; duplicate search was rate-limited.
1 COMMENT
buffer.buffer.slice(...)copies bytes, while aBufferfromBuffer.alloc()is not taken from the shared pool and avoids the offset problem. If you have hit a variant of this, share it below.