Permalink
Browse files

Attempt to hide require('fs') from webpack, see #527

  • Loading branch information...
dcodeIO committed Dec 7, 2016
1 parent 98a58d4 commit 4462d8b05d3aba37c865cf53e09b3199cf051a92
Showing with 14 additions and 14 deletions.
  1. +13 −13 README.md
  2. +1 −1 src/util.js
@@ -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
------------
@@ -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();

0 comments on commit 4462d8b

Please sign in to comment.