Skip to content

Commit

Permalink
Attempt to hide require('fs') from webpack, see #527
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Dec 7, 2016
1 parent 98a58d4 commit 4462d8b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,19 +284,19 @@ Documentation

### Data type recommendations

| Value type | protobuf Type | Size / Notes
|--------------------------|---------------|-----------------------------------------------------------------------------------
| Unsigned 32 bit integers | uint32 | 1 to 5 bytes.
| Signed 32 bit integers | sint32 | 1 to 5 bytes. Do not use int32 (always encodes negative values as 10 bytes).
| Unsigned 52 bit integers | uint64 | 1 to 10 bytes.
| Signed 52 bit integers | sint64 | 1 to 10 bytes. Do not use int64 (always encodes negative values as 10 bytes).
| Unsigned 64 bit integers | uint64 | Use with long.js. 1 to 10 bytes.
| Signed 64 bit integers | sint64 | Use with long.js. 1 to 10 bytes. Do not use int64 (always encodes negative values as 10 bytes).
| 32 bit precision floats | float | 4 bytes.
| 64 bit precision floats | double | 8 bytes. Use float if 32 bits of precision are enough.
| Boolean values | bool | 1 byte.
| Strings | string | 1 byte + utf8 byte length.
| Buffers | bytes | 1 byte + byte length.
| Value type | protobuf Type | Size / Notes
|---------------------|---------------|-----------------------------------------------------------------------------------
| Unsigned 32 bit int | uint32 | 1 to 5 bytes.
| Signed 32 bit int | sint32 | 1 to 5 bytes. Do not use int32 (always encodes negative values as 10 bytes).
| Unsigned 52 bit int | uint64 | 1 to 10 bytes.
| Signed 52 bit int | sint64 | 1 to 10 bytes. Do not use int64 (always encodes negative values as 10 bytes).
| Unsigned 64 bit int | uint64 | Use with long.js. 1 to 10 bytes.
| Signed 64 bit int | sint64 | Use with long.js. 1 to 10 bytes. Do not use int64 (always encodes negative values as 10 bytes).
| 32 bit float | float | 4 bytes.
| 64 bit float | double | 8 bytes. Use float if 32 bits of precision are enough.
| Boolean values | bool | 1 byte.
| Strings | string | 1 to 5 bytes + utf8 byte length.
| Buffers | bytes | 1 to 5 bytes + byte length.

Command line
------------
Expand Down
2 changes: 1 addition & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ util.asPromise = asPromise;
function fetch(path, callback) {
if (!callback)
return asPromise(fetch, util, path);
var fs; try { fs = require("fs"); } catch (e) {} // eslint-disable-line no-empty
var fs; try { fs = Function('r', 'return r("fs")')(require); } catch (e) { } // eslint-disable-line no-new-func, no-empty
if (fs && fs.readFile)
return fs.readFile(path, "utf8", callback);
var xhr = new XMLHttpRequest();
Expand Down

0 comments on commit 4462d8b

Please sign in to comment.