Merge pull request #280 from CesiumGS/reduce-max-buffer-length

Don't merge buffers if final buffer exceeds fs.write maximum of `2147479552` bytes
This commit is contained in:
Matthew Amato 2023-01-25 16:21:06 -05:00 committed by GitHub
commit 81f6d539d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,9 @@
# Change Log
### 3.1.5 - ????-??-??
- Fixed crash when writing GLB files above 2GB. [#280](https://github.com/CesiumGS/obj2gltf/pull/280)
### 3.1.4 - 2021-10-15
- Unlocked CesiumJS package now that CesiumJS 1.86.1 is released with a fix for Node 16. [#270](https://github.com/CesiumGS/obj2gltf/pull/270)

View File

@ -1,5 +1,7 @@
"use strict";
const BUFFER_MAX_BYTE_LENGTH = require("buffer").constants.MAX_LENGTH;
const FS_WRITE_MAX_LENGTH = 2147479552; // See https://github.com/nodejs/node/issues/35605
const BUFFER_MAX_LENGTH = require("buffer").constants.MAX_LENGTH;
const BUFFER_MAX_BYTE_LENGTH = Math.min(FS_WRITE_MAX_LENGTH, BUFFER_MAX_LENGTH);
const Cesium = require("cesium");
const getBufferPadded = require("./getBufferPadded");
const getDefaultMaterial = require("./loadMtl").getDefaultMaterial;