Closed ThomasAribart closed 11 months ago
Hello and thanks for this awesome lib' 🙌
I'm encountering an error when writing + reading a .tif file with the writeArrayBuffer and fromArrayBuffer utils:
.tif
writeArrayBuffer
fromArrayBuffer
import { readFileSync, writeFileSync } from 'fs'; import { fromArrayBuffer, writeArrayBuffer } from 'geotiff'; // Example from docs const values = [1, 2, 3, 4, 5, 6, 7, 8, 9]; const metadata = { height: 3, width: 3, }; const arrayBuffer = (await writeArrayBuffer( values, metadata, )) as ArrayBuffer; writeFileSync( './foo.tif', Buffer.from(arrayBuffer), ); const { buffer } = readFileSync('./foo.tif'); // 👇 ❌ Fails with 'Invalid byte order value.' error const tiff = await fromArrayBuffer(buffer);
When logging the two buffers, they indeed seem different.
What am I doing wrong ?
Solving this as I managed to make it work with fromFile instead of readFileSync + fromArrayBuffer
fromFile
readFileSync
Hello and thanks for this awesome lib' 🙌
I'm encountering an error when writing + reading a
.tif
file with thewriteArrayBuffer
andfromArrayBuffer
utils:When logging the two buffers, they indeed seem different.
What am I doing wrong ?