How to use bl

Comprehensive bl code examples:

How to use bl.BufferList:

92
93
94
95
96
97
98
99
100
101
// you usually go content.toString() after this...
const getFromIPFS = async hashToGet => {
  for await (const file of ipfs.get(hashToGet)) {
    console.log(file.path);
    if (!file.content) continue;
    const content = new BufferList();
    for await (const chunk of file.content) {
      content.append(chunk);
    }
    console.log(content);

How to use bl.BufferListStream:

52
53
54
55
56
57
58
59
60
61
62
63
64


class StdinDiscarder {
  constructor() {
    this.requests = 0;


    this.mutedStream = new BufferListStream();
    this.mutedStream.pipe(process.stdout);


    const self = this;