Skip to content

Commit

Permalink
Clarify readme a bit
Browse files Browse the repository at this point in the history
Fixes #46
Fixes #51
  • Loading branch information
Kagami committed Apr 19, 2020
1 parent d814877 commit db3db68
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ You can send the following messages to the worker:
* `{type: "run", ...opts}` - Start new job with provided options.

```js
var stdout = "";
var stderr = "";
var worker = new Worker("ffmpeg-worker-webm.js");
worker.onmessage = function(e) {
var msg = e.data;
Expand All @@ -74,15 +72,13 @@ worker.onmessage = function(e) {
worker.postMessage({type: "run", arguments: ["-version"]});
break;
case "stdout":
stdout += msg.data + "\n";
console.log(msg.data);
break;
case "stderr":
stderr += msg.data + "\n";
console.log(msg.data);
break;
case "exit":
console.log("Process exited with code " + msg.data);
console.log(stdout);
worker.terminate();
case "done":
console.log(msg.data);
break;
}
};
Expand All @@ -106,8 +102,6 @@ var testData = new Uint8Array(fs.readFileSync("test.webm"));
var result = ffmpeg({
MEMFS: [{name: "test.webm", data: testData}],
arguments: ["-i", "test.webm", "-c:v", "libvpx", "-an", "out.webm"],
// Ignore stdin read requests.
stdin: function() {},
});
// Write out.webm to disk.
var out = result.MEMFS[0];
Expand All @@ -127,7 +121,6 @@ ffmpeg({
// Mount /data inside application to the current directory.
mounts: [{type: "NODEFS", opts: {root: "."}, mountpoint: "/data"}],
arguments: ["-i", "/data/test.webm", "-c:v", "libvpx", "-an", "/data/out.webm"],
stdin: function() {},
});
// out.webm was written to the current directory.
```
Expand Down

0 comments on commit db3db68

Please sign in to comment.