Skip to content

Commit

Permalink
Added test for getBlobUrl() and fixed a spurious compile bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
Qvazar committed Jan 28, 2016
1 parent 91091fb commit 766744b
Show file tree
Hide file tree
Showing 11 changed files with 234 additions and 31 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Useful when packing all your application images/sound/json/etc. data in a standa

As of September 2015 this includes Chrome>=20, Firefox>=13, IE>=10, Opera>=12.10 and Safari>=8.
[Web Worker transferable objects](https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage) are used when available, increasing speed greatly. This is supported in Chrome>=21, Firefox>=18, Opera>=15 and Safari.
**Web Workers are not implemented in Node.js, so js-untar is not Node-compatible. Use a Node-compatible library such as [tar-stream](https://www.npmjs.com/package/tar-stream).**

## Installation
### NPM
Expand All @@ -36,7 +37,9 @@ The extraction is done in a [Web Worker](https://developer.mozilla.org/en-US/doc
.then(function(extractedFiles) {
... // Do something with all extracted files.
});

// or

untar(sourceBuffer).then(
function(extractedFiles) { // onSuccess
... // Do something with all extracted files.
Expand Down Expand Up @@ -66,7 +69,7 @@ The returned file object(s) has the following properties. Most of these are expl
* blob A [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) object with the contents of the file.
* getBlobUrl()
A unique [ObjectUrl](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL) to the data can be retrieved with this method for easy usage of extracted data in <img> tags etc.
document.getElementById("targetImageElement").src = file.getObjectUrl();
document.getElementById("targetImageElement").src = file.getBlobUrl();
* readAsString()
Parse the file contents as a UTF-8 string.
* readAsJSON()
Expand Down
4 changes: 2 additions & 2 deletions build/dev/untar-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ UntarWorker.prototype = {
},

postLog: function(level, msg) {
console.info("postLog");
//console.info("postLog");
this.postMessage({ type: "log", data: { level: level, msg: msg }});
},

Expand All @@ -44,7 +44,7 @@ UntarWorker.prototype = {
},

postMessage: function(msg, transfers) {
console.info("postMessage(" + msg + ", " + JSON.stringify(transfers) + ")");
//console.info("postMessage(" + msg + ", " + JSON.stringify(transfers) + ")");
self.postMessage(msg, transfers);
}
};
Expand Down
12 changes: 7 additions & 5 deletions build/dev/untar.js

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

Loading

0 comments on commit 766744b

Please sign in to comment.