Skip to content

Commit

Permalink
v0.5.1: Fixing localStorage backend's compatibility with non-BFS Buff…
Browse files Browse the repository at this point in the history
…ers.

Fallback to base64 encoding when binary_string isn't available.
  • Loading branch information
John Vilk committed Nov 7, 2015
1 parent b35d82a commit c8ff260
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 11 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.5.0
# BrowserFS v0.5.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.
[![NPM version](https://badge.fury.io/js/browserfs.svg)](http://badge.fury.io/js/browserfs)
Expand Down
3 changes: 3 additions & 0 deletions dist/browserfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8549,6 +8549,9 @@ catch (e) {
supportsBinaryString = false;
}
binaryEncoding = supportsBinaryString ? 'binary_string' : 'binary_string_ie';
if (!Buffer.isEncoding(binaryEncoding)) {
binaryEncoding = "base64";
}
var LocalStorageStore = (function () {
function LocalStorageStore() {
}
Expand Down
4 changes: 2 additions & 2 deletions dist/browserfs.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/browserfs.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/browserfs.min.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion dist/node/backend/LocalStorage.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.5.0",
"version": "0.5.1",
"description": "A filesystem in your browser!",
"main": "dist/browserfs.js",
"typings": "dist/node/main",
Expand Down
6 changes: 5 additions & 1 deletion src/backend/LocalStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ try {
supportsBinaryString = false;
}
binaryEncoding = supportsBinaryString ? 'binary_string' : 'binary_string_ie';

if (!Buffer.isEncoding(binaryEncoding)) {
// Fallback for non BrowserFS implementations of buffer that lack a
// binary_string format.
binaryEncoding = "base64";
}

/**
* A synchronous key-value store backed by localStorage.
Expand Down

0 comments on commit c8ff260

Please sign in to comment.