Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 053716a

Browse files
committed
Expose Buffer on ipfs objects
This lets you construct a Buffer even in browser code that doesn't have access to the Node Buffer global, so that you can pass it back to IPFS API calls that want a Buffer. Still need to do the documentation.
1 parent 7515aec commit 053716a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/core/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,9 @@ function IPFS (repoInstance) {
6666
this.files = files(this)
6767
this.bitswap = bitswap(this)
6868
this.ping = ping(this)
69+
70+
// Export Buffer to somewhere where API consumers can get at it, for when
71+
// we're running in a browser but still expect Buffer instances to be passed
72+
// in.
73+
this.Buffer = Buffer
6974
}

0 commit comments

Comments
 (0)