Open wandergis opened 1 year ago
There are no file operations in Node.js, however you can still retrieve the file in a Buffer
by calling vsimem.release
:
https://mmomtchev.github.io/node-gdal-async/#vsimem
Here is an extract from the unit test:
// Create an in-memory dataset
const size = 64
const ds = gdal.open('/vsimem/temp1.tiff', 'w', 'GTiff', size, size, 1, gdal.GDT_Byte)
const data = new Uint8Array(size * size)
for (let i = 0; i < data.length; i ++) data[i] = Math.round(Math.random() * 256)
ds.bands.get(1).pixels.write(0, 0, ds.rasterSize.x, ds.rasterSize.y, data)
ds.close()
// Happens here
const buffer = gdal.vsimem.release('/vsimem/temp1.tiff')
assert.instanceOf(buffer, Buffer)
What about the file header? Or doesn't exist.
What do you mean by the file header?
like python gdal binding lib: