repl.txt (1181B)
1 2 {{alias}}( file[, options], clbk ) 3 Asynchronously reads a file as WebAssembly. 4 5 The function returns file contents as a Uint8Array. 6 7 Parameters 8 ---------- 9 file: string|Buffer|integer 10 Filename or file descriptor. 11 12 options: Object (optional) 13 Options. 14 15 options.flag: string (optional) 16 Flag. Default: 'r'. 17 18 clbk: Function 19 Callback to invoke upon reading file contents. 20 21 Examples 22 -------- 23 > function onRead( error, data ) { 24 ... if ( error ) { 25 ... console.error( error.message ); 26 ... } else { 27 ... console.log( data ); 28 ... } 29 ... }; 30 > {{alias}}( './beep/boop.wasm', onRead ); 31 32 33 {{alias}}.sync( file[, options] ) 34 Synchronously reads a file as WebAssembly. 35 36 Parameters 37 ---------- 38 file: string|Buffer|integer 39 Filename or file descriptor. 40 41 options: Object (optional) 42 Options. 43 44 options.flag: string (optional) 45 Flag. Default: 'r'. 46 47 Returns 48 ------- 49 out: Error|Uint8Array 50 File contents. 51 52 Examples 53 -------- 54 > var out = {{alias}}.sync( './beep/boop.wasm' ); 55 56 See Also 57 -------- 58