Skip to content

Commit

Permalink
v0.6.1: Fix error in XHR downloads and allow synchronous FS in AsyncM…
Browse files Browse the repository at this point in the history
…irror.

Turns off assertions in our calls to writeUint8 in our XHR code, since we expect to pass large values that the code clamps to 8 bits.

Also removes a restriction on AsyncMirror; now, synchronous file systems can be async mirrored. This is useful if you want to prevent synchronous XHR.
  • Loading branch information
John Vilk committed Sep 10, 2016
1 parent 1243a0f commit 23dfa99
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# BrowserFS v0.6.0
# BrowserFS v0.6.1
> BrowserFS is an in-browser file system that emulates the [Node JS file system API](http://nodejs.org/api/fs.html) and supports storing and retrieving files from various backends. BrowserFS also integrates nicely into the Emscripten file system.
[![Build Status](https://travis-ci.org/jvilk/BrowserFS.svg?branch=master)](https://travis-ci.org/jvilk/BrowserFS)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "browserfs",
"version": "0.6.0",
"version": "0.6.1",
"description": "A filesystem in your browser!",
"main": "dist/browserfs.js",
"typings": "dist/node/main",
Expand Down
5 changes: 1 addition & 4 deletions src/backend/AsyncMirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ export default class AsyncMirror extends file_system.SynchronousFileSystem imple
this._sync = sync;
this._async = async;
if (!sync.supportsSynch()) {
throw new Error("Expected synchronous storage.");
}
if (async.supportsSynch()) {
throw new Error("Expected asynchronous storage.");
throw new Error("The first argument to AsyncMirror needs to be a synchronous file system.");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/generic/xhr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function syncDownloadFileModern(p: string, type: string): any {
for (var i = 0; i < text.length; i++) {
// This will automatically throw away the upper bit of each
// character for us.
data.writeUInt8(text.charCodeAt(i), i);
(<Buffer> data).writeUInt8(text.charCodeAt(i), i, true);
}
return;
case 'json':
Expand Down

0 comments on commit 23dfa99

Please sign in to comment.