robertbira

Italian Translation Report: Node.js [Part 23 - 1339 words]

Aug 9th, 2018
99
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Optional specific stream to unpipe
  2. The method detaches a stream previously attached using the method.
  3. If the is not specified, then all pipes are detached.
  4. If the is specified, but no pipe is set up for it, then the method does nothing.
  5. All the data from readable goes into but only for the first second
  6. Chunk of data to unshift onto the read queue.
  7. For streams not operating in object mode, must be a string,
  8. For object mode streams, may be any JavaScript value other than
  9. The method pushes a chunk of data back into the internal buffer.
  10. This is useful in certain situations where a stream is being consumed by code that needs to "un-consume" some amount of data that it has optimistically pulled out of the source, so that the data can be passed on to some other party.
  11. The method cannot be called after the event has been emitted or a runtime error will be thrown.
  12. Developers using often should consider switching to use of a stream instead.
  13. See the API for Stream Implementers section for more information.
  14. Pull off a header delimited by
  15. use if we get too much
  16. Call the callback with
  17. found the header boundary
  18. remove the listener before unshifting
  19. now the body of the message can be read from the stream.
  20. still reading the header.
  21. Unlike, will not end the reading process by resetting the internal reading state of the stream.
  22. This can cause unexpected results if is called during a read (i.e. from within a implementation on a custom stream).
  23. Following the call to with an immediate will reset the reading state appropriately, however it is best to simply avoid calling while in the process of performing a read.
  24. An "old style" readable stream
  25. Versions of Node.js prior to v0.10 had streams that did not implement the entire module API as it is currently defined.
  26. (See Compatibility for more information.)
  27. When using an older Node.js library that emits events and has a method that is advisory only, the method can be used to create a stream that uses the old stream as its data source.
  28. It will rarely be necessary to use but the method has been provided as a convenience for interacting with older Node.js applications and libraries.
  29. Stability: 1 - Experimental
  30. to fully consume the stream.
  31. If the loop terminates with a or a, the stream will be destroyed.
  32. In other terms, iterating over a stream will consume the stream fully.
  33. The stream will be read in chunks of size equal to the option.
  34. In the code example above, data will be in a single chunk if the file has less then 64kb of data because no option is provided to
  35. Duplex and Transform Streams
  36. Duplex streams are streams that implement both the and interfaces.
  37. Examples of streams include:
  38. Transform streams are streams where the output is in some way related to the input.
  39. Like all streams, streams implement both the and interfaces.
  40. Destroy the stream, and emit
  41. After this call, the transform stream would release any internal resources.
  42. implementors should not override this method, but instead implement
  43. The default implementation of for also emit
  44. A and/or stream
  45. A callback function that takes an optional error argument.
  46. A function to get notified when a stream is no longer readable, writable or has experienced an error or a premature close event.
  47. drain the stream
  48. Especially useful in error handling scenarios where a stream is destroyed prematurely (like an aborted HTTP request), and will not emit or
  49. The API is promisify'able as well;
  50. Two or more streams to pipe between.
  51. A module method to pipe between streams forwarding errors and properly cleaning up and provide a callback when the pipeline is complete.
  52. Use the pipeline API to easily pipe a series of streams together and get notified when the pipeline is fully done.
  53. A pipeline to gzip a potentially huge tar file efficiently:
  54. API for Stream Implementers
  55. The module API has been designed to make it possible to easily implement streams using JavaScript's prototypal inheritance model.
  56. First, a stream developer would declare a new JavaScript class that extends one of the four basic stream classes ( or ), making sure they call the appropriate parent class constructor:
  57. The new stream class must then implement one or more specific methods, depending on the type of stream being created, as detailed in the chart below:
  58. Use-case
  59. Class
  60. Method(s) to implement
  61. The implementation code for a stream should never call the "public" methods of a stream that are intended for use by consumers (as described in the section).
  62. Doing so may lead to adverse side effects in application code consuming the stream.
  63. Simplified Construction
  64. For many simple cases, it is possible to construct a stream without relying on inheritance.
  65. This can be accomplished by directly creating instances of the or objects and passing appropriate methods as constructor options.
  66. Implementing a Writable Stream
  67. The class is extended to implement a stream.
  68. Custom streams must call the constructor and implement the method.
  69. The method may also be implemented.
  70. Buffer level when starts returning
  71. Whether or not to decode strings into before passing them to
  72. Whether or not the is a valid operation.
  73. When set, it becomes possible to write JavaScript values other than string, or if supported by the stream implementation.
  74. Whether or not the stream should emit after it has been destroyed.
  75. Implementation for the method
  76. Calls the constructor
  77. Or, when using pre-ES6 style constructors:
  78. Or, using the Simplified Constructor approach:
  79. The chunk to be written.
  80. Will always be a buffer unless the option was set to or the stream is operating in object mode.
  81. If the chunk is a string, then is the character encoding of that string.
  82. If chunk is a, or if the stream is operating in object mode, may be ignored.
  83. Call this function (optionally with an error argument) when processing is complete for the supplied chunk.
  84. All stream implementations must provide a method to send data to the underlying resource.
  85. streams provide their own implementation of the
  86. This function MUST NOT be called by application code directly.
  87. It should be implemented by child classes, and called by the internal class methods only.
  88. The method must be called to signal either that the write completed successfully or failed with an error.
  89. The first argument passed to the must be the object if the call failed or if the write succeeded.
  90. All calls to that occur between the time is called and the is called will cause the written data to be buffered.
  91. When the is invoked, the stream might emit a event.
  92. If a stream implementation is capable of processing multiple chunks of data at once, the method should be implemented.
  93. If the property is explicitly set to in the constructor options, then will remain the same object that is passed to and may be a string rather than a
  94. This is to support implementations that have an optimized handling for certain string data encodings.
  95. In that case, the argument will indicate the character encoding of the string.
  96. Otherwise, the argument can be safely ignored.
  97. The method is prefixed with an underscore because it is internal to the class that defines it, and should never be called directly by user programs.
  98. Each chunk has following format:
  99. A callback function (optionally with an error argument) to be invoked when processing is complete for the supplied chunks.
  100. The method may be implemented in addition to in stream implementations that are capable of processing multiple chunks of data at once.
  101. If implemented, the method will be called with all chunks of data currently buffered in the write queue.
  102. The method is called by
  103. It can be overridden by child classes but it must not be called directly.
  104. It may be implemented by child classes, and if so, will be called by the internal class methods only.
  105. This optional function will be called before the stream closes, delaying the event until is called.
  106. This is useful to close resources or write buffered data before a stream ends.
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×