diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-08-08 18:22:18 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-08-08 18:22:18 -0700 |
commit | 91a6f5cdabad809c94c52ccc2f0eac518ac65679 (patch) | |
tree | 1e4b88f895702161f2eaa5fd309c1c97f36099b4 | |
parent | ace6f0a30c459c60cf854201c5af8abe049f8181 (diff) |
make dataFile contents easier to understand
-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 |