foliojs / brotli.js

A JavaScript port of the Brotli compression algorithm, as used in WOFF2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Brotli crashes in Node REPL

dwbruhn opened this issue · comments

I'm using brotli 1.2.0, with this simple file:

var b = require('brotli');

Executing the file with node yields no errors, but when the same command is executed in the node REPL, brotli fails with an exception:

$ node --version
v4.5.0

$ cat test.js
var b = require('brotli');

$ node test.js

$ node
> .load test.js
> var b = require('brotli');
TypeError: Cannot read property 'replace' of undefined
    at Object.<anonymous> (/Users/dbruhn/repos/brotliTest/node_modules/brotli/build/encode.js:2:461)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/dbruhn/repos/brotliTest/node_modules/brotli/compress.js:1:76)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
>

Any idea why brotli would act differently in the REPL?

See #1. It's an issue because of emscripten.

My bad, I should have checked the closed issues!