chunk_id large_stringlengths 36 36 | doc_type large_stringclasses 2
values | category large_stringclasses 17
values | document large_stringclasses 50
values | version_raw large_stringclasses 590
values | chunk_index int64 0 262 | text large_stringlengths 11 5.69k | file_path large_stringclasses 882
values |
|---|---|---|---|---|---|---|---|
deedf452-32fd-5087-88b4-db5a6a9e8982 | docs | nodejs | nodejs_crypto | 9x | 46 | The [`crypto.createSign()`](#crypto_crypto_createsign_algorithm_options) method is used to create `Sign` instances. The
argument is the string name of the hash function to use. `Sign` objects are not
to be created directly using the `new` keyword.
Example: Using `Sign` objects as streams:
```None
const crypto = requi... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
34a2b7df-e1b3-5bd4-a578-a47006010b64 | docs | nodejs | nodejs_crypto | 9x | 47 | const privateKey = getPrivateKeySomehow();
console.log(sign.sign(privateKey, 'hex'));
// Prints: the calculated signature
```
In some cases, a `Sign` instance can also be created by passing in a signature
algorithm name, such as 'RSA-SHA256'. This will use the corresponding digest
algorithm. This does not work for all... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
25c03a06-19c2-553b-8c48-cf32062ccf37 | docs | nodejs | nodejs_crypto | 9x | 48 | * `privateKey` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
+ `key` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
13917768-783e-59d6-9ad5-f44e0a5012b9 | docs | nodejs | nodejs_crypto | 9x | 49 | * `key`: [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - PEM encoded private key (required)
* `passphrase`: [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - passphrase for the private key
* `padding`: [<integer>](https://... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
d07a091f-c162-5fe3-b91c-0eadc99a375a | docs | nodejs | nodejs_crypto | 9x | 50 | size, `crypto.constants.RSA_PSS_SALTLEN_MAX_SIGN` (default) sets it to the
maximum permissible value.
The `outputFormat` can specify one of `'latin1'`, `'hex'` or `'base64'`. If
`outputFormat` is provided a string is returned; otherwise a [`Buffer`](buffer.html) is
returned.
The `Sign` object can not be again use... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
7f8640bc-b209-5bcb-90f8-dcd41a74af0e | docs | nodejs | nodejs_crypto | 9x | 51 | * `data` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
d6cc4c14-d5f4-555a-85ba-1ac8aa68722d | docs | nodejs | nodejs_crypto | 9x | 52 | ## Class: Verify[#](#crypto_class_verify)
Added in: v0.1.92
The `Verify` class is a utility for verifying signatures. It can be used in one
of two ways:
* As a writable [stream](stream.html) where written data is used to validate against the
supplied signature, or
* Using the [`verify.update()`](#crypto_verify_upd... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
ac26e321-cf4a-564a-ad41-4deecaad52e5 | docs | nodejs | nodejs_crypto | 9x | 53 | Example: Using the [`verify.update()`](#crypto_verify_update_data_inputencoding) and [`verify.verify()`](#crypto_verify_verify_object_signature_signatureformat) methods:
```None
const crypto = require('crypto');
const verify = crypto.createVerify('SHA256');
verify.update('some data to sign');
const publicKey = getPu... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
0a839407-76bf-5e63-971d-a3a9b071c49e | docs | nodejs | nodejs_crypto | 9x | 54 | * `data` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
28e211c5-57e8-535d-98c9-5d1885253ed8 | docs | nodejs | nodejs_crypto | 9x | 55 | ### verify.verify(object, signature[, signatureFormat])[#](#crypto_verify_verify_object_signature_signatureformat)
History
| Version | Changes |
| --- | --- |
| v8.0.0 | Support for RSASSA-PSS and additional options was added. |
| v0.1.92 | Added in: v0.1.92 |
* `object` [<string>](https://developer.mozilla.org/en-U... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
cf891b16-0d77-5aa6-b3be-94efd331976b | docs | nodejs | nodejs_crypto | 9x | 56 | Verifies the provided data using the given `object` and `signature`.
The `object` argument can be either a string containing a PEM encoded object,
which can be an RSA public key, a DSA public key, or an X.509 certificate,
or an object with one or more of the following properties:
* `key`: [<string>](https://developer.... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
97a7b824-8856-5102-aecb-556eb85043c0 | docs | nodejs | nodejs_crypto | 9x | 57 | * `saltLength`: [<integer>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) - salt length for when padding is
`RSA_PKCS1_PSS_PADDING`. The special value
`crypto.constants.RSA_PSS_SALTLEN_DIGEST` sets the salt length to the digest
size, `crypto.constants.RSA_PSS_SALTLEN_AUTO` (... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
3f511d1a-9aec-5d94-ba10-014bdaed7b90 | docs | nodejs | nodejs_crypto | 9x | 58 | ## `crypto` module methods and properties[#](#crypto_crypto_module_methods_and_properties)
### crypto.constants[#](#crypto_crypto_constants)
Added in: v6.3.0
Returns an object containing commonly used constants for crypto and security
related operations. The specific constants currently defined are described in
[Cry... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
8c72175e-ed9d-5c73-a075-e8635583945a | docs | nodejs | nodejs_crypto | 9x | 59 | ### crypto.fips[#](#crypto_crypto_fips)
Added in: v6.0.0
Property for checking and controlling whether a FIPS compliant crypto provider
is currently in use. Setting to true requires a FIPS build of Node.js.
### crypto.createCipher(algorithm, password[, options])[#](#crypto_crypto_createcipher_algorithm_password_opti... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
0dce5ab9-f91f-5250-9f64-46210dabde60 | docs | nodejs | nodejs_crypto | 9x | 60 | Creates and returns a `Cipher` object that uses the given `algorithm` and
`password`. Optional `options` argument controls stream behavior.
The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
recent OpenSSL releases, `openssl list-cipher-algorithms` will display the
available cipher algorithms.
... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
1cba6b7f-dca6-514d-bf21-86f8bf80e668 | docs | nodejs | nodejs_crypto | 9x | 61 | [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) it is recommended that developers derive a key and IV on
their own using [`crypto.pbkdf2()`](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback) and to use [`crypto.createCipheriv()`](#crypto_crypto_createcipheriv_al... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
85eec21c-9bdb-50d1-a9e8-e7a7cb9c045c | docs | nodejs | nodejs_crypto | 9x | 62 | | v0.1.94 | Added in: v0.1.94 |
* `algorithm` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
* `key` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://de... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
2b3e1f55-23ae-5e2b-af74-06fc5b69f9b8 | docs | nodejs | nodejs_crypto | 9x | 63 | * `options` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stream_transform_options)
Creates and returns a `Cipher` object, with the given `algorithm`, `key` and
initialization vector (`iv`). Optional `options` arg... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
ef4b461f-d245-5fde-8e2e-4ab40b2c2f23 | docs | nodejs | nodejs_crypto | 9x | 64 | ### crypto.createCredentials(details)[#](#crypto_crypto_createcredentials_details)
Added in: v0.1.92Deprecated since: v0.11.13
[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`tls.createSecureContext()`](tls.html#tls_tls_createsecurecontext_options) instead.
* `details` [<Object>]... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
896644b2-8369-5801-9b1f-e61b07897c18 | docs | nodejs | nodejs_crypto | 9x | 65 | ### crypto.createDecipher(algorithm, password[, options])[#](#crypto_crypto_createdecipher_algorithm_password_options)
Added in: v0.1.94
* `algorithm` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
* `password` [<string>](https://developer.mozilla.org/en-US/docs/Web/Ja... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
76542132-9c2b-5718-a0ab-3f40ca85137a | docs | nodejs | nodejs_crypto | 9x | 66 | The implementation of `crypto.createDecipher()` derives keys using the OpenSSL
function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.0.2/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one
iteration, and no salt. The lack of salt allows dictionary attacks as the same
password always creates th... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
94d1f9ea-aef1-5a97-9f1d-cb71b797ad1b | docs | nodejs | nodejs_crypto | 9x | 67 | ### crypto.createDecipheriv(algorithm, key, iv[, options])[#](#crypto_crypto_createdecipheriv_algorithm_key_iv_options)
History
| Version | Changes |
| --- | --- |
| v9.9.0 | The `iv` parameter may now be `null` for ciphers which do not need an initialization vector. |
| v0.1.94 | Added in: v0.1.94 |
* `algorithm` [... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
63b68c17-e9e2-57ce-81ed-bcc4b1a4de8f | docs | nodejs | nodejs_crypto | 9x | 68 | * `iv` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web/J... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
4586922c-79d0-5618-ae69-0acbf30bb987 | docs | nodejs | nodejs_crypto | 9x | 69 | [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded strings,
[Buffers](buffer.html), `TypedArray`, or `DataView`s. If the cipher does not need
an initialization vector, `iv` may be `null`.
### crypto.createDiffieHellman(prime[, primeEncoding][, generato... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
49c13190-291f-53d3-8afd-a314488f0cff | docs | nodejs | nodejs_crypto | 9x | 70 | * `prime` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/We... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
191a1103-4021-5a90-b73f-f543ec7a455d | docs | nodejs | nodejs_crypto | 9x | 71 | * `generatorEncoding` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
Creates a `DiffieHellman` key exchange object using the supplied `prime` and an
optional specific `generator`.
The `generator` argument can be a number, string, or [`Buffer`](buffer.html). If
`generat... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
1d54db1a-c7fb-5fe3-88eb-3e5edb6c03e0 | docs | nodejs | nodejs_crypto | 9x | 72 | * `generator` [<number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/Java... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
73fb6076-53b0-571f-a122-3d3609f25302 | docs | nodejs | nodejs_crypto | 9x | 73 | predefined curve specified by the `curveName` string. Use
[`crypto.getCurves()`](#crypto_crypto_getcurves) to obtain a list of available curve names. On recent
OpenSSL releases, `openssl ecparam -list_curves` will also display the name
and description of each available elliptic curve.
### crypto.createHash(algorithm[,... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
9cad6605-6b83-556d-9242-4c6e6abeaa8c | docs | nodejs | nodejs_crypto | 9x | 74 | On recent releases of OpenSSL, `openssl list-message-digest-algorithms` will
display the available digest algorithms.
Example: generating the sha256 sum of a file
```None
const filename = process.argv[2];
const crypto = require('crypto');
const fs = require('fs');
const hash = crypto.createHash('sha256');
const inp... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
c1180c9a-9bf5-53cb-8884-7885dd34e543 | docs | nodejs | nodejs_crypto | 9x | 75 | * `key` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web/... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
a8e778ed-fece-5389-ba38-24a30b9b7156 | docs | nodejs | nodejs_crypto | 9x | 76 | The `key` is the HMAC key used to generate the cryptographic HMAC hash.
Example: generating the sha256 HMAC of a file
```None
const filename = process.argv[2];
const crypto = require('crypto');
const fs = require('fs');
const hmac = crypto.createHmac('sha256', 'a secret');
const input = fs.createReadStream(filename... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
5ccd9a8a-c4e7-5fef-bf98-b12369d04820 | docs | nodejs | nodejs_crypto | 9x | 77 | Use [`crypto.getHashes()`](#crypto_crypto_gethashes) to obtain an array of names of the available
signing algorithms. Optional `options` argument controls the
`stream.Writable` behavior.
### crypto.createVerify(algorithm[, options])[#](#crypto_crypto_createverify_algorithm_options)
Added in: v0.1.92
* `algorithm` [<... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
b2f7f813-9d21-5345-b19e-76cf6f80cf33 | docs | nodejs | nodejs_crypto | 9x | 78 | ### crypto.getCiphers()[#](#crypto_crypto_getciphers)
Added in: v0.9.3
Returns an array with the names of the supported cipher algorithms.
Example:
```None
const ciphers = crypto.getCiphers();
console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...]
```
### crypto.getCurves()[#](#crypto_crypto_getcurves)
Adde... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
6c52f7a8-8790-5157-a684-fa558f623bc3 | docs | nodejs | nodejs_crypto | 9x | 79 | `'modp16'`, `'modp17'`, `'modp18'` (defined in [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt)). The
returned object mimics the interface of objects created by
[`crypto.createDiffieHellman()`](#crypto_crypto_creatediffiehellman_prime_primeencoding_generator_generatorencoding), but will not allow changing
the key... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
fd901bfb-d252-54e5-862d-f1958c7fa0a7 | docs | nodejs | nodejs_crypto | 9x | 80 | console.log(aliceSecret === bobSecret);
```
### crypto.getHashes()[#](#crypto_crypto_gethashes)
Added in: v0.9.3
Returns an array of the names of the supported hash algorithms,
such as `RSA-SHA256`.
Example:
```None
const hashes = crypto.getHashes();
console.log(hashes); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...]
```
... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
1f3cb5ef-088b-561f-b0a1-680b7b0c5510 | docs | nodejs | nodejs_crypto | 9x | 81 | * `password` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)
* `salt` [<string>](https://developer.mozilla.org/en-US... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
9f0568e9-60c3-56c1-8f32-fa3604809e0b | docs | nodejs | nodejs_crypto | 9x | 82 | + `err` [<Error>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)
+ `derivedKey` [<Buffer>](buffer.html#buffer_class_buffer)
Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2)
implementation. A selected HMAC digest algorithm specified by `digest` is
a... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
c4b408d4-f4b1-58ed-8dc2-bc1a9f558e6d | docs | nodejs | nodejs_crypto | 9x | 83 | The `salt` should also be as unique as possible. It is recommended that the
salts are random and their lengths are at least 16 bytes. See
[NIST SP 800-132](http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
Example:
```None
const crypto = require('crypto');
crypto.pbkdf2('secre... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
ab726f78-87e0-52c3-8e66-3e0f1c995d64 | docs | nodejs | nodejs_crypto | 9x | 84 | negative performance implications for some applications, see the
[`UV_THREADPOOL_SIZE`](cli.html#cli_uv_threadpool_size_size) documentation for more information.
### crypto.pbkdf2Sync(password, salt, iterations, keylen, digest)[#](#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen_digest)
History
| Version | ... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
3d59278d-8048-5a6f-8a94-ee22776d98ad | docs | nodejs | nodejs_crypto | 9x | 85 | * `salt` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)
* `iterations` [<number>](https://developer.mozilla.org/en-... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
c7697eb3-fd9d-513b-97e1-b24e2c3cfd86 | docs | nodejs | nodejs_crypto | 9x | 86 | The `iterations` argument must be a number set as high as possible. The
higher the number of iterations, the more secure the derived key will be,
but will take a longer amount of time to complete.
The `salt` should also be as unique as possible. It is recommended that the
salts are random and their lengths are at leas... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
051b3289-5d11-53e2-b8b7-0f55d59f44b0 | docs | nodejs | nodejs_crypto | 9x | 87 | [`crypto.getHashes()`](#crypto_crypto_gethashes).
### crypto.privateDecrypt(privateKey, buffer)[#](#crypto_crypto_privatedecrypt_privatekey_buffer)
Added in: v0.11.14
* `privateKey` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [<string>](https://developer.mozi... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
1f28c535-0e43-53ce-af6c-db594db9b8e2 | docs | nodejs | nodejs_crypto | 9x | 88 | * `buffer` [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView)
* Returns: [<Buffer>](buffer.html#buffer_class_bu... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
e7cdb00f-02a7-50d0-877a-9d41c0f9a270 | docs | nodejs | nodejs_crypto | 9x | 89 | + `key` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A PEM encoded private key.
+ `passphrase` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An optional passphrase for the private key.
+ `padding` [<crypto.constan... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
6da325de-16f2-5e6a-8bcb-19c6b0ef4f34 | docs | nodejs | nodejs_crypto | 9x | 90 | treated as the key with no passphrase and will use `RSA_PKCS1_PADDING`.
### crypto.publicDecrypt(key, buffer)[#](#crypto_crypto_publicdecrypt_key_buffer)
Added in: v1.1.0
* `key` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | [<string>](https://developer.mozilla... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
b011e044-e06a-51c6-807a-d8f3f40c0d47 | docs | nodejs | nodejs_crypto | 9x | 91 | * `buffer` [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView)
* Returns: [<Buffer>](buffer.html#buffer_class_bu... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
35446cde-2f65-5517-8508-57ce37e5cd7d | docs | nodejs | nodejs_crypto | 9x | 92 | + `key` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A PEM encoded public or private key.
+ `passphrase` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) An optional passphrase for the private key.
+ `padding` [<cryp... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
54693a96-f179-5e75-bb22-80fb373dfb38 | docs | nodejs | nodejs_crypto | 9x | 93 | [`Buffer`](buffer.html) with encrypted content.
`key` can be an object or a string. If `key` is a string, it is treated as
the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`.
Because RSA public keys can be derived from private keys, a private key may
be passed instead of a public key.
### crypto.random... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
b7a88cfd-a095-5bb6-889e-05ca7bdbee35 | docs | nodejs | nodejs_crypto | 9x | 94 | is a number indicating the number of bytes to generate.
If a `callback` function is provided, the bytes are generated asynchronously
and the `callback` function is invoked with two arguments: `err` and `buf`.
If an error occurs, `err` will be an Error object; otherwise it is null. The
`buf` argument is a [`Buffer`](bu... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
51a4cd49-ac60-59b6-b55d-ae458e937edf | docs | nodejs | nodejs_crypto | 9x | 95 | This should normally never take longer than a few milliseconds. The only time
when generating the random bytes may conceivably block for a longer period of
time is right after boot, when the whole system is still low on entropy.
Note that this API uses libuv's threadpool, which can have surprising and
negative perform... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
945c7d33-8b4c-5ae9-b4b0-6482cc6b343d | docs | nodejs | nodejs_crypto | 9x | 96 | * `buffer` [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) Must be supplied.
* `offset` [<number>](https://d... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
806cf284-68d2-5252-b14c-0bb6f3a01205 | docs | nodejs | nodejs_crypto | 9x | 97 | Any `TypedArray` or `DataView` instance may be passed as `buffer`.
```None
const a = new Uint32Array(10);
console.log(crypto.randomFillSync(a).toString('hex'));
const b = new Float64Array(10);
console.log(crypto.randomFillSync(a).toString('hex'));
const c = new DataView(new ArrayBuffer(10));
console.log(crypto.rando... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
99b17ad3-5ea6-5fa8-9fe3-8a926e3f678e | docs | nodejs | nodejs_crypto | 9x | 98 | * `offset` [<number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Defaults to `0`.
* `size` [<number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) Defaults to `buffer.length - offset`.
* `callback` [<Function>](https://developer.mozilla.o... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
1536ef98-593d-5cfc-a7f0-c2a575024bc4 | docs | nodejs | nodejs_crypto | 9x | 99 | crypto.randomFill(buf, 5, 5, (err, buf) => {
if (err) throw err;
console.log(buf.toString('hex'));
});
```
Any `TypedArray` or `DataView` instance may be passed as `buffer`.
```None
const a = new Uint32Array(10);
crypto.randomFill(a, (err, buf) => {
if (err) throw err;
console.log(buf.toString('hex'));
});
c... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
2831dff5-add0-54e3-8295-de26ff4804bf | docs | nodejs | nodejs_crypto | 9x | 100 | large `randomFill` requests when doing so as part of fulfilling a client
request.
### crypto.setEngine(engine[, flags])[#](#crypto_crypto_setengine_engine_flags)
Added in: v0.11.11
* `engine` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)
* `flags` [<crypto.constants>... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
1fe9ebfe-88a1-594b-9de0-bde9cac83d6f | docs | nodejs | nodejs_crypto | 9x | 101 | * `crypto.constants.ENGINE_METHOD_DIGESTS`
* `crypto.constants.ENGINE_METHOD_STORE`
* `crypto.constants.ENGINE_METHOD_PKEY_METHS`
* `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS`
* `crypto.constants.ENGINE_METHOD_ALL`
* `crypto.constants.ENGINE_METHOD_NONE`
### crypto.timingSafeEqual(a, b)[#](#crypto_crypto_timingsa... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
14f5a088-8160-5163-bc4e-bde5a3934d47 | docs | nodejs | nodejs_crypto | 9x | 102 | would allow an attacker to guess one of the values. This is suitable for
comparing HMAC digests or secret values like authentication cookies or
[capability urls](https://www.w3.org/TR/capability-urls/).
`a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they
must have the same length.
Use of `cryp... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
24f99b6e-f6f6-50fe-83cd-187394111f06 | docs | nodejs | nodejs_crypto | 9x | 103 | and returned `'latin1'` encoded strings by default rather than Buffers. This
default was changed after Node.js v0.8 to use [`Buffer`](buffer.html) objects by default
instead.
### Recent ECDH Changes[#](#crypto_recent_ecdh_changes)
Usage of `ECDH` with non-dynamically generated key pairs has been simplified.
Now, [`ec... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
77a56fc8-44b4-5182-8a04-76652421631a | docs | nodejs | nodejs_crypto | 9x | 104 | automatically generates the associated public key, or [`ecdh.generateKeys()`](#crypto_ecdh_generatekeys_encoding_format)
should be called. The main drawback of using [`ecdh.setPublicKey()`](#crypto_ecdh_setpublickey_publickey_encoding) is that
it can be used to put the ECDH key pair into an inconsistent state.
### Sup... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
beb3ba58-a345-5c67-811e-3d2bc4edd39d | docs | nodejs | nodejs_crypto | 9x | 105 | required such as digital signatures.
* The key used with RSA, DSA, and DH algorithms is recommended to have
at least 2048 bits and that of the curve of ECDSA and ECDH at least
224 bits, to be safe to use for several years.
* The DH groups of `modp1`, `modp2` and `modp5` have a key size
smaller than 2048 bits an... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
3ca4b740-83aa-5f4f-a7ad-9e347e0b4c92 | docs | nodejs | nodejs_crypto | 9x | 106 | | `SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION` | Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See <https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html>. |
| `SSL_OP_CIPHER_SERVER_PREFERENCE` | Attempts to use the server's preferences instead of the client's when se... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
f202597a-922a-51e9-bb53-e41fd1880e48 | docs | nodejs | nodejs_crypto | 9x | 107 | | `SSL_OP_LEGACY_SERVER_CONNECT` | Allows initial connection to servers that do not support RI. |
| `SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER` | |
| `SSL_OP_MICROSOFT_SESS_ID_BUG` | |
| `SSL_OP_MSIE_SSLV2_RSA_PADDING` | Instructs OpenSSL to disable the workaround for a man-in-the-middle protocol-version vulnerability in the... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
8f3ccbb1-dfc8-5307-b284-c2fba3154772 | docs | nodejs | nodejs_crypto | 9x | 108 | | `SSL_OP_NO_TLSv1` | Instructs OpenSSL to turn off TLS v1 |
| `SSL_OP_NO_TLSv1_1` | Instructs OpenSSL to turn off TLS v1.1 |
| `SSL_OP_NO_TLSv1_2` | Instructs OpenSSL to turn off TLS v1.2 |
`SSL_OP_PKCS1_CHECK_1` | || `SSL_OP_PKCS1_CHECK_2` | |
| `SSL_OP_SINGLE_DH_USE` | Instructs OpenSSL to always create a new key... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
ed71cf47-b63f-5d69-82f0-9ab9c58a6a05 | docs | nodejs | nodejs_crypto | 9x | 109 | | `ENGINE_METHOD_RAND` | Limit engine usage to RAND |
| `ENGINE_METHOD_ECDH` | Limit engine usage to ECDH |
| `ENGINE_METHOD_ECDSA` | Limit engine usage to ECDSA |
| `ENGINE_METHOD_CIPHERS` | Limit engine usage to CIPHERS |
| `ENGINE_METHOD_DIGESTS` | Limit engine usage to DIGESTS |
| `ENGINE_METHOD_STORE` | Limit engi... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
5a0be5d5-1bc4-5e0e-8e21-11627edfa03c | docs | nodejs | nodejs_crypto | 9x | 110 | | `RSA_PSS_SALTLEN_DIGEST` | Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the digest size when signing or verifying. |
| `RSA_PSS_SALTLEN_MAX_SIGN` | Sets the salt length for `RSA_PKCS1_PSS_PADDING` to the maximum permissible value when signing data. |
| `RSA_PSS_SALTLEN_AUTO` | Causes the salt length for `RSA_P... | large_dataset/raw/docs/nodejs/crypto/crypto_9x.md |
764b97db-8c80-5c2b-80b0-b47c1338040b | docs | nodejs | nodejs_stream | 010x | 0 | # Stream#
Source: https://nodejs.org/docs/latest-v0.10.x/api/stream.html
Version: 0.10.x
```None
Stability: 2 - Unstable
```
A stream is an abstract interface implemented by various objects in
Node. For example a [request to an HTTP
server](http.html#http_http_incomingmessage) is a stream, as is
[stdout](process.htm... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
b4bd7872-4c29-5476-9de4-d8c79ef712a7 | docs | nodejs | nodejs_stream | 010x | 1 | The second section explains the parts of the API that you need to use
if you implement your own custom streams yourself. The API is
designed to make this easy for you to do.
The third section goes into more depth about how streams work,
including some of the internal mechanisms and functions that you
should probably n... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
8ffdc07c-ec6e-53af-8ac5-cc4741fe313e | docs | nodejs | nodejs_stream | 010x | 2 | somewhat different.
It is not necessary to implement Stream interfaces in order to consume
streams in your programs. If you **are** implementing streaming
interfaces in your own program, please also refer to
[API for Stream Implementors](#stream_api_for_stream_implementors) below.
Almost all Node programs, no matter ... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
34d66788-71df-512f-ae8c-dc5099fbf8e8 | docs | nodejs | nodejs_stream | 010x | 3 | var data = JSON.parse(body);
} catch (er) {
// uh oh! bad json!
res.statusCode = 400;
return res.end('error: ' + er.message);
}
// write back something interesting to the user:
res.write(typeof data);
res.end();
})
})
server.listen(1337);
// $ curl localhost:1337 -d '{}... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
3c9f390b-f4d1-5767-83de-340fb062637a | docs | nodejs | nodejs_stream | 010x | 4 | mode, you must explicitly call `stream.read()` to get chunks of data
out.
Examples of readable streams include:
* [http responses, on the client](http.html#http_http_incomingmessage)
* [http requests, on the server](http.html#http_http_incomingmessage)
* [fs read streams](fs.html#fs_class_fs_readstream)
* [zlib strea... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
4cf1db54-e71e-5c89-a42b-e8acfc5b9e7b | docs | nodejs | nodejs_stream | 010x | 5 | Once the internal buffer is drained, a `readable` event will fire
again when more data is available.
#### Event: 'data'[#](#stream_event_data)
* `chunk` Buffer | String The chunk of data.
If you attach a `data` event listener, then it will switch the stream
into flowing mode, and data will be passed to your handler ... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
9e28038c-e070-5ba4-9743-9c8fefc56362 | docs | nodejs | nodejs_stream | 010x | 6 | console.log('got %d bytes of data', chunk.length);
})
readable.on('end', function() {
console.log('there will be no more data.');
});
```
#### Event: 'close'[#](#stream_event_close)
Emitted when the underlying resource (for example, the backing file
descriptor) has been closed. Not all streams will emit this.
##... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
895a3188-d1e1-5790-870b-e7291a505c5d | docs | nodejs | nodejs_stream | 010x | 7 | flowing-mode, this method is called automatically until the internal
buffer is drained.
```None
var readable = getReadableStreamSomehow();
readable.on('readable', function() {
var chunk;
while (null !== (chunk = readable.read())) {
console.log('got %d bytes of data', chunk.length);
}
});
```
#### readable.s... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
3d371a38-35ec-5ce3-9ea7-82a8e4da6471 | docs | nodejs | nodejs_stream | 010x | 8 | var readable = getReadableStreamSomehow();
readable.setEncoding('utf8');
readable.on('data', function(chunk) {
assert.equal(typeof chunk, 'string');
console.log('got %d characters of string data', chunk.length);
})
```
#### readable.resume()[#](#stream_readable_resume)
This method will cause the readable stream t... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
bd66a9ca-da42-5111-b229-0b5cf8d4437e | docs | nodejs | nodejs_stream | 010x | 9 | non-flowing stream, it will switch into flowing mode, but remain
paused.
```None
var readable = getReadableStreamSomehow();
readable.on('data', function(chunk) {
console.log('got %d bytes of data', chunk.length);
readable.pause();
console.log('there will be no more data for 1 second');
setTimeout(function() {
... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
1f40e639-9aa0-57d3-a2d3-3adb54601345 | docs | nodejs | nodejs_stream | 010x | 10 | var writable = fs.createWriteStream('file.txt');
// All the data from readable goes into 'file.txt'
readable.pipe(writable);
```
This function returns the destination stream, so you can set up pipe
chains like so:
```None
var r = fs.createReadStream('file.txt');
var z = zlib.createGzip();
var w = fs.createWriteStream... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
861e4991-4ea9-510e-84d3-674203533ef7 | docs | nodejs | nodejs_stream | 010x | 11 | #### readable.unpipe([destination])[#](#stream_readable_unpipe_destination)
* `destination` [Writable](#stream_class_stream_writable) Stream Optional specific stream to unpipe
This method will remove the hooks set up for a previous `pipe()` call.
If the destination is not specified, then all pipes are removed.
If t... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
905db7d9-966c-5a08-9405-a768a8fc3e2f | docs | nodejs | nodejs_stream | 010x | 12 | parser, which needs to "un-consume" some data that it has
optimistically pulled out of the source, so that the stream can be
passed on to some other party.
If you find that you must often call `stream.unshift(chunk)` in your
programs, consider implementing a [Transform](#stream_class_stream_transform) stream instead. ... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
1cf55495-5962-5b81-821c-c91065f1faf8 | docs | nodejs | nodejs_stream | 010x | 13 | var remaining = split.join('\n\n');
var buf = new Buffer(remaining, 'utf8');
if (buf.length)
stream.unshift(buf);
stream.removeListener('error', callback);
stream.removeListener('readable', onReadable);
// now the body of the message can be read from the stream.... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
8f0bb52d-ceec-5b99-b741-e862a1436393 | docs | nodejs | nodejs_stream | 010x | 14 | You will very rarely ever need to call this function, but it exists
as a convenience for interacting with old Node programs and libraries.
For example:
```None
var OldReader = require('./old-api-module.js').OldReader;
var oreader = new OldReader;
var Readable = require('stream').Readable;
var myReader = new Readable(... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
40eb6a21-e64d-54f6-859c-f21c6a1a4bd5 | docs | nodejs | nodejs_stream | 010x | 15 | * [process.stdout](process.html#process_process_stdout), [process.stderr](process.html#process_process_stderr)
#### writable.write(chunk, [encoding], [callback])[#](#stream_writable_write_chunk_encoding_callback)
* `chunk` String | Buffer The data to write
* `encoding` String The encoding, if `chunk` is a String
* `c... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
25e4a561-75b4-5dd3-bee4-13a850414792 | docs | nodejs | nodejs_stream | 010x | 16 | #### Event: 'drain'[#](#stream_event_drain)
If a [`writable.write(chunk)`](#stream_writable_write_chunk_encoding_callback) call returns false, then the `drain`
event will indicate when it is appropriate to begin writing more data
to the stream.
```None
// Write the data to the supplied writable stream 1MM times.
// B... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
2cb7c9e0-dcf6-5e43-8ab1-5957329c02de | docs | nodejs | nodejs_stream | 010x | 17 | #### writable.end([chunk], [encoding], [callback])[#](#stream_writable_end_chunk_encoding_callback)
* `chunk` String | Buffer Optional data to write
* `encoding` String The encoding, if `chunk` is a String
* `callback` Function Optional callback for when the stream is finished
Call this method when no more data will ... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
44889cad-81c0-5d6d-ac4f-5b5bac75a54d | docs | nodejs | nodejs_stream | 010x | 18 | #### Event: 'finish'[#](#stream_event_finish)
When the [`end()`](#stream_writable_end_chunk_encoding_callback) method has been called, and all data has been flushed
to the underlying system, this event is emitted.
```None
var writer = getWritableStreamSomehow();
for (var i = 0; i < 100; i ++) {
writer.write('hello,... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
77d2727d-02d3-5b4b-a205-7f4a955b8ba5 | docs | nodejs | nodejs_stream | 010x | 19 | #### Event: 'unpipe'[#](#stream_event_unpipe)
* `src` [Readable](#stream_class_stream_readable) Stream The source stream that [unpiped](#stream_readable_unpipe_destination) this writable
This is emitted whenever the [`unpipe()`](#stream_readable_unpipe_destination) method is called on a
readable stream, removing this... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
d8cbbf3f-f9a8-5ac7-9fe7-1c730a2d86fc | docs | nodejs | nodejs_stream | 010x | 20 | * [tcp sockets](net.html#net_class_net_socket)
* [zlib streams](zlib.html)
* [crypto streams](crypto.html)
### Class: stream.Transform[#](#stream_class_stream_transform)
Transform streams are [Duplex](#stream_class_stream_duplex) streams where the output is in some way
computed from the input. They implement both the... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
37a73ab0-ff7d-5dbd-b594-783fc9e04934 | docs | nodejs | nodejs_stream | 010x | 21 | 3. Implement one or more specific methods, as detailed below.
The class to extend and the method(s) to implement depend on the sort
of stream class you are writing:
| Use-case | Class | Method(s) to implement |
| --- | --- | --- |
| Reading only | [Readable](#stream_class_stream_readable_1) | `_read` |
| Writing only... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
d3d8c950-fe15-5be5-885a-3e37ffcf4576 | docs | nodejs | nodejs_stream | 010x | 22 | ### Class: stream.Readable[#](#stream_class_stream_readable_1)
`stream.Readable` is an abstract class designed to be extended with an
underlying implementation of the [`_read(size)`](#stream_readable_read_size_1) method.
Please see above under [API for Stream Consumers](#stream_api_for_stream_consumers) for how to co... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
b4121b38-863c-5250-912a-11e04047936b | docs | nodejs | nodejs_stream | 010x | 23 | this.push(buf);
}
};
```
#### Example: SimpleProtocol v1 (Sub-optimal)[#](#stream_example_simpleprotocol_v1_sub_optimal)
This is similar to the `parseHeader` function described above, but
implemented as a custom stream. Also, note that this implementation
does not convert the incoming data to a string.
However... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
30140426-83e8-5cb8-bf29-934f57845915 | docs | nodejs | nodejs_stream | 010x | 24 | Readable.call(this, options);
this._inBody = false;
this._sawFirstCr = false;
// source is a readable stream, such as a socket or file
this._source = source;
var self = this;
source.on('end', function() {
self.push(null);
});
// give it a kick whenever the source is readable
// read(0) will n... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
f7cc50db-e991-5663-9fba-0bba9f94aaed | docs | nodejs | nodejs_stream | 010x | 25 | if (split === -1) {
// still waiting for the \n\n
// stash the chunk, and try again.
this._rawHeader.push(chunk);
this.push('');
} else {
this._inBody = true;
var h = chunk.slice(0, split);
this._rawHeader.push(h);
var header = Buffer.concat(this._rawHeader).toStr... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
d1f07de9-1d39-5ec8-a2dd-1b44812c137f | docs | nodejs | nodejs_stream | 010x | 26 | // var parser = new SimpleProtocol(source);
// Now parser is a readable stream that will emit 'header'
// with the parsed header data.
```
#### new stream.Readable([options])[#](#stream_new_stream_readable_options)
* `options` Object
+ `highWaterMark` Number The maximum number of bytes to store in
the internal ... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
1ac4c265-1df9-5b39-8374-c973711a5552 | docs | nodejs | nodejs_stream | 010x | 27 | #### readable.\_read(size)[#](#stream_readable_read_size_1)
* `size` Number Number of bytes to read asynchronously
Note: **Implement this function, but do NOT call it directly.**
This function should NOT be called directly. It should be implemented
by child classes, and only called by the internal Readable class
met... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
d9abd1e6-945a-5d9e-bdb0-e8c9ff635cbb | docs | nodejs | nodejs_stream | 010x | 28 | fetch. Implementations where that is not relevant, such as TCP or
TLS, may ignore this argument, and simply provide data whenever it
becomes available. There is no need, for example to "wait" until
`size` bytes are available before calling [`stream.push(chunk)`](#stream_readable_push_chunk_encoding).
#### readable.pus... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
4c0902e4-fba1-513e-b71e-c1998325555a | docs | nodejs | nodejs_stream | 010x | 29 | The `push()` method will explicitly insert some data into the read
queue. If it is called with `null` then it will signal the end of the
data (EOF).
This API is designed to be as flexible as possible. For example,
you may be wrapping a lower-level source which has some sort of
pause/resume mechanism, and a data callba... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
c2b9a908-d9a4-5386-805d-324b18fefdde | docs | nodejs | nodejs_stream | 010x | 30 | };
// When the source ends, we push the EOF-signalling `null` chunk
this._source.onend = function() {
self.push(null);
};
}
// _read will be called when the stream wants to pull more data in
// the advisory size argument is ignored in this case.
SourceWrapper.prototype._read = function(size) {
this._sou... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
4f175300-9846-5103-9982-fee70a2bddb5 | docs | nodejs | nodejs_stream | 010x | 31 | #### new stream.Writable([options])[#](#stream_new_stream_writable_options)
* `options` Object
+ `highWaterMark` Number Buffer level when [`write()`](#stream_writable_write_chunk_encoding_callback) starts
returning false. Default=16kb
+ `decodeStrings` Boolean Whether or not to decode strings into
Buffers ... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
1baba749-898f-5625-8ba1-b4041e983faa | docs | nodejs | nodejs_stream | 010x | 32 | * `encoding` String If the chunk is a string, then this is the
encoding type. Ignore chunk is a buffer. Note that chunk will
**always** be a buffer unless the `decodeStrings` option is
explicitly set to `false`.
* `callback` Function Call this function (optionally with an error
argument) when you are done proce... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
35e50a4f-9188-56d3-a840-111375da4b3a | docs | nodejs | nodejs_stream | 010x | 33 | implementations that have an optimized handling for certain string
data encodings. If you do not explicitly set the `decodeStrings`
option to `false`, then you can safely ignore the `encoding` argument,
and assume that `chunk` will always be a Buffer.
This method is prefixed with an underscore because it is internal t... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
97da5db6-338f-551c-81ee-f7522a7582de | docs | nodejs | nodejs_stream | 010x | 34 | class prototypally inherits from Readable, and then parasitically from
Writable. It is thus up to the user to implement both the lowlevel
`_read(n)` method as well as the lowlevel
[`_write(chunk, encoding, callback)`](#stream_writable_write_chunk_encoding_callback_1) method on extension duplex classes.
#### new stream... | large_dataset/raw/docs/nodejs/stream/stream_010x.md |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.