You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: buffers-and-streams/buffers.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,17 +2,19 @@
2
2
layout: default
3
3
title: Buffers in depth
4
4
url: buffers
5
+
author: john
6
+
date: 2019-11-14
5
7
---
6
8
7
9
## Buffers
8
10
9
-
Node's `Buffer` class enables working with binary data in Javascript. A buffer is allows a programme to store data temporarily outside the V8 engine's stack.
11
+
Node's `Buffer` class enables working with binary data in Javascript. A buffer allows a programme to store data temporarily outside the V8 engine's stack.
10
12
11
13
Though not entirely accurate we can think of a buffer as an array of bytes, each byte is represented by a hexadecimal digit.
12
14
13
15
The Node `Buffer` class is a global class and therefore does not need to be imported into a module.
14
16
15
-
### A simple example
17
+
### Example
16
18
17
19
```javascript
18
20
// create a buffer from a string
@@ -46,6 +48,8 @@ Buffers can also be instantiated by size using `Buffer.alloc()`, `Buffer.allocUn
46
48
47
49
> _Unsafe_ as the memory containing the buffer is not initialised - i.e. not zeroed-out, so the potential exists for sensitive data to be leaked.
Copy file name to clipboardExpand all lines: buffers-and-streams/streams.md
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,20 @@
2
2
layout: default
3
3
title: Streams in depth
4
4
url: streams
5
+
author: john
6
+
date: 2019-11-15
5
7
---
6
8
7
-
## Streams
9
+
## Streams
10
+
11
+
Node's `stream` module is an API for working with streaming data. Streams enable working with data as it is received rather than waiting for the data to be fully loaded into memory.
12
+
13
+
An example of streaming data is watching an online video broadcast. As the data is received the video can be displayed.
14
+
15
+
Streams are instances of [`EventEmitter`](#events).
0 commit comments