shoco icon indicating copy to clipboard operation
shoco copied to clipboard

Does not work as a node.js module

Open pmaxhogan opened this issue 8 years ago • 0 comments

Download this repo, cd there, and run node. Type this in:

var shoco = require("./shoco.js");shoco.decompress(shoco.compress("Hello, World!"));

I get this error:

TypeError: shoco.compress is not a function
    at repl:1:58
    at sigintHandlersWrap (vm.js:22:35)
    at sigintHandlersWrap (vm.js:96:12)
    at ContextifyScript.Script.runInThisContext (vm.js:21:12)
    at REPLServer.defaultEval (repl.js:340:29)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.<anonymous> (repl.js:538:10)
    at emitOne (events.js:101:20)
    at REPLServer.emit (events.js:188:7)

instead of the expected "Hello, World!". FYI, var shoco = require("./shoco.js");Object.keys(shoco); returns:

[ 'preRun',
  'print',
  'printErr',
  'read',
  'readBinary',
  'load',
  'arguments',
  'I',
  'postRun',
  'Runtime',
  'ccall',
  'cwrap',
  'setValue',
  'getValue',
  'ALLOC_NORMAL',
  'ALLOC_STACK',
  'ALLOC_STATIC',
  'ALLOC_DYNAMIC',
  'ALLOC_NONE',
  'allocate',
  'Pointer_stringify',
  'UTF16ToString',
  'stringToUTF16',
  'UTF32ToString',
  'stringToUTF32',
  'HEAP',
  'HEAP8',
  'HEAP16',
  'HEAP32',
  'HEAPU8',
  'HEAPU16',
  'HEAPU32',
  'HEAPF32',
  'HEAPF64',
  'Md',
  'addOnPreRun',
  'Jd',
  'addOnInit',
  'Ld',
  'addOnPreMain',
  'Id',
  'addOnExit',
  'Kd',
  'addOnPostRun',
  'intArrayFromString',
  'intArrayToString',
  'writeStringToMemory',
  'writeArrayToMemory',
  'writeAsciiToMemory',
  'addRunDependency',
  'removeRunDependency',
  'preloadedImages',
  'preloadedAudios',
  '_malloc',
  '_memset',
  '_strlen',
  '_memcpy',
  '_free',
  'requestFullScreen',
  'requestAnimationFrame',
  'setCanvasSize',
  'pauseMainLoop',
  'resumeMainLoop',
  'getUserMedia',
  'FS_createFolder',
  'FS_createPath',
  'FS_createDataFile',
  'FS_createPreloadedFile',
  'FS_createLazyFile',
  'FS_createLink',
  'FS_createDevice',
  '_shoco_decompress',
  '_shoco_compress',
  'runPostSets',
  'Rd',
  'callMain',
  're',
  'run',
  'Vd',
  'exit',
  'abort',
  'calledRun',
  'stdin',
  'stdout',
  'stderr',
  'preloadPlugins',
  'Ta' ]

BTW, var shoco = require("./shoco.js");shoco._shoco_decompress(shoco._shoco_compress("hi")); returns 0.

pmaxhogan avatar May 05 '17 15:05 pmaxhogan