diff options
-rw-r--r-- | src/library.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/library.js b/src/library.js index 57961da5..c6470560 100644 --- a/src/library.js +++ b/src/library.js @@ -279,7 +279,10 @@ LibraryManager.library = { for (var i = 0, len = data.length; i < len; ++i) dataArray[i] = data.charCodeAt(i); data = dataArray; } - var properties = {isDevice: false, contents: data}; + var properties = { + isDevice: false, + contents: data.subarray ? data.subarray(0) : data // as an optimization, create a new array wrapper (not buffer) here, to help JS engines understand this object + }; return FS.createFile(parent, name, properties, canRead, canWrite); }, // Creates a file record for lazy-loading from a URL. XXX This requires a synchronous |