Browse Source

doc: conform to rules for eslint-plugin-markdown

PR-URL: https://github.com/nodejs/node/pull/12563
Refs: https://github.com/nodejs/node/pull/12557#issuecomment-296015032
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
v6
Vse Mozhet Byt 8 years ago
parent
commit
e2c3e4727d
  1. 30
      doc/api/assert.md
  2. 16
      doc/api/buffer.md
  3. 12
      doc/api/child_process.md
  4. 13
      doc/api/cluster.md
  5. 6
      doc/api/console.md
  6. 6
      doc/api/crypto.md
  7. 2
      doc/api/domain.md
  8. 8
      doc/api/http.md
  9. 4
      doc/api/modules.md
  10. 74
      doc/api/path.md
  11. 15
      doc/api/process.md
  12. 8
      doc/api/querystring.md
  13. 4
      doc/api/readline.md
  14. 32
      doc/api/stream.md
  15. 8
      doc/api/url.md
  16. 7
      doc/api/util.md
  17. 4
      doc/api/vm.md
  18. 29
      doc/api/zlib.md

30
doc/api/assert.md

@ -63,18 +63,18 @@ are evaluated also:
const assert = require('assert');
const obj1 = {
a : {
b : 1
a: {
b: 1
}
};
const obj2 = {
a : {
b : 2
a: {
b: 2
}
};
const obj3 = {
a : {
b : 1
a: {
b: 1
}
};
const obj4 = Object.create(obj1);
@ -322,18 +322,18 @@ Tests for any deep inequality. Opposite of [`assert.deepEqual()`][].
const assert = require('assert');
const obj1 = {
a : {
b : 1
a: {
b: 1
}
};
const obj2 = {
a : {
b : 2
a: {
b: 2
}
};
const obj3 = {
a : {
b : 1
a: {
b: 1
}
};
const obj4 = Object.create(obj1);
@ -368,10 +368,10 @@ Tests for deep strict inequality. Opposite of [`assert.deepStrictEqual()`][].
```js
const assert = require('assert');
assert.notDeepEqual({a:1}, {a:'1'});
assert.notDeepEqual({a: 1}, {a: '1'});
// AssertionError: { a: 1 } notDeepEqual { a: '1' }
assert.notDeepStrictEqual({a:1}, {a:'1'});
assert.notDeepStrictEqual({a: 1}, {a: '1'});
// OK
```
@ -542,7 +542,7 @@ assert.throws(
throw new Error('Wrong value');
},
function(err) {
if ( (err instanceof Error) && /value/.test(err) ) {
if ((err instanceof Error) && /value/.test(err)) {
return true;
}
},

16
doc/api/buffer.md

@ -959,7 +959,7 @@ Example: Copy an ASCII string into a `Buffer`, one byte at a time
const str = 'Node.js';
const buf = Buffer.allocUnsafe(str.length);
for (let i = 0; i < str.length ; i++) {
for (let i = 0; i < str.length; i++) {
buf[i] = str.charCodeAt(i);
}
@ -1087,7 +1087,7 @@ byte 16 through byte 19 into `buf2`, starting at the 8th byte in `buf2`
const buf1 = Buffer.allocUnsafe(26);
const buf2 = Buffer.allocUnsafe(26).fill('!');
for (let i = 0 ; i < 26 ; i++) {
for (let i = 0; i < 26; i++) {
// 97 is the decimal ASCII value for 'a'
buf1[i] = i + 97;
}
@ -1104,7 +1104,7 @@ overlapping region within the same `Buffer`
```js
const buf = Buffer.allocUnsafe(26);
for (let i = 0 ; i < 26 ; i++) {
for (let i = 0; i < 26; i++) {
// 97 is the decimal ASCII value for 'a'
buf[i] = i + 97;
}
@ -1871,7 +1871,7 @@ one byte from the original `Buffer`
```js
const buf1 = Buffer.allocUnsafe(26);
for (let i = 0 ; i < 26 ; i++) {
for (let i = 0; i < 26; i++) {
// 97 is the decimal ASCII value for 'a'
buf1[i] = i + 97;
}
@ -2021,9 +2021,9 @@ const json = JSON.stringify(buf);
console.log(json);
const copy = JSON.parse(json, (key, value) => {
return value && value.type === 'Buffer'
? Buffer.from(value.data)
: value;
return value && value.type === 'Buffer' ?
Buffer.from(value.data) :
value;
});
// Prints: <Buffer 01 02 03 04 05>
@ -2049,7 +2049,7 @@ Examples:
```js
const buf1 = Buffer.allocUnsafe(26);
for (let i = 0 ; i < 26 ; i++) {
for (let i = 0; i < 26; i++) {
// 97 is the decimal ASCII value for 'a'
buf1[i] = i + 97;
}

12
doc/api/child_process.md

@ -200,7 +200,7 @@ the process is spawned. The default options are:
const defaults = {
encoding: 'utf8',
timeout: 0,
maxBuffer: 200*1024,
maxBuffer: 200 * 1024,
killSignal: 'SIGTERM',
cwd: null,
env: null
@ -933,13 +933,17 @@ as in this example:
'use strict';
const spawn = require('child_process').spawn;
const child = spawn('sh', ['-c',
`node -e "setInterval(() => {
const child = spawn(
'sh',
[
'-c',
`node -e "setInterval(() => {
console.log(process.pid, 'is alive')
}, 500);"`
], {
stdio: ['inherit', 'inherit', 'inherit']
});
}
);
setTimeout(() => {
child.kill(); // does not terminate the node process in the shell

13
doc/api/cluster.md

@ -523,11 +523,14 @@ When any of the workers die the cluster module will emit the `'exit'` event.
This can be used to restart the worker by calling `.fork()` again.
```js
cluster.on('exit', (worker, code, signal) => {
console.log('worker %d died (%s). restarting...',
worker.process.pid, signal || code);
cluster.fork();
});
cluster.on(
'exit',
(worker, code, signal) => {
console.log('worker %d died (%s). restarting...',
worker.process.pid, signal || code);
cluster.fork();
}
);
```
See [child_process event: 'exit'][].

6
doc/api/console.md

@ -142,7 +142,7 @@ the default behavior of `console` in Node.js.
// new impl for assert without monkey-patching.
const myConsole = Object.create(console, {
assert: {
value: function assert(assertion, message, ...args) {
value(assertion, message, ...args) {
try {
console.assert(assertion, message, ...args);
} catch (err) {
@ -276,9 +276,7 @@ prints the result to `stdout`:
```js
console.time('100-elements');
for (let i = 0; i < 100; i++) {
;
}
for (let i = 0; i < 100; i++) ;
console.timeEnd('100-elements');
// prints 100-elements: 225.438ms
```

6
doc/api/crypto.md

@ -288,7 +288,8 @@ decipher.on('end', () => {
// Prints: some clear text data
});
const encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504';
const encrypted =
'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504';
decipher.write(encrypted, 'hex');
decipher.end();
```
@ -312,7 +313,8 @@ Example: Using the [`decipher.update()`][] and [`decipher.final()`][] methods:
const crypto = require('crypto');
const decipher = crypto.createDecipher('aes192', 'a password');
const encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504';
const encrypted =
'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504';
let decrypted = decipher.update(encrypted, 'hex', 'utf8');
decrypted += decipher.final('utf8');
console.log(decrypted);

2
doc/api/domain.md

@ -162,7 +162,7 @@ function handleRequest(req, res) {
setTimeout(() => {
// Whoops!
flerb.bark();
});
}, timeout);
break;
default:
res.end('ok');

8
doc/api/http.md

@ -309,7 +309,7 @@ const net = require('net');
const url = require('url');
// Create an HTTP tunneling proxy
const proxy = http.createServer( (req, res) => {
const proxy = http.createServer((req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('okay');
});
@ -405,7 +405,7 @@ A client server pair demonstrating how to listen for the `'upgrade'` event.
const http = require('http');
// Create an HTTP server
const srv = http.createServer( (req, res) => {
const srv = http.createServer((req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('okay');
});
@ -1570,10 +1570,10 @@ http.get('http://nodejs.org/dist/index.json', (res) => {
let error;
if (statusCode !== 200) {
error = new Error(`Request Failed.\n` +
error = new Error('Request Failed.\n' +
`Status Code: ${statusCode}`);
} else if (!/^application\/json/.test(contentType)) {
error = new Error(`Invalid content-type.\n` +
error = new Error('Invalid content-type.\n' +
`Expected application/json but received ${contentType}`);
}
if (error) {

4
doc/api/modules.md

@ -70,7 +70,7 @@ When a file is run directly from Node.js, `require.main` is set to its
directly by testing
```js
require.main === module
require.main === module;
```
For a file `foo.js`, this will be `true` if run via `node foo.js`, but
@ -441,7 +441,7 @@ Before a module's code is executed, Node.js will wrap it with a function
wrapper that looks like the following:
```js
(function (exports, require, module, __filename, __dirname) {
(function(exports, require, module, __filename, __dirname) {
// Your module code actually lives in here
});
```

74
doc/api/path.md

@ -74,10 +74,10 @@ the Unix `basename` command. Trailing directory separators are ignored, see
For example:
```js
path.basename('/foo/bar/baz/asdf/quux.html')
path.basename('/foo/bar/baz/asdf/quux.html');
// Returns: 'quux.html'
path.basename('/foo/bar/baz/asdf/quux.html', '.html')
path.basename('/foo/bar/baz/asdf/quux.html', '.html');
// Returns: 'quux'
```
@ -99,21 +99,21 @@ Provides the platform-specific path delimiter:
For example, on POSIX:
```js
console.log(process.env.PATH)
console.log(process.env.PATH);
// Prints: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
process.env.PATH.split(path.delimiter)
process.env.PATH.split(path.delimiter);
// Returns: ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
```
On Windows:
```js
console.log(process.env.PATH)
console.log(process.env.PATH);
// Prints: 'C:\Windows\system32;C:\Windows;C:\Program Files\node\'
process.env.PATH.split(path.delimiter)
// Returns: ['C:\\Windows\\system32', 'C:\\Windows', 'C:\\Program Files\\node\\']
process.env.PATH.split(path.delimiter);
// Returns ['C:\\Windows\\system32', 'C:\\Windows', 'C:\\Program Files\\node\\']
```
## path.dirname(path)
@ -135,7 +135,7 @@ the Unix `dirname` command. Trailing directory separators are ignored, see
For example:
```js
path.dirname('/foo/bar/baz/asdf/quux')
path.dirname('/foo/bar/baz/asdf/quux');
// Returns: '/foo/bar/baz/asdf'
```
@ -162,19 +162,19 @@ an empty string is returned.
For example:
```js
path.extname('index.html')
path.extname('index.html');
// Returns: '.html'
path.extname('index.coffee.md')
path.extname('index.coffee.md');
// Returns: '.md'
path.extname('index.')
path.extname('index.');
// Returns: '.'
path.extname('index')
path.extname('index');
// Returns: ''
path.extname('.index')
path.extname('.index');
// Returns: ''
```
@ -259,22 +259,22 @@ If the given `path` is a zero-length string, `false` will be returned.
For example on POSIX:
```js
path.isAbsolute('/foo/bar') // true
path.isAbsolute('/baz/..') // true
path.isAbsolute('qux/') // false
path.isAbsolute('.') // false
path.isAbsolute('/foo/bar'); // true
path.isAbsolute('/baz/..'); // true
path.isAbsolute('qux/'); // false
path.isAbsolute('.'); // false
```
On Windows:
```js
path.isAbsolute('//server') // true
path.isAbsolute('\\\\server') // true
path.isAbsolute('C:/foo/..') // true
path.isAbsolute('C:\\foo\\..') // true
path.isAbsolute('bar\\baz') // false
path.isAbsolute('bar/baz') // false
path.isAbsolute('.') // false
path.isAbsolute('//server'); // true
path.isAbsolute('\\\\server'); // true
path.isAbsolute('C:/foo/..'); // true
path.isAbsolute('C:\\foo\\..'); // true
path.isAbsolute('bar\\baz'); // false
path.isAbsolute('bar/baz'); // false
path.isAbsolute('.'); // false
```
A [`TypeError`][] is thrown if `path` is not a string.
@ -297,10 +297,10 @@ working directory.
For example:
```js
path.join('/foo', 'bar', 'baz/asdf', 'quux', '..')
path.join('/foo', 'bar', 'baz/asdf', 'quux', '..');
// Returns: '/foo/bar/baz/asdf'
path.join('foo', {}, 'bar')
path.join('foo', {}, 'bar');
// throws 'TypeError: Path must be a string. Received {}'
```
@ -327,14 +327,14 @@ current working directory.
For example on POSIX:
```js
path.normalize('/foo/bar//baz/asdf/quux/..')
path.normalize('/foo/bar//baz/asdf/quux/..');
// Returns: '/foo/bar/baz/asdf'
```
On Windows:
```js
path.normalize('C:\\temp\\\\foo\\bar\\..\\')
path.normalize('C:\\temp\\\\foo\\bar\\..\\');
// Returns: 'C:\\temp\\foo\\'
```
@ -363,7 +363,7 @@ The returned object will have the following properties:
For example on POSIX:
```js
path.parse('/home/user/dir/file.txt')
path.parse('/home/user/dir/file.txt');
// Returns:
// { root: '/',
// dir: '/home/user/dir',
@ -385,7 +385,7 @@ path.parse('/home/user/dir/file.txt')
On Windows:
```js
path.parse('C:\\path\\dir\\file.txt')
path.parse('C:\\path\\dir\\file.txt');
// Returns:
// { root: 'C:\\',
// dir: 'C:\\path\\dir',
@ -440,14 +440,14 @@ directory will be used instead of the zero-length strings.
For example on POSIX:
```js
path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb')
path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb');
// Returns: '../../impl/bbb'
```
On Windows:
```js
path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb')
path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb');
// Returns: '..\\..\\impl\\bbb'
```
@ -483,13 +483,13 @@ of the current working directory.
For example:
```js
path.resolve('/foo/bar', './baz')
path.resolve('/foo/bar', './baz');
// Returns: '/foo/bar/baz'
path.resolve('/foo/bar', '/tmp/file/')
path.resolve('/foo/bar', '/tmp/file/');
// Returns: '/tmp/file'
path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif')
path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif');
// if the current working directory is /home/myself/node,
// this returns '/home/myself/node/wwwroot/static_files/gif/image.gif'
```
@ -511,14 +511,14 @@ Provides the platform-specific path segment separator:
For example on POSIX:
```js
'foo/bar/baz'.split(path.sep)
'foo/bar/baz'.split(path.sep);
// Returns: ['foo', 'bar', 'baz']
```
On Windows:
```js
'foo\\bar\\baz'.split(path.sep)
'foo\\bar\\baz'.split(path.sep);
// Returns: ['foo', 'bar', 'baz']
```

15
doc/api/process.md

@ -509,8 +509,7 @@ console.log(`Starting directory: ${process.cwd()}`);
try {
process.chdir('/tmp');
console.log(`New directory: ${process.cwd()}`);
}
catch (err) {
} catch (err) {
console.error(`chdir: ${err}`);
}
```
@ -1398,8 +1397,7 @@ if (process.getegid && process.setegid) {
try {
process.setegid(501);
console.log(`New gid: ${process.getegid()}`);
}
catch (err) {
} catch (err) {
console.log(`Failed to set gid: ${err}`);
}
}
@ -1427,8 +1425,7 @@ if (process.geteuid && process.seteuid) {
try {
process.seteuid(501);
console.log(`New uid: ${process.geteuid()}`);
}
catch (err) {
} catch (err) {
console.log(`Failed to set uid: ${err}`);
}
}
@ -1455,8 +1452,7 @@ if (process.getgid && process.setgid) {
try {
process.setgid(501);
console.log(`New gid: ${process.getgid()}`);
}
catch (err) {
} catch (err) {
console.log(`Failed to set gid: ${err}`);
}
}
@ -1497,8 +1493,7 @@ if (process.getuid && process.setuid) {
try {
process.setuid(501);
console.log(`New uid: ${process.getuid()}`);
}
catch (err) {
} catch (err) {
console.log(`Failed to set uid: ${err}`);
}
}

8
doc/api/querystring.md

@ -80,7 +80,7 @@ in the following example:
// Assuming gbkDecodeURIComponent function already exists...
querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null,
{ decodeURIComponent: gbkDecodeURIComponent })
{ decodeURIComponent: gbkDecodeURIComponent });
```
## querystring.stringify(obj[, sep[, eq[, options]]])
@ -108,10 +108,10 @@ Any other input values will be coerced to empty strings.
For example:
```js
querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' })
querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' });
// returns 'foo=bar&baz=qux&baz=quux&corge='
querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':')
querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':');
// returns 'foo:bar;baz:qux'
```
@ -124,7 +124,7 @@ following example:
// Assuming gbkEncodeURIComponent function already exists,
querystring.stringify({ w: '中文', foo: 'bar' }, null, null,
{ encodeURIComponent: gbkEncodeURIComponent })
{ encodeURIComponent: gbkEncodeURIComponent });
```
## querystring.unescape(str)

4
doc/api/readline.md

@ -414,7 +414,7 @@ For instance: `[[substr1, substr2, ...], originalsubstring]`.
```js
function completer(line) {
const completions = '.help .error .exit .quit .q'.split(' ');
const hits = completions.filter((c) => { return c.indexOf(line) === 0 });
const hits = completions.filter((c) => { return c.indexOf(line) === 0; });
// show all completions if none found
return [hits.length ? hits : completions, line];
}
@ -492,7 +492,7 @@ const rl = readline.createInterface({
rl.prompt();
rl.on('line', (line) => {
switch(line.trim()) {
switch (line.trim()) {
case 'hello':
console.log('world!');
break;

32
doc/api/stream.md

@ -112,7 +112,7 @@ that implements an HTTP server:
```js
const http = require('http');
const server = http.createServer( (req, res) => {
const server = http.createServer((req, res) => {
// req is an http.IncomingMessage, which is a Readable Stream
// res is an http.ServerResponse, which is a Writable Stream
@ -280,7 +280,7 @@ has been called, and all data has been flushed to the underlying system.
```js
const writer = getWritableStreamSomehow();
for (var i = 0; i < 100; i ++) {
for (var i = 0; i < 100; i++) {
writer.write(`hello, #${i}!\n`);
}
writer.end('This is the end\n');
@ -483,18 +483,18 @@ possible to respect backpressure and avoid memory issues using the
[`'drain'`][] event:
```js
function write (data, cb) {
function write(data, cb) {
if (!stream.write(data)) {
stream.once('drain', cb)
stream.once('drain', cb);
} else {
process.nextTick(cb)
process.nextTick(cb);
}
}
// Wait for cb to be called before doing any other write.
write('hello', () => {
console.log('write completed, do more writes now')
})
console.log('write completed, do more writes now');
});
```
A Writable stream in object mode will always ignore the `encoding` argument.
@ -749,13 +749,13 @@ Readable. This is used primarily by the mechanism that underlies the
use this method directly.
```js
const readable = new stream.Readable
const readable = new stream.Readable();
readable.isPaused() // === false
readable.pause()
readable.isPaused() // === true
readable.resume()
readable.isPaused() // === false
readable.isPaused(); // === false
readable.pause();
readable.isPaused(); // === true
readable.resume();
readable.isPaused(); // === false
```
##### readable.pause()
@ -1065,7 +1065,7 @@ For example:
```js
const OldReader = require('./old-api-module.js').OldReader;
const Readable = require('stream').Readable;
const oreader = new OldReader;
const oreader = new OldReader();
const myReader = new Readable().wrap(oreader);
myReader.on('readable', () => {
@ -1906,12 +1906,12 @@ argument is passed to the `callback`, it will be forwarded on to the
`readable.push()` method. In other words the following are equivalent:
```js
transform.prototype._transform = function (data, encoding, callback) {
transform.prototype._transform = function(data, encoding, callback) {
this.push(data);
callback();
};
transform.prototype._transform = function (data, encoding, callback) {
transform.prototype._transform = function(data, encoding, callback) {
callback(null, data);
};
```

8
doc/api/url.md

@ -289,9 +289,9 @@ manner similar to that of a Web browser resolving an anchor tag HREF.
For example:
```js
url.resolve('/one/two/three', 'four') // '/one/two/four'
url.resolve('http://example.com/', '/one') // 'http://example.com/one'
url.resolve('http://example.com/one', '/two') // 'http://example.com/two'
url.resolve('/one/two/three', 'four'); // '/one/two/four'
url.resolve('http://example.com/', '/one'); // 'http://example.com/one'
url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
```
## Escaped Characters
@ -460,7 +460,7 @@ const myURL = new URL('https://example.org/foo');
console.log(myURL.href);
// Prints https://example.org/foo
myURL.href = 'https://example.com/bar'
myURL.href = 'https://example.com/bar';
// Prints https://example.com/bar
```

7
doc/api/util.md

@ -328,7 +328,8 @@ class Box {
// Five space padding because that's the size of "Box< ".
const padding = ' '.repeat(5);
const inner = util.inspect(this.value, newOptions).replace(/\n/g, '\n' + padding);
const inner = util.inspect(this.value, newOptions)
.replace(/\n/g, '\n' + padding);
return options.stylize('Box', 'special') + '< ' + inner + ' >';
}
}
@ -460,7 +461,7 @@ const util = require('util');
util.isArray([]);
// Returns: true
util.isArray(new Array);
util.isArray(new Array());
// Returns: true
util.isArray({});
// Returns: false
@ -696,7 +697,7 @@ util.isObject(null);
// Returns: false
util.isObject({});
// Returns: true
util.isObject(function(){});
util.isObject(function() {});
// Returns: false
```

4
doc/api/vm.md

@ -435,7 +435,7 @@ to the `http` module passed to it. For instance:
'use strict';
const vm = require('vm');
let code =
const code =
`(function(require) {
const http = require('http');
@ -448,7 +448,7 @@ let code =
console.log('Server running at http://127.0.0.1:8124/');
})`;
vm.runInThisContext(code)(require);
vm.runInThisContext(code)(require);
```
*Note*: The `require()` in the above case shares the state with the context it

29
doc/api/zlib.md

@ -65,9 +65,9 @@ const zlib = require('zlib');
const http = require('http');
const fs = require('fs');
const request = http.get({ host: 'example.com',
path: '/',
port: 80,
headers: { 'Accept-Encoding': 'gzip,deflate' } });
path: '/',
port: 80,
headers: { 'Accept-Encoding': 'gzip,deflate' } });
request.on('response', (response) => {
var output = fs.createWriteStream('example.com_index.html');
@ -125,15 +125,16 @@ method that is used to compressed the last chunk of input data:
// This is a truncated version of the buffer from the above examples
const buffer = Buffer.from('eJzT0yMA', 'base64');
zlib.unzip(buffer,
{finishFlush: zlib.constants.Z_SYNC_FLUSH},
(err, buffer) => {
if (!err) {
console.log(buffer.toString());
} else {
// handle error
}
});
zlib.unzip(
buffer,
{finishFlush: zlib.constants.Z_SYNC_FLUSH},
(err, buffer) => {
if (!err) {
console.log(buffer.toString());
} else {
// handle error
}
});
```
This will not change the behavior in other error-throwing situations, e.g.
@ -151,7 +152,7 @@ From `zlib/zconf.h`, modified to node.js's usage:
The memory requirements for deflate are (in bytes):
```js
(1 << (windowBits+2)) + (1 << (memLevel+9))
(1 << (windowBits + 2)) + (1 << (memLevel + 9));
```
That is: 128K for windowBits=15 + 128K for memLevel = 8
@ -169,7 +170,7 @@ This will, however, generally degrade compression.
The memory requirements for inflate are (in bytes)
```js
1 << windowBits
1 << windowBits;
```
That is, 32K for windowBits=15 (default value) plus a few kilobytes

Loading…
Cancel
Save